退化函数建模
%% 退化函数建模
f=checkerboard(8);
imshow(f);
PSF = fspecial('motion',7,45);
gb = imfilter(f,PSF,'circular');
figure;
imshow(gb);
noise = imnoise(zeros(size(f)),'gaussian',0,0.001);
g = gb+noise;
subplot(221),imshow(pixeldup(f,8),[]);title('src');
subplot(222),imshow(pixeldup(gb,8),[]);title('motion');
subplot(223),imshow(pixeldup(noise,8),[]);title('noise');
subplot(224),imshow(pixeldup(g,8),[]);title('motion+noise');
维纳滤波
使用固定比率来复原图像
Sn = abs(fft2(noise)).^2;
nA = sum(Sn(:))/prod(size(noise));
Sf = abs(fft2(f)).^2;
fA = sum(Sf(:))/prod(size(f));
R = nA/fA
fr2 = deconvwnr(g,PSF,R);
figure,imshow(fr2,[]);
使用自相关函数来复原:
NCORR = fftshift(real(ifft2(Sn)));
ICORR = fftshift(real(ifft2(Sf)));
fr3 = deconvwnr(g,PSF,NCORR,ICORR);
figure,imshow(fr3,[]);
正则滤波
fr4 = deconvreg(g,PSF,4);
figure,imshow(fr4,[]);
fr5 = deconvreg(g,PSF,0.4,[1e-7 1e7]);
figure,imshow(fr5,[]);
LR算法
f=checkerboard(8);
imshow(pixeldup(f,8));
PSF=fspecial('gaussian',7,10);
SD = 0.01;
g = imnoise(imfilter(f,PSF),'gaussian',0,SD^2);
imshow(g);
DAMPAR = 10*SD;
LIM = ceil(size(PSF,1)/2);
WEIGHT = zeros(size(g));
WEIGHT(LIM+1:end-LIM,LIM+1:end-LIM)=1;
NUMIT = 5;
fr6 = deconvlucy(g,PSF,NUMIT,DAMPAR,WEIGHT);
imshow(pixeldup(fr6,8));
迭代五次:
迭代100次:
盲去卷积
f=checkerboard(8);
imshow(pixeldup(f,8));
PSF=fspecial('gaussian',7,10);
SD = 0.01;
g = imnoise(imfilter(f,PSF),'gaussian',0,SD^2);
imshow(g);
DAMPAR = 10*SD;
LIM = ceil(size(PSF,1)/2);
WEIGHT = zeros(size(g));
WEIGHT(LIM+1:end-LIM,LIM+1:end-LIM)=1;
%% blind deconv
INITPSF=ones(size(PSF));
NUMIT = 50;
[fr,PSFe] = deconvblind(g,INITPSF,NUMIT,DAMPAR,WEIGHT);
figure,imshow(pixeldup(PSFe,73),[]);
figure,imshow(pixeldup(fr,8),[]);
迭代五十次的PSF图像:
复原的图:
版权声明:本文为fangjin_kl原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。