clear all;%clear the values
clc;%clear the command window
tic
strhead = '5';%the name of file
strtail = '.bmp' ;% the format of the file
str = strcat(strhead,strtail);
img = im2double(imread(str));%read the image and convert to double.
N = 15;%the size of filter
sigma = [100 , 0.3];%the parameters of bilateral filter
retimg = bialteral(img , N , sigma );%get the illumination image
subplot(1,3,1);imshow(img);title('the original image');
subplot(1,3,2);imshow(retimg);title('the illumination image');
%% s-l
img_copy = rgb2hsv(img);
img_copy3 = log(img_copy(:,:,3));
retimg_copy = rgb2hsv(retimg);
retimg_copy3 = log(retimg_copy(:,:,3));%only to v layer
r_img = img_copy3 - retimg_copy3;
r_img = exp(r_img);
N = 4;
sigma = [100,0.3];
retinex_img(:,:,3) = bialteral2(r_img,N,sigma);%get reflect image
dim = size(img);
for i = 1:dim(1)
for j = 1:dim(2)
img_copy(i,j,3) = img_copy(i,j,3)^(1/3);
end
end
retinex_img(:,:,3) = retinex_img(:,:,3).*(img_copy(:,:,3));
retinex_img(:,:,1) = img_copy(:,:,1);
retinex_img(:,:,2) = img_copy(:,:,2);
retinex_img = hsv2rgb(retinex_img);
%% Gamma-correction
% dim = size(img);
% for i = 1:dim(1)
% for j = 1:dim(2)
% for c=1:3
% img(i,j,c) = img(i,j,c)^(1/3);
% end
% end
% end
% retinex_img(:,:,1) = retinex_img(:,:,1).*(img(:,:,1));
% retinex_img(:,:,2) = retinex_img(:,:,2).*(img(:,:,2));
% retinex_img(:,:,3) = retinex_img(:,:,3).*(img(:,:,3));
subplot(1,3,3);imshow(retinex_img);title('the retinex image');
% string=strcat(strhead,'_retinex.bmp');
% imwrite(retinex_img,string,'bmp');
t=toc
海神之光
- 粉丝: 5w+
- 资源: 6110
最新资源
- 单个IO口检测多个按键
- 汇川EASY32x固件6.3.0.0
- 高分成品毕业设计《基于SSM(Spring、Spring MVC、MyBatis)+MySQL开发个人财务管理系统》+源码+论文+说明文档+数据库
- 高分成品毕业设计《基于SSM(Spring、Spring MVC、MyBatis)+MySQL开发B2C电子商务平台》+源码+论文+说明文档+数据库
- HKJC_3in1_TR_PROD_L3.0R1An_Build10229.apk
- 高分成品毕业设计《基于SSM(Spring、Spring MVC、MyBatis)+MySQL开发高校实验室资源综合管理系统》+源码+论文+说明文档+数据库
- 高分成品毕业设计《基于SSM(Spring、Spring MVC、MyBatis)+MySQL开发校医务系统》+源码+论文+说明文档+数据库
- 硕博士毕业率历史数据(2003-2022年).xlsx
- 高分成品毕业设计《基于SSM(Spring、Spring MVC、MyBatis)+MySQL开发供电公司安全生产考试系统》+源码+论文+说明文档+数据库
- 本科生毕业设计.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈