0
$\begingroup$

Rosanswers logo

Hellow,

I'm trying to install cv_bridge on my raspberry Pi using Ros Hydro. I installed OpenCV following this link and when I try to compile ROS I have the following :

WARNING: package "opencv_tests" should not depend on metapackage "ros" but on its packages instead

And

/home/pi/tobot_ws/ros_mobile_ws/src/cv_bridge/cv_bridge/src/cv_bridge.cpp: In function ‘std::map<std::pair<cv_bridge::Format, cv_bridge::Format>, std::vector<int> > cv_bridge::getConversionCodes()’:
/home/pi/tobot_ws/ros_mobile_ws/src/cv_bridge/cv_bridge/src/cv_bridge.cpp:133:44: error: ‘CV_GRAY2RGB’ was not declared in this scope

I installed OpenCV into /usr/lib/include and everything. I guess some files are not found and I'm wondering how can I link it correctly ?

EDIT :

I did a source install of opencv2 this way :

Need to source install like this :

  • cd ros_mobile_ws/src
  • rosinstall_generator opencv2 --deps | rosws merge -
  • rosws update
  • cd ..
  • rosdep install --from-paths src --ignore-src --rosdistro hydro -y --os=debian:wheezy
  • ./src/catkin/bin/catkin_make_isolated --install

This install went fine and everything compile but now when I want to compile this I have this error :

Linking CXX executable /home/pi/tobot_ws/catkin_ws2/devel/lib/openni2_camera/openni2_camera_node
/usr/bin/ld: warning: libopencv_videostab.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_video.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_superres.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_stitching.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_softcascade.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_shape.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_photo.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_optim.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_objdetect.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_nonfree.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_ml.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_legacy.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_imgproc.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_highgui.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_flann.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_features2d.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_cudawarping.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_cudastereo.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_cudaoptflow.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_cudaimgproc.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_cudafilters.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_cudafeatures2d.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_cudacodec.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_cudabgsegm.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_cudaarithm.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_cuda.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_core.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_contrib.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_calib3d.so.3.0, needed by /home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so, not found (try using -rpath or -rpath-link)
CMakeFiles/openni2_camera_node.dir/src/openni2_camera.cpp.o: In function `cv::Mat::~Mat()':
openni2_camera.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x3c): undefined reference to `cv::fastFree(void*)'
CMakeFiles/openni2_camera_node.dir/src/openni2_camera.cpp.o: In function `cv::Mat::operator=(cv::Mat const&)':
openni2_camera.cpp:(.text._ZN2cv3MataSERKS0_[cv::Mat::operator=(cv::Mat const&)]+0x12c): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
CMakeFiles/openni2_camera_node.dir/src/openni2_camera.cpp.o: In function `cv::Mat::release()':
openni2_camera.cpp:(.text._ZN2cv3Mat7releaseEv[cv::Mat::release()]+0x58): undefined reference to `cv::Mat::deallocate()'
/home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so: undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
/home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so: undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const'
/home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
/home/pi/tobot_ws/ros_mobile_ws/install_isolated/lib/libcv_bridge.so: undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
collect2: ld returned 1 exit status
make[2]: *** [/home/pi/tobot_ws/catkin_ws2/devel/lib/openni2_camera/openni2_camera_node] Error 1
make[1]: *** [openni2_camera/CMakeFiles/openni2_camera_node.dir/all] Error 2
make: *** [all] Error 2

I'm pretty sure it just means that cv_bridge can't find open_cv but here are all the package I've installed :

pi@raspberrypi ~/tobot_ws/ros_mobile_ws/src $ ls
actionlib       control_msgs          gencpp                 message_generation          random_numbers         roslint
angles          cv_bridge             genlisp                message_runtime             robot_model            rospack
bond_core       diagnostics           genmsg                 metapackages                robot_state_publisher  shape_tools
catkin          driver_common         genpy                  nodelet_core                ros                    std_msgs
class_loader    dynamic_reconfigure   geometric_shapes       octomap                     rosbag_migration_rule  urdfdom
cmake_modules   eigen_stl_containers  geometry               opencv2                     ros_comm               urdfdom_headers
common_msgs     executive_smach       geometry_experimental  orocos_kinematics_dynamics  rosconsole_bridge      xacro
console_bridge  filters               image_transport        pluginlib                   roscpp_core
pi@raspberrypi ~/tobot_ws/ros_mobile_ws/src $ 

I do have opencv and opencv2... so I can't understand why it still can't link it. I suppress the other version of OpenCV I installed so the "ros" opencv2 is the only openCV on the system.

Thanks a lot for your help !


Originally posted by Maya on ROS Answers with karma: 1172 on 2014-05-15

Post score: 3

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

In ROS Hydro cv_bridge expects OpenCV to be installed via opencv2 package, that installs OpenCV as "3rd party package" where it gets installed under /opt/ros/hydro instead of general directory as you mentioned (I asked here if this guess is correct, and confirmed by a OpenCV developer).

That said it's possible that linking might not work with the OpenCV that's installed differently.


Originally posted by 130s with karma: 10937 on 2014-05-22

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Maya on 2014-05-23:
You didn't found any way to link it ?

Comment by 130s on 2014-05-23:
I haven't tried installing OpenCV by non-ROS way like you do. Isn't installing opencv2 an option for you?

Comment by Maya on 2014-05-23:
When I try to do it with rosdep it says that it can't find the package opencv2 for raspbian weezy. I can't reproduce the problem now but I'll do as soon as I can.

Comment by 130s on 2014-05-26:
rosdep doesn't install ROS package. I'm not familliar with raspbian but you might want to source-install OpenCV2. You can generate .rosintall description by running $ rosinstall_generator opencv2.

Comment by Maya on 2014-06-14:
But now I have openCV installed as a thrid party AND from source :P... I'll have to find out what's wrong.. EDIT : found an OpenCV linker missing. It compile now !

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.