CSDN
https://mp.csdn.net/mp_blog/creation/editor/145659134
3. 图像去模糊技术
3.1 盲与非盲去模糊
- 非盲去模糊:已知PSF(如运动模糊核)
- 盲去模糊:同时估计PSF与复原图像
3.2 经典去模糊算法
维纳滤波(非盲去模糊)
MATLAB实现:
% 读取图像并转换为双精度类型
img = im2double(imread('cameraman.tif'));
% Step1: 生成水平运动模糊PSF(长度20像素,0度角)
psf = fspecial('motion', 20, 0);
% Step2: 应用模糊(circular模式减少边界伪影)
blurred = imfilter(img, psf, 'conv', 'circular');
% Step3: 添加高斯噪声(方差0.001)
noisy_blurred = imnoise(blurred, 'gaussian', 0, 0.001);
% Step4: 估计噪声/信号功率比K(夹带先验知识)
estimated_nsr = 0.001 / var(img(:)); % K = 噪声方差 / 图像方差
% Step5: 执行维纳滤波
restored_wiener = deconvwnr(noisy_blurred, psf, estimated_nsr);
% 画图展示结果
figure;
% 显示原始图像
subplot(2, 2, 1);
imshow(img);
title('原始图像');
% 显示模糊图像
subplot(2, 2, 2);
imshow(blurred);
title('模糊图像');
% 显示添加噪声后的图像
subplot(2, 2, 3);
imshow(noisy_blurred);
title('模糊且添加噪声后的图像');
% 显示维纳滤波恢复后的图像
subplot(2, 2, 4);
imshow(restored_wiener);
title('维纳滤波恢复后的图像');
fspecial('motion', len, theta)
: 定义运动模糊PSF,长度len
(像素),角度theta
(度)imfilter
的circular
选项:对图像进行周期性扩展,抑制边界暗边var(img(:))
:计算原始图像方差(实际应用中通常未知,需通过统计估计)