MATLAB图像复原三

I = checkerboard(8); %产生一个88的跳棋盘图像
PSF = fspecial(‘gaussian’,7,10); %产生一个高斯低通滤波器
V = .0001; %高斯加性噪声的标准差
IF1= imfilter(I,PSF); %原图像通过高斯低通滤波器
BlurredNoisy = imnoise(IF1,‘gaussian’,0,V);% 加入高斯噪声
WT = zeros(size(I)); %产生权重矩阵
WT(5:end-4,5:end-4) = 1;
INITPSF = ones(size(PSF)); %初始化最初的点扩散函数
[J P] = deconvblind(BlurredNoisy,INITPSF,20,10
sqrt(V),WT);
figure, %依次显示模糊图像,真实的PSF,反卷积得到的图像和恢复的PSF
subplot(221);imshow(BlurredNoisy); title(‘A = Blurred and Noisy’);
subplot(222);imshow(PSF,[]); title(‘True PSF’);
subplot(223);imshow(J); title(‘Deblurred Image’);
subplot(224);imshow(P,[]); title(‘Recovered PSF’);
在这里插入图片描述
PSF = fspecial(‘gaussian’,13,1);
OTF = psf2otf(PSF,[31 31]); %点扩散函数转化为光学转换函数
PSF2 = otf2psf(OTF,size(PSF)); %光学转换函数转化为点扩散函数
subplot(1,2,1); surf(abs(OTF)); %显示光学转换函数
title(’|OTF|’); axis square; axis tight
subplot(1,2,2); surf(PSF2); %显示点扩散函数
title(‘Corresponding PSF’); axis square; axis tight
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/m0_38127487/article/details/115254172