44#include <pcl/segmentation/region_growing.h>
55 template <
typename Po
intT,
typename NormalT = pcl::Normal>
172 extract (std::vector <pcl::PointIndices>& clusters)
override;
233 findRegionNeighbours (std::vector< std::vector< std::pair<float, pcl::index_t> > >& neighbours_out, std::vector< std::vector<int> >& regions_in);
240 assembleRegions (std::vector<unsigned int>& num_pts_in_region,
int num_regions);
283#ifdef PCL_NO_PRECOMPILE
284#include <pcl/segmentation/impl/region_growing_rgb.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.
bool deinitCompute()
This method should get called after finishing the actual computation.
std::vector< int > point_labels_
float curvature_threshold_
unsigned int neighbour_number_
pcl::uindex_t max_pts_per_cluster_
float residual_threshold_
std::vector< pcl::Indices > point_neighbours_
void applySmoothRegionGrowingAlgorithm()
pcl::uindex_t min_pts_per_cluster_
std::vector< pcl::uindex_t > num_pts_in_segment_
std::vector< pcl::PointIndices > clusters_
void getSegmentFromPoint(index_t index, pcl::PointIndices &cluster) override
For a given point this function builds a segment to which it belongs and returns this segment.
void setDistanceThreshold(float thresh)
Allows to set distance threshold.
void setRegionColorThreshold(float thresh)
This method specifies the threshold value for color test between the regions.
float getPointColorThreshold() const
Returns the color threshold value used for testing if points belong to the same region.
bool prepareForSegmentation() override
This method simply checks if it is possible to execute the segmentation algorithm with the current se...
std::vector< std::vector< float > > point_distances_
Stores distances for the point neighbours from point_neighbours_.
std::vector< pcl::Indices > segment_neighbours_
Stores the neighboures for the corresponding segments.
void findRegionNeighbours(std::vector< std::vector< std::pair< float, pcl::index_t > > > &neighbours_out, std::vector< std::vector< int > > ®ions_in)
This method assembles the array containing neighbours of each homogeneous region.
void applyRegionMergingAlgorithm()
This function implements the merging algorithm described in the article "Color-based segmentation of ...
unsigned int getNumberOfRegionNeighbours() const
Returns the number of nearest neighbours used for searching K nearest segments.
float color_r2r_threshold_
Thershold used in color test for regions.
void setCurvatureTestFlag(bool value) override
Allows to turn on/off the curvature test.
void extract(std::vector< pcl::PointIndices > &clusters) override
This method launches the segmentation algorithm and returns the clusters that were obtained during th...
float distance_threshold_
Threshold that tells which points we need to assume neighbouring.
void setNormalTestFlag(bool value)
Allows to turn on/off the smoothness test.
void setNumberOfRegionNeighbours(unsigned int nghbr_number)
This method allows to set the number of neighbours that is used for finding neighbouring segments.
std::vector< std::vector< float > > segment_distances_
Stores distances for the segment neighbours from segment_neighbours_.
float calculateColorimetricalDifference(std::vector< unsigned int > &first_color, std::vector< unsigned int > &second_color) const
This method calculates the colorimetrical difference between two points.
float getDistanceThreshold() const
Returns the distance threshold.
bool getNormalTestFlag() const
Returns the flag that signalize if the smoothness test is turned on/off.
void findRegionsKNN(pcl::index_t index, pcl::uindex_t nghbr_number, Indices &nghbrs, std::vector< float > &dist)
This method finds K nearest neighbours of the given segment.
RegionGrowingRGB()
Constructor that sets default values for member variables.
unsigned int region_neighbour_number_
Number of neighbouring segments to find.
float color_p2p_threshold_
Thershold used in color test for points.
void setResidualTestFlag(bool value) override
Allows to turn on/off the residual test.
void findPointNeighbours() override
This method finds KNN for each point and saves them to the array because the algorithm needs to find ...
std::vector< int > segment_labels_
Stores new indices for segments that were obtained at the region growing stage.
float getRegionColorThreshold() const
Returns the color threshold value used for testing if regions can be merged.
void findSegmentNeighbours()
This method simply calls the findRegionsKNN for each segment and saves the results for later use.
void setPointColorThreshold(float thresh)
This method specifies the threshold value for color test between the points.
bool validatePoint(index_t initial_seed, index_t point, index_t nghbr, bool &is_a_seed) const override
This function is checking if the point with index 'nghbr' belongs to the segment.
void assembleRegions(std::vector< unsigned int > &num_pts_in_region, int num_regions)
This function simply assembles the regions from list of point labels.
#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.
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
IndicesAllocator<> Indices
Type used for indices 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.