KEMBAR78
Adding QOI compression support for ROS1 by awesomebytes · Pull Request #103 · ros-perception/image_transport_plugins · GitHub
Skip to content

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?

@ijnek
Copy link
Member

ijnek commented May 24, 2025

I am closing ROS 1 PRs that add features as Noetic EOL approaches.

Apologies I didn't get around to reviewing this PR earlier, as peci1 said this repo was very inactive before I became voluntary maintainer for the ros2 packages. If this is still of interest to the community, please consider re-opening a PR against the rolling branch.


EDIT: Apologies, I already see a PR against the rolling branch!

@ijnek ijnek closed this May 24, 2025
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.

4 participants