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

pcl_ros pointcloud_to_pcd using kinect gives red patches in the .pcd file

asked 2015-01-19 19:02:52 -0500

asidd gravatar image

updated 2015-06-16 16:29:17 -0500

lucasw gravatar image


I am trying to extract the point cloud2 topic from a kinect and save it as a PCD file. I was following the tutorials from to convert a sensor_msgs/PointCloud2 topic to a .pcd file. I found the section 4.5 pointcloud_to_pcd in that link to be useful in this case.

I ran :

roslaunch openni2_launch openni2.launch depth_registration:=true

followed by :

rosrun pcl_ros pointcloud_to_pcd input:=/camera/depth_registered/points

However, when I visualized the resulting pcd file using pcl_viewer I saw numerous red patches which were not present when I was visualizing the pointcloud in rviz. I'm fairly new to ROS at this point , so I'm not really sure where these red patches are coming from.

Here are the pictures of the two sample point clouds for reference(I have low karma so I am uploading it on imgur)

  1. Point cloud (camera/depth_registered/points) in rviz:
    image description
  2. Point cloud in saved pcd file using pcl_viewer :
    image description

As seen from the first picture, the kinect seems to be working fine, however the pcd file is missing some of the color information. My Ubuntu Distribution is Ubuntu 14.04 and my ROS version is indigo. My graphics card is Nvidia GTX 860 and my processor is Intel® Core™ i7-4710HQ CPU @ 2.50GHz × 8 . Any help in this matter would be appreciated.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2015-06-16 11:20:02 -0500

asidd gravatar image

updated 2015-06-16 16:12:12 -0500

I believe I found a solution to the problem. The problem arises when the point cloud is converted to a .pcd file in ASCII format. If you convert the pointcloud to a Binary format, the red patches should not appear. Here is the source file I found for the pointcloud_to_pcd node: .

You will have to change line 0084 of this code from

 pcl::io::savePCDFile (ss.str (), *cloud, Eigen::Vector4f::Zero (),
                    Eigen::Quaternionf::Identity (), false);


 pcl::io::savePCDFileBinary (ss.str (), *cloud, Eigen::Vector4f::Zero (),
                    Eigen::Quaternionf::Identity (), false);

Once you change that line, you can build this node and run it. The red patches should not appear anymore.

edit flag offensive delete link more

answered 2015-06-15 09:43:57 -0500

-edith- gravatar image

I have the same problem. Did you find a solution?

edit flag offensive delete link more


In the end I wrote my own node to save point clouds and I also used the binary format, which solves the problem.

-edith- gravatar image -edith-  ( 2015-06-18 09:53:29 -0500 )edit

Question Tools



Asked: 2015-01-19 19:02:52 -0500

Seen: 1,591 times

Last updated: Jun 16 '15