|
retinex图像增强算法:MATLAB代码如下:
单retinex图像增强算法---多retinex图像增强算法- clc,clear,close all
- % single scale retinex
- % I = imread('C:\Users\ysw\Desktop\视频讲解\图库\Tulips.jpg');
- I = imread('C:\Users\ysw\Desktop\视频讲解\图库\shot.jpg');
- [m,n,dim] = size(I);
- c = 5e1; % 可变参
- [Y,X]=meshgrid(1:n,1:m);
- %Fnok = exp(-((X.^2)+(Y.^2))./(c.^2));
- Fnok = exp(-(((X-m/2).^2)+((Y-n/2).^2))./(c.^2));
- K = 1/(sum(sum(Fnok)));
- F = K.*Fnok;
- IR = double(I(:,:,1));
- IG = double(I(:,:,2));
- IB = double(I(:,:,3));
- FF = fftshift(fft2(F));
- IFR = fftshift(fft2(IR)); IFR=FF.*IFR; IFR=real(ifft2(ifftshift(IFR)));
- IFG = fftshift(fft2(IG)); IFG=FF.*IFG; IFG=real(ifft2(ifftshift(IFG)));
- IFB = fftshift(fft2(IB)); IFB=FF.*IFB; IFB=real(ifft2(ifftshift(IFB)));
- RR = log10(double(IR))-log10(IFR);
- RG = log10(double(IG))-log10(IFG);
- RB = log10(double(IB))-log10(IFB);
- OUT(:,:,1)=uint8(255*RR/(max(max([RR RG RB]))));
- OUT(:,:,2)=uint8(255*RG/(max(max([RR RG RB]))));
- OUT(:,:,3)=uint8(255*RB/(max(max([RR RG RB]))));
- figure,
- subplot(121),imshow(I,[])
- subplot(122),imshow(OUT,[])
- % multi scale retinex
- % c = 45; c = 100; c=200;
- % 加权和
复制代码
参考链接:http://zoi.utia.cas.cz/research
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|