pcl::RegionGrowingRGB< PointT, NormalT > Class Template Reference

Implements the well known Region Growing algorithm used for segmentation based on color of points. More...

#include <pcl/segmentation/region_growing_rgb.h>

Inheritance diagram for pcl::RegionGrowingRGB< PointT, NormalT >:
Inheritance graph
[legend]
Collaboration diagram for pcl::RegionGrowingRGB< PointT, NormalT >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 RegionGrowingRGB ()
 Constructor that sets default values for member variables.
virtual ~RegionGrowingRGB ()
 Destructor that frees memory.
float getPointColorThreshold () const
 Returns the color threshold value used for testing if points belong to the same region.
void setPointColorThreshold (float thresh)
 This method specifies the threshold value for color test between the points.
float getRegionColorThreshold () const
 Returns the color threshold value used for testing if regions can be merged.
void setRegionColorThreshold (float thresh)
 This method specifies the threshold value for color test between the regions.
float getDistanceThreshold () const
 Returns the distance threshold.
void setDistanceThreshold (float thresh)
 Allows to set distance threshold.
unsigned int getNumberOfRegionNeighbours () const
 Returns the number of nearest neighbours used for searching K nearest segments.
void setNumberOfRegionNeighbours (unsigned int nghbr_number)
 This method allows to set the number of neighbours that is used for finding neighbouring segments.
bool getNormalTestFlag () const
 Returns the flag that signalize if the smoothness test is turned on/off.
void setNormalTestFlag (bool value)
 Allows to turn on/off the smoothness test.
virtual void setCurvatureTestFlag (bool value)
 Allows to turn on/off the curvature test.
virtual void setResidualTestFlag (bool value)
 Allows to turn on/off the residual test.
virtual void extract (std::vector< pcl::PointIndices > &clusters)
 This method launches the segmentation algorithm and returns the clusters that were obtained during the segmentation.
virtual void getSegmentFromPoint (int index, pcl::PointIndices &cluster)
 For a given point this function builds a segment to which it belongs and returns this segment.

Protected Member Functions

virtual bool prepareForSegmentation ()
 This method simply checks if it is possible to execute the segmentation algorithm with the current settings.
virtual void findPointNeighbours ()
 This method finds KNN for each point and saves them to the array because the algorithm needs to find KNN a few times.
void findSegmentNeighbours ()
 This method simply calls the findRegionsKNN for each segment and saves the results for later use.
void findRegionsKNN (int index, int nghbr_number, std::vector< int > &nghbrs, std::vector< float > &dist)
 This method finds K nearest neighbours of the given segment.
void applyRegionMergingAlgorithm ()
 This function implements the merging algorithm described in the article "Color-based segmentation of point clouds" by Qingming Zhan, Yubin Liang, Yinghui Xiao.
float calculateColorimetricalDifference (std::vector< unsigned int > &first_color, std::vector< unsigned int > &second_color) const
 This method calculates the colorimetrical difference between two points.
void findRegionNeighbours (std::vector< std::vector< std::pair< float, int > > > &neighbours_out, std::vector< std::vector< int > > &regions_in)
 This method assembles the array containing neighbours of each homogeneous region.
void assembleRegions (std::vector< unsigned int > &num_pts_in_region, int num_regions)
 This function simply assembles the regions from list of point labels.
virtual bool validatePoint (int initial_seed, int point, int nghbr, bool &is_a_seed) const
 This function is checking if the point with index 'nghbr' belongs to the segment.

Protected Attributes

float color_p2p_threshold_
 Thershold used in color test for points.
float color_r2r_threshold_
 Thershold used in color test for regions.
float distance_threshold_
 Threshold that tells which points we need to assume neighbouring.
unsigned int region_neighbour_number_
 Number of neighbouring segments to find.
std::vector< std::vector< float > > point_distances_
 Stores distances for the point neighbours from point_neighbours_.
std::vector< std::vector< int > > segment_neighbours_
 Stores the neighboures for the corresponding segments.
std::vector< std::vector< float > > segment_distances_
 Stores distances for the segment neighbours from segment_neighbours_.
std::vector< int > segment_labels_
 Stores new indices for segments that were obtained at the region growing stage.

Detailed Description

template<typename PointT, typename NormalT = pcl::Normal>
class pcl::RegionGrowingRGB< PointT, NormalT >

Implements the well known Region Growing algorithm used for segmentation based on color of points.

Description can be found in the article "Color-based segmentation of point clouds" by Qingming Zhan, Yubin Liang, Yinghui Xiao

Definition at line 54 of file region_growing_rgb.h.


Constructor & Destructor Documentation

template<typename PointT , typename NormalT >
pcl::RegionGrowingRGB< PointT, NormalT >::RegionGrowingRGB (  )  [inline]
template<typename PointT , typename NormalT >
pcl::RegionGrowingRGB< PointT, NormalT >::~RegionGrowingRGB (  )  [inline, virtual]

Member Function Documentation

template<typename PointT , typename NormalT >
void pcl::RegionGrowingRGB< PointT, NormalT >::applyRegionMergingAlgorithm (  )  [inline, protected]
template<typename PointT , typename NormalT >
void pcl::RegionGrowingRGB< PointT, NormalT >::assembleRegions ( std::vector< unsigned int > &  num_pts_in_region,
int  num_regions 
) [inline, protected]

This function simply assembles the regions from list of point labels.

Parameters:
[in] num_pts_in_region for each final region it stores the corresponding number of points in it
[in] num_regions number of regions to assemble

Definition at line 564 of file region_growing_rgb.hpp.

References pcl::RegionGrowing< PointT, NormalT >::clusters_, pcl::PCLBase< PointT >::indices_, pcl::RegionGrowing< PointT, NormalT >::point_labels_, and pcl::RegionGrowingRGB< PointT, NormalT >::segment_labels_.

template<typename PointT , typename NormalT >
float pcl::RegionGrowingRGB< PointT, NormalT >::calculateColorimetricalDifference ( std::vector< unsigned int > &  first_color,
std::vector< unsigned int > &  second_color 
) const [inline, protected]

This method calculates the colorimetrical difference between two points.

In this case it simply returns the euclidean distance between two colors.

Parameters:
[in] first_color the color of the first point
[in] second_color the color of the second point

Definition at line 519 of file region_growing_rgb.hpp.

Referenced by pcl::RegionGrowingRGB< PointT, NormalT >::applyRegionMergingAlgorithm(), and pcl::RegionGrowingRGB< PointT, NormalT >::validatePoint().

template<typename PointT , typename NormalT >
void pcl::RegionGrowingRGB< PointT, NormalT >::extract ( std::vector< pcl::PointIndices > &  clusters  )  [inline, virtual]
template<typename PointT , typename NormalT >
void pcl::RegionGrowingRGB< PointT, NormalT >::findPointNeighbours (  )  [inline, protected, virtual]
template<typename PointT , typename NormalT >
void pcl::RegionGrowingRGB< PointT, NormalT >::findRegionNeighbours ( std::vector< std::vector< std::pair< float, int > > > &  neighbours_out,
std::vector< std::vector< int > > &  regions_in 
) [inline, protected]

This method assembles the array containing neighbours of each homogeneous region.

Homogeneous region is the union of some segments. This array is used when the regions with a few points need to be merged with the neighbouring region.

Parameters:
[out] neighbours_out vector of lists of neighbours for every homogeneous region
[in] regions_in vector of lists, each list contains indices of segments that belong to the corresponding homogeneous region.

Definition at line 530 of file region_growing_rgb.hpp.

References pcl::comparePair(), pcl::RegionGrowingRGB< PointT, NormalT >::region_neighbour_number_, pcl::RegionGrowingRGB< PointT, NormalT >::segment_distances_, pcl::RegionGrowingRGB< PointT, NormalT >::segment_labels_, and pcl::RegionGrowingRGB< PointT, NormalT >::segment_neighbours_.

Referenced by pcl::RegionGrowingRGB< PointT, NormalT >::applyRegionMergingAlgorithm().

template<typename PointT , typename NormalT >
void pcl::RegionGrowingRGB< PointT, NormalT >::findRegionsKNN ( int  index,
int  nghbr_number,
std::vector< int > &  nghbrs,
std::vector< float > &  dist 
) [inline, protected]

This method finds K nearest neighbours of the given segment.

Parameters:
[in] index index of the segment for which neighbours will be found
[in] nghbr_number the number of neighbours to find
[out] nghbrs the array of indices of the neighbours that were found
[out] dist the array of distances to the corresponding neighbours

Definition at line 312 of file region_growing_rgb.hpp.

References pcl::RegionGrowing< PointT, NormalT >::clusters_, pcl::RegionGrowing< PointT, NormalT >::num_pts_in_segment_, pcl::RegionGrowing< PointT, NormalT >::number_of_segments_, pcl::RegionGrowingRGB< PointT, NormalT >::point_distances_, pcl::RegionGrowing< PointT, NormalT >::point_labels_, and pcl::RegionGrowing< PointT, NormalT >::point_neighbours_.

Referenced by pcl::RegionGrowingRGB< PointT, NormalT >::findSegmentNeighbours().

template<typename PointT , typename NormalT >
void pcl::RegionGrowingRGB< PointT, NormalT >::findSegmentNeighbours (  )  [inline, protected]
template<typename PointT , typename NormalT >
float pcl::RegionGrowingRGB< PointT, NormalT >::getDistanceThreshold (  )  const [inline]

Returns the distance threshold.

If the distance between two points is less or equal to distance threshold value, then those points assumed to be neighbouring points.

Definition at line 107 of file region_growing_rgb.hpp.

References pcl::RegionGrowingRGB< PointT, NormalT >::distance_threshold_.

template<typename PointT , typename NormalT >
bool pcl::RegionGrowingRGB< PointT, NormalT >::getNormalTestFlag (  )  const [inline]

Returns the flag that signalize if the smoothness test is turned on/off.

Definition at line 135 of file region_growing_rgb.hpp.

References pcl::RegionGrowing< PointT, NormalT >::normal_flag_.

template<typename PointT , typename NormalT >
unsigned int pcl::RegionGrowingRGB< PointT, NormalT >::getNumberOfRegionNeighbours (  )  const [inline]

Returns the number of nearest neighbours used for searching K nearest segments.

Note that here it refers to the segments(not the points).

Definition at line 121 of file region_growing_rgb.hpp.

References pcl::RegionGrowingRGB< PointT, NormalT >::region_neighbour_number_.

template<typename PointT , typename NormalT >
float pcl::RegionGrowingRGB< PointT, NormalT >::getPointColorThreshold (  )  const [inline]

Returns the color threshold value used for testing if points belong to the same region.

Definition at line 79 of file region_growing_rgb.hpp.

References pcl::RegionGrowingRGB< PointT, NormalT >::color_p2p_threshold_.

template<typename PointT , typename NormalT >
float pcl::RegionGrowingRGB< PointT, NormalT >::getRegionColorThreshold (  )  const [inline]

Returns the color threshold value used for testing if regions can be merged.

Definition at line 93 of file region_growing_rgb.hpp.

References pcl::RegionGrowingRGB< PointT, NormalT >::color_r2r_threshold_.

template<typename PointT , typename NormalT >
void pcl::RegionGrowingRGB< PointT, NormalT >::getSegmentFromPoint ( int  index,
pcl::PointIndices cluster 
) [inline, virtual]
template<typename PointT , typename NormalT >
bool pcl::RegionGrowingRGB< PointT, NormalT >::prepareForSegmentation (  )  [inline, protected, virtual]
template<typename PointT , typename NormalT >
void pcl::RegionGrowingRGB< PointT, NormalT >::setCurvatureTestFlag ( bool  value  )  [inline, virtual]

Allows to turn on/off the curvature test.

Parameters:
[in] value new value for curvature test. If set to true then the test will be turned on

Reimplemented from pcl::RegionGrowing< PointT, NormalT >.

Definition at line 149 of file region_growing_rgb.hpp.

References pcl::RegionGrowing< PointT, NormalT >::curvature_flag_.

template<typename PointT , typename NormalT >
void pcl::RegionGrowingRGB< PointT, NormalT >::setDistanceThreshold ( float  thresh  )  [inline]

Allows to set distance threshold.

Parameters:
[in] thresh new threshold value for neighbour test

Definition at line 114 of file region_growing_rgb.hpp.

References pcl::RegionGrowingRGB< PointT, NormalT >::distance_threshold_.

template<typename PointT , typename NormalT >
void pcl::RegionGrowingRGB< PointT, NormalT >::setNormalTestFlag ( bool  value  )  [inline]

Allows to turn on/off the smoothness test.

Parameters:
[in] value new value for normal/smoothness test. If set to true then the test will be turned on

Definition at line 142 of file region_growing_rgb.hpp.

References pcl::RegionGrowing< PointT, NormalT >::normal_flag_.

template<typename PointT , typename NormalT >
void pcl::RegionGrowingRGB< PointT, NormalT >::setNumberOfRegionNeighbours ( unsigned int  nghbr_number  )  [inline]

This method allows to set the number of neighbours that is used for finding neighbouring segments.

Neighbouring segments are needed for the merging process.

Parameters:
[in] nghbr_number the number of neighbouring segments to find

Definition at line 128 of file region_growing_rgb.hpp.

References pcl::RegionGrowingRGB< PointT, NormalT >::region_neighbour_number_.

template<typename PointT , typename NormalT >
void pcl::RegionGrowingRGB< PointT, NormalT >::setPointColorThreshold ( float  thresh  )  [inline]

This method specifies the threshold value for color test between the points.

This kind of testing is made at the first stage of the algorithm(region growing). If the difference between points color is less than threshold value, then they are considered to be in the same region.

Parameters:
[in] thresh new threshold value for color test

Definition at line 86 of file region_growing_rgb.hpp.

References pcl::RegionGrowingRGB< PointT, NormalT >::color_p2p_threshold_.

template<typename PointT , typename NormalT >
void pcl::RegionGrowingRGB< PointT, NormalT >::setRegionColorThreshold ( float  thresh  )  [inline]

This method specifies the threshold value for color test between the regions.

This kind of testing is made at the second stage of the algorithm(region merging). If the difference between segments color is less than threshold value, then they are merged together.

Parameters:
[in] thresh new threshold value for color test

Definition at line 100 of file region_growing_rgb.hpp.

References pcl::RegionGrowingRGB< PointT, NormalT >::color_r2r_threshold_.

template<typename PointT , typename NormalT >
void pcl::RegionGrowingRGB< PointT, NormalT >::setResidualTestFlag ( bool  value  )  [inline, virtual]

Allows to turn on/off the residual test.

Parameters:
[in] value new value for residual test. If set to true then the test will be turned on

Reimplemented from pcl::RegionGrowing< PointT, NormalT >.

Definition at line 156 of file region_growing_rgb.hpp.

References pcl::RegionGrowing< PointT, NormalT >::residual_flag_.

template<typename PointT , typename NormalT >
bool pcl::RegionGrowingRGB< PointT, NormalT >::validatePoint ( int  initial_seed,
int  point,
int  nghbr,
bool &  is_a_seed 
) const [inline, protected, virtual]

This function is checking if the point with index 'nghbr' belongs to the segment.

If so, then it returns true. It also checks if this point can serve as the seed.

Parameters:
[in] initial_seed index of the initial point that was passed to the growRegion() function
[in] point index of the current seed point
[in] nghbr index of the point that is neighbour of the current seed
[out] is_a_seed this value is set to true if the point with index 'nghbr' can serve as the seed

Reimplemented from pcl::RegionGrowing< PointT, NormalT >.

Definition at line 600 of file region_growing_rgb.hpp.

References pcl::RegionGrowingRGB< PointT, NormalT >::calculateColorimetricalDifference(), pcl::RegionGrowingRGB< PointT, NormalT >::color_p2p_threshold_, pcl::RegionGrowing< PointT, NormalT >::curvature_flag_, pcl::RegionGrowing< PointT, NormalT >::curvature_threshold_, pcl::PCLBase< PointT >::input_, pcl::RegionGrowing< PointT, NormalT >::normal_flag_, pcl::RegionGrowing< PointT, NormalT >::normals_, pcl::RegionGrowing< PointT, NormalT >::residual_flag_, pcl::RegionGrowing< PointT, NormalT >::residual_threshold_, pcl::RegionGrowing< PointT, NormalT >::smooth_mode_flag_, and pcl::RegionGrowing< PointT, NormalT >::theta_threshold_.


Member Data Documentation

template<typename PointT , typename NormalT = pcl::Normal>
float pcl::RegionGrowingRGB< PointT, NormalT >::color_p2p_threshold_ [protected]
template<typename PointT , typename NormalT = pcl::Normal>
float pcl::RegionGrowingRGB< PointT, NormalT >::color_r2r_threshold_ [protected]
template<typename PointT , typename NormalT = pcl::Normal>
float pcl::RegionGrowingRGB< PointT, NormalT >::distance_threshold_ [protected]
template<typename PointT , typename NormalT = pcl::Normal>
std::vector< std::vector<float> > pcl::RegionGrowingRGB< PointT, NormalT >::point_distances_ [protected]
template<typename PointT , typename NormalT = pcl::Normal>
unsigned int pcl::RegionGrowingRGB< PointT, NormalT >::region_neighbour_number_ [protected]
template<typename PointT , typename NormalT = pcl::Normal>
std::vector< std::vector<float> > pcl::RegionGrowingRGB< PointT, NormalT >::segment_distances_ [protected]
template<typename PointT , typename NormalT = pcl::Normal>
std::vector<int> pcl::RegionGrowingRGB< PointT, NormalT >::segment_labels_ [protected]
template<typename PointT , typename NormalT = pcl::Normal>
std::vector< std::vector<int> > pcl::RegionGrowingRGB< PointT, NormalT >::segment_neighbours_ [protected]

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends