3

i am working on an iphone project which uses openCV for some image matching. Initially I was using cvMatchTemplate(), but the output is not what we expected. so I am now trying to implement SURF detector using FLANN.

I tried to port the following .cpp code to objective C,

//-- Step 2: Calculate descriptors (feature vectors)
  SurfDescriptorExtractor extractor;

  Mat descriptors_1, descriptors_2;

  extractor.compute( img_1, keypoints_1, descriptors_1 );
  extractor.compute( img_2, keypoints_2, descriptors_2 );

  //-- Step 3: Matching descriptor vectors using FLANN matcher
  FlannBasedMatcher matcher;
  std::vector< DMatch > matches;
  matcher.match( descriptors_1, descriptors_2, matches );

But couldn't get it compiled, even though I have all the required libraries and header files included. The auto-complete is also not giving options for the any detectors present in

#include "opencv2/features2d/features2d.hpp"

The detector is defined in the header file as

class CV_EXPORTS FeatureDetector
{
...
}

What am I doing wrong here? Any input on how to call methods in the detector class(Abstract base class)?

Nithin
  • 6,435
  • 5
  • 43
  • 56
Nandakumar R
  • 1,404
  • 11
  • 17

1 Answers1

1

I've not used openCV on the iphone specifically so can't help there, but when I've used feature detector/descriptor/matcher I've used the following syntax (which may end up being the same as what you've written...):

cv::Ptr<cv::DescriptorExtractor> extractor;
extractor = cv::DescriptorExtractor::create("SURF");

cv::Ptr<cv::DescriptorMatcher> matcher;
matcher = cv::DescriptorMatcher::create("FlannBased");

Does that style work for you?

Chris
  • 8,030
  • 4
  • 37
  • 56
  • Just noticed you were trying to port the above code to objective C: I have no experience of that so cannot help you. Sorry! – Chris Nov 14 '11 at 14:21