《滤波源程序代码》word版

《滤波源程序代码》word版

ID:29907781

大小:76.50 KB

页数:11页

时间:2018-12-24

《滤波源程序代码》word版_第1页
《滤波源程序代码》word版_第2页
《滤波源程序代码》word版_第3页
《滤波源程序代码》word版_第4页
《滤波源程序代码》word版_第5页
资源描述:

《《滤波源程序代码》word版》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、例8-2clearall;I=imread('circuit.tif');figure;subplot(221);imshow(I);subplot(222);imhist(I);I1=histeq(I);subplot(223);imshow(I1);subplot(224);imhist(I1);例8-4I=imread('circuit.tif');[M,N]=size(I);fori=1:8:257counts(i)=i;endQ=imread('circuit.tif');N=histeq(Q,counts);figure;subplot(22

2、1);imshow(N);subplot(222);imhist(N);axis([025605000]);例8-5clear;a=imread('coins.png');%读取图像anoised=imnoise(a,'gaussian',0.1,0.005);%对图像进行高斯加噪%制定卷积核h=ones(3,3)/5;h(1,1)=0;h(1,3)=0;h(3,1)=0;h(1,3)=0;%平滑运算a2=imfilter(anoised,h);subplot(131);imshow(a);%显示原始图像subplot(132);imshow(anois

3、ed);%加有高斯噪声的图像subplot(133);imshow(a2);%经过平滑后的图像例8-6clearall;I=imread('eight.tif');J=imnoise(I,'salt&pepper',0.02);subplot(231);imshow(I);subplot(232);imshow(J);K1=filter2(fspecial('average',3),J);%进行3×3模板平滑滤波K2=filter2(fspecial('average',5),J);%%进行5×5模板平滑滤波K3=filter2(fspecial('av

4、erage',7),J);%%进行7×7模板平滑滤波K4=filter2(fspecial('average',9),J);%%进行9×9模板平滑滤波subplot(233);imshow(uint8(K1));subplot(234);imshow(uint8(K2));subplot(235);imshow(uint8(K3));subplot(236);imshow(uint8(K4));例8-7a=imread('coins.png');%读取图像b=imnoise(a,'salt&pepper',0.02);%对图像增加椒盐噪声k=medfil

5、t2(b);%中值滤波去噪subplot(131);imshow(a);xlabel('原始图像');subplot(132);imshow(b);xlabel('含有椒盐噪声图像');subplot(133);imshow(k);xlabel('中值滤波去噪图像');例8-9I=imread('lena.bmp');J=im2double(I);subplot(2,2,1),imshow(J,[])h1=[0-10,-15-1,0-10];h2=[-1-1-1,-19-1,-1-1-1];h3=[1-20,-25-2,1-21];A=conv2(J,

6、h1,'same');subplot(2,2,2),imshow(A,[])B=conv2(J,h2,'same');subplot(2,2,3),imshow(B,[])C=conv2(J,h3,'same');subplot(2,2,4),imshow(C,[])例8-10clearall;[I,map]=imread('lena.bmp');figure(1),imshow(I,map);I=double(I);[IX,IY]=gradient(I);GM=sqrt(IX.*IX+IY.*IY);meth1=GM;figure(2),imshow(

7、meth1,map);meth2=I;J=find(GM>10);meth2(J)=GM(J);figure(3),imshow(meth2,map);meth3=I;J=find(GM>10);meth3(J)=255;figure(4),imshow(meth3,map);meth4=I;J=find(GM<10);meth4(J)=255;figure(5),imshow(meth4,map);meth5=I;J=find(GM>10);meth5(J)=255;Q=find(GM<10);OUTS(Q)=0;figure(6),imshow(me

8、th5,map);例8-11I=imread('cat.jpg');h1=[0,

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。