[Documentation] [TitleIndex] [WordIndex

  Show EOL distros: 

opencv2 ROS package deprecated (ROS Electric). It is now a third party package.

Overview

For documentation on OpenCV, please see the Official OpenCV documentation. For additional libraries to help you use OpenCV with ROS, please see the cv_bridge package and vision_opencv stack.

OpenCV in Diamondback and C Turtle

For ROS Diamondback and C Turtle, OpenCV was provided inside of a ROS package. The opencv2 package contains OpenCV 2.2 (Diamondback) or OpenCV 2.0 (C Turtle).

OpenCV in Electric

Starting in ROS Electric, OpenCV can now be used with ROS as a rosdep system dependency. The opencv2 ROS package is still provided for backwards compatibility, but will be removed in future releases.

The instructions below will guide you through configuring your ROS packages to use the OpenCV rosdep system dependency.

Migrating from Diamondback

Please transition away from using <depend package="opencv2" /> to link against OpenCV in your packages. Standard CMake mechanisms (e.g. find_package()) are now the preferred way of linking against OpenCV.

CMakeLists.txt

For convenience, the system install includes CMake config files for easily finding and configuring OpenCV in your CMakeLists.txt using the normal find_package() macro:

find_package(OpenCV REQUIRED)
#define some target ...
target_link_libraries(my_target ${OpenCV_LIBRARIES})

Package/stack dependencies

When on Fuerte releasing for Electric

You just need the following:

  1. manifest.xml

      <rosdep name="opencv2"/>

When on Electric releasing for Electric

The OpenCV rosdep is defined in the vision_opencv stack. You may depend on OpenCV by adding the following:

  1. manifest.xml

      <depend package="cv_bridge" />
    
      <rosdep name="opencv2.3"/>
  2. stack.xml

      <depend stack="vision_opencv" />

Getting OpenCV

If you have updated your package and stack files following the directions above, you can simply type:

rosdep install <your-package>

and rosdep will automatically bring in the appropriate OpenCV for your system.

Manual apt-get install

If you need to install OpenCV manually on Ubuntu, please follow the instructions below.

  1. Verify that you have the latest ROS sources added to apt. See the section Setting up sources

  2. Install libopencv2.3-dev with apt.
    • sudo apt-get update
      sudo apt-get install libopencv2.3-dev

CMakeLists.txt

For convenience, the system install includes CMake config files for easily finding and configuring OpenCV in your CMakeLists.txt using the normal find_package() macro:

find_package(OpenCV REQUIRED)
#define some target ...
target_link_libraries(my_target ${OpenCV_LIBS})

Package/stack dependencies

OpenCV only dependency

You just need the following:

  1. manifest.xml

      <rosdep name="opencv2"/>

vision-opencv dependency

The OpenCV rosdep is defined in the vision_opencv stack. You may depend on OpenCV by adding the following:

  1. manifest.xml

      <depend package="cv_bridge" />
    
      <rosdep name="opencv2"/>
  2. stack.xml

      <depend stack="vision_opencv" />

Getting OpenCV

If you have updated your package and stack files following the directions above, you can simply type:

rosdep install <your-package>

and rosdep will automatically bring in the appropriate OpenCV for your system.

Manual apt-get install

If you need to install OpenCV manually on Ubuntu, please follow the instructions below.

  • sudo apt-get update
    sudo apt-get install ros-fuerte-opencv2

Report a Bug

If your issue is related to the OpenCV packaged in ROS (it is too old, you would like to see a backport in there ...), please file a bug using the link at vision_opencv.

For issues specific to OpenCV:

Relationship to standalone library

Ubuntu .deb of OpenCV2 is released into ROS as a Third Party package using source code from its upstream repository, which means it works independently from its standalone version (libopencv*).

You can check its version number by:

$ rosversion opencv2

Since Indigo, OpenCV is not released from ROS infrastructure. Its ROS-interface package vision_opencv depends on standalone libopencv* packages.


2022-05-28 12:49