Class SACSegmentation
- Namespace
- OpenCvSharp
- Assembly
- OpenCvSharp.dll
Sample Consensus algorithm segmentation of 3D point cloud model.
public class SACSegmentation : Algorithm, IDisposable
- Inheritance
-
SACSegmentation
- Implements
- Inherited Members
Remarks
See SacMethod for supported algorithms and SacModelType for supported models.
Properties
Confidence
The confidence that ensures at least one of the selections is an error-free set of data points.
public virtual double Confidence { get; set; }
Property Value
DistanceThreshold
The distance to the model threshold. Considered as inlier point if distance to the model is less than threshold.
public virtual double DistanceThreshold { get; set; }
Property Value
IsParallel
Whether to use parallelism or not. The number of threads is set by SetNumThreads(int).
public virtual bool IsParallel { get; set; }
Property Value
MaxIterations
The maximum number of iterations to attempt.
public virtual int MaxIterations { get; set; }
Property Value
NumberOfModelsExpected
The number of models expected.
public virtual int NumberOfModelsExpected { get; set; }
Property Value
RandomGeneratorState
State used to initialize the RNG (Random Number Generator).
public virtual ulong RandomGeneratorState { get; set; }
Property Value
SacMethodType
The type of sample consensus method to use.
public virtual SacMethod SacMethodType { get; set; }
Property Value
SacModelType
The type of sample consensus model to use.
public virtual SacModelType SacModelType { get; set; }
Property Value
Methods
Create(SacModelType, SacMethod, double, int)
Creates a SACSegmentation object.
public static SACSegmentation Create(SacModelType sacModelType = SacModelType.SAC_MODEL_PLANE, SacMethod sacMethod = SacMethod.SAC_METHOD_RANSAC, double threshold = 0.5, int maxIterations = 1000)
Parameters
sacModelTypeSacModelTypeThe type of sample consensus model to use.
sacMethodSacMethodThe type of sample consensus method to use.
thresholddoubleThe distance to the model threshold.
maxIterationsintThe maximum number of iterations to attempt.
Returns
- SACSegmentation
SACSegmentation instance
GetCustomModelConstraints()
Gets the custom model coefficient constraint function previously set via SetCustomModelConstraints(ModelConstraintFunction?), or null if none is set.
public virtual SACSegmentation.ModelConstraintFunction? GetCustomModelConstraints()
Returns
GetRadiusLimits(out double, out double)
Gets the minimum and maximum radius limits for the model.
public virtual void GetRadiusLimits(out double radiusMin, out double radiusMax)
Parameters
Segment(InputArray, OutputArray, OutputArray)
Executes segmentation using the sample consensus method.
public virtual int Segment(InputArray inputPts, OutputArray labels, OutputArray modelsCoefficients)
Parameters
inputPtsInputArrayOriginal point cloud, vector of Point3 or Mat of size Nx3/3xN.
labelsOutputArrayThe label corresponds to the model number, 0 means it does not belong to any model, range [0, Number of final resultant models obtained].
modelsCoefficientsOutputArrayThe resultant models coefficients. Placed in a matrix of NxK with depth CV_64F, where N is the number of models and K is the number of coefficients of one model.
Returns
- int
Number of final resultant models obtained by segmentation.
SetCustomModelConstraints(ModelConstraintFunction?)
Sets a custom model coefficient constraint function. A custom function that takes model coefficients and returns whether the model is acceptable or not. Pass null to clear a previously set constraint function.
public virtual void SetCustomModelConstraints(SACSegmentation.ModelConstraintFunction? customModelConstraints)
Parameters
customModelConstraintsSACSegmentation.ModelConstraintFunction
SetRadiusLimits(double, double)
Sets the minimum and maximum radius limits for the model. Only used for models whose model parameters include a radius.
public virtual void SetRadiusLimits(double radiusMin, double radiusMax)