how to find distance between two points in an image

39 ビュー (過去 30 日間)
sindhu c
sindhu c 2016 年 1 月 16 日
コメント済み: Walter Roberson 2018 年 3 月 29 日
hello! i have an image something like this.
how to obtain the distance between the dot above i and the line in i? the image of i is attached below.
please help me with the code... thank you!


harjeet singh
harjeet singh 2016 年 1 月 16 日
try to use this
hold on
D = pdist2([r c],[r1 c1],'euclidean'); % euclidean distance
point_1=[r(r2) c(r2)];
point_2=[r1(c2) c1(c2)];
plot([point_1(2) point_2(2)],[point_1(1) point_2(1)],'r')
hold off
distance=sqrt( (point_1(1)-point_2(1)).^2 + (point_1(2)-point_2(2)).^2)
distance =
  7 件のコメント
Walter Roberson
Walter Roberson 2018 年 3 月 29 日
The distance unit is pixels.


その他の回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 1 月 16 日
  1 件のコメント
sindhu c
sindhu c 2016 年 1 月 16 日
thank you sir! in both of the above links we need to know column and row vectors, how to find the position vectors for dot and line in the above image attached?


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by