资源简介
matlab代码实现的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
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 360054 2011-02-25 11:10 night3.bmp
文件 2684 2011-03-03 14:52 retinex.m
----------- --------- ---------- ----- ----
362738 2
相关资源
- 基于Matlab的最大熵模糊图像复原算法
- KITTI雷达点云与图像数据融合matlab源码
- matlab 解码 NMEA0183格式GGA数据
- 一个有关飞机的模板匹配的跟踪的m
- 基于MATLAB的电弧模型仿真
- PRI信号分选
- Matlab论文:基于Matlab的二进制数字调
- 802.11协议吞吐量随节点数性能仿真
- matlab图片rgb转yuv,存.yuv文件 播放器
- Duda模式分类Pattern Classification MATLAB 代
- dijkstra算法的matlab实现31274
- 随机路径生成函数matlab
- matlab语音信号处理工具箱
- matlab2013激活文件
- matlab实现游程编码
- 暗通道先验+引导滤波MATLAB代码
- 边缘检测中的canny算法及其matlab实现
- 通过达曼光栅生成点阵的matlab程序.
- MATLAB核函数算法
- 求控制系统的性能指标MptrtsFAI,matl
- matlab 求DTFT
- 逆变器重复控制算法MATLAB仿真
- MATLAB R2014b 许可协议文件
- matlab读取comtrade格式的程序
- 基于Matlab的RC一阶电路仿真
- Las点云数据读取代码
- 雷达回波加天线方向图模拟程序
- MATLAB 2017b 安装文件及其破解文件百度
- Matlab实现音频降噪
- matlab实现导航卫星系统中计算多普勒
评论
共有 条评论