Ask Your Question
0

Image Registration (OpenCV 3.0.0)

asked 2015-02-14 09:04:13 -0600

Potato gravatar image

I have been trying to run the sample code given in the opencv_contrib repo --> https://github.com/Itseez/opencv_cont...

It is the image registration module. I am compiling the map_test.cpp program. -->https://github.com/Itseez/opencv_contrib/blob/master/modules/reg/samples/map_test.cpp

Now, the code compiles the first time. However, when you #define COMPARE_FEATURES to compare feature based vs. pixel based registration, the program doesn't compile and gives these errors

map_test.cpp: In function ‘void calcHomographyFeature(const cv::Mat&, const cv::Mat&)’:
map_test.cpp:299:41: error: no matching function for call to ‘cv::xfeatures2d::SURF::SURF(int&)’
map_test.cpp:299:41: note: candidates are:
In file included from /app_MS/ocv3/include/opencv2/xfeatures2d.hpp:43:0,
                 from map_test.cpp:51:
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:116:20: note: cv::xfeatures2d::SURF::SURF()
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:116:20: note:   candidate expects 0 arguments, 1 provided
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:116:20: note: cv::xfeatures2d::SURF::SURF(const cv::xfeatures2d::SURF&)
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:116:20: note:   no known conversion for argument 1 from ‘int’ to ‘const cv::xfeatures2d::SURF&’
map_test.cpp:299:22: error: cannot declare variable ‘detector’ to be of abstract type ‘cv::xfeatures2d::SURF’
In file included from /app_MS/ocv3/include/opencv2/xfeatures2d.hpp:43:0,
                 from map_test.cpp:51:
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:116:20: note:   because the following virtual functions are pure within ‘cv::xfeatures2d::SURF’:
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:132:26: note:  virtual void cv::xfeatures2d::SURF::setHessianThreshold(double)
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:133:28: note:  virtual double cv::xfeatures2d::SURF::getHessianThreshold() const
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:135:26: note:  virtual void cv::xfeatures2d::SURF::setNOctaves(int)
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:136:25: note:  virtual int cv::xfeatures2d::SURF::getNOctaves() const
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:138:26: note:  virtual void cv::xfeatures2d::SURF::setNOctaveLayers(int)
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:139:25: note:  virtual int cv::xfeatures2d::SURF::getNOctaveLayers() const
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:141:26: note:  virtual void cv::xfeatures2d::SURF::setExtended(bool)
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:142:26: note:  virtual bool cv::xfeatures2d::SURF::getExtended() const
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:144:26: note:  virtual void cv::xfeatures2d::SURF::setUpright(bool)
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:145:26: note:  virtual bool cv::xfeatures2d::SURF::getUpright() const
map_test.cpp:307:26: error: cannot declare variable ‘extractor’ to be of abstract type ‘cv::xfeatures2d::SURF’
In file included from /app_MS/ocv3/include/opencv2/xfeatures2d.hpp:43:0,
                 from map_test.cpp:51:
/app_MS/ocv3/include/opencv2/xfeatures2d/nonfree.hpp:116:20: note:   since type ‘cv::xfeatures2d::SURF’ has pure virtual functions

There seems to be a problem with the SURF feature detector and the Matcher etc. Does anyone know a fix for this? Are there library linking issues? I am ... (more)

edit retag flag offensive close merge delete

Comments

Ah, that makes sense. So the old 2.4.10 ways will be deprecated? Is there no way to compile 2.4.10 code with 3.0.0 libraries?

Potato gravatar imagePotato ( 2015-02-14 09:30:41 -0600 )edit

contrib repo will only work with latest opencv master (3.0, currently, lots of changes)

berak gravatar imageberak ( 2015-02-14 09:32:00 -0600 )edit
1

Ahh. Guess I'll have to start getting used to 3.0.0 Any word on a stable release date?

Potato gravatar imagePotato ( 2015-02-14 09:35:26 -0600 )edit
1

^^ hehehehehehe, good one ;)

berak gravatar imageberak ( 2015-02-14 11:03:26 -0600 )edit

1 answer

Sort by » oldest newest most voted
5

answered 2015-02-14 09:23:41 -0600

berak gravatar image

updated 2015-02-14 09:45:16 -0600

" Are there library linking issues?" no, i'd rather think, the `#ifdef``'ed code is out of date , and was not tested from the buildbot.

you can't create SURF/SIFT instances on the stack anymore, instead of

SurfFeatureDetector detector(minHessian);

it now will have to be:

//-- Step 1: Detect the keypoints and extract descriptors using SURF
int minHessian = 400;

//SurfFeatureDetector detector(minHessian);
Ptr<xfeatures2d::SURF> surf = xfeatures2d::SURF::create(minHessian);

// note, that it's also far more efficient, to compute keypoints and descriptors in one go.

std::vector<KeyPoint> keypoints_object, keypoints_scene;
Mat descriptors_object, descriptors_scene;

surf->detectAndCompute(gray_image1, Mat(), keypoints_object, descriptors_object);
surf->detectAndCompute(gray_image2, Mat(), keypoints_scene,  descriptors_scene);
edit flag offensive delete link more

Comments

1

Perfect. I was just looking at the surf.cpp example given in the opencv_contrib xfeatures2d folder. An example of an implementation is there. Thanks for your help. You have saved my life a lot this week ;) The point about efficiency that you made is a great improvement over 2.4.10 as well.

I have made the changes. It all works now. How can this be updated on the git hub repo? Would I have to contact a dev?

Potato gravatar imagePotato ( 2015-02-14 10:00:53 -0600 )edit
1
berak gravatar imageberak ( 2015-02-14 10:46:41 -0600 )edit

Haha, perfect. Thanks.

Potato gravatar imagePotato ( 2015-02-15 09:06:35 -0600 )edit
1

lol, now look at this

it worked for you, and it worked for me, right ?

(again, you're not the only person troubled by 3.0 oddities...)

berak gravatar imageberak ( 2015-02-15 09:10:22 -0600 )edit
2

YES. I'm still running it perfectly with no issues. Haha. That's good to know. 3.0.0 is a pain at this point.

Potato gravatar imagePotato ( 2015-02-15 09:23:38 -0600 )edit

Hello, I Have the same problem , but I dont Know where exactly I must add this modification in the code , I m using c++ opencv 3.1 this the originally code that I must modify for been compatible with opencv 3.1 : https://github.com/doczhivago/rtObjec...

Widad gravatar imageWidad ( 2016-03-08 04:37:13 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-02-14 09:04:13 -0600

Seen: 5,384 times

Last updated: Feb 14 '15