资源描述:
《matlab图像增强与平滑简单程序》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、像增强与平滑直方图:I=imread('l.jpg’);imshow(I);I=rgb2gray(I);%三维变成二维的图;figure,imhist(I);%显示灰度分布直方图均衡处理:I=imread('l.jpg');I=rgb2gray(I);J=histeq(I);Subplot(1,2,1),imshow(I);Subplot(l,2,2),imshow(J);figure,Subplot(1,2,1),imhist(I,64);81^10《1,2,2),加比似,64);%这个参数是什么意思??
2、?MATLABFilefcdtDebugDesktopWindowHelpDFigure1rtorreFileEditViewInsertToolsDesktopHelpdg^bs&吸叹o®'*3口0anHFigure2ComitfikEditVkwInttftToolsDesktopWindowHelp□(«ud我负00□x10x10I咖11100200100200)PCUb22,1)>i»9hov2)>iR8ho
3、v(J);Ti(uce,Subplot(1»2,1)»mhist(1,54),1-祕plot(I,2,iihirt(J,M);4iftshov(I);Subplot(1,2,2),ixhow(1,64);Subplot(1.2.2).Vamxn<:FunctioncallSubplotxnv^cesinexactBatchD:ruanjim*at1abtoolboxVait1ab(raph2dsubplot.7014/3/29灰度变换:imadj
4、ust(I,n,[],);I=imread('1.jpg');I=rgb2gray(I);J=imadjust(I,[0.1,0.5],U);Subplot(1,2,1),imshow(I);Subplot(l,2,2),imshow(J);figure,Subplot(1,2,1),imhist(I,64);Subplot(l,2,2),imhist(J,64);图像反转:I=imread('l.jpg');I=rgb2gray(I);J=imadjust(I,[0.1,0.9],[0.90.1]);Su
5、bplot(1,2,1),imshow(I);Subplot(1,2,2),imshow(J);figure,Subplot(1,2,1),imhist(I,64);Subplot(l,2,2),imhist(J,64);mwi®/J)DRltMMIbm«ITeebDmIIbwWMwHb^o^uaciosj■□*10Subfile—.-S«bpX«t(b2.2),xWurta,64).dJttJxmUvCJ》.春图像平滑噪声I=imread(Tjpg’);I=rgb2gray(l);J=imnoise(I/
6、salt&pepper’,0.02);H=one$(5,5)/25;I2=imfilter(J,H);%领域平均法去噪;Subplot(1,2,1),imshow(J);Subplot(1,2,2),imshow(I2);JS3EEOesktopWindowHelpEflFigure1FileEditViewInsertToolsDBSk□0」□高斯噪声J=imnoise(I,’gaussian’,0.02);%高斯噪声I=imread(,l.jpg,);I=rgb2gray(I);J=imnoise(I/
7、gaussian .02);H=ones(5,5)/25;I2=imfilter(J,H);%领域平均法去噪;Subplot(1,2,1),imshow(J);Subplot(1,2,2),imshow(I2);□c^H备叹叹O®犮□0a□掩模大小对比I=imread(’2.bmp’);I=rgb2gray(I);J=imnoise(I,,gaussian',0.02);H=ones(2,2)/25;Hl=ones(5,5)/25;Il二imfilter(J,Hl);%5*5领域平均法去噪I2=imfil
8、ter(J,H);%2*2领域平均法去噪Subplot(1,2,1),imshow(Il);Subplot(l,2,2),imshow(I2);FileEditVievi□魯b黾叹□回■□中值滤波I=imreadC2.bmp’);I=rgb2gray(I);J=imnoise(I/gaussian .02);H=ones(5,5)/25;I2=medfilt2(J,[5,5]);Subplot(1,2,1),i