光照预处理的retinex法.doc

  1. 1、本文档共3页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
光照预处理的retinex法

I = imread(C:\MATLAB7\work\1.jpg); subplot(1,2,1); 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(i,j) =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(i,j) =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(i,j) =exp(-((i-nn)^2+(j-nn)^2)/(k1*alf))/(k2*pi*alf*10000); %高斯函数2 end end %%%%%%%%%%%对R分量的处理%%%%%%%%%%%%% Img = double(f); [m,n]=size(f); K=imfilter(Img,b); KK=imfilter(Img,bb); KKK=imfilter(Img,bbb); for i=1:m for j=1:n G(i,j)=1/3*(log(Img(i,j)+1)-log(K(i,j)+1)); G(i,j)=1/3*(log(Img(i,j)+1)-log(KK(i,j)+1))+G(i,j); G(i,j)=1/3*(log(Img(i,j)+1)-log(KKK(i,j)+1))+G(i,j); end end mi=min(min(G)); ma=max(max(G)); L=(G-mi)*255/(ma-mi); %%%%%%%%%%%%%%对G分量的处理%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Img = double(ff); [m,n]=size(ff); K=imfilter(Img,b); KK=imfilter(Img,bb); KKK=imfilter(Img,bbb); for i=1:m for j=1:n G(i,j)=1/3*(log(Img(i,j)+1)-log(K(i,j)+1)); G(i,j)=1/3*(log(Img(i,j)+1)-log(KK(i,j)+1))+G(i,j); G(i,j)=1/3*(log(Img(i,j)+1)-log(KKK(i,j)+1))+G(i,j); end end mi=min(min(G)); ma=max(max(G)); LL=(G-mi)*255/(ma-mi); %%%%%%%%%%%%%随B分量的处理%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Img = double(fff); [m,n]=size(fff); K=imfilter(Img,b); KK=imfilter(Img,bb); KKK=imfilter(Img,bbb); for i=1:m for j=1:n G(i,j)=1/3*(log(Img(i,j)+1)-log(K(i,j)+1)); G(i,j)=1/3*(log(Img(i,j)+1)-log(KK(i,j)+1))+G(i,j); G(i,j)=1/3*(log(Img(i,j)+1)-log(KKK(i,j)+1))+G(i,j); end end mi=min(min(G)); ma=max(max(G)); LLL=(G-mi)*255/(ma-mi); %%%%%%%%%%%%对彩色图像的综合处理 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% msr=cat(3,L,LL,LLL); s

您可能关注的文档

文档评论(0)

xy88118 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档