statistical_removal.cpp
Go to the documentation of this file.
00001 #include <iostream>
00002 #include <pcl/io/pcd_io.h>
00003 #include <pcl/point_types.h>
00004 #include <pcl/filters/statistical_outlier_removal.h>
00005 
00006 int
00007 main (int argc, char** argv)
00008 {
00009   pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
00010   pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered (new pcl::PointCloud<pcl::PointXYZ>);
00011 
00012   // Fill in the cloud data
00013   pcl::PCDReader reader;
00014   // Replace the path below with the path where you saved your file
00015   reader.read<pcl::PointXYZ> ("table_scene_lms400.pcd", *cloud);
00016 
00017   std::cerr << "Cloud before filtering: " << std::endl;
00018   std::cerr << *cloud << std::endl;
00019 
00020   // Create the filtering object
00021   pcl::StatisticalOutlierRemoval<pcl::PointXYZ> sor;
00022   sor.setInputCloud (cloud);
00023   sor.setMeanK (50);
00024   sor.setStddevMulThresh (1.0);
00025   sor.filter (*cloud_filtered);
00026 
00027   std::cerr << "Cloud after filtering: " << std::endl;
00028   std::cerr << *cloud_filtered << std::endl;
00029 
00030   pcl::PCDWriter writer;
00031   writer.write<pcl::PointXYZ> ("table_scene_lms400_inliers.pcd", *cloud_filtered, false);
00032 
00033   sor.setNegative (true);
00034   sor.filter (*cloud_filtered);
00035   writer.write<pcl::PointXYZ> ("table_scene_lms400_outliers.pcd", *cloud_filtered, false);
00036 
00037   return (0);
00038 }


pcl
Author(s): Open Perception
autogenerated on Mon Oct 6 2014 03:18:09