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