Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
detect_contour.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) Roland Meertens and Peng Lu
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 #ifndef DETECT_CONTOUR_FPS
31 #define DETECT_CONTOUR_FPS 0
32 #endif
33 PRINT_CONFIG_VAR(DETECT_CONTOUR_FPS)
34 
35 // Function
36 struct image_t *contour_func(struct image_t *img, uint8_t camera_id);
37 struct image_t *contour_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  find_contour((char *) img->buf, img->w, img->h);
43  }
44  return img;
45 }
46 
48 {
49  cv_add_to_device(&DETECT_CONTOUR_CAMERA, contour_func, DETECT_CONTOUR_FPS, 0);
50  // in the mavlab, bright
53  //
54  // for cyberzoo: Y:12-95, U:129-161, V:80-165, turn white.
55  //int y1=16; int u1=129; int v1=80; % cyberzoo, dark
56  //int y2=100; int u2=161; int v2=165;
57 }
58 
image_t::type
enum image_type type
The image type.
Definition: image.h:45
cont_thres
struct contour_threshold cont_thres
Definition: opencv_contour.cpp:35
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
contour_threshold::upper_y
int upper_y
Definition: opencv_contour.h:41
image_t::w
uint16_t w
Image width.
Definition: image.h:46
detect_contour.h
image_t::h
uint16_t h
Image height.
Definition: image.h:47
cv.h
opencv_contour.h
contour_threshold::lower_y
int lower_y
Definition: opencv_contour.h:41
uint8_t
unsigned char uint8_t
Definition: types.h:14
contour_func
struct image_t * contour_func(struct image_t *img, uint8_t camera_id)
Definition: detect_contour.c:37
contour_threshold::lower_u
int lower_u
Definition: opencv_contour.h:41
DETECT_CONTOUR_FPS
#define DETECT_CONTOUR_FPS
Default FPS (zero means run at camera fps)
Definition: detect_contour.c:31
IMAGE_YUV422
@ IMAGE_YUV422
UYVY format (uint16 per pixel)
Definition: image.h:36
contour_threshold::upper_v
int upper_v
Definition: opencv_contour.h:41
detect_contour_init
void detect_contour_init(void)
Definition: detect_contour.c:47
contour_threshold::lower_v
int lower_v
Definition: opencv_contour.h:41
image_t::buf
void * buf
Image buffer (depending on the image_type)
Definition: image.h:54
find_contour
void find_contour(char *img, int width, int height)
Definition: opencv_contour.cpp:79
image_t
Definition: image.h:44
contour_threshold::upper_u
int upper_u
Definition: opencv_contour.h:41