Paparazzi UAS  v5.8.2_stable-0-g6260b7c
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  *
5  * This file is part of Paparazzi.
6  *
7  * Paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * Paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with Paparazzi; see the file COPYING. If not, see
19  * <http://www.gnu.org/licenses/>.
20  */
21 
29 #ifndef OPTICFLOW_CALCULATOR_H
30 #define OPTICFLOW_CALCULATOR_H
31 
32 #include "std.h"
33 #include "inter_thread_data.h"
34 #include "lib/vision/image.h"
35 #include "lib/v4l/v4l2.h"
36 
37 struct opticflow_t {
38  bool_t got_first_img;
39  float prev_phi;
40  float prev_theta;
41  struct image_t img_gray;
43  struct timeval prev_timestamp;
44 
50 
51  bool_t fast9_adaptive;
54 };
55 
56 
58 void opticflow_calc_frame(struct opticflow_t *opticflow, struct opticflow_state_t *state, struct image_t *img, struct opticflow_result_t *result);
59 
60 #endif /* OPTICFLOW_CALCULATOR_H */
61 
62 
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 of the Lucas Kanade calculation (needs to be even)
Capture images from a V4L2 device (Video for Linux 2)
Definition: image.h:42
float prev_phi
Phi from the previous image frame.
Inter-thread data structures.
uint8_t threshold_vec
The threshold in x, y subpixels which the algorithm should stop.
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...
bool_t got_first_img
If we got a image to work with.
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.
bool_t fast9_adaptive
Whether the FAST9 threshold should be adaptive.
struct image_t img_gray
Current gray image frame.
uint8_t subpixel_factor
The amount of subpixels per pixel.
unsigned char uint8_t
Definition: types.h:14
float prev_theta
Theta from the previous image frame.
struct State state
Definition: state.c:36