Go to the documentation of this file.
33 #ifndef _SAMPLE_CONSENSUS_SAC_H_
34 #define _SAMPLE_CONSENSUS_SAC_H_
37 #include <pcl/point_types.h>
127 virtual std::vector<int>
163 std::set<int> random_idx;
164 for (
int i = 0; i < nr_samples; i++)
165 random_idx.insert ((
int) (points.points.size () * (rand () / (RAND_MAX + 1.0))));
180 std::set<int> random_idx;
181 for (
int i = 0; i < nr_samples; i++)
182 random_idx.insert ((
int) (indices.size () * (rand () / (RAND_MAX + 1.0))));
SAC(SACModel *model)
Constructor for base SAC.
virtual bool computeModel(int debug=0)=0
Compute the actual model. Pure virtual.
pcl::PointCloud< pcl::PointXYZ > PointCloud
virtual std::vector< int > getInliers()
Get a list of the model inliers, found after computeModel ()
virtual int removeInliers()
Remove the inliers found from the initial set of given point indices.
double threshold_
Distance to model threshold.
double probability_
Desired probability of choosing at least one sample free from outliers.
virtual void setProbability(double probability)
Set the desired probability of choosing at least one sample free from outliers.
std::vector< int > getBestInliers()
Return the best set of inliers found so far for this model.
virtual void projectPoints(const std::vector< int > &inliers, const std::vector< double > &model_coefficients, PointCloud &projected_points)=0
Create a new point cloud with inliers projected onto the model. Pure virtual.
int max_iterations_
Maximum number of iterations before giving up.
std::set< int > getRandomSamples(PointCloud points, int nr_samples)
Get a set of randomly selected indices.
virtual bool computeModelCoefficients(const std::vector< int > &samples)=0
Check whether the given index samples can form a valid model, compute the model coefficients from the...
std::set< int > getRandomSamples(PointCloud points, std::vector< int > indices, int nr_samples)
Get a vector of randomly selected indices.
std::vector< int > getBestModel()
Return the best model found so far.
virtual ~SAC()
Destructor for base SAC.
virtual void refineCoefficients(std::vector< double > &refined_coefficients)
Use Least-Squares optimizations to refine the coefficients of the model, and return them.
SAC()
Constructor for base SAC.
virtual int removeInliers()
Remove the model inliers from the list of data indices. Returns the number of indices left.
virtual void computeCoefficients(std::vector< double > &coefficients)
Compute the coefficients of the model and return them.
virtual void refitModel(const std::vector< int > &inliers, std::vector< double > &refit_coefficients)=0
Recompute the model coefficients using the given inlier set and return them to the user....
virtual void setThreshold(double threshold)
Set the threshold to model.
int iterations_
Total number of internal loop iterations that we've done so far.
PointCloud getPointCloud(std::vector< int > indices)
Return the point cloud representing a set of given indices.
std::vector< double > getModelCoefficients()
Return the model coefficients of the best model found so far.
SACModel * sac_model_
The underlying data model used (i.e. what is it that we attempt to search for).
virtual void setMaxIterations(int max_iterations)
Set the maximum number of iterations.
virtual void projectPointsToModel(const std::vector< int > &indices, const std::vector< double > &model_coefficients, PointCloud &projected_points)
Project a set of given points (using their indices) onto the model and return their projections.