Ask Your Question
0

Opencv installation, usage with and without ROS

asked 2016-06-07 12:26:53 -0600

skr_robo gravatar image

Hello, I have OpenCV 2.4.8 which was installed along with ROS Indigo on an Ubuntu 14.04. My project requires use of OpenCV 2.4.9. I have limited understanding of how this installation works. I have seen a few questions and answers related to this. But it is still not clear to me. So, I have a few questions:

  1. Can I install OpenCV 2.4.9 by following the normal installation method? If I do so will it break the version (2.4.8) linked with ROS Indigo?

  2. If I get OpenCV 2.4.9 installed, how can I get it to work with ROS Indigo? Also, once linked how to get it back in standalone mode?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2016-06-07 12:37:18 -0600

It is possible to work with both versions of the library parallel, but it would not be recomendable because you have to pay some extra attention to possible issues related with it.

You can do it in many ways. One of them would be to download the code of the exact version you want, compile it and deploy/install it for instance in /usr/local. Then you will be able to link your code to this version of opencv (using cmake and the CMakeList.txt file), while you are linked at the same time to other indigo libraries that may depend to the original 2.4.8 version of opencv.

edit flag offensive delete link more

Comments

Thank you for the reply. Can you pls tell me how to edit CMakeLists.txt so that ROS uses OpenCV 2.4.9

skr_robo gravatar imageskr_robo ( 2016-06-09 15:53:59 -0600 )edit

The ROS libraries and executable come already linked to a specific (and not changeable opencv library). However, for your custom code you can select the version of opencv in cmake. One thing you have todo is: FIND_PACKAGE(OpenCV 2.4.8 EXACT REQUIRED)

Pablo Iñigo Blasco gravatar imagePablo Iñigo Blasco ( 2016-06-10 02:50:44 -0600 )edit

Additionally you have to enable cmake reach the development libraries you are going to use. It can be done in many ways, for instance you can set the OPENCV_DIR cmake variable (through the CMakeFileLists.txt or using the cmake -DOPENCV_DIR or configuring the build with ccmake)

Pablo Iñigo Blasco gravatar imagePablo Iñigo Blasco ( 2016-06-10 02:52:55 -0600 )edit

All this is possible but you should study how Cmake works here and how the operative system works in terms of library loading and how C++ libraries are linked... otherwise you may find problems or situations that you may not understand

Pablo Iñigo Blasco gravatar imagePablo Iñigo Blasco ( 2016-06-10 02:54:21 -0600 )edit

To make ROS work directly with one specific version you will have to compile ROS from sources or find a precompiled version (hydro, indigo, jade, etc.) that is linked with the version of opencv you want.

Pablo Iñigo Blasco gravatar imagePablo Iñigo Blasco ( 2016-06-10 03:47:00 -0600 )edit

Thank You for the guidance. I will start developing an understanding of cmake.

skr_robo gravatar imageskr_robo ( 2016-06-10 16:22:59 -0600 )edit
0

answered 2016-06-07 15:08:29 -0600

Maya gravatar image

updated 2016-06-07 15:31:44 -0600

_EDIT : If someone could confirm this because I'm not so sure_

I would like to add some info the previous answer you got.

It is my understanding that openCV on indigo is a thrid party app and thus does not depend on ros itself. It is the version your Ubuntu installation (if you are Ubuntu) is shipping.

Thus, if I am correct, if you want a specific version, just download it and install it from source. CMake should take care of the rest once it is installed :). You do not need to get it back into standalone mode.

Working with both version in parallel is not recommended because it might lead to some issue when trying to compile and link.

This is not true for kinetic.

edit flag offensive delete link more

Comments

Thank You for the reply.

skr_robo gravatar imageskr_robo ( 2016-06-13 11:24:30 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-06-07 12:26:53 -0600

Seen: 617 times

Last updated: Jun 07 '16