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

Publishing compressed images directly for 120fps streaming

asked 2016-08-02 07:02:12 -0600

Rouno gravatar image

updated 2016-08-03 04:47:43 -0600

Hi,

I have a usb camera able to out mjpeg up to 120fps. I would like to send this video stream over a wifi network to a remote node. So far using image_raw/compressed topic re-encode video stream and thus poorly optimal for my purpose.

According to http://wiki.ros.org/compressed_image_... :

"a quick and dirty approach is to simply copy the JPEG data into a sensor_msgs/CompressedImage message and publish it on a topic of the form image_raw/compressed"

But this is "dirty" and may not be the best way to do it. What do you think ?

Thanks

edit retag flag offensive close merge delete

Comments

To be more specific, I run usb_cam driver and would like to stream mjpeg camera output to a remote node based on my camera framerate

Rouno gravatar image Rouno  ( 2016-08-02 12:56:27 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-08-02 11:11:11 -0600

ahendrix gravatar image

updated 2016-08-03 11:19:29 -0600

The ROS driver for your camera should have a parameter or a dynamic_reconfigure option to adjust the frame rate.

Without knowing which camera you're using or which ROS driver you're using, I can't provide more specific advice.

UPDATE

The usb_cam driver decodes the image and passes it directly to the image_transport publisher, so it isn't passing mjpeg images through directly.

The "quick and dirty" approach mentioned by the compressed_image_transport page is dirty because it only publishes compressed images, and doesn't provide the uncompressed images that most other ROS nodes expect.

If you really want compressed images directly from the camera you'll have to modify the source for the usb_cam driver or write a new camera driver. You'll probably want to stop using the image_transport library and implement image transport yourself, either:

  • Do the "quick and dirty" solution, and publish directly to the compressed image topic
  • Publish directly on the compressed topic, and decompress the image and publish a copy to the image_raw topic.
edit flag offensive delete link more

Comments

Thanks for the answer I have no problem changing usb_cam/image_raw framerate. My issue is on the compressed topic of it (through image_transport plugin)

I would like to stream the 120fps mjpeg stream to a remote node but it seems that ros is re-encoding the usb camera output at a fixed framerate

Rouno gravatar image Rouno  ( 2016-08-02 12:54:16 -0600 )edit

Yes; a quick read of the usb_cam source confirms that it is decoding the incoming data and sending it through the image_transport publisher, which does its own compression. I don't see any obvious places where the code might be limiting the frame rate. Perhaps it's just limited on CPU cycles?

ahendrix gravatar image ahendrix  ( 2016-08-02 13:33:47 -0600 )edit

I will have a look on my cpu performance indeed. But in any case, shouldn't we be able to send directly mjpeg from a camera on the network without re encoding overhead ? There are few words about this in the last section of image compressed plugin wiki but I'm not dure it's the right way to do it

Rouno gravatar image Rouno  ( 2016-08-02 18:52:03 -0600 )edit

I have edited the topic title and content to be more specific

Rouno gravatar image Rouno  ( 2016-08-03 04:48:05 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2016-08-02 07:02:12 -0600

Seen: 1,522 times

Last updated: Aug 03 '16