๐Ÿ’ป
Tutorial
  • INTRO
  • Part 0 (๊ฐœ์š”)
    • README
    • 3D ์˜์ƒ์ฒ˜๋ฆฌ
    • [๋ณ„์ฒจ] PCL & PCD๋ž€ (100%)
    • chapter02 : PCL ์„ค์น˜ (100%)
    • chapter03 : ROS ์‹ค์Šต ์ค€๋น„(100%)
  • Part 1 (์ดˆ๊ธ‰)
    • README
    • PCL ๊ธฐ๋ฐ˜ ๋กœ๋ด‡ ๋น„์ ผ
    • [๋ณ„์ฒจ] ํŒŒ์ผ ์ƒ์„ฑ ๋ฐ ์ž…์ถœ๋ ฅ (70%)
      • PCL-Cpp (70%)
      • PCL-Python (70%)
      • Open3D-Python (70%)
      • ROS ์‹ค์Šต (90%)
    • Filter
    • [๋ณ„์ฒจ] ์ƒ˜ํ”Œ๋ง (70%)
      • ๋‹ค์šด์ƒ˜ํ”Œ๋ง-PCL-Cpp (70%)
      • ๋‹ค์šด์ƒ˜ํ”Œ๋ง-PCL-Python (50%)
      • ์—…์ƒ˜ํ”Œ๋ง-PCL-Cpp (70%)
      • ROS ์‹ค์Šต (90%)
    • [๋ณ„์ฒจ] ๊ด€์‹ฌ ์˜์—ญ ์„ค์ • (70%)
      • PCL-Cpp (70%)
      • PCL-Python (70%)
      • ROS ์‹ค์Šต (90%)
    • [๋ณ„์ฒจ] ๋…ธ์ด์ฆˆ ์ œ๊ฑฐ (70%)
      • PCL-Cpp (70%)
      • PCL-Python (50%)
      • ROS ์‹ค์Šต (90%)
  • Part 2 (์ค‘๊ธ‰)
    • README
    • Kd-Tree/Octree Search
    • Chapter03 : Sample Consensus
    • [๋ณ„์ฒจ] ๋ฐ”๋‹ฅ์ œ๊ฑฐ (RANSAC) (70%)
      • PCL-Cpp (70%)
      • PCL-Python (70%)
      • ROS ์‹ค์Šต (90%)
    • ๊ตฐ์ง‘ํ™” (70%)
      • Euclidean-PCL-Cpp (70%)
      • Euclidean-PCL-Python (0%)
      • Conditional-Euclidean-PCL-Cpp (50%)
      • DBSCAN-PCL-Python (0%)
      • Region-Growing-PCL-Cpp (50%)
      • Region-Growing-RGB-PCL-Cpp (50%)
      • Min-Cut-PCL-Cpp (50%)
      • Model-Outlier-Removal-PCL-Cpp (50%)
      • Progressive-Morphological-Filter-PCL-Cpp (50%)
    • ํฌ์ธํŠธ ํƒ์ƒ‰๊ณผ ๋ฐฐ๊ฒฝ์ œ๊ฑฐ (60%)
      • Search-Octree-PCL-Cpp (70%)
      • Search-Octree-PCL-Python (70%)
      • Search-Kdtree-PCL-Cpp (70%)
      • Search-Kdtree-PCL-Python (70%)
      • Compression-PCL-Cpp (70%)
      • DetectChanges-PCL-Cpp (50%)
      • DetectChanges-PCL-Python (50%)
    • ํŠน์ง• ์ฐพ๊ธฐ (50%)
      • PFH-PCL-Cpp
      • FPFH-PCL-Cpp
      • Normal-PCL-Cpp (70%)
      • Normal-PCL-Python (80%)
      • Tmp
    • ๋ถ„๋ฅ˜/์ธ์‹ (30%)
      • ์ธ์‹-GeometricConsistencyGrouping
      • SVM-RGBD-PCL-Python (70%)
      • SVM-LIDAR-PCL-Python (0%)
      • SVM-ROS (0%)
    • ์ •ํ•ฉ (70%)
      • ICP-PCL-Cpp (70%)
      • ICP-ROS ์‹ค์Šต (10%)
    • ์žฌ๊ตฌ์„ฑ (30%)
      • Smoothig-PCL-Cpp (70%)
      • Smoothig-PCL-Python (70%)
      • Triangulation-PCL-Cpp (70%)
  • Part 3 (๊ณ ๊ธ‰)
    • README
    • ๋”ฅ๋Ÿฌ๋‹ ๊ธฐ๋ฐ˜ ํ•™์Šต ๋ฐ์ดํ„ฐ ์ƒ์„ฑ (0%)
      • PointGAN (90%)
      • AutoEncoder (0%)
    • ๋”ฅ๋Ÿฌ๋‹ ๊ธฐ๋ฐ˜ ์ƒ˜ํ”Œ๋ง ๊ธฐ๋ฒ• (0%)
      • DenseLidarNet (50%)
      • Point Cloud Upsampling Network
      • Pseudo-LiDAR
    • ๋”ฅ๋Ÿฌ๋‹ ๊ธฐ๋ฐ˜ ์ž์œจ์ฃผํ–‰ ํƒ์ง€ ๊ธฐ์ˆ  (0%)
    • ๋”ฅ๋Ÿฌ๋‹ ๊ธฐ๋ฐ˜ ์ž์œจ์ฃผํ–‰ ๋ถ„๋ฅ˜ ๊ธฐ์ˆ  (0%)
      • Multi3D
      • PointNet
      • VoxelNet (50%)
      • YOLO3D
      • SqueezeSeg
      • butNet
  • Snippets
    • PCL-Snippets
    • PCL-Python-Helper (10%)
    • Lidar Data Augmentation
  • Appendix
    • ์‹œ๊ฐํ™”Code
    • ์‹œ๊ฐํ™”ํˆด
    • Annotationํˆด
    • Point Cloud Libraries (0%)
    • ๋ฐ์ดํ„ฐ์…‹
    • Cling_PCL
    • ์ฐธ๊ณ  ์ž๋ฃŒ
    • ์ž‘์„ฑ ๊ณ„ํš_Tips
    • ์šฉ์–ด์ง‘
Powered by GitBook
On this page
  • 1. PassThrough
  • 2. Conditional Outlier removal

Was this helpful?

  1. Part 1 (์ดˆ๊ธ‰)
  2. [๋ณ„์ฒจ] ๊ด€์‹ฌ ์˜์—ญ ์„ค์ • (70%)

PCL-Cpp (70%)

Previous[๋ณ„์ฒจ] ๊ด€์‹ฌ ์˜์—ญ ์„ค์ • (70%)NextPCL-Python (70%)

Last updated 5 years ago

Was this helpful?

1. PassThrough

์ฝ”๋“œ๋Š” ์—์„œ ๋‹ค์šด๋กœ๋“œ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ์ƒ˜ํ”ŒํŒŒ์ผ์€ ์„ ์‚ฌ์šฉํ•˜์˜€์Šต๋‹ˆ๋‹ค.

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/filters/passthrough.h>

//Filtering a PointCloud using a PassThrough filter
//http://pointclouds.org/documentation/tutorials/passthrough.php#passthrough

int
 main (int argc, char** argv)
{
  pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGB>);
  pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_filtered (new pcl::PointCloud<pcl::PointXYZRGB>);

  // *.PCD ํŒŒ์ผ ์ฝ๊ธฐ (https://raw.githubusercontent.com/adioshun/gitBook_Tutorial_PCL/master/Beginner/sample/tabletop.pcd)
  pcl::io::loadPCDFile<pcl::PointXYZRGB> ("tabletop.pcd", *cloud);

  // ํฌ์ธํŠธ์ˆ˜ ์ถœ๋ ฅ
  std::cout << "Loaded :" << cloud->width * cloud->height  << std::endl;

  // ์˜ค๋ธŒ์ ํŠธ ์ƒ์„ฑ 
  pcl::PassThrough<pcl::PointXYZRGB> pass;
  pass.setInputCloud (cloud);                //์ž…๋ ฅ 
  pass.setFilterFieldName ("z");             //์ ์šฉํ•  ์ขŒํ‘œ ์ถ• (eg. Z์ถ•)
  pass.setFilterLimits (0.70, 1.5);          //์ ์šฉํ•  ๊ฐ’ (์ตœ์†Œ, ์ตœ๋Œ€ ๊ฐ’)
  //pass.setFilterLimitsNegative (true);     //์ ์šฉํ•  ๊ฐ’ ์™ธ 
  pass.filter (*cloud_filtered);             //ํ•„ํ„ฐ ์ ์šฉ 

  // ํฌ์ธํŠธ์ˆ˜ ์ถœ๋ ฅ
  std::cout << "Filtered :" << cloud_filtered->width * cloud_filtered->height  << std::endl;  

  // ์ €์žฅ 
  pcl::io::savePCDFile<pcl::PointXYZRGB>("tabletop_passthrough.pcd", *cloud_filtered); //Default binary mode save

  return (0);
}

์‹คํ–‰ & ๊ฒฐ๊ณผ

$ Loaded :202627
$ Filtered :72823

์‹œ๊ฐํ™” & ๊ฒฐ๊ณผ

$ pcl_viewer tabletop.pcd 
$ pcl_viewer tabletop_passthrough.pcd

์›๋ณธ

๊ฒฐ๊ณผ

๊ฒฐ๊ณผ(Negative)

2. Conditional Outlier removal

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/filters/conditional_removal.h>

//Removing outliers using a Conditional or RadiusOutlier removal
//http://pointclouds.org/documentation/tutorials/remove_outliers.php#remove-outliers

int
 main (int argc, char** argv)
{

  pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGB>);
  pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_filtered (new pcl::PointCloud<pcl::PointXYZRGB>);

  // *.PCD ํŒŒ์ผ ์ฝ๊ธฐ (https://raw.githubusercontent.com/adioshun/gitBook_Tutorial_PCL/master/Beginner/sample/tabletop.pcd)
  pcl::io::loadPCDFile<pcl::PointXYZRGB> ("tabletop.pcd", *cloud);

  // ํฌ์ธํŠธ์ˆ˜ ์ถœ๋ ฅ
  std::cout << "Loaded " << cloud->width * cloud->height  << std::endl;

  // ์กฐ๊ฑด ์ •์˜ 
  pcl::ConditionAnd<pcl::PointXYZRGB>::Ptr range_cond (new pcl::ConditionAnd<pcl::PointXYZRGB> ());
  range_cond->addComparison (pcl::FieldComparison<pcl::PointXYZRGB>::ConstPtr (new //์กฐ๊ฑด 1 
     pcl::FieldComparison<pcl::PointXYZRGB> ("z", pcl::ComparisonOps::GT, 0.0)));  //eg. z์ถ•์œผ๋กœ 0.00๋ณด๋‹ค ํฐ๊ฐ’(GT:Greater Than)
  range_cond->addComparison (pcl::FieldComparison<pcl::PointXYZRGB>::ConstPtr (new //์กฐ๊ฑด 2 
     pcl::FieldComparison<pcl::PointXYZRGB> ("z", pcl::ComparisonOps::LT, 0.8)));  //eg. z์ถ•์œผ๋กœ 0.08๋ณด๋‹ค ์ž‘์€๊ฐ’(LT:Less Than)

  //์˜คํ”„์ ํŠธ ์ƒ์„ฑ 
  pcl::ConditionalRemoval<pcl::PointXYZRGB> condrem;
  condrem.setInputCloud (cloud);        //์ž…๋ ฅ 
  condrem.setCondition (range_cond);    //์กฐ๊ฑด ์„ค์ •  
  condrem.setKeepOrganized(true);       //
  condrem.filter (*cloud_filtered);     //ํ•„ํ„ฐ ์ ์šฉ 

  // ํฌ์ธํŠธ์ˆ˜ ์ถœ๋ ฅ  
  std::cout << "Filtered " << cloud_filtered->width * cloud_filtered->height  << std::endl;

  // ์ €์žฅ 
  pcl::io::savePCDFile<pcl::PointXYZRGB>("tabletop_conditional.pcd", *cloud_filtered); //Default binary mode save
  return (0);
}

์›๋ณธ

๊ฒฐ๊ณผ

[์ด๊ณณ]
[tabletop.pcd]