代码:
I = imread('cameraman.tif');
figure;imshow(I);title('original img');
PSF = fspecial('gaussian',7,10);
Blurredimg = imfilter(I,PSF,'symmetric','conv');
figure;
imshow(Blurredimg);title('blurred img');
underPSF = ones(size(PSF)-4);
[j1,p1] = deconvblind(Blurredimg,underPSF);
figure;
imshow(j1);title('deConvblind img');
underPSF是用来初始输入的预估PSF,这里第一个实验输入的估计PSF比真实PSF少4个像素大小。原始PSF是77大小,预估的PSF是33大小。
结果对比:
衣服领肩位置
模糊去除的不彻底,相比于模糊图像,模糊的边缘有明显的变窄趋势。
underPSF2 = padarray(underPSF,[4,4],'replicate','both');
[j2,p2] = deconvblind(Blurredimg,underPSF2);
figure;
imshow(j2);title('deConvblind2 img');
结果如下:
有很明显的振铃效应。
第三个实验:用和原来PSF一样大小的卷积核去卷积。
underPSF3 = padarray(underPSF,[2 2],'replicate','both');
[j3,p3] = deconvblind(Blurredimg,underPSF3);
imshow(j3);title('Deblurring with INITPSF')
结果如下:
衣领处的细节对比:
去振铃效应:
1.增加迭代次数30:
增加一个初始像素权重:
边界权重等于0的权重:
WEIGHT([1:3 end-(0:2)],:) = 0;
WEIGHT(:,[1:3 end-(0:2)]) = 0;
figure
imshow(WEIGHT)
title('Weight Array')
[j5,p5_] = deconvblind(I,underPSF3,30,[],weight)
图像边缘的的振铃得到比较好的抑制,人物边缘的振铃得到一定的抑制。
参考资料:
matlab 教程