AliceVision
Photogrammetric Computer Vision Framework
Public Types | Public Member Functions | List of all members
aliceVision::robustEstimation::PointFittingRansacKernel< SolverT_, ErrorT_, ModelT_, SolverLsT_ > Class Template Referenceabstract

A virtual kernel used for the ACRANSAC / LORANSAC framework. More...

#include <PointFittingRansacKernel.hpp>

Inheritance diagram for aliceVision::robustEstimation::PointFittingRansacKernel< SolverT_, ErrorT_, ModelT_, SolverLsT_ >:
aliceVision::robustEstimation::IRansacKernel< ModelT_ > aliceVision::robustEstimation::PointFittingKernel< SolverT_, ErrorT_, ModelT_ >

Public Types

using PFKernel = robustEstimation::PointFittingKernel< SolverT_, ErrorT_, ModelT_ >
 
- Public Types inherited from aliceVision::robustEstimation::PointFittingKernel< SolverT_, ErrorT_, ModelT_ >
using SolverT = SolverT_
 
using ErrorT = ErrorT_
 
using ModelT = ModelT_
 

Public Member Functions

 PointFittingRansacKernel (const Mat &x1, const Mat &x2)
 
std::size_t getMinimumNbRequiredSamples () const override
 Return the minimum number of required samples for the solver. More...
 
std::size_t getMinimumNbRequiredSamplesLS () const override
 
std::size_t getMaximumNbModels () const override
 Return the maximum number of models for the solver. More...
 
void fit (const std::vector< std::size_t > &samples, std::vector< ModelT_ > &models) const override
 This function is called to estimate the model from the minimum number of sample minSample (i.e. minimal problem solver). More...
 
void fitLS (const std::vector< std::size_t > &inliers, std::vector< ModelT_ > &models, const std::vector< double > *weights=nullptr) const override
 This function is called to estimate the model using a least squared algorithm from a minimum of minSampleLS. More...
 
void computeWeights (const ModelT_ &model, const std::vector< std::size_t > &inliers, std::vector< double > &weights, const double eps=0.001) const override
 Function used to estimate the weights, typically used by the least square algorithm. More...
 
double error (std::size_t sample, const ModelT_ &model) const override
 Function that computes the estimation error for a given model and a given element. More...
 
void errors (const ModelT_ &model, std::vector< double > &errors) const override
 Function that computes the estimation error for a given model and all the elements. More...
 
virtual void unnormalize (ModelT_ &model) const =0
 Function used to unnormalize the model. More...
 
std::size_t nbSamples () const override
 The number of elements in the data. More...
 
virtual double logalpha0 () const =0
 Get logalpha0, Alpha0 is used to make the error adaptive to the image size. More...
 
virtual double errorVectorDimension () const =0
 
virtual double unormalizeError (double val) const =0
 
virtual Mat3 normalizer1 () const =0
 
virtual double thresholdNormalizer () const =0
 
- Public Member Functions inherited from aliceVision::robustEstimation::IRansacKernel< ModelT_ >
virtual std::size_t getMinimumNbRequiredSamples () const=0
 Return the minimum number of required samples for the solver. More...
 
virtual std::size_t getMinimumNbRequiredSamplesLS () const=0
 Return the minimum number of required samples for the solver Ls. More...
 
virtual std::size_t getMaximumNbModels () const=0
 Return the maximum number of models for the solver. More...
 
virtual std::size_t nbSamples () const=0
 The number of elements in the data. More...
 
virtual double logalpha0 () const=0
 Get logalpha0, Alpha0 is used to make the error adaptive to the image size. More...
 
virtual double errorVectorDimension () const=0
 
virtual Mat3 normalizer1 () const=0
 
virtual double thresholdNormalizer () const=0
 
- Public Member Functions inherited from aliceVision::robustEstimation::PointFittingKernel< SolverT_, ErrorT_, ModelT_ >
 PointFittingKernel (const Mat &x1, const Mat &x2)
 
std::size_t getMinimumNbRequiredSamples () const
 Return the minimum number of required samples. More...
 
std::size_t getMaximumNbModels () const
 Return the maximum number of models. More...
 
std::size_t nbSamples () const
 get the number of putative points More...
 

Additional Inherited Members

- Protected Attributes inherited from aliceVision::robustEstimation::PointFittingKernel< SolverT_, ErrorT_, ModelT_ >
const Mat & _x1
 left corresponding data
 
const Mat & _x2
 right corresponding data
 
const SolverT _kernelSolver {}
 two view solver
 
const ErrorT _errorEstimator {}
 solver error estimation
 

Detailed Description

template<typename SolverT_, typename ErrorT_, typename ModelT_, typename SolverLsT_ = robustEstimation::UndefinedSolver<ModelT_>>
class aliceVision::robustEstimation::PointFittingRansacKernel< SolverT_, ErrorT_, ModelT_, SolverLsT_ >

A virtual kernel used for the ACRANSAC / LORANSAC framework.

Template Parameters
SolverT_The minimal solver able to find a solution from a minimum set of points.
ErrorT_The functor computing the error for each data sample with respect to the estimated model.
UnnormalizerT_The functor used to normalize the data before the estimation of the model.
ModelT_= Mat34Model The type of the model to estimate.
SolverLsT_= SolverT The least square solver that is used to find a solution from any set of data larger than the minimum required.
Note
Handle data normalization and compute the corresponding logalpha 0 that depends of the error model (point to line, or point to point)

Member Function Documentation

◆ computeWeights()

template<typename SolverT_ , typename ErrorT_ , typename ModelT_ , typename SolverLsT_ = robustEstimation::UndefinedSolver<ModelT_>>
void aliceVision::robustEstimation::PointFittingRansacKernel< SolverT_, ErrorT_, ModelT_, SolverLsT_ >::computeWeights ( const ModelT_ &  model,
const std::vector< std::size_t > &  inliers,
std::vector< double > &  weights,
const double  eps = 0.001 
) const
inlineoverridevirtual

Function used to estimate the weights, typically used by the least square algorithm.

Parameters
[in]modelThe model against which the weights are computed.
[in]inliersThe array of the indices of the data to be used.
[out]vec_weightsThe array of weight of the same size as inliers.
[in]epsAn optional threshold to max out the value of the threshold (typically to avoid division by zero or too small numbers).

Implements aliceVision::robustEstimation::IRansacKernel< ModelT_ >.

◆ error()

template<typename SolverT_ , typename ErrorT_ , typename ModelT_ , typename SolverLsT_ = robustEstimation::UndefinedSolver<ModelT_>>
double aliceVision::robustEstimation::PointFittingRansacKernel< SolverT_, ErrorT_, ModelT_, SolverLsT_ >::error ( std::size_t  sample,
const ModelT_ &  model 
) const
inlineoverridevirtual

Function that computes the estimation error for a given model and a given element.

Parameters
[in]sampleThe index of the element for which the error is computed.
[in]modelThe model to consider.
Returns
The estimation error for the given element and the given model.

Reimplemented from aliceVision::robustEstimation::PointFittingKernel< SolverT_, ErrorT_, ModelT_ >.

◆ errors()

template<typename SolverT_ , typename ErrorT_ , typename ModelT_ , typename SolverLsT_ = robustEstimation::UndefinedSolver<ModelT_>>
void aliceVision::robustEstimation::PointFittingRansacKernel< SolverT_, ErrorT_, ModelT_, SolverLsT_ >::errors ( const ModelT_ &  model,
std::vector< double > &  errors 
) const
inlineoverridevirtual

Function that computes the estimation error for a given model and all the elements.

Parameters
[in]modelThe model to consider.
[out]vec_errorsThe vector containing all the estimation errors for every element.

Reimplemented from aliceVision::robustEstimation::PointFittingKernel< SolverT_, ErrorT_, ModelT_ >.

◆ fit()

template<typename SolverT_ , typename ErrorT_ , typename ModelT_ , typename SolverLsT_ = robustEstimation::UndefinedSolver<ModelT_>>
void aliceVision::robustEstimation::PointFittingRansacKernel< SolverT_, ErrorT_, ModelT_, SolverLsT_ >::fit ( const std::vector< std::size_t > &  samples,
std::vector< ModelT_ > &  models 
) const
inlineoverridevirtual

This function is called to estimate the model from the minimum number of sample minSample (i.e. minimal problem solver).

Parameters
[in]samplesA vector containing the indices of the data to be used for the minimal estimation.
[out]modelsThe model(s) estimated by the minimal solver.

Reimplemented from aliceVision::robustEstimation::PointFittingKernel< SolverT_, ErrorT_, ModelT_ >.

◆ fitLS()

template<typename SolverT_ , typename ErrorT_ , typename ModelT_ , typename SolverLsT_ = robustEstimation::UndefinedSolver<ModelT_>>
void aliceVision::robustEstimation::PointFittingRansacKernel< SolverT_, ErrorT_, ModelT_, SolverLsT_ >::fitLS ( const std::vector< std::size_t > &  inliers,
std::vector< ModelT_ > &  models,
const std::vector< double > *  weights = nullptr 
) const
inlineoverridevirtual

This function is called to estimate the model using a least squared algorithm from a minimum of minSampleLS.

Parameters
[in]inliersAn array containing the indices of the data to use.
[out]modelsThe model(s) estimated using the least squared algorithm.
[in]weightsAn optional array of weights, one for each sample

Implements aliceVision::robustEstimation::IRansacKernel< ModelT_ >.

◆ getMaximumNbModels()

template<typename SolverT_ , typename ErrorT_ , typename ModelT_ , typename SolverLsT_ = robustEstimation::UndefinedSolver<ModelT_>>
std::size_t aliceVision::robustEstimation::PointFittingRansacKernel< SolverT_, ErrorT_, ModelT_, SolverLsT_ >::getMaximumNbModels ( ) const
inlineoverride

Return the maximum number of models for the solver.

Returns
maximum number of models

◆ getMinimumNbRequiredSamples()

template<typename SolverT_ , typename ErrorT_ , typename ModelT_ , typename SolverLsT_ = robustEstimation::UndefinedSolver<ModelT_>>
std::size_t aliceVision::robustEstimation::PointFittingRansacKernel< SolverT_, ErrorT_, ModelT_, SolverLsT_ >::getMinimumNbRequiredSamples ( ) const
inlineoverride

Return the minimum number of required samples for the solver.

Returns
minimum number of required samples

◆ logalpha0()

template<typename SolverT_ , typename ErrorT_ , typename ModelT_ , typename SolverLsT_ = robustEstimation::UndefinedSolver<ModelT_>>
virtual double aliceVision::robustEstimation::PointFittingRansacKernel< SolverT_, ErrorT_, ModelT_, SolverLsT_ >::logalpha0 ( ) const
pure virtual

Get logalpha0, Alpha0 is used to make the error adaptive to the image size.

Returns
logalpha0

◆ nbSamples()

template<typename SolverT_ , typename ErrorT_ , typename ModelT_ , typename SolverLsT_ = robustEstimation::UndefinedSolver<ModelT_>>
std::size_t aliceVision::robustEstimation::PointFittingRansacKernel< SolverT_, ErrorT_, ModelT_, SolverLsT_ >::nbSamples ( ) const
inlineoverride

The number of elements in the data.

Returns
the number of elements in the data.

◆ unnormalize()

template<typename SolverT_ , typename ErrorT_ , typename ModelT_ , typename SolverLsT_ = robustEstimation::UndefinedSolver<ModelT_>>
virtual void aliceVision::robustEstimation::PointFittingRansacKernel< SolverT_, ErrorT_, ModelT_, SolverLsT_ >::unnormalize ( ModelT_ &  model) const
pure virtual

Function used to unnormalize the model.

Parameters
[in,out]modelThe model to unnormalize.

Implements aliceVision::robustEstimation::IRansacKernel< ModelT_ >.


The documentation for this class was generated from the following file: