arrenglover/openfabmap

openFABMAP installation problem

kevindokaist opened this issue · 4 comments

Hi. I'm trying to install openFABMAP and having a few problems.
When I type in make after building, I get the following message.

[ 66%] Built target openFABMAP
[ 83%] Building CXX object CMakeFiles/openFABMAPcli.dir/samples/openFABMAPcli.cpp.o
/home/kd/trunk/samples/openFABMAPcli.cpp: In function ‘int openFABMAP(std::__cxx11::string, of2::FabMap*, std::__cxx11::string, std::__cxx11::string, bool)’:
/home/kd/trunk/samples/openFABMAPcli.cpp:571:16: error: ambiguous overload for ‘operator=’ (operand types are ‘cv::Mat’ and ‘int’)
confusion_mat = 0; // init to 0's
^
In file included from /usr/local/include/opencv2/core/core.hpp:4922:0,
from /usr/local/include/opencv2/opencv.hpp:49,
from /home/kd/trunk/samples/../include/openfabmap.hpp:38,
from /home/kd/trunk/samples/openFABMAPcli.cpp:31:
/usr/local/include/opencv2/core/mat.hpp:281:13: note: candidate: cv::Mat& cv::Mat::operator=(const cv::Mat&)
inline Mat& Mat::operator = (const Mat& m)
^
In file included from /usr/local/include/opencv2/opencv.hpp:49:0,
from /home/kd/trunk/samples/../include/openfabmap.hpp:38,
from /home/kd/trunk/samples/openFABMAPcli.cpp:31:
/usr/local/include/opencv2/core/core.hpp:1795:10: note: candidate: cv::Mat& cv::Mat::operator=(const Scalar&)
Mat& operator = (const Scalar& s);
^
CMakeFiles/openFABMAPcli.dir/build.make:62: recipe for target 'CMakeFiles/openFABMAPcli.dir/samples/openFABMAPcli.cpp.o' failed
make[2]: *** [CMakeFiles/openFABMAPcli.dir/samples/openFABMAPcli.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/openFABMAPcli.dir/all' failed
make[1]: *** [CMakeFiles/openFABMAPcli.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

I am currently using openCV 2.4. I would really appreciate any help.
Thank you!

On which OS are you building? On ubuntu 18.04 and opencv version 2.4.13.7 I am not getting any errors. It does appear to be an opencv version error though, maybe double check the version you are compiling against if you also have opencv 3.X installed.

Currently on ubuntu 16.04 and opencv 2.4.13. I tried uninstalling and reinstalling opencv a few times but still get the same error. I don't really know where to start. Any suggestions on what I could try?
Thank you!

I've been using the code in googlecode project so I tried it using the one in the git and got the following error.

kd@kd-H170-Gaming-3:~/openfabmap-master/build$ cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done

-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp
FOUND OPENMP
-- Found OpenCV: /opt/ros/kinetic (found version "3.3.1")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kd/openfabmap-master/build

kd@kd-H170-Gaming-3:~/openfabmap-master/build$ make
[ 12%] Building CXX object CMakeFiles/openFABMAP.dir/src/chowliutree.cpp.o
/home/kd/openfabmap-master/src/chowliutree.cpp: In member function ‘bool of2::ChowLiuTree::reduceEdgesToMinSpan(std::__cxx11::listof2::ChowLiuTree::info&)’:
/home/kd/openfabmap-master/src/chowliutree.cpp:272:5: error: ‘map’ is not a member of ‘std’
std::map<int, int> groups; std::map<int, int>::iterator groupIt;
^
/home/kd/openfabmap-master/src/chowliutree.cpp:272:14: error: expected primary-expression before ‘int’
std::map<int, int> groups; std::map<int, int>::iterator groupIt;
^
/home/kd/openfabmap-master/src/chowliutree.cpp:272:32: error: ‘map’ is not a member of ‘std’
std::map<int, int> groups; std::map<int, int>::iterator groupIt;
^
/home/kd/openfabmap-master/src/chowliutree.cpp:272:41: error: expected primary-expression before ‘int’
std::map<int, int> groups; std::map<int, int>::iterator groupIt;
^
/home/kd/openfabmap-master/src/chowliutree.cpp:273:53: error: ‘groups’ was not declared in this scope
for(int i = 0; i < imgDescriptors[0].cols; i++) groups[i] = i;
^
/home/kd/openfabmap-master/src/chowliutree.cpp:278:12: error: ‘groups’ was not declared in this scope
if(groups[edge->word1] != groups[edge->word2]) {
^
/home/kd/openfabmap-master/src/chowliutree.cpp:281:17: error: ‘groupIt’ was not declared in this scope
for(groupIt = groups.begin(); groupIt != groups.end(); groupIt++)
^
CMakeFiles/openFABMAP.dir/build.make:110: recipe for target 'CMakeFiles/openFABMAP.dir/src/chowliutree.cpp.o' failed
make[2]: *** [CMakeFiles/openFABMAP.dir/src/chowliutree.cpp.o] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/openFABMAP.dir/all' failed
make[1]: *** [CMakeFiles/openFABMAP.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Is it a similar problem as the first? I've checked that I have opencv 2.4.13 and not opencv 3.

It looks like the version of opencv that you are finding is 3.3 - it probably comes bundled with ROS. To solve this do a "ccmake .." in the build folder and manually change the path of the opencv to the location of opencv2.4. The location will change depending on how you installed it.

I'm currently updating the code to work with opencv3, but haven't quite finished.