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

Differences between Image and CompressedImage message types

asked 2022-02-25 10:44:20 -0500

davide.cremona gravatar image

updated 2022-02-26 09:44:43 -0500


I'm building a deep learning pipeline for robotics where

  1. an image is read from camera (using the package cv_camera)
  2. A node I wrote is reading the /cv_camera/image_raw topic and make inference using a Segmentation CNN.
  3. Then the segmented image is published to the rest of the pipeline.

I want to ask to the community what is more heavy in terms of CPU usage between these two options:

  • publish and read the segmented image as a CompressedImage message type
  • publish and read the segmented image as an Image message type

I'm using cv_bridge to convert images from ROS to OpenCV in Python.

I think CompressedImage is heavier due to the compression step. Am I right?

Thank you

edit retag flag offensive close merge delete


Please give us more description about what you are trying to do. The site guidelines discourage us from answering homework questions.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-02-26 08:17:54 -0500 )edit

I've modified the question. I'm asking this for a job-related task and not for homeworks :)

davide.cremona gravatar image davide.cremona  ( 2022-02-26 09:45:20 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-02-26 12:09:22 -0500

Mike Scheutzow gravatar image

The Compressed Image is not necessarily heavier for the system, because there is a tradeoff between:

  • image size & pixel depth
  • CPU usage on the robot
  • bandwidth off the robot
  • CPU usage on some more powerful server machine

If you have enough CPU on the robot to do compression (or especially if the camera already does it for you), then the Compressed Image can work better overall. I would advise you to look for ways to transport the image data NOT using ROS topics - in my experience, they are not really designed for efficient high-bandwidth data transfer.

edit flag offensive delete link more

Question Tools



Asked: 2022-02-25 10:44:20 -0500

Seen: 556 times

Last updated: Feb 26 '22