A Sample Consensus Model class for 3D plane segmentation. More...
#include <sac_model_plane.h>
Public Member Functions | |
virtual bool | computeModelCoefficients (const std::vector< int > &samples) |
Check whether the given index samples can form a valid plane model, compute the model coefficients from these samples and store them internally in model_coefficients_. The plane coefficients are: a, b, c, d (ax+by+cz+d=0). | |
virtual bool | doSamplesVerifyModel (const std::set< int > &indices, double threshold) |
Verify whether a subset of indices verifies the internal plane model coefficients. | |
virtual void | getDistancesToModel (const std::vector< double > &model_coefficients, std::vector< double > &distances) |
Compute all distances from the cloud data to a given plane model. | |
virtual int | getModelType () |
Return an unique id for this model (SACMODEL_PLANE). | |
virtual void | getSamples (int &iterations, std::vector< int > &samples) |
Get 3 random non-collinear points as data samples and return them as point indices. | |
virtual void | projectPoints (const std::vector< int > &inliers, const std::vector< double > &model_coefficients, sensor_msgs::PointCloud &projected_points) |
Create a new point cloud with inliers projected onto the plane model. | |
virtual void | projectPointsInPlace (const std::vector< int > &inliers, const std::vector< double > &model_coefficients) |
Project inliers (in place) onto the given plane model. | |
virtual void | refitModel (const std::vector< int > &inliers, std::vector< double > &refit_coefficients) |
Recompute the plane coefficients using the given inlier set and return them to the user. | |
SACModelPlane () | |
Constructor for base SACModelPlane. | |
virtual void | selectWithinDistance (const std::vector< double > &model_coefficients, double threshold, std::vector< int > &inliers) |
Select all the points which respect the given model coefficients as inliers. | |
bool | testModelCoefficients (const std::vector< double > &model_coefficients) |
Test whether the given model coefficients are valid given the input point cloud data. | |
virtual | ~SACModelPlane () |
Destructor for base SACModelPlane. | |
Static Public Member Functions | |
static int | functionToOptimize (void *p, int m, int n, const double *x, double *fvec, int iflag) |
A Sample Consensus Model class for 3D plane segmentation.
Definition at line 46 of file sac_model_plane.h.
sample_consensus::SACModelPlane::SACModelPlane | ( | ) | [inline] |
Constructor for base SACModelPlane.
Definition at line 51 of file sac_model_plane.h.
virtual sample_consensus::SACModelPlane::~SACModelPlane | ( | ) | [inline, virtual] |
Destructor for base SACModelPlane.
Definition at line 55 of file sac_model_plane.h.
bool sample_consensus::SACModelPlane::computeModelCoefficients | ( | const std::vector< int > & | samples | ) | [virtual] |
Check whether the given index samples can form a valid plane model, compute the model coefficients from these samples and store them internally in model_coefficients_. The plane coefficients are: a, b, c, d (ax+by+cz+d=0).
samples | the point indices found as possible good candidates for creating a valid model |
Implements sample_consensus::SACModel.
Definition at line 248 of file sac_model_plane.cpp.
bool sample_consensus::SACModelPlane::doSamplesVerifyModel | ( | const std::set< int > & | indices, | |
double | threshold | |||
) | [virtual] |
Verify whether a subset of indices verifies the internal plane model coefficients.
indices | the data indices that need to be tested against the plane model | |
threshold | a maximum admissible distance threshold for determining the inliers from the outliers |
Implements sample_consensus::SACModel.
Definition at line 332 of file sac_model_plane.cpp.
static int sample_consensus::SACModelPlane::functionToOptimize | ( | void * | p, | |
int | m, | |||
int | n, | |||
const double * | x, | |||
double * | fvec, | |||
int | iflag | |||
) | [static] |
void sample_consensus::SACModelPlane::getDistancesToModel | ( | const std::vector< double > & | model_coefficients, | |
std::vector< double > & | distances | |||
) | [virtual] |
Compute all distances from the cloud data to a given plane model.
model_coefficients | the coefficients of a plane model that we need to compute distances to | |
distances | the resultant estimated distances |
Implements sample_consensus::SACModel.
Reimplemented in sample_consensus::SACModelNormalPlane.
Definition at line 144 of file sac_model_plane.cpp.
virtual int sample_consensus::SACModelPlane::getModelType | ( | ) | [inline, virtual] |
Return an unique id for this model (SACMODEL_PLANE).
Implements sample_consensus::SACModel.
Reimplemented in sample_consensus::SACModelNormalPlane.
Definition at line 81 of file sac_model_plane.h.
void sample_consensus::SACModelPlane::getSamples | ( | int & | iterations, | |
std::vector< int > & | samples | |||
) | [virtual] |
Get 3 random non-collinear points as data samples and return them as point indices.
iterations | the internal number of iterations used by SAC methods | |
samples | the resultant model samples |
Implements sample_consensus::SACModel.
Definition at line 45 of file sac_model_plane.cpp.
void sample_consensus::SACModelPlane::projectPoints | ( | const std::vector< int > & | inliers, | |
const std::vector< double > & | model_coefficients, | |||
sensor_msgs::PointCloud & | projected_points | |||
) | [virtual] |
Create a new point cloud with inliers projected onto the plane model.
inliers | the data inliers that we want to project on the plane model | |
model_coefficients | the *normalized* coefficients of a plane model | |
projected_points | the resultant projected points |
Implements sample_consensus::SACModel.
Definition at line 166 of file sac_model_plane.cpp.
void sample_consensus::SACModelPlane::projectPointsInPlace | ( | const std::vector< int > & | inliers, | |
const std::vector< double > & | model_coefficients | |||
) | [virtual] |
Project inliers (in place) onto the given plane model.
inliers | the data inliers that we want to project on the plane model | |
model_coefficients | the *normalized* coefficients of a plane model |
Implements sample_consensus::SACModel.
Definition at line 214 of file sac_model_plane.cpp.
void sample_consensus::SACModelPlane::refitModel | ( | const std::vector< int > & | inliers, | |
std::vector< double > & | refit_coefficients | |||
) | [virtual] |
Recompute the plane coefficients using the given inlier set and return them to the user.
inliers | the data inliers found as supporting the model | |
refit_coefficients | the resultant recomputed coefficients after non-linear optimization |
Implements sample_consensus::SACModel.
Definition at line 306 of file sac_model_plane.cpp.
void sample_consensus::SACModelPlane::selectWithinDistance | ( | const std::vector< double > & | model_coefficients, | |
double | threshold, | |||
std::vector< int > & | inliers | |||
) | [virtual] |
Select all the points which respect the given model coefficients as inliers.
model_coefficients | the coefficients of a plane model that we need to compute distances to | |
threshold | a maximum admissible distance threshold for determining the inliers from the outliers | |
inliers | the resultant model inliers |
Implements sample_consensus::SACModel.
Reimplemented in sample_consensus::SACModelNormalPlane.
Definition at line 114 of file sac_model_plane.cpp.
bool sample_consensus::SACModelPlane::testModelCoefficients | ( | const std::vector< double > & | model_coefficients | ) | [inline, virtual] |
Test whether the given model coefficients are valid given the input point cloud data.
model_coefficients | the model coefficients that need to be tested |
Implements sample_consensus::SACModel.
Definition at line 64 of file sac_model_plane.h.