Matlab 属于不同集合的两个像素之间的距离

Matlab 属于不同集合的两个像素之间的距离,matlab,distance,set,pixels,Matlab,Distance,Set,Pixels,如何找到属于两个不同集合的两个像素之间的距离?我想如果不是单个对象,pdist会这样做吗 谢谢。只需计算欧几里得距离: p1 % a 1x2 vector of the x y position of the first pixel p2 % a 1x2 vector of the x y position of the second pixel d = sqrt( ( p1(1)-p2(1) ).^2 + (p1(2)-p2(2)).^2 ); 你能定义你所说的“距离”和“集合”是什么意思吗

如何找到属于两个不同集合的两个像素之间的距离?我想如果不是单个对象,pdist会这样做吗


谢谢。

只需计算欧几里得距离:

p1 % a 1x2 vector of the x y position of the first pixel
p2 % a 1x2 vector of the x y position of the second pixel
d = sqrt( ( p1(1)-p2(1) ).^2 + (p1(2)-p2(2)).^2 );

你能定义你所说的“距离”和“集合”是什么意思吗?