zoukankan      html  css  js  c++  java
  • 学习笔记(2)---Matlab 图像处理相关函数命令大全

    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,[low high]) imshow(BW) imshow(X,map) imshow(RGB) imshow(...,display_option) imshow(x,y,A,...) imshow filename 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,[mrows mcols]) truesize(fig)

    warp 将图像显示到纹理映射表面

    语法:warp(X,map) warp(I ,n) warp(z,...) warp(x,y,z,...)   h=warp(...)

    zoom 缩放图像

    语法:zoom on zoom off zoom out zoom reset zoom zoom xon zoom yon 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,and TIFF only) [...]=imread(...,'frames',idx) (GIF only) [...]=imread(...,ref) (HDF only) [...]=imread(...,'BackgroundColor',BG) (PNG only) [A,map,alpha] =imread(...) (ICO,CUR,PNG only)

    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  显示图像像素信息

    语法:pixval on

    std2 计算矩阵元素的标准偏移

    语法:b=std2(A)

    四、图像分析函数:

    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) [BW,threshold]=edge(I,'canny',...)

    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,[m n]) 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,[m n])

    六、线性滤波函数

    conv2 进行二维卷积操作

    语法:C=conv2(A,B) C=conv2(hcol,hrow,A) C=conv2(...,'shape')

    convmtx2 计算二维卷积矩阵

    语法:T=convmtx2(H,m,n) T=convmtx2(H,[m n])

    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)

    七、线性二维滤波设计函数

    freqspace 确定二维频率响应的频率空间

    语法:[f1,f2]=freqspace(n) [f1,f2]=freqspace([m n]) [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,...,[dx dy]) [...]=freqz2(h,...,dx) freqz2(...)

    fsamp2 用频率采样法设计二维FIR过滤器

    语法:h=fsamp2(Hd) h=fsamp2(f1,f2,Hd,[m n])

    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,[m n])

    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([m n],k) [mb,nb]=bestblk([m n],k)

    blkproc 实现图像的显示块操作

    语法:B=blkproc(A,[m n]),fun) B=blkproc(A,[m n],fun,P1,P2,...) B=blkproc(A,[m n],[mborder nborder],fun,...)

    col2im 将矩阵的列重新组织到块中

    语法:A=col2im(B,[m n],[mm nn],block_type) A=col2im(B,[m n],[mm nn])

    colfilt 利用列相关函数进行边沿操作

    语法:B=colfilt(A,[m n],block_type,fun) B=colfilt(A,[m n],block_type,fun,P1,P2,...) B=colfilt(A,[m n],[mblock nblock],...) B=colfilt(A,'indexed',...)

    im2col 重调图像块为列

    语法:B=im2col(A,[m n],block_type) B=im2col(A,[m n]) B=im2col(A,'indexed',...)

    nlfilter 进行边沿操作

    语法:B=nlfilter(A,[m n],fun) B=nlfilter(A,[m n],fun,P1,P2,...) B=nlfilter(A,'indexed',...)

    十、二进制图像操作函数

    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=roifill(I,BW) [J,BW]=roifill(...) J=roifill(x,y,I,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,P1,P2,...)

    roipoly 选择一个敏感的多边形区域

    语法:BW=roipoly(I,c,r) BW=roipoly(I) BW=roipoly(x,y,I,xi,yi) [BW,xi,yi]=roipoly(...) [x,y,BW,xi,yi]=roipoly(...)

    十二、颜色映像处理函数

    brighten 增加或降低颜色映像表的亮度

    语法:brighten(beta) brighten(h,beta) newmap=brighten(beta) newmap=brighten(cmap,beta)

    cmpermute 调整颜色映像表中的颜色

    语法:[Y,newmap]=cmpermute(X,map) [Y,newmap]=cmpermute(X,map,index)

    cmunigue 查找颜色映像表中特定的颜色及相应的图像

    语法:[Y,newmap]=cmunigue(X,map) [Y,newmap]=cmunigue(RGB) [Y,newmap]=cmunique(I)

    imapprox 对索引图像进行近似处理

    语法:[Y,newmap]=imapprox(X,map,n)   [Y,newmap]=imapprox(X,map,tol) Y=imapprox(X,map,newmap) [...]=imapprox(...,dither_option)

    rgbplot 划分颜色映像表

    语法:rgbplot(cmap)

    十三、颜色空间转换函数

    hsv2rgb 转换HSV值为RGB颜色空间:M=hsv2rgb(H)

    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颜色空间:rgbmap=ycbcr2rgb(ycbcrmap) RGB=ycbcr2rgb(YCBCR)

    十四、图像类型和类型转换函数

    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(I,v)

    im2bw 转换图像为二进制图像

    语法:BW=im2bw(I,level) BW=im2bw(X,map,level) BW=im2bw(RGB,level)

    im2double 转换图像矩阵为双精度型

    语法:I2=im2double(I1) RGB2=im2double(RGB1) I=im2double(BW) X2=im2double(X1,'indexed')

    double 转换数据为双精度型

    语法:double(X)

    unit8 、unit16转换数据为8位、16位无符号整型: i=unit8(x) i=unit16(x)

    im2unit8 转换图像阵列为8位无符号整型

    语法:I2=im2unit8(I1) RGB2=im2unit8(RGB1) I=im2unit8(BW) X2=im2unit8(X1,'indexed')

    im2unit16 转换图像阵列为16位无符号整型

    语法:I2=im2unit16(I1) RGB2=im2unit16(RGB1) I=im2unit16(BW) X2=im2unit16(X1,'indexed')

    ind2gray 把检索图像转化为灰度图像

    语法:I=ind2gray(X,map)

    ind2rgb  转化索引图像为RGB真彩图像

    语法:RGB=ind2rgb(X,map)

    isbw 判断是否为二进制图像

    语法:flag=isbw(A)

    isgray 判断是否为灰度图像

    语法: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,map) [...]=rgb2ind(...,dither_option)

    十五、新增图像处理工具箱函数

    adapthisteq 限制对比度直方图均衡化: J=adapthisteq(I) J=adapthisteq(I,param1,val1,param2,val2...)

    applycform 用于颜色空间变换 out=applyform(I,C)

    bwboundaries 描绘二进制图像边界

    语法: B=bwboundaries(BW) B=bwboundaries(BW,CONN) B=bwboundaries(BW,CONN,options) [BW,CONN,options] [BL]=bwboundaries(...) [BLNA]=bwboundaries()

    bwtraceboundary 描述二进制图像中的物体

    B=bwtraceboundary(BW,P,fstep) B=bwtraceboundary(BW,P,fstep,CONN) B=bwtraceboundary(...N,dir)

    decorrstrech 对多通道图像进行去相关处理

    语法:S=decorrstretch(I) S=decorrstretch(I,TOL)

    dicomdict 获取或读取DICOM文件

    语法:dicomdict('set',dictionary) dictionary=dicomdict('get')

    getline 用鼠标选择ployline

    语法:[x,y]=getline(fig) [x,y]=getline(ax) [x,y]=getline [x,y]=getline(...,'closed')

    getpts 用鼠标选择像素点

    语法:[x,y]=getpts(fig) [x,y]=getpts(ax) [x,y]=getpts

    getrect 用鼠标选择矩阵

    语法:rect=getrect(fig) rect=getrect(ax) rect=getrect(fig)

    iccread 读取ICC剖面

    语法:P=iccread(filename)

    im2java2d 将图像转换为Java缓冲图像

    语法:jimage=im2java2d(I) jimage=im2java2d(X,MAP)

    imview 在图像与蓝旗中显示图像

    语法:imview(I)   imview(RGB) imview(X,map) imview(I,range) imview(filename) imview(....'InitialMagnification',initial_mag) h=imview(...)    imview close all

    ippl 检查IPPL的存在

    语法:TF=ippl [TF B]=ippl

    iptdemos 显示图像处理工具箱中的索引图像

    lab2double、lab2unit16、lab2unit8 将L*a*b数据分别转换为双精度、16位数据、8位数据

    makecform 创造一个色彩转换结构

    poly2mask 把多边形区域转换成mask区域

    语法:BW=poly2mask(x,y,m,n)

    unitlut 查找表中A像素值

    语法:B=unitlut(A,LUT)

    xyz2double、xyz2unit16 将颜色数据从XYZ转换到双精度、16进制。

    语法:xyzd=xyz2double(XYZ) xyz16=xyz2unit16(xyz)

  • 相关阅读:
    正则表达式的单行模式和多行模式
    js 正则匹配(去掉html标签)
    ES6中set和map的区别
    回调函数的使用场合
    javascript逻辑运算符“||”和“&&”
    [bzoj3210]花神的浇花集会
    [bzoj2438][中山市选2011]杀人游戏
    [bzoj2743][HEOI2012]采花
    [luoguP3729]曼哈顿计划EX
    [bzoj4850][Jsoi2016]灯塔
  • 原文地址:https://www.cnblogs.com/haoyul/p/6921529.html
Copyright © 2011-2022 走看看