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 -0600

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 -0600

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 12 times

Last updated: Oct 31