matlab图像处理常用函数列表.docx
《matlab图像处理常用函数列表.docx》由会员分享,可在线阅读,更多相关《matlab图像处理常用函数列表.docx(25页珍藏版)》请在冰豆网上搜索。
matlab图像处理常用函数列表
附录MATLAB图像处理工具箱函数表1通用函数
函数
功能
语法
colorbar
显示颜色条
colorbar
colorbar(...,'peer',axes_handle)
colorbar(axes_handle)
colorbar('location')
colorbar(...,'PropertyName',propertyvalue)
cbar_axes=colorbar(...)
getimage
从坐标轴取得图像数据
A=getimage(h)
[x,y,A]=getimage(h)
[...,A,flag]=getimage(h)
[...]=getimage
image
创建并显示图像对象
image(C)
image(x,y,C)
image(...,'PropertyName',PropertyValue,...)
image('PropertyName',PropertyValue,...)Formalsyntax-PN/PVonly
handle=image(...)
imagesc
按图像显示数据矩阵
imagesc(C)
imagesc(x,y,C)
imagesc(...,clims)
h=imagesc(...)
imshow
显示图像
imshow(I,n)
imshow(I,[lowhigh])
imshow(BW)
imshow(X,map)
imshow(RGB)
imshow(…,display_option)
imshow(x,y,A,…)
imshowfilename
h=imshow(…)
imview
利用图像浏览器显示图像
imview(I)
imview(RGB)
imview(X,map)
imview(I,range)
imview(filename)
imview(...,'InitialMagnification',initial_mag)
h=imview(...)
imviewcloseall
montage
在矩形框中同时显示多帧图像
montage(I)
montage(BW)
montage(X,map)
montage(RGB)
h=montage(...)
immovie
创建多帧索引色图像的电影动画
mov=immovie(X,map)
mov=immovie(RGB)
subimage
在一个图形中显示多个图像,结合函数subplot使用
subimage(X,map)
subimage(I)
subimage(BW)
subimage(RGB)
subimage(x,y,...)
h=subimage(...)
truesize
调整图像显示尺寸
truesize(fig,[mrowsmcols])
truesize(fig)
wrap
将图像显示到纹理映射表面
warp(X,map)
warp(I,n)
warp(BW)
warp(RGB)
warp(z,...)
warp(x,y,z,...)
h=warp(...)
zoom
缩放图像或图形
zoomon
zoomoff
zoomout
zoomreset
zoom
zoomxon
zoomyon
zoom(factor)
zoom(fig,option)
表2图像文件I/O函数
函数
功能
语法
imfinfo
返回图像文件信息
info=imfinfo(filename,fmt)
info=imfinfo(filename)
imread
从图像文件中读取图像
A=imread(filename,fmt)
[X,map]=imread(filename,fmt)
[...]=imread(filename)
[...]=imread(URL,...)
[...]=imread(...,idx)
(CUR,GIF,ICO,andTIFFonly)
[...]=imread(...,'PixelRegion',{ROWS,COLS})(TIFFonly)
[...]=imread(...,'frames',idx)(GIFonly)
[...]=imread(...,ref)(HDFonly)
[...]=imread(...,'BackgroundColor',BG)
(PNGonly)
[A,map,alpha]=imread(...)
(ICO,CUR,andPNGonly)
imwrite
把图像写入图像文件中
imwrite(A,filename,fmt)
imwrite(X,map,filename,fmt)
imwrite(...,filename)
imwrite(...,Param1,Val1,Param2,Val2...)
表3空间变换函数
函数
功能
语法
findbounds
为空间变换寻找输出边界
outbounds=findbounds(TFORM,inbounds)
fliptform
切换空间变换结构的输入和输出角色
TFLIP=fliptform(T)
imcrop
剪切图像
I2=imcrop(I)
X2=imcrop(X,map)
RGB2=imcrop(RGB)
I2=imcrop(I,rect)
X2=imcrop(X,map,rect)
RGB2=imcrop(RGB,rect)
[...]=imcrop(x,y,...)
[A,rect]=imcrop(...)
[x,y,A,rect]=imcrop(...)
imresize
图像缩放
B=imresize(A,m)
B=imresize(A,m,method)
B=imresize(A,[mrowsncols],method)
B=imresize(...,method,n)
B=imresize(...,method,h)
imrotate
图像旋转
B=imrotate(A,angle)
B=imrotate(A,angle,method)
B=imrotate(A,angle,method,bbox)
interp2
2-D数据插值
ZI=interp2(X,Y,Z,XI,YI)
ZI=interp2(Z,XI,YI)
ZI=interp2(Z,ntimes)
ZI=interp2(X,Y,Z,XI,YI,method)
imtransform
对图像进行2-D空间变换
B=imtransform(A,TFORM)
B=imtransform(A,TFORM,INTERP)
[B,XDATA,YDATA]=imtransform(...)
[B,XDATA,YDATA]=imtransform(...,param1,val1,param2,val2,...)
makeresampler
生成重采样结构
R=makeresampler(interpolant,padmethod)
maketform
生成几何变换结构
T=maketform(transformtype,...)
tformarray
多维数组的空间变换
B=tformarray(A,T,R,TDIMS_A,TDIMS_B,TSIZE_B,TMAP_B,F)
tformfwd
正向空间变换
[X,Y]=tformfwd(T,U,V)
[X1,X2,X3,...]=tformfwd(T,U1,U2,U3,...)
X=tformfwd(T,U)
[X1,X2,X3,...]=tformfwd(T,U)
X=tformfwd(T,U1,U2,U3,...)
tforminv
逆向空间变换
U=tforminv(X,T)
表4像素和统计处理函数
函数
功能
语法
corr2
计算两个矩阵的2-D相关系数
r=corr2(A,B)
imcontour
创建图像的轮廓图
imcontour(I)
imcontour(I,n)
imcontour(I,v)
imcontour(x,y,...)
imcontour(...,LineSpec)
[C,h]=imcontour(...)
imhist
显示图像的直方图
imhist(I,n)
imhist(X,map)
[counts,x]=imhist(...)
impixel
确定像素颜色值
P=impixel(I)
P=impixel(X,map)
P=impixel(RGB)
P=impixel(I,c,r)
P=impixel(X,map,c,r)
P=impixel(RGB,c,r)
[c,r,P]=impixel(...)
P=impixel(x,y,I,xi,yi)
P=impixel(x,y,X,map,xi,yi)
P=impixel(x,y,RGB,xi,yi)
[xi,yi,P]=impixel(x,y,...)
improfile
沿线段计算剖面图的像素值
c=improfile
c=improfile(n)
c=improfile(I,xi,yi)
c=improfile(I,xi,yi,n)
[cx,cy,c]=improfile(...)
[cx,cy,c,xi,yi]=improfile(...)
[...]=improfile(x,y,I,xi,yi)
[...]=improfile(x,y,I,xi,yi,n)
[...]=improfile(...,method)
mean2
求矩阵元素平均值
B=mean2(A)
pixval
显示图像像素信息
pixvalon
pixvaloff
pixval
pixval(fig,option)
pixval(ax,option)
pixval(H,option)
regionprops
得到图像区域属性
STATS=regionprops(L,properties)
std2
计算矩阵元素的标准偏移
b=std2(A)
表5图像分析函数
函数
功能
语法
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',...)
qtdecomp
执行四叉树分解
S=qtdecomp(I)
S=qtdecomp(I,threshold)
S=qtdecomp(I,threshold,mindim)
S=qtdecomp(I,threshold,[mindimmaxdim])
S=qtdecomp(I,fun)
S=qtdecomp(I,fun,P1,P2,...)
qtgetblk
获取四叉树分解中的数组块值
[vals,r,c]=qtgetblk(I,S,dim)
[vals,idx]=qtgetblk(I,S,dim)
qtsetblk
设置四叉树分解中的数组块值
J=qtsetblk(I,S,dim,vals)
表6图像增强函数
函数
功能
语法
adapthisteq
执行对比度受限的直方图均衡
J=adapthisteq(I)
J=adapthisteq(I,param1,val1,param2,val2...)
decorrstretch
对多通道图像应用解卷积延拓
S=decorrstretch(I)
S=decorrstretch(I,TOL)
histeq
用直方图均等化增强对比度
J=histeq(I,hgram)
J=histeq(I,n)
[J,T]=histeq(I,...)
newmap=histeq(X,map,hgram)
newmap=histeq(X,map)
[newmap,T]=histeq(X,...)
imadjust
调整图像灰度值或颜色映射表
J=imadjust(I)
J=imadjust(I,[low_in;high_in],[low_out;high_out])
J=imadjust(...,gamma)
newmap=imadjust(map,[low_inhigh_in],[low_outhigh_out],gamma)
RGB2=imadjust(RGB1,...)
imnoise
向图像中加入噪声
J=imnoise(I,type)
J=imnoise(I,type,parameters)
medfilt2
进行二维中值滤波
B=medfilt2(A,[mn])
B=medfilt2(A)
B=medfilt2(A,'indexed',...)
ordfilt2
进行二维统计顺序滤波
B=ordfilt2(A,order,domain)
B=ordfilt2(A,order,domain,S)
B=ordfilt2(...,padopt)
stretchlim
得到图像对比度延拓的灰度上下限
LOW_HIGH=stretchlim(I,TOL)
LOW_HIGH=stretchlim(RGB,TOL)
wiener2
进行二维适应性去噪滤波
J=wiener2(I,[mn],noise)
[J,noise]=wiener2(I,[mn])
表7线性滤波函数
函数
功能
语法
conv2
二维卷积
C=conv2(A,B)
C=conv2(hcol,hrow,A)
C=conv2(...,'shape')
convmtx2
二维矩阵卷积
T=convmtx2(H,m,n)
T=convmtx2(H,[mn])
convn
n维卷积
C=convn(A,B)
C=convn(A,B,'shape')
filter2
二维线性滤波
Y=filter2(h,X)
Y=filter2(h,X,shape)
fspecial
创建预定义滤波器
h=fspecial(type)
h=fspecial(type,parameters)
imfilter
多维图像滤波
B=imfilter(A,H)
B=imfilter(A,H,option1,option2,...)
表8线性二维滤波器设计函数
函数
功能
语法
freqspace
确定二维频率响应的频率空间
[f1,f2]=freqspace(n)
[f1,f2]=freqspace([mn])
[x1,y1]=freqspace(...,'meshgrid')
f=freqspace(N)
f=freqspace(N,'whole')
freqz2
计算二维频率响应
[H,f1,f2]=freqz2(h,n1,n2)
[H,f1,f2]=freqz2(h,[n2n1])
[H,f1,f2]=freqz2(h)
[H,f1,f2]=freqz2(h,f1,f2)
[...]=freqz2(h,...,[dxdy])
[...]=freqz2(h,...,dx)
freqz2(...)
fsamp2
用频率采样法设计二维FIR滤波器
h=fsamp2(Hd)
h=fsamp2(f1,f2,Hd,[mn])
ftrans2
通过频率转换法设计二维FIR滤波器
h=ftrans2(b,t)
h=ftrans2(b)
fwind1
用一维窗口方法设计二维FIR滤波器
h=fwind1(Hd,win)
h=fwind1(Hd,win1,win2)
h=fwind1(f1,f2,Hd,...)
fwind2
用二维窗口方法设计二维FIR滤波器
h=fwind2(Hd,win)
h=fwind2(f1,f2,Hd,win)
表9图像变换函数
函数
功能
语法
dct2
进行二维离散余弦变换
B=dct2(A)
B=dct2(A,m,n)
B=dct2(A,[mn])
dctmtx
计算离散余弦变换矩阵
D=dctmtx(n)
fft2
进行二维快速傅立叶变换
Y=fft2(X)
Y=fft2(X,m,n)
fftn
进行n维快速傅立叶变换
Y=fftn(X)
Y=fftn(X,siz)
fftshift
转换快速傅立叶变换的输出象限
Y=fftshift(X)
Y=fftshift(X,dim)
idct2
计算二维逆离散余弦变换
B=idct2(A)
B=idct2(A,m,n)
B=idct2(A,[mn])
ifft2
计算二维逆快速傅立叶变换
Y=ifft2(X)
Y=ifft2(X,m,n)
y=ifft2(...,'nonsymmetric')
y=ifft2(...,'nonsymmetric')
ifftn
计算n维逆快速傅立叶变换
Y=ifftn(X)
Y=ifftn(X,siz)
y=ifftn(...,'nonsymmetric')
y=ifftn(...,'nonsymmetric')
iradon
逆Radon变换
I=iradon(R,theta)
I=iradon(R,theta,interp,filter,frequency_scaling,output_size)
[I,H]=iradon(...)
phantom
产生一个头部幻影图像
P=phantom(def,n)
P=phantom(E,n)
[P,E]=phantom(...)
radon
计算Radon变换
R=radon(I,theta)
[R,xp]=radon(…)
fanbeam
计算扇形投影变换
F=fanbeam(I,D)
F=fanbeam(...,param1,val1,param1,val2,...)
[F,sensor_positions,fan_rotation_angles]=fanbeam(...)
表10边沿和块处理函数
函数
功能
语法
bestblk
确定进行块操作的块大小
siz=bestblk([mn],k)
[mb,nb]=bestblk([mn],k)
blkproc
实现图像的非重叠(distinct)块操作
B=blkproc(A,[mn],fun)
B=blkproc(A,[mn],fun,P1,P2,...)
B=blkproc(A,[mn],[mbordernborder],fun,...)
B=blkproc(A,'indexed',...)
col2im
将矩阵的列重新组织到块中
A=col2im(B,[mn],[mmnn],block_type)
A=col2im(B,[mn],[mmnn])
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',...)
im2col
重调图像块为列
B=im2col(A,[mn],block_type)
B=im2col(A,[mn])
B=im2col(A,'indexed',...)
nlfilter
通用滑动邻域操作
B=nlfilter(A,[mn],fun)
B=nlfilter(A,[mn],fun,P1,P2,...)
B=nlfilter(A,'indexed',...)
表11图像形态学操作函数
函数
功能
语法
applylut
在二值图像中利用查找表进行邻域操作
A=applylut(BW,LUT)
bwarea
计算二值图像的对象面积
total=bwarea(BW)
bweuler
计算二值图像的欧拉数
eul=bweuler(BW,n)
bwhitmiss
执行二值图像的击中和击不中操作
BW2=bwhitmiss(BW1,SE1,SE2)
BW2=bwhitmiss(BW1,INTERVAL)
bwlabel
标注二值图像中已连接的部分
L=bwlabel(BW,n)
[L,num]=bwlabel(BW,n)
bwmorph
二值图像的通用形态学操作
BW2=bwmorph(BW,operation)
BW2=bwmorph(BW,operation,n)
bwperim
计算二值图像中对象的周长
BW2=bwperim(BW1)
BW2=bwperim(BW1,CONN)
bwselect
在二值图像中选择对象
BW2=bwselect(BW,c,r,n)
BW2=bwselect(BW,n)
[BW2,idx]=bwselect(...)
BW2=bwselect(x,y,B