MATLAB图像处理函数大全
MATLAB图像处理函数大全
![MATLAB图像处理函数大全](https://img.taocdn.com/s3/m/0c1a9143336c1eb91a375d6f.png)
Matlab图像处理函数大全目录图像增强 (3)1. 直方图均衡化的Matlab 实现 (3)1.1 imhist 函数 (3)1.2 imcontour 函数 (3)1.3 imadjust 函数 (3)1.4 histeq 函数 (4)2. 噪声及其噪声的Matlab 实现 (4)3. 图像滤波的Matlab 实现 (4)3.1 conv2 函数 (4)3.2 conv 函数 (5)3.3 filter2函数 (5)3.4 fspecial 函数 (6)4. 彩色增强的Matlab 实现 (6)4.1 imfilter函数 (6)图像的变换 (6)1. 离散傅立叶变换的Matlab 实现 (6)2. 离散余弦变换的Matlab 实现 (7)2.1. dct2 函数 (7)2.2. dict2 函数 (8)2.3. dctmtx函数 (8)3. 图像小波变换的Matlab 实现 (8)3.1 一维小波变换的Matlab 实现 (8)3.2 二维小波变换的Matlab 实现 (9)图像处理工具箱 (11)1. 图像和图像数据 (11)2. 图像处理工具箱所支持的图像类型 (12)2.1 真彩色图像 (12)2.2 索引色图像 (13)2.3 灰度图像 (14)2.4 二值图像 (14)2.5 图像序列 (14)3. MATLAB图像类型转换 (14)4. 图像文件的读写和查询 (15)4.1 图形图像文件的读取 (15)4.2 图形图像文件的写入 (16)4.3 图形图像文件信息的查询imfinfo()函数 (16)5. 图像文件的显示 (16)5.1 索引图像及其显示 (16)5.2 灰度图像及其显示 (16)5.3 RGB 图像及其显示 (17)5.4 二进制图像及其显示 (17)5.5 直接从磁盘显示图像 (18)图像处理函数 (18)图像处理函数详解——strel (18)图像处理函数详解——roipoly (19)图像处理函数详解——roifilt2 (20)图像处理函数详解——roifill (20)图像处理函数详解——roicolor (21)matlab图像处理函数详解——rgb2gray (22)Matlab图像处理函数:regionprops (22)图像处理函数详解——padarray (26)图像处理函数详解——nlfilter (27)图像处理函数详解——montage (27)函数详解——mat2gray (28)图像处理函数详解——imclose (29)图像处理函数详解——imopen (29)图像处理函数详解——imerode (30)图像处理函数详解——imdilate (30)图像处理函数详解——imresize (31)图像处理函数详解——imnoise (32)图像处理函数详解——imhist (32)图像处理函数详解——imfinfo (33)图像处理函数详解——imcomplement (34)图像处理函数详解——imapprox (35)图像处理函数详解——imadjust (35)图像处理函数详解——imadd (36)图像处理函数详解——im2uint8 (36)图像处理函数详解——im2bw (37)图像处理函数详解——histeq (37)图像处理函数详解——dither (38)图像处理函数详解——conv2 (38)图像处理函数详解——colfilt (39)图像处理函数详解——bwperim (39)图像处理函数详解——bwlabel (40)图像处理函数详解——bwareaopen (41)图像增强1. 直方图均衡化的Matlab 实现1.1 imhist 函数功能:计算和显示图像的色彩直方图格式:imhist(I,n)imhist(X,map)说明:imhist(I,n) 其中,n 为指定的灰度级数目,缺省值为256;imhist(X,map) 就算和显示索引色图像 X 的直方图,map 为调色板。
MATLAB的常用函数和工具介绍
![MATLAB的常用函数和工具介绍](https://img.taocdn.com/s3/m/ea6ab9bdf605cc1755270722192e453610665bac.png)
MATLAB的常用函数和工具介绍MATLAB是一款被广泛应用于科学计算和工程设计的软件,它提供了丰富的函数库和工具箱,能够帮助用户进行数据分析、模拟仿真、图像处理、信号处理等多种任务。
本文将介绍一些MATLAB常用的函数和工具,帮助读者更好地利用MATLAB进行编程和数据处理。
一、MATLAB函数介绍1. plot函数:该函数用于绘制二维图形,如折线图、曲线图等。
通过输入数据点的坐标,plot函数可以帮助用户快速可视化数据分布,同时支持自定义线型、颜色和标注等功能。
2. imread函数:该函数用于读取图像文件,支持常见的图像格式,如JPEG、PNG等。
通过imread函数,用户可以方便地加载图像数据进行后续的处理和分析。
3. fft函数:该函数用于进行快速傅里叶变换,可以将时域信号转换为频域信号。
傅里叶变换在信号处理中广泛应用,通过fft函数,用户可以快速计算信号的频谱信息。
4. solve函数:该函数用于求解方程组,支持线性方程和非线性方程的求解。
用户只需输入方程组的表达式,solve函数会自动求解变量的值,帮助用户解决复杂的数学问题。
5. mean函数:该函数用于计算数据的平均值。
mean函数支持数组、矩阵和向量等多种数据类型,可以方便地对数据进行统计分析。
6. importdata函数:该函数用于导入外部数据文件,如文本文件、CSV文件等。
通过importdata函数,用户可以将外部数据加载到MATLAB中,进行后续的数据处理和分析。
二、MATLAB工具介绍1. MATLAB Editor:这是MATLAB自带的编辑器,可以用于编写和调试MATLAB代码。
它提供了代码高亮、自动缩进和代码片段等功能,能够提高编程效率和代码可读性。
2. Simulink:这是MATLAB的一个强大的仿真工具,用于建立动态系统的模型并进行仿真。
Simulink支持直观的图形化建模界面,用户可以通过拖拽元件和线条来搭建系统模型,进而进行仿真和系统分析。
matlab函数大全
![matlab函数大全](https://img.taocdn.com/s3/m/fb6ffd1fcd7931b765ce0508763231126edb7774.png)
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) \ [...]=getimageimshow 显⽰图像语法: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 onstd2 计算矩阵元素的标准偏移语法: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]=getptsgetrect ⽤⿏标选择矩阵语法: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 allippl 检查IPPL的存在语法:TF=ippl \ [TF B]=ippliptdemos 显⽰图像处理⼯具箱中的索引图像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进制。
matlab数字图像处理函数大全
![matlab数字图像处理函数大全](https://img.taocdn.com/s3/m/cb82c4d02cc58bd63086bd04.png)
Import, Export, and ConversionDisplay and ExplorationGeometric Transformation, Spatial ReferencingImage EnhancementImage AnalysisRead image from graphics fileWrite image to graphics fileInformation about graphics fileRead metadata from National Imagery Transmission Format (NITF) file Read image from NITF fileRead metadata from DPX fileRead DPX imageRead metadata from header file of Analyze 7.5 data setRead image data from image file of Analyze 7.5 data setRead metadata from Interfile fileRead images in Interfile formatAnonymize DICOM fileGet or set active DICOM data dictionaryDisplay DICOM file structureRead metadata from DICOM messageFind attribute in DICOM data dictionaryRead DICOM imageGenerate DICOM unique identifierWrite images as DICOM filesRead high dynamic range (HDR) imageWrite Radiance high dynamic range (HDR) image fileCreate high dynamic range imageRender high dynamic range image for viewingInterface for image I/OCheck if file is R-SetOpen R-Set fileCreate reduced resolution data set from image fileConvert grayscale or binary image to indexed imageConvert indexed image to grayscale imageConvert matrix to grayscale imageConvert RGB image or colormap to grayscaleConvert indexed image to RGB imageConvert label matrix into RGB imageConvert Bayer pattern encoded image to truecolor imageBinarize image by thresholdingQuantize image using specified quantization levels and output values Multilevel image thresholds using Otsu's methodAdaptive image threshold using local first-order statisticsGlobal histogram threshold using Otsu's methodConvert image to binary image, based on thresholdGlobal image threshold using Otsu's methodConvert grayscale image to indexed image using multilevel thresholdingConvert image to double precisionConvert image to 16-bit signed integersConvert image to Java buffered imageConvert image to single precisionConvert image to 16-bit unsigned integersConvert image to 8-bit unsigned integersCreate checkerboard imageCreate head phantom imageAdd noise to imageDisplay imageDisplay multiple image frames as rectangular montage Display multiple images in single figureMake movie from multiframe imagePlay movies, videos, or image sequencesDisplay image as texture-mapped surfaceGet values of Image Processing Toolbox preferencesDisplay Image Processing Toolbox Preferences dialog boxSet Image Processing Toolbox preferences or display valid values Image Viewer appImage Information toolAdjust Contrast toolDisplay Range toolDistance toolPixel Information toolPixel Information tool without text labelPixel Region toolMagnification box for scroll panelOverview tool for image displayed in scroll panelGet values of Image Processing Toolbox preferencesDisplay Image Processing Toolbox Preferences dialog boxSet Image Processing Toolbox preferences or display valid values Image Information toolChoose Colormap toolAdjust Contrast toolCrop imageDisplay Range toolDistance toolPixel Information toolPixel Information tool without text labelPixel Region toolPixel Region tool panelMagnification box for scroll panelOverview tool for image displayed in scroll panelOverview tool panel for image displayed in scroll panelSave Image ToolScroll panel for interactive image navigationCreate draggable ellipseCreate draggable freehand regionCreate draggable, resizable lineCreate draggable pointCreate draggable, resizable polygonCreate draggable rectangleRegion-of-interest (ROI) base classSelect polyline with mouseSpecify points with mouseSpecify rectangle with mouseImage data from axesImage model object from image objectImage Model objectConvert axes coordinates to pixel coordinatesInformation about image attributesGet handle to current axes containing imageGet handle to current figure containing imageOpen Image dialog boxGet all image handlesAdd function handle to callback listCheck validity of handleGet Application Programmer Interface (API) for handleRetrieve pointer behavior from HG objectDirectories containing IPT and MATLAB iconsCreate pointer manager in figureDelete function handle from callback listStore pointer behavior structure in Handle Graphics object Align figure windowsCreate rectangularly bounded drag constraint functionAdjust display size of imagencing, and Image RegistrationCrop imageResize imageRotate imageTranslate imageImage pyramid reduction and expansionApply geometric transformation to imageFit geometric transformation to control point pairsApply 2-D spatial transformation to imageFind output bounds for spatial transformationFlip input and output roles of TFORM structureCreate resampling structureCreate spatial transformation structure (TFORM)Apply spatial transformation to N-D arrayApply forward spatial transformationApply inverse spatial transformationCreate checkerboard image2-D Affine Geometric Transformation3-D Affine Geometric Transformation2-D Projective Geometric Transformation2-D piecewise linear geometric transformation2-D Polynomial Geometric Transformation2-D Local Weighted Mean Geometric TransformationApply geometric transformation to imageIntensity-based image registrationEstimate geometric transformation that aligns two 2-D or 3-D images Display imageCompare differences between imagesComposite of two imagesReference 2-D image to world coordinatesReference 3-D image to world coordinatesIntensity-based image registrationConfigurations for intensity-based registrationEstimate geometric transformation that aligns two 2-D or 3-D images Estimates geometric transformation that aligns two 2-D images using phase Estimate displacement field that aligns two 2-D or 3-D images Composite of two imagesCompare differences between imagesMattes mutual information metric configuration objectMean square error metric configuration objectRegular step gradient descent optimizer configuration objectOne-plus-one evolutionary optimizer configuration objectControl Point Selection ToolFit geometric transformation to control point pairsTune control-point locations using cross correlationConvert CPSTRUCT to valid pairs of control pointsNormalized 2-D cross-correlationInfer spatial transformation from control point pairsAdjust image intensity values or colormapAdjust Contrast toolSharpen image using unsharp maskingEnhance contrast using histogram equalizationContrast-limited adaptive histogram equalization (CLAHE)Adjust histogram of image to match N-bin histogram of reference image Apply decorrelation stretch to multichannel imageFind limits to contrast stretch imageConvert integer values using lookup tableAdd noise to imageN-D filtering of multidimensional images2-D Gaussian filtering of images3-D Gaussian filtering of 3-D imagesCreate predefined 2-D filterGuided filtering of imagesNormalized 2-D cross-correlation2-D adaptive noise-removal filtering2-D median filtering2-D order-statistic filteringLocal standard deviation of imageLocal range of imageLocal entropy of grayscale imageGeneral sliding-neighborhood operationsCreate Gabor filter or Gabor filter bankApply Gabor filter or set of filters to 2-D image2-D box filtering of images3-D box filtering of 3-D imagesCalculate integral imageCalculate 3-D integral image2-D box filtering of integral images3-D box filtering of 3-D integral imagesExtract objects from binary image by sizeExtract objects from binary image using properties Pad array2-D frequency response2-D FIR filter using frequency sampling2-D FIR filter using frequency transformation2-D FIR filter using 1-D window method2-D FIR filter using 2-D window method2-D convolution matrixBinary hit-miss operationMorphological operations on binary images Ultimate erosionRemove small objects from binary imageBottom-hat filteringSuppress light structures connected to image border Morphologically close imageDilate imageErode imageExtended-maxima transformExtended-minima transformFill image regions and holesH-maxima transformH-minima transformImpose minimaMorphologically open imageMorphological reconstructionRegional maximaRegional minimaTop-hat filteringWatershed transformCreate connectivity arrayCheck validity of connectivity argumentNeighborhood operations on binary images using lookup tables Nonlinear filtering using lookup tablesCreate lookup table for use with bwlookupMorphological structuring elementMorphological offset structuring elementDeblur image using blind deconvolutionDeblur image using Lucy-Richardson methodDeblur image using regularized filterDeblur image using Wiener filterTaper discontinuities along image edgesConvert optical transfer function to point-spread function Convert point-spread function to optical transfer functionPad arraySpecify polygonal region of interest (ROI)Convert region of interest (ROI) polygon to region maskFill in specified regions in image using inward interpolation Select region of interest (ROI) based on colorFilter region of interest (ROI) in imageCreate draggable ellipseCreate draggable freehand regionCreate draggable, resizable polygonCreate draggable rectangleRegion-of-interest (ROI) base classInterface for image I/ODistinct block processing for imageDetermine optimal block size for block processingGeneral sliding-neighborhood operationsRearrange matrix columns into blocksColumnwise neighborhood operationsRearrange image blocks into columnsAbsolute difference of two imagesAdd two images or add constant to imageLinear combination of color channelsComplement imageDivide one image into another or divide image by constant Linear combination of imagesMultiply two images or multiply image by constantSubtract one image from another or subtract constant from image Trace region boundaries in binary imageTrace object in binary imagePlot region boundariesFind edges in intensity imageFind circles using circular Hough transformCreate circleGradient magnitude and direction of an imageDirectional gradients of an imageFind 3-D gradient magnitude and direction of imagesFind the directional gradients of a 3-D imageHough transformExtract line segments based on Hough transformIdentify peaks in Hough transformQuadtree decompositionBlock values in quadtree decompositionSet block values in quadtree decompositionMeasure properties of image regionsArea of objects in binary imageExtract objects from binary image by sizeFind connected components in binary imageGenerate convex hull image from binary imageDistance transform of binary imageGeodesic distance transform of binary imageEuler number of binary imageFind perimeter of objects in binary imageExtract objects from binary image using propertiesSelect objects in binary imageGray-weighted distance transform of grayscale imageCreate contour plot of image dataHistogram of image dataPixel color valuesPixel-value cross-sections along line segments2-D correlation coefficientAverage or mean of matrix elementsStandard deviation of matrix elementsLabel connected components in 2-D binary imageLabel connected components in binary imageCreate label matrix from bwconncomp structurePack binary imageUnpack binary imageEntropy of grayscale imageLocal entropy of grayscale imageLocal range of imageLocal standard deviation of imageCreate gray-level co-occurrence matrix from imageProperties of gray-level co-occurrence matrixMean-squared errorPeak Signal-to-Noise Ratio (PSNR)Structural Similarity Index (SSIM) for measuring image qualitySegment image into foreground and background using active contour Binary image segmentation using Fast Marching MethodSegment image into two or three regions using geodesic distance-based colorCalculate weights for image pixels based on image gradient Calculate weights for image pixels based on grayscale intensity difference Select contiguous image region with similar gray valuesGlobal image threshold using Otsu's methodMultilevel image thresholds using Otsu's methodGlobal histogram threshold using Otsu's methodAdaptive image threshold using local first-order statisticsFind region boundaries of segmentation2-D superpixel oversegmentation of imagesBurn binary mask into 2-D imageConvert label matrix to cell array of linear indicesDistance transform of binary imageGeodesic distance transform of binary imageGray-weighted distance transform of grayscale imageHough transform2-D discrete cosine transformDiscrete cosine transform matrixConvert fan-beam projections to parallel-beamFan-beam transform2-D inverse discrete cosine transformInverse fan-beam transformInverse Radon transformConvert parallel-beam projections to fan-beamRadon transform2-D fast Fourier transformShift zero-frequency component to center of spectrum2-D inverse fast Fourier transformInverse FFT shiftConvert RGB to CIE 1976 L*a*b*Convert RGB color values to NTSC color spaceConvert RGB to CIE 1931 XYZConvert RGB color values to YCbCr color spaceConvert CIE 1976 L*a*b* to RGBConvert CIE 1976 L*a*b* to CIE 1931 XYZConvert CIE 1931 XYZ to CIE 1976 L*a*b*Convert CIE 1931 XYZ to RGBConvert YCbCr color values to RGB color spaceConvert NTSC values to RGB color spaceConvert L*a*b* data to doubleConvert L*a*b* data to uint16Convert L*a*b* data to uint8Convert XYZ color values to doubleConvert XYZ color values to uint16Search for ICC profilesRead ICC profileFind system default ICC profile repositoryWrite ICC color profile to disk fileTrue for valid ICC color profileCreate color transformation structureApply device-independent color space transformation Approximate indexed image by reducing number of colors XYZ color values of standard illuminantsAdaptive image threshold using local first-order statistics Find region boundaries of segmentationRemove small objects from binary imageTrace region boundaries in binary imageFind connected components in binary imageDistance transform of binary imageEuler number of binary imageLabel connected components in 2-D binary image Nonlinear filtering using lookup tables Morphological operations on binary imagesPack binary imageFind perimeter of objects in binary imageSelect objects in binary imageTrace object in binary imageUnpack binary imageCreate connectivity arrayConvert Bayer pattern encoded image to truecolor image Find edges in intensity imageFit geometric transformation to control point pairs Create predefined 2-D filterDefault display range of image based on its classSelect contiguous image region with similar gray values Enhance contrast using histogram equalizationHough transformExtract line segments based on Hough transform Identify peaks in Hough transformConvert HSV colormap to RGB colormapConvert image to double precisionConvert image to 16-bit signed integersConvert image to single precisionConvert image to 16-bit unsigned integersConvert image to 8-bit unsigned integersAbsolute difference of two imagesAdjust image intensity values or colormapBinarize image by thresholdingBottom-hat filtering2-D box filtering of imagesSuppress light structures connected to image border Morphologically close imageComplement imageCrop imageDilate imageErode imageExtended-maxima transformExtended-minima transformFill image regions and holesN-D filtering of multidimensional imagesFind circles using circular Hough transformApply Gabor filter or set of filters to 2-D image2-D Gaussian filtering of imagesFind 3-D gradient magnitude and direction of imagesFind the directional gradients of a 3-D imageHistogram of image dataH-maxima transformH-minima transformLinear combination of imagesMean-squared errorMorphologically open imageBurn binary mask into 2-D imageImage pyramid reduction and expansionQuantize image using specified quantization levels and output values Read image from graphics fileMorphological reconstructionRegional maximaRegional minimaResize imageRotate imageTop-hat filteringTranslate imageApply geometric transformation to image2-D box filtering of integral imagesCalculate integral imageConvert integer values using lookup tableCheck validity of colormapCheck validity of connectivity argumentConvert CIE 1976 L*a*b* to RGBConvert label matrix into RGB imageConvert label matrix to cell array of linear indicesAverage or mean of matrix elements2-D median filteringMultilevel image thresholds using Otsu's method2-D order-statistic filteringGlobal histogram threshold using Otsu's methodPad arrayPeak Signal-to-Noise Ratio (PSNR)Measure properties of image regionsConvert RGB image or colormap to grayscaleConvert RGB colormap to HSV colormapConvert RGB to CIE 1976 L*a*b*Convert RGB color values to YCbCr color spaceFind limits to contrast stretch image2-D superpixel oversegmentation of imagesWatershed transformConvert YCbCr color values to RGB color spaceReference 2-D image to world coordinatesReference 3-D image to world coordinates2-D Affine Geometric Transformation2-D Projective Geometric TransformationMorphological structuring elementMorphological offset structuring elementDistance transform of binary imageLabel connected components in 2-D binary image Nonlinear filtering using lookup tablesMorphological operations on binary images2-D correlation coefficientFind edges in intensity imageEnhance contrast using histogram equalizationConvert image to double precisionConvert image to single precisionConvert image to 8-bit unsigned integersConvert image to 16-bit unsigned integersAbsolute difference of two imagesAdjust image intensity values or colormapBottom-hat filteringMorphologically close imageComplement imageDilate imageErode imageFill image regions and holesN-D filtering of multidimensional imagesGradient magnitude and direction of an image Directional gradients of an imageHistogram of image dataLinear combination of imagesAdd noise to imageConvert YCbCr color values to RGB color space Morphologically open imageMorphological reconstructionEstimate displacement field that aligns two 2-D or 3-D images Resize imageRotate imageDisplay imageTop-hat filteringInverse Radon transformConvert matrix to grayscale imageAverage or mean of matrix elements2-D median filteringNormalized 2-D cross-correlationPad arrayRadon transformMeasure properties of image regionsConvert RGB image or colormap to grayscaleConvert RGB color values to YCbCr color spaceStandard deviation of matrix elementsLocal standard deviation of imageFind limits to contrast stretch image从图形文件读取图像写入图像到图形文件关于图形文件的信息从国家图像传输格式的元数据(NITF)文件从NITF文件读取图像读取DPX文件元数据读取DPX图像从分析7.5数据集的头文件读取元数据从分析7.5数据集的图像文件中读取图像数据从归档文件元数据在内部文件格式读取图像匿名DICOM文件获取或设置活动DICOM数据字典显示DICOM文件结构读取DICOM消息元数据发现在DICOM数据字典属性读取DICOM图像生成DICOM的唯一标识符写图像的DICOM文件读高动态范围(HDR)图像写下光辉的高动态范围(HDR)图像文件创建高动态范围图像用于观看的高动态范围图像图像I / O接口检查文件是否存在与r-组开放与r-组文件从图像文件创建减少的分辨率数据集将灰度或二值图像转换为索引图像将索引图像转换为灰度图像转换矩阵到灰度图像将RGB图像的灰度或颜色表索引图像的RGB图像转换转换成RGB图像标签矩阵Bayer编码图像转换为彩色图像二值化图像的阈值分割量化图像使用指定的量化电平和输出值采用多级图像阈值Otsu方法采用局部一阶统计的自适应图像阈值使用全局直方图阈值Otsu方法基于阈值的图像转换成二值图像使用全局阈值Otsu方法采用多层阈值化方法将灰度图像转换为索引图像将图像转换为双精度将图像转换为16位有符号整数将图像转换成java缓冲图像将图像转换为单精度将图像转换为16位无符号整数将图像转换为8位无符号整数创建棋盘格图像创建头部影像添加噪声到图像显示图像显示多个图像帧矩形蒙太奇在单个图形中显示多个图像从多帧图像的电影播放电影、视频或图像序列显示图像作为纹理映射的表面获取图像处理工具箱的首选项显示图像处理工具箱首选项对话框设置图像处理工具箱的首选项或显示有效值图像查看器应用程序图像信息的工具对比度调整工具显示范围的工具距离工具像素信息的工具无文本标签的像素信息工具像素区域的工具用于滚动面板的放大盒在滚动面板中显示的图像的概述工具获取图像处理工具箱的首选项显示图像处理工具箱首选项对话框设置图像处理工具箱的首选项或显示有效值图像信息的工具选择映射工具对比度调整工具作物图像显示范围的工具距离工具像素信息的工具无文本标签的像素信息工具像素区域的工具像素区域工具面板用于滚动面板的放大盒在滚动面板中显示的图像的概述工具滚动面板中显示的图像的工具面板保存图像的工具用于交互式图像导航的滚动面板创建可拖动椭圆创建可拖动自由区域创建可拖动,可调整大小的线创建可拖动点创建可拖动,可调整大小的多边形创建可拖动矩形感兴趣区域(感兴趣区域)基类用鼠标选择多段线用鼠标指定点用鼠标指定矩形从轴的图像数据图像对象的图像模型对象图像模型对象将坐标轴转换为像素坐标关于图像属性的信息获取当前包含图像的轴的句柄获取当前图像包含图像的句柄打开图像对话框获取所有图像处理添加函数句柄到回调列表检查处理的有效性获取处理的应用程序程序员接口(接口)从汞对象检索指针行为目录包含了IPT和Matlab的图标创建图形中的指针管理器从回调列表中删除函数句柄句柄图形对象中的存储指针行为结构排列图的窗口创建矩形拖动约束函数有界调整图像的显示大小作物图像调整图像大小旋转图像转换图像图像金字塔的还原与扩展将几何变换应用于图像拟合控制点对的几何变换二维空间变换在图像中的应用查找空间变换的输出范围输入和输出翻转平台结构的作用创建重采样结构创造空间转换结构(平台)将空间变换N-D数组应用前向空间变换应用逆空间变换创建棋盘格图像二维仿射几何变换三维仿射几何变换二维射影几何变换二维分段线性几何变换二维多项式几何变换二维局部加权平均几何变换将几何变换应用于图像基于强度的图像配准估计对齐两个二维或三维图像的几何变换显示图像比较图像之间的差异两幅图像的复合参考二维图像到世界坐标参考三维图像到世界坐标基于强度的图像配准基于强度的注册的配置估计对齐两个二维或三维图像的几何变换使用相位相关的两个二维图像的几何变换估计估计对齐两个二维或三维图像的位移场两幅图像的复合比较图像之间的差异Mattes互信息度量的配置对象均方误差度量配置对象正规步长梯度下降优化配置对象一加一进化优化配置对象控制点选择工具拟合控制点对的几何变换使用交叉相关的调整控制点位置cpstruct转换控制点的有效对标准化二维互相关从控制点对的空间变换调整图像的灰度值或颜色表对比度调整工具利用反锐化掩模图像锐化采用直方图均衡化增强对比度对比度自适应直方图均衡化(CLAHE)调整直方图的图像与参考图像n-bin直方图申请去相关拉伸的多通道图像查找对比度拉伸图像的限制使用查找表转换整数值添加噪声到图像N维的多维图像滤波二维图像的二维高斯滤波三维图像的三维高斯滤波创建预定义的二维滤波器图像引导滤波标准化二维互相关二维自适应噪声滤除二维中值滤波二维阶统计滤波图像局部标准偏差局部图像范围灰度图像局部熵一般滑动邻域运算Gabor滤波器和Gabor滤波器组的创建应用Gabor滤波器或滤波器组二维图像二维图像的二维图像滤波三维图像的三维盒滤波计算积分图像计算三维积分图像积分图像的二维箱滤波三维整体图像的三维箱滤波通过大小从二值图像中提取对象使用属性从二值图像中提取对象焊盘阵列二维频率响应采用频率采样的二维滤波器采用频率变换的二维滤波器二维FIR滤波器采用一维窗口的方法采用二维窗法的二维二维滤波器二维卷积矩阵二进制命中错误操作二值图像的形态学运算终极侵蚀从二值图像中删除小对象帽子底部过滤抑制连接到图像边缘的光结构形态接近的图像放大图像腐蚀图像扩展极大值变换扩展最小变换填充图像区域和孔h-maxima变换利用H-minima变换强制最小形态上打开的图像形态重构区域极值局部极小顶帽滤波分水岭变换创建连接的阵列检查连通性参数的有效性使用查找表的二值图像的邻域运算使用查找表的非线性滤波创建bwlookup使用查找表形态学结构元素形态学偏移结构元素利用盲反卷积去模糊图像用露西理查德森的方法去模糊图像利用正则化滤波复原图像使用维纳滤波复原图像沿图像边缘的锥度不连续性将光学传递函数转换为点扩散函数转换点扩展函数到光传输函数焊盘阵列指定感兴趣区域(投资回报率)将感兴趣区域(感兴趣区域)的多边形转换为区域掩模用内插法填充图像中的指定区域基于颜色的选择感兴趣区域(感兴趣区域)图像中的感兴趣区域(感兴趣区域)创建可拖动椭圆创建可拖动自由区域创建可拖动,可调整大小的多边形创建可拖动矩形感兴趣区域(感兴趣区域)基类图像I / O接口图像的不同块处理确定块处理的最佳块大小一般滑动邻域运算将矩阵列重新排列成块纵列邻域操作将图像块重新排列成列两幅图像的绝对差添加两个图像或添加常量到图像彩色通道的线性组合补充图像用常数将一幅图像分割成另一幅图像图像的线性组合用常数相乘的两幅图像或多幅图像从另一个或减去一个图像减去一个图像二元图像中的迹区域边界二进制图像中的跟踪对象绘图区域的边界在强度图像中查找边缘发现使用Hough变换圆创建圈子图像的梯度幅值和方向图像的方向梯度查找图像的三维梯度幅值和方向查找三维图像的方向梯度Hough变换基于Hough变换提取直线段确定峰Hough变换四叉树分解在四叉树分解块值在四叉树分解模块设置的值图像区域的测量特性二值图像中的对象区域通过大小从二值图像中提取对象查找二进制图像中的连接组件从二值图像生成凸壳图像二值图像的距离变换二值图像的测地距离变换二值图像的欧拉数在二值图像中查找对象的周长使用属性从二值图像中提取对象在二值图像中选择对象灰度图像的灰度加权距离变换创建图像数据的等高线图图像数据直方图像素的颜色值沿线段的像素值的横截面二维相关系数矩阵元素的平均值或平均值矩阵元素的标准偏差二维二值图像中的标签连接部件二值图像中的标签连接组件从bwconncomp创建标签矩阵结构包的二进制图像打开二进制图像灰度图像熵灰度图像局部熵局部图像范围图像局部标准偏差从图像创建灰度共生矩阵灰度共生矩阵的性质均方误差峰值信噪比(PSNR)结构相似性指数(SSIM)测量图像质量用主动轮廓分割成前景和背景的图像采用快速行进法的二值图像分割用基于测地距离的彩色分割的两个或三个区域的分割图像基于图像梯度的图像像素权重计算基于灰度强度差的图像像素权重计算选择具有相似灰度值的连续图像区域使用全局阈值Otsu方法采用多级图像阈值Otsu方法使用全局直方图阈值Otsu方法采用局部一阶统计的自适应图像阈值查找区域边界的分割二维超像素oversegmentation的图像将二元掩模烧成二维图像将标签矩阵转换为线性指标的单元阵列图像变换二值图像的距离变换二值图像的测地距离变换灰度图像的灰度加权距离变换Hough变换二维离散余弦变换离散余弦变换矩阵将扇形束投影转换成平行光束扇束变换二维逆离散余弦变换逆扇形束变换逆Radon变换将平行光束投影转换成扇形光束Radon变换二维快速傅立叶变换将零频分量移到光谱中心二维逆快速傅立叶变换逆FFT转换颜色转换转换RGB与CIE 1976 L*a*b*将RGB颜色值的NTSC色彩空间转换RGB与CIE 1931 XYZ转换到YCbCr色彩空间RGB颜色值1976将CIE L*a*b*到RGB1976将CIE L*a*b*到CIE 1931 XYZ将CIE 1931 XYZ CIE 1976 L*a*b*CIE 1931 XYZ到RGB的转换YCbCr颜色值转换到RGB颜色空间转换成NTSC值RGB颜色空间将L * A * B *数据转换为双将L*a*b*数据uint16将L*a*b*数据卡片XYZ颜色值转换为双将XYZ颜色值uint16搜索国际商会简介读的ICC配置文件查找系统默认的国际刑事法院配置文件库将颜色配置文件写入磁盘文件真正的有效的国际刑事法院颜色配置文件创建颜色转换结构应用设备独立的颜色空间变换通过减少颜色数的近似索引图像标准照明体XYZ颜色值generation采用局部一阶统计的自适应图像阈值查找区域边界的分割从二值图像中删除小对象二元图像中的迹区域边界查找二进制图像中的连接组件二值图像的距离变换二值图像的欧拉数二维二值图像中的标签连接部件使用查找表的非线性滤波二值图像的形态学运算包的二进制图像在二值图像中查找对象的周长在二值图像中选择对象二进制图像中的跟踪对象打开二进制图像创建连接的阵列Bayer编码图像转换为彩色图像在强度图像中查找边缘拟合控制点对的几何变换创建预定义的二维滤波器基于它的类的图像的默认显示范围选择具有相似灰度值的连续图像区域采用直方图均衡化增强对比度Hough变换基于Hough变换提取直线段确定峰Hough变换转换到RGB的色度HSV颜色图将图像转换为双精度将图像转换为16位有符号整数将图像转换为单精度将图像转换为16位无符号整数将图像转换为8位无符号整数两幅图像的绝对差调整图像的灰度值或颜色表二值化图像的阈值分割帽子底部过滤二维图像的二维图像滤波抑制连接到图像边缘的光结构形态接近的图像补充图像作物图像放大图像腐蚀图像扩展极大值变换扩展最小变换填充图像区域和孔N维的多维图像滤波发现使用Hough变换圆应用Gabor滤波器或滤波器组二维图像二维图像的二维高斯滤波查找图像的三维梯度幅值和方向查找三维图像的方向梯度图像数据直方图h-maxima变换利用H-minima变换图像的线性组合均方误差形态上打开的图像将二元掩模烧成二维图像图像金字塔的还原与扩展量化图像使用指定的量化电平和输出值从图形文件读取图像形态重构区域极值局部极小调整图像大小旋转图像顶帽滤波转换图像将几何变换应用于图像积分图像的二维箱滤波计算积分图像使用查找表转换整数值检查的有效性信息检查连通性参数的有效性1976将CIE L*a*b*到RGB转换成RGB图像标签矩阵将标签矩阵转换为线性指标的单元阵列矩阵元素的平均值或平均值二维中值滤波采用多级图像阈值Otsu方法二维阶统计滤波使用全局直方图阈值Otsu方法焊盘阵列峰值信噪比(PSNR)图像区域的测量特性将RGB图像的灰度或颜色表将RGB颜色表HSV色图转换RGB与CIE 1976 L*a*b*转换到YCbCr色彩空间RGB颜色值查找对比度拉伸图像的限制二维超像素oversegmentation的图像分水岭变换YCbCr颜色值转换到RGB颜色空间参考二维图像到世界坐标参考三维图像到世界坐标二维仿射几何变换二维射影几何变换形态学结构元素形态学偏移结构元素GPU 计算二值图像的距离变换二维二值图像中的标签连接部件使用查找表的非线性滤波二值图像的形态学运算二维相关系数在强度图像中查找边缘采用直方图均衡化增强对比度将图像转换为双精度将图像转换为单精度将图像转换为8位无符号整数将图像转换为16位无符号整数两幅图像的绝对差调整图像的灰度值或颜色表帽子底部过滤形态接近的图像补充图像放大图像腐蚀图像填充图像区域和孔N维的多维图像滤波图像的梯度幅值和方向图像的方向梯度图像数据直方图图像的线性组合添加噪声到图像YCbCr颜色值转换到RGB颜色空间形态上打开的图像形态重构估计对齐两个二维或三维图像的位移场调整图像大小旋转图像显示图像顶帽滤波逆Radon变换转换矩阵到灰度图像矩阵元素的平均值或平均值二维中值滤波标准化二维互相关焊盘阵列Radon变换图像区域的测量特性将RGB图像的灰度或颜色表转换到YCbCr色彩空间RGB颜色值矩阵元素的标准偏差图像局部标准偏差查找对比度拉伸图像的限制。
MATLAB 图像处理命令使用
![MATLAB 图像处理命令使用](https://img.taocdn.com/s3/m/83b9a57d27284b73f2425094.png)
MATLAB 图像处理命令使用1.MATLAB中图像处理的一些简单函数A、imreadimread函数用于读入各种图像文件,其一般的用法为[X,MAP]=imread(‘filename’,‘fmt’)其中,X,MAP分别为读出的图像数据和颜色表数据,fmt为图像的格式,filename为读取的图像文件(可以加上文件的路径)。
例:[X,MAP]=imread(’flowers.tif’,’tif’);比较读取二值图像,灰度图像,索引图像,彩色图像的X和MAP的特点,可以利用size 函数用来显示数组的维数,了解数据的特点。
B=size(a) 返回数组a 的维数。
B、imwriteimwrite函数用于输出图像,其语法格式为:imwrite(X,map,filename,fmt)imwrite(X,map,filename,fmt)按照fmt指定的格式将图像数据矩阵X和调色板map写入文件filename。
C、imfinfoimfinfo函数用于读取图像文件的有关信息,其语法格式为imfinfo(filename,fmt)imfinfo函数返回一个结构info,它反映了该图像的各方面信息,其主要数据包括:文件名(路径)、文件格式、文件格式版本号、文件的修改时间、文件的大小、文件的长度、文件的宽度、每个像素的位数、图像的类型等。
2.MATLAB中图像文件的显示imshowimshow函数是最常用的显示各种图像的函数,其语法如下:imshow(X,map)其中X是图像数据矩阵,map是其对应的颜色矩阵,若进行图像处理后不知道图像数据的值域可以用[]代替map。
(1)二进制(二值)图像显示方法,在MATLAB中一幅二值图像是uint8或双精度的,该矩阵仅包含0和1。
如果希望工具箱中的函数能将图像理解为二进制的,那么所有数据都要是逻辑数据,必须对其进行设置(将所有数据标志均设置on).可以对数据利用“~”取反操作实现图像逆转即黑白反色。
Matlab中图像处理常用函数的用法
![Matlab中图像处理常用函数的用法](https://img.taocdn.com/s3/m/f0d687cb5022aaea998f0f78.png)
Matlab中常见函数的用法1 size()函数1)s=size(A),当只有一个输出参数时,返回一个行向量,该行向量的第一个元素时矩阵的行数,第二个元素是矩阵的列数。
2)[r,c]=size(A),当有两个输出参数时,size函数将矩阵的行数返回到第一个输出变量r,将矩阵的列数返回到第二个输出变量c。
3)size(A,n)如果在size函数的输入参数中再添加一项n,并用1、2或者3为n赋值,则 size将返回矩阵的行数或列数。
其中r=size(A,1)该语句返回的时矩阵A的行数, c=size(A,2) 该语句返回的时矩阵A的列数。
如果A为一个二维数组,则可以将其看成一个第三维为1的数组,即size(A,3)的返回值为1。
2 padarray()函数B = padarray(A,padsize,padval,direction)A为输入图像,B为填充后的图像,padsize给出了给出了填充的行数和列数,通常用[r c]来表示。
padval和direction分别表示填充方法和方向。
它们的具体值和描述如下:Padval选项:'symmetric'表示图像大小通过围绕边界进行镜像反射来扩展;'replicate'表示图像大小通过复制外边界中的值来扩展;'circular'图像大小通过将图像看成是一个二维周期函数的一个周期来进行扩展。
Direction选项:'pre'表示在每一维的第一个元素前填充;'post'表示在每一维的最后一个元素后填充;'both'表示在每一维的第一个元素前和最后一个元素后填充,此项为默认值。
若参量中不包括direction,则默认值为'both';若参量中不包含padval,则默认用0来填充。
若参量中不包括任何参数,则默认填充为零且方向为'both'。
matlab图像处理函数大全
![matlab图像处理函数大全](https://img.taocdn.com/s3/m/a069501e580102020740be1e650e52ea5518ceb7.png)
matlab图像处理函数大全Matlab是一种强大的科学计算软件,广泛应用于各个领域,包括图像处理。
在Matlab中,有许多内置的图像处理函数,可以帮助我们实现各种图像处理任务。
本文将介绍一些常用的Matlab图像处理函数,帮助您更好地理解和运用这些函数。
1. imread函数imread函数用于读取图像文件,并将其存储为Matlab的图像矩阵。
它可以读取多种图像格式,如JPEG、PNG、BMP等。
例如,可以使用以下代码读取名为"image.jpg"的图像文件:```matlabimage = imread('image.jpg');```2. imshow函数imshow函数用于显示图像。
它可以接受一个图像矩阵作为输入,并将其显示在Matlab的图像窗口中。
例如,可以使用以下代码显示之前读取的图像:```matlabimshow(image);```3. imresize函数imresize函数用于调整图像的大小。
它可以接受一个图像矩阵和目标大小作为输入,并返回调整大小后的图像矩阵。
例如,可以使用以下代码将图像调整为200x200的大小:```matlabresized_image = imresize(image, [200, 200]);```4. rgb2gray函数rgb2gray函数用于将彩色图像转换为灰度图像。
它可以接受一个彩色图像矩阵作为输入,并返回一个灰度图像矩阵。
例如,可以使用以下代码将彩色图像转换为灰度图像:```matlabgray_image = rgb2gray(image);```5. imadjust函数imadjust函数用于调整图像的对比度和亮度。
它可以接受一个灰度图像矩阵和目标对比度和亮度范围作为输入,并返回调整后的图像矩阵。
例如,可以使用以下代码增加图像的对比度和亮度:```matlabadjusted_image = imadjust(gray_image, [0.2, 0.8], [0, 1]);```6. imfilter函数imfilter函数用于对图像进行滤波操作。
matlab图像处理-常用函数列表.docx
![matlab图像处理-常用函数列表.docx](https://img.taocdn.com/s3/m/5e889c5dce2f0066f433220a.png)
附录MATLAB图像处理工具箱函数表1通用函数函数功能语法colorbar 显示颜色条colorbar colorbar(.../peer\axes_handle) colorbar(axes_handle) colorba^location1) colorbar(.../PropertyName*,property value) cbar_axes = colorbar(…)getimage 从坐标轴取得图像数据A = getimage(h)[x,y,A] = getimage(h) [...,A,flag] = getimage(h) [...]=getimageimage 创建并显示图像对象image(C)image(x,y,C) image(.../PropertyName\Property Value,...) image(,PropertyName\Property Value,...) Formal syntax - PN/PV onlyhandle = 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)imsho w(…,display_option) imshow(x,yA …) imshow filename h = imshow(…)imview 利川图像浏览器显示图像imview(I)imview(RGB)imview(X,map)imview(I,range) imview(filename)imview(.../InitialMagnification\initial_mag) h = imview(…)imview close allmontage在矩形框中同时显示多帧图像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,[mrows mcols])truesize(fig)wrap 将图像显示到纹理映射农面warp(X.map) warp(I5n) warp(BW) warp(RGB)warp(z,...) warp(x,y,z,…) h = warp(...)zoom onzoom offzoom outzoom resetzoom 缩放图像或图形zoomzoom xonzoom yon zoom(factor) zoom(fig, option)表2图像文件I/O函数函数功能语法imfinfo 返回图像文件信息info = imfinfo(filename5fmt)info = imfinfo(filename)imread 从图像文件中读取图像A = imread(filename,fmt)[X,map] = imread(filename,fmt) [...]=imread(filename)[...]=imread(URL,...)[…]=imread(...,idx)(CUR, GIF, ICO, and TIFF only)=imread(..., 'PixelRegion', { ROWS, COLS )) (TIFF only)[...]=imread(.../frames\idx) (GIF only) [...]=imread(...,ref) (HDF only) [...]=imread(.../BackgroundColor\BG) (PNG only)[A,map,alpha] = imread(…)(ICO, CUR, and PNG only)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,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 图像旋转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 DATA, YD ATA] = imtransform(...) [B,X DATA, YD ATA] = imtransform(..M param 1, vail, param2, val2,…)makeresampler 生成重采样结构R = makeresampler(interpolant,padmethod) maketform 生成几何变换结构T = maketform(transformtype v..)tformarray 多维数组的空间变换 B = tformarray(A, T, R, TDIMS_A,TDIMS_B, TSIZE_B, TMAP_B,F)tformfwd 正向空1'可变换[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,...)imcontour(...,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,xi,yi)P = impixel(x,y,RGB,xi,yi) [xi,yi,P] = impixel(x,y,…)improfile 沿线段计算剖面图的像索值c = improfilec = 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 求矩阵元素平均值 B = mean2(A)pixval 显示图像像素信息pixval onpixval offpixval pixval(fig,option) pixval(ax,option) pixval(H,option)regionprops 得到图像区域属性STATS = regionprops(L,properties) std2 计算矩阵元素的标准偏移 b = std2(A)函数功能语法edge 识别灰度图像中的边界BW = edged,,sober)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,'roberts1,thresh) [BW,thresh] = edgeCI/roberts1,...)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(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)qtsetblk设置四叉树分解屮的数纽•块值J = qtsetblk(LS,dim,vals)函数功能语法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] = histeq(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 向图像中加入噪声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)LOW_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(.../shape1)convmtx2 二维矩阵卷积T = convmtx2(H,m,n)T = convmtx2(H,[m n])convn n维卷积C = convn(A,B)C = con vn( A,B /shape1)filter2 二维线性滤波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(.../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 通过频率转换法设计二维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 计算离散余弦变换矩阵 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(..., 'nonsymmetric1) y = ifft2(..., 'nonsymmetric1)ifftn 计算n维逆快速傅立叶变换Y= ifftn(X)Y= ifftn(X,siz)y = ^onsymmetric1) 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 = phantom(E,n) [P,E] = phantom(…)radon 计算Radon变换R=radon(I,theta)[R,xp]=radon(...)F = fanbeam(I,D)F = fanbeam 计算扇形投影变换fanbeam(...,param 1 ,val 1,param 1 ,val2,...) [Esensor_positions,fan_rotation_angles] fanbeam(…)表10边沿和块处理函数函数功能语法bestblk 确定进行块操作的块人小siz = bestblk([m n],k)[mb,nbj = bestblk([m n],k)blkproc实现图像的非重叠(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,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图像形态学操作函数函数功能语法applylut 在二值图像屮利用查找表进行邻域操作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 = bwmorph(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 = makelut(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)imdilate 图像的膨胀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,'holes1)12 = imfill(I)BW2 = imfill(BW)[BW2 locations] = imfill(BW)BW2 = imfill(BW,locations,CONN) BW2 = imfill(BW,CONN,'holes1) 12 = imfill(I,CONN)imtophat用开运算后的图像减去原图像IM2 = imtophat(IM,SE)IM2 = imtophat(IM,NHOOD)strel 创建形态学结构元素SE = strel(shape,parameters)表12区域处理函数函数功能语法roicolor 选择感兴趣的颜色区BW = roicolor(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 = roipoly(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)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)表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 = 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 = im2uint8(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 判断是否为灰度图像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)表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, NOISEPOWER, 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, DAMPAR, 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)。
matlab中images函数
![matlab中images函数](https://img.taocdn.com/s3/m/2cf463308f9951e79b89680203d8ce2f0066659c.png)
1. 图像处理在科学研究和工程领域中具有重要作用,而MATLAB作为一种强大的科学计算软件,拥有丰富的图像处理功能。
其中,images 函数是MATLAB中用于图像处理的重要函数之一。
2. images函数是MATLAB中一个用于创建图像的函数。
它可以在MATLAB中生成各种类型和大小的图像,包括灰度图像、彩色图像以及各种特定形状和大小的图像。
images函数的基本语法如下所示: ```matlabimg = images('PropertyName', 'PropertyValue', ...)```其中,img是生成的图像对象,'PropertyName'和'PropertyValue'是用于指定图像属性的参数。
3. images函数可以用来创建各种类型的图像,包括灰度图像和彩色图像。
对于灰度图像,可以通过指定图像的大小和灰度值来创建。
下面的代码创建了一个大小为256x256的灰度图像,灰度值为128:```matlabimg = images('CData', ones(256,256)*128);```对于彩色图像,可以通过指定图像的大小和RGB值来创建。
下面的代码创建了一个大小为256x256的彩色图像,颜色为红色:```matlabimg = images('CData', cat(3, ones(256,256), zeros(256,256),zeros(256,256)));```4. images函数还可以用来创建特定形状和大小的图像。
通过指定图像的大小和形状参数,可以轻松地创建各种形状的图像,如矩形、圆形和椭圆形。
下面的代码创建了一个大小为256x256的红色矩形图像: ```matlabimg = images('CData', cat(3, ones(256,256), zeros(256,256), zeros(256,256)), 'XData', [0 10], 'YData', [0 10]);```5. images函数还可以用来处理图像的显示和调整。
matlabimread,imshow,subplot,figure,imwrite的用法
![matlabimread,imshow,subplot,figure,imwrite的用法](https://img.taocdn.com/s3/m/1905c02b24c52cc58bd63186bceb19e8b8f6ecea.png)
matlabimread,imshow,subplot,figure,imwrite的用法1. imread:这个函数用于从文件中读取图像。
它的语法如下:```A = imread(filename)```其中,`filename`是字符串类型的参数,表示要读取的图像文件名。
`A`是一个矩阵,表示读取到的图像。
2. imshow:imshow函数用于显示图像。
它的语法如下:```imshow(A)```其中,`A`是一个矩阵,表示要显示的图像。
3. subplot:subplot函数用于在一个图形窗口中创建一个均匀的子图网格,并指定当前操作的子图。
它的语法如下:```subplot(m,n,p)```其中,`m`表示子图网格的行数,`n`表示子图网格的列数,`p`表示当前要操作的子图的位置。
4. figure:figure函数用于创建一个新的图形窗口。
它的语法如下:```figure```这个函数调用时不带参数,只创建一个新的图形窗口。
5. imwrite:imwrite函数用于将图像保存到一个文件中。
它的语法如下:```imwrite(A,filename)```其中,`A`是一个矩阵,表示要保存的图像,`filename`是保存图像的文件名。
这些函数在MATLAB中经常被用于图像处理和分析领域。
在具体使用时,我们可以结合其他函数一起使用,来完成一些复杂的图像处理任务。
例如,我们可以使用imread读取一张图像,然后使用imshow显示该图像:```A = imread('image.jpg');imshow(A);```我们也可以创建一个带有多个子图的图形窗口,并在不同的子图中显示不同的图像:```figure;subplot(2,2,1);imshow(A);subplot(2,2,2);imshow(B);subplot(2,2,3);imshow(C);subplot(2,2,4);imshow(D);```最后,我们还可以对处理后的图像使用imwrite保存到文件中:```C = someImageProcessingFunction(A);imwrite(C,'processed_image.jpg');```这些函数都是MATLAB中图像处理和分析的基本操作,通过它们的灵活使用,可以实现各种不同的图像处理任务。
matlab函数大全
![matlab函数大全](https://img.taocdn.com/s3/m/5e9fe2d250e2524de5187e8c.png)
图像处理和图像识别中常用的matlab函数2012年03月28日星期三9:42下面仅给出函数的大概意思,详细用法见:help 函数名或matlab help1、imread:read image from graphics file;2、imshow:display image in Handle Graphics figure;3、imwrite:write image to graphics file;4、rgb2gray:convert RGB image or colormap to grayscale;5、im2bw:convert image to bi nary image, based on threshold;6、exist:check existence of variable, functi on, directory, or class;7、size:size of array,用此函数可以获得图像的高和宽;8、min:smallest elements in array;9、max:largest elements in array;10、fprintf:write data to text file;将信息显示到屏幕上或将数据写到指定的文件中;11、conv2:two dimensional convolution;二维卷积(图像滤波);12、ones(m, n):create array of all ones;13、zeros(m, n):create array of all zeros;14、interp2:2-D data interpolati on;二维插值(图像插值),多和meshgrid一起用;15、meshgrid:generate X and Y arrays for 3-D plots;用于产生网格,将向量区域转换成矩阵;16、clf:clear current figure window;清除当前的图像,图像窗口仍存在;17、pause:halt execution temporarily;暂停;18、figure:create figure graphics object;19、pinv:Moore-Penrose pseudoinverse of matrix;求矩阵的伪逆;20、hold on:holds the current plot and all axis properties so that subsequent graphingcommands add to the existing graph;21、hold off:returns to the default mode whereby PLOT commands erase the previousplots and reset all axis properties before drawing new plots;22、error:di splay message and abort function;23、isempty:determine whether array is empty;24、close:remove specified figure;25、repmat:replicate and tile an array;26、find:find indices and val ues of nonzero elements;27、cell:construct cell array;28、atan2:four quadrant inverse tangent;29、prod:product(乘积) of array elements,对于向量返回的是其所有元素的积、对于矩阵返回的是按列向量的所有元素的积,然后组成一行向量;30、abs:absolute value and complex magnitude;31、disp:Display text or array;32、clear:remove items from workspace, freeing up system memory;33、clc:clear command window;34、delete:delete file or graphics object;35、diary:save text of MATLAB session(a copy of all subsequent command window input and most of the resulting command window output to be appended to the named file);36、save:saves all workspace variables to the binary "MAT-file"(disk);37、rand:uniformly distributed pseudo-random numbers;均匀分布的伪随机数;38、memory:di splay memory information;39、pack:consolidate workspace memory;40、pwd:displays the current working directory;41、feature('memstats'):可以用来查看内存的使用情况;42、length:length of vector or largest array dimension;43、floor:round towards minus infinity;朝负无穷方向靠近最近的整数;44、ceil:round towards plus i nfinity;朝正无穷方向靠近最近的整数;45、round:round towards nearest integer;取最近的整数(相当于四舍五入);46、fix:round towards zero;取离0最近的整数;47、norm:matrix or vector norms(范数);48、mod:modulus after divi sion;求余数;49、reshape:reshape array;改变指定矩阵的形状,元素个数不变;50、graythresh:global image threshold using Otsu's method;51、xor:logical exclusive OR;逻辑异或;52、imopen:morphologically open image;形态学开运算;53、imclose:morphologically close image;形态学闭运算;54、imerode:erode image;图像腐蚀;55、imdilate:dilate image;图像膨胀;56、bwlabel:label connected components in 2-D binary image;57、cpselect:i s a graphical user interface that enables you to select control points from two related images;手动在两幅图像中选取配准控制点;它会自动存到两个points 数组里面58、cp2tform:takes pairs of control points and uses them to infer spatial transformation;图象配准一个求坐标转换参数的函数;能修正6种变形;59、imcrop:crops an image to a specified rectangle;图像剪切;60、imresize:resize image;61、imrotate:rotate image;62、imtransform:apply 2-D spatial transformation to image;图像空间变换;多与cp2tform或maketform 一起用;63、maketform:create spatial transformation structure (TFORM);64、edge:find edges i n grayscale image;包括Sobel、Prewitt、Roberts、Laplacian of Gaussian、Zero-cross、Canny;65、cpcorr:tune control point locations usi ng cross-correlation;采用互相关法协调控制点位置,在图像配准中,对已选定的控制点进行微调;66、isnan:array elements that are NaN;67、ischar:determine whether item is character array;68、strcmp:compare strings;69、colstyle:parse color and style from string;70、gcf:get handle to current figure;71、print:print figure or model;save to di sk as image or M-file;72、warning:di splay warning message;di sable or enable warning messages;73、nargout:number of function output arguments;74、nargi n:number of function input arguments;75、any:determine whether any array elements are nonzero;76、median:median value of array;77、imfinfo:information about graphics file;78、filter2:two-dimensional digital filter;在计算filter2时先将卷积核旋转180度,再调用conv2函数进行计算,其实filter2和conv2是等价的;79、fspecial:create predefined 2-D filters;80、det:matrix determinant(行列式);81、trace:sum of diagonal(对角线) elements;矩阵的迹;82、plot:2-D line plot;用于在指定位置标注;83、eye:i dentity matrix(单位矩阵);84、mean:average or mean value of array;85、exp:exponential(指数);86、imagesc:scale data and display as image;87、all:determine whether all array elements are nonzero or true;88、sort:sort array elements i n ascending or descending order;89、sparse:create sparse matrix;90、set:set Handle Graphics object properties;91、inv:matrix inverse(逆矩阵);92、drawnow:flush event queue and update figure window;93、rem:remainder after divi sion(取余数);94、tril:extract lower triangular part of matrix;95、nargchk:validate number of input arguments;96、ordfilt2:2-D order-statistic filtering;97、im2double:convert image to double preci sion;98、pdi st:pairwise distance between pairs of objects;99、version:version number for MATLAB and libraries;100、nargchk:validate number of input arguments;101、isa:determine whether input is object of given class(类型,如:char、int8);102、varargin:variable length input argument list;103、varargout:variable length output argument list;104、strcmpi:compare strings ignoring case(忽略大小写);105、ndims:number of array dimensions;106、assert:generate an error when a condition is vi olated;107、strcmp:compare strings;108、ordfilt2:2-D order-stati stic filtering(类似于形态学灰度图像膨胀);109、eps:floating-poi nt relati ve accuracy;110、randsample:random sample, with or without replacement;111、feval:execute the specified function;112、dot:vector dot product(向量点积);113、cross:vector cross product(向量叉积);114、svd:singular value decompositi on(奇异值分解);115、numel:number of elements in an array or subscripted array expressi on;116、nnz:number of nonzero matrix elements;可以用来计算某矩阵中某元素的个数;117、wiener2:2-D adaptive noise-removal filtering(二维自适应维纳滤波);118、medfilt2:2-D median filtering;119、wavedec2:multilevel 2-D wavelet decomposition;120、wrcoef2:reconstruct single branch from 2-D wavelet coefficients;121、wpdencmp:de-noi sing or compression using wavelet packets;122、adjust:adj ust image intensity values or colormap;123、movegui:move a figure window to a specified positi on on the screen;124、uicontrol:create user interface control;125、waitforbuttonpress:wait for key/buttonpress over figure;126、imhist:display histogram of image data;127、smooth:smooth response data;128、cputime:returns the CPU time in seconds;129、bitset:set bit at specified position;设置数的某一位二进制位为1或0;130、bitget:get bit at specified position;取的数的某一位二进制位(只能是0或1);131、load:load workspace variables from disk;132、axis:control axis scaling and appearance;133、subpl ot:create axes in tiled positions;134、uimenu:create user interface menu;135、eval:execute string with MATLAB expression;136、segment:segments data and estimate models for each segment(分割字符);137、strcat:concatenate strings horizontally;138、num2str:convert numbers to string;139、diff:difference and approximate derivative(导数);140、imcomplement:complement image(图像反色处理);141、bwmorph:morphological operations on binary image(二值图像形态学运算);142、strel:create morphological structuring element;143、regionprops:measure properties of image regions;144、rectangle:create rectangle, rounded-rectangle, or ellipse;145、text:create text object in current axes;146、radon:radon transform(用于检测图像中的线);147、ind2sub:multiple subscripts from linear index(把数组的单索引值(按列进行排列)转化相应的下标值(行列值));148、uigetfile:open standard dialog box for retrieving files;149、im2col:rearrange image blocks into columns(按列重新排列图像块);150、sim:simulate dynamic system(仿真动态系统,如仿真神经网络);151、newff:create feed-forward backpropagation network(生成一个BP网络);152、imadjust:adjust image intensity values or col ormap;153、stretchlim:find limits to contrast stretch an image(获得图像对比度拉伸范围);154、input:request user input;155、mse:mean squared normalized error performance function(可用来计算神经网络的均方误差);156、legend:graph legend for lines and patches(图例的线条和patches);157、init:initialize neural network(初始化一个神经网络);158、train:train neural network(训练一个神经网络);159、dir:folder listing(列举当前文件夹里(或指定文件夹)所有的文件与文件夹);。
MATLAB图像处理函数汇总(二)
![MATLAB图像处理函数汇总(二)](https://img.taocdn.com/s3/m/afa3ae4e814d2b160b4e767f5acfa1c7aa0082cc.png)
MATLAB图像处理函数汇总(⼆)60.imnoise功能:增加图像的渲染效果.语法:J = imnoise(I,type)J = imnoise(I,type,parameters)举例I = imread('eight.tif');J = imnoise(I,'salt & pepper',0.02);imshow(I)figure, imshow(J)相关命令:rand61.impixel功能:确定像素颜⾊值.语法:MATLAB⾼级应⽤——图形及影像处理 348P = impixel(I)P = impixel(X,map)P = impixel(RGB)P = impixel(Incur)P = impixel(X,map,c,r)P = impixel(RGB,c,r)[carp] = 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,...)举例RGB = imread('flowers.tif');c = [12 146 410];r = [104 156 129];pixels = impixel(RGB,c,r)pixels =61 59 101253 240 0237 37 44相关命令:improfile, pixval62.improfile功能:沿线段计算剖⾯图的像素值.语法:c = improfilec = 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)附录 MATLAB图像处理命令 349[...] = improfile(...,method)举例I = imread('alumgrns.tif');x = [35 338 346 103];y = [253 250 17 148];improfile(I,x,y), grid on相关命令:impixel, pixval63.imread功能:从图形⽂件中读取图像.语法:A = imread(filename,fmt)[X,map] = imread(filename,fmt)[...] = imread(filename)[...] = imread(...,idx) (TIFF only)[...] = imread(...,ref) (HDF only)[...] = imread(...,'BackgroundColor',BG) (PNG only) [A,map,alpha] = imread(...) (PNG only)举例[X,map] = imread('flowers.tif',6);info = imfinfo('skull.hdf');[X,map] = imread('skull.hdf',info(4).Reference);bg = [255 0 0];A = imread('image.png','BackgroundColor',bg); MATLAB⾼级应⽤——图形及影像处理 350 [A,map,alpha] = imread('image.png');相关命令:imfinfo, imwrite,fread,double,uint8,uint1664.imresize功能:改变图像⼤⼩.语法:B = imresize(A,m,method)B = imresize(A,[mrows ncols],method)B = imresize(...,method,n)B = imresize(...,method,h)65.imrotate功能:旋转图像.语法:B = imrotate(A,angle,method)B = imrotate(A,angle,method,'crop')举例I = imread('ic.tif');J = imrotate(I,-4,'bilinear','crop');imshow(I)figure, imshow(J)相关命令:imcrop, imresize66.imshow功能:显⽰图像.语法:附录 MATLAB图像处理命令 351imshow(I,n)imshow(I,[low high])imshow(BW)imshow(X,map)imshow(RGB)imshow(...,display_option)imshow(x,y,A,...)imshow filenameh = imshow(...)相关命令:getimage, imread, iptgetpref, iptsetpref, subimage, truesize, warp 67.imwrite功能:把图像写⼊图形⽂件中.语法:imwrite(A,filename,fmt)imwrite(X,map,filename,fmt)imwrite(...,filename)imwrite(...,Param1,Val1,Param2,Val2...)举例imwrite(X,map,'flowers.hdf','Compression','none',... 'WriteMode','append')相关命令:imfinfo, imread68.ind2gray功能:把检索图像转化为灰度图像.语法:I = ind2gray(X,map)举例load treesI = ind2gray(X,map);imshow(X,map)figure,imshow(I)MATLAB⾼级应⽤——图形及影像处理 352相关命令:gray2ind, imshow, rgb2ntsc69.ind2rgb功能:转化索引图像为RGB真彩图像.语法:RGB = ind2rgb(X,map)相关命令:ind2gray, rgb2ind70.iptgetpref功能:获取图像处理⼯具箱参数设置.语法:value = iptgetpref(prefname)举例value = iptgetpref('ImshowAxesVisible')value =off相关命令:imshow, iptsetpref71.iptsetpref功能:设置图像处理⼯具箱参数.语法:iptsetpref(prefname,value)举例iptsetpref('ImshowBorder','tight')相关命令:imshow, iptgetpref, truesize72.iradon附录 MATLAB图像处理命令 353功能:进⾏反Radon变换.语法:I = iradon(P,theta)I = iradon(P,theta,interp,filter,d,n)[I,h] = iradon(...)举例P = phantom(128);R = radon(P,0:179);I = iradon(R,0:179,'nearest','Hann'); imshow(P)figure, imshow(I)相关命令:radon, phantom73.isbw功能:判断是否为⼆进制图像.语法:flag = isbw(A)相关命令:isind, isgray, isrgb74.isgray功能:判断是否为灰度图像.语法:flag = isgray(A)相关命令:isbw, isind, isrgb75.isindMATLAB⾼级应⽤——图形及影像处理 354功能:判断是否为索引图像.语法:flag = isind(A)相关命令:isbw, isgray, isrgb76.isrgb功能:判读是否为RGB真彩图像.语法:flag = isrgb(A)相关命令:isbw, isgray, isind77.makelut功能:创建⼀个⽤于applylut函数的lookup表.语法:lut = makelut(fun,n)lut = makelut(fun,n,P1,P2,...)举例f = inline('sum(x(:)) >= 2');lut = makelut(f,2)lut =111111111附录 MATLAB图像处理命令 35511相关命令:applylut78.mat2gray功能:转化矩阵为灰度图像.语法:I = mat2gray(A,[amin amax])I = mat2gray(A)举例I = imread('rice.tif');J = filter2(fspecial('sobel'),I);K = mat2gray(J);imshow(I)figure, imshow(K)相关命令:gray2ind79.mean2功能:计算矩阵元素的平均值.语法:b = mean2(A)相关命令:std2, mean, std80.medfilt2功能:进⾏⼆维中值过滤.语法:MATLAB⾼级应⽤——图形及影像处理 356 B = medfilt2(A,[m n])B = medfilt2(A)B = medfilt2(A,'indexed',...)举例I = imread('eight.tif');J = imnoise(I,'salt & pepper',0.02);K = medfilt2(J);imshow(J)figure, imshow(K)相关命令:filter2, ordfilt2, wiener281.montage功能:在矩形框中同时显⽰多幅图像.语法:montage(I)montage(BW)montage(X,map)montage(RGB)h = montage(...)举例montage(D,map)附录 MATLAB图像处理命令 357相关命令:immovie82.nlfilter功能:进⾏边沿操作.语法:B = nlfilter(A,[m n],fun)B = nlfilter(A,[m n],fun,P1,P2,...)B = nlfilter(A,'indexed',...)举例B = nlfilter(A,[3 3],'median(x(:))');相关命令:blkproc, colfilt83.ntsc2rgb功能: 转换NTSC的值为RGB颜⾊空间.语法:rgbmap = ntsc2rgb(yiqmap)RGB = ntsc2rgb(YIQ)相关命令:rgb2ntsc, rgb2ind, ind2rgb, ind2gray84.ordfilt2功能:进⾏⼆维统计顺序过滤.语法:B = ordfilt2(A,order,domain)B = ordfilt2(A,order,domain,S)MATLAB⾼级应⽤——图形及影像处理 358 B = ordfilt2(...,padopt)相关命令:medfilt285.phantom功能:产⽣⼀个头部幻影图像.语法:P = phantom(def,n)P = phantom(E,n)[P,E] = phantom(...)举例P = phantom('Modified Shepp-Logan',200);相关命令:radon, iradon86.pixval功能:显⽰图像像素信息.语法:pixval onpixval offpixvalpixval(fig,option)相关命令:impixel, improfile87.qtdecomp功能:进⾏四叉树分解.附录 MATLAB图像处理命令 359语法:S = qtdecomp(I)S = qtdecomp(I,threshold)S = qtdecomp(I,threshold,mindim)S = qtdecomp(I,threshold,[mindim maxdim]) S = qtdecomp(I,fun)S = qtdecomp(I,fun,P1,P2,...)举例I = [1 1 1 1 2 3 6 61 12 1 4 5 6 81 1 1 1 10 15 7 71 1 1 1 20 25 7 720 22 20 22 1 2 3 420 22 22 20 5 6 7 820 22 20 20 9 10 11 1222 22 20 20 13 14 15 16];S = qtdecomp(I,5);full(S)ans =4 0 0 0 2 0 2 00 0 0 0 0 0 0 00 0 0 0 1 1 2 00 0 0 0 1 1 0 04 0 0 0 2 0 2 00 0 0 0 2 0 2 00 0 0 0 0 0 0 0相关命令:qtgetblk, qtsetblk88.qtgetblk功能:获取四叉树分解中的块值.语法:[vals,r,c] = qtgetblk(I,S,dim)MATLAB⾼级应⽤——图形及影像处理 360 [vals,idx] = qtgetblk(I,S,dim)举例[vals,r,c] = qtgetblk(I,S,4)vals(:,:,1) =1 1 1 11 12 11 1 1 11 1 1 1vals(:,:,2) =20 22 20 2220 22 22 2020 22 20 2022 22 20 20r =15c =11相关命令:qtdecomp, qtsetblk89.qtsetblk功能:设置四叉树分解中的块值.语法:J = qtsetblk(I,S,dim,vals)举例newvals = cat(3,zeros(4),ones(4));J = qtsetblk(I,S,4,newvals)J =0 0 0 0 2 3 6 60 0 0 0 4 5 6 80 0 0 0 10 15 7 7附录 MATLAB图像处理命令 3610 0 0 0 20 25 7 71 1 1 1 123 41 1 1 1 5 6 7 81 1 1 1 9 10 11 121 1 1 1 13 14 15 16相关命令:qtdecomp, qtgetblk90.radon功能: 计算Radon变换.语法:R = radon(I,theta)R = radon(I,theta,n)[R,xp] = radon(...)举例iptsetpref('ImshowAxesVisible','on')I = zeros(100,100);I(25:75,25:75) = 1;theta = 0:180;[R,xp] = radon(I,theta);imshow(theta,xp,R,[]), colormap(hot), colorbar 相关命令:iradon, phantom91.rgb2gray功能: 转换RGB图像或颜⾊映像表为灰度图像.语法:I = rgb2gray(RGB)newmap = rgb2gray(map)相关命令:MATLAB⾼级应⽤——图形及影像处理 362 ind2gray, ntsc2rgb, rgb2ind, rgb2ntsc92.rgb2hsv功能: 转化RGB值为HSV颜⾊空间.语法:hsvmap = rgb2hsv(rgbmap)HSV = rgb2hsv(RGB)相关命令:hsv2rgb, rgbplot93.rgb2ind功能: 转化RGB图像为索引图像.语法:[X,map] = rgb2ind(RGB,tol)[X,map] = rgb2ind(RGB,n)X = rgb2ind(RGB,map)[...] = rgb2ind(...,dither_option)举例RGB = imread('flowers.tif');[X,map] = rgb2ind(RGB,128);imshow(X,map)相关命令:cmunique, dither, imapprox, ind2rgb, rgb2gray 94.rgb2ntsc功能: 转化RGB的值为NTSC颜⾊空间.语法:yiqmap = rgb2ntsc(rgbmap)YIQ = rgb2ntsc(RGB)附录 MATLAB图像处理命令 363相关命令:ntsc2rgb, rgb2ind, ind2rgb, ind2gray95.rgb2ycbcr功能: 转化RGB的值为YcbCr颜⾊空间.语法:ycbcrmap = rgb2ycbcr(rgbmap)YCBCR = rgb2ycbcr(RGB)相关命令:ntsc2rgb, rgb2ntsc, ycbcr2rgb96.rgbplot功能:划分颜⾊映像表.语法:rgbplot(map)举例rgbplot(jet)相关命令:colormap97.roicolor功能:选择感兴趣的颜⾊区.语法:BW = roicolor(A,low,high)BW = roicolor(A,v)举例I = imread('rice.tif');BW = roicolor(I,128,255);imshow(I);MATLAB⾼级应⽤——图形及影像处理 364 figure, imshow(BW)相关命令:roifilt2, roipoly98.roifill功能:在图像的任意区域中进⾏平滑插补.语法:J = roifill(Incur)J = roifill(I)J = roifill(I,BW)[J,BW] = roifill(...)J = roifill(x,y,I,xi,yi)[x,y,J,BW,xi,yi] = roifill(...)举例I = imread('eight.tif');c = [222 272 300 270 221 194];r = [21 21 75 121 121 75];J = roifill(Incur);imshow(I)figure, imshow(J)附录 MATLAB图像处理命令 365相关命令:roifilt2, roipoly99.roifilt2功能:过滤敏感区域.语法:J = roifilt2(h,I,BW)J = roifilt2(I,BW,fun)J = roifilt2(I,BW,fun,P1,P2,...)举例h = fspecial('unsharp');J = roifilt2(h,I,BW);imshow(J)相关命令:filter2, roipoly100.roipoly功能:选择⼀个敏感的多边形区域.语法:BW = roipoly(Incur)BW = roipoly(I)BW = roipoly(x,y,I,xi,yi)[BW,xi,yi] = roipoly(...)[x,y,BW,xi,yi] = roipoly(...)举例I = imread('eight.tif');c = [222 272 300 270 221 194];r = [21 21 75 121 121 75];BW = roipoly(Incur);imshow(I)MATLAB⾼级应⽤——图形及影像处理 366 figure, imshow(BW)相关命令:roifilt2, roicolor, roifill101.std2功能:计算矩阵元素的标准偏移.语法:b = std2(A)相关命令:corr2, mean2102.subimage功能:在⼀幅图中显⽰多个图像.语法:subimage(X,map)subimage(I)subimage(BW)subimage(RGB)subimage(x,y,...)h = subimage(...)举例load trees[X2,map2] = imread('forest.tif');subplot(1,2,1), subimage(X,map)subplot(1,2,2), subimage(X2,map2)相关命令:附录 MATLAB图像处理命令 367103.truesize功能:调整图像显⽰尺⼨.语法:truesize(fig,[mrows mcols])truesize(fig)相关命令:imshow, iptsetpref, iptgetpref104.uint8功能:转换数据为8位⽆符号整型.语法:B = uint8(A)举例a = [1 3 5];b = uint8(a);whosName Size Bytes Classa 1x3 24 doublearrayb 1x3 3 uint8 array相关命令:double, im2double, im2uint8105.uint16功能:转换数据为16位⽆符号整型.语法:I = uint16(X)MATLAB⾼级应⽤——图形及影像处理 368举例a = [1 3 5];b = uint16(a);whosName Size Bytes Classa 1x3 24 double arrayb 1x3 6 uint16 array相关命令:double, datatypes, uint8, uint32, int8, int16, int32.106.warp功能:将图像显⽰到纹理映射表⾯.语法:warp(X,map)warp(I,n)warp(BW)warp(RGB)warp(z,...)warp(x,y,z,...)h = warp(...)举例[x,y,z] = cylinder;I = imread('testpat1.tif');warp(x,y,z,I);相关命令:imshow附录 MATLAB图像处理命令 369 107.wiener2功能:进⾏⼆维适应性去噪过滤处理.语法:J = wiener2(I,[m n],noise)[J,noise] = wiener2(I,[m n])举例I = imread('saturn.tif');J = imnoise(I,'gaussian',0,0.005);K = wiener2(J,[5 5]);imshow(J)figure, imshow(K)相关命令:filter2, medfilt2108.ycbcr2rgb功能: 转化YcbCr值为RGB颜⾊空间.语法:rgbmap = ycbcr2rgb(ycbcrmap) RGB = ycbcr2rgb(YCBCR)相关命令:ntsc2rgb, rgb2ntsc, rgb2ycbcr 109.zoom功能:缩放图像.语法:zoom onzoom offzoom outMATLAB⾼级应⽤——图形及影像处理 370 zoom resetzoomzoom xonzoom yonzoom(factor)zoom(fig,option)相关命令:imcrop。
MATLAB中图像函数大全 详解及例子
![MATLAB中图像函数大全 详解及例子](https://img.taocdn.com/s3/m/098ea7e85ef7ba0d4a733b21.png)
图像处理函数详解——strel功能:用于膨胀腐蚀及开闭运算等操作的结构元素对象(本论坛随即对膨胀腐蚀等操作进行讲解)。
用法:SE = strel(shape,parameters)创建由指定形状shape对应的结构元素。
其中shape的种类有arbitrary''pair''diamond''periodicline''disk''rectangle''line''square''octagon参数parameters一般控制SE的大小。
例子:se1 = strel('square',6)% 创建6*6的正方形se2 = strel('line',10,45)% 创建直线长度10,角度45se3 = strel('disk',15)% 创建圆盘半径15se4 = strel('ball',15,5)% 创建椭圆体,半径15,高度5图像处理函数详解——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(...)BW = roipoly(I,c,r)表示用向量c、r指定多边形各点的X、Y坐标。
BW选中的区域为1,其他部分的值为0.BW = roipoly(I)表示建立交互式的处理界面。
BW = roipoly(x,y,I,xi,yi)表示向量x和y建立非默认的坐标系,然后在指定的坐标系下选择由向量xi,yi指定的多边形区域。
例子:I = imread('eight.tif');c = [222 272 300 270 221 194];r = [21 21 75 121 121 75];BW = roipoly(I,c,r);imshow(I)figure, imshow(BW)图像处理函数详解——roifilt2功能:用于对一个区域进行滤波。
详解matlab图像函数及应用
![详解matlab图像函数及应用](https://img.taocdn.com/s3/m/8895698559f5f61fb7360b4c2e3f5727a5e92493.png)
详解matlab图像函数及应用MATLAB是一个用于科学计算和数据可视化的强大工具。
它提供了许多用于处理和分析图像的函数和工具。
在这篇文章中,我将详细介绍MATLAB中常用的图像函数及其应用。
MATLAB中的图像函数可以分为以下几类:1. 读取和显示图像:MATLAB提供了imread和imshow函数用于读取和显示图像。
imread函数可以从文件中读取图像,并将其存储为矩阵,imshow函数可以显示图像矩阵。
2. 调整图像尺寸和缩放:MATLAB提供了imresize函数用于调整图像的尺寸。
可以使用该函数将图像缩小或放大到指定的尺寸。
3. 调整图像亮度和对比度:MATLAB提供了imadjust函数用于调整图像的亮度和对比度。
可以使用该函数将图像的像素值映射到新的范围,从而改变图像的亮度和对比度。
4. 图像滤波和增强:MATLAB提供了许多用于图像滤波和增强的函数,如imfilter、medfilt2和imsharpen。
可以使用这些函数来平滑图像、去除噪声和增强图像的细节。
5. 图像变换:MATLAB提供了一些常用的图像变换函数,如imrotate、imcrop 和imresize。
可以使用这些函数对图像进行旋转、裁剪和缩放。
6. 图像分割和边缘检测:MATLAB提供了一些图像分割和边缘检测函数,如imsegm、edge和regionprops。
可以使用这些函数将图像分割成不同的区域,并检测图像中的边缘。
7. 形态学操作:MATLAB提供了一些形态学操作函数,如imerode、imdilate 和imopen。
可以使用这些函数来处理二值图像,如腐蚀、膨胀和开运算等操作。
8. 颜色空间转换:MATLAB提供了一些颜色空间转换函数,如rgb2gray、rgb2hsv和rgb2lab。
可以使用这些函数将图像从一种颜色空间转换到另一种颜色空间。
这些图像函数可以广泛应用于许多领域,如计算机视觉、模式识别、医学图像处理和遥感图像分析等。
matlab图像处理工具箱大全--参考
![matlab图像处理工具箱大全--参考](https://img.taocdn.com/s3/m/4b267de3240c844769eaee71.png)
图像处理函数详解——imadjust功能:调节灰度图像的亮度或彩色图像的颜色矩阵。
用法:J = imadjust(I,[low_in; high_in],[low_out; high_out],gamma)将图像I中的亮度值映射到J中的新值,即将low_in至hige_in之间的值映射到low_out至high_out之间的值。
low_in以下与 high_in以上的值被剪切掉了,也就是说,low_in以下的值映射到low_out,high_in以上的值映射到high_out。
它们都可以使用空的矩阵[],默认值是[0 1]。
newmap = imadjust(map,[low_in high_in],[low_outhigh_out],gamma)调整索引色图像的调色板map。
RGB2 = imadjust(RGB1,[low_in high_in],[low_outhigh_out],gamma)对RGB图像1的红、绿、蓝调色板分别进行调整。
随着颜色矩阵的调整,每一个调色板都有唯一的映射值。
参数gamma指定了曲线的形状,该曲线用来映射I的亮度值。
如果gamma 小于1,映射被加权到更高的输出值。
如果gamma大于1,映射被加权到更低的输出值。
如果省略了函数的参量,则gamma默认为1(线性映射)。
举例:调整灰度图像:K = imadjust(I,[0.3 0.7],[]);figure, imshow(K)调整RGB图像:RGB1 = imread('football.jpg');RGB2 = imadjust(RGB1,[.2 .3 0; .6 .7 1],[]);imshow(RGB 1), figure, imshow(RGB2)图像处理函数详解——imadd功能:实现图像相加运算。
用法:Z = imadd(X,Y)例子:I = imread('rice.png');J = imread('cameraman.tif');K = imadd(I,J,'uint16');%转换数据类型,然后将图像相加imshow(K,[])图像处理函数详解——im2uint8功能:将图像转换为8位无符号整型。
如何使用MATLAB进行图像处理和计算机视觉
![如何使用MATLAB进行图像处理和计算机视觉](https://img.taocdn.com/s3/m/6a395944fd4ffe4733687e21af45b307e871f9ff.png)
如何使用MATLAB进行图像处理和计算机视觉第一章:MATLAB 图像处理基础图像处理是计算机视觉领域中的重要组成部分,而MATLAB是一种强大的数值计算和数据分析工具,也是图像处理和计算机视觉研究的常用工具之一。
本章将介绍MATLAB中的图像处理基础知识,并介绍如何使用MATLAB进行图像的加载、显示和保存。
1.1 MATLAB中的图像处理函数MATLAB提供了丰富的图像处理函数,包括图像的加载和保存、图像的显示和绘制、图像的滤波和增强等。
常用的图像处理函数包括imread、imshow、imwrite、imfilter等。
1.2 图像的加载和显示使用imread函数可以加载图像,imread函数可以读取各种格式的图像文件,如PNG、JPEG、BMP等。
使用imshow函数可以显示图像,并提供了多种显示选项,如调整图像的亮度、对比度等。
1.3 图像的保存使用imwrite函数可以保存图像到指定的文件中,可以保存为各种格式的图像文件,如PNG、JPEG、BMP等。
同时,imwrite函数也支持指定图像的压缩质量和压缩格式。
第二章:图像滤波和增强图像滤波和增强是图像处理中重要的操作,可以用于去除图像中的噪声、增强图像的细节等。
MATLAB提供了丰富的图像滤波和增强函数,本章将介绍常用的图像滤波和增强方法,并结合MATLAB中的函数进行实例演示。
2.1 图像平滑使用平滑滤波可以去除图像中的噪声,常用的平滑滤波方法有均值滤波、中值滤波和高斯滤波等。
MATLAB中的imfilter函数可以实现这些滤波方法,根据需要选择不同的参数进行滤波操作。
2.2 图像锐化图像锐化可以增强图像的细节和边缘,常用的图像锐化方法有拉普拉斯锐化和梯度锐化等。
MATLAB中的imfilter函数和imgradient函数可以实现这些锐化方法,同样需要根据需求选择不同的参数。
2.3 对比度增强对比度增强可以增强图像的视觉效果,而不改变图像的色彩信息。
Matlab图像处理工具箱中部分函数用法
![Matlab图像处理工具箱中部分函数用法](https://img.taocdn.com/s3/m/f001b06e25c52cc58bd6be86.png)
1. blkproc( )用法blkproc功能:对图像进行分块处理调用形式: B = blkproc(A,[m n],fun, parameter1, parameter2, ...)B = blkproc(A,[m n],[mborder nborder],fun,...)B = blkproc(A,'indexed',...)参数解释:[m n] :图像以m*n为分块单位,对图像进行处理(如8像素*8像素)Fun:应用此函数对分别对每个m*n分块的像素进行处理parameter1, parameter2:要传给fun函数的参数mborder nborder:对每个m*n块上下进行mborder个单位的扩充,左右进行nborder个单位的扩充,扩充的像素值为0,fun函数对整个扩充后的分块进行处理。
这里:fun='P1*x*P2',fun的参数P1,P2,将T,T'传递给fun的参数,即:P1= T,P2=T'.2.dwt2( )用法d wt2功能:单级二维离散小波变换调用格式: [cA,cH,cV,cD] = dwt2(X,'wname')[cA,cH,cV,cD] = dwt2(X,Lo_D,Hi_D)其意义为使用指定的小波基函数'wname'对二维信号X进行二维离散小波变换。
cA,cH,cV,cD分别为近似细节分量、水平细节分量、垂直细节分量和对角细节分量。
3.wavedec2( )用法waveder2功能:二维信号的多层小波分解调用格式:[C,S] = wavedec2(X,N,'wname')[C,S] = wavedec2(X,N,Lo_D,Hi_D)其意义为使用小波基函数'wname'对二维信号X进行N层分解。
4.idwt2( )用法idwt2功能:单级二维离散小波反变换调用格式:X = idwt2(cA,cH,cV,cD,'wname')X = idwt2(cA,cH,cV,cD,Lo_R,Hi_R)X = idwt2(cA,cH,cV,cD,'wname',S)X = idwt2(cA,cH,cV,cD,Lo_R,Hi_R,S)X = idwt2(...,'mode',MODE)其意义为由信号小波分解的近似信号cA和细节信号cH,cV,cD经小波反变换重构原信号X。
使用Matlab进行图像处理的常用函数介绍
![使用Matlab进行图像处理的常用函数介绍](https://img.taocdn.com/s3/m/3976832d876fb84ae45c3b3567ec102de2bddf6c.png)
使用Matlab进行图像处理的常用函数介绍引言:图像处理是计算机科学和电子工程领域中的重要分支,它利用数字技术对图像进行各种操作和改变,以实现图像的增强、分割、恢复等目标。
而Matlab作为一种功能强大的科学计算软件,被广泛应用于图像处理领域。
本文将介绍几个常用的Matlab图像处理函数,并结合实例进行详解。
一、图像读取与显示函数1. imread函数imread函数是Matlab中用于读取图像的函数,它可以读取各种图像格式(如JPEG、PNG、BMP等)的图像文件,并将其转换为Matlab中的矩阵形式。
示例:```img = imread('image.jpg');```2. imshow函数imshow函数用于在Matlab中显示图像,它可以接受矩阵形式的图像作为输入,并在新窗口中显示出来。
此外,imshow函数还可以对显示的图像进行一些调整,如调整图像的亮度、对比度等参数。
示例:```imshow(img); % 显示读取的图像```二、图像增强函数1. imadjust函数imadjust函数可以调整图像的亮度和对比度,以增强图像的视觉效果。
它通过对图像的像素值进行映射,将原始图像灰度值的范围进行调整,从而使图像的显示效果更好。
示例:```img_adjusted = imadjust(img, [0.2 0.8], [0 1]);```2. histeq函数histeq函数可以进行直方图均衡化处理,使图像的像素值在不同灰度级之间更均匀分布,从而增强图像的对比度和细节。
示例:```img_equalized = histeq(img);```三、图像滤波函数1. imfilter函数imfilter函数实现了不同类型的图像滤波算法,包括平滑滤波、锐化滤波等。
它可以对图像的每个像素点进行卷积运算,以消除噪声、增强边缘等。
示例:```filter = fspecial('average', [5 5]); % 创建一个平滑滤波器img_filtered = imfilter(img, filter); % 对图像进行平滑滤波```2. medfilt2函数medfilt2函数是一种中值滤波算法,它可以有效地去除图像中的椒盐噪声、脉冲噪声等。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Matlab数字数字图像处理函数汇总:1、数字数字图像的变换①fft2:fft2函数用于数字数字图像的二维傅立叶变换,如:i=imread('104_8.tif'); j=fft2(i);②ifft2::ifft2函数用于数字数字图像的二维傅立叶反变换,如:i=imread('104_8.tif');j=fft2(i);k=ifft2(j);2、模拟噪声生成函数和预定义滤波器①imnoise:用于对数字数字图像生成模拟噪声,如:i=imread('104_8.tif');j=imnoise(i,'gaussian',0,0.02);%模拟高斯噪声②fspecial:用于产生预定义滤波器,如:h=fspecial('sobel');%sobel水平边缘增强滤波器h=fspecial('gaussian');%高斯低通滤波器h=fspecial('laplacian');%拉普拉斯滤波器h=fspecial('log');%高斯拉普拉斯(LoG)滤波器h=fspecial('average');%均值滤波器2、数字数字图像的增强①直方图:imhist函数用于数字数字图像的直方图显示,如:i=imread('104_8.tif');imhist(i);②直方图均化:histeq函数用于数字数字图像的直方图均化,如:i=imread('104_8.tif');j=histeq(i);③对比度调整:imadjust函数用于数字数字图像的对比度调整,如:i=imread('104_8.tif');j=imadjust(i,[0.3,0.7],[]);④对数变换:log函数用于数字数字图像的对数变换,如:i=imread('104_8.tif');j=double(i);k=log(j);⑤基于卷积的数字数字图像滤波函数:filter2函数用于数字数字图像滤波,如:i=imread('104_8.tif');h=[1,2,1;0,0,0;-1,-2,-1];j=filter2(h,i);⑥线性滤波:利用二维卷积conv2滤波, 如:i=imread('104_8.tif');h=[1,1,1;1,1,1;1,1,1];h=h/9;j=conv2(i,h);⑦中值滤波:medfilt2函数用于数字数字图像的中值滤波,如:i=imread('104_8.tif');j=medfilt2(i);⑧锐化(1)利用Sobel算子锐化数字数字图像, 如:i=imread('104_8.tif');h=[1,2,1;0,0,0;-1,-2,-1];%Sobel算子j=filter2(h,i);(2)利用拉氏算子锐化数字数字图像, 如:i=imread('104_8.tif');j=double(i);h=[0,1,0;1,-4,0;0,1,0];%拉氏算子k=conv2(j,h,'same');m=j-k;3、数字数字图像边缘检测①sobel算子如:i=imread('104_8.tif');如有帮助,欢迎支持。
j =edge(i,'sobel',thresh)②prewitt算子如:i=imread('104_8.tif');j =edge(i,'prewitt',thresh)③roberts算子如:i=imread('104_8.tif');j =edge(i,'roberts',thresh)④log算子如:i=imread('104_8.tif');j =edge(i,'log',thresh)⑤canny算子如:i=imread('104_8.tif');j =edge(i,'canny',thresh)⑥Zero-Cross算子如:i=imread('104_8.tif');j =edge(i,'zerocross',thresh)4、形态学数字数字图像处理①膨胀:是在二值化数字数字图像中“加长”或“变粗”的操作,函数imdilate执行膨胀运算,如:a=imread('104_7.tif');%输入二值数字数字图像b=[0 1 0;1 1 1;01 0];c=imdilate(a,b);②腐蚀:函数imerode执行腐蚀,如:a=imread('104_7.tif');%输入二值数字数字图像b=strel('disk',1);c=imerode(a,b);③开运算:先腐蚀后膨胀称为开运算,用imopen来实现,如:a=imread('104_8.tif');b=strel('square',2);c=imopen(a,b);④闭运算:先膨胀后腐蚀称为闭运算,用imclose来实现,如:a=imread('104_8.tif');b=strel('square',2);c=imclose(a,b);数字数字图像增强1. 直方图均衡化的Matlab 实现1.1 imhist 函数功能:计算和显示数字数字图像的色彩直方图格式:imhist(I,n)imhist(X,map)说明:imhist(I,n) 其中,n 为指定的灰度级数目,缺省值为256;imhist(X,map) 就算和显示索引色数字数字图像X 的直方图,map为调色板。
用stem(x,counts) 同样可以显示直方图。
1.2 imcontour 函数功能:显示数字数字图像的等灰度值图格式:imcontour(I,n),imcontour(I,v)说明:n 为灰度级的个数,v 是有用户指定所选的等灰度级向量。
1.3 imadjust 函数功能:通过直方图变换调整对比度格式:J=imadjust(I,[low high],[bottomtop],gamma)newmap=imadjust(map,[low high],[bottomtop],gamma)说明:J=imadjust(I,[low high],[bottomtop],gamma) 其中,gamma 为校正量r,[lowhigh] 为原数字数字图像中要变换的灰度范围,[bottom top]指定了变换后的灰度范围;newmap=imadjust(map,[lowhigh],[bottomtop],gamma) 调整索引色数字数字图像的调色板map 。
此时若[low high] 和[bottom top] 都为2×3的矩阵,则分别调整R、G、B 3个分量。
1.4 histeq 函数功能:直方图均衡化格式:J=histeq(I,hgram)J=histeq(I,n)[J,T]=histeq(I,...)newmap=histeq(X,map,hgram)newmap=histeq(X,map)[new,T]=histeq(X,...)说明:J=histeq(I,hgram) 实现了所谓“直方图规定化”,即将原是图象I 的直方图变换成用户指定的向量hgram 。
hgram 中的每一个元素都在[0,1] 中;J=histeq(I,n) 指定均衡化后的灰度级数n ,缺省值为64;[J,T]=histeq(I,...)返回从能将数字数字图像I 的灰度直方图变换成数字数字图像J 的直方图的变换T ;newmap=histeq(X,map) 和[new,T]=histeq(X,...) 是针对索引色数字数字图像调色板的直方图均衡。
2. 噪声及其噪声的Matlab 实现imnoise 函数格式:J=imnoise(I,type)J=imnoise(I,type,parameter)说明:J=imnoise(I,type) 返回对数字数字图像I 添加典型噪声后的有噪数字数字图像J ,参数type 和parameter 用于确定噪声的类型和相应的参数。
3. 数字数字图像滤波的Matlab 实现3.1 conv2 函数功能:计算二维卷积格式:C=conv2(A,B)C=conv2(Hcol,Hrow,A)C=conv2(...,'shape')说明:对于C=conv2(A,B) ,conv2 的算矩阵A 和 B 的卷积,若[Ma,Na]=size(A), [Mb,Nb]=size(B), 则size(C)=[Ma+Mb-1,Na+Nb-1];C=conv2(Hcol,Hrow,A) 中,矩阵A 分别与Hcol 向量在列方向和Hrow 向量在行方向上进行卷积;C=conv2(...,'shape') 用来指定conv2返回二维卷积结果部分,参数shape 可取值如下:》full为缺省值,返回二维卷积的全部结果;》same返回二维卷积结果中与A 大小相同的中间部分;valid 返回在卷积过程中,未使用边缘补0 部分进行计算的卷积结果部分,当size(A)>size(B) 时,size(C)=[Ma-Mb+1,Na-Nb+1]。
3.2 conv 函数功能:计算多维卷积格式:与conv2 函数相同3.3 filter2函数功能:计算二维线型数字滤波,它与函数fspecial 连用格式:Y=filter2(B,X)Y=filter2(B,X,'shape')说明:对于Y=filter2(B,X) ,filter2 使用矩阵B 中的二维FIR 滤波器对数据X 进行滤波,结果Y 是通过二维互相关计算出来的,其大小与X 一样;对于Y=filter2(B,X,'shape') ,filter2返回的Y 是通过二维互相关计算出来的,其大小由参数shape 确定,其取值如下:》full返回二维相关的全部结果,size(Y)>size(X);》same返回二维互相关结果的中间部分,Y 与X 大小相同;》valid返回在二维互相关过程中,未使用边缘补0 部分进行计算的结果部分,有size(Y)<size(X) 。
3.4 fspecial 函数功能:产生预定义滤波器格式:H=fspecial(type)H=fspecial('gaussian',n,sigma) 高斯低通滤波器H=fspecial('sobel') Sobel 水平边缘增强滤波器H=fspecial('prewitt') Prewitt 水平边缘增强滤波器H=fspecial('laplacian',alpha) 近似二维拉普拉斯运算滤波器H=fspecial('log',n,sigma) 高斯拉普拉斯(LoG)运算滤波器 H=fspecial('average',n) 均值滤波器H=fspecial('unsharp',alpha) 模糊对比增强滤波器说明:对于形式H=fspecial(type) ,fspecial 函数产生一个由type 指定的二维滤波器H ,返回的H 常与其它滤波器搭配使用。