资源描述:
《实验七图像增强—平滑与滤波》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、实验七图像增强一平滑与滤波%X>%TxxT^L^IWfcJ%£>%T^%T^>T^xf^^£>%£^%T^个个个个个个个个个个个个个个个个Q
2、理的解释。二、实验设备与软件1.PC计算机2.MATLAB软件/语言包括图像处理工具箱(ImageProcessingToolbox)3.实验所需要的图片三.实验内容1.对给定的图像添加均值为0,方差分别为200、400的高斯噪声,以及概率分别为0.1、0.2的椒盐噪声,显示添加噪声后的图像。加高斯>>I=imread(’rice,jpg’);>>J=imnoise(I,’gaussian*,0,200);>>K=imnoise(I,’gaussian,,0,400);»subplot(2,2,1);imshow(I);title(’原»subplot(2,2,2);imshow(J);
3、titleC200高斯噪声’);»subplot(2,2,3);imshow(I);title(’原»subplot(2,2,4);imshow(K);titleC400高斯噪声’);加椒盐»I=imread(’rice,jpg’);>>J=iranoise(I,’salt&pepper’,0.2);>>K=iranoise(I,Jsalt&pepper*,0.1);»subplot(2,2,1);imshow(I);title(,原囫’);»subplot(2,2,2);imshow(J);titleC0.2椒盐噪声’);»subplot(2,2,3);imshow(I);title(
4、’原图’);»subplot(2,2,4);imshow(K);title(’0.1椒盐噪声’);2.7sn>TD國额^>syK4.3x3,5X5,9x93s{»?a^、國印本一:惡論薄酣細。〉>IHimreadcrice.jpg-);>>J=imnoise(I'salt妒pepper-,0.2);>>avelH:fspecialCaveraoqe3)>>ave2=f*specialCaverage*,>>ave3=:fspecia.lCaverage*,>>K=filter2(avel,J)/255;〉>L=filter2(ave2,J)/255;>>M=filter2(ave3,J
5、)/255;>〉subplot(2,2,1);imshow(J)〉>subplot(2,2,2);imshow(K)〉〉subplot(2,2,3);imshow(L)>〉subplot(2,2,4);imshow(M)5)9)titleC3*3sfjtitlef5*5titleC9*9so饔);■);謹c;MFigure1,口I回FileEditViewInsert工oolsDesktopWindowHelpDB
6、1^®暹X▼1③□S■Q椒盐噪声图3,3均值滤波5,5均值滤波9*9均值滤波3.对加噪图像分别进行3x3、5x5、9x9的中值滤波,显示并比较滤波结果。»K二medfilt2
7、(J,[33]);»L=medfilt2(J,[55]);»M=medfilt2(J,[99]);»subplot(2,2,1);imshow(J);title(’椒盐噪声图’);»subplot(2,2,2);imshow(K);title(’3*3中值滤波’);»subplot(2,2,3);imshow(L);title(’5*5中值滤浪’);»subplot(2,2,4);imshow(M);title(’9*9中值滤波’);Figure1FileEditViewInsertToolsDesktopWindowHelpOMWOHMOHM*(Dda^i椒盐噪声图3,3中值滤波5,5
8、中值滤波9,9中值滤波3.对加噪图像进行截至频率D。分别为10、25的高斯低通滤波,显示并比较滤波结果。I=imreadCrice,jpg’);J=imnoise(I,,salt&pepper’,0.2);f=double(J);ff=fft2(f);g=fftshift(ff);[nl,n2]=size(g);d0=25;u0=round(nl/2);v0=round(n2/2);fori=l:nlforj二l:n2d=sqrt(