Search code examples
c++visual-studiofilterkinectpoint-cloud-library

Using Fast Bilateral Filter in Point Cloud Library


I am trying to apply a bilateral filter to smooth 2 point clouds for registration. Code is below:

pcl::FastBilateralFilter<pcl::PointXYZRGB> filter;
filter.setInputCloud(input);
filter.setSigmaS(5);
filter.setSigmaR(5e-3);
filter.applyFilter(*output);

The result is an empty point cloud, and I can't seem to figure out why. Other people have used this approach with good success. I have tried manipulating my SigmaS and SigmaR values based on what I found in this paper (http://people.csail.mit.edu/sparis/bf_course/course_notes.pdf), but there is no change in the output. Any thoughts on why this is? Thank-you.


Solution

  • My input cloud was messed up in the sense that it was not an "organized point cloud"; that is, there was not a relationship between two given points in my Point Cloud. The Bilateral Filter in PCL requires the input point cloud to be organized. Click here for more info.

    Since I am using the Kinect v2, I have the ability to generate organized Point Clouds; and indeed, I initialized it to be organized. Somewhere later in my code, I used the cloud->clear() command which deleted all of the height, width, and isDense information in the Point Cloud; however, my original intention was to just delete the data points so I could add new points in.