ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to combine a camera image and a laser pointcloud to create a color pointcloud?

asked 2013-11-09 01:18:34 -0600

SHPOWER gravatar image

updated 2013-11-18 19:00:19 -0600

tfoote gravatar image

Hey all,

I have a point cloud from my laser LMS100 and an Image from a camera both can be transformed to the same tf. How can I combine both image and a laser point cloud to create a colourful point cloud.

Thanks in advance

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-11-09 10:37:41 -0600

sudhanshu_mittal gravatar image

Yes, it is very much possible to combine DEPTH data from laser and RGB data from image to form a rgbd/color pointcloud using pcl library.

I hope you can define a x and y correspondence between each voxel of laser pointcloud and pixel from the image using tf. Given that laser pointcloud size and image size are same in x,y direction in case of kinect it is 640X480. While writing the combined pointcloud, use PointXYZRGB structure Following is a small example code:

  pcl::PointCloud<pcl::PointXYZRGB> cloud;
  uint8_t r = 255, g = 0, b = 0;    // Example: Red color
  uint32_t rgb = ((uint32_t)r << 16 | (uint32_t)g << 8 | (uint32_t)b);
  cloud.points[0].rgb = *reinterpret_cast<float*>(&rgb);

About how to write a simple pcd file, you can find it here

edit flag offensive delete link more


Thanks for the quick reply. How can I correspond between the laser and the camera. I believe I need to calibrate them. Is there any instructions for such calibration?

SHPOWER gravatar image SHPOWER  ( 2013-11-11 11:04:07 -0600 )edit

There are no such standard instructions available to calibrate as far as I know. I can explain how I would do such task: Suppose i have image of size 640X480 and laser pointcloud of the same size in xy direction, (min. Requirement). It is same in kinect data. . . The depth pointcloud is available as a matrix of dimension [cloud.SIZE()] x 1. i.e. height is 1 and length is equal to the total no. of points. . . . Through manual matrix handling (converting the pointcloud matrix to 640X480 matrix) I can trace the XYZ values from laser pointcloud and RGB values from image to the output color pointcloud of format PointXYZRGB.

sudhanshu_mittal gravatar image sudhanshu_mittal  ( 2013-11-11 11:59:36 -0600 )edit

@sudhanshu_mittal: Could you elaborate on this "Through manual matrix handling (converting the pointcloud matrix to 640X480 matrix)". From the depth pcd I have the cartesian coordinates (say 260 x-y points). What values would the 640x480 matrix elements have?

adirana gravatar image adirana  ( 2015-05-21 14:56:01 -0600 )edit

I am looking into doing something similar. Except I am using Velodyne VLP16 LiDAR. The laser point cloud and the image have different sizes. Do you have any pointers on how to calibration camera and LiDAR in such setup?

chukcha2 gravatar image chukcha2  ( 2016-07-12 19:20:35 -0600 )edit

Your Answer

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

Add Answer

Question Tools



Asked: 2013-11-09 01:18:34 -0600

Seen: 3,768 times

Last updated: Nov 10 '13