Find the euclidean distance
조회 수: 2 (최근 30일)
이전 댓글 표시
I want to find the euclidean distance of 1 specific feature in one image.Then the corresponding feature in the second image. How to find the euclidean distance of these two points? Any suggestions.
댓글 수: 0
채택된 답변
Image Analyst
2014년 12월 3일
I wouldn't use ginput() or pdist(). I'd use the function improfile() in the Image Processing Toolbox. It's a lot easier to use than imdistline(). Here's a snippet:
% Display sample image.
grayImage = imread('moon.tif');
imshow(grayImage);
title('Left click, then right click');
% Have user draw the line.
[x, y, grayLevels] = improfile();
% Re-Draw the line in the overlay (which normally vanishes)
line([x(1), x(end)], [y(1), y(end)]);
% Compute the distance between the endpoints.
dist = sqrt((x(end)-x(1))^2 + (y(end)-y(1))^2)
댓글 수: 4
Image Analyst
2014년 12월 3일
It will still work, as is. You might want to rename variables to make them more accurately descriptive, like rgbImage instead of grayImage.
추가 답변 (1개)
Deepesh B
2014년 12월 2일
use
dist_out = pdist(feature_array,'euclidean');
if u want to use b/w 2 images use this
dist_out = pdist2(i1, i2,'euclidean')
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!