[#06] Statistical Outlier Removal Filter ์ ์ฉํ๊ธฐ
Statistical Outlier Removal Filter๋ฅผ ์ฌ์ฉํด๋ณด์
์ ์ฒด ์ฝ๋
#include <iostream>
#include <pcl/io/pcd_io.h> // pcl::PCDReader, pcl::PCDWriter ์ฌ๊ธฐ ํฌํจ
#include <pcl/point_types.h> // PassThrough, VoxelGrid ์ฌ๊ธฐ ํฌํจ
#include <pcl/filters/statistical_outlier_removal.h> // StatisticalOutlierRemoval ์ฌ๊ธฐ ํฌํจ
using namespace std;
int main(int argc, char** argv)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
pcl::PointCloud<pcl::PointXYZ>::Ptr cloudFiltered (new pcl::PointCloud<pcl::PointXYZ>);
// // Read the pcd file
pcl::PCDReader reader;
reader.read("../data/table_scene_lms400.pcd", *cloud);
// Create filtering obejct
pcl::StatisticalOutlierRemoval<pcl::PointXYZ> sor;
sor.setInputCloud(cloud);
sor.setMeanK(50);
sor.setStddevMulThresh (1.0);
sor.filter(*cloudFiltered);
// Write
pcl::PCDWriter writer;
writer.write("../data/table_scene_lms400_inlier.pcd", *cloudFiltered, false);
sor.setNegative(true);
sor.filter(*cloudFiltered);
writer.write("../data/table_scene_lms400_outlier.pcd", *cloudFiltered, false);
return 0;
}
Leave a comment