ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

It is "hard coded" to 3.2 because that is the version of OpenCV that is officially supported by ROS for Melodic Morenia on Ubuntu Bionic. See also REP 3: Target Platforms - Platforms by Distribution - Melodic Morenia (May 2018 - May 2023).

Note the 3.2 in the row for OpenCV in the table titled Requirements, and also note the * there with the note:

" * " means that this is not the upstream version (available on the official Operating System repositories) but a package distributed by OSRF or the community (package built and distributed on custom repositories).

In order to keep the set of supported platforms managable, some choices have to be made, and as it's very difficult to find a set of dependencies that can be supported across the different OS and architectures that you see in that table, it may happen that you don't get the newest versions of some packages -- such as OpenCV.


You're next question is probably going to be: "but I need OpenCV 3.4, so how do I use OpenCV 3.4 with ROS Melodic?".

The answer would be: you'd have to build everything that uses OpenCV (even indirectly) from source in your / a Catkin workspace. See #q289264 for an overview of the steps (that Q&A is about PCL, but that's just an example).

At a high-level: you'll want to have OpenCV 3.4 installed on your system, checkout the sources of packages that depend on OpenCV in your workspace, update the build scripts (ie: CMakeLists.txt) of those packages (so that they require OpenCV 3.4 instead of 3.2) and then build the workspace.

After that, you should be able to use OpenCV 3.4 with your locally build ROS Melodic.

Note: you cannot mix-and-match versions of system dependencies. This means that also future packages you install that (indirectly) depend on OpenCV you must build those from source.