pcl::SACSegmentation< PointT > Class Template Reference
Module segmentation

SACSegmentation represents the Nodelet segmentation class for Sample Consensus methods and models, in the sense that it just creates a Nodelet wrapper for generic-purpose SAC-based segmentation. More...

`#include <pcl/segmentation/sac_segmentation.h>`

Inheritance diagram for pcl::SACSegmentation< PointT >:

## Public Types

typedef pcl::PointCloud< PointT > | PointCloud
typedef PointCloud::Ptr | PointCloudPtr
typedef PointCloud::ConstPtr | PointCloudConstPtr
typedef pcl::search::Search< PointT >::Ptr | SearchPtr
typedef SampleConsensus< PointT >::Ptr | SampleConsensusPtr
typedef SampleConsensusModel< PointT >::Ptr | SampleConsensusModelPtr
Public Types inherited from pcl::PCLBase< PointT >
typedef pcl::PointCloud< PointT > | PointCloud
typedef PointCloud::Ptr | PointCloudPtr
typedef PointCloud::ConstPtr | PointCloudConstPtr
typedef boost::shared_ptr< PointIndices > | PointIndicesPtr
typedef boost::shared_ptr< PointIndices const > | PointIndicesConstPtr

## Public Member Functions

| SACSegmentation (bool random=false)
| Empty constructor. More...
virtual | ~SACSegmentation ()
| Empty destructor. More...
void | setModelType (int model)
| The type of model to use (user given parameter). More...
int | getModelType () const
| Get the type of SAC model used. More...
SampleConsensusPtr | getMethod () const
| Get a pointer to the SAC method used. More...
SampleConsensusModelPtr | getModel () const
| Get a pointer to the SAC model used. More...
void | setMethodType (int method)
| The type of sample consensus method to use (user given parameter). More...
int | getMethodType () const
| Get the type of sample consensus method used. More...
void | setDistanceThreshold (double threshold)
| Distance to the model threshold (user given parameter). More...
double | getDistanceThreshold () const
| Get the distance to the model threshold. More...
void | setMaxIterations (int max_iterations)
| Set the maximum number of iterations before giving up. More...
int | getMaxIterations () const
| Get maximum number of iterations before giving up. More...
void | setProbability (double probability)
| Set the probability of choosing at least one sample free from outliers. More...
double | getProbability () const
| Get the probability of choosing at least one sample free from outliers. More...
void | setOptimizeCoefficients (bool optimize)
| Set to true if a coefficient refinement is required. More...
bool | getOptimizeCoefficients () const
| Get the coefficient refinement internal flag. More...
void | setRadiusLimits (const double &min_radius, const double &max_radius)
| Set the minimum and maximum allowable radius limits for the model (applicable to models that estimate a radius) More...
void | getRadiusLimits (double &min_radius, double &max_radius)
| Get the minimum and maximum allowable radius limits for the model as set by the user. More...
void | setSamplesMaxDist (const double &radius, SearchPtr search)
| Set the maximum distance allowed when drawing random samples. More...
void | getSamplesMaxDist (double &radius)
| Get maximum distance allowed when drawing random samples. More...
void | setAxis (const Eigen::Vector3f &ax)
| Set the axis along which we need to search for a model perpendicular to. More...
Eigen::Vector3f | getAxis () const
| Get the axis along which we need to search for a model perpendicular to. More...
void | setEpsAngle (double ea)
| Set the angle epsilon (delta) threshold. More...
double | getEpsAngle () const
| Get the epsilon (delta) model angle threshold in radians. More...
virtual void | segment (PointIndices &inliers, ModelCoefficients &model_coefficients)
| Base method for segmentation of a model in a PointCloud given by <setInputCloud (), setIndices ()> More...
Public Member Functions inherited from pcl::PCLBase< PointT >
| PCLBase ()
| Empty constructor. More...
| PCLBase (const PCLBase &base)
| Copy constructor. More...
virtual | ~PCLBase ()
| Destructor. More...
virtual void | setInputCloud (const PointCloudConstPtr &cloud)
| Provide a pointer to the input dataset. More...
PointCloudConstPtr const | getInputCloud () const
| Get a pointer to the input point cloud dataset. More...
virtual void | setIndices (const IndicesPtr &indices)
| Provide a pointer to the vector of indices that represents the input data. More...
virtual void | setIndices (const IndicesConstPtr &indices)
| Provide a pointer to the vector of indices that represents the input data. More...
virtual void | setIndices (const PointIndicesConstPtr &indices)
| Provide a pointer to the vector of indices that represents the input data. More...
virtual void | setIndices (size_t row_start, size_t col_start, size_t nb_rows, size_t nb_cols)
| Set the indices for the points laying within an interest region of the point cloud. More...
IndicesPtr const | getIndices ()
| Get a pointer to the vector of indices used. More...
IndicesConstPtr const | getIndices () const
| Get a pointer to the vector of indices used. More...
const PointT & | operator[] (size_t pos) const
| Override PointCloud operator[] to shorten code. More...

## Protected Member Functions

virtual bool | initSACModel (const int model_type)
| Initialize the Sample Consensus model and set its parameters. More...
virtual void | initSAC (const int method_type)
| Initialize the Sample Consensus method and set its parameters. More...
virtual std::string | getClassName () const
| Class get name method. More...
Protected Member Functions inherited from pcl::PCLBase< PointT >
bool | initCompute ()
| This method should get called before starting the actual computation. More...
bool | deinitCompute ()
| This method should get called after finishing the actual computation. More...

## Protected Attributes

SampleConsensusModelPtr | model_
| The model that needs to be segmented. More...
SampleConsensusPtr | sac_
| The sample consensus segmentation method. More...
int | model_type_
| The type of model to use (user given parameter). More...
int | method_type_
| The type of sample consensus method to use (user given parameter). More...
double | threshold_
| Distance to the model threshold (user given parameter). More...
bool | optimize_coefficients_
| Set to true if a coefficient refinement is required. More...
double | radius_min_
| The minimum and maximum radius limits for the model. More...
double | radius_max_
double | samples_radius_
| The maximum distance of subsequent samples from the first (radius search) More...
SearchPtr | samples_radius_search_
| The search object for picking subsequent samples using radius search. More...
double | eps_angle_
| The maximum allowed difference between the model normal and the given axis. More...
Eigen::Vector3f | axis_
| The axis along which we need to search for a model perpendicular to. More...
int | max_iterations_
| Maximum number of iterations before giving up (user given parameter). More...
double | probability_
| Desired probability of choosing at least one sample free from outliers (user given parameter). More...
bool | random_
| Set to true if we need a random seed. More...
Protected Attributes inherited from pcl::PCLBase< PointT >
PointCloudConstPtr | input_
| The input point cloud dataset. More...
IndicesPtr | indices_
| A pointer to the vector of point indices to use. More...
bool | use_indices_
| Set to true if point indices are used. More...
bool | fake_indices_
| If no set of indices are given, we construct a set of fake indices that mimic the input PointCloud. More...

## Detailed Description

### template<typename PointT>
class pcl::SACSegmentation< PointT >

SACSegmentation represents the Nodelet segmentation class for Sample Consensus methods and models, in the sense that it just creates a Nodelet wrapper for generic-purpose SAC-based segmentation.

Author
  Radu Bogdan Rusu

Definition at line 65 of file sac_segmentation.h.

## Member Typedef Documentation

template<typename PointT>

typedef pcl::PointCloud<PointT> pcl::SACSegmentation< PointT >::PointCloud

Definition at line 74 of file sac_segmentation.h.

template<typename PointT>

typedef PointCloud::ConstPtr pcl::SACSegmentation< PointT >::PointCloudConstPtr

Definition at line 76 of file sac_segmentation.h.

template<typename PointT>

typedef PointCloud::Ptr pcl::SACSegmentation< PointT >::PointCloudPtr

Definition at line 75 of file sac_segmentation.h.

template<typename PointT>

typedef SampleConsensusModel<PointT>::Ptr pcl::SACSegmentation< PointT >::SampleConsensusModelPtr

Definition at line 80 of file sac_segmentation.h.

template<typename PointT>

typedef SampleConsensus<PointT>::Ptr pcl::SACSegmentation< PointT >::SampleConsensusPtr

Definition at line 79 of file sac_segmentation.h.

template<typename PointT>

typedef pcl::search::Search<PointT>::Ptr pcl::SACSegmentation< PointT >::SearchPtr

Definition at line 77 of file sac_segmentation.h.

## Constructor & Destructor Documentation

template<typename PointT>

pcl::SACSegmentation< PointT >::SACSegmentation | ( | bool | random = `false` | ) |

inline

Empty constructor.

Parameters

  [in] | random | if true set the random seed to the current time, else set to 12345 (default: false)

Definition at line 85 of file sac_segmentation.h.

template<typename PointT>

virtual pcl::SACSegmentation< PointT >::~SACSegmentation | ( |  | ) |

inline virtual

Empty destructor.

Definition at line 105 of file sac_segmentation.h.

## Member Function Documentation

template<typename PointT>

Eigen::Vector3f pcl::SACSegmentation< PointT >::getAxis | ( |  | ) | const

inline

Get the axis along which we need to search for a model perpendicular to.

Definition at line 227 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::axis_.

template<typename PointT>

virtual std::string pcl::SACSegmentation< PointT >::getClassName | ( |  | ) | const

inline protected virtual

Class get name method.

Reimplemented in pcl::SACSegmentationFromNormals< PointT, PointNT >.

Definition at line 303 of file sac_segmentation.h.

template<typename PointT>

double pcl::SACSegmentation< PointT >::getDistanceThreshold | ( |  | ) | const

inline

Get the distance to the model threshold.

Definition at line 143 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::threshold_.

template<typename PointT>

double pcl::SACSegmentation< PointT >::getEpsAngle | ( |  | ) | const

inline

Get the epsilon (delta) model angle threshold in radians.

Definition at line 237 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::eps_angle_, pcl::SACSegmentation< PointT >::initSAC(), pcl::SACSegmentation< PointT >::initSACModel(), and pcl::SACSegmentation< PointT >::segment().

template<typename PointT>

int pcl::SACSegmentation< PointT >::getMaxIterations | ( |  | ) | const

inline

Get maximum number of iterations before giving up.

Definition at line 153 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::max_iterations_.

template<typename PointT>

SampleConsensusPtr pcl::SACSegmentation< PointT >::getMethod | ( |  | ) | const

inline

Get a pointer to the SAC method used.

Definition at line 119 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::sac_.

template<typename PointT>

int pcl::SACSegmentation< PointT >::getMethodType | ( |  | ) | const

inline

Get the type of sample consensus method used.

Definition at line 133 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::method_type_.

template<typename PointT>

SampleConsensusModelPtr pcl::SACSegmentation< PointT >::getModel | ( |  | ) | const

inline

Get a pointer to the SAC model used.

Definition at line 123 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::model_.

template<typename PointT>

int pcl::SACSegmentation< PointT >::getModelType | ( |  | ) | const

inline

Get the type of SAC model used.

Definition at line 115 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::model_type_.

template<typename PointT>

bool pcl::SACSegmentation< PointT >::getOptimizeCoefficients | ( |  | ) | const

inline

Get the coefficient refinement internal flag.

Definition at line 173 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::optimize_coefficients_.

template<typename PointT>

double pcl::SACSegmentation< PointT >::getProbability | ( |  | ) | const

inline

Get the probability of choosing at least one sample free from outliers.

Definition at line 163 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::probability_.

template<typename PointT>

void pcl::SACSegmentation< PointT >::getRadiusLimits | ( | double & | min_radius,
|  | double & | max_radius
| ) |  |

inline

Get the minimum and maximum allowable radius limits for the model as set by the user.

Parameters

  [out] | min_radius | the resultant minimum radius model
  [out] | max_radius | the resultant maximum radius model

Definition at line 192 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::radius_max_, and pcl::SACSegmentation< PointT >::radius_min_.

template<typename PointT>

void pcl::SACSegmentation< PointT >::getSamplesMaxDist | ( | double & | radius | ) |

inline

Get maximum distance allowed when drawing random samples.

Parameters

  [out] | radius | the maximum distance (L2 norm)

Definition at line 214 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::samples_radius_.

template<typename PointT >

void pcl::SACSegmentation< PointT >::initSAC | ( | const int | method_type | ) |

protected virtual

Initialize the Sample Consensus method and set its parameters.

Parameters

  [in] | method_type | the type of SAC method to be used

Definition at line 270 of file sac_segmentation.hpp.

Referenced by pcl::SACSegmentation< PointT >::getEpsAngle().

template<typename PointT >

bool pcl::SACSegmentation< PointT >::initSACModel | ( | const int | model_type | ) |

protected virtual

Initialize the Sample Consensus model and set its parameters.

Parameters

  [in] | model_type | the type of SAC model that is to be used

Reimplemented in pcl::SACSegmentationFromNormals< PointT, PointNT >.

Definition at line 133 of file sac_segmentation.hpp.

References pcl::SampleConsensusModelParallelLine< PointT >::getAxis(), pcl::SampleConsensusModelParallelPlane< PointT >::getAxis(), pcl::SampleConsensusModelPerpendicularPlane< PointT >::getAxis(), pcl::SampleConsensusModelParallelLine< PointT >::getEpsAngle(), pcl::SampleConsensusModelParallelPlane< PointT >::getEpsAngle(), pcl::SampleConsensusModelPerpendicularPlane< PointT >::getEpsAngle(), pcl::SampleConsensusModel< PointT >::getRadiusLimits(), pcl::SACMODEL_CIRCLE2D, pcl::SACMODEL_CIRCLE3D, pcl::SACMODEL_LINE, pcl::SACMODEL_PARALLEL_LINE, pcl::SACMODEL_PARALLEL_PLANE, pcl::SACMODEL_PERPENDICULAR_PLANE, pcl::SACMODEL_PLANE, pcl::SACMODEL_SPHERE, pcl::SACMODEL_STICK, pcl::SampleConsensusModelParallelLine< PointT >::setAxis(), pcl::SampleConsensusModelParallelPlane< PointT >::setAxis(), pcl::SampleConsensusModelPerpendicularPlane< PointT >::setAxis(), pcl::SampleConsensusModelParallelLine< PointT >::setEpsAngle(), pcl::SampleConsensusModelParallelPlane< PointT >::setEpsAngle(), pcl::SampleConsensusModelPerpendicularPlane< PointT >::setEpsAngle(), and pcl::SampleConsensusModel< PointT >::setRadiusLimits().

Referenced by pcl::SACSegmentation< PointT >::getEpsAngle().

template<typename PointT >

void pcl::SACSegmentation< PointT >::segment | ( | PointIndices & | inliers,
|  | ModelCoefficients & | model_coefficients
| ) |  |

virtual

Base method for segmentation of a model in a PointCloud given by <setInputCloud (), setIndices ()>

Parameters

  [in] | inliers | the resultant point indices that support the model found (inliers)
  [out] | model_coefficients | the resultant model coefficients

Definition at line 75 of file sac_segmentation.hpp.

References pcl::PointIndices::header, pcl::ModelCoefficients::header, pcl::PointIndices::indices, and pcl::ModelCoefficients::values.

Referenced by pcl::SACSegmentation< PointT >::getEpsAngle().

template<typename PointT>

void pcl::SACSegmentation< PointT >::setAxis | ( | const Eigen::Vector3f & | ax | ) |

inline

Set the axis along which we need to search for a model perpendicular to.

Parameters

  [in] | ax | the axis along which we need to search for a model perpendicular to

Definition at line 223 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::axis_.

template<typename PointT>

void pcl::SACSegmentation< PointT >::setDistanceThreshold | ( | double | threshold | ) |

inline

Distance to the model threshold (user given parameter).

Parameters

  [in] | threshold | the distance threshold to use

Definition at line 139 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::threshold_.

template<typename PointT>

void pcl::SACSegmentation< PointT >::setEpsAngle | ( | double | ea | ) |

inline

Set the angle epsilon (delta) threshold.

Parameters

  [in] | ea | the maximum allowed difference between the model normal and the given axis in radians.

Definition at line 233 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::eps_angle_.

template<typename PointT>

void pcl::SACSegmentation< PointT >::setMaxIterations | ( | int | max_iterations | ) |

inline

Set the maximum number of iterations before giving up.

Parameters

  [in] | max_iterations | the maximum number of iterations the sample consensus method will run

Definition at line 149 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::max_iterations_.

template<typename PointT>

void pcl::SACSegmentation< PointT >::setMethodType | ( | int | method | ) |

inline

The type of sample consensus method to use (user given parameter).

Parameters

  [in] | method | the method type (check method_types.h)

Definition at line 129 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::method_type_.

template<typename PointT>

void pcl::SACSegmentation< PointT >::setModelType | ( | int | model | ) |

inline

The type of model to use (user given parameter).

Parameters

  [in] | model | the model type (check model_types.h)

Definition at line 111 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::model_type_.

template<typename PointT>

void pcl::SACSegmentation< PointT >::setOptimizeCoefficients | ( | bool | optimize | ) |

inline

Set to true if a coefficient refinement is required.

Parameters

  [in] | optimize | true for enabling model coefficient refinement, false otherwise

Definition at line 169 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::optimize_coefficients_.

template<typename PointT>

void pcl::SACSegmentation< PointT >::setProbability | ( | double | probability | ) |

inline

Set the probability of choosing at least one sample free from outliers.

Parameters

  [in] | probability | the model fitting probability

Definition at line 159 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::probability_.

template<typename PointT>

void pcl::SACSegmentation< PointT >::setRadiusLimits | ( | const double & | min_radius,
|  | const double & | max_radius
| ) |  |

inline

Set the minimum and maximum allowable radius limits for the model (applicable to models that estimate a radius)

Parameters

  [in] | min_radius | the minimum radius model
  [in] | max_radius | the maximum radius model

Definition at line 181 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::radius_max_, and pcl::SACSegmentation< PointT >::radius_min_.

template<typename PointT>

void pcl::SACSegmentation< PointT >::setSamplesMaxDist | ( | const double & | radius,
|  | SearchPtr | search
| ) |  |

inline

Set the maximum distance allowed when drawing random samples.

Parameters

  [in] | radius | the maximum distance (L2 norm)
  | search |

Definition at line 203 of file sac_segmentation.h.

References pcl::SACSegmentation< PointT >::samples_radius_, and pcl::SACSegmentation< PointT >::samples_radius_search_.

## Member Data Documentation

template<typename PointT>

Eigen::Vector3f pcl::SACSegmentation< PointT >::axis_

protected

The axis along which we need to search for a model perpendicular to.

Definition at line 290 of file sac_segmentation.h.

Referenced by pcl::SACSegmentation< PointT >::getAxis(), and pcl::SACSegmentation< PointT >::setAxis().

template<typename PointT>

double pcl::SACSegmentation< PointT >::eps_angle_

protected

The maximum allowed difference between the model normal and the given axis.

Definition at line 287 of file sac_segmentation.h.

Referenced by pcl::SACSegmentation< PointT >::getEpsAngle(), and pcl::SACSegmentation< PointT >::setEpsAngle().

template<typename PointT>

int pcl::SACSegmentation< PointT >::max_iterations_

protected

Maximum number of iterations before giving up (user given parameter).

Definition at line 293 of file sac_segmentation.h.

Referenced by pcl::SACSegmentation< PointT >::getMaxIterations(), and pcl::SACSegmentation< PointT >::setMaxIterations().

template<typename PointT>

int pcl::SACSegmentation< PointT >::method_type_

protected

The type of sample consensus method to use (user given parameter).

Definition at line 269 of file sac_segmentation.h.

Referenced by pcl::SACSegmentation< PointT >::getMethodType(), and pcl::SACSegmentation< PointT >::setMethodType().

template<typename PointT>

SampleConsensusModelPtr pcl::SACSegmentation< PointT >::model_

protected

The model that needs to be segmented.

Definition at line 260 of file sac_segmentation.h.

Referenced by pcl::SACSegmentation< PointT >::getModel().

template<typename PointT>

int pcl::SACSegmentation< PointT >::model_type_

protected

The type of model to use (user given parameter).

Definition at line 266 of file sac_segmentation.h.

Referenced by pcl::SACSegmentation< PointT >::getModelType(), and pcl::SACSegmentation< PointT >::setModelType().

template<typename PointT>

bool pcl::SACSegmentation< PointT >::optimize_coefficients_

protected

Set to true if a coefficient refinement is required.

Definition at line 275 of file sac_segmentation.h.

Referenced by pcl::SACSegmentation< PointT >::getOptimizeCoefficients(), and pcl::SACSegmentation< PointT >::setOptimizeCoefficients().

template<typename PointT>

double pcl::SACSegmentation< PointT >::probability_

protected

Desired probability of choosing at least one sample free from outliers (user given parameter).

Definition at line 296 of file sac_segmentation.h.

Referenced by pcl::SACSegmentation< PointT >::getProbability(), and pcl::SACSegmentation< PointT >::setProbability().

template<typename PointT>

double pcl::SACSegmentation< PointT >::radius_max_

protected

Definition at line 278 of file sac_segmentation.h.

Referenced by pcl::SACSegmentation< PointT >::getRadiusLimits(), and pcl::SACSegmentation< PointT >::setRadiusLimits().

template<typename PointT>

double pcl::SACSegmentation< PointT >::radius_min_

protected

The minimum and maximum radius limits for the model.

Applicable to all models that estimate a radius.

Definition at line 278 of file sac_segmentation.h.

Referenced by pcl::SACSegmentation< PointT >::getRadiusLimits(), and pcl::SACSegmentation< PointT >::setRadiusLimits().

template<typename PointT>

bool pcl::SACSegmentation< PointT >::random_

protected

Set to true if we need a random seed.

Definition at line 299 of file sac_segmentation.h.

template<typename PointT>

SampleConsensusPtr pcl::SACSegmentation< PointT >::sac_

protected

The sample consensus segmentation method.

Definition at line 263 of file sac_segmentation.h.

Referenced by pcl::SACSegmentation< PointT >::getMethod().

template<typename PointT>

double pcl::SACSegmentation< PointT >::samples_radius_

protected

The maximum distance of subsequent samples from the first (radius search)

Definition at line 281 of file sac_segmentation.h.

Referenced by pcl::SACSegmentation< PointT >::getSamplesMaxDist(), and pcl::SACSegmentation< PointT >::setSamplesMaxDist().

template<typename PointT>

SearchPtr pcl::SACSegmentation< PointT >::samples_radius_search_

protected

The search object for picking subsequent samples using radius search.

Definition at line 284 of file sac_segmentation.h.

Referenced by pcl::SACSegmentation< PointT >::setSamplesMaxDist().

template<typename PointT>

double pcl::SACSegmentation< PointT >::threshold_

protected

Distance to the model threshold (user given parameter).

Definition at line 272 of file sac_segmentation.h.

Referenced by pcl::SACSegmentation< PointT >::getDistanceThreshold(), and pcl::SACSegmentation< PointT >::setDistanceThreshold().

The documentation for this class was generated from the following files:

- /build/pcl-6_P28C/pcl-1.7.2/segmentation/include/pcl/segmentation/sac_segmentation.h
- /build/pcl-6_P28C/pcl-1.7.2/segmentation/include/pcl/segmentation/impl/sac_segmentation.hpp