Zhe-LIU-Imagine / openfabmap

Automatically exported from code.google.com/p/openfabmap
Other
0 stars 1 forks source link

Compilation against OpenCV 2.4 #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compiling with OpenCV 2.4 installed

What is the expected output? What do you see instead?
It should be compiled. But These errors Occur:
/home/alireza/Tools/Codes/SLAM/OpenFabMap/openFabMap/samples/openFABMAPcli.cpp:5
71: error: ambiguous overload for ‘operator=’ in ‘confusion_mat = 0’
/usr/local/include/opencv2/core/mat.hpp:300: note: candidates are: cv::Mat& 
cv::Mat::operator=(const cv::Mat&)
/usr/local/include/opencv2/core/core.hpp:1714: note:                 cv::Mat& 
cv::Mat::operator=(const cv::Scalar&)
make[2]: *** [CMakeFiles/openFABMAPcli.dir/samples/openFABMAPcli.cpp.o] Error 1
make[1]: *** [CMakeFiles/openFABMAPcli.dir/all] Error 2

openFABMAPcli.cpp:(.text+0x4607): undefined reference to 
`cv::SURF::SURF(double, int, int, bool, bool)'
openFABMAPcli.cpp:(.text+0x48ff): undefined reference to `cv::SIFT::SIFT(int, 
int, double, double, double)'
CMakeFiles/openFABMAPcli.dir/samples/openFABMAPcli.cpp.o: In function 
`generateExtractor(cv::FileStorage&)':
openFABMAPcli.cpp:(.text+0x51ea): undefined reference to `cv::SIFT::SIFT(int, 
int, double, double, double)'
openFABMAPcli.cpp:(.text+0x54f0): undefined reference to 
`cv::SURF::SURF(double, int, int, bool, bool)'

What version of the product are you using? On what operating system?
2.0

Please provide any additional information below.
In openFABMAPcli.cpp:
Change
    cv::Mat confusion_mat(testImageDescs.rows, testImageDescs.rows, CV_64FC1 );
confusion_mat = 0; // init to 0's

to
    cv::Mat confusion_mat(testImageDescs.rows, testImageDescs.rows, CV_64FC1 , cv::Scalar::all(0));

Link against nonfree library
# Tell openFABMAPcli to link against its required libs
    TARGET_LINK_LIBRARIES(openFABMAPcli openFABMAP opencv_nonfree)

Original issue reported on code.google.com by a.norouz...@gmail.com on 29 Sep 2012 at 6:29

GoogleCodeExporter commented 9 years ago
Linking to the opencv_nonfree removes the undefined references

But it does not solve the "ambigious overload for ..."

Did you find a solution? 
Specifically
Ubuntu 12.10, opencv2.4.4

/home/mikael/packages/fabmap/fabmap/samples/openFABMAPcli.cpp: In function 
âint openFABMAP(std::string, of2::FabMap*, std::string, std::string, bool)â:
/home/mikael/packages/fabmap/fabmap/samples/openFABMAPcli.cpp:568:18: error: 
ambiguous overload for âoperator=â in âconfusion_mat = 0â
/home/mikael/packages/fabmap/fabmap/samples/openFABMAPcli.cpp:568:18: note: 
candidates are:
In file included from /usr/local/include/opencv2/core/core.hpp:4785:0,
                 from /usr/local/include/opencv2/opencv.hpp:47,
                 from /home/mikael/packages/fabmap/fabmap/samples/../include/openfabmap.hpp:38,
                 from /home/mikael/packages/fabmap/fabmap/samples/openFABMAPcli.cpp:30:
/usr/local/include/opencv2/core/mat.hpp:281:13: note: cv::Mat& 
cv::Mat::operator=(const cv::Mat&)
In file included from /usr/local/include/opencv2/opencv.hpp:47:0,
                 from /home/mikael/packages/fabmap/fabmap/samples/../include/openfabmap.hpp:38,
                 from /home/mikael/packages/fabmap/fabmap/samples/openFABMAPcli.cpp:30:
/usr/local/include/opencv2/core/core.hpp:1767:10: note: cv::Mat& 
cv::Mat::operator=(const Scalar&)
make[2]: *** [CMakeFiles/openFABMAPcli.dir/samples/openFABMAPcli.cpp.o] Error 1
make[1]: *** [CMakeFiles/openFABMAPcli.dir/all] Error 2
make: *** [all] Error 2

Original comment by Mikael.P...@gmail.com on 4 Apr 2013 at 7:50

GoogleCodeExporter commented 9 years ago
I got it working by changing 
confusion_mat = 0; // init to 0's
to
confusion_mat = cv::Mat::zeros(testImageDescs.rows, testImageDescs.rows, 
CV_64FC1);
in openFABMAPcli.cpp

Original comment by cyc3...@gmail.com on 13 Aug 2013 at 7:54