add opencv to indigo
The Opencv packages aren't built in the ROS Indigo anymore. So what should I do if I want to add opencv2?
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
The Opencv packages aren't built in the ROS Indigo anymore. So what should I do if I want to add opencv2?
Note that for compatibility with Hydro and general simplicity it is recommended to use cv_bridge as a dependency to pull in opencv for Indigo packages (a bit hacky though, as this pulls in other related packages). See discussion on github and Indigo migration guide on OpenCV.
You should install opencv by yourself on your computer, the easiest way is to clone this to your computer https://github.com/jayrambhia/Install...
git clone https://github.com/jayrambhia/Install-OpenCV.git
Then run the ubuntu/opencv_install.sh
Now in your ros package:
In the manifest.xml add this line
<rosdep name="opencv2"/>
you also need to include these lines in your CMakeFiles.txt
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
and
target_link_libraries(your_cpp_node ${OpenCV_LIBS})
for linking the libraries to the nodes written in c++.
Thanks for your reply. I do the same and add the lines except the last line (target_link_libraries) since the package is written in python. The package is built correctly but I get following error when using roslaunch for running it: cv_image = self.bridge.imgmsg_to_cv(data, "bgr8") AttributeError: CvBridge instance has no attribute 'imgmsg_to_cv'
This is not the right way to do it -- the opencv2 rosdep will slowly be going away, replaced by the libopencv-dev rosdep which uses the system OpenCV rather than the one built for ROS. On ubuntu, all you should have to do is "sudo apt-get install libopencv-dev".
@voladoddi, no need to link, in your python script just write "import cv2"
Asked: 2014-07-07 02:16:27 -0600
Seen: 14,549 times
Last updated: Nov 03 '16