43#include <pcl/pcl_base.h>
45#include <pcl/search/search.h>
46#include <pcl/point_cloud.h>
59 template <
typename Po
intT,
typename NormalT>
208 extract (std::vector <pcl::PointIndices>& clusters);
261 growRegion (
int initial_seed,
int segment_number);
342 return (i.first < j.first);
346#ifdef PCL_NO_PRECOMPILE
347#include <pcl/segmentation/impl/region_growing.hpp>
PointCloudConstPtr input_
The input point cloud dataset.
IndicesPtr indices_
A pointer to the vector of point indices to use.
bool initCompute()
This method should get called before starting the actual computation.
PCLBase()
Empty constructor.
bool deinitCompute()
This method should get called after finishing the actual computation.
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< NormalT > > Ptr
NormalPtr normals_
Contains normals of the points that will be segmented.
bool getResidualTestFlag() const
Returns the flag that signalize if the residual test is turned on/off.
bool curvature_flag_
If set to true then curvature test will be done during segmentation.
pcl::PointCloud< pcl::PointXYZRGBA >::Ptr getColoredCloudRGBA()
If the cloud was successfully segmented, then function returns colored cloud.
void setResidualThreshold(float residual)
Allows to set residual threshold used for testing the points.
virtual void setCurvatureTestFlag(bool value)
Allows to turn on/off the curvature test.
typename KdTree::Ptr KdTreePtr
void setSearchMethod(const KdTreePtr &tree)
Allows to set search method that will be used for finding KNN.
KdTreePtr search_
Search method that will be used for KNN.
void setInputNormals(const NormalPtr &norm)
This method sets the normals.
pcl::uindex_t getMinClusterSize()
Get the minimum number of points that a cluster needs to contain in order to be considered valid.
RegionGrowing()
Constructor that sets default values for member variables.
int growRegion(int initial_seed, int segment_number)
This method grows a segment for the given seed point.
pcl::search::Search< PointT > KdTree
void setNumberOfNeighbours(unsigned int neighbour_number)
Allows to set the number of neighbours.
virtual bool prepareForSegmentation()
This method simply checks if it is possible to execute the segmentation algorithm with the current se...
virtual void findPointNeighbours()
This method finds KNN for each point and saves them to the array because the algorithm needs to find ...
NormalPtr getInputNormals() const
Returns normals.
float getCurvatureThreshold() const
Returns curvature threshold.
void setMinClusterSize(pcl::uindex_t min_cluster_size)
Set the minimum number of points that a cluster needs to contain in order to be considered valid.
std::vector< int > point_labels_
Point labels that tells to which segment each point belongs.
float theta_threshold_
Threshold used for testing the smoothness between points.
float getResidualThreshold() const
Returns residual threshold.
float curvature_threshold_
Threshold used in curvature test.
bool smooth_mode_flag_
Flag that signalizes if the smoothness constraint will be used.
unsigned int neighbour_number_
Number of neighbours to find.
float getSmoothnessThreshold() const
Returns smoothness threshold.
bool normal_flag_
If set to true then normal/smoothness test will be done during segmentation.
KdTreePtr getSearchMethod() const
Returns the pointer to the search method that is used for KNN.
virtual void extract(std::vector< pcl::PointIndices > &clusters)
This method launches the segmentation algorithm and returns the clusters that were obtained during th...
pcl::uindex_t max_pts_per_cluster_
Stores the maximum number of points that a cluster needs to contain in order to be considered valid.
bool residual_flag_
If set to true then residual test will be done during segmentation.
unsigned int getNumberOfNeighbours() const
Returns the number of nearest neighbours used for KNN.
bool getCurvatureTestFlag() const
Returns the flag that signalize if the curvature test is turned on/off.
void setSmoothnessThreshold(float theta)
Allows to set smoothness threshold used for testing the points.
pcl::uindex_t getMaxClusterSize()
Get the maximum number of points that a cluster needs to contain in order to be considered valid.
float residual_threshold_
Threshold used in residual test.
std::vector< pcl::Indices > point_neighbours_
Contains neighbours of each point.
virtual void getSegmentFromPoint(pcl::index_t index, pcl::PointIndices &cluster)
For a given point this function builds a segment to which it belongs and returns this segment.
virtual void setResidualTestFlag(bool value)
Allows to turn on/off the residual test.
void setMaxClusterSize(pcl::uindex_t max_cluster_size)
Set the maximum number of points that a cluster needs to contain in order to be considered valid.
void setCurvatureThreshold(float curvature)
Allows to set curvature threshold used for testing the points.
void applySmoothRegionGrowingAlgorithm()
This function implements the algorithm described in the article "Segmentation of point clouds using s...
int number_of_segments_
Stores the number of segments.
bool getSmoothModeFlag() const
Returns the flag value.
pcl::uindex_t min_pts_per_cluster_
Stores the minimum number of points that a cluster needs to contain in order to be considered valid.
pcl::PointCloud< pcl::PointXYZRGB >::Ptr getColoredCloud()
If the cloud was successfully segmented, then function returns colored cloud.
std::vector< pcl::uindex_t > num_pts_in_segment_
Tells how much points each segment contains.
virtual bool validatePoint(pcl::index_t initial_seed, pcl::index_t point, pcl::index_t nghbr, bool &is_a_seed) const
This function is checking if the point with index 'nghbr' belongs to the segment.
void setSmoothModeFlag(bool value)
This function allows to turn on/off the smoothness constraint.
std::vector< pcl::PointIndices > clusters_
After the segmentation it will contain the segments.
typename Normal::Ptr NormalPtr
void assembleRegions()
This function simply assembles the regions from list of point labels.
pcl::PointCloud< PointT > PointCloud
pcl::PointCloud< NormalT > Normal
shared_ptr< pcl::search::Search< PointT > > Ptr
Defines all the PCL implemented PointT point type structures.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Defines functions, macros and traits for allocating and using memory.
bool comparePair(std::pair< float, int > i, std::pair< float, int > j)
This function is used as a comparator for sorting.
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
detail::int_type_t< detail::index_type_size, false > uindex_t
Type used for an unsigned index in PCL.
Defines all the PCL and non-PCL macros used.