Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FabMap activation (opencv 2.4.9 Ubuntu 14.04) #27

Closed
tyutyuginslava opened this issue Oct 28, 2014 · 8 comments
Closed

FabMap activation (opencv 2.4.9 Ubuntu 14.04) #27

tyutyuginslava opened this issue Oct 28, 2014 · 8 comments

Comments

@tyutyuginslava
Copy link

Hello!
Please tell me how to properly connect openFabMap? How should I edit CMakeLists.txt?

System:
Ubuntu 14.04 64-bit
Opencv 2.4.9
ROS Indigo

Installing without openFabMap all works.
If I uncomment the line in CMakeLists.txt

add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/openFabMap)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/openFabMap/include)
add_definitions("-DHAVE_FABMAP")
set(FABMAP_LIB openFABMAP )

and make rosmake lsd_slam, I get the error:

Linking CXX executable ../bin/live_slam
//usr/local/lib/libopencv_nonfree.so: undefined reference to `cv :: ocl :: integral (cv :: ocl :: oclMat const &, cv :: ocl :: oclMat &) '
collect2: error: ld returned 1 exit status

log file
https://drive.google.com/file/d/0B_w8l8HXXdd8dnlULXZoRkozZk0/view?usp=sharing

@RDmitrich
Copy link

Same problem on System:
Ubuntu 14.04 arm
Opencv 2.4.9
ROS Indigo

pkg-config --libs opencv

shows link /usr/local/lib/libopencv_nonfree.so

@JakobEngel
Copy link
Member

If anyone finds a universal, working way to fix the OpenCV-nonfree issue, I'd be very interested in that as well.
As it is, it took us several attempts to get it to run, and even then there were some problems remaining with the ImageDisplay. Seems like your current problem is a version-mismatch between the libopencv_nonfree.so and other opencv libraries (if I remember correctly, the integral function was slightly changed at some point).

@gpdaniels
Copy link

I approached this by compiling my own OpenCV, partly so I could enable CUDA. The moden versions of opencv (aka the git) require you to also download the modules repository, which is separate, to get the nonfree stuff.
OpenCV: https://github.com/Itseez/opencv
OpenCV Modules: https://github.com/Itseez/opencv_contrib

And then compile it all.

In FabMap.cpp you can then include:

#include <opencv2/xfeatures2d.hpp>
#include <opencv2/xfeatures2d/nonfree.hpp>

And need to modify the detector and extractor:

detector = cv::Ptr<cv::xfeatures2d::StarDetector>(new cv::xfeatures2d::StarDetector(32, 10, 18, 18, 20));
cv::Ptr<cv::DescriptorExtractor> extractor = cv::Ptr<cv::xfeatures2d::SURF>(new cv::xfeatures2d::SURF(1000, 4, 2, false, true));

I think that's all I changed.
Although this is for a non ros version, I'm not sure what you'd need to do to force cvbridge to behave.

@romulogcerqueira
Copy link

I followed @gpdaniels steps but it didn't work for me. I'm using Ubuntu 14.04 with OpenCV 2.4.10.

@gpdaniels
Copy link

When I did this I was using the git version of OpenCV which is now version 3.0 I think. These steps won't work unless you're using a very modern version of OpenCV.

@hca2014
Copy link

hca2014 commented Dec 30, 2014

Hi.
Just thought I'd add that if one compiles and installs OpenCV including the cmake -D WITH_OPENCL=OFF option then the problem is resolved (although of cousrse OpenCL support is disabled) . See post here for additional information:
http://stackoverflow.com/questions/26553659/linking-opencv-nonfree-components-sift-features-and-ocl-specifically
Good luck.
P.S running Kubuntu 14.04 with CUDA 6.5 and OpenCV 2.4.10.

@hca2014
Copy link

hca2014 commented Dec 30, 2014

Just as a follow up to my previous post - if after OpenCV compilation and installation you run lsd_slam and get an error such as:
"error while loading shared libraries: libopencv_nonfree.so.2.4: cannot open shared object file: No such file or directory"

then just make sure that you export the OpenCV library path so that it can be found (in my case it's /usr/local/lib):
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib

@romulogcerqueira
Copy link

I followed @hca2014 steps and it works for me! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants