matlab图像处理-常用函数列表.docx.pdf

上传人:tbuqq 文档编号:5616133 上传时间:2020-07-02 格式:PDF 页数:23 大小:660.02KB
返回 下载 相关 举报
matlab图像处理-常用函数列表.docx.pdf_第1页
第1页 / 共23页
matlab图像处理-常用函数列表.docx.pdf_第2页
第2页 / 共23页
matlab图像处理-常用函数列表.docx.pdf_第3页
第3页 / 共23页
matlab图像处理-常用函数列表.docx.pdf_第4页
第4页 / 共23页
matlab图像处理-常用函数列表.docx.pdf_第5页
第5页 / 共23页
点击查看更多>>
资源描述

《matlab图像处理-常用函数列表.docx.pdf》由会员分享,可在线阅读,更多相关《matlab图像处理-常用函数列表.docx.pdf(23页珍藏版)》请在三一文库上搜索。

1、附录MATLAB图像处理工具箱函数 表1通用函数 函数功能语法 colorbar 显示颜色条 colorbar colorbar(./peeraxes_handle) colorbar(axes_handle) colorbalocation 1) colorbar(./PropertyName*,property value) cbar_axes = colorbar ( ) getimage 从坐标轴取得图像数据 A = getimage(h) x,y,A = getimage(h) .,A,flag = getimage(h) .=getimage image 创建并显示图像对象 ima

2、ge(C) image(x,y,C) image(./PropertyNameProperty Value,.) image( ,PropertyNameProperty Value,.) Formal syntax - PN/PV only handle = image ( ) imagesc 按图像显示数据矩阵 imagesc(C) imagesc(x,y,C) imagesc ( Qims) h = imagesc(.) imshow 显示图像 imshow(I,n) imshow(IJlow high) imshow(BW) imshow(X,map) imshow(RGB) imsh

3、o w( ,display_option) imshow(x,yA ) imshow filename h = imshow( ) imview 利川图像浏览器显示图像 imview(I) imview(RGB) imview(X,map) imview(I,range) imview(filename) imview(./InitialMagnificationinitial_mag) h = imview( ) imview close all montage 在矩形框中同时显示多帧图 像 montage(I) montage(BW) montage(X,map) montage(RGB)

4、 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,mrows mcols) truesize(fig) wrap 将图像显示到纹理映射农面 warp(X.map) warp(I5n)

5、 warp(BW) warp(RGB) warp(z,.) warp(x,y,z,) h = warp(.) zoom on zoom off zoom out zoom reset zoom zoom xon zoom yon zoom(factor) zoom(fig, option) zoom 缩放图像或图形 表2图像文件I/O函数 函数功能语法 imfinfo 返回图像文件信息 info = imfinfo(filename5fmt) info = imfinfo(filename) imread 从图像文件中读取图像 A = imread(filename,fmt) X,map =

6、imread(filename,fmt) .=imread(filename) .=imread(URL,.) =imread(.,idx) (CUR, GIF, ICO, and TIFF only) =imread(., PixelRegion, ROWS, COLS ) (TIFF only) .=imread(./framesidx) (GIF only) .=imread(.,ref) (HDF only) .=imread(./BackgroundColorBG) (PNG only) A,map,alpha = imread( ) (ICO, CUR, and PNG only)

7、 imwrite 把图像写入图像文件中 imwrite(A,filename,fmt) imwrite(X,map,filename,fmt) i m write(.,filename) imwrite( , Param 1 ,Vall f aram2,Val2 ) 表3空间变换函数 函数功能语法 findbounds 为空间变换寻找输出边界outbounds = findbounds(TFORM,inbounds) fliptform 切换空间变换结构的输入和 输出角色 TFLIP = fliptform(T) imcrop 剪切图像 12 = imcrop(I) X2 = imcrop(X

8、,map) RGB2 = imcrop(RGB) 12 = imcrop(I,rect) X2 = imcrop(X,map,rect) RGB2 = imcrop(RGB,rect) =imcrop(x,y,) A,rectJ = imcrop( ) xyAject = imcrop ( ) imresize 图像缩放 B = imresize(A,m) B = imresize( A,m,method) B = imresize(A,mrows ncols,method) B = imresize(.,method,n) B = imresize( , method,h) imrotate

9、 图像旋转 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,X DAT

10、A, YD ATA = imtransform(.) B,X DATA, YD ATA = imtransform(M param 1, vail, param2, val2, ) makeresampler 生成重采样结构 R = makeresampler(interpolant,padmethod) maketform 生成几何变换结构T = maketform(transformtypev) tformarray 多维数组的空间变换 B = tformarray(A, T, R, TDIMS_A, TDIMS_B, TSIZE_B, TMAP_B,F) tformfwd 正向空1可变换

11、 X,Y = tformfwd(T,U,V) X1,X2,X3,. = tformfwd(T,U 1 ,U2,U3,.) X = tformfwd(T,U) X1,X2,X3,.二tformfwd(T,U) X = tformfwd(T,Ul ,U2,U3,.) tforminv 逆向空间变换U = tforminv(X,T) 表4像素和统计处理函数 函数功能语法 corr2 计算两个矩阵的2-D相关系 数 r = COIT2(A,B) imcontour 创建图像的轮廓图 imcontour(I) imcontour(Ln) imcontour(Lv) imcontour(x,y,.) im

12、contour(.,LineSpec) C,h = imcontour( ) imhist 显示图像的直方图 imhist(I,n) imhist(X,map) counts,xj = imhist( ) impixel 确定像素颜色值 P = impixel(I) P = impixeI(X,map) P = impixel(RGB) P = impixel(I,c,r) P = impixel(X,map,c,r) P = impixeI(RGB,c,r) fc,r,Fl = impixel ( ) P = impixel(x,y,xi,yi) P = impixel(x,y,X,map,

13、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,yj,xi,yi) .=improfile(x,y,I,xi,yi,n) .=improfile(.,method) mean2 求矩阵元素平

14、均值B = mean2(A) pixval 显示图像像素信息 pixval on pixval off pixval pixval(fig,option) pixval(ax,option) pixval(H,option) regionprops 得到图像区域属性STATS = regionprops(L,properties) std2 计算矩阵元素的标准偏移b = std2(A) 表5图像分析函数 函数功能语法 edge 识别灰度图像中的边界 BW = edged, ,sober) BW = edge(I,sobel,thresh) BW = edge(I,sobel,thresh,di

15、rection) 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 1,thresh) BW,thresh = edgeCI/roberts 1,.) BW = edge(I;log) BW = edge(I,log,thresh) BW = edge(I,log*,th

16、resh,sigma) BW,threshold = edge(I,log,.) qtdecomp 执行四义树分解 S = qtdecomp(I) S = qtdecomp(Lthreshold) S = qtdecomp(I,threshold jnindim) S = qtdecomp(I,threshold,mindim maxdim) S = qtdecomp(I,fun) S = qtdecomp(I,fun,Pl,P2,) qtgetblk 获取四义树分解中的数组块 值 vals,r,c = qtgetblk(I,S,dim) vals,idx = qtgetblk(I,S,dim

17、) qtsetblk 设置四叉树分解屮的数纽? 块 值 J = qtsetblk(LS,dim,vals) 表6图像增强函数 函数功能语法 adaplhisteq 执行对比度受限的宜方图均 衡 J = adapthisteq(I) J = adapthisteq(I,paraml,vall,param2,val2.) decorrstretch 对多通道图像应用解卷积延 拓 S = decorrstretch(I) S = decorrstretch(I,TOL) histeq 用直方图均等化增强对比度 J = histeq(Lhgram) J = histeq(I,n) J,T = hist

18、eq(I,.) n ewmap = histeq(X,map,hgram) n ewmap = histeq(X5map) newmap,T| = histeq(X,.) imadjust 调整图像灰度值或颜色映射 表 J = imadjust(I) J = imadjust(I,low_in; high_in,low_out; high_out) J = i madj ust(gamma) new map = imadjust(map, low _in high_in, low_out high_out, gamma) RGB2 = imadjust(RGBl,.) imnoise 向图像中

19、加入噪声 J = imnoise(Ltype) J = imnoise(I,type,parameters) medfilt2 进行二维中值滤波 B = medfilt2(A,m n) 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) LO

20、W_HIGH = stretchlim(RGB,TOL) wiener2 进行二维适应性去噪滤波 J = wiener2(IJm n,noise) J,noise = wiener2(I,m nJ) 表7线性滤波函数 函数功能语法 conv2 二维卷积 C = conv2(A,B) C = conv2(hcol,hrow,A) C = conv2(./shape 1) convmtx2 二维矩阵卷积 T = convmtx2(H,m,n) T = convmtx2(H,m n) convn n维卷积 C = convn(A,B) C = con vn( A,B /shape 1) filter

21、2 二维线性滤波 Y = filter2(h,X) Y = filter2(h,X,shape) fspecial 创建预定义滤波器 h = fspecial(type) h = fspecial(type,parameters) imfilter 多维图像滤波 B = imfi!ter(A,H) B = imfilter( A,H,option l,option2v?) 表8线性二维滤波器设计函数 函数功能语法 freqspace 确定二维频率响应的频率空 间 fl ,f2 = freqspace(n) ffl,f2 = freqspace(m n) xl,yl = freqspace(./

22、meshgricr) f = freqspace(N) f = freqspace(N/whole f ) freqz2 计算二维频率响应 H,fl, f2 = freqz2(h,nl,n2) H,fl,f2 = freqz2(h,n2nl) H,fl,f2 = freqz2(h) H,fl,f2 = freqz2(h,fl,f2) .=freqz2(h,.,dx dy) .=freqz2(h,.,dx) freqz2(.) fsamp2 用频率采样法设计二维FIR 滤波器 h = fsamp2(Hd) h = fsamp2(fl,f2,Hd,m nJ) ftrans2 通过频率转换法设计二维

23、 FIR滤波器 h = ftrans2(b,t) h = ftrans2(b) fwind 1 用一维窗口方法设计二维 FIR滤波器 h = fwind l(Hd,win) h = fwind 1 (Hd,win 1 ,win2) h = fwind l(fl,f2,Hd,.) fwind2 用二维窗口方法设计二维 FIR滤波器 h = fwind2(Hd,win) h = fwind2(f 1 ,f2,Hd, win) 表9图像变换函数 函数功能语法 dct2 进行二维离散余弦变换 B = dct2(A) B = dct2(A,m,n) B = dct2(A,m n) dctmtx 计算离散

24、余弦变换矩阵 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 = ff(shift(X,dim) idct2 计算二维逆离散余弦变换 B = idct2(A) B = idct2(A,m,n) B = idct2(A,m nJ) ifft2 计算二维逆快速傅立叶变换 Y = ifft2(X) Y = ifft2(X,m,n) y = ifft2(.,

25、 nonsymmetric 1) y = ifft2(., nonsymmetric 1) ifftn 计算n维逆快速傅立叶变换 Y = ifftn(X) Y = ifftn(X,siz) y = onsymmetric 1) y = onsymmetric1) 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 = phant

26、om(E,n) P,E = phantom( ) radon 计算Radon变换 R=radon(I,theta) R,xp=radon(.) F = fanbeam(I,D) F = fanbeam(.,param 1 ,val 1,param 1 ,val2,.) Esensor_positions,fan_rotation_angles fanbeam ( ) fanbeam 计算扇形投影变换 表10边沿和块处理函数 函数功能语法 bestblk 确定进行块操作的块人小 siz = bestblk(m n,k) mb,nbj = bestblk(m n,k) blkproc 实现图像的非

27、重叠(distinct) 块操作 B = blkproc(A,m n,fun) B = blkproc(A,m n,fun,Pl,P2,.) B=blkproc(A,m n,mborder nborder, fun, ) B = blkproc(A/indexed.) col2im 将矩阵的列重新组织到块中 A = col2im(B,m n,mm nnj, block_type) A = col2im(B,m nn) colfilt 利用列相关两数进行边沿操 作 B = colfilt(A,m n,block_type,fun) B = colfilt(A,m n,block_type,fun

28、,P 1 ,P2,.) B = colfilt(A, m n, mblock nblock, block_type, fun,) B = colfill(A,indexed,.) im2col 重调图像块为列 B = im2col(A,m nj,block_type) B = im2col(A,m nJ) B = im2col(A,indexed;) nlfilter 通用滑动邻域操作 B = nlfilter(A,m n,fun) B = nlfilter(A,m n,fun,Pl,P2,.) B = nlfilter( A,indexed,.) 表11图像形态学操作函数 函数功能语法 ap

29、plylut 在二值图像屮利用查找表进 行邻域操作 A = applylut(BW,LUT) bwarea 计算二值图像的对象面积total = bwarea(BW) bweuler 计算二值图像的欧拉数 eul = bweuler(BW.n) bwhitmiss 执行二值图像的击中和击不 中操作 BW2 = bwhitmiss(BWl,SEl,SE2) BW2 = bwhitmiss(B W1JNTERVAL) bwlabel 标注二值图像中己连接的部 分 L = bwlabel(BW,n) L,num = bwlabel(BW,n) bwmorph 二值图像的通用形态学操作 BW2 = b

30、wmorph(BW,operation) BW2 = bwmorph(BW,operation) bwperim 计算二值图像中对象的周长 BW2 = bwperim(BWl) BW2 = bwperim(BWl,CONN) bwselect 在二值图像中选择对象 BW2 = bwselect(BW,c,r,n) BW2 = bwselect(BW,n) BW2,idx = bwselect(.) BW2 = bwselect(x,y,BW,xi,yi,n) x,y,BW2,idx,xi,yi = bwselect(.) makelut 创建用于applylut函数的查 找表 lut = ma

31、kelut(fun.n) lut = makelut(fun,n,P 1 ,P2,.) bwdist 距离变换 D = bwdist(BW) D,L = bwdist(BW) D,L = bwdist(BW,METHOD) imbothat 执行形态学的闭包运算 IM2 = imbothat(IM,SE) IM2 = imbothat(IM,NHOOD) imclose 图像的闭运算 IM2 = imclose(IM,SE) IM2 = imclose(IM,NHOOD) imopen 图像的开运算 IM2 = imopen(IM,SE) IM2 = imopen(IM,NHOOD) imdi

32、late 图像的膨胀 IM2 = imdilate(IM,SE) IM2 = imdilate(IM,NHOOD) IM2 = imdilate(IM,SE,PACKOPT) IM2 = imdilate(.,PADOPT) imerode 图像的腐蚀 IM2 = imerode(IM,SE) IM2 = imerode(IM,NHOOD) IM2 = imerode(IM,SE,PACKOPT,M) IM2 = imerode(.,PADOPT) imfill 填充图像区域 BW2 = imfill(BW,locations) BW2 = imfill(BW,holes 1) 12 = im

33、fill(I) BW2 = imfill(BW) BW2 locations = imfill(BW) BW2 = imfill(BW,locations,CONN) BW2 = imfill(BW,CONN,holes 1) 12 = imfill(I,CONN) imtophat 用开运算后的图像减去原图 像 IM2 = imtophat(IM,SE) IM2 = imtophat(IM,NHOOD) strel 创建形态学结构元素 SE = strel(shape,parameters) 表12区域处理函数 函数功能语法 roicolor 选择感兴趣的颜色区 BW = roicolor(

34、AJow,high) BW = roicolor(A,v) roifill 在图像的任意区域中进行平 滑插补 J = roifill(I,c,r) J = roifill(I) J = roifill(I,BW) J,BW = roifill ( ) J = roifill(x,yj,xi,yi) x,y,J,BW,xi,yi = roifill(.) roifilt2 滤波特定区域 J = roifilt2(h,I,BW) J = roifilt2(I,BW?fun) J = roifilt2(I,BW,fun,Pl,P2,.) roipoly 选择一个感兴趣的多边形区 域 BW = roi

35、poly(I,c,r) BW = roipoly(I) BW = roipoly(x,y,I,xi,yi) BW,xi,yi = roipoly(.) x,y,BW,xi,yi = roipoly(.) 表13图像代数操作 函数功能语法 imadd 加运算Z = imadd(X,Y) imsubtract 减运算Z = imsubtract(X,Y) immultiply 乘运算 Z = immultiply(X,Y) imdivide 除运算Z = imdivide(X,Y) 表14颜色空间转换函数 函数功能语法 hsv2rgb 转换HSV的值为RGB颜色 空间 M = hsv2rgb(H)

36、 ntsc2rgb 转换NTSC的值为RGB颜色 空间 rgbmap = ntsc2rgb(yiqmap) RGB = ntsc2rgb(YIQ) rgb2hsv 转换RGB的值为HSV颜色 空间 cmap = rgb2hsv(M) rgb2ntsc 转换RGB的值为NTSC颜色 空间 yiqmap = rgb2ntsc(rgbmap) YIQ = rgb2ntsc(RGB) rgb2ycbcr 转换RGB的值为YCbCr颜 色空间 ycbcrmap = rgb2ycbcr(rgbmap) YCBCR = rgb2ycbcr(RGB) ycbcr2rgb 转换YCbCr的值为RGB颜 色空间

37、rgbmap = ycbcr2rgb(ycbcrmap) RGB = ycbcr2rgb(YCBCR) 表15图像类型和类型转换函数 函数功能语法 dither 通过抖动增加外观颜色分辨 率,转换图像 X = dither(RGB,map) BW = dither(I) gray2ind 转换灰度图像为索引色图像 X,map = gray2ind(I,n) X,map = gray2ind(BW,n) grayslice 从灰度图像为索引色图像 X = grayslice(I,n) X = grayslice(Lv) im2bw 转换图像为二值图像 BW = im2bw(I,level) BW

38、 = im2bw(X,map,level) BW = im2bw(RGB,level) im2double 转换图像矩阵为双精度类型 12 = im2double(I) RGB2 = im2double(RGB) I = im2double(BW) X2 = im2double(X,indexed) double 转换数据为双粘度类熨double(X) uint8 转换数据为8位无符号整熨 I = uint8(X) im2uint8 转换图像阵列为8位为无符 号整型 12 = im2uint8(I) RGB2 = im2uint8(RGB) I = im2uint8(BW) X2 = im2u

39、int8(X ;indexed*) im2uintl6 转换图像阵列为16位为无 符号整型 12 = im2uintl6 (I) RGB2 = im2uintl6(RGB) I = im2uintl6(BW) X2 = im2uint 16(X,indexed) uintl6 转换数据为16位无符号整 型 I = uintl6(X) ind2gray 转换索引色图像为灰度图像 I = ind2gray(Xjnap) ind2rgb 转换索引色图像为RGB图 像 RGB = ind2rgb(X,map) isbw 判断是否为二值图像flag = isbw(A) isgray 判断是否为灰度图像

40、flag = isgray(A) isind 判断是否为索引色图像 flag = isind(A) isrgb 判断是否为RGB图像flag = isrgb(A) mat2gray 转换矩阵为灰度图像 I = mat2gray(A,amin amax) I = mat2gray(A) rgb2gray 转换RGB图像或颜色映射 表为灰度图像 I = rgb2gray(RGB) newmap = rgb2gray(map) rgb2ind 转换RGB图像为索引色图 像 X,map = rgb2ind(RGB ,tol) X,map = rgb2ind(RGB,n) X = rgb2ind(RGB

41、,map) .=rgb2ind(.,dither_option) 表A.16图像复原函数 函数功能语法 deconvwnr 用维纳滤波复原图像 J = deconvwnr(I,PSF) J = deconvwnr(I,PSF,NSR) J = deconvwnr(I,PSF,NCORRJCORR) deconvreg 用最小约束二乘滤波复原图 像 J = deconvreg(I,PSF) J = deconvreg(I,PSF,NOISEPOWER) J = deconvreg(I, PSF, NOISEPOWER, LRANGE) J = deconvreg(I, PSF, NOISEPOW

42、ER, LRANGE, REGOP) J, LAGRA = deconvreg(I,PSF,.) deconvlucy 用Richardson-Lucy滤波复原 图像 J = deconvlucy(I,PSF) J = deconvlucy(I,PSF,NUMIT) J = deconvlucy(I,PSF,NUMIT,DAMPAR) J = deconvlucy(I, PSF, NUMIT, DAMPAR, WEIGHT) J = deconvlucy(I, PSF, NUMIT, DAMPAR, WEIGHT READOUT) J = deconvlucy(I, PSF, NUMIT, D

43、AMPAR, WEIGHT, READOUT, SUBSMPL) deconvblind 用盲卷积滤波复原图像 J,PSF = deconvblind(IJNITPSF) 卩,PSF = deconvblind(I,INITPSF,NUMIT) 卩,PSF = deconvblind(I, INITPSF, NUMIT, DAMPAR) J,PSF = deconvblind(I, INITPSF, NUMIT, DAMPAR, WEIGHT) J,PSF = deconvblind(I, INITPSF, NUMIT, DAMPAR, WEIGHT, READOUT) J,PSF = deconvblind(., FUN, Pl, P2, PN)

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1