Rosanswers logo

hi guys ,I am trying to interface ROS(diamondback) and opencv. I am working on ubuntu 10.04 . I followed the tutorial in the following link


I created a package with the following dependencies sensor_msgs,image_transport,opencv2,cv_bridge,roscpp,std_msgs.

I used the same program in the link above and copied it to the "src" folder as a CPP file. I compiled it using rosmake (after being done with cmake). This was my output:

[ rosmake ] No package specified. Building ['ardrone_kar'] [ rosmake ] Packages requested are: ['ardrone_kar'] [ rosmake ] Logging to directory/home/metallo/.ros/rosmake/rosmake_output-20120202-043021 [ rosmake ] Expanded args ['ardrone_kar'] to: ['ardrone_kar'] [ rosmake ] Checking rosdeps compliance for packages ardrone_kar. This may take a few seconds. Failed to find rosdep opencv2 for package ardrone_kar on OS:ubuntu version:10.10 WARNING: Rosdeps [u'opencv2'] could not be resolved [ rosmake ] rosdep check passed all system dependencies in packages [rosmake-0] Starting >>> roslib [ make ] [rosmake-0] Finished <<< roslib ROS_NOBUILD in package roslib [rosmake-1] Starting >>> rosbuild [ make ] [rosmake-1] Finished <<< rosbuild ROS_NOBUILD in package rosbuild No Makefile in package rosbuild [rosmake-2] Starting >>> cpp_common [ make ] [rosmake-2] Finished <<< cpp_common ROS_NOBUILD in package cpp_common [rosmake-3] Starting >>> xmlrpcpp [ make ] [rosmake-0] Starting >>> std_msgs [ make ] [rosmake-1] Starting >>> roslang [ make ] [rosmake-2] Starting >>> roscpp_traits [ make ] [rosmake-3] Finished <<< xmlrpcpp ROS_NOBUILD in package xmlrpcpp [rosmake-1] Finished <<< roslang ROS_NOBUILD in package roslang No Makefile in package roslang [rosmake-0] Finished <<< std_msgs ROS_NOBUILD in package std_msgs [rosmake-1] Starting >>> rostime [ make ] [rosmake-2] Finished <<< roscpp_traits ROS_NOBUILD in package roscpp_traits [rosmake-1] Finished <<< rostime ROS_NOBUILD in package rostime [rosmake-0] Starting >>> rosgraph_msgs [ make ] [rosmake-3] Starting >>> roscpp_serialization [ make ] [rosmake-2] Starting >>> rosconsole [ make ] [rosmake-0] Finished <<< rosgraph_msgs ROS_NOBUILD in package rosgraph_msgs [rosmake-3] Finished <<< roscpp_serialization ROS_NOBUILD in package roscpp_serialization [rosmake-2] Finished <<< rosconsole ROS_NOBUILD in package rosconsole [rosmake-1] Starting >>> rosclean [ make ] [rosmake-0] Starting >>> rospy [ make ] [rosmake-3] Starting >>> roscpp [ make ] [rosmake-0] Finished <<< rospy ROS_NOBUILD in package rospy [rosmake-3] Finished <<< roscpp ROS_NOBUILD in package roscpp [rosmake-1] Finished <<< rosclean ROS_NOBUILD in package rosclean [rosmake-2] Starting >>> rosgraph [ make ] [rosmake-2] Finished <<< rosgraph ROS_NOBUILD in package rosgraph [rosmake-0] Starting >>> rosparam [ make ] [rosmake-0] Finished <<< rosparam ROS_NOBUILD in package rosparam [rosmake-1] Starting >>> rosmaster [ make ] [rosmake-1] Finished <<< rosmaster ROS_NOBUILD in package rosmaster [rosmake-3] Starting >>> rosout [ make ] [rosmake-3] Finished <<< rosout ROS_NOBUILD in package rosout [rosmake-2] Starting >>> rosunit [ make ] [rosmake-2] Finished <<< rosunit ROS_NOBUILD in package rosunit [rosmake-0] Starting >>> tinyxml [ make ] [rosmake-0] Finished <<< tinyxml ROS_NOBUILD in package tinyxml [rosmake-3] Starting >>> roslaunch [ make ] [rosmake-1] Starting >>> opencv2 [ make ] [rosmake-2] Starting >>> pluginlib [ make ] [rosmake-3] Finished <<< roslaunch ROS_NOBUILD in package roslaunch No Makefile in package roslaunch [rosmake-2] Finished <<< pluginlib ROS_NOBUILD in package pluginlib [rosmake-3] Starting >>> rostest [ make ] [rosmake-3] Finished <<< rostest ROS_NOBUILD in package rostest [rosmake-3] Starting >>> topic_tools [ make ] [rosmake-3] Finished <<< topic_tools ROS_NOBUILD in package topic_tools [rosmake-3] Starting >>> rosbag [ make ] [rosmake-0] Starting >>> message_filters [ make ] [rosmake-1] Finished <<< opencv2 [PASS] [ 0.02 seconds ] [rosmake-3] Finished <<< rosbag ROS_NOBUILD in package rosbag [rosmake-3] Starting >>> rosbagmigration [ make ] [rosmake-0] Finished <<< message_filters ROS_NOBUILD in package message_filters [rosmake-3] Finished <<< rosbagmigration ROS_NOBUILD in package rosbagmigration No Makefile in package rosbagmigration [rosmake-3] Starting >>> geometry_msgs [ make ] [rosmake-3] Finished <<< geometry_msgs ROS_NOBUILD in package geometry_msgs [rosmake-3] Starting >>> sensor_msgs [ make ] [rosmake-3] Finished <<< sensor_msgs ROS_NOBUILD in package sensor_msgs [rosmake-3] Starting >>> image_transport [ make ] [rosmake-1] Starting >>> cv_bridge [ make ] [rosmake-3] Finished <<< image_transport ROS_NOBUILD in package image_transport [ rosmake ] All 20 linesv_bridge: 2.2 sec ] [ 1 Active 32/34 Complete ] {------------------------------------------------------------------------------- [ 0%] Built target rospack_genmsg_libexe [ 0%] Built target rosbuild_precompile [100%] Building CXX object CMakeFiles/cv_bridge.dir/src/cv_bridge.o /home/metallo/ros/trunk/cv_bridge/src/cv_bridge.cpp: In function ‘int cv_bridge::getCvType(const std::string&)’: /home/metallo/ros/trunk/cv_bridge/src/cv_bridge.cpp:51: error: ‘BGR16’ is not a member of ‘enc’ /home/metallo/ros/trunk/cv_bridge/src/cv_bridge.cpp:52: error: ‘RGB16’ is not a member of ‘enc’ /home/metallo/ros/trunk/cv_bridge/src/cv_bridge.cpp:55: error: ‘BGRA16’ is not a member of ‘enc’ /home/metallo/ros/trunk/cv_bridge/src/cv_bridge.cpp:56: error: ‘RGBA16’ is not a member of ‘enc’ /home/metallo/ros/trunk/cv_bridge/src/cv_bridge.cpp:63: error: ‘BAYER_RGGB16’ is not a member of ‘enc’ /home/metallo/ros/trunk/cv_bridge/src/cv_bridge.cpp:64: error: ‘BAYER_BGGR16’ is not a member of ‘enc’ /home/metallo/ros/trunk/cv_bridge/src/cv_bridge.cpp:65: error: ‘BAYER_GBRG16’ is not a member of ‘enc’ /home/metallo/ros/trunk/cv_bridge/src/cv_bridge.cpp:66: error: ‘BAYER_GRBG16’ is not a member of ‘enc’ /home/metallo/ros/trunk/cv_bridge/src/cv_bridge.cpp: In function ‘cv_bridge::Format cv_bridge::getFormat(const std::string&)’: /home/metallo/ros/trunk/cv_bridge/src/cv_bridge.cpp:103: error: ‘BGR16’ is not a member of ‘enc’ /home/metallo/ros/trunk/cv_bridge/src/cv_bridge.cpp:104: error: ‘RGB16’ is not a member of ‘enc’ /home/metallo/ros/trunk/cv_bridge/src/cv_bridge.cpp:107: error: ‘BGRA16’ is not a member of ‘enc’ /home/metallo/ros/trunk/cv_bridge/src/cv_bridge.cpp:108: error: ‘RGBA16’ is not a member of ‘enc’ make[2]: *** [CMakeFiles/cv_bridge.dir/src/cv_bridge.o] Error 1 make[1]: *** [CMakeFiles/cv_bridge.dir/all] Error 2

[ rosmake ] Output from build of package cv_bridge written to: [ rosmake ] /home/metallo/.ros/rosmake/rosmake_output-20120202-043021/cv_bridge/build_output.log [rosmake-1] Finished <<< cv_bridge [FAIL] [ 2.25 seconds ]
[ rosmake ] Halting due to failure in package cv_bridge. [ rosmake ] Waiting for other threads to complete. [ rosmake ] Results:
[ rosmake ] Built 33 packages with 1 failures.
[ rosmake ] Summary output to directory
[ rosmake ] /home/metallo/.ros/rosmake/rosmake_output-20120202-043021

Its clearly not able to compile cv_bridge and my opencv2 is blank. But the ar_recog package is clearly able to identify cv_bridge and work perfectly.I am not sure about the problem. Should I download any other important package for the synchronization ROS and opencv?. Like I said before I am using ROS diamondback ,opencv(latest download),Ubuntu Lucid 10.04

Originally posted by metal on ROS Answers with karma: 174 on 2012-02-01

Post score: 0

Original comments

Comment by tfoote on 2012-02-02:
As @Patrick Mihelich said, please don't shout. There are many people reading this forum and keeping it nice to read it important. I have removed the shouting for you this time.


1 Answer 1


Rosanswers logo

Please don't shout.

The problem is you're compiling the trunk (or perhaps Electric) version of cv_bridge against your Diamondback install of sensor_msgs. Mixing packages from different ROS distros will almost always get you into trouble. In this case, in Electric we added support for some 16-bit encodings (BGR16, RGB16, etc.). So the Electric cv_bridge references those, but they aren't defined in the Diamondback sensor_msgs.

You're on Ubuntu, so you shouldn't need to compile cv_bridge at all. Just use the prebuilt debian package:

sudo apt-get install ros-diamondback-vision-opencv

If there's some ROS stack that you need to modify (and therefore install from source), make sure to check out the maintenance branch for whatever distro you're using. In this case that would be:


1.4 = Diamondback, 1.6 = Electric, and trunk is for active development (currently leading to Fuerte).

Originally posted by Patrick Mihelich with karma: 4336 on 2012-02-02

This answer was ACCEPTED on the original site

Post score: 2

Original comments

Comment by metal on 2012-02-04:
Patrick ,I installed ros electric in the same machine where diamondback was.The file I had problem with is able to build clearly now.But I cant create the driver file.I got the dependencies and also made proper changes in the cmake.txt. But the driver file is not getting created at all...

Comment by metal on 2012-02-02:
Patrick thanks for your response.I downloaded the vision_opencv-1.4


Your Answer

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