41#ifndef OPENGV_SAC_SAMPLECONSENSUSPROBLEM_HPP_
42#define OPENGV_SAC_SAMPLECONSENSUSPROBLEM_HPP_
66template<
typename MODEL_T>
90 virtual void getSamples(
int &iterations, std::vector<int> &samples );
98 virtual bool isSampleGood(
const std::vector<int> & sample )
const;
127 const std::vector<int> & indices,
138 const std::vector<int> & inliers,
139 const model_t & model_coefficients,
140 model_t & optimized_coefficients ) = 0;
152 const std::vector<int> & indices,
153 std::vector<double> & scores )
const = 0;
163 const model_t & model_coefficients,
164 std::vector<double> &distances );
175 const model_t &model_coefficients,
176 const double threshold,
177 std::vector<int> &inliers );
188 const model_t &model_coefficients,
189 const double threshold );
227 std::shared_ptr< std::uniform_int_distribution<> >
rng_dist_;
237#include "implementation/SampleConsensusProblem.hpp"
Definition: SampleConsensusProblem.hpp:68
void setIndices(const std::vector< int > &indices)
Set the indices_ variable (see member-description).
virtual void optimizeModelCoefficients(const std::vector< int > &inliers, const model_t &model_coefficients, model_t &optimized_coefficients)=0
Refine the model coefficients over a given set (inliers). Needs implementation in the child-class.
virtual int getSampleSize() const =0
Get the number of samples needed for a hypothesis generation. Needs implementation in the child class...
MODEL_T model_t
Definition: SampleConsensusProblem.hpp:71
std::shared_ptr< std::function< int()> > rng_gen_
std-based random number generator.
Definition: SampleConsensusProblem.hpp:230
virtual void getSamples(int &iterations, std::vector< int > &samples)
Get samples for hypothesis generation.
int max_sample_checks_
Definition: SampleConsensusProblem.hpp:212
void setUniformIndices(int N)
Use this method if you want to use all samples.
virtual void getDistancesToModel(const model_t &model_coefficients, std::vector< double > &distances)
Compute the distances of all samples which respect to given model coefficients.
std::mt19937 rng_alg_
std-based random number generator algorithm.
Definition: SampleConsensusProblem.hpp:224
virtual void getSelectedDistancesToModel(const model_t &model, const std::vector< int > &indices, std::vector< double > &scores) const =0
Compute the distances of all samples whith respect to given model coefficients. Needs implementation ...
virtual bool isSampleGood(const std::vector< int > &sample) const
Check if a set of samples for model generation is degenerate.
void drawIndexSample(std::vector< int > &sample)
Sub-function for getting samples for hypothesis generation.
std::shared_ptr< std::uniform_int_distribution<> > rng_dist_
std-based random number generator distribution.
Definition: SampleConsensusProblem.hpp:227
virtual void selectWithinDistance(const model_t &model_coefficients, const double threshold, std::vector< int > &inliers)
Select all the inlier samples whith respect to given model coefficients.
virtual ~SampleConsensusProblem()
Destructor.
std::shared_ptr< std::vector< int > > getIndices() const
Get a pointer to the vector of indices used.
virtual int countWithinDistance(const model_t &model_coefficients, const double threshold)
Count all the inlier samples whith respect to given model coefficients.
SampleConsensusProblem(bool randomSeed=true)
Contructor.
std::vector< int > shuffled_indices_
Definition: SampleConsensusProblem.hpp:221
int rnd()
Get a random number.
std::shared_ptr< std::vector< int > > indices_
Definition: SampleConsensusProblem.hpp:218
virtual bool computeModelCoefficients(const std::vector< int > &indices, model_t &outModel) const =0
Compute a model from a set of samples. Needs implementation in the child-class.
The namespace of this library.
Definition: AbsoluteAdapterBase.hpp:48