关于图像处理:Matlab常用图像处理命令108例六

77次阅读

共计 3158 个字符,预计需要花费 8 分钟才能阅读完成。

文章和代码以及样例图片等相干资源,曾经归档至【Github 仓库:digital-image-processing-matlab】或者公众号【AIShareLab】回复 数字图像处理 也可获取。

66.imshow

性能:显示图像。
语法:

imshow(I,n) 
imshow(I,[low high]) 
imshow(BW) 
imshow(X,map) 
imshow(RGB)
imshow(...,display_option) 
imshow(x,y,A,...)
imshow filename 
h = imshow(...) 

相干命令:
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)

相干命令:
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

性能:进行反 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

性能:判断是否为索引图像。
语法:

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
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

性能:进行二维中值过滤。
语法:

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)

相干命令:

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) 
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

参考文献:

[1] Rafael C. Gonzalez, Richard E. Woods, and Steven L. Eddins. 2003. Digital Image Processing Using MATLAB. Prentice-Hall, Inc., USA.

[2] [阮秋琦. 数字图像处理(MATLAB 版)[M]. 北京:电子工业出版社, 2014.](https://github.com/timerring/digital-image-processing-matlab/blob/main/reference/Digital_Image_Processing_(MATLAB_version).pdf)

[3] [冈萨雷斯. 数字图像处理(第三版)[M]. 北京:电子工业出版社, 2011.](https://github.com/timerring/digital-image-processing-matlab/blob/main/reference/Digital_Image_Processing_(Third_Edition).pdf)

正文完
 0