Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
linear_flow_fit.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "linear_flow_fit.h"
#include "math/pprz_algebra_float.h"
#include "math/pprz_matrix_decomp_float.h"
#include "math/pprz_simple_matrix.h"
+ Include dependency graph for linear_flow_fit.c:

Go to the source code of this file.

Macros

#define MAX_COUNT_PT   50
 
#define MIN_SAMPLES_FIT   3
 

Functions

bool analyze_linear_flow_field (struct flow_t *vectors, int count, float error_threshold, int n_iterations, int n_samples, int im_width, int im_height, struct linear_flow_fit_info *info)
 Analyze a linear flow field, retrieving information such as divergence, surface roughness, focus of expansion, etc. More...
 
void fit_linear_flow_field (struct flow_t *vectors, int count, float error_threshold, int n_iterations, int n_samples, float *parameters_u, float *parameters_v, float *fit_error, float *min_error_u, float *min_error_v, int *n_inliers_u, int *n_inliers_v)
 Analyze a linear flow field, retrieving information such as divergence, surface roughness, focus of expansion, etc. More...
 
void extract_information_from_parameters (float *parameters_u, float *parameters_v, int im_width, int im_height, struct linear_flow_fit_info *info)
 Extract information from the parameters that were fit to the optical flow field. More...
 

Macro Definition Documentation

#define MAX_COUNT_PT   50

Definition at line 47 of file linear_flow_fit.c.

#define MIN_SAMPLES_FIT   3

Definition at line 49 of file linear_flow_fit.c.

Referenced by analyze_linear_flow_field(), and fit_linear_flow_field().

Function Documentation

bool analyze_linear_flow_field ( struct flow_t vectors,
int  count,
float  error_threshold,
int  n_iterations,
int  n_samples,
int  im_width,
int  im_height,
struct linear_flow_fit_info info 
)

Analyze a linear flow field, retrieving information such as divergence, surface roughness, focus of expansion, etc.

Parameters
[out]outcomeIf 0, there were too few vectors for a fit. If 1, the fit was successful.
[in]vectorsThe optical flow vectors
[in]countThe number of optical flow vectors
[in]error_thresholdError used to determine inliers / outliers.
[in]n_iterationsNumber of RANSAC iterations.
[in]n_samplesNumber of samples used for a single fit (min. 3).
[in]im_widthImage width in pixels
[in]im_heightImage height in pixels
[out]infoContains all info extracted from the linear flow fit.

Definition at line 63 of file linear_flow_fit.c.

References linear_flow_fit_info::divergence, E, extract_information_from_parameters(), linear_flow_fit_info::fit_error, fit_linear_flow_field(), MIN_SAMPLES_FIT, linear_flow_fit_info::n_inliers_u, linear_flow_fit_info::n_inliers_v, linear_flow_fit_info::relative_velocity_z, linear_flow_fit_info::surface_roughness, and linear_flow_fit_info::time_to_contact.

Referenced by calc_fast9_lukas_kanade().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void extract_information_from_parameters ( float *  parameters_u,
float *  parameters_v,
int  im_width,
int  im_height,
struct linear_flow_fit_info info 
)

Extract information from the parameters that were fit to the optical flow field.

Parameters
[in]parameters_u*Parameters of the horizontal flow field
[in]parameters_v*Parameters of the vertical flow field
[in]im_widthWidth of image in pixels
[in]im_heightHeight of image in pixels
[out]infoContains all info extracted from the linear flow fit

Definition at line 313 of file linear_flow_fit.c.

References E, linear_flow_fit_info::focus_of_expansion_x, linear_flow_fit_info::focus_of_expansion_y, linear_flow_fit_info::relative_velocity_x, linear_flow_fit_info::relative_velocity_y, linear_flow_fit_info::relative_velocity_z, linear_flow_fit_info::slope_x, and linear_flow_fit_info::slope_y.

Referenced by analyze_linear_flow_field().

+ Here is the caller graph for this function:

void fit_linear_flow_field ( struct flow_t vectors,
int  count,
float  error_threshold,
int  n_iterations,
int  n_samples,
float *  parameters_u,
float *  parameters_v,
float *  fit_error,
float *  min_error_u,
float *  min_error_v,
int *  n_inliers_u,
int *  n_inliers_v 
)

Analyze a linear flow field, retrieving information such as divergence, surface roughness, focus of expansion, etc.

Parameters
[in]vectorsThe optical flow vectors
[in]countThe number of optical flow vectors
[in]error_thresholdError used to determine inliers / outliers.
[in]n_iterationsNumber of RANSAC iterations.
[in]n_samplesNumber of samples used for a single fit (min. 3).
[out]parameters_u*Parameters of the horizontal flow field
[out]parameters_v*Parameters of the vertical flow field
[out]fit_error*Total error of the finally selected fit
[out]min_error_u*Error fit horizontal flow field
[out]min_error_v*Error fit vertical flow field
[out]n_inliers_u*Number of inliers in the horizontal flow fit.
[out]n_inliers_v*Number of inliers in the vertical flow fit.

Definition at line 103 of file linear_flow_fit.c.

References A, AA, MAKE_MATRIX_PTR, MAT_MUL, MAT_SUB, MIN_SAMPLES_FIT, n_samples, p, flow_t::pos, pprz_svd_float(), pprz_svd_solve_float(), and point_t::y.

Referenced by analyze_linear_flow_field().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: