MasteringOpenCV / code

Code for the book "Mastering OpenCV with Practical Computer Vision Projects" by Packt Publishing 2012.
Other
2.71k stars 1.64k forks source link

Chapter 4 compile problem ‘BruteForceMatcher_GPU’ was not declared in this scope #76

Open wkyoun opened 7 years ago

wkyoun commented 7 years ago

I am trying to compile chapter 4, but following error occurs!

Would you please let me know how to fix it?

wkyoun@wkyoun-XPS-13-9343:~/code/Chapter4_StructureFromMotion/build$ make

Scanning dependencies of target ExploringSfMLibrary
[  7%] Building CXX object CMakeFiles/ExploringSfMLibrary.dir/GPUSURFFeatureMatcher.cpp.o
/home/wkyoun/code/Chapter4_StructureFromMotion/GPUSURFFeatureMatcher.cpp: In member     function ‘virtual void GPU
SURFFeatureMatcher::MatchFeatures(int, int, std::vector<cv::DMatch>*)’:
/home/wkyoun/code/Chapter4_StructureFromMotion/GPUSURFFeatureMatcher.cpp:77:5: error:     ‘BruteForceMatcher_GPU’ was not declared in this scope
     BruteForceMatcher_GPU<L2<float> > matcher;
     ^
/home/wkyoun/code/Chapter4_StructureFromMotion/GPUSURFFeatureMatcher.cpp:77:37: error:     expected primary-expression before ‘>’ token
     BruteForceMatcher_GPU<L2<float> > matcher;
                                 ^
/home/wkyoun/code/Chapter4_StructureFromMotion/GPUSURFFeatureMatcher.cpp:77:39: error:     ‘matcher’ was not declared in this scope
     BruteForceMatcher_GPU<L2<float> > matcher;
                                   ^
make[2]: *** [CMakeFiles/ExploringSfMLibrary.dir/GPUSURFFeatureMatcher.cpp.o] Error 1
make[1]: *** [CMakeFiles/ExploringSfMLibrary.dir/all] Error 2
make: *** [all] Error 2
royshil commented 7 years ago

@won13y I'm currently re-writing this chapter, getting ready for a 2nd edition of the book that's schedule to publish before the end of the year. This code will be replaced with a far more robust version.

wkyoun commented 7 years ago

@royshil Thank you for the reply Before you publish 2nd edition, Would you please let me know how to fix those problems?

I already bought your book which have excellent contents about Sfm,

and I really need to run the opencv example of Chapter 4 for my projects

If possible, I would like to invite you to come my institution(KARI) in south korea in the future to share you knowlegde, and really hope that we can collaborate each other! (Main topic of our team is Visual-SLAM usnig mono-camera on drone(quadcopter))

thbupt commented 7 years ago

@won13y I have the same problem, have you solved it?

wkyoun commented 7 years ago

@thbupt No, I cannot solve the problem yet!

Would anyone of you please let me know how to fix it?

thbupt commented 7 years ago

@won13y I just solved this problem. Just include opencv2/nonfree/gpu.hpp in the GPUSURFFeatureMatcher.hpp. You can have a try.

lothas commented 7 years ago

For the sake of clarity, @thbupt 's solution requires adding opencv2/nonfree/gpu.hpp, in addition to opencv2/gpu/gpu.hpp. That solved it for me.