Ask Your Question

Limiting the no. of keypoints detected by detector created by FeatureDetector

asked 2014-12-02 07:44:04 -0500

bad_keypoints gravatar image

Is there any way I can limit the no. of keypoints detected by a detector I created using the FeatureDetector interface in OpenCV's C++ SDK? I see the function, it has no other param besides the string that's to be passed. But I do need to limit the no. of keypoints the detector detects.

I'm using it for BRISK, and I need to limit the max. no. of keypoints the detector detects in an image, preferably detecting the N best keypoints.

I'm not using cv::BRISK because it's broken, (saw in an issue), and thus I've been using the one which can be instantiated from the FeatureDetector interface, which works great.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-12-02 13:43:22 -0500


In 2.4.9, you can still use the Algorithm::set function to change the value of parameters... In your case, you can adjust the "thres" parameter to reduce the number of detected points:

 cv::Ptr<FeatureDetector> detect = FeatureDetector::create("BRISK");
 detect->set("thres", 50);//default value is 30

But in Opencv3, you will have to use the parameters of the BRISK class...

edit flag offensive delete link more

answered 2014-12-02 15:27:44 -0500

Doombot gravatar image

Personally, I am using BRISK and have no problem. Still, there is a threshold parameter that influence the number of keypoint retrieved. If you really want a specific number of keypoint, you must iterate this threshold until you detect the required number of keypoint. I think I have read this in the BRISK paper, but I am not sure and can't access it right now...

This said, I think that you should consider a different approach. Since you don't really specify why you want to limit the number of keypoint, I assume that it is because you are getting too much keypoint of low interest (if I am wrong, then it will be of use for someone else I assume).

First, you could simply filter the detected keypoints by keeping say 80% of the keypoints with the highest intensity. But this is arbitrary and you don't know if 80% will get you the correct keypoints. You better wait until you match to keep only the best matches.

The idea that when you match the keypoints between two images, you have to filter the matches to eliminate the ones that are seemingly superfluous. There are a number of ways to do it, and one is to use the ratio test proposed by [Lowe].(

Then, you will have less keypoint/matches to work with. The shortcoming is that you still need to compute more keypoints to be able to reject them instead of never computing them in the first place. But when you think about it (if you have read the BRISK paper or similar binary keypoint descriptor), it seems impossible to know beforehand which keypoints are going to be the best if you don't compare them between themselves.

edit flag offensive delete link more

Question Tools


Asked: 2014-12-02 07:44:04 -0500

Seen: 1,815 times

Last updated: Dec 02 '14