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)
相关命令:
rand
61.impixel
功能:确定像素颜色值.
语法:
MATLAB高级应用——图形及影像处理 348
P = 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 101
253 240 0
237 37 44
相关命令:
improfile, pixval
62.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)
附录 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, pixval
63.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,uint16
64.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, imresize
66.imshow
功能:显示图像.
语法:
附录 MATLAB图像处理命令 351
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(...)
相关命令:
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, imread
68.ind2gray
功能:把检索图像转化为灰度图像.
语法:
I = ind2gray(X,map)
举例
load trees
I = ind2gray(X,map);
imshow(X,map)
figure,imshow(I)
MATLAB高级应用——图形及影像处理 352
相关命令:
gray2ind, imshow, rgb2ntsc
69.ind2rgb
功能:转化索引图像为RGB真彩图像.
语法:
RGB = ind2rgb(X,map)
相关命令:
ind2gray, rgb2ind
70.iptgetpref
功能:获取图像处理工具箱参数设置.
语法:
value = iptgetpref(prefname)
举例
value = iptgetpref('ImshowAxesVisible')
value =
off
相关命令:
imshow, iptsetpref
71.iptsetpref
功能:设置图像处理工具箱参数.
语法:
iptsetpref(prefname,value)
举例
iptsetpref('ImshowBorder','tight')
相关命令:
imshow, iptgetpref, truesize
72.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, phantom
73.isbw
功能:判断是否为二进制图像.
语法:
flag = isbw(A)
相关命令:
isind, isgray, isrgb
74.isgray
功能:判断是否为灰度图像.
语法:
flag = isgray(A)
相关命令:
isbw, isind, isrgb
75.isind
MATLAB高级应用——图形及影像处理 354
功能:判断是否为索引图像.
语法:
flag = isind(A)
相关命令:
isbw, isgray, isrgb
76.isrgb
功能:判读是否为RGB真彩图像.
语法:
flag = isrgb(A)
相关命令:
isbw, isgray, isind
77.makelut
功能:创建一个用于applylut函数的lookup表.
语法:
lut = makelut(fun,n)
lut = makelut(fun,n,P1,P2,...)
举例
f = inline('sum(x(:)) >= 2');
lut = makelut(f,2)
lut =
0
0
0
1
0
1
1
1
0
1
1
1
1
1
附录 MATLAB图像处理命令 355
1
1
相关命令:
applylut
78.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)
相关命令:
gray2ind
79.mean2
功能:计算矩阵元素的平均值.
语法:
b = mean2(A)
相关命令:
std2, mean, std
80.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, wiener2
81.montage
功能:在矩形框中同时显示多幅图像.
语法:
montage(I)
montage(BW)
montage(X,map)
montage(RGB)
h = montage(...)
举例
load mri
montage(D,map)
附录 MATLAB图像处理命令 357
相关命令:
immovie
82.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, colfilt
83.ntsc2rgb
功能: 转换NTSC的值为RGB颜色空间.
语法:
rgbmap = ntsc2rgb(yiqmap)
RGB = ntsc2rgb(YIQ)
相关命令:
rgb2ntsc, rgb2ind, ind2rgb, ind2gray
84.ordfilt2
功能:进行二维统计顺序过滤.
语法:
B = ordfilt2(A,order,domain)
B = ordfilt2(A,order,domain,S)
MATLAB高级应用——图形及影像处理 358
B = ordfilt2(...,padopt)
相关命令:
medfilt2
85.phantom
功能:产生一个头部幻影图像.
语法:
P = phantom(def,n)
P = phantom(E,n)
[P,E] = phantom(...)
举例
P = phantom('Modified Shepp-Logan',200);
imshow(P)
相关命令:
radon, iradon
86.pixval
功能:显示图像像素信息.
语法:
pixval on
pixval off
pixval
pixval(fig,option)
相关命令:
impixel, improfile
87.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 6
1 1 2 1 4 5 6 8
1 1 1 1 10 15 7 7
1 1 1 1 20 25 7 7
20 22 20 22 1 2 3 4
20 22 22 20 5 6 7 8
20 22 20 20 9 10 11 12
22 22 20 20 13 14 15 16];
S = qtdecomp(I,5);
full(S)
ans =
4 0 0 0 2 0 2 0
0 0 0 0 0 0 0 0
0 0 0 0 1 1 2 0
0 0 0 0 1 1 0 0
4 0 0 0 2 0 2 0
0 0 0 0 0 0 0 0
0 0 0 0 2 0 2 0
0 0 0 0 0 0 0 0
相关命令:
qtgetblk, qtsetblk
88.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 1
1 1 2 1
1 1 1 1
1 1 1 1
vals(:,:,2) =
20 22 20 22
20 22 22 20
20 22 20 20
22 22 20 20
r =
1
5
c =
1
1
相关命令:
qtdecomp, qtsetblk
89.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 6
0 0 0 0 4 5 6 8
0 0 0 0 10 15 7 7
附录 MATLAB图像处理命令 361
0 0 0 0 20 25 7 7
1 1 1 1 1 2 3 4
1 1 1 1 5 6 7 8
1 1 1 1 9 10 11 12
1 1 1 1 13 14 15 16
相关命令:
qtdecomp, qtgetblk
90.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, phantom
91.rgb2gray
功能: 转换RGB图像或颜色映像表为灰度图像.
语法:
I = rgb2gray(RGB)
newmap = rgb2gray(map)
相关命令:
MATLAB高级应用——图形及影像处理 362
ind2gray, ntsc2rgb, rgb2ind, rgb2ntsc
92.rgb2hsv
功能: 转化RGB值为HSV颜色空间.
语法:
hsvmap = rgb2hsv(rgbmap)
HSV = rgb2hsv(RGB)
相关命令:
hsv2rgb, rgbplot
93.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, ind2gray
95.rgb2ycbcr
功能: 转化RGB的值为YcbCr颜色空间.
语法:
ycbcrmap = rgb2ycbcr(rgbmap)
YCBCR = rgb2ycbcr(RGB)
相关命令:
ntsc2rgb, rgb2ntsc, ycbcr2rgb
96.rgbplot
功能:划分颜色映像表.
语法:
rgbplot(map)
举例
rgbplot(jet)
相关命令:
colormap
97.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, roipoly
98.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, roipoly
99.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, roipoly
100.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, roifill
101.std2
功能:计算矩阵元素的标准偏移.
语法:
b = std2(A)
相关命令:
corr2, mean2
102.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图像处理命令 367
103.truesize
功能:调整图像显示尺寸.
语法:
truesize(fig,[mrows mcols])
truesize(fig)
相关命令:
imshow, iptsetpref, iptgetpref
104.uint8
功能:转换数据为8位无符号整型.
语法:
B = uint8(A)
举例
a = [1 3 5];
b = uint8(a);
whos
Name Size Bytes Class
a 1x3 24 doublearray
b 1x3 3 uint8 array
相关命令:
double, im2double, im2uint8
105.uint16
功能:转换数据为16位无符号整型.
语法:
I = uint16(X)
MATLAB高级应用——图形及影像处理 368
举例
a = [1 3 5];
b = uint16(a);
whos
Name Size Bytes Class
a 1x3 24 double array
b 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, medfilt2
108.ycbcr2rgb
功能: 转化YcbCr值为RGB颜色空间.
语法:
rgbmap = ycbcr2rgb(ycbcrmap)
RGB = ycbcr2rgb(YCBCR)
相关命令:
ntsc2rgb, rgb2ntsc, rgb2ycbcr
109.zoom
功能:缩放图像.
语法:
zoom on
zoom off
zoom out
MATLAB高级应用——图形及影像处理 370
zoom reset
zoom
zoom xon
zoom yon
zoom(factor)
zoom(fig,option)
相关命令:
imcrop
MATLAB图像处理函数汇总(二)的更多相关文章
- MATLAB图像处理函数汇总(一)
1.applylut功能: 在二进制图像中利用lookup表进行边沿操作.语法:A = applylut(BW,lut)举例lut = makelut('sum(x(:)) == 4',2);BW1 ...
- Matlab图像处理函数:regionprops
本篇文章为转载,仅为方便学术讨论所用,不用于商业用途.由于时间较久,原作者以及原始链接暂时无法找到,如有侵权以及其他任何事宜欢迎跟我联系,如有侵扰,在此提前表示歉意.----------------- ...
- matlab 常用函数汇总
1. 特殊变量与常数 主题词 意义 主题词 意义 ans 计算结果的变量名 computer 确定运行的计算机 eps 浮点相对精度 Inf 无穷大 I 虚数单位 inputname 输入参数名 Na ...
- Matlab图像处理入门
1. Matlab基础 1.1 数据格式 Matlab默认的数据格式为双精度浮点数的矩阵或数组,同时支持其它数据类型.Matlab将单变量看作1´1的数组.Matlab支持的数据类型如下: 索 ...
- MATLAB图像处理基础
MATLAB图像处理基础 2.2.1 图像文件格式及图像类型 1.MATLAB支持的几种图像文件格式: ⑴JPEG(Joint Photogyaphic Expeyts Group):一种称为联合图像 ...
- matlab图像处理
matlab图像处理 转自:http://www.cnblogs.com/lovebay/p/5094146.html 1. 图像和图像数据 缺省情况下,MATLAB将图像中的数据存储为双精度类型(d ...
- Matlab图像处理系列1———线性变换和直方图均衡
注:本系列来自于图像处理课程实验,用Matlab实现最主要的图像处理算法 图像点处理是图像处理系列的基础,主要用于让我们熟悉Matlab图像处理的编程环境.灰度线性变换和灰度拉伸是对像素灰度值的变换操 ...
- Matlab中插值函数汇总(上)
Matlab中插值函数汇总分上下两个部分,主要整合自matlabsky论坛dynamic发表于2009-2-21 21:53:26 的主题帖,以及豆丁网rickoon上传的教材第8章<插值,拟合 ...
- Matlab图像处理(01)-Matlab基础
枫竹梦对于Matlab几乎是零基础,只是在上学的时候稍稍接触一点,万万没有想到现在还能用到Matlab.进入正题>>> 图像的基本概念 一幅图像可以被定义为一个二维函数f(x,y), ...
随机推荐
- MYSQL 编码方式 ------导入 .sql 文件 报编码错误
在做计量泵上位机时,利用MYSQL存储数据,建表hisruninfo(计量泵历史运行数据表). 表格式为utf8,查过数据库 格式 同样为utf8 导入该hisruninfo.sql文件时,并没有报错 ...
- 闹钟--alarmManager
1.AlarmManager,顾名思义,就是“提醒”,是Android中 常用的一种系统级别的提示服务,在特定的时刻为我们广播一个指定的Intent.简单的说就是我们设定一个时间,然后在该时间到来 时 ...
- opencl初探-sobel检测
sobel检测的C版本,neon和GPU的时间比较. Platform: LG G3, Adreno 330 ,img size 3264x2448 sobel: C code neon GPU 73 ...
- Windows7隐藏字体
今天突然发现字体Times New Roman消失了,如下图所示: 图1.1 不仅仅Times New Roman,还有System.MS Sans Serif--这些熟悉的字体都消失了,不能选用了! ...
- 如何理解和熟练使用JS 中的call apply
有时候看一两个关于apply或call的小例子,感觉能够理解一点点但是下次碰到又要纠结半天才能转过弯来-而且不知道怎么应用到实际工作当中去- call 和 apply 都是为了改变某个函数运行时的 c ...
- 青少年如何使用 Python 开始游戏开发
这是一篇由教程团队成员Julian Meyer发表的文章,一个12岁的python开发人员.你可以在Google+和Twitter上找到他. 你可曾想过如何创建视频游戏吗?它不像你想象的那么复杂! 在 ...
- Compound Interest Calculator2.0
Compound Interest Calculator2.0 1.如果按照单利计算,本息又是多少呢? 2.假如30年之后要筹措到300万元的养老金,平均的年回报率是3%,那么,现在必须投入的本金是多 ...
- (32)odoo中的编码问题
对于全部是英文就不存在问题,但我们常用中文,这样会导致一个棘手的问题 约定: 系统Ubuntu trusty14.04 自带python2.7.6 python2.7.9 自己升级了 升级方法: -- ...
- 解决li在ie,firefox中行高不一致问题
转载 http://www.cnblogs.com/jikey/archive/2011/11/13/2247543.html li在ie与firefox的高度是不一样的,解决办法是li font-s ...
- JSON Viewer
http://jsonviewer.codeplex.com/ jsoneditor https://github.com/josdejong/jsoneditor