Use local library (i.e. OpenCV, Image transport)
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 imagetransportplugin 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!
Asked by camilo.chiang on 2022-04-23 02:40:58 UTC
Answers
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!
Asked by camilo.chiang on 2022-04-23 09:41:18 UTC
Comments
You don't say which ros packages you want to use, but changing opencv version is rarely that simple.
Asked by Mike Scheutzow on 2022-04-23 09:50:17 UTC
Yes, I guess that my question was a bit unclear. Im not thinking to change the already existing packages, only my package :)
Asked by camilo.chiang on 2022-04-23 09:56:24 UTC
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.
Asked by Mike Scheutzow on 2022-04-23 12:09:09 UTC
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.
Asked by Mike Scheutzow on 2022-04-23 09:48:25 UTC
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?
Asked by camilo.chiang on 2022-04-23 09:54:49 UTC
Comments