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

How to convert CompressedImage to Image?

asked 2017-02-18 10:37:17 -0600

baozhang gravatar image

I would like to convert CompressedImage to Image.

rosrun image_transport republish raw in:=/image_raw  compressed out:=/image_raw_converted

Then, I could got image_raw_converted which is CompressedImage and 1/10 data size. I would like to use image_raw_converted as Image. So,

rosrun image_transport republish compressed in:=/image_raw_converted raw out:=/image_raw_converted2

However, the data size increases by 10 times.

Is there any way to convert CompressedImage to Image and also decrease the data size?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-02-20 03:10:13 -0600

tushar gravatar image

No. Compression is the way to reduce the size of the data footprint while recording data. This is the principle that governs video data as well, known as codec. The actual data of a recorded movie is lot larger than the one you stream or watch on your computer.

I believe that ros does a pretty good job of compressing incoming image data and hence you see a bloat in the image size when you decompress it frame by frame. You can read the source code of compressions here

If you want to compress it further I would recommend use ros to generate all the images and then compress everything using a video codec using ffmpeg. There is information about that on this stack overflow question.

edit flag offensive delete link more

Comments

Thank you for replying.

I would like to ask that it is possible to convert the image in type of CompressedImage into the image in type of Image.

baozhang gravatar image baozhang  ( 2017-02-21 05:38:30 -0600 )edit

Image view is the package you are looking for. It will let you subscribe to the topic that is publishing images and save the output to files.

tushar gravatar image tushar  ( 2017-02-21 21:15:59 -0600 )edit
2

Is there any method for converting sensor_msgs/image data to sensor_msgs/CompressedImage?

anonymous userAnonymous ( 2019-04-02 01:16:12 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2017-02-18 10:37:17 -0600

Seen: 5,138 times

Last updated: Feb 20 '17