Robotics StackExchange | Archived questions

ROS image to PNG but as an object in the program, not to disk.

Hello!

I am subscribing to a ROS Image topic. I need to take the ROS Image object, convert it to a .png and use it in a REST API client call (so I don't need to save it to disk). How can I transform the ROS Image to png in the program?

Thanks!

Asked by Heelbruise on 2019-10-31 15:27:08 UTC

Comments

Answers

You should be able to use the cv_bridge package to convert an image to an OpenCV cv::Mat, and from there you can use cv::imencode to encode the image into PNG format.

I'm not sure how you would pass that to a REST API, but I assume the REST library that you're using will have documentation which covers that.

Asked by ahendrix on 2019-10-31 16:36:23 UTC

Comments