summarylogtreecommitdiffstats
path: root/opencv3.patch
blob: 3447540e75bcf20ae3648ba1378c346ffe58c81f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
diff --git a/src/camera/pfsalign.cpp b/src/camera/pfsalign.cpp
index 12c7642..91c97ab 100644
--- a/src/camera/pfsalign.cpp
+++ b/src/camera/pfsalign.cpp
@@ -43,7 +43,8 @@
 #include <opencv2/core/core.hpp>
 #include <opencv2/highgui/highgui.hpp>
 #include <opencv2/features2d/features2d.hpp>
-#include <opencv2/nonfree/features2d.hpp>
+#include <opencv2/features2d.hpp>
+#include <opencv2/xfeatures2d/nonfree.hpp>
 #include <opencv2/calib3d/calib3d.hpp>
 #include <opencv2/imgproc/imgproc.hpp>
 #include <libexif/exif-data.h>
@@ -61,6 +62,7 @@ class QuietException
 
 using namespace cv;
 using namespace std;
+using namespace cv::xfeatures2d;
 
 void printHelp()
 {
@@ -141,8 +143,12 @@ bool alignImagePair( const Mat &ref_img, const Mat &exp_img, Mat &homography, in
     //    cv::imshow( "Result2", exp_img );
     //    cv::waitKey(0);
 
-    Ptr<FeatureDetector> detector(new DynamicAdaptedFeatureDetector( new SurfAdjuster( (11-sensitivity) * 100.f, 2, 1000 ),
-                                                                     100, 1000, sensitivity/2+2 ));
+    //Ptr<FeatureDetector> detector(new DynamicAdaptedFeatureDetector( new SurfAdjuster( (11-sensitivity) * 100.f, 2, 1000 ),
+    //                                                                 100, 1000, sensitivity/2+2 ));
+    
+//        SiftDescriptorExtractor surfDesc;
+    Ptr<SURF> surfDesc = SURF::create();
+
 //    Ptr<FeatureDetector> detector;
     //    detector = new GoodFeaturesToTrackDetector();
 //    detector = new SurfFeatureDetector();
@@ -150,8 +156,8 @@ bool alignImagePair( const Mat &ref_img, const Mat &exp_img, Mat &homography, in
     std::vector<KeyPoint> keypoints1, keypoints2;
 
     toc.tic( "feature detection" );
-    detector->detect( ref_img, keypoints1 );
-    detector->detect( exp_img, keypoints2 );
+    surfDesc->detect( ref_img, keypoints1 );
+    surfDesc->detect( exp_img, keypoints2 );
     toc.toc( );
 
     if( keypoints1.size() < 10 || keypoints2.size() < 10 ) {
@@ -171,13 +177,11 @@ bool alignImagePair( const Mat &ref_img, const Mat &exp_img, Mat &homography, in
         return false;
     }
 
-    //        SiftDescriptorExtractor surfDesc;
-    SurfDescriptorExtractor surfDesc;
 
     Mat descr_ref, descr_exp;
     toc.tic( "descriptor extraction" );
-    surfDesc.compute( ref_img, keypoints1, descr_ref );
-    surfDesc.compute( exp_img, keypoints2, descr_exp );
+    surfDesc->compute( ref_img, keypoints1, descr_ref );
+    surfDesc->compute( exp_img, keypoints2, descr_exp );
     toc.toc( );
 
     FlannBasedMatcher matcher;