cv_bridge: reading distance from /camera/depth/image_raw
Hi, I'm running an turtlebot simulation on gazebo. roslaunch turtlebot_gazebo myrobot.launch
I subscribed to the topic /camera/depth/image_raw
to get the distance information using code
def get_distance(img):
#calculate x and y
bridge=CvBridge()
cv_image = bridge.imgmsg_to_cv2(img, "passingthrough")
print cv_image[x,y]
rospy.Subscriber('/camera/depth/image_raw',Image,get_distance)
according to the document,
depth/image_raw (sensor_msgs/Image)
Raw image from device. Contains uint16 depths in mm.
But I keep geting float numbers between 0 and 5.
Then I tried several other converting types besides "passthrough"
32FC1 gave me a complex number.
32SC1 gave me a large negative number.
16UC1 usually gave me 0.
16SC1 and 8UC1 gave me contant 5.
none of them makes sense, can anyone give me some idea? Thanks.