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

Use local library (i.e. OpenCV, Image transport)

asked 2022-04-23 02:40:58 -0600

camilo.chiang gravatar image

My apologies if this is a basic question, but im new to ROS. I have in my PC a from source installation of OpenCV that I would like to use in ROS. How do I tell ROS that there is an existing OpenCV in my PC and that should like ros-melodic-opencv to this version? Also in a similar way, I would like to use a modified image_transport_plugin that is in my catkin_space (and compile without problems), but im not sure how to tell ROS to use this version and not the default one. I guess that once the workspace is active should be enough no?

Thanks in advance!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2022-04-23 09:48:25 -0600

Mike Scheutzow gravatar image

updated 2022-04-23 09:52:23 -0600

You can not easily use a different version of opencv than the one the ros developers chose for that ros-release. It requires that you build all the ros packages that depend on opencv (& you want to use) from source code. Then you may discover that the opencv devs changed the opencv API, so the existing ros packages produce compile errors.

It's not a simple process. Most people find it easier to upgrade to a later version of ros that already uses a "good enough" version of opencv.

edit flag offensive delete link more

Comments

Thanks Mike! Didn't think about that. I guess that you can use your version of opencv for the packages that you build as mentioned in my answer no?

camilo.chiang gravatar image camilo.chiang  ( 2022-04-23 09:54:49 -0600 )edit
0

answered 2022-04-23 09:41:18 -0600

camilo.chiang gravatar image

updated 2022-04-23 09:43:25 -0600

Never mind. About using a local resource as opencv : You can set the DIR in your CMakeLists.txt and check it later
set(OpenCV_DIR "/home/ubuntu/Others/opencv-3.4.16/build") and message(WARNING "OpenCV_VERSION: ${OpenCV_VERSION}")

About using a local library: Well explained here . basically when you source your catkin_workspace, your package should have priority. Thanks in any case!

edit flag offensive delete link more

Comments

You don't say which ros packages you want to use, but changing opencv version is rarely that simple.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-04-23 09:50:17 -0600 )edit

Yes, I guess that my question was a bit unclear. Im not thinking to change the already existing packages, only my package :)

camilo.chiang gravatar image camilo.chiang  ( 2022-04-23 09:56:24 -0600 )edit

You will need to do an experiment to see if it works. Consider yourself lucky if it does - it is more likely you will have fatal library conflicts that cause ros nodes to not run.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-04-23 12:09:09 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2022-04-23 02:40:58 -0600

Seen: 125 times

Last updated: Apr 23 '22