编写MATLAB程序,选择Matlab自带图像eight.tif,对其使用运动模糊处理,再在模糊图像中加入高斯噪声,使用维纳(wiener)滤波对其进行去退化处理,显示原始图像、模糊后图像和复原图像。
时间: 2024-02-17 11:03:08 浏览: 89
好的,请先确认您已经将Matlab自带图像eight.tif导入到当前工作目录中。接下来,我们可以按照以下步骤进行处理:
1. 读取原始图像
```matlab
I = imread('eight.tif');
```
2. 进行运动模糊处理
```matlab
PSF = fspecial('motion', 20, 45); % 运动模糊的点扩散函数
blurred = imfilter(I, PSF, 'conv', 'circular'); % 圆形卷积
```
3. 添加高斯噪声
```matlab
noise_mean = 0;
noise_var = 0.0001;
blurred_noisy = imnoise(blurred, 'gaussian', noise_mean, noise_var);
```
4. 使用维纳滤波进行去退化处理
```matlab
estimated_nsr = noise_var / var(I(:)); % 计算信噪比
wnr3 = deconvwnr(blurred_noisy, PSF, estimated_nsr); % 维纳滤波
```
5. 显示原始图像、模糊后图像和复原图像
```matlab
figure;
subplot(2,2,1); imshow(I); title('原始图像');
subplot(2,2,2); imshow(blurred); title('模糊后图像');
subplot(2,2,3); imshow(blurred_noisy); title('带噪声的模糊图像');
subplot(2,2,4); imshow(wnr3); title('维纳滤波复原图像');
```
运行以上代码,即可得到原始图像、模糊后图像和复原图像的展示效果。
阅读全文