39 #define PRINT(string,...) fprintf(stderr, "[object_detector->%s()] " string,__FUNCTION__ , ##__VA_ARGS__)
40 #if OBJECT_DETECTOR_VERBOSE
41 #define VERBOSE_PRINT PRINT
43 #define VERBOSE_PRINT(...)
48 #ifndef COLOR_OBJECT_DETECTOR_FPS1
49 #define COLOR_OBJECT_DETECTOR_FPS1 0
51 #ifndef COLOR_OBJECT_DETECTOR_FPS2
52 #define COLOR_OBJECT_DETECTOR_FPS2 0
128 VERBOSE_PRINT(
"Color count %d: %u, threshold %u, x_c %d, y_c %d\n", camera, object_count, count_threshold, x_c, y_c);
129 VERBOSE_PRINT(
"centroid %d: (%d, %d) r: %4.2f a: %4.2f\n", camera, x_c, y_c,
130 hypotf(x_c, y_c) / hypotf(img->
w * 0.5, img->
h * 0.5), RadOfDeg(atan2f(y_c, x_c)));
132 pthread_mutex_lock(&
mutex);
137 pthread_mutex_unlock(&
mutex);
157 pthread_mutex_init(&
mutex, NULL);
158 #ifdef COLOR_OBJECT_DETECTOR_CAMERA1
159 #ifdef COLOR_OBJECT_DETECTOR_LUM_MIN1
167 #ifdef COLOR_OBJECT_DETECTOR_DRAW1
174 #ifdef COLOR_OBJECT_DETECTOR_CAMERA2
175 #ifdef COLOR_OBJECT_DETECTOR_LUM_MIN2
183 #ifdef COLOR_OBJECT_DETECTOR_DRAW2
226 up = &buffer[y * 2 * img->
w + 2 * x];
227 yp = &buffer[y * 2 * img->
w + 2 * x + 1];
228 vp = &buffer[y * 2 * img->
w + 2 * x + 2];
232 up = &buffer[y * 2 * img->
w + 2 * x - 2];
234 vp = &buffer[y * 2 * img->
w + 2 * x];
235 yp = &buffer[y * 2 * img->
w + 2 * x + 1];
237 if ( (*yp >= lum_min) && (*yp <= lum_max) &&
238 (*
up >= cb_min ) && (*
up <= cb_max ) &&
239 (*vp >= cr_min ) && (*vp <= cr_max )) {
250 *p_xc = (
int32_t)roundf(tot_x / ((
float) cnt) - img->
w * 0.5f);
251 *p_yc = (
int32_t)roundf(img->
h * 0.5f - tot_y / ((
float) cnt));
262 pthread_mutex_lock(&
mutex);
264 pthread_mutex_unlock(&
mutex);
269 local_filters[0].
updated =
false;
274 local_filters[1].
updated =
false;