?? 16-17.m
字號(hào):
bw = zeros(200,200); bw(50,50) = 1;
bw(50,150) = 1;bw(150,100) = 1;
% 初始化一個(gè)全0的200×200的數(shù)組
% 分別定義三個(gè)點(diǎn)值為1
D1 = bwdist(bw,'euclidean');
% 計(jì)算歐幾里得距離
D2 = bwdist(bw,'cityblock');
% 計(jì)算cityblock距離
D3 = bwdist(bw,'chessboard');
% 計(jì)算棋盤(pán)距離
D4 = bwdist(bw,'quasi-euclidean');
% 計(jì)算類(lèi)歐幾里得距離
subplot(2,2,1), subimage(mat2gray(D1)), title('Euclidean')
hold on, imcontour(D1)
subplot(2,2,2), subimage(mat2gray(D2)), title('City block')
hold on, imcontour(D2)
subplot(2,2,3), subimage(mat2gray(D3)), title('Chessboard')
hold on, imcontour(D3)
subplot(2,2,4), subimage(mat2gray(D4)), title('Quasi-Euclidean')
hold on, imcontour(D4)
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -