Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
cv_detect_color_object.c File Reference
#include "modules/computer_vision/cv_detect_color_object.h"
#include "modules/computer_vision/cv.h"
#include "subsystems/abi.h"
#include "std.h"
#include <stdio.h>
#include <stdbool.h>
#include <math.h>
#include "pthread.h"
+ Include dependency graph for cv_detect_color_object.c:

Go to the source code of this file.

Data Structures

struct  color_object_t
 

Macros

#define PRINT(string, ...)   fprintf(stderr, "[object_detector->%s()] " string,__FUNCTION__ , ##__VA_ARGS__)
 
#define VERBOSE_PRINT(...)
 
#define COLOR_OBJECT_DETECTOR_FPS1   0
 Default FPS (zero means run at camera fps) More...
 
#define COLOR_OBJECT_DETECTOR_FPS2   0
 Default FPS (zero means run at camera fps) More...
 

Functions

uint32_t find_object_centroid (struct image_t *img, int32_t *p_xc, int32_t *p_yc, bool draw, uint8_t lum_min, uint8_t lum_max, uint8_t cb_min, uint8_t cb_max, uint8_t cr_min, uint8_t cr_max)
 
static struct image_tobject_detector (struct image_t *img, uint8_t filter)
 
struct image_tobject_detector1 (struct image_t *img, uint8_t camera_id)
 
struct image_tobject_detector2 (struct image_t *img, uint8_t camera_id)
 
void color_object_detector_init (void)
 
void color_object_detector_periodic (void)
 

Variables

static pthread_mutex_t mutex
 
uint8_t cod_lum_min1 = 0
 
uint8_t cod_lum_max1 = 0
 
uint8_t cod_cb_min1 = 0
 
uint8_t cod_cb_max1 = 0
 
uint8_t cod_cr_min1 = 0
 
uint8_t cod_cr_max1 = 0
 
uint8_t cod_lum_min2 = 0
 
uint8_t cod_lum_max2 = 0
 
uint8_t cod_cb_min2 = 0
 
uint8_t cod_cb_max2 = 0
 
uint8_t cod_cr_min2 = 0
 
uint8_t cod_cr_max2 = 0
 
bool cod_draw1 = false
 
bool cod_draw2 = false
 
struct color_object_t global_filters [2]
 

Data Structure Documentation

◆ color_object_t

struct color_object_t

Definition at line 74 of file cv_detect_color_object.c.

Data Fields
uint32_t color_count
bool updated
int32_t x_c
int32_t y_c

Macro Definition Documentation

◆ COLOR_OBJECT_DETECTOR_FPS1

#define COLOR_OBJECT_DETECTOR_FPS1   0

Default FPS (zero means run at camera fps)

Definition at line 49 of file cv_detect_color_object.c.

◆ COLOR_OBJECT_DETECTOR_FPS2

#define COLOR_OBJECT_DETECTOR_FPS2   0

Default FPS (zero means run at camera fps)

Definition at line 52 of file cv_detect_color_object.c.

◆ PRINT

#define PRINT (   string,
  ... 
)    fprintf(stderr, "[object_detector->%s()] " string,__FUNCTION__ , ##__VA_ARGS__)

Definition at line 39 of file cv_detect_color_object.c.

◆ VERBOSE_PRINT

#define VERBOSE_PRINT (   ...)

Definition at line 43 of file cv_detect_color_object.c.

Function Documentation

◆ color_object_detector_init()

◆ color_object_detector_periodic()

◆ find_object_centroid()

uint32_t find_object_centroid ( struct image_t img,
int32_t p_xc,
int32_t p_yc,
bool  draw,
uint8_t  lum_min,
uint8_t  lum_max,
uint8_t  cb_min,
uint8_t  cb_max,
uint8_t  cr_min,
uint8_t  cr_max 
)

Definition at line 209 of file cv_detect_color_object.c.

References image_t::buf, image_t::h, up, and image_t::w.

Referenced by object_detector().

+ Here is the caller graph for this function:

◆ object_detector()

static struct image_t* object_detector ( struct image_t img,
uint8_t  filter 
)
static

◆ object_detector1()

struct image_t * object_detector1 ( struct image_t img,
uint8_t  camera_id 
)

Definition at line 143 of file cv_detect_color_object.c.

References object_detector().

Referenced by color_object_detector_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_detector2()

struct image_t * object_detector2 ( struct image_t img,
uint8_t  camera_id 
)

Definition at line 149 of file cv_detect_color_object.c.

References object_detector().

Referenced by color_object_detector_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ cod_cb_max1

uint8_t cod_cb_max1 = 0

Definition at line 59 of file cv_detect_color_object.c.

Referenced by color_object_detector_init(), and object_detector().

◆ cod_cb_max2

uint8_t cod_cb_max2 = 0

Definition at line 66 of file cv_detect_color_object.c.

Referenced by color_object_detector_init(), and object_detector().

◆ cod_cb_min1

uint8_t cod_cb_min1 = 0

Definition at line 58 of file cv_detect_color_object.c.

Referenced by color_object_detector_init(), and object_detector().

◆ cod_cb_min2

uint8_t cod_cb_min2 = 0

Definition at line 65 of file cv_detect_color_object.c.

Referenced by color_object_detector_init(), and object_detector().

◆ cod_cr_max1

uint8_t cod_cr_max1 = 0

Definition at line 61 of file cv_detect_color_object.c.

Referenced by color_object_detector_init(), and object_detector().

◆ cod_cr_max2

uint8_t cod_cr_max2 = 0

Definition at line 68 of file cv_detect_color_object.c.

Referenced by color_object_detector_init(), and object_detector().

◆ cod_cr_min1

uint8_t cod_cr_min1 = 0

Definition at line 60 of file cv_detect_color_object.c.

Referenced by color_object_detector_init(), and object_detector().

◆ cod_cr_min2

uint8_t cod_cr_min2 = 0

Definition at line 67 of file cv_detect_color_object.c.

Referenced by color_object_detector_init(), and object_detector().

◆ cod_draw1

bool cod_draw1 = false

Definition at line 70 of file cv_detect_color_object.c.

Referenced by color_object_detector_init(), and object_detector().

◆ cod_draw2

bool cod_draw2 = false

Definition at line 71 of file cv_detect_color_object.c.

Referenced by color_object_detector_init(), and object_detector().

◆ cod_lum_max1

uint8_t cod_lum_max1 = 0

Definition at line 57 of file cv_detect_color_object.c.

Referenced by color_object_detector_init(), and object_detector().

◆ cod_lum_max2

uint8_t cod_lum_max2 = 0

Definition at line 64 of file cv_detect_color_object.c.

Referenced by color_object_detector_init(), and object_detector().

◆ cod_lum_min1

uint8_t cod_lum_min1 = 0

Definition at line 56 of file cv_detect_color_object.c.

Referenced by color_object_detector_init(), and object_detector().

◆ cod_lum_min2

uint8_t cod_lum_min2 = 0

Definition at line 63 of file cv_detect_color_object.c.

Referenced by color_object_detector_init(), and object_detector().

◆ global_filters

struct color_object_t global_filters[2]

◆ mutex