运动模糊图像复原

1.维纳滤波

deconvwnr 用wiener滤波器实现图像去模糊
deconvreg 用regularized滤波器实现图像去模糊
deconvlucy 用Lucy-Richardson滤波器实现图像去模糊
deconvbind 用盲反卷积算法实现图像去模糊

题目是已知模糊核的,我们需要自己尝试不同的方差找到最合适的。

img=imread('motion.bmp');
img=im2double(img);
subplot(2,2,1),imshow(img),title("initial")
len=30;
theta=11;
PSF=fspecial("motion",len,theta);
sVar=var(img(:));

wnr1=deconvwnr(img,PSF,0);
subplot(2,2,2),imshow(wnr1),title("without using NSR")

wnr2=deconvwnr(img,PSF,0.0001/sVar);
subplot(2,2,3),imshow(wnr2),title("with using NSR=0.0001");

wnr3=deconvwnr(img,PSF,0.001/sVar);
subplot(2,2,4),imshow(wnr3),title("with using NSR=0.001");

figure(2),imshow(wnr2)

h=fspecial('average');
f=filter2(h,wnr2);
figure(3),imshow(f)

在这里插入图片描述
处理之后发现取0.001时效果最好,把图像去除,加以均值滤波(对于高斯噪声来说略优)。

2.模糊及逆滤波

使用imnoise对模糊后的图像加高斯噪声。
fspecial是定义核所用的,非常重要。

img=imread('work.jpg');
img=rgb2gray(img);
img=im2double(img);

len=28;
theta=14;
PSF=fspecial("motion",len,theta);
blurred=imfilter(img,PSF,'circular');
% motion blur
subplot(2,3,1),imshow(img),title("原图")
subplot(2,3,2),imshow(blurred),title("运动模糊")
If=fft2(blurred);
Pf=fft2(PSF,500,500);
deblurred=ifft2(If./Pf);
subplot(2,3,3),imshow(deblurred),title("直接逆滤波")

mean=0;
var=0.0001;
noised=imnoise(blurred,'gaussian',mean,var);
subplot(2,3,4),imshow(noised),title("模糊加噪声")

Ifn=fft2(noised);
deblurredn=ifft2(Ifn./Pf);
subplot(2,3,5),imshow(deblurredn),title("直接逆滤波")

在这里插入图片描述
呵呵,逆滤波不能处理有噪声的图像哦。

  • 10
    点赞
  • 164
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值