cropsize = 1;
} else {
cropsize = layer->bug_frame.geometry.x - (new_w / 2);
+ if (cropsize > img->d_w - new_w) {
+ cropsize = img->d_w - new_w;
+ }
}
} else {
cropsize = (img->d_w - new_w) / 2;
}
- if (cropsize > img->d_w - new_w) {
- cropsize = img->d_w - new_w;
- }
-
if (cropsize < 1) {
cropsize = 1;
- }
-
+ }
+
if (cropsize) {
switch_img_set_rect(img, cropsize, 0, new_w, new_h);
img_aspect = (double) img->d_w / img->d_h;
cropsize = 1;
} else {
cropsize = layer->bug_frame.geometry.y - (new_h / 2);
+ if (cropsize > img->d_h - new_h) {
+ cropsize = img->d_h - new_h;
+ }
}
} else {
cropsize = (img->d_h - new_h) / 2;
}
- if (cropsize > img->d_h - new_h) {
- cropsize = img->d_h - new_h;
- }
-
if (cropsize < 1) {
cropsize = 1;
}
int detect_event;
int nest_detect_event;
struct shape shape[MAX_SHAPES];
+ struct shape last_shape[MAX_SHAPES];
int shape_idx;
int32_t skip;
int32_t skip_count;
//printf("SCORE: %d %f %d\n", context->detected.simo_count, context->detected.avg, context->detected.last_score);
+ for (i = 0; i < context->shape_idx; i++) {
+ context->last_shape[i] = context->shape[i];
+ }
+
context->shape_idx = 0;
//memset(context->shape, 0, sizeof(context->shape[0]) * MAX_SHAPES);
switch_img_to_raw(frame->img, context->rawImage->imageData, context->rawImage->widthStep, SWITCH_IMG_FMT_RGB24);
detectAndDraw(context);
+
+ if (context->detect_event && context->shape_idx &&
+ abs(context->shape[0].cx - context->last_shape[0].cx) > 200 || abs(context->shape[0].w - context->last_shape[0].w) > 200) {
+ context->detected.simo_count = 0;
+ context->detected.simo_miss_count = context->confidence_level;
+ }
if (context->detected.simo_count > context->confidence_level) {
if (!context->detect_event) {