MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
ransac.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015, Simon Fuhrmann
3 * TU Darmstadt - Graphics, Capture and Massively Parallel Computing
4 * All rights reserved.
5 *
6 * This software may be modified and distributed under the terms
7 * of the BSD 3-Clause license. See the LICENSE.txt file for details.
8 */
9
10#include <cmath>
11
12#include "math/functions.h"
13#include "sfm/ransac.h"
14
16
17int
18compute_ransac_iterations (double inlier_ratio,
19 int num_samples,
20 double desired_success_rate)
21{
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));
26}
27
T round(T const &x)
Removes the fractional part of the value to the closest integer.
Definition functions.h:70
T fastpow(T const &base, unsigned int exp)
Takes base to the integer power of 'exp'.
Definition functions.h:235
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.
Definition ransac.cc:18
#define SFM_NAMESPACE_END
Definition defines.h:14
#define SFM_NAMESPACE_BEGIN
Definition defines.h:13