Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
opticflow_calculator.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Hann Woei Ho
3  * 2015 Freek van Tienen <freek.v.tienen@gmail.com>
4  * 2016 Kimberly McGuire <k.n.mcguire@tudelft.nl
5  *
6  * This file is part of Paparazzi.
7  *
8  * Paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * Paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Paparazzi; see the file COPYING. If not, see
20  * <http://www.gnu.org/licenses/>.
21  */
22 
32 #ifndef OPTICFLOW_CALCULATOR_H
33 #define OPTICFLOW_CALCULATOR_H
34 
35 #include "std.h"
36 #include "inter_thread_data.h"
37 #include "lib/vision/image.h"
38 #include "lib/v4l/v4l2.h"
39 
40 struct opticflow_t {
44  struct image_t img_gray;
46  struct timeval prev_timestamp;
47 
51  bool derotation;
53 
58 
64 
67 };
68 
69 
71 void opticflow_calc_frame(struct opticflow_t *opticflow, struct opticflow_state_t *state, struct image_t *img,
72  struct opticflow_result_t *result);
73 
75  struct opticflow_result_t *result);
76 void calc_edgeflow_tot(struct opticflow_t *opticflow, struct opticflow_state_t *state, struct image_t *img,
77  struct opticflow_result_t *result);
78 #endif /* OPTICFLOW_CALCULATOR_H */
79 
80 
unsigned short uint16_t
Definition: types.h:16
uint16_t fast9_min_distance
Minimum distance in pixels between corners.
uint8_t max_iterations
The maximum amount of iterations the Lucas Kanade algorithm should do.
struct opticflow_t opticflow
Opticflow calculations.
uint16_t window_size
Window size for the blockmatching algorithm (general value for all methods)
uint16_t fast9_rsize
Amount of corners allocated.
Capture images from a V4L2 device (Video for Linux 2)
bool median_filter
Decides to use a median filter on the velocity.
void calc_edgeflow_tot(struct opticflow_t *opticflow, struct opticflow_state_t *state, struct image_t *img, struct opticflow_result_t *result)
Run the optical flow with EDGEFLOW on a new image frame.
Definition: image.h:42
Inter-thread data structures.
uint8_t threshold_vec
The threshold in x, y subpixels which the algorithm should stop.
bool derotation
Derotation switched on or off (depended on the quality of the gyroscope measurement) ...
uint8_t method
Method to use to calculate the optical flow.
uint8_t max_track_corners
Maximum amount of corners Lucas Kanade should track.
void opticflow_calc_init(struct opticflow_t *opticflow, uint16_t w, uint16_t h)
Initialize the opticflow calculator.
Image helper functions like resizing, color filter, converters...
uint16_t subpixel_factor
The amount of subpixels per pixel.
struct point_t * fast9_ret_corners
Corners.
struct timeval prev_timestamp
Timestamp of the previous frame, used for FPS calculation.
struct image_t prev_img_gray
Previous gray image frame.
void opticflow_calc_frame(struct opticflow_t *opticflow, struct opticflow_state_t *state, struct image_t *img, struct opticflow_result_t *result)
Run the optical flow on a new image frame.
uint8_t fast9_threshold
FAST9 corner detection threshold.
Definition: image.h:55
struct image_t img_gray
Current gray image frame.
unsigned char uint8_t
Definition: types.h:14
bool got_first_img
If we got a image to work with.
void calc_fast9_lukas_kanade(struct opticflow_t *opticflow, struct opticflow_state_t *state, struct image_t *img, struct opticflow_result_t *result)
Run the optical flow with fast9 and lukaskanade on a new image frame.
uint16_t fast9_padding
Padding used in FAST9 detector.
bool fast9_adaptive
Whether the FAST9 threshold should be adaptive.
struct FloatRates prev_rates
Gyro Rates from the previous image frame.
uint8_t pyramid_level
Number of pyramid levels used in Lucas Kanade algorithm (0 == no pyramids used)
uint16_t search_distance
Search distance for blockmatching alg.
angular rates
struct State state
Definition: state.c:36