Ask Your Question
0

sensor_msgs/Image data to sensor_msgs/CompressedImage data

asked 2019-04-02 01:31:15 -0500

Bryant gravatar image

updated 2019-04-02 01:32:26 -0500

I have an industrial camera (DVP interface), and I added some code in the driver to convert the cv image into ros image data. I want to use this camera to test the fiducials package. But it needs to subscribe to a sensor_msgs/CompressedImage topic, and now the driver can only provide the sensor_msgs/Image topic. Is there any way to convert the sensor_msgs/Image data into sensor_msgs/CompressedImage data?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-04-02 02:39:52 -0500

gvdhoorn gravatar image

Is there any way to convert the sensor_msgs/Image data into sensor_msgs/CompressedImage data?

yes: the republish node of the image_transport package can convert between uncompressed and compressed images (between any registered transports actually).

Note: this will incur overhead, as it subscribes, compressed and then publishes messages.

edit flag offensive delete link more

Comments

Thank you! It solved my problem. This is my method:rosrun image_transport republish raw in:=/usb_cam/image_raw compressed out:=/usb_cam/image_raw. Before use this node, ros-$ROS_DISTRO-image-transport and ros-$ROS_DISTRO-image-transport-plugins should be installed.

Bryant gravatar imageBryant ( 2019-04-02 07:37:54 -0500 )edit
out:=/usb_cam/image_raw

is that correct, or a typo?

I would not publish on the exact same topic. Or does republish add a subtopic (ie: /usb_cam/image_raw/compressed)?

gvdhoorn gravatar imagegvdhoorn ( 2019-04-02 07:39:51 -0500 )edit

Because my camera driver will only generate a usb_cam/image_raw topic, and image_transport node will generate a new topic usb_cam/image_raw/compressed based on the parameter compressed of out.

Bryant gravatar imageBryant ( 2019-04-02 07:50:07 -0500 )edit

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-04-02 01:31:15 -0500

Seen: 375 times

Last updated: Apr 02