Matlab图像处理函数汇总Word格式文档下载.docx
- 文档编号:20589342
- 上传时间:2023-01-24
- 格式:DOCX
- 页数:27
- 大小:27.20KB
Matlab图像处理函数汇总Word格式文档下载.docx
《Matlab图像处理函数汇总Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《Matlab图像处理函数汇总Word格式文档下载.docx(27页珍藏版)》请在冰豆网上搜索。
average'
%均值滤波器
2、图像的增强
①直方图:
imhist函数用于数字图像的直方图显示,如:
imhist(i);
②直方图均化:
histeq函数用于数字图像的直方图均化,如:
j=histeq(i);
③对比度调整:
imadjust函数用于数字图像的对比度调整,如:
j=imadjust(i,[0.3,0.7],[]);
④对数变换:
log函数用于数字图像的对数变换,如:
j=double(i);
k=log(j);
⑤基于卷积的图像滤波函数:
filter2函数用于图像滤波,如:
h=[1,2,1;
0,0,0;
-1,-2,-1];
j=filter2(h,i);
⑥线性滤波:
利用二维卷积conv2滤波,如:
h=[1,1,1;
1,1,1;
1,1,1];
h=h/9;
j=conv2(i,h);
⑦中值滤波:
medfilt2函数用于图像的中值滤波,如:
j=medfilt2(i);
⑧锐化
(1)利用Sobel算子锐化图像,如:
%Sobel算子
(2)利用拉氏算子锐化图像,如:
h=[0,1,0;
1,-4,0;
0,1,0];
%拉氏算子
k=conv2(j,h,'
same'
m=j-k;
3、图像边缘检测
①sobel算子如:
j=edge(i,'
thresh)
②prewitt算子如:
prewitt'
③roberts算子
如:
roberts'
④log算子
⑤canny算子如:
canny'
⑥Zero-Cross算子如:
zerocross'
4、形态学图像处理
①膨胀:
是在二值化图像中“加长”或“变粗”的操作,函数imdilate执行膨胀运算,如:
a=imread('
104_7.tif'
%输入二值图像
b=[010;
111;
010];
c=imdilate(a,b);
②腐蚀:
函数imerode执行腐蚀,如:
b=strel('
disk'
1);
c=imerode(a,b);
③开运算:
先腐蚀后膨胀称为开运算,用imopen来实现,如:
square'
2);
c=imopen(a,b);
④闭运算:
先膨胀后腐蚀称为闭运算,用imclose来实现,如:
c=imclose(a,b);
===========================================================
Matlab图像处理相关函数命令大全
一、通用函数:
colorbar
显示彩色条
语法:
colorbar\colorbar('
vert'
)\colorbar('
horiz'
)\colorbar(h)\h=colorbar(...)\colorbar(...,'
peer'
axes_handle)
getimage从坐标轴取得图像数据
A=getimage(h)\[x,y,A]=getimage(h)\[...,A,flag]=getimage(h)\[...]=getimage
imshow显示图像
imshow(I,n)\imshow(I,[lowhigh])\imshow(BW)\imshow(X,map)\imshow(RGB)\imshow(...,display_option)\imshow(x,y,A,...)\imshowfilename\h=imshow(...)
montage在矩形框中同时显示多幅图像
montage(I)\montage(BW)\montage(X,map)\montage(RGB)\h=montage(...)
immovie创建多帧索引图的电影动画
mov=immovie(X,map)\mov=immovie(RGB)
subimage在一副图中显示多个图像
subimage(X,map)\subimage(I)\subimage(BW)\
subimage(RGB)\subimage(x,y,...)\subimage(...)
truesize调整图像显示尺寸
truesize(fig,[mrowsmcols])\truesize(fig)
warp将图像显示到纹理映射表面
warp(X,map)\warp(I,n)\warp(z,...)warp(x,y,z,...)\
h=warp(...)
zoom缩放图像
zoomon\zoomoff\zoomout\zoomreset\zoom\zoomxon\zoomyon\zoom(factor)\zoom(fig,option)
二、图像文件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,ICO,andTIFFonly)\[...]=imread(...,'
frames'
idx)(GIFonly)\[...]=imread(...,ref)(HDFonly)\[...]=imread(...,'
BackgroundColor'
BG)(PNGonly)\[A,map,alpha]=imread(...)(ICO,CUR,PNGonly)
imwrite
把图像写入(保存)图像文件中
imwrite(A,filename,fmt)\imwrite(X,map,filename,fmt)\imwrite(...,filename)\imwite(...,Param1,Val1,Param2,Val2...)
imcrop
剪切图像
I2=imcrop(I)\X2=imcrop(X,map)\RGB2=imcrop(RGB)\I2=imcrop(I,rect)\X2=imcrop(RGB,rect)\[...]=imcrop(x,y,...)\[A,rect]=imcrop(...)\[x,y,A,rect]=imcrop(...)
imresize
改变图像大小
B=imresize(A,m,method)
imrotate
旋转图像
B=imrotate(A,angle,method)\B=imrotate(A,angle,method,'
crop'
)
三、像素和统计处理函数
corr2
计算两个矩形的二维相关系数
r=corr2(A,B)
imcontour创建图像数据的轮廓图
imcontour(I,n)\imcontour(I,v)\imcontour(x,y,...)\imcontour(...,LineSpec)\[C,h]=imcontour(...)
imfeature
计算图像区域的特征尺寸
stats=imfeature(L,measurements)\stats=imfeature(L,measurements,n)
imbist
显示图像数据的柱状图
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,RGB,xi,yi)\P=impixel(x,y,X,map,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
std2计算矩阵元素的标准偏移
b=std2(A)
四、图像分析函数:
edge图像边缘检测
BW=edge(I,'
)\BW=edge(I,'
thresh)\BW=edge(I,'
thresh,direction)\[BW,thresh]=edge(I,'
...)\BW=edge(I,'
thresh,direction)\
[BW,thresh]=edge(I,'
...)\
BW=edge(I,'
thresh)\[BW,thresh]=edge(I,'
thresh,sigma)\[BW,threshold]=edge(I,'
thresh,h)\[BW,thresh]=edge(I,'
...)\
...)
qtgetblk
获取四叉树分解的块值
[vals,r,c]=qtgetblk(I,S,dim)\[vals,idx]=qtgetblk(I,S,dim)
qtsetblk设置四叉树分解中的块值
J=qtsetblk(I,S,dim,vals)
五、图像增强函数
histeq用柱状图均等化增强对比
J=histeq(I,hgram)\J=histeq(I,n)\[J,T]=histeq(I,...)\newmap=histeq(X,map,hgram)\newmap=histeq(X,map)
imadjust调整图像灰度值或颜色映像表
J=imadjust(I,[low_in,high_in]),[low_out,high_out],gamma)\newmap=imadjust(map,[low_in,high_in]),[low_out,high_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)
wiener2进行二维适应性去噪过滤处理
J=wiener2(I,[m
n],noise)\[J,noise]=wiener2(I,[mn])
六、线性滤波函数
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,'
filter2进行二维线性过滤操作
Y=filter2(h,X)\Y=filter2(h,X,shape)
fspecial创建预定义过滤器
h=fspecial(type)\h=fspecial(type,parameters)
七、线性二维滤波设计函数
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,fi,f2]]=freqz2(h,[n2,n1])\[H,fi,f2]]=freqz2(h,f1,f2])\[H,fi,f2]]=freqz2(h)\[...]=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)
八、图像变换函数
dct2进行二维离散余弦变换(反余弦变换用idct2)
B=dct2(A)\B=dct2(A,m.n)\B=dct2(A,[mn])
dctmtx计算离散余弦傅立叶变换
D=dctmtx(n)
fft2进行二维快速傅立叶变换(反变换用ifft2)
Y=fft2(X)\Y=fft2(X,m,n)
fftn进行n维快速傅立叶变换(反变换用ifftn)
Y=ffn(X)\Y=fftn(X,siz)
fftshift快速傅立叶变换的DC组件移到光谱中心
Y=fftshift(X)\Y=fftshift(X,dim)
iradon进行反radon变换
I=iradon(P,theta)\I=iradon(P,theta,interp,filter,d,n)\[I,h]=iradon(...)
phantom产生一个头部幻影图像
P=phantom(def,n)\P=phantom(E,n)\[P,E]=phantom(...)
radon计算radon变换
R=radon(I,theta)\[R,xp]=radon(...)
九、边沿和块处理函数
bestblk确定进行块操作的块大小
siz=bestblk([mn],k)\[mb,nb]=bestblk([mn],k)
blkproc实现图像的显示块操作
B=blkproc(A,[mn]),fun)\B=blkproc(A,[mn],fun,P1,P2,...)\B=blkproc(A,[mn],[mbordernborder],fun,...)
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],...)\B=colfilt(A,'
im2col重调图像块为列
B=im2col(A,[mn],block_type)\B=im2col(A,[mn])\B=im2col(A,'
nlfilter进行边沿操作
B=nlfilter(A,[mn],fun)\B=nlfilter(A,[mn],fun,P1,P2,...)\B=nlfilter(A,'
十、二进制图像操作函数
applylut在二进制图像中利用lookup表进行行边沿操作
A=applylut(BW,LUT)
bwarea计算二进制图像对象的面积
total=bwarea(BW)
bweuler计算二进制图像的欧拉数
eul=bweuler(BW)
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,idx]=bwfill(BW1,'
holes'
n)
bwlabel标注二进制图像中已连接的部分
L=bwlabel(BW,n)\[L,num]=bwlabel(BW,n)
bwmorph提取二进制图像的轮廓
BW2=bwmorph(BW1,operation)\BW2=bwmorph(BW1,operation,n)
bwperim计算二进制图像中对象的周长
BW2=bwperim(BW1)\BW2=bwperim(BW1,CONN)
bwselect在二进制图像中选择对象
BW2=bwselect(BW1,c,r,n)\BW2=bwselect(BW1,n)\[BW2,idx]=bwselect(...)\BW2=bwselect(x,y,BW1,xi,yi,n)\[x,y,BW2,idx,xi,yi]=bwselect(...)
dilate放大二进制图像
BW2=dilate(BW1,SE)\BW2=dilate(BW1,SE,alg)\BW2=dilate(BW1,SE,...,n)
erode弱化二进制图像的边界
BW2=erode(BW1,SE)\BW2=erode(BW1,SE,alg)\BW2=erode(BW1,SE,...,n)
makelut创建一个用于applylut函数的lookup表
lut=makelut(fun,n)\lut=makelut(fun,n,P1,P2,...)
十一、区域处理函数
roicolor选择感兴趣的颜色区
语法:
BW=roicolor(A,low,high)\BW=rocicolor(A,v)
roifill在图像的任意区域中进行平滑插补
J=roifill(I,c,r)\J=roifill(I)\J=roi
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Matlab 图像 处理 函数 汇总