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

Revision history [back]

click to hide/show revision 1
initial version

You can know the know the distance of each point in the world from the camera centered co-ordinate frame. Just subscribe to the topic /camera/depth/points . It is a sensor_msgs::PointCloud2 topic where you have points with [x, y, z] distance from the camera centered coordinate frame.

The package depth_image_proc implements the method to convert the depth image to point cloud [x, y, z] format. Going through the internals of this package can help you in understanding more on how the image is converted to point cloud.

To completely understand and gain access to each point in the point cloud, you need to understand basics of point cloud library and point cloud format. This can be learnt from

http://wiki.ros.org/pcl/Tutorials

http://wiki.ros.org/pcl

You can know the know the distance of each point in the world from the camera centered co-ordinate frame. Just subscribe to the topic /camera/depth/points . It is a sensor_msgs::PointCloud2 topic where you have points with [x, y, z] distance from the camera centered coordinate frame.

The package depth_image_proc implements the method to convert the depth image to point cloud [x, y, z] format. Going through the internals of this package can help you in understanding more on how the image is converted to point cloud.

To completely understand and gain access to each point in the point cloud, you need to understand basics of point cloud library and point cloud format. This can be learnt from

http://wiki.ros.org/pcl/Tutorials

http://wiki.ros.org/pcl

EDIT 1 :

Here is something which can be done. First convert the 32

const std::string& enc = depth_msg->encoding;

if (enc.compare("16UC1") == 0)

depth_img = cv_bridge::toCvShare(depth_msg)->image;

else if (enc.compare("32FC1") == 0)

depthImageFloatTo16bit(cv_bridge::toCvShare(depth_msg)->image, depth_img);

// get raw z value (in mm) uint16_t z_raw = depth_img.at<uint16_t>(v, u);

// z [meters] z_mean = z_raw * 0.001;

Look here for better understanding : http://docs.ros.org/groovy/api/ccny_rgbd/html/rgbd__frame_8cpp_source.html

Go through in detail and you can completely find what you are asking for.

You can know the know the distance of each point in the world from the camera centered co-ordinate frame. Just subscribe to the topic /camera/depth/points . It is a sensor_msgs::PointCloud2 topic where you have points with [x, y, z] distance from the camera centered coordinate frame.

The package depth_image_proc implements the method to convert the depth image to point cloud [x, y, z] format. Going through the internals of this package can help you in understanding more on how the image is converted to point cloud.

To completely understand and gain access to each point in the point cloud, you need to understand basics of point cloud library and point cloud format. This can be learnt from

http://wiki.ros.org/pcl/Tutorials

http://wiki.ros.org/pcl

EDIT 1 :

Here is something which can be done. First convert the 32

const std::string& enc = depth_msg->encoding;

if (enc.compare("16UC1") == 0)

depth_img = cv_bridge::toCvShare(depth_msg)->image;

else if (enc.compare("32FC1") == 0)

depthImageFloatTo16bit(cv_bridge::toCvShare(depth_msg)->image, depth_img);

// get raw z value (in mm)

uint16_t z_raw = depth_img.at<uint16_t>(v, u);

// z [meters]

z_mean = z_raw * 0.001;

Look here for better understanding : http://docs.ros.org/groovy/api/ccny_rgbd/html/rgbd__frame_8cpp_source.html

Go through in detail and you can completely find what you are asking for.