43 #ifndef OPENGV_SAC_MULTISAMPLECONSENSUSPROBLEM_HPP_ 44 #define OPENGV_SAC_MULTISAMPLECONSENSUSPROBLEM_HPP_ 69 template<
typename MODEL_T>
95 std::vector< std::vector<int> > &samples );
104 const std::vector< std::vector<int> > & sample )
const;
110 std::shared_ptr< std::vector< std::vector<int> > >
getIndices()
const;
133 const std::vector< std::vector<int> > & indices,
134 model_t & outModel)
const = 0;
144 const std::vector< std::vector<int> > & inliers,
145 const model_t & model_coefficients,
146 model_t & optimized_coefficients ) = 0;
157 const model_t & model,
158 const std::vector< std::vector<int> > & indices,
159 std::vector< std::vector<double> > & scores )
const = 0;
169 const model_t & model_coefficients,
170 std::vector< std::vector<double> > &distances );
181 const model_t &model_coefficients,
182 const double threshold,
183 std::vector< std::vector<int> > &inliers );
194 const model_t &model_coefficients,
195 const double threshold);
201 void setIndices(
const std::vector< std::vector<int> > & indices);
224 std::shared_ptr< std::vector< std::vector<int> > >
indices_;
233 std::shared_ptr< std::uniform_int_distribution<> >
rng_dist_;
243 #include "implementation/MultiSampleConsensusProblem.hpp" virtual void optimizeModelCoefficients(const std::vector< 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...
void setUniformIndices(std::vector< int > N)
Use this method if you want to use all samples.
The namespace of this library.
Definition: AbsoluteAdapterBase.hpp:47
virtual void getDistancesToModel(const model_t &model_coefficients, std::vector< std::vector< double > > &distances)
Compute the distances of all samples which respect to given model coefficients.
std::shared_ptr< std::function< int()> > rng_gen_
std-based random number generator.
Definition: MultiSampleConsensusProblem.hpp:236
std::mt19937 rng_alg_
std-based random number generator algorithm.
Definition: MultiSampleConsensusProblem.hpp:230
std::shared_ptr< std::uniform_int_distribution<> > rng_dist_
std-based random number generator distribution.
Definition: MultiSampleConsensusProblem.hpp:233
virtual std::vector< int > getSampleSizes() const =0
Get the number of samples needed for a hypothesis generation. Needs implementation in the child class...
std::shared_ptr< std::vector< std::vector< int > > > indices_
Definition: MultiSampleConsensusProblem.hpp:224
Definition: MultiSampleConsensusProblem.hpp:70
virtual int countWithinDistance(const model_t &model_coefficients, const double threshold)
Count all the inlier samples whith respect to given model coefficients.
virtual ~MultiSampleConsensusProblem()
Destructor.
virtual bool isSampleGood(const std::vector< std::vector< int > > &sample) const
Check if a set of samples for model generation is degenerate.
virtual bool computeModelCoefficients(const std::vector< std::vector< int > > &indices, model_t &outModel) const =0
Compute a model from a set of samples. Needs implementation in the child-class.
virtual void getSelectedDistancesToModel(const model_t &model, const std::vector< std::vector< int > > &indices, std::vector< std::vector< double > > &scores) const =0
Compute the distances of all samples whith respect to given model coefficients. Needs implementation ...
int rnd()
Get a random number.
MODEL_T model_t
Definition: MultiSampleConsensusProblem.hpp:74
virtual void getSamples(int &iterations, std::vector< std::vector< int > > &samples)
Get samples for hypothesis generation.
MultiSampleConsensusProblem(bool randomSeed=true)
Contructor.
std::shared_ptr< std::vector< std::vector< int > > > getIndices() const
Get a pointer to the vector of multi-indices used.
virtual void selectWithinDistance(const model_t &model_coefficients, const double threshold, std::vector< std::vector< int > > &inliers)
Select all the inlier samples whith respect to given model coefficients.
int max_sample_checks_
Definition: MultiSampleConsensusProblem.hpp:218
void setIndices(const std::vector< std::vector< int > > &indices)
Set the indices_ variable (see member-description).
std::vector< std::vector< int > > shuffled_indices_
Definition: MultiSampleConsensusProblem.hpp:227
void drawIndexSample(std::vector< std::vector< int > > &sample)
Sub-function for getting samples for hypothesis generation.