Commit f4df732b authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

Merge pull request #200 from alfonsosanchezbeato/fix-sample-reg

Adapt reg sample to changes in features detectors
parents f822984a 97cf5ade
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment