实验三图像恢复技术_第1页
实验三图像恢复技术_第2页
实验三图像恢复技术_第3页
实验三图像恢复技术_第4页
实验三图像恢复技术_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、实验三 图像恢复技术一、 实验目的掌握退化图像中常见噪声模型及参数估计方法;加深对几种常用的图像复原方法的理解;通过Matlab开发环境实现参数维纳滤波器复原图像。二、 实验内容1 对各种常见噪声模型进行仿真实现;2 把仿真噪声加入纯净图像上形成退化图像,让后对噪声进行参数估计,并与原设定参数进行比较以衡量估计的准确性;3 仿真几种常见噪声,并用参数维纳滤波器方法进行图像复原;4 观察复原效果,并进行仔细讨论。三、 知识要点与范例1. 图像恢复退化模型f(x,y)退化函数H+g(x,y)n(x,y)恢复滤波器f(x,y)的最优估计退化过程恢复过程图像恢复问题可以分为两大类:1) 假定系统退化函

2、数H为恒等算子,而只考虑环境噪声引起退化的情况;2) 同时考虑H和环境噪声h。2. 噪声模型对噪声的行为和效果进行仿真的能力是图像恢复处理中的重点。除了周期噪声,通常假定噪声与象素坐标无关。Matlab噪声仿真函数为:g = imnoise(f, type, parameters);常见的噪声(高斯、椒盐噪声)的仿真实例如下:g = imnoise(f, gaussian, m, var);g = imnoise(f,salt & pepper, d); (where d represents the noise density).3. 产生具有某种固定分布的空间随机噪声.MATLAB

3、中两个常用的随机分布产生函数是:rand(均匀分布噪声), randn(标准正态分布噪声)空间随机噪声是有各自的PDF 或 CDF所决定的。除了有上面所讲的immoise噪声产生函数外, 具有某种规定 CDF的大部分随机噪声都可由均匀分布的随机量(这里用w表示)通过某个随机数产生方程来生成。也就是说,给定w (0,1), 具有某个确定分布Fz 的随机变量z 可以通过解如下方程获得:z = Fz-1(w).如:变量z 满足如下Rayleigh分布:则:, 这个方程也通常叫做随机数产生方程 (RNGE)。对其他类型的 RNGEs, 请见参考教材2的146页。产生两种噪声的Matlab程序实例(1)

4、 generate the gaussian noise of 500*500 size, mean=0, variance=1 R = imnoise2(gaussian, 500,500, 0, 1)Whose histogram is below, generated by:hist(R:), 50);(2) rayleigh noise (a and b is by default)r= imnoise2(rayleight, 100000, 1)4. 从灰度直方图估计噪声的方法所要进行估计的参数主要有两个:均值和方差;参考教材2中的Matlab实现函数为:v, unv = statm

5、oments(p, n)选取无特征背景区域 (ROI)的函数为:B = roipoly(f, c, r), or B, r, c = roipoly() for chose interactively.实例:仿真某种噪声加入到某个无噪声的图像,然后把上面方法得到的参数估计与原参数进行比较。f=imread('Fig0504(a)(noisy_image).tif');B, c, r = roipoly(f)subplot(221);imshow(f);subplot(222);imshow(B);p,npix = histroi(f,c,r);subplot(223);bar(

6、p,1);v,unv=statmoments(p,2);x = imnoise2(gaussian, npix, 1, floor(unv), floor(sqrt(v);v,unv=statmoments(p,2)x = imnoise2('gaussian', npix, 1, floor(unv(1), floor(sqrt(unv(2);subplot(224), hist(x, 130);axis(0 300 0 50)结果:5. 只有空间加性噪声时的图像恢复问题当退化仅仅是由上式所示的加性噪声造成时,可以采用教材第三章中所讲的图像强技术。Matlab函数spfilt

7、(见附录)集成了差不多所有空间滤波的功能,包括 including: arithmetic mean, geometric mean, harmonic mean, contraharmonic mean, median, max, min, midpoint, alpha-trimmed mean;用上面的函数进行图像复原的实例:原图像是一幅电路板的x-image,图像的相关信息为: unit8, TIFF, 448*464 (heigh*width); 对图像加入椒盐噪声后再用各种方法进行恢复:% adding pepper-salt noiseM, N=size(f);R=imnoise

8、2('salt & pepper',M, N, 0.1,0);c = find(R=0);gp = f;gp(c)=0;% the following codes generate only salt noise only: (see upper-middle figure)R=imnoise2('salt & pepper',M, N, 0,0.1);c = find(R=1);gs = f;gs(c)=255;%the upper-right figure is generated by filtering pepper noise usin

9、g contraharmonic filter with Q>0:fp = spfilt(gp, 'chmean',3,3,1.5);%the bottom-left figure is generated by filtering salt noise using contraharmonic filter with Q<0:fs = spfilt(gs, 'chmean',3,3,-1.5);%the bottom-middle figure is generated by filtering pepper noise using max fil

10、ter:fpmax = spfilt(gp,'max',3,3);%the bottom-right figure is generated by filtering salt noise using min filter:fsmin = spfilt(gs,'min',3,3);=6. 空间退化函数建模有先验知识的退化函数建模函数:PSF = fspecial(motion, len , theta); %it approximates the effects of linear motion of a camera.为比较各种恢复方法而设计的一种合适的测试模

11、式:C = checkerboard(NP, M, N);一个产生“checkerboard” 图像和其测试图像的实例:+f = checkerboard(8);PSF = fspecial ('motion', 7, 45); % generate degradation functiongb = imfilter(f, PSF, 'circular'); % producing degraded imagenoise = imnoise(zeros(size(f), 'gaussian', 0, 0.001); % simulate Gaus

12、sian noiseg = gb + noise; % generate blurred image by degradation and noisefr = pixeldup(f, 8); % pixel replication to form 512*512 imagegbr = pixeldup(gb, 8);nr = pixeldup(noise,8);gr = pixeldup(g, 8);subplot(221);imshow(fr,);title(' original test pattern of size 512*512');subplot(222);imsh

13、ow(gbr, );title(' degreded image by PSF');subplot(223);imshow(nr, );title(' gaussian noise image');subplot(224);imshow(gr, );title('blurred image by degradation and noise');+7. Wiener filtering基本原理:Matlab实现:fr = deconvwnr(g, PSF, NACORR, FACORR);四、 参数维纳滤波参考程序两种维纳滤波方法与直接逆滤波方法间

14、的比较: +f = checkerboard(8); % the original undegraded imagePSF = fspecial ('motion', 7, 45); % degradation functiongb = imfilter(f, PSF, 'circular'); % producing degraded imagenoise = imnoise(zeros(size(f), 'gaussian', 0, 0.001); % simulate Gaussian noiseg = gb + noise; % degr

15、aded image mixed with noise % direct verse filteringfr1 = deconvwnr(g, PSF); % parametric Wiener filtering (assume noise-to-signal ratio is average power ratio)Sf = abs(fft2(f) . 2; % clear image power spectrumfA = sum(Sf(:)/prod(size(f); % the image average power; Sn = abs(fft2(noise) . 2; % noise

16、power spectrumnA = sum(Sn(:)/prod(size(noise); % the average noise power;R = nA/fA;fr2 = deconvwnr(g, PSF, R) % parametric Wiener filtering by autocorrelation functionsNCORR = fftshift(real(ifft2(Sn);ICORR = fftshift(real(ifft2(Sf);fr3 = deconvwnr(g, PSF, NCORR, ICORR); subplot(221); imshow(g, );title('degraded image');subplot(222); im

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论