Ask Your Question

How to convert point cloud without RGB field to depth image ?

asked 2013-05-28 08:52:42 -0500

sai gravatar image

updated 2014-01-28 17:16:41 -0500

ngrennan gravatar image

ubuntu 12.04 and fuerte

I want to convert sensor_msgs::PointCloud2 message to sensor_msgs::Image and the point cloud does not have the RGB field. It only has X Y Z fields.

I saw the CloudtoImage tutorial and when I tried to run it needs the RGB field, or else its resulting in error.

The point cloud is from kinect and I saw depth_img_proc nodelet which uses the camera parameters to convert the depth image to point cloud.

I want something which exactly does opposite to that using the camera parameters.

Is there anything which is already implemented ?

edit retag flag offensive close merge delete



how are u getting the point cloud, are u using a kinect, or stereo-vision? Because you can usually get both. PointCloud2 is coloured and point cloud is uncoloured

Sentinal_Bias gravatar image Sentinal_Bias  ( 2013-05-28 21:58:12 -0500 )edit

I get the kinect point cloud, then extract some keypoints of PointXYZ using PCL. Now I want to get the corresponding u,v positions on the depth image of the original pointcloud. Thus I converted the PCL PointXYZ to sensor_msgs::PointCloud2 .I m struck on how to find corresponding u,v on depth image

sai gravatar image sai  ( 2013-05-28 22:49:17 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-05-28 11:31:58 -0500

ebeowulf gravatar image

updated 2013-05-28 11:32:16 -0500

If you have the depth image already... why don't you just use that, and then calculate the X and Y coordinates yourself from the camera parameters.

X = (columns from center) * depth / focal_length

Y = (rows from center) * depth / focal_length

You can either store the camera focal length in your program, or retrieve it from the /camera_info topic.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-05-28 08:52:42 -0500

Seen: 2,333 times

Last updated: May 28 '13