资源简介

采用中心环绕函数的retinex算法,可以对于暗视觉的图像进行有效的增强

资源截图

代码片段和文件信息

I = imread(‘C:\MATLAB7\work\1.jpg‘);
subplot(121);
imshow(I);

f=I(::1);
ff=I(::2);
fff=I(::3);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
k1=4;
k2=5;
r=161;
alf=1600;
nn=floor((r+1)/2);
for i=1:r
    for j=1:r
        b(ij) =exp(-((i-nn)^2+(j-nn)^2)/(k1*alf))/(k2*pi*alf*10000);        %高斯函数1
   end
end

k1=8;
k2=8;
r=161;
alf=1400;
nn=floor((r+1)/2);
for i=1:r
    for j=1:r
        bb(ij) =exp(-((i-nn)^2+(j-nn)^2)/(k1*alf))/(k2*pi*alf*10000);        %高斯函数2
   end
end

k1=0.5;
k2=0.5;
r=161;
alf=1458;
nn=floor((r+1)/2);
for i=1:r
    for j=1:r
        bbb(ij) =exp(-((i-nn)^2+(j-nn)^2)/(k1*alf))/(k2*pi*alf*10000);        %高斯函数2
   end
end
%%%%%%%%%%%对R分量的处理%%%%%%%%%%%%%
Img = double(f);
[mn]=size(f);

K=imfilter(Imgb);
KK=imfilter(Imgbb);
KKK=imfilter(Imgbbb);

for i=1:m
    for j=1:n      
       G(ij)=1/3*(log(Img(ij)+1)-log(K(ij)+1));
        G(ij)=1/3*(log(Img(ij)+1)-log(KK(ij)+1))+G(ij);
         G(ij)=1/3*(log(Img(ij)+1)-log(KKK(ij)+1))+G(ij);
    end
end

mi=min(min(G));
ma=max(max(G));

       L=(G-mi)*255/(ma-mi);
%%%%%%%%%%%%%%对G分量的处理%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Img = double(ff);
[mn]=size(ff);

K=imfilter(Imgb);
KK=imfilter(Imgbb);
KKK=imfilter(Imgbbb);

for i=1:m
    for j=1:n      
       G(ij)=1/3*(log(Img(ij)+1)-log(K(ij)+1));
        G(ij)=1/3*(log(Img(ij)+1)-log(KK(ij)+1))+G(ij);
         G(ij)=1/3*(log(Img(ij)+1)-log(KKK(ij)+1))+G(ij);
    end
end

mi=min(min(G));
ma=max(max(G));

       LL=(G-mi)*255/(ma-mi);
%%%%%%%%%%%%%随B分量的处理%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Img = double(fff);
[mn]=size(fff);

K=imfilter(Imgb);
KK=imfilter(Imgbb);
KKK=imfilter(Imgbbb);


for i=1:m
    for j=1:n      
       G(ij)=1/3*(log(Img(ij)+1)-log(K(ij)+1));
        G(ij)=1/3*(log(Img(ij)+1)-log(KK(ij)+1))+G(ij);
         G(ij)=1/3*(log(Img(ij)+1)-log(KKK(ij)+1))+G(ij);
    end
end

mi=min(min(G));
ma=max(max(G));

       LLL=(G-mi)*255/(ma-mi);

%%%%%%%%%%%%对彩色图像的综合处理 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
msr=cat(3LLLLLL);
subplot(122);
imshow(uint8(msr));
imwrite(uint8(msr)‘msrretnx.bmp‘);


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-10-22 16:14  i   retinex\
     目录           0  2012-08-06 10:46  i   retinex\21RETINEX\
     目录           0  2012-08-06 10:46  i   retinex\21RETINEX\RETINEX算法\
     文件        2239  2008-11-28 17:04  i   retinex\21RETINEX\RETINEX算法\MSR.m
     文件        2626  2008-11-21 23:36  i   retinex\21RETINEX\RETINEX算法\MSRCR.m
     文件        2714  2008-11-28 16:30  i   retinex\21RETINEX\RETINEX算法\retinex.m
     文件        1021  2008-11-28 16:45  i   retinex\21RETINEX\RETINEX算法\SSR.m

评论

共有 条评论