点云滤波继承自Filter模板类
注意Filter类的filter 方法调用了虚方法applyFilter:
1 inline void filter (PointCloud &output) 2 { 3 if (!initCompute ()) 4 return; 5 6 if (input_.get () == &output) // cloud_in = cloud_out 7 { 8 PointCloud output_temp; 9 applyFilter (output_temp); 10 output_temp.header = input_->header; 11 output_temp.sensor_origin_ = input_->sensor_origin_; 12 output_temp.sensor_orientation_ = input_->sensor_orientation_; 13 pcl::copyPointCloud (output_temp, output); 14 } 15 else 16 { 17 output.header = input_->header; 18 output.sensor_origin_ = input_->sensor_origin_; 19 output.sensor_orientation_ = input_->sensor_orientation_; 20 applyFilter (output); 21 } 22 23 deinitCompute (); 24 }
ApproximateVoxelGrid进行点云Filter
效果图:
原始点云66901个点,点云平均距离0.038253,采样参数(Grid size 0.2)后点云数目11924