matlab图像处理命令汇总.docx
《matlab图像处理命令汇总.docx》由会员分享,可在线阅读,更多相关《matlab图像处理命令汇总.docx(64页珍藏版)》请在冰豆网上搜索。
matlab图像处理命令汇总
matlab图像处理命令汇总
1.applylut6
2.bestblk6
3.blkproc6
4.brighten6
5.bwarea7
6.bweuler.7
7.bwfill7
8.bwlabel7
9.bwmorph7
10.bwperim8
11.bwselect8
12.cmpermute8
13.cmunique9
14.col2im9
15.colfilt9
16.colorbar9
17.conv2二维卷积操作.10
18.convmtx210
19.convn10
20.corr210
21.dct210
22.dctmtx11
23.dilate11
24.dither11
25.double11
26.edge12
27.erode12
28.fft213
29.fftn13
30.fftshift13
31.filter214
32.freqspace14
33.freqz214
34.fsamp214
35.fspecial15
36.ftrans215
37.fwind115
38.fwind216
39.getimage16
40.gray2ind17
41.grayslice17
42.histeq17
43.hsv2rgb17
44.idct218
45.ifft218
46.ifftn18
47.sim2bw18
48.im2col19
49.im2double19
50.im2uint819
51.im2uint1619
52.imadjust20
53.imapprox20
55.imcrop21
56.imfeature21
57.imfinfo21
58.imhist21
59.immovie22
60.imnoise22
61.impixel22
63.imread23
64.imresize24
65.imrotate24
66.imshow24
67.imwrite25
68.ind2gray25
69.ind2rgb25
70.iptgetpref26
71.iptsetpref26
72.iradon26
73.isbw26
74.isgray27
75.isind27
76.isrgb27
77.makelut27
78.mat2gray27
79.mean228
80.medfilt228
81.montage28
82.nlfilter29
83.ntsc2rgb29
84.ordfilt229
85.phantom29
86.pixval30
87.qtdecomp30
88.qtgetblk30
89.qtsetblk30
90.radon31
91.rgb2gray31
92.rgb2hsv31
93.rgb2ind31
94.rgb2ntsc32
95.rgb2ycbcr32
96.rgbplot32
97.roicolor32
98.roifill33
99.roifilt233
100.roipoly33
101.std234
102.subimage34
103.truesize34
104.uint835
105.uint1635
106.warp35
107.wiener235
108.ycbcr2rgb36
109.zoom36
110.fft2:
36
111.ifft2:
36
112.imnoise:
37
113.fspecial:
37
114.imhist37
115.histeq37
116.imadjust37
117.log37
118.filter237
119.conv238
120.medfilt238
121.Sobel算子锐化图像38
122.利用拉氏算子锐化图像38
123.sobel算子图像边缘检测38
124.prewitt算子图像边缘检测38
125.roberts算子图像边缘检测39
126.log算子图像边缘检测39
127.canny算子图像边缘检测39
128.Zero-Cross算子图像边缘检测39
129.imdilate膨胀:
39
130.imerode执行腐蚀39
131.imopen开运算39
132.imclose闭运算39
133.imhist:
计算和显示图像的色彩直方图40
134.imcontour:
显示图像的等灰度值图40
135.imadjust:
通过直方图变换调整对比度40
136.histeq:
直方图均衡化40
137.imnoise函数40
138.conv2函数:
计算二维卷积41
139.conv:
计算多维卷积41
140.filter2:
计算二维线型数字滤波,它与函数fspecial连用41
141.fspecial:
产生预定义滤波器41
142.imfilter:
真彩色增强42
143.离散傅立叶变换的Matlab实现fft、fft2和fftn42
144.离散余弦变换的Matlab实现dCT2dict2dctmtx42
145.图像小波变换的Matlab实现dwtidwtwcodematdwt2wavedec2idwt243
146.图像处理工具箱45
147.MATLAB图像类型转换47
148.图像文件的读写和查询47
149.图像文件的显示48
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)
2.bestblk
功能:
确定进行块操作的块大小.
语法:
siz=bestblk([mn],k)
[mb,nb]=bestblk([mn],k)
3.blkproc
功能:
实现图像的显式块操作.
语法:
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,[]);
相关命令:
colfilt,nlfilter,inline
4.brighten
功能:
增加或降低颜色映像表的亮度.
语法:
brighten(beta)
newmap=brighten(beta)
newmap=brighten(map,beta)
brighten(fig,beta)
相关命令:
imadjust,rgbplot
5.bwarea
功能:
计算二进制图像对象的面积.
语法:
total=bwarea(BW)
举例BW=imread('circles.tif');
imshow(BW);
bwarea(BW)
ans=
15799
相关命令:
bweuler,bwperim
6.bweuler.
功能:
计算二进制图像的欧拉数.
语法:
eul=bweuler(BW,n)
相关命令:
bwmorph,bwperim
7.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]=bwfill(BW1,'holes',n)
8.bwlabel
功能:
标注二进制图像中已连接的部分.
语法:
L=bwlabel(BW,n)
[L,num]=bwlabel(BW,n)
相关命令:
bweuler,bwselect
9.bwmorph
功能:
提取二进制图像的轮廓.
语法:
BW2=bwmorph(BW1,operation)
BW2=bwmorph(BW1,operation,n)
举例
BW1=imread('circles.tif');
imshow(BW1);
BW2=bwmorph(BW1,'remove');
BW3=bwmorph(BW1,'skel',Inf);
imshow(BW2)
figure,imshow(BW3)
相关命令:
bweuler,bwperim,dilate,erode
10.bwperim
功能:
计算二进制图像中对象的周长.
语法:
BW2=bwperim(BW1,n)
举例
BW1=imread('circbw.tif');
BW2=bwperim(BW1,8);
imshow(BW1)
figure,imshow(BW2)
附录MATLAB图像处理命令325
相关命令:
bwarea,bweuler,bwfill
11.bwselect
功能:
在二进制图像中选择对象.
语法:
BW2=bwselect(BW1,c,r,n)
BW2=bwselect(BW1,n)
[BW2,idx]=bwselect(...)
举例
BW1=imread('text.tif');
c=[1690144];
r=[85197247];
BW2=bwselect(BW1,c,r,4);
imshow(BW1)
figure,imshow(BW2)
相关命令:
bwfill,bwlabel,impixel,roipoly,roifill
12.cmpermute
功能:
调整颜色映像表中的颜色.
语法:
[Y,newmap]=cmpermute(X,map)
[Y,newmap]=cmpermute(X,map,index)
举例
Toorderacolormapbyluminance,use:
ntsc=rgb2ntsc(map);
[dum,index]=sort(ntsc(:
1));
[Y,newmap]=cmpermute(X,map,index);
相关命令:
randperm
13.cmunique
功能:
查找颜色映像表中特定的颜色及相应的图像.
语法:
[Y,newmap]=cmunique(X,map)
[Y,newmap]=cmunique(RGB)
[Y,newmap]=cmunique(I)
相关命令:
gray2ind,rgb2ind
14.col2im
功能:
将矩阵的列重新组织到块中.
语法:
A=col2im(B,[mn],[mmnn],block_type)
A=col2im(B,[mn],[mmnn])
相关命令:
blkproc,colfilt,im2col,nlfilter
15.colfilt
功能:
利用列相关函数进行边沿操作.
语法:
B=colfilt(A,[mn],block_type,fun)
B=colfilt(A,[mn],block_type,fun,P1,P2,...)
B=colfilt(A,[mn],[mblocknblock],block_type,fun,...)
B=colfilt(A,'indexed',...)
相关命令:
blkproc,col2im,im2col,nlfilter
16.colorbar
功能:
显示颜色条.
语法:
colorbar('vert')
colorbar('horiz')
colorbar(h)
colorbar
h=colorbar(...)
举例
I=imread('blood1.tif');
h=fspecial('log');
I2=filter2(h,I);
imshow(I2,[]),colormap(jet(64)),colorbar
17.conv2二维卷积操作.
功能:
进行二维卷积操作.
语法:
C=conv2(A,B)
C=conv2(hcol,hrow,A)
C=conv2(...,shape)
相关命令:
filter2
18.convmtx2
功能:
计算二维卷积矩阵.
语法:
T=convmtx2(H,m,n)
T=convmtx2(H,[mn])
相关命令:
conv2
19.convn
功能:
计算n维卷积.
语法:
C=convn(A,B)
C=convn(A,B,shape)
相关命令:
conv2
20.corr2
功能:
计算两个矩阵的二维相关系数.
附录MATLAB图像处理命令329
语法:
r=corr2(A,B)
相关命令:
std2
21.dct2
功能:
进行二维离散余弦变换.
语法:
B=dct2(A)
B=dct2(A,m,n)
B=dct2(A,[mn])
举例
RGB=imread('autumn.tif');
I=rgb2gray(RGB);
J=dct2(I);
imshow(log(abs(J)),[]),colormap(jet(64)),colorbar
J(abs(J)<10)=0;
K=idct2(J)/255;
imshow(K)
相关命令:
fft2,idct2,ifft2
22.dctmtx
功能:
计算离散余弦变换矩阵.
语法:
D=dctmtx(n)
相关命令:
dct2
23.dilate
功能:
放大二进制图像.
语法:
BW2=dilate(BW1,SE)
BW2=dilate(BW1,SE,alg)
BW2=dilate(BW1,SE,...,n)
举例
BW1=imread('text.tif');
SE=ones(6,2);
BW2=dilate(BW1,SE);
imshow(BW1)
figure,imshow(BW2)
相关
命令:
bwmorph,erode
24.dither
功能:
通过抖动增加外观颜色分辨率,转换图像.
语法:
X=dither(RGB,map)
BW=dither(I)
相关命令:
rgb2ind
25.double
功能:
转换数据为双精度型.
语法:
B=double(A)
举例
A=imread('saturn.tif');
B=sqrt(double(A));
相关命令:
im2double,im2uint,uint8
26.edge
功能:
识别强度图像中的边界.
语法:
BW=edge(I,'sobel')
BW=edge(I,'sobel',thresh)
BW=edge(I,'sobel',thresh,direction)
[BW,thresh]=edge(I,'sobel',...)
BW=edge(I,'prewitt')
BW=edge(I,'prewitt',thresh)
BW=edge(I,'prewitt',thresh,direction)
[BW,thresh]=edge(I,'prewitt',...)
BW=edge(I,'roberts')
BW=edge(I,'roberts',thresh)
[BW,thresh]=edge(I,'roberts',...)
BW=edge(I,'log')
BW=edge(I,'log',thresh)
BW=edge(I,'log',thresh,sigma)
[BW,threshold]=edge(I,'log',...)
BW=edge(I,'zerocross',thresh,h)
[BW,thresh]=edge(I,'zerocross',...)
BW=edge(I,'canny')
BW=edge(I,'canny',thresh)
BW=edge(I,'canny',thresh,sigma)
MATLAB高级应用——图形及影像处理332
[BW,threshold]=edge(I,'canny',...)
举例
I=imread('rice.tif');
BW1=edge(I,'prewitt');
BW2=edge(I,'canny');
imshow(BW1);
figure,imshow(BW2)
27.erode
功能:
弱化二进制图像的边界.
语法:
BW2=erode(BW1,SE)
BW2=erode(BW1,SE,alg)
BW2=erode(BW1,SE,...,n)
举例
BW1=imread('text.tif');
SE=ones(3,1);
BW2=erode(BW1,SE);
imshow(BW1)
figure,imshow(BW2)
相关命令:
bwmorph,dilate
附录MATLAB图像处理命令333
28.fft2
功能:
进行二维快速傅里叶变换.
语法:
B=fft2(A)
B=fft2(A,m,n)
举例
loadimdemossaturn2
imshow(saturn2)
B=fftshift(fft2(saturn2));
imshow(log(abs(B)),[]),colormap(jet(64)),colorbar
相关命令:
dct2,fftshift,idct2,ifft2
29.fftn
功能:
进行n维快速傅里叶变换.
语法:
B=fftn(A)
B=fftn(A,siz)
相关命令:
fft2,ifftn
30.fftshift
功能:
把快速傅里叶变换的DC组件移到光谱中心.
语法:
B=fftshift(A)
举例
B=fftn(A);
C=fftshift(B);
相关命令:
fft2,fftn,ifftshift
31.filter2
功能:
进行二维线性过滤操作.
语法:
B=filter2(h,A)
B=filter2(h,A,shape)
相关命令:
conv2,roifilt2
32.freqspace
功能:
确定二维频率响应的频率空间.
语法:
[f1,f2]=freqspace(n)
[f1,f2]=freqspace([mn])
[x1,y1]=freqspace(...,'meshgrid')
f=freqspace(N)
f=freqspace(N,'whole')
相关命令:
fsamp2,fwind1,fwind2
33.freqz2
功能:
计算二维频率响应.
语法:
[H,f1,f2]=freqz2(h,n1,n2)
[H,f1,f2]=freqz2(h,[n2n1])
[H,f1,f2]=freqz2(h,f1,f2)
[H,f1,f2]=freqz2(h)
[...]=freqz2(h,...,[dxdy])
[...]=freqz2(h,...,dx)
freqz2(...)
举例
Hd=zeros(16,16);
Hd(5:
12,5:
12)=1;
Hd(7:
10,7:
10)=0;
h=fwind1(Hd,bartlett(16));
colormap(jet(64))
freqz2(h,[3232]);axis([-11-1101])
34.fsamp2
功能:
用频率采样法设计二维FIR过滤器.
语法:
h=fsamp2(Hd)
h=fsamp2(f1,f2,Hd,[mn])
举例
[f1,f2]=freqspace(21,'meshgrid');
Hd=ones(21);
r=sqrt(f1.^2+f2.^2);
Hd((r0.5))=0;
colormap(jet(64))
mesh(f1,f2,Hd)
相关命令:
conv2,filter2,freqspace,ftrans2,fwind1,fwind2
35.fspecial
功能:
创建预定义过滤器.
语法:
h=fspecial(type)
h=fspecial(type,parameters)
举例
I=imread('saturn.tif');
h=fspecial('unsharp',0.5);
I2=filter2(h,I)/255;
imshow(I)
figure,imshow(I2)
相关命令:
conv2,edge,filter2,fsamp2,fwind1,fwind2
36.ftrans2
功能:
通过频率转换设计二维FIR过滤器.
语法:
h=ftrans2(b,t)
h=ftrans2(b)
举例
colormap(j