Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
cv.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015
3  *
4  * This file is part of Paparazzi.
5  *
6  * Paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * Paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  *
20  */
21 
29 #ifndef CV_H_
30 #define CV_H_
31 
32 #include <pthread.h>
33 
34 #include "std.h"
36 
37 #include BOARD_CONFIG
38 
39 typedef struct image_t *(*cv_function)(struct image_t *img);
40 
41 struct cv_async {
42  pthread_t thread_id;
43  volatile bool thread_running;
44  volatile int thread_priority;
45  pthread_mutex_t img_mutex;
46  pthread_cond_t img_available;
47  volatile bool img_processed;
48  struct image_t img_copy;
49 };
50 
53  struct cv_async *async;
54  struct timeval ts;
56 
57  // Can be set by user
59  volatile bool active;
60 };
61 
62 extern bool add_video_device(struct video_config_t *device);
63 
64 extern struct video_listener *cv_add_to_device(struct video_config_t *device, cv_function func, uint16_t fps);
65 extern struct video_listener *cv_add_to_device_async(struct video_config_t *device, cv_function func, int nice_level, uint16_t fps);
66 
67 extern void cv_run_device(struct video_config_t *device, struct image_t *img);
68 
69 #endif /* CV_H_ */
unsigned short uint16_t
Definition: types.h:16
volatile bool active
Definition: cv.h:59
pthread_t thread_id
Definition: cv.h:42
volatile bool thread_running
Definition: cv.h:43
uint16_t maximum_fps
Definition: cv.h:58
struct cv_async * async
Definition: cv.h:53
struct video_listener * cv_add_to_device(struct video_config_t *device, cv_function func, uint16_t fps)
Definition: cv.c:46
Definition: image.h:43
void cv_run_device(struct video_config_t *device, struct image_t *img)
Definition: cv.c:177
volatile int thread_priority
Definition: cv.h:44
bool add_video_device(struct video_config_t *device)
Keep track of video devices added by modules.
Definition: video_thread.c:189
pthread_cond_t img_available
Definition: cv.h:46
struct video_listener * cv_add_to_device_async(struct video_config_t *device, cv_function func, int nice_level, uint16_t fps)
Definition: cv.c:82
struct timeval ts
Definition: cv.h:54
struct image_t *(* cv_function)(struct image_t *img)
Definition: cv.h:39
volatile bool img_processed
Definition: cv.h:47
cv_function func
Definition: cv.h:55
pthread_mutex_t img_mutex
Definition: cv.h:45
struct video_listener * next
Definition: cv.h:52
struct image_t img_copy
Definition: cv.h:48
Definition: cv.h:41
V4L2 device settings.
Definition: video_device.h:55