A Sample Consensus Model class for 3D line segmentation. More...
#include <sac_model_line.h>
Public Member Functions | |
void | computeCentroid (const sensor_msgs::PointCloud &points, const std::vector< int > &indices, geometry_msgs::Point32 ¢roid) |
Compute the centroid of a set of points using their indices and return it as a Point32 message. | |
void | computeCovarianceMatrix (const sensor_msgs::PointCloud &points, const std::vector< int > &indices, Eigen::Matrix3d &covariance_matrix, geometry_msgs::Point32 ¢roid) |
Compute the 3x3 covariance matrix of a given set of points using their indices. The result is returned as a Eigen::Matrix3d. | |
virtual bool | computeModelCoefficients (const std::vector< int > &samples) |
Check whether the given index samples can form a valid line model, compute the model coefficients from these samples and store them internally in model_coefficients_. The line coefficients are represented by the points themselves. | |
geometry_msgs::Point32 | cross (const geometry_msgs::Point32 &p1, const geometry_msgs::Point32 &p2) |
Compute the cross product between two points (vectors). | |
virtual bool | doSamplesVerifyModel (const std::set< int > &indices, double threshold) |
Verify whether a subset of indices verifies the internal line 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 line model. | |
virtual int | getModelType () |
Return an unique id for this model (SACMODEL_LINE). | |
virtual void | getSamples (int &iterations, std::vector< int > &samples) |
Get 2 random 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 line model. | |
virtual void | projectPointsInPlace (const std::vector< int > &inliers, const std::vector< double > &model_coefficients) |
Project inliers (in place) onto the given line model. | |
virtual void | refitModel (const std::vector< int > &inliers, std::vector< double > &refit_coefficients) |
Recompute the line coefficients using the given inlier set and return them to the user. | |
SACModelLine () | |
Constructor for base SACModelLine. | |
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 | ~SACModelLine () |
Destructor for base SACModelLine. |
A Sample Consensus Model class for 3D line segmentation.
Definition at line 46 of file sac_model_line.h.
sample_consensus::SACModelLine::SACModelLine | ( | ) | [inline] |
Constructor for base SACModelLine.
Definition at line 51 of file sac_model_line.h.
virtual sample_consensus::SACModelLine::~SACModelLine | ( | ) | [inline, virtual] |
Destructor for base SACModelLine.
Definition at line 55 of file sac_model_line.h.
void sample_consensus::SACModelLine::computeCentroid | ( | const sensor_msgs::PointCloud & | points, | |
const std::vector< int > & | indices, | |||
geometry_msgs::Point32 & | centroid | |||
) | [inline] |
Compute the centroid of a set of points using their indices and return it as a Point32 message.
points | the input point cloud | |
indices | the point cloud indices that need to be used | |
centroid | the output centroid |
Definition at line 103 of file sac_model_line.h.
void sample_consensus::SACModelLine::computeCovarianceMatrix | ( | const sensor_msgs::PointCloud & | points, | |
const std::vector< int > & | indices, | |||
Eigen::Matrix3d & | covariance_matrix, | |||
geometry_msgs::Point32 & | centroid | |||
) | [inline] |
Compute the 3x3 covariance matrix of a given set of points using their indices. The result is returned as a Eigen::Matrix3d.
points | the input point cloud | |
indices | the point cloud indices that need to be used | |
covariance_matrix | the 3x3 covariance matrix | |
centroid | the computed centroid |
Definition at line 129 of file sac_model_line.h.
bool sample_consensus::SACModelLine::computeModelCoefficients | ( | const std::vector< int > & | samples | ) | [virtual] |
Check whether the given index samples can form a valid line model, compute the model coefficients from these samples and store them internally in model_coefficients_. The line coefficients are represented by the points themselves.
samples | the point indices found as possible good candidates for creating a valid model |
Implements sample_consensus::SACModel.
Definition at line 238 of file sac_model_line.cpp.
geometry_msgs::Point32 sample_consensus::SACModelLine::cross | ( | const geometry_msgs::Point32 & | p1, | |
const geometry_msgs::Point32 & | p2 | |||
) | [inline] |
Compute the cross product between two points (vectors).
p1 | the first point/vector | |
p2 | the second point/vector |
Definition at line 87 of file sac_model_line.h.
bool sample_consensus::SACModelLine::doSamplesVerifyModel | ( | const std::set< int > & | indices, | |
double | threshold | |||
) | [virtual] |
Verify whether a subset of indices verifies the internal line model coefficients.
indices | the data indices that need to be tested against the line model | |
threshold | a maximum admissible distance threshold for determining the inliers from the outliers |
Implements sample_consensus::SACModel.
Definition at line 296 of file sac_model_line.cpp.
void sample_consensus::SACModelLine::getDistancesToModel | ( | const std::vector< double > & | model_coefficients, | |
std::vector< double > & | distances | |||
) | [virtual] |
Compute all distances from the cloud data to a given line model.
model_coefficients | the coefficients of a line model that we need to compute distances to | |
distances | the resultant estimated distances |
Implements sample_consensus::SACModel.
Definition at line 134 of file sac_model_line.cpp.
virtual int sample_consensus::SACModelLine::getModelType | ( | ) | [inline, virtual] |
Return an unique id for this model (SACMODEL_LINE).
Implements sample_consensus::SACModel.
Definition at line 79 of file sac_model_line.h.
void sample_consensus::SACModelLine::getSamples | ( | int & | iterations, | |
std::vector< int > & | samples | |||
) | [virtual] |
Get 2 random 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 46 of file sac_model_line.cpp.
void sample_consensus::SACModelLine::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 line model.
inliers | the data inliers that we want to project on the line model | |
model_coefficients | the coefficients of a line model | |
projected_points | the resultant projected points |
Implements sample_consensus::SACModel.
Definition at line 166 of file sac_model_line.cpp.
void sample_consensus::SACModelLine::projectPointsInPlace | ( | const std::vector< int > & | inliers, | |
const std::vector< double > & | model_coefficients | |||
) | [virtual] |
Project inliers (in place) onto the given line model.
inliers | the data inliers that we want to project on the line model | |
model_coefficients | the coefficients of a line model |
Implements sample_consensus::SACModel.
Definition at line 209 of file sac_model_line.cpp.
void sample_consensus::SACModelLine::refitModel | ( | const std::vector< int > & | inliers, | |
std::vector< double > & | refit_coefficients | |||
) | [virtual] |
Recompute the line 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 258 of file sac_model_line.cpp.
void sample_consensus::SACModelLine::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 line 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.
Definition at line 84 of file sac_model_line.cpp.
bool sample_consensus::SACModelLine::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_line.h.