40 #ifndef PCL_SAMPLE_CONSENSUS_H_
41 #define PCL_SAMPLE_CONSENSUS_H_
44 #include <boost/random.hpp>
64 typedef boost::shared_ptr<SampleConsensus>
Ptr;
65 typedef boost::shared_ptr<const SampleConsensus>
ConstPtr;
75 model_coefficients_ (),
78 threshold_ (std::numeric_limits<double>::max()),
79 max_iterations_ (1000),
81 rng_ (new boost::uniform_01<boost::mt19937> (rng_alg_))
85 rng_->base ().seed (static_cast<unsigned> (std::time(0)));
87 rng_->base ().seed (12345u);
95 SampleConsensus (
const SampleConsensusModelPtr &model,
double threshold,
bool random =
false) :
99 model_coefficients_ (),
102 threshold_ (threshold),
103 max_iterations_ (1000),
105 rng_ (new boost::uniform_01<boost::mt19937> (rng_alg_))
109 rng_->base ().seed (static_cast<unsigned> (std::time(0)));
111 rng_->base ().seed (12345u);
160 std::set<int> &indices_subset)
162 indices_subset.clear ();
163 while (indices_subset.size () < nr_samples)
165 indices_subset.insert ((*indices)[static_cast<int> (static_cast<double>(indices->size ()) * rnd ())]);
172 getModel (std::vector<int> &model) { model = model_; }
178 getInliers (std::vector<int> &inliers) { inliers = inliers_; }
188 SampleConsensusModelPtr sac_model_;
191 std::vector<int> model_;
194 std::vector<int> inliers_;
197 Eigen::VectorXf model_coefficients_;
212 boost::mt19937 rng_alg_;
215 boost::shared_ptr<boost::uniform_01<boost::mt19937> > rng_;
226 #endif //#ifndef PCL_SAMPLE_CONSENSUS_H_