0
$\begingroup$

Rosanswers logo

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_transport :

"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


Originally posted by Rouno on ROS Answers with karma: 68 on 2016-08-02

Post score: 0


Original comments

Comment by Rouno on 2016-08-02:
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

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.

Originally posted by ahendrix with karma: 47576 on 2016-08-02

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Rouno on 2016-08-02:
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

Comment by ahendrix on 2016-08-02:
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?

Comment by Rouno on 2016-08-02:
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

Comment by Rouno on 2016-08-03:
I have edited the topic title and content to be more specific

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.