OpenCV
5.0.0-pre
Open Source Computer Vision
|
Sample Consensus algorithm segmentation of 3D point cloud model. More...
#include <opencv2/3d/ptcloud.hpp>
Public Types | |
using | ModelConstraintFunction = std::function< bool(const std::vector< double > &)> |
Custom function that take the model coefficients and return whether the model is acceptable or not. | |
Public Member Functions | |
SACSegmentation ()=default | |
virtual | ~SACSegmentation ()=default |
virtual double | getConfidence () const =0 |
Get the confidence that ensure at least one of selections is an error-free set of data points. | |
virtual const ModelConstraintFunction & | getCustomModelConstraints () const =0 |
Get custom model coefficient constraint function. | |
virtual double | getDistanceThreshold () const =0 |
Get the distance to the model threshold. | |
virtual int | getMaxIterations () const =0 |
Get the maximum number of iterations to attempt. | |
virtual int | getNumberOfModelsExpected () const =0 |
Get the expected number of models. | |
virtual void | getRadiusLimits (double &radius_min, double &radius_max) const =0 |
Get the minimum and maximum radius limits for the model. | |
virtual uint64 | getRandomGeneratorState () const =0 |
Get state used to initialize the RNG(Random Number Generator). | |
virtual SacMethod | getSacMethodType () const =0 |
Get the type of sample consensus method used. | |
virtual SacModelType | getSacModelType () const =0 |
Get the type of sample consensus model used. | |
virtual bool | isParallel () const =0 |
Get whether to use parallelism or not. | |
virtual int | segment (InputArray input_pts, OutputArray labels, OutputArray models_coefficients)=0 |
Execute segmentation using the sample consensus method. | |
virtual void | setConfidence (double confidence)=0 |
Set the confidence that ensure at least one of selections is an error-free set of data points. | |
virtual void | setCustomModelConstraints (const ModelConstraintFunction &custom_model_constraints)=0 |
virtual void | setDistanceThreshold (double threshold)=0 |
virtual void | setMaxIterations (int max_iterations)=0 |
Set the maximum number of iterations to attempt. | |
virtual void | setNumberOfModelsExpected (int number_of_models_expected)=0 |
Set the number of models expected. | |
virtual void | setParallel (bool is_parallel)=0 |
virtual void | setRadiusLimits (double radius_min, double radius_max)=0 |
virtual void | setRandomGeneratorState (uint64 rng_state)=0 |
Set state used to initialize the RNG(Random Number Generator). | |
virtual void | setSacMethodType (SacMethod sac_method)=0 |
Set the type of sample consensus method to use. | |
virtual void | setSacModelType (SacModelType sac_model_type)=0 |
Set the type of sample consensus model to use. | |
Static Public Member Functions | |
static Ptr< SACSegmentation > | create (SacModelType sac_model_type=SAC_MODEL_PLANE, SacMethod sac_method=SAC_METHOD_RANSAC, double threshold=0.5, int max_iterations=1000) |
Sample Consensus algorithm segmentation of 3D point cloud model.
Example of segmenting plane from a 3D point cloud using the RANSAC algorithm:
using cv::SACSegmentation::ModelConstraintFunction = std::function<bool(const std::vector<double> &)> |
Custom function that take the model coefficients and return whether the model is acceptable or not.
Example of constructing SACSegmentation::ModelConstraintFunction:
|
default |
|
virtualdefault |
|
static |
|
pure virtual |
Get the confidence that ensure at least one of selections is an error-free set of data points.
|
pure virtual |
Get custom model coefficient constraint function.
|
pure virtual |
Get the distance to the model threshold.
|
pure virtual |
Get the maximum number of iterations to attempt.
|
pure virtual |
Get the expected number of models.
|
pure virtual |
Get the minimum and maximum radius limits for the model.
|
pure virtual |
Get state used to initialize the RNG(Random Number Generator).
|
pure virtual |
Get the type of sample consensus method used.
|
pure virtual |
Get the type of sample consensus model used.
|
pure virtual |
Get whether to use parallelism or not.
|
pure virtual |
Execute segmentation using the sample consensus method.
input_pts | Original point cloud, vector of Point3 or Mat of size Nx3/3xN. | |
[out] | labels | The label corresponds to the model number, 0 means it does not belong to any model, range [0, Number of final resultant models obtained]. |
[out] | models_coefficients | The resultant models coefficients. Currently supports passing in cv::Mat. Models coefficients are placed in a matrix of NxK with depth CV_64F (will automatically adjust if the passing one does not look like this), where N is the number of models and K is the number of coefficients of one model. The coefficients for each model refer to the comments inside enumeration type SacModelType. |
|
pure virtual |
Set the confidence that ensure at least one of selections is an error-free set of data points.
|
pure virtual |
Set custom model coefficient constraint function. A custom function that takes model coefficients and returns whether the model is acceptable or not.
|
pure virtual |
Set the distance to the model threshold. Considered as inlier point if distance to the model less than threshold.
|
pure virtual |
Set the maximum number of iterations to attempt.
|
pure virtual |
Set the number of models expected.
|
pure virtual |
Set whether to use parallelism or not. The number of threads is set by cv::setNumThreads(int nthreads).
|
pure virtual |
Set the minimum and maximum radius limits for the model. Only used for models whose model parameters include a radius.
|
pure virtual |
Set state used to initialize the RNG(Random Number Generator).
|
pure virtual |
Set the type of sample consensus method to use.
|
pure virtual |
Set the type of sample consensus model to use.