Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
cv_opencvdemo.c
Go to the documentation of this file.
1
/*
2
* Copyright (C) C. De Wagter
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
*/
26
#include "
modules/computer_vision/cv.h
"
27
#include "
modules/computer_vision/cv_opencvdemo.h
"
28
#include "
modules/computer_vision/opencv_example.h
"
29
30
#ifndef OPENCVDEMO_FPS
31
#define OPENCVDEMO_FPS 0
32
#endif
33
PRINT_CONFIG_VAR(
OPENCVDEMO_FPS
)
34
35
// Function
36
struct
image_t
*
opencv_func
(
struct
image_t
*img,
uint8_t
camera_id);
37
struct
image_t
*
opencv_func
(
struct
image_t
*img,
uint8_t
camera_id)
38
{
39
40
if
(img->
type
==
IMAGE_YUV422
) {
41
// Call OpenCV (C++ from paparazzi C function)
42
opencv_example
((
char
*) img->
buf
, img->
w
, img->
h
);
43
}
44
45
// opencv_example(NULL, 10,10);
46
47
return
NULL;
48
}
49
50
void
opencvdemo_init
(
void
)
51
{
52
cv_add_to_device
(&OPENCVDEMO_CAMERA,
opencv_func
,
OPENCVDEMO_FPS
, 0);
53
}
54
image_t::type
enum image_type type
The image type.
Definition:
image.h:45
cv_add_to_device
struct video_listener * cv_add_to_device(struct video_config_t *device, cv_function func, uint16_t fps, uint8_t id)
Definition:
cv.c:46
image_t::w
uint16_t w
Image width.
Definition:
image.h:46
opencv_func
struct image_t * opencv_func(struct image_t *img, uint8_t camera_id)
Definition:
cv_opencvdemo.c:37
image_t::h
uint16_t h
Image height.
Definition:
image.h:47
OPENCVDEMO_FPS
#define OPENCVDEMO_FPS
Default FPS (zero means run at camera fps)
Definition:
cv_opencvdemo.c:31
opencvdemo_init
void opencvdemo_init(void)
Definition:
cv_opencvdemo.c:50
cv.h
opencv_example.h
uint8_t
unsigned char uint8_t
Definition:
types.h:14
cv_opencvdemo.h
IMAGE_YUV422
@ IMAGE_YUV422
UYVY format (uint16 per pixel)
Definition:
image.h:36
image_t::buf
void * buf
Image buffer (depending on the image_type)
Definition:
image.h:54
opencv_example
int opencv_example(char *img, int width, int height)
Definition:
opencv_example.cpp:38
image_t
Definition:
image.h:44
sw
airborne
modules
computer_vision
cv_opencvdemo.c
Generated on Tue Feb 1 2022 13:51:14 for Paparazzi UAS by
1.8.17