共计 2781 个字符,预计需要花费 7 分钟才能阅读完成。
文章和代码以及样例图片等相干资源,曾经归档至【Github 仓库:digital-image-processing-matlab】或者公众号【AIShareLab】回复 数字图像处理 也可获取。
11.bwselect
性能:在二进制图像中选择对象。语法:
BW2 = bwselect(BW1,c,r,n)
BW2 = bwselect(BW1,n)
[BW2,idx] = bwselect(...)
举例
BW1 = imread('text.tif');
c = [16 90 144];
r = [85 197 247];
BW2 = bwselect(BW1,c,r,4);
imshow(BW1)
figure, imshow(BW2)
相干命令:
bwfill, bwlabel, impixel, roipoly, roifill
12.cmpermute
性能:调整色彩映像表中的色彩。
语法:
[Y,newmap] = cmpermute(X,map)
[Y,newmap] = cmpermute(X,map,index)
举例
To order a colormap by luminance, use:
ntsc = rgb2ntsc(map);
[dum,index] = sort(ntsc(:,1));
[Y,newmap] = cmpermute(X,map,index);
相干命令:randperm
13.cmunique
性能:查找色彩映像表中特定的色彩及相应的图像。语法:
[Y,newmap] = cmunique(X,map)
[Y,newmap] = cmunique(RGB)
[Y,newmap] = cmunique(I)
相干命令:
gray2ind, rgb2ind
14.col2im
性能:将矩阵的列从新组织到块中。语法:
A = col2im(B,[m n],[mm nn],block_type)
A = col2im(B,[m n],[mm nn])
相干命令:
blkproc, colfilt, im2col, nlfilter
15.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],block_type,fun,...)
B = colfilt(A,'indexed',...)
相干命令:
blkproc, col2im, im2col, nlfilter
16.colorbar
性能:显示色彩条。语法:
colorbar('vert')
colorbar('horiz')
colorbar(h)
colorbar
h = colorbar(...)
举例
I = imread('blood1.tif');
h = fspecial('log');
I2 = filter2(h,I);
imshow(I2,[]), colormap(jet(64)), colorbar
17.conv2
性能:进行二维卷积操作。语法:
C = conv2(A,B)
C = conv2(hcol,hrow,A)
C = conv2(...,shape)
举例
A = magic(5)
A =
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9
B = [1 2 1;0 2 0;3 1 3]
B =
1 2 1
0 2 0
3 1 3
C = conv2(A,B)
C =
17 58 66 34 32 38 15
23 85 88 35 67 76 16
55 149 117 163 159 135 67
79 78 160 161 187 129 51
23 82 153 199 205 108 75
30 68 135 168 91 84 9
33 65 126 85 104 15 27
相干命令:
filter2
18.convmtx2
性能:计算二维卷积矩阵。语法:
T = convmtx2(H,m,n)
T = convmtx2(H,[m n])
相干命令:
conv2
19.convn
性能:计算 n 维卷积。
语法:
C = convn(A,B)
C = convn(A,B,shape)
相干命令:conv2
20.corr2
性能:计算两个矩阵的二维相关系数。
语法:
r = corr2(A,B)
相干命令:std2
21.dct2
性能:进行二维离散余弦变换。语法:
B = dct2(A)
B = dct2(A,m,n)
B = dct2(A,[m n])
举例
RGB = imread('autumn.tif');
I = rgb2gray(RGB);
J = dct2(I);
imshow(log(abs(J)),[]), colormap(jet(64)), colorbar
J(abs(J) < 10) = 0;
K = idct2(J)/255;
imshow(K)
相干命令:
fft2, idct2, ifft2
22.dctmtx
性能:计算离散余弦变换矩阵。
语法:
D = dctmtx(n)
相干命令:dct2
23.dilate
性能:放大二进制图像。语法:
BW2 = dilate(BW1,SE)
BW2 = dilate(BW1,SE,alg) BW2 = dilate(BW1,SE,...,n)
举例
BW1 = imread('text.tif');
SE = ones(6,2);
BW2 = dilate(BW1,SE);
imshow(BW1)
figure, imshow(BW2)
相干命令:
bwmorph, erode
24.dither
性能:通过抖动减少外观色彩分辨率,转换图像。
语法:
X = dither(RGB,map)
BW = dither(I)
相干命令:
rgb2ind
25.double
性能:转换数据为双精度型。
语法:
B = double(A)
举例
A = imread('saturn.tif');
B = sqrt(double(A));
相干命令:
im2double, im2uint, uint8
参考文献:
[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)