ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
![]() | 1 | initial version |
The more general way (i.e. for all type of messages), which also avoids the detour over cv.Mat, and should work fine for opencv today, as opencv now uses numpy arrays in the new cv2 interface is described here:
http://www.ros.org/wiki/rospy_tutorials/Tutorials/numpy
You basically tell ros to use the serialize/deserialize_numpy methods by adding numpy_msg() around the message type. Which means your subscription should look like:
[code] from rospy.numpy_msg import numpy_msg ... sub_vis = rospy.Subscriber('navbot/camera/image',numpy_msg(Image),vis_callback)[/code]
and then data.data should be an numpy.array.