Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

DenseFeatureDetector: Only a certain number of points?

I'm using DenseFeatureDetector and want to return only a certain number of keypoints (or as close to that amount as possible). I know I can tweak the parameters listed in the documentation (http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_feature_detectors.html) and try to calculate how many keypoints will be generated, but I was wondering if there's a simpler way.

With the other feature detectors (SIFT, FAST etc) I can sort based on the response and only save the n best features. Since the DenseFeatureDetector only lays out the keypoints in a gridlike fashion, the points don't have a "response" value AFAIK.

I could just take the first n features, but that would probably only cover the first portion of the page. Better would be to save every k keypoint so that it is still in a gridlike fashion but just more sparsely laid out.

tl; dr: What's the best way to return only n features when using DenseFeatureDetector?