Paparazzi UAS
v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
|
Perform Random Sample Consensus (RANSAC), a robust fitting method. More...
#include "std.h"
Go to the source code of this file.
Functions | |
void | RANSAC_linear_model (int n_samples, int n_iterations, float error_threshold, float *targets, int D, float(*samples)[D], uint16_t count, float *params, float *fit_error) |
Perform RANSAC to fit a linear model. More... | |
void | get_indices_without_replacement (int *indices_subset, int n_samples, int count) |
Get indices without replacement. More... | |
float | predict_value (float *sample, float *weights, int D, bool use_bias) |
Predict the value of a sample with linear weights. More... | |
Perform Random Sample Consensus (RANSAC), a robust fitting method.
The concept is to select (minimal) subsets of the samples for learning a model, then determining the error on the entire data set, and selecting the best fit. In determining the error, the individual sample errors are capped, so that outliers can be identified and have only a modest influence on the results.
Read: Fischler, M. A., & Bolles, R. C. (1981). Random sample consensus: a paradigm for model fitting with applications to image analysis and automated cartography. Communications of the ACM, 24(6), 381-395.
This file depends on the function fit_linear_model in math/pprz_matrix_decomp_float.h/c
Definition in file RANSAC.h.
void get_indices_without_replacement | ( | int * | indices_subset, |
int | n_samples, | ||
int | count | ||
) |
Get indices without replacement.
[out] | indices_subset | This will be filled with the sampled indices |
[in] | n_samples | The number of samples / indices. |
[in] | count | The function will sample n_sample numbers from the range 1, 2, 3,..., count |
Definition at line 160 of file RANSAC.c.
References n_samples.
Referenced by RANSAC_linear_model().
float predict_value | ( | float * | sample, |
float * | weights, | ||
int | D, | ||
bool | use_bias | ||
) |
Predict the value of a sample with linear weights.
[in] | sample | The sample vector of size D |
[in] | weights | The weight vector of size D+1 |
[in] | D | The dimension of the sample. |
Definition at line 136 of file RANSAC.c.
References D.
Referenced by RANSAC_linear_model().
void RANSAC_linear_model | ( | int | n_samples, |
int | n_iterations, | ||
float | error_threshold, | ||
float * | targets, | ||
int | D, | ||
float(*) | samples[D], | ||
uint16_t | count, | ||
float * | params, | ||
float * | fit_error | ||
) |
Perform RANSAC to fit a linear model.
[in] | n_samples | The number of samples to use for a single fit |
[in] | n_iterations | The number of times a linear fit is performed |
[in] | error_threshold | The threshold used to cap errors in the RANSAC process |
[in] | targets | The target values |
[in] | samples | The samples / feature vectors |
[in] | D | The dimensionality of the samples |
[in] | count | The number of samples |
[out] | parameters* | Parameters of the linear fit |
[out] | fit_error* | Total error of the fit |
[in] | n_samples | The number of samples to use for a single fit |
[in] | n_iterations | The number of times a linear fit is performed |
[in] | error_threshold | The threshold used to cap errors in the RANSAC process |
[in] | targets | The target values |
[in] | samples | The samples / feature vectors |
[in] | D | The dimensionality of the samples |
[in] | count | The number of samples |
[out] | parameters* | Parameters of the linear fit, of size D + 1 (accounting for a constant 1 being added to the samples to represent a potential bias) |
[out] | fit_error* | Total error of the fit |
Definition at line 57 of file RANSAC.c.
References D, fit_linear_model(), fit_linear_model_prior(), get_indices_without_replacement(), n_samples, and predict_value().