资源简介
该算法是基于retinex理论的,在图像去雾上取得了很好的成果,基本和何凯明的暗通道去雾算法相媲美
代码片段和文件信息
clear
clc
tic
%*****************参数***********
k1=225;
k2=3000;
k3=80000;
k4=10000;
r=81;
c = 0.01;
nn=floor((r+1)/2); % 计算中心
% nn=0;
string = ‘night3‘;
string1 = [string ‘.bmp‘];
I = imread(string1);
subplot(131);
imshow(I);
f=I(::1);
ff=I(::2);
fff=I(::3);
Img1 = double(f);
Img2 = double(ff);
Img3 = double(fff);
[mn]=size(f);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
b = zeros(rr);
bb = zeros(rr);
bbb = zeros(rr);
for i=1:r
for j=1:r
b(ij) =exp(-((i-nn)^2+(j-nn)^2)/k1)/k4; %高斯函数1
end
end
tiaojie1 = 1/sum(sum(b));
b = tiaojie1.*b;
for i=1:r
for j=1:r
bb(ij) =exp(-((i-nn)^2+(j-nn)^2)/k2)/k4; %高斯函数2
end
end
tiaojie2 = 1/sum(sum(bb));
bb = tiaojie2.*bb;
for i=1:r
for j=1:r
bbb(ij) =exp(-((i-nn)^2+(j-nn)^2)/k3)/k4; %高斯函数3
end
end
tiaojie3 = 1/sum(sum(bbb));
bbb = tiaojie3.*bbb;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%对R分量的处理%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
K=imfilter(Img1b);
KK=imfilter(Img1bb);
KKK=imfilter(Img1bbb);
G = zeros(mn);
for i=1:m
for j=1:n
G(ij)=1/3*(log(Img1(ij)+c)-log(K(ij)+c));
G(ij)=1/3*(log(Img1(ij)+c)-log(KK(ij)+c))+G(ij);
G(ij)=1/3*(log(Img1(ij)+c)-log(KKK(ij)+c))+G(ij);
end
end
G = 3*G+50;
mi=min(min(G));
ma=max(max(G));
L=(G-mi)*255/(ma-mi);
%%%%%%%%%%%%%%对G分量的处理%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
K=imfilter(Img2b);
KK=imfilter(Img2bb);
KKK=imfilter(Img2bbb);
for i=1:m
for j=1:n
G(ij)=1/3*(log(Img2(ij)+c)-log(K(ij)+c));
G(ij)=1/3*(log(Img2(ij)+c)-log(KK(ij)+c))+G(ij);
G(ij)=1/3*(log(Img2(ij)+c)-log(KKK(ij)+c))+G(ij);
end
end
G = 3*G+50;
mi=min(min(G));
ma=max(max(G));
LL=(G-mi)*255/(ma-mi);
%%%%%%%%%%%%%随B分量的处理%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
K=imfilter(Img3b);
KK=imfilter(Img3bb);
KKK=imfilter(Img3bbb);
for i=1:m
for j=1:n
G(ij)=1/3*(log(Img3(ij)+c)-log(K(ij)+c));
G(ij)=1/3*(log(Img3(ij)+c)-log(KK(ij)+c))+G(ij);
G(ij)=1/3*(log(Img3(ij)+c)-log(KKK(ij)+c))+G(ij);
end
end
G = 3*G+50;
mi=min(min(G));
ma=max(max(G));
LLL=(G-mi)*255/(ma-mi);
%%%%%%%%%%%%对彩色图像的综合处理 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I(::1)= L;
I1 = adapthisteq(I(::1));
I(::2)= LL;
I2 = adapthisteq(I(::2));
I(::3)= LLL;
I3 = adapthisteq(I(::3));
msr1 = cat(3LLLLLL);
msr2 = cat(3I1I2I3);
subplot(132);
imshow(uint8(msr1));
subplot(133);
imshow(uint8(msr2));
string2 = [string ‘result.jpg‘];
imwrite(uint8(msr2)string2);
toc
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-03-04 22:10 retinex\
文件 2684 2011-03-03 14:52 retinex\retinex.m
- 上一篇:离散数学(第五版耿素云,屈婉玲著 课后答案
- 下一篇:yum.repos.d.zip
相关资源
- 奇数场、偶数场还原方法
- 图像融合源图像红外与可见光
- 数字图像处理实验项目_Laboratory Proj
- 图像处理光流法
- BP神经网络实现图像压缩,精解含代码
- 信息隐藏 二值图像的隐藏 MD5
- 低比特率图像压缩
- Opencv+Tensorflow入门人工智能处理无密完
- 神经网络图像去噪
- 3d重建CT图像重建代码
- 基于提升小波的图像去噪算法的FPGA设
- HALCON图像处理。识别视野中球的个数
- Kinect获取深度图像
- 图像中点扩散函数的获取
- U-Net:用于生物医学图像分割的卷积网
- 压缩感知人脸识别以及图像处理
- 基于小波变换的图像融合算法的研究
- pointCloud
- 训练集+测试集图像识别
- 静脉识别程序
- 压缩感知重构图像的几种方法
- 改进的细菌觅食优化算法用于双阈值
- opencv图像处理视频
- 对含有周期性噪声图像进行高斯带通
- 基于labview图像采集与处理论文(本科
- 图像相似度 感知相似度计算代码
- 基于Logistic 混沌序列的灰度图像加密
- 图像平滑去噪
- lena256图像
- 数字图像处理-3.7混合空间增强法-骨骼
评论
共有 条评论