Adapt reg sample to changes in features detectors

Adapt to changes in the interface of feature detectors, using now
Feature2D interface.
pull/200/head
Alfonso Sanchez-Beato 10 years ago
parent ca7c573ebe
commit 97cf5ade02
  1. 19
      modules/reg/samples/map_test.cpp

@ -289,23 +289,25 @@ static void calcHomographyFeature(const Mat& image1, const Mat& image2)
else
image2.copyTo(gray_image2);
//-- Step 1: Detect the keypoints using SURF Detector
//-- Step 1: Detect the keypoints using SIFT or SURF Detector
#ifdef USE_SIFT
Ptr<Feature2D> features = SIFT::create();
#else
int minHessian = 400;
SurfFeatureDetector detector(minHessian);
Ptr<Feature2D> features = SURF::create(minHessian);
#endif
std::vector<KeyPoint> keypoints_object, keypoints_scene;
detector.detect(gray_image1, keypoints_object);
detector.detect(gray_image2, keypoints_scene);
features->detect(gray_image1, keypoints_object);
features->detect(gray_image2, keypoints_scene);
//-- Step 2: Calculate descriptors (feature vectors)
SurfDescriptorExtractor extractor;
Mat descriptors_object, descriptors_scene;
extractor.compute(gray_image1, keypoints_object, descriptors_object);
extractor.compute(gray_image2, keypoints_scene, descriptors_scene);
features->compute(gray_image1, keypoints_object, descriptors_object);
features->compute(gray_image2, keypoints_scene, descriptors_scene);
//-- Step 3: Matching descriptor vectors using FLANN matcher
FlannBasedMatcher matcher;
@ -431,4 +433,3 @@ int main(void)
return 0;
}

Loading…
Cancel
Save