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
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  */
29 
30 
31 // Function
32 struct image_t* opencv_func(struct image_t* img);
33 struct image_t* opencv_func(struct image_t* img)
34 {
35 
36  if (img->type == IMAGE_YUV422)
37  {
38  // Call OpenCV (C++ from paparazzi C function)
39  opencv_example((char*) img->buf, img->w, img->h);
40  }
41 
42 // opencv_example(NULL, 10,10);
43 
44  return NULL;
45 }
46 
47 void opencvdemo_init(void)
48 {
49  cv_add_to_device(&OPENCVDEMO_CAMERA, opencv_func);
50 }
51 
struct video_listener * cv_add_to_device(struct video_config_t *device, cv_function func)
Definition: cv.c:45
int opencv_example(char *img, int width, int height)
void opencvdemo_init(void)
Definition: cv_opencvdemo.c:47
Definition: image.h:42
uint16_t w
Image width.
Definition: image.h:44
Computer vision framework for onboard processing.
uint16_t h
Image height.
Definition: image.h:45
void * buf
Image buffer (depending on the image_type)
Definition: image.h:51
UYVY format (uint16 per pixel)
Definition: image.h:35
struct image_t * opencv_func(struct image_t *img)
Definition: cv_opencvdemo.c:33
enum image_type type
The image type.
Definition: image.h:43