• 大小: 6KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-16
  • 语言: Matlab
  • 标签: retinex  

资源简介

retinex的MATLAB实现程序,效率很高,分享给大家,如果大家有更好的建议,欢迎留言

资源截图

代码片段和文件信息

I = imread(‘111.bmp‘);
subplot(121);
imshow(I);


I=double(I);
f=I(::1);
ff=I(::2);
fff=I(::3);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
k1=4;
k2=5;
r=161;
alf=1458;
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;                                                                  %高斯函数2
k2=8;
r=161;
alf=1458;
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);     
   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);        %高斯函数23
end
%%%%%%%%%%%对R分量的处理%%%%%%%%%%%%%
Img = double(f);
[mn]=size(f);

aa=125;
for i=1:m
    for j=1:n 
        C(ij)=log(1+aa*(Img(ij)/I(ij)));
    end
end

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)=C(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);

aa=125;
for i=1:m
    for j=1:n 
        CC(ij)=log(1+aa*(Img(ij)/I(ij)));
    end
end

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)=CC(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);

aa=125;
for i=1:m
    for j=1:n 
        CCC(ij)=log(1+aa*(Img(ij)/I(ij)));
    end
end

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)=CCC(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);
%%%%%%%%%%%%对彩色图像的综合处理 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
msrcr=cat(3LLLLLL);
subplot(122);
imshow(uint8(msrcr));
imwrite(uint8(msrcr)‘msrcrsretnx.bmp‘);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        2612  2009-09-06 20:55  retinex\MSRCR.m
     文件        3183  2009-09-07 10:07  retinex\MSR_new.m
     文件          24  2018-04-21 10:52  retinex\Readme.txt
     文件        2693  2010-04-23 21:00  retinex\retinex.m
     文件        2775  2009-03-08 18:33  retinex\retinex_frankle_mccann.m
     文件        5392  2009-03-08 18:33  retinex\retinex_mccann99.m
     目录           0  2018-04-21 10:51  retinex\

评论

共有 条评论