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

Trouble trying to subscribe to roslibjs node and show with OpenCV

asked 2020-07-08 08:25:43 -0600

サイトダニエロ gravatar image

I'm following RosLibJs Video Publishing with CV_bridge tutorial to read images from mobile camera to show them in openCV in server and I'm with two problems: First is that for some reason the camera does not work into smartphone (using Vivaldi browser) . Second: when opening into computer's browser (also vivaldi) the node into WebSocket used to communicate with server send Base64 images but when I "rostopic echo /camera/image/compressed " in the server it shows 0-255 numbers that keep the same even if I block with thumb or release the camera. I suspect that is the cause of OpenCV visualizer crash opening in the subscriber into the server. I would like some help to these two problems that I suspect that are related, reason why I publish in same question. Want to understand better what is happening here.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-07-08 15:55:42 -0600

サイトダニエロ gravatar image

I figured it out and I think this should be better explained, one parameter was missing in the subscriber in the server, image_sub_ = it_.subscribe("/camera/image", 1, &ImageConverter::imageCb, this, image_transport::TransportHints("compressed")); which this part: image_transport::TransportHints("compressed") is important to make they both (publisher and subscriber) interact with compressed image. I was trying to figure out the problem and messed up the code which I managed to go back to what is in the tutorial, more or less. There is a problem in the tutorial of publishing image with RosLibJs because that method of get the camera is deprecated, as I could se, as well as the method of closing and releasing it.

edit flag offensive delete link more


Lol, I've figured out and need more points to declare this my answer :c, but ok

サイトダニエロ gravatar image サイトダニエロ  ( 2020-08-06 12:55:39 -0600 )edit

Question Tools

1 follower


Asked: 2020-07-08 08:25:43 -0600

Seen: 128 times

Last updated: Jul 08 '20