资源描述:
《matlab图像处理函数汇总1》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、MATLAB图像处理函数汇总(一)1.applylut功能:在二进制图像中利用lookup表进行边沿操作.语法:A=applylut(BW,lut)举例lut=makelut('sum(x(:))==4',2);BW1=imread('text.tif');BW2=applylut(BW1,lut);imshow(BW1)figure,imshow(BW2)相关命令:makelut2.bestblk功能:确定进行块操作的块大小.语法:siz=bestblk([mn],k)[mb,nb]=bestblk([mn],k)举例siz=bestblk([640800],72)siz=64
2、50相关命令:blkproc3.blkproc功能:MATLAB高级应用——图形及影像处理320,实现图像的显式块操作.语法:B=blkproc(A,[mn],fun)B=blkproc(A,[mn],fun,P1,P2,...)B=blkproc(A,[mn],[mbordernborder],fun,...)B=blkproc(A,'indexed',...)举例I=imread('alumgrns.tif');I2=blkproc(I,[88],'std2(x)*ones(size(x))');imshow(I)figure,imshow(I2,[]);相关命令:colfi
3、lt,nlfilter,inline4.brighten功能:增加或降低颜色映像表的亮度.语法:brighten(beta)newmap=brighten(beta)newmap=brighten(map,beta)brighten(fig,beta)相关命令:imadjust,rgbplot5.bwarea功能:计算二进制图像对象的面积.语法:total=bwarea(BW)举例BW=imread('circles.tif');imshow(BW);附录MATLAB图像处理命令321bwarea(BW)ans=15799相关命令:bweuler,bwperim6.bweuler
4、.功能:计算二进制图像的欧拉数.语法:eul=bweuler(BW,n)举例BW=imread('circles.tif');imshow(BW);bweuler(BW)ans=-2相关命令:bwmorph,bwperim7.bwfill功能:填充二进制图像的背景色.语法:BW2=bwfill(BW1,c,r,n)BW2=bwfill(BW1,n)[BW2,idx]=bwfill(...)BW2=bwfill(x,y,BW1,xi,yi,n)[x,y,BW2,idx,xi,yi]=bwfill(...)BW2=bwfill(BW1,'holes',n)[BW2,idx]=bwfi
5、ll(BW1,'holes',n)举例MATLAB高级应用——图形及影像处理322BW1=[1000000011111000100010101000111011110111100110101000101010001110]BW2=bwfill(BW1,3,3,8)BW2=1000000011111000111110101111111011110111100110101000101010001110I=imread('blood1.tif');BW3=~im2bw(I);BW4=bwfill(BW3,'holes');imshow(BW3)figure,imshow(BW4)相关命
6、令:bwselect,roifill8.bwlabel功能:标注二进制图像中已连接的部分.语法:附录MATLAB图像处理命令323L=bwlabel(BW,n)[L,num]=bwlabel(BW,n)举例BW=[1110000011101100111011001110001011100010111000101110011011100000]L=bwlabel(BW,4)L=1110000011102200111022001110003011100030111000301110033011100000[r,c]=find(L==2);rc=[rc]rc=25352636相关命令:
7、bweuler,bwselect9.bwmorph功能:提取二进制图像的轮廓.语法:BW2=bwmorph(BW1,operation)BW2=bwmorph(BW1,operation,n)举例BW1=imread('circles.tif');MATLAB高级应用——图形及影像处理324imshow(BW1);BW2=bwmorph(BW1,'remove');BW3=bwmorph(BW1,'skel',Inf);imshow(BW2)figure,imshow(BW3)相