Paparazzi UAS
v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
|
calculate optical flow with EdgeFlow More...
#include <lib/vision/edge_flow.h>
Go to the source code of this file.
Functions | |
void | calc_previous_frame_nr (struct opticflow_result_t *result, struct opticflow_t *opticflow, uint8_t current_frame_nr, uint8_t *previous_frame_offset, uint8_t *previous_frame_nr) |
Calc_previous_frame_nr; adaptive Time Horizon. More... | |
void | calculate_edge_histogram (struct image_t *img, int32_t edge_histogram[], char direction, uint16_t edge_threshold) |
Calculate a edge/gradient histogram for each dimension of the image. More... | |
void | calculate_edge_displacement (int32_t *edge_histogram, int32_t *edge_histogram_prev, int32_t *displacement, uint16_t size, uint8_t window, uint8_t disp_range, int32_t der_shift) |
Calculate_displacement calculates the displacement between two histograms. More... | |
uint32_t | getMinimum (uint32_t *a, uint32_t n) |
Calculate minimum of an array. More... | |
void | line_fit (int32_t *displacement, int32_t *divergence, int32_t *flow, uint32_t size, uint32_t border, uint16_t RES) |
Fits a linear model to an array with pixel displacements with least squares. More... | |
void | draw_edgeflow_img (struct image_t *img, struct edge_flow_t edgeflow, int32_t *edge_hist_x_prev, int32_t *edge_hist_x) |
Draws edgehistogram, displacement and linefit directly on the image for debugging (only for edgeflow in horizontal direction!!) More... | |
uint32_t | getAmountPeaks (int32_t *edgehist, int32_t thres, int32_t size) |
getAmountPeaks, calculates the amount of peaks in a edge histogram More... | |
calculate optical flow with EdgeFlow
Edge-histogram matching, implementation by K. N. McGuire Publication: Local Histogram Matching for Efficient Optical Flow Computation Applied to Velocity Estimation on Pocket Drones by K.N. McGuire et al. (2016), ICRA 2016
Definition in file edge_flow.c.
void calc_previous_frame_nr | ( | struct opticflow_result_t * | result, |
struct opticflow_t * | opticflow, | ||
uint8_t | current_frame_nr, | ||
uint8_t * | previous_frame_offset, | ||
uint8_t * | previous_frame_nr | ||
) |
Calc_previous_frame_nr; adaptive Time Horizon.
[in] | *opticflow | The opticalflow structure |
[in] | *result | The optical flow result |
[in] | *current_frame_nr | The current frame number of the circular array of the edge_hist struct |
[in] | *previous_frame_offset | previous frame offset of how far the method should compare the edgehistogram |
[out] | *previous_frame_nr | previous frame index of the edgehist struct |
Definition at line 39 of file edge_flow.c.
References opticflow_result_t::flow_x, opticflow_result_t::flow_y, MAX_HORIZON, and opticflow_t::search_distance.
Referenced by calc_edgeflow_tot().
void calculate_edge_displacement | ( | int32_t * | edge_histogram, |
int32_t * | edge_histogram_prev, | ||
int32_t * | displacement, | ||
uint16_t | size, | ||
uint8_t | window, | ||
uint8_t | disp_range, | ||
int32_t | der_shift | ||
) |
Calculate_displacement calculates the displacement between two histograms.
[in] | *edge_histogram | The edge histogram from the current frame_step |
[in] | *edge_histogram_prev | The edge histogram from the previous frame_step |
[out] | *displacement | array with pixel displacement of the sequential edge histograms |
[in] | size | Indicating the size of the displacement array |
[in] | window | Indicating the search window size |
[in] | disp_range | Indicating the maximum disparity range for the block matching |
[in] | der_shift | The pixel shift estimated by the angle rate of the IMU |
Definition at line 168 of file edge_flow.c.
References D, DISP_RANGE_MAX, and getMinimum().
Referenced by calc_edgeflow_tot().
void calculate_edge_histogram | ( | struct image_t * | img, |
int32_t | edge_histogram[], | ||
char | direction, | ||
uint16_t | edge_threshold | ||
) |
Calculate a edge/gradient histogram for each dimension of the image.
[in] | *img | The image frame to calculate the edge histogram from |
[out] | *edge_histogram | The edge histogram from the current frame_step |
[in] | direction | Indicating if the histogram is made in either x or y direction |
[in] | edge_threshold | A threshold if a gradient is considered a edge or not |
Definition at line 88 of file edge_flow.c.
References image_t::buf.
Referenced by calc_edgeflow_tot().
void draw_edgeflow_img | ( | struct image_t * | img, |
struct edge_flow_t | edgeflow, | ||
int32_t * | edge_hist_x_prev, | ||
int32_t * | edge_hist_x | ||
) |
Draws edgehistogram, displacement and linefit directly on the image for debugging (only for edgeflow in horizontal direction!!)
[out] | *img | The image structure where will be drawn on |
[in] | edgeflow | Information structure for flow information |
[in] | Displacement | Pixel wise Displacement array |
[in] | *edge_hist_x | Horizontal edge_histogram |
Definition at line 297 of file edge_flow.c.
References edge_flow_t::div_x, edge_flow_t::flow_x, image_t::h, image_draw_line(), image_t::w, point_t::x, and point_t::y.
Referenced by calc_edgeflow_tot().
getAmountPeaks, calculates the amount of peaks in a edge histogram
[in] | *edgehist | Horizontal edge_histogram |
[in] | thres | The threshold from which a peak is considered significant peak or not |
[in] | size | Size of the array |
return] | amount of peaks |
Definition at line 337 of file edge_flow.c.
Referenced by calc_edgeflow_tot().
Calculate minimum of an array.
[in] | *a | Array containing values |
[in] | *n | The size of the array |
Definition at line 220 of file edge_flow.c.
Referenced by calculate_edge_displacement().
void line_fit | ( | int32_t * | displacement, |
int32_t * | divergence, | ||
int32_t * | flow, | ||
uint32_t | size, | ||
uint32_t | border, | ||
uint16_t | RES | ||
) |
Fits a linear model to an array with pixel displacements with least squares.
[in] | *displacements | Array with Pixel Displacements |
[out] | *divergence | Global divergence of pixel displacements |
[out] | *flow | Global translational flow from pixel displacements |
[in] | *size | Size of displacement array |
[in] | border | A border offset of the array that should not be considerd for the line fit |
[in] | RES | Resolution to be used for the integer based linefit |
Definition at line 247 of file edge_flow.c.
Referenced by calc_edgeflow_tot().