how to find cityblock distance?
조회 수: 5 (최근 30일)
이전 댓글 표시
how to find the city block distance between feature vectors to query image feature vector, in matlab2013?
댓글 수: 0
답변 (3개)
Fowzi barznji
2020년 3월 16일
x=[1 3 9 6 4 2 6 8 3 6];
y=[4 -2 6 8 8 3 7 2 1 1];
cityblockvalue = sum((abs(x - y)));
cityblockvalue= 32
댓글 수: 7
DGM
2023년 1월 10일
b is not a vector. It depends what the relationship between a and b is.
Assuming that a is a row vector and applies in whole to each row of b in the same way, then the distance for each row is:
x = [1 2 3];
y = [4 5 6; % i made this 4x3 so that it's easy to see the orientation
7 8 9;
10 11 12;
13 14 15];
D = pdist2(x,y,'cityblock').'
D = sum((abs(x - y)),2) % works R2016b+
참고 항목
카테고리
Help Center 및 File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!