20 double desired_success_rate)
22 double prob_all_good =
math::fastpow(inlier_ratio, num_samples);
23 double num_iterations = std::log(1.0 - desired_success_rate)
24 / std::log(1.0 - prob_all_good);
25 return static_cast<int>(
math::round(num_iterations));
T round(T const &x)
Removes the fractional part of the value to the closest integer.
T fastpow(T const &base, unsigned int exp)
Takes base to the integer power of 'exp'.
int compute_ransac_iterations(double inlier_ratio, int num_samples, double desired_success_rate)
The function returns the required number of iterations for a desired RANSAC success rate.
#define SFM_NAMESPACE_END
#define SFM_NAMESPACE_BEGIN