0
$\begingroup$

Rosanswers logo

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 ?


Originally posted by sai on ROS Answers with karma: 1935 on 2013-05-28

Post score: 0


Original comments

Comment by Sentinal_Bias on 2013-05-28:
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

Comment by sai on 2013-05-28:
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

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by ebeowulf with karma: 100 on 2013-05-28

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.