Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If you want to use an OpenCV version different than the one shipped with ROS:

  • do it at your own risks and understand the consequences of the following instructions
  • build your OpenCV version and use as CMAKE_INSTALL_PREFIX a local directory, e.g.: ~/src/opencv4/build/install
  • uninstall ROS-Kinetic-Opencv (of course assuming ROS Kinetic here): sudo apt-get remove ros-kinetic-opencv3
  • write the names of ROS packages that depend on ros-kinetic-opencv3 and that will be uninstalled
  • git clone the missing ROS packages in catkin_ws/src:

Something like:

git clone https://github.com/ros-perception/image_pipeline.git
git clone https://github.com/ros-perception/image_transport_plugins.git
git clone https://github.com/ros-perception/vision_opencv.git
git clone https://github.com/ros-visualization/rqt_image_view.git
etc...
  • build with your OpenCV version:

Go to your catkin_ws:

catkin_make VERBOSE=1 -j4 -DCMAKE_BUILD_TYPE=Release --cmake-args -DOpenCV_DIR=~/src/opencv4/build/install

If you want to use an OpenCV version different than the one shipped with ROS:

  • do it at your own risks and understand the consequences of the following instructions
  • your ROS program cannot use OpenCV 4 and in the same time use ROS image_transport that uses OpenCV 3.3.1, so you have to uninstall anything that is related to OpenCV 3.3.1 in ROS and build everything with the same OpenCV version
  • build your OpenCV version and use as CMAKE_INSTALL_PREFIX a local directory, e.g.: ~/src/opencv4/build/install
  • uninstall ROS-Kinetic-Opencv (of course assuming ROS Kinetic here): sudo apt-get remove ros-kinetic-opencv3
  • write the names of ROS packages that depend on ros-kinetic-opencv3 and that will be uninstalled
  • git clone the missing ROS packages in catkin_ws/src:

Something like:

git clone https://github.com/ros-perception/image_pipeline.git
git clone https://github.com/ros-perception/image_transport_plugins.git
git clone https://github.com/ros-perception/vision_opencv.git
git clone https://github.com/ros-visualization/rqt_image_view.git
etc...
  • build with your OpenCV version:

Go to your catkin_ws:

catkin_make VERBOSE=1 -j4 -DCMAKE_BUILD_TYPE=Release --cmake-args -DOpenCV_DIR=~/src/opencv4/build/install

If you want to use an OpenCV version different than the one shipped with ROS:

  • do it at your own risks and understand the consequences of the following instructions
  • your ROS program cannot use OpenCV 4 (any different OpenCV version than the one in ROS) and in the same time use ROS image_transport that uses OpenCV 3.3.1, so you have to uninstall anything that is related to OpenCV 3.3.1 in ROS and build everything with the same OpenCV version
  • build your OpenCV version and use as CMAKE_INSTALL_PREFIX a local directory, e.g.: ~/src/opencv4/build/install
  • uninstall ROS-Kinetic-Opencv (of course assuming ROS Kinetic here): sudo apt-get remove ros-kinetic-opencv3
  • write the names of ROS packages that depend on ros-kinetic-opencv3 and that will be uninstalled
  • git clone the missing ROS packages in catkin_ws/src:

Something like:

git clone https://github.com/ros-perception/image_pipeline.git
git clone https://github.com/ros-perception/image_transport_plugins.git
git clone https://github.com/ros-perception/vision_opencv.git
git clone https://github.com/ros-visualization/rqt_image_view.git
etc...
  • build with your OpenCV version:

Go to your catkin_ws:

catkin_make VERBOSE=1 -j4 -DCMAKE_BUILD_TYPE=Release --cmake-args -DOpenCV_DIR=~/src/opencv4/build/install