Ask Your Question

How to make my own feature detection method in opencv?

asked 2013-01-16 10:42:35 -0500

valgussev gravatar image

updated 2013-01-16 10:43:34 -0500

Let's take a look on this basic tutorial named Features2D + Homography to find a known object. It uses SurfFeatureDetector to detect features:

  SurfFeatureDetector detector( minHessian );
  std::vector<KeyPoint> keypoints_object, keypoints_scene;
  detector.detect( img_object, keypoints_object );
  detector.detect( img_scene, keypoints_scene );

Then it uses SurfDescriptorExtractor to calculate descriptors (feature vectors) using detected features.

My questions are:

if I want to create my own feature detector (for example with Trajkovic or Harris algorithms) which Descriptor Extractor shall I use? are the features, that were found in SurfFeatureDetector, just the common points or the areas of points?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-01-16 13:28:00 -0500

  1. Selection of DescriptorExtractor depends of detection algorithms and you need to select it by your self.

  2. OpenCV GoodFeaturesToTrackDetector already supports Harris algorithm as option. See docs for details.

  3. Trajkovic corner detector is not implemented in OpenCV. You can create your detector class inherited from common FeatureDetector class. Also you can contribute your code to OpenCV via Github.

  4. The feature is a common point on the image.

edit flag offensive delete link more


In this example the Surf algorithm of feature detection was used. I have made my own algorithm (Trajkovic) and it works great - all the corners (image features) are found. Then I try to use SurfDescriptorExtractor as it was used in example. The problem is that SurfDescriptorExtractor don't want to use my founded points in correct way (resulted picture appears with wrong connections, that means, that extractor didn't calculate the vectors correctly). So if detection works, the problem is in extractor or in FlannBasedMatcher am I right?

valgussev gravatar imagevalgussev ( 2013-01-17 09:58:30 -0500 )edit

answered 2013-01-28 11:35:55 -0500

valgussev gravatar image

updated 2013-01-28 11:36:55 -0500

I have added my project to Github could you please take a look on it and tell me what am I doing wrong?

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-01-16 10:42:35 -0500

Seen: 850 times

Last updated: Jan 28 '13