Hello, I am trying to find the closest object to a zed camera. I am using the package: zed_wrapper. I need to find the depth (z value) of each pixel in the scene. My understanding is that the topic:
/camera/depth/image_rect_color
will provide me the required information. The command rostopic type /camera/depth/image_rect_color
returned
sensor_msgs/Image
which I believe is the msg type for depth images. The command rosmsg show sensor_msgs/Image
returned
std_msgs/Header header
uint32 seq
time stamp
string frame_id
uint32 height
uint32 width
string encoding
uint8 is_bigendian
uint32 step
uint8[] data
I believe that the last field:
uint8[] data
gives the actual info.
I believe that at this point, I should write a subscriber. Do I have enough information to write a subscriber? Is there any other way I can get this information without writing a subscriber? Kindly help. Thank You.
Originally posted by skr_robo on ROS Answers with karma: 178 on 2016-07-01
Post score: 0
Original comments
Comment by dinesh on 2016-07-06:
subscribe to sensor_msgs::PointCloud2 input, where input is your camera topic than convert it to pcl::PointCloudpcl::PointXYZRGB cloud, then make struct: PointXYZRGB p1, then access the z value as depth = p1.z where p1 = cloud.at(x,y), where (x,y) is pixel position of depth image.
Comment by skr_robo on 2016-07-06:
I am not looking to subscribe to point cloud at this stage. I just need depth values. I believe zed provides separate topic for depth alone without relying on topics related to point cloud.