필터 지우기
필터 지우기

How to find the linear distance between two points say (x,y) and (m,n) on an image?

조회 수: 89 (최근 30일)
Hi..How can we find the linear distance between any two points on an image?Can we do this using any inbuilt function??or can this be done in any other way??plz help..
  댓글 수: 2
Fernanda Rivera
Fernanda Rivera 2017년 6월 28일
You can use the function pdist2 such as:
value=pdist2([x m],[y n],'euclidean'); %obtaining euclidean distance
Also if it works better for you, you can develop the formula:
value=sqrt((x-m)^2 + (y-n)^2); %euclidean distance.
María Peñas Leonor
María Peñas Leonor 2019년 3월 6일
how could I do to show the line of that distance with plot?
Thanks

댓글을 달려면 로그인하십시오.

답변 (1개)

Oliver Woodford
Oliver Woodford 2012년 2월 15일
p1 = [x; y];
p2 = [m; n];
d = norm(p1 - p2);

카테고리

Help CenterFile 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!

Translated by