def _find_in_image(self, image, n_max):
"""
Calculate keypoints from a image
Using cv2.goodFeaturesToTrack to find good points
@param: image: np.ndarray
@return: a list
Cowards use this. The brave use '_key_points' which starts from scratch
"""
rows, cols = image.shape
kp = cv2.goodFeaturesToTrack(image, n_max, 0.01, 10, 3)
# assert kp.shape = (<number of keypoints>, 1, 2)
if kp is None:
return []
return [list(i) for i in kp.reshape(-1, 2)[:, ::-1].astype(np.int)]
评论列表
文章目录