Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding QOI compression support for ROS1 #103

Open
wants to merge 1 commit into
base: noetic-devel
Choose a base branch
from

Conversation

awesomebytes
Copy link

@awesomebytes awesomebytes commented Jul 24, 2022

The Quite OK Image format (https://qoiformat.org/) is a good substitute of PNG for lossless compression.

As per QOI's website:

QOI is fast. It losslessy compresses images to a similar size of PNG, while offering 20x-50x faster encoding and 3x-4x faster decoding

This commit adds it as a compressed image transport thanks to Dimitri Belopopsky's (@ShadowMitia) MIT Licensed
library (https://github.com/ShadowMitia/libqoi) implementing Dominic Szablewski's QOI algorithm (which is
CC0 licensed, public domain).

To give context, I implemented this to practice C++ and to provide an alternative to PNG compression for when we'd like lossless compression or to have an alpha channel without framerate drop. Currently using PNG drops a 640x480 webcam stream 30fps to 3fps. With QOI it stays at 30fps.
Taking as baseline raw image publishing with video_stream_opencv, and subscribing with rqt_image_view, on my i7-10875H CPU @ 2.30GHz × 16, QOI compression adds 28% CPU usage and QOI decompression adds 13% CPU usage. Feels reasonable to me, specially compared to PNG going over 100% CPU usage and dropping most of the frames.

I would gladly appreciate help on how to eliminate the (what I think is) unnecessary copy of the image in the publisher and the subscriber.

The Quite OK Image format (https://qoiformat.org/) is a good substitute of PNG for lossless compression.
This commit adds it as a compressed image transport thanks to Dimitri's Belopopsky (@ShadowMitia) MIT Licensed
library (https://github.com/ShadowMitia/libqoi) implementing Dominic Szablewski's QOI algorithm (which is
CC0 licensed, public domain).
@peci1
Copy link

peci1 commented Dec 12, 2022

This would probably have better impact as a standalone package that you'd release yourself. Getting anything in this library is most probably a year(s)-long run... In a standalone package, you could first prove practical usability of this compression, get feedback from users, and after that, its way to this "master" package could be easier. Feel free to post a link to the standalone package to this issue and mention it on discourse.ros.org.

@duda1202
Copy link

duda1202 commented May 12, 2023

This looks like an amazing addition. Would you help me set up? I was trying to use your version using qoi but I am having some issues regarding high resolution images. I have 8k images which are bayered and i would like to compress them as is. But qoi only allows 3 to 4 channels. Is this a qoi limitation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants