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+
- 资源: 6477
最新资源
- PLC立体车库智能仿真 博途V15 3×2立体车库 西门子1200PLC 触摸屏仿真 不需要实物 自带人机界面 小车上下行有电梯效果 每一个程序段都有注释 FC块标准化编写 自带变频器输出也可以仿真
- 配电网有功电压控制的多智能体强化学习(代码) 针对电压主动控制问题的不同场景,采用7种最先进的MARL算法进行了大规模实验,将电压约束转化为势垒函数,并从实验结果中观察到设计合适的电压势垒函数的重要性
- COMSOL 远场偏振通用计算方法,包含远场偏振图,能带,matlab 程序 展示包含仿真文件截图,所见即所得
- 西门子V90效率倍增-伺服驱动功能库详解-简易非循环功能库之绝对值编码器校准.mp4
- 运输工具检测17-YOLO(v5至v9)、COCO、CreateML、Paligemma、TFRecord数据集合集.rar
- 储能选址定容,33节点,matpower潮流计算,计算目标函数 考虑储能SOC、储能额定容量、功率约束 NSGA2多目标:储能投资费用和电压偏差最小 熵权TOPSIS确定最优解
- 六轴,scara机器人运动学分析,建模和运动控制 matlab,simulink,simscape.机器人工具箱,DH建模 Pd控制,滑模控制,模糊控制等等
- 车辆,汽车检测1-YOLO(v5至v11)、COCO、CreateML、Paligemma、TFRecord、VOC数据集合集.rar
- 美国旧金山28R粗糙跑道数据
- mp3转换器小程序-音频20241222115740.mp3
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈