5#include <pcl/ModelCoefficients.h>
6#include <pcl/sample_consensus/method_types.h>
7#include <pcl/sample_consensus/model_types.h>
8#include <pcl/segmentation/sac_segmentation.h>
9#include <pcl/filters/extract_indices.h>
10#include <pcl/segmentation/extract_clusters.h>
26fitPlane (
const PointCloudPtr & input,
float distance_threshold,
float max_iterations)
30 seg.setOptimizeCoefficients (
true);
33 seg.setDistanceThreshold (distance_threshold);
34 seg.setMaxIterations (max_iterations);
36 seg.setInputCloud (input);
39 seg.segment (*inliers, *coefficients);
41 return (coefficients);
56findAndSubtractPlane (
const PointCloudPtr & input,
float distance_threshold,
float max_iterations)
60 seg.setOptimizeCoefficients (
false);
63 seg.setDistanceThreshold (distance_threshold);
64 seg.setMaxIterations (max_iterations);
65 seg.setInputCloud (input);
68 seg.segment (*inliers, *coefficients);
72 extract.setInputCloud (input);
73 extract.setIndices (inliers);
74 extract.setNegative (
true);
76 extract.filter (*output);
92clusterObjects (
const PointCloudPtr & input,
93 float cluster_tolerance,
int min_cluster_size,
int max_cluster_size,
94 std::vector<pcl::PointIndices> & cluster_indices_out)
97 ec.setClusterTolerance (cluster_tolerance);
98 ec.setMinClusterSize (min_cluster_size);
99 ec.setMaxClusterSize (max_cluster_size);
101 ec.setInputCloud (input);
102 ec.extract (cluster_indices_out);
Iterator class for point clouds with or without given indices.
PointCloud represents the base class in PCL for storing collections of 3D points.
static const int SAC_RANSAC
shared_ptr< ::pcl::ModelCoefficients > Ptr
shared_ptr< ::pcl::PointIndices > Ptr