图像恢复
来源:互联网 发布:java heap 怎么设置 编辑:程序博客网 时间:2024/06/07 04:49
维纳滤波—deconvwnr函数利用维纳滤波器来对图像模糊修复
function image_restoration_deconvwnr() %Read image I = im2double(imread('lena.tif')); I=rgb2gray(I); figure,subplot(2,3,1),imshow(I); title('Original Image'); %Simulate a motion blur LEN = 21; THETA = 11; PSF = fspecial('motion', LEN, THETA); blurred = imfilter(I, PSF, 'conv', 'circular'); subplot(2,3,2),imshow(blurred); title('Blurred Image'); %Restore the blurred image wnr1 = deconvwnr(blurred, PSF, 0); subplot(2,3,3),imshow(wnr1); title('Restored Image'); %Simulate blur and noise noise_mean = 0; noise_var = 0.0001; blurred_noisy = imnoise(blurred, 'gaussian', ... noise_mean, noise_var); subplot(2,3,4),imshow(blurred_noisy) title('Simulate Blur and Noise') %Restore the blurred and noisy image:First attempt wnr2 = deconvwnr(blurred_noisy, PSF, 0); subplot(2,3,5);imshow(wnr2);title('Restoration of Blurred, Noisy Image Using NSR = 0') %Restore the Blurred and Noisy Image: Second Attempt signal_var = var(I(:)); wnr3 = deconvwnr(blurred_noisy, PSF, noise_var / signal_var); subplot(2,3,6),imshow(wnr3) title('Restoration of Blurred, Noisy Image Using Estimated NSR');end
维纳滤波需要估计图像的信噪比(SNR)或者噪信比(NSR),信号的功率谱使用图像的方差近似估计,噪声分布是已知的。从第一排中可以看出,若无噪声,此时维纳滤波相当于逆滤波,恢复运动模糊效果是极好的。从第二排可以看出噪信比估计的准确性对图像影响比较大的,二排中间效果几乎不可用。
逆滤波
function image_restoration_matlab() % Display the original image. I = im2double(imread('lena.tif')); I=rgb2gray(I); [hei,wid,~] = size(I); subplot(2,3,1),imshow(I); title('Original Image (courtesy of MIT)'); % Simulate a motion blur. LEN = 21; THETA = 11; PSF = fspecial('motion', LEN, THETA); blurred = imfilter(I, PSF, 'conv', 'circular'); subplot(2,3,2), imshow(blurred); title('Blurred Image'); % Inverse filter If = fft2(blurred); Pf = fft2(PSF,hei,wid); deblurred = ifft2(If./Pf); subplot(2,3,3), imshow(deblurred); title('Restore Image') % Simulate additive noise. noise_mean = 0; noise_var = 0.0001; blurred_noisy = imnoise(blurred, 'gaussian', ... noise_mean, noise_var); subplot(2,3,4), imshow(blurred_noisy) title('Simulate Blur and Noise') % Try restoration assuming no noise. If = fft2(blurred_noisy); deblurred2 = ifft2(If./Pf); subplot(2,3,5), imshow(deblurred2) title('Restoration of Blurred Assuming No Noise'); % Try restoration with noise is known. noisy = blurred_noisy - blurred; Nf = fft2(noisy); deblurred2 = ifft2(If./Pf - Nf./Pf); subplot(2,3,6), imshow(deblurred2) title('Restoration of Blurred with Noise Is Known')end
逆滤波对噪声非常敏感,除非我们知道噪声的分布情况(事实上,这也很难知道),逆滤波几乎不可用,可以从二排中间看出,恢复图像效果极差。但若知道噪声分布,也是可以完全复原信息的。可以从二排最后一张图可以看出。
参考文献:
数字图像处理matlab版(左飞)
数字图像处理第三版(Gonzalez)
http://blog.csdn.net/zhoufan900428/article/details/38064125
http://blog.csdn.net/bluecol/article/details/47357717
http://blog.csdn.net/bluecol/article/details/46242355
0 0
- 图像恢复
- 图像恢复
- 图像增强与图像恢复
- 求助图像恢复实例
- 图像恢复及滤波处理
- 图像的压缩与恢复
- matlab图像恢复程序实例
- matlab 图像分块及恢复
- 图像恢复----Retinex算法详解
- VC++实现对退化图像的恢复
- 由图像恢复摄像机的参数
- 有图像恢复的相关执行软件
- 图像恢复迭代算法的加速
- 二元回归解决图像恢复问题(图像去噪)
- 基于分割的图像恢复-A New Approach
- 恢复windows 右键菜单 新建BMP图像 Bitmap Image
- MFC opencv 中恢复图像(重新加载)
- 数字图像处理—图像恢复和重建—退化模型
- ArcGIS Server3.20视域分析GP服务的发布过程
- HDU
- hdu 4055 Number String
- hibernate-croe-5.1.5与5.2.10与5.0.12版本环境问题
- “Wishare杯”南邮第九届大学生程序设计竞赛之现场赛 部分题解
- 图像恢复
- 软件工程作业
- Code Vs-problem-1160 蛇形矩阵
- python_Django_5:Testing
- 图的经典算法
- eclipse tomcat已经启动成功 但是出现:preparing launch delegate
- 欢迎使用CSDN-markdown编辑器
- c语言(用结构排成绩)
- python_Django_6:Static files