Ask Your Question

rosbridge image (uri-data)

asked 2012-05-21 05:20:14 -0500

BeuBeu gravatar image

Hello, I try to deal with a topic which type is sensor_msgs/Image. I want to display those messages in a webpage using rosbridge. As it's written here the json obejct contain an uri field. I created a canva and then drawed an image object containing this "uri field value" as source. I succeeded to connect to the topic because my handler is activated but i cant display the picture. Somebody already did something similar?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-05-21 06:14:12 -0500

rtoris288 gravatar image

Have you considered trying to use mjpeg_sever to stream images to your web page? This package takes advantage of browser optimizations by streaming ROS images in binary form. Take a look at the following wiki page which explains how to get it up and running:

edit flag offensive delete link more


I second this recommendation for general in-page image use. Treating images special has been deprecated (and thanks to you removed from the documentation). If you really want to still handle images "purely" with JS and rosbridge, you should look at wsview.js in the scripts directory.

tjay gravatar image tjay  ( 2012-05-21 19:03:51 -0500 )edit

Hello, Tjay, I looked your script. Just to clear my mind, your img argument in the display function is the json_object received by a rosbridge handler? I found a code handling the mono8 encoding; /trunk/experimental/ROSDojo

BeuBeu gravatar image BeuBeu  ( 2012-05-21 23:29:04 -0500 )edit

The object the display method expects is indeed the "raw" JSON object. Also, make sure to take a look at the rgb8 version. It's in the scripts directory of rosbridge itself.

tjay gravatar image tjay  ( 2012-05-22 18:51:28 -0500 )edit

OK It works !!!! I will try the mpeg_server because this solution is quite power consuming. (50-60% of the CPU if i ask for a topic at 200Hz).

BeuBeu gravatar image BeuBeu  ( 2012-05-22 23:32:23 -0500 )edit

Oh yeah. It's pretty terrible. Again, I recommend mjpeg_server unless you can get away with a tiny low framerate stream. I've had good luck with a 160x120 stream at 8HZ that I use the wsview.js script to upsize. It'll still hog your CPU more than a bit though.

tjay gravatar image tjay  ( 2012-05-23 03:17:43 -0500 )edit

My picture are 7752*480 published at 30 Hz. Both strategy works and own quite high CPU consuming.(50 %) Thanks you for your advices :)

BeuBeu gravatar image BeuBeu  ( 2012-05-23 06:02:35 -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


Asked: 2012-05-21 05:20:14 -0500

Seen: 935 times

Last updated: May 21 '12