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

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

asked 2019-10-31 15:27:08 -0500

Heelbruise gravatar image

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!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-10-31 16:36:23 -0500

ahendrix gravatar image

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.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-10-31 15:27:08 -0500

Seen: 368 times

Last updated: Oct 31 '19