ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Using Python3 and cv_bridge with ROS Melodic

asked 2021-11-02 18:13:54 -0500

mros gravatar image

updated 2021-11-03 06:38:49 -0500

Mike Scheutzow gravatar image

Hi all, I am using ROS Melodic. And I want to use Python3 with OpenCV. In fact, I have a problem when I use imgmsg_to_cv2 (cv_bridge) with python3.6. I tried also to compile cv_bridge but I got an error because I am using OpenCV 4.2.1 . So, do I need to downgrade to OpenCV 3.2 ? Or there is someone who was able to compile cv_bridge and use imgmsg_to_cv2 with melodic+Python 3.6 + OpenCV 4.2.1? Thank you

edit retag flag offensive close merge delete


Not easy for sure. There is a question discussion you may want to refer:

osilva gravatar image osilva  ( 2021-11-02 18:25:11 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-11-02 20:01:43 -0500

Mike Scheutzow gravatar image

I advise you not to do this. The effort is somewhere between "difficult" and "impossible", depending on your skills. If you really need to use python3, then use the noetic release of ROS, along with opencv 4.2.0 that the ros repository requires that you use.

edit flag offensive delete link more


I have to use the melodic and Ubuntu 18.04 because I am using a NVIDIA plateform which oblige the using of this distribution, and does not support yet the Ubuntu 20.04.

mros gravatar image mros  ( 2021-11-02 20:22:44 -0500 )edit

That's not necessarily true.

Docker is a very viable way of running code with requirements which cannot be satisfied by the host system.

Another option could be singularity.

If you have libraries or binaries which must interact with the host FS or are integrated in some other way with it, using Docker becomes a bit more difficult, but it may still be worth it.

I would perhaps recommend to see how other people are using Docker with Jetsons/Xaviers/etc.

gvdhoorn gravatar image gvdhoorn  ( 2021-11-03 02:58:49 -0500 )edit

I tried the Docker, but I found that it is not suitable for my application. In fact, I am using a different sensors LIdar, CameraI, IMU...

mros gravatar image mros  ( 2021-11-03 04:15:00 -0500 )edit

It's perfectly possible to use devices on the host inside a container.

But if you're not comfortable with Docker yet, then you might want to try other approaches.

I just wanted to mention it (for future readers).

gvdhoorn gravatar image gvdhoorn  ( 2021-11-03 04:25:52 -0500 )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


Asked: 2021-11-02 18:13:54 -0500

Seen: 206 times

Last updated: Nov 02 '21