• 大小: 3KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-14
  • 语言: Matlab
  • 标签: Retinex  

资源简介

这里边有单尺度,多尺度等等的Retinex的Matlab程序,挺好用的

资源截图

代码片段和文件信息

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‘);


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2239  2008-11-28 17:04  RETINEX算法\MSR.m

     文件       2626  2008-11-21 23:36  RETINEX算法\MSRCR.m

     文件       2714  2008-11-28 16:30  RETINEX算法\retinex.m

     文件       1021  2008-11-28 16:45  RETINEX算法\SSR.m

     目录          0  2008-12-29 12:06  RETINEX算法

----------- ---------  ---------- -----  ----

                 8818                    6


评论

共有 条评论