PyImageSearch / imutils

A series of convenience functions to make basic image processing operations such as translation, rotation, resizing, skeletonization, and displaying Matplotlib images easier with OpenCV and Python.
MIT License
4.54k stars 1.03k forks source link

scipy.spatial is not necessary for Euclidean distance #175

Open rgov opened 4 years ago

rgov commented 4 years ago

In perspective.py:

from scipy.spatial import distance as dist
...
D = dist.cdist(tl[np.newaxis], rightMost, "euclidean")[0]

You ought to be able to do this without importing SciPy, something like:

D = np.linalg.norm(rightMost - tl, ord=2, axis=1)