- 我如何知道特征数量是否足以满足图像的需求?
这必须取决于你的形象,你的任务要求。你应该比别人更了解,或者做实验来弄清楚。
- 有什么方法可以控制特征的数量?
当然。创建时,只需传递必要的参数即可。
cv2.xfeatures2d.SIFT_create([, nfeatures[, nOctaveLayers[, contrastThreshold[, edgeThreshold[, sigma]]]]]) -> retval
| . @param nfeatures The number of best features to retain. The features are ranked by their scores
| . (measured in SIFT algorithm as the local contrast)
| .
| . @param nOctaveLayers The number of layers in each octave. 3 is the value used in D. Lowe paper.
| . The number of octaves is computed automatically from the image resolution.
| .
| . @param contrastThreshold The contrast threshold used to filter out weak features in semi-uniform
| . (low-contrast) regions. The larger the threshold, the less features are produced by the detector.
| .
| . @param edgeThreshold The threshold used to filter out edge-like features. Note that the its meaning
| . is different from the contrastThreshold, i.e. the larger the edgeThreshold, the less features are
| . filtered out (more features are retained).
| .
| . @param sigma The sigma of the Gaussian applied to the input image at the octave \#0. If your image
| . is captured with a weak camera with soft lenses, you might want to reduce the number.
|
例如,我创建了一个具有 50 个关键点和 3 层的筛选检测器:
sift = cv2.xfeatures2d.SIFT_create(nfeatures = 50, nOctaveLayers=3)
这是检测结果:
- 太长了。我知道您在 OpenCV-Python 中将大量关键点和描述符存储为 .yml 格式。
好的,当您需要存储大量数据时,.yml 真的有帮助吗?真的合理吗?你真的需要keypoint (points2f, size, response, octave, class_id) 的每一个元素吗?至于描述符,它是一个直方图,或者一个 int 数组。所以即使你把它保存为int,这个值也是可以的。