我需要你的帮助。我必须计算点之间的距离来定义最短对,为了实现它,我使用了 scipy.spatial.distance.pdist (我的轮廓点很复杂,z=x+1j*y)
last_points = np.array([contour.last_point_on_contour() for contour in reached])
print last_points
last_points_2d=np.array([last_points.real, last_points.imag])
dm = pdist(last_points_2d, 'euclidean')
并采取跟随错误
ValueError: A 2-dimensional array must be passed.
最后的点是(点的坐标)
[-501.54525930+9.54332241j -496.00082683+7.88953715j
-494.40471685+2.72497522j -492.63174757-1.58916156j
-494.39724167-6.69815202j -499.57661541-9.11793037j]
我将不胜感激。谢谢