diff --git a/src/alg.cpp b/src/alg.cpp index 1e27c471..51172e6c 100644 --- a/src/alg.cpp +++ b/src/alg.cpp @@ -1251,14 +1251,15 @@ static void alg_new_stddev(ctx_cam *cam) long chk_stddev; - /* - MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, "dev_x %d dev_y %d dev_xy %d, diff %d ratio %d" + return; + + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO, "dev_x %d dev_y %d dev_xy %d, diff %d ratio %d" , cam->current_image->location.stddev_x , cam->current_image->location.stddev_y , cam->current_image->location.stddev_xy , cam->current_image->diffs , cam->current_image->diffs_ratio); - */ + if (cam->conf->threshold_sdevx > 0) { if (cam->current_image->location.stddev_x > cam->conf->threshold_sdevx) { @@ -1277,6 +1278,10 @@ static void alg_new_stddev(ctx_cam *cam) } } + if (cam->current_image->diffs_ratio < cam->conf->threshold_ratio) { + cam->current_image->diffs = 0; + } + /* Default standard deviation testing. The 8 is just a developer choice of * that would say if the deviation is within 1/8th of the screen count it */ @@ -1346,17 +1351,13 @@ static void alg_new_diff_base(ctx_cam *cam) new_var++; } cam->current_image->diffs_raw = diffs; + cam->current_image->diffs = diffs; + diffs_net = abs(diffs_net); if (diffs_net > 0 ) { cam->current_image->diffs_ratio = (diffs *10) / diffs_net; } else { - cam->current_image->diffs_ratio = diffs; - } - - if (cam->current_image->diffs_ratio > cam->conf->threshold_ratio) { - cam->current_image->diffs = 0; - } else { - cam->current_image->diffs= diffs; + cam->current_image->diffs_ratio = 0; } return; diff --git a/src/motion_loop.cpp b/src/motion_loop.cpp index 03b7d9c0..458e21b8 100644 --- a/src/motion_loop.cpp +++ b/src/motion_loop.cpp @@ -1125,6 +1125,11 @@ static void mlp_overlay(struct ctx_cam *cam) draw_text(cam->imgs.image_motion.image_norm, cam->imgs.width, cam->imgs.height, cam->imgs.width - 10, cam->imgs.height - (30 * cam->text_scale), tmp, cam->text_scale); + sprintf(tmp, "center %d x %d", cam->current_image->location.x , cam->current_image->location.y ); + draw_text(cam->imgs.image_motion.image_norm, cam->imgs.width, cam->imgs.height, + cam->imgs.width - 10, cam->imgs.height - (10 * cam->text_scale), + tmp, cam->text_scale); + } } @@ -1538,12 +1543,8 @@ void *motion_loop(void *arg) mlp_resetimages(cam); if (mlp_retry(cam) == 1) break; if (mlp_capture(cam) == 1) break; - if (cam->shots == 0){ - mlp_detection(cam); - mlp_tuning(cam); - } else { - cam->current_image->diffs = cam->previous_diffs; - } + mlp_detection(cam); + mlp_tuning(cam); mlp_overlay(cam); mlp_actions(cam); mlp_setupmode(cam); @@ -1552,7 +1553,6 @@ void *motion_loop(void *arg) mlp_timelapse(cam); mlp_loopback(cam); mlp_parmsupdate(cam); -// mythreadname_set("ml15",cam->threadnr,cam->conf->camera_name.c_str()); mlp_frametiming(cam); } }