LATCHFeature.distance#
- LATCHFeature.distance(other: BaseFeature2D, metric: str = 'L2') ndarray#
Distance between feature sets
- Parameters:
other (
BaseFeature2D) – second set of featuresmetric (str, optional) – feature distance metric, one of “ncc”, “L1”, “L2” [default]
- Returns:
distance between features
- Return type:
ndarray(N1, N2)
Compute the distance matrix between two sets of feature. If the first set of features has length N1 and the
otheris of length N2, then compute an \(N_1 imes N_2\) matrix where element \(D_{ij}\) is the distance between feature \(i\) in the first set and feature \(j\) in the other set. The position of the closest match in row \(i\) is the best matching feature to feature \(i\).Example:
>>> from machinevisiontoolbox import Image >>> orb1 = Image.Read("eiffel-1.png").ORB() >>> orb2 = Image.Read("eiffel-2.png").ORB() >>> dist = orb1.distance(orb2) >>> dist.shape (500, 500)
Note
The matrix is symmetric.
For the metric “L1” and “L2” the best match is the smallest distance
For the metric “ncc” the best match is the largest distance. A value over 0.8 is often considered to be a good match.
- Seealso: