The keypoint coordinates are extracted from the heatmap via:
|
xs, ys = np.where(heatmap >= self.conf_thresh) # Confidence threshold. |
|
if len(xs) == 0: |
|
return np.zeros((3, 0)), None, None |
|
pts = np.zeros((3, len(xs))) # Populate point data sized 3xN. |
|
pts[0, :] = ys |
|
pts[1, :] = xs |
|
pts[2, :] = heatmap[xs, ys] |
The indices returned by np.where, respectively np.nonzero are in order of the dimensions. In a NumPy array, the first dimension is along the rows (i.e. the y coordinates in an image), the second dimension is along the columns (i.e. the x coordinates in an image).
Hence, syntactically this should be:
ys, xs = np.where(heatmap >= self.conf_thresh) # Confidence threshold.
# [...]
pts[0, :] = xs
pts[1, :] = ys
pts[2, :] = heatmap[ys, xs]
The actual variable name does not matter later, as those values are correctly normalised.
The keypoint coordinates are extracted from the heatmap via:
SuperPointPretrainedNetwork/demo_superpoint.py
Lines 251 to 257 in 1fda796
The indices returned by
np.where, respectivelynp.nonzeroare in order of the dimensions. In a NumPy array, the first dimension is along the rows (i.e. theycoordinates in an image), the second dimension is along the columns (i.e. thexcoordinates in an image).Hence, syntactically this should be:
The actual variable name does not matter later, as those values are correctly normalised.