Extract less key with opencv

I need to make object recognition in real time (with the image coming from the usb camcorder)

Is there anyway to say

SurfFeatureDetector.detect(); 

to extract fewer key points?

+4
source share
2 answers

Here is the constructor for SurfFeatureDetector . Using the constructor, you can reduce the number of key points with 3 main arguments:

  • hessianThreshold : increase this
  • octaves : reduce it
  • octavelayers : reduce it

I don’t know the details of the SURF implementation, but this SO answer points to the documentation that explains the whole algorithm so you can choose how to change them.

As an alternative to studying the implementation, I directly found Find-Object to be very useful for experimenting with many of the algorithm tuning detection functions.

+2
source

By changing the threshold, you can somehow control the number of key points. In any case, this does not directly control the maximum number of key points.

If you want it to stop maximum, you will have to go to the algorithm in .cpp (which is not debugging) and set the condition in a loop. I did this with some algortihms in OpenCV to get computational efficiency. The problem is that you will need to copy the code and paste it into your own class in order to be able to change, and this gives some binding problems until you get everything right. D

+4
source

All Articles