00001 #ifndef SEGMENTATION_H 00002 #define SEGMENTATION_H 00003 00004 #include "typedefs.h" 00005 00006 #include <pcl/ModelCoefficients.h> 00007 #include <pcl/sample_consensus/method_types.h> 00008 #include <pcl/sample_consensus/model_types.h> 00009 #include <pcl/segmentation/sac_segmentation.h> 00010 #include <pcl/filters/extract_indices.h> 00011 #include <pcl/segmentation/extract_clusters.h> 00012 00013 00014 /* Use SACSegmentation to find the dominant plane in the scene 00015 * Inputs: 00016 * input 00017 * The input point cloud 00018 * max_iterations 00019 * The maximum number of RANSAC iterations to run 00020 * distance_threshold 00021 * The inlier/outlier threshold. Points within this distance 00022 * from the hypothesized plane are scored as inliers. 00023 * Return: A pointer to the ModelCoefficients (i.e., the 4 coefficients of the plane, 00024 * represented in c0*x + c1*y + c2*z + c3 = 0 form) 00025 */ 00026 pcl::ModelCoefficients::Ptr 00027 fitPlane (const PointCloudPtr & input, float distance_threshold, float max_iterations) 00028 { 00029 pcl::ModelCoefficients::Ptr coefficients; 00030 return (coefficients); 00031 } 00032 00033 /* Use SACSegmentation and an ExtractIndices filter to find the dominant plane and subtract it 00034 * Inputs: 00035 * input 00036 * The input point cloud 00037 * max_iterations 00038 * The maximum number of RANSAC iterations to run 00039 * distance_threshold 00040 * The inlier/outlier threshold. Points within this distance 00041 * from the hypothesized plane are scored as inliers. 00042 * Return: A pointer to a new point cloud which contains only the non-plane points 00043 */ 00044 PointCloudPtr 00045 findAndSubtractPlane (const PointCloudPtr & input, float distance_threshold, float max_iterations) 00046 { 00047 PointCloudPtr output; 00048 return (output); 00049 } 00050 00051 /* Use EuclidieanClusterExtraction to group a cloud into contiguous clusters 00052 * Inputs: 00053 * input 00054 * The input point cloud 00055 * cluster_tolerance 00056 * The maximum distance between neighboring points in a cluster 00057 * min/max_cluster_size 00058 * The minimum and maximum allowable cluster sizes 00059 * Return (by reference): a vector of PointIndices containing the points indices in each cluster 00060 */ 00061 void 00062 clusterObjects (const PointCloudPtr & input, 00063 float cluster_tolerance, int min_cluster_size, int max_cluster_size, 00064 std::vector<pcl::PointIndices> & cluster_indices_out) 00065 { 00066 } 00067 00068 #endif