41 #ifndef OPENGV_SAC_SAMPLECONSENSUSPROBLEM_HPP_ 42 #define OPENGV_SAC_SAMPLECONSENSUSPROBLEM_HPP_ 66 template<
typename MODEL_T>
90 virtual void getSamples(
int &iterations, std::vector<int> &samples );
98 virtual bool isSampleGood(
const std::vector<int> & sample )
const;
104 std::shared_ptr< std::vector<int> >
getIndices()
const;
127 const std::vector<int> & indices,
128 model_t & outModel)
const = 0;
138 const std::vector<int> & inliers,
139 const model_t & model_coefficients,
140 model_t & optimized_coefficients ) = 0;
151 const model_t & model,
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 );
195 void setIndices(
const std::vector<int> & indices );
227 std::shared_ptr< std::uniform_int_distribution<> >
rng_dist_;
237 #include "implementation/SampleConsensusProblem.hpp" std::shared_ptr< std::uniform_int_distribution<> > rng_dist_
std-based random number generator distribution.
Definition: SampleConsensusProblem.hpp:227
std::shared_ptr< std::vector< int > > indices_
Definition: SampleConsensusProblem.hpp:218
The namespace of this library.
Definition: AbsoluteAdapterBase.hpp:47
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...
std::mt19937 rng_alg_
std-based random number generator algorithm.
Definition: SampleConsensusProblem.hpp:224
void setIndices(const std::vector< int > &indices)
Set the indices_ variable (see member-description).
SampleConsensusProblem(bool randomSeed=true)
Contructor.
virtual bool isSampleGood(const std::vector< int > &sample) const
Check if a set of samples for model generation is degenerate.
int rnd()
Get a random number.
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.
std::vector< int > shuffled_indices_
Definition: SampleConsensusProblem.hpp:221
int max_sample_checks_
Definition: SampleConsensusProblem.hpp:212
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 ...
Definition: SampleConsensusProblem.hpp:67
virtual ~SampleConsensusProblem()
Destructor.
virtual int getSampleSize() const =0
Get the number of samples needed for a hypothesis generation. Needs implementation in the child class...
virtual int countWithinDistance(const model_t &model_coefficients, const double threshold)
Count all the inlier samples whith respect to given model coefficients.
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::shared_ptr< std::vector< int > > getIndices() const
Get a pointer to the vector of indices used.
virtual void getSamples(int &iterations, std::vector< int > &samples)
Get samples for hypothesis generation.
void setUniformIndices(int N)
Use this method if you want to use all samples.
std::shared_ptr< std::function< int()> > rng_gen_
std-based random number generator.
Definition: SampleConsensusProblem.hpp:230
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.
void drawIndexSample(std::vector< int > &sample)
Sub-function for getting samples for hypothesis generation.
MODEL_T model_t
Definition: SampleConsensusProblem.hpp:71