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

6次阅读

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

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

37.fwind1

性能:用一维窗口办法设计二维 FIR 过滤器。
语法:

h = fwind1(Hd,win)
h = fwind1(Hd,win1,win2) 
h = fwind1(f1,f2,Hd,...) 

举例

[f1,f2] = freqspace(21,'meshgrid');
Hd = ones(21);
r = sqrt(f1.^2 + f2.^2); 
Hd((r<0.1)|(r>0.5)) = 0;
colormap(jet(64)) 
mesh(f1,f2,Hd)

相干命令:
conv2, filter2, fsamp2, freqspace, ftrans2, fwind2

38.fwind2

性能:用二维窗口办法设计二维 FIR 过滤器。
语法:

h = fwind2(Hd,win)
h = fwind2(f1,f2,Hd,win)

举例

[f1,f2] = freqspace(21,'meshgrid'); 
Hd = ones(21);
r = sqrt(f1.^2 + f2.^2); 
Hd((r<0.1)|(r>0.5)) = 0;
colormap(jet(64)) 
mesh(f1,f2,Hd)

相干命令:
conv2, filter2, fsamp2, freqspace, ftrans2, fwind1

39.getimage

性能:从坐标轴获得图像数据。
语法:

A = getimage(h) 
[x,y,A] = getimage(h)
[...,A,flag] = getimage(h) 
[...] = getimage

举例

imshow rice.tif I = getimage;

40.gray2ind

性能:转换灰度图像为索引图像。
语法:

[X,map] = gray2ind(I,n) 

相干命令:ind2gray

41.grayslice

性能:从灰度图像创立索引图像。
语法:

X = grayslice(I,n) 
X = grayslice(I,v) 

举例

I = imread('ngc4024m.tif');
X = grayslice(I,16); 
imshow(I)
figure, imshow(X,jet(16))

相干命令:gray2ind

42.histeq

性能:用柱状图均等化加强比照。
语法:

J = histeq(I,hgram) 
J = histeq(I,n) 
[J,T] = histeq(I,...) 

举例

I = imread('tire.tif');
J = histeq(I); 
imshow(I)
figure, imshow(J)

imhist(I,64)
figure; imhist(J,64)

相干命令:
brighten, imadjust, imhist

43.hsv2rgb

性能:转换 HSV 值为 RGB 色彩空间。
语法:

rgbmap = hsv2rgb(hsvmap) 
RGB = hsv2rgb(HSV)

相干命令:rgb2hsv, rgbplot

44.idct2

性能:计算二维离散反余弦变换。
语法:

B = idct2(A)
B = idct2(A,m,n) 
B = idct2(A,[m n])

相干命令:
dct2, dctmtx, fft2, ifft2

45.ifft2

性能:计算二维疾速傅里叶反变换。
语法:

B = ifft2(A)
B = ifft2(A,m,n)

相干命令:
fft2, fftshift, idct2

46.ifftn

性能:计算 n 维疾速傅里叶反变换。
语法:

B = ifftn(A)
B = ifftn(A,siz) 

相干命令:fft2, fftn, ifft2

47.sim2bw

性能:转换图像为二进制图像。
语法:

BW = im2bw(I,level)
BW = im2bw(X,map,level) 
BW = im2bw(RGB,level) 

举例

load trees
BW = im2bw(X,map,0.4);
imshow(X,map)
figure, imshow(BW)

相干命令:
ind2gray, rgb2gray

48.im2col

性能:重调图像块为列。语法:

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

相干命令:
blkproc, col2im, colfilt, nlfilter

49.im2double

性能:转换图像矩阵为双精度型。
语法:

I2 = im2double(I1)
RGB2 = im2double(RGB1) 
BW2 = im2double(BW1)
X2 = im2double(X1,'indexed')

相干命令:
double, im2uint8, uint8

50.im2uint8

性能:转换图像阵列为 8 位无符号整型。
语法:

I2 = im2uint8(I1)
RGB2 = im2uint8(RGB1) 
BW2 = im2uint8(BW1)
X2 = im2uint8(X1,'indexed')

相干命令:
im2uint16, double, im2double, uint8, imapprox, uint16

51.im2uint16

性能:转换图像阵列为 16 位无符号整型。
语法:

I2 = im2uint16(I1)
RGB2 = im2uint16(RGB1) 
X2 = im2uint16(X1,'indexed')

相干命令:
im2uint8, double, im2double, uint8, uint16, imapprox

52.imadjust

性能:调整图像灰度值或色彩映像表。
语法:

J = imadjust(I,[low high],[bottom top],gamma)
newmap = imadjust(map,[low high],[bottom top],gamma) 
RGB2 = imadjust(RGB1,...)

举例

I = imread('pout.tif');
J = imadjust(I,[0.3 0.7],[]); imshow(I)
figure, imshow(J)

相干命令:brighten, histeq

53.imapprox

性能:对索引图像进行近似解决。
语法:

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

相干命令:
cmunique, dither, rgb2ind

参考文献:

[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