At the root of computer vision is a heavy amount of math and probability. Theia contains various math functions implemented with a generic interface for ease of use.
You can include the Math module with the following line:
#include <theia/math.h>
Many problems in vision rely on solving a polynomial quickly. For small degrees (n <= 4) this can be done in closed form, making them exceptionally fast. We have implemented solvers for these cases.
Provides solutions to the equation \(a*x^2 + b*x + c = 0\)
Provides solutions to the equation \(a*x^3 + b*x^2 + c*x + d = 0\) using Cardano’s method.
Provides solutions to the equation \(a*x^4 + b*x^3 + c*x^2 + d*x + e = 0\) using Ferrari’s method to reduce to problem to a depressed cubic.
For polynomials of degree > 4 there are no easy closed-form solutions, making the problem of finding roots much more difficult. However, we have implemented a function that will solve for all roots of a polynomial by constructing a companion matrix and solving with an eigenvalue decomposition.
These methods take in polynomial coefficients such that the highest degree coefficient is the first element, and the lowest degree coefficient (correspondening to degree 0) is the last element. Real or complex roots are returned depending on the method called.
Perform traditional Gauss-Jordan elimination on an Eigen3 matrix. If max_rows is specified, it will on perform Gauss-Jordan on the first max_rows number of rows. This is useful for problems where your system is extremely overdetermined and you do not need all rows to be solved.
Modified version of Wald’s SPRT as [Matas] et. al. implement it in “Randomized RANSAC with Sequential Probability Ratio Test”
sigma: Probability of rejecting a good model (Bernoulli parameter).
epsilon: Inlier ratio.
time_compute_model_ratio: Computing the model parameters from a sample takes the same time as verification of time_compute_model_ratio data points. Matas et. al. use 200.
num_model_verified: Number of models that are verified per sample.
Returns: The SPRT decision threshold based on the input parameters.
Modified version of Wald’s SPRT as [Matas] et. al. implement it in “Randomized RANSAC with Sequential Probability Ratio Test”. See the paper for more details.
residuals: Error residuals to use for SPRT analysis.
error_thresh: Error threshold for determining when Datum fits the model.
sigma: Probability of rejecting a good model.
epsilon: Inlier ratio.
decision_threshold: The decision threshold at which to terminate.
observed_inlier_ratio: Output parameter of inlier ratio tested.