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

138 visualizaciones (últimos 30 días)
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 comentarios
Fernanda Rivera
Fernanda Rivera el 28 de Jun. de 2017
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 el 6 de Mzo. de 2019
how could I do to show the line of that distance with plot?
Thanks

Iniciar sesión para comentar.

Respuestas (1)

Oliver Woodford
Oliver Woodford el 15 de Feb. de 2012
p1 = [x; y];
p2 = [m; n];
d = norm(p1 - p2);

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by