0
$\begingroup$

Rosanswers logo

Hi,

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 http://wiki.ros.org/pcl_ros 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: http://i.imgur.com/X4U1yE1.png
    image description
  2. Point cloud in saved pcd file using pcl_viewer : http://i.imgur.com/pvNcraQ.png
    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.


Originally posted by asidd on ROS Answers with karma: 11 on 2015-01-19

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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: http://docs.ros.org/groovy/api/pcl_ros/html/pointcloud__to__pcd_8cpp_source.html.

You will have to change line 0084 of this code from

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

to

 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.


Originally posted by asidd with karma: 11 on 2015-06-16

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

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