Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
RANSAC.c File Reference
#include "RANSAC.h"
#include "math/pprz_matrix_decomp_float.h"
#include "math/pprz_algebra_float.h"
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "stdio.h"
+ Include dependency graph for RANSAC.c:

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, bool use_bias, float *params, float *fit_error)
 Perform RANSAC to fit a linear model. More...
 
float predict_value (float *sample, float *weights, int D, bool use_bias)
 Predict the value of a sample with linear weights. More...
 
void get_indices_without_replacement (int *indices_subset, int n_samples, int count)
 Get indices without replacement. More...
 

Function Documentation

◆ get_indices_without_replacement()

void get_indices_without_replacement ( int *  indices_subset,
int  n_samples,
int  count 
)

Get indices without replacement.

Parameters
[out]indices_subsetThis will be filled with the sampled indices
[in]n_samplesThe number of samples / indices.
[in]countThe function will sample n_sample numbers from the range 1, 2, 3,..., count

Definition at line 157 of file RANSAC.c.

References n_samples.

Referenced by RANSAC_linear_model().

+ Here is the caller graph for this function:

◆ predict_value()

float predict_value ( float *  sample,
float *  weights,
int  D,
bool  use_bias 
)

Predict the value of a sample with linear weights.

Parameters
[in]sampleThe sample vector of size D
[in]weightsThe weight vector of size D+1
[in]DThe dimension of the sample.
Returns
The predicted value

Definition at line 133 of file RANSAC.c.

References D, and weights.

Referenced by RANSAC_linear_model().

+ Here is the caller graph for this function:

◆ 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,
bool  use_bias,
float *  params,
float *  fit_error 
)

Perform RANSAC to fit a linear model.

Parameters
[in]n_samplesThe number of samples to use for a single fit
[in]n_iterationsThe number of times a linear fit is performed
[in]error_thresholdThe threshold used to cap errors in the RANSAC process
[in]targetsThe target values
[in]samplesThe samples / feature vectors
[in]DThe dimensionality of the samples
[in]countThe 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(), get_indices_without_replacement(), n_samples, and predict_value().

+ Here is the call graph for this function: