fix scoring algorithim, to use max_alarm_size when specified instead of the size of the zone. (#2186)

This commit is contained in:
vajonam 2018-08-22 12:58:26 -04:00 committed by Isaac Connor
parent 8742388acd
commit d97eea886a
1 changed files with 16 additions and 4 deletions

View File

@ -252,7 +252,11 @@ bool Zone::CheckAlarms(const Image *delta_image) {
return false; return false;
} }
if (max_alarm_pixels != 0)
score = (100*alarm_pixels)/max_alarm_pixels;
else
score = (100*alarm_pixels)/polygon.Area(); score = (100*alarm_pixels)/polygon.Area();
if ( score < 1 ) if ( score < 1 )
score = 1; /* Fix for score of 0 when frame meets thresholds but alarmed area is not big enough */ score = 1; /* Fix for score of 0 when frame meets thresholds but alarmed area is not big enough */
Debug(5, "Current score is %d", score); Debug(5, "Current score is %d", score);
@ -328,7 +332,11 @@ bool Zone::CheckAlarms(const Image *delta_image) {
return false; return false;
} }
score = (100*alarm_filter_pixels)/(polygon.Area()); if (max_filter_pixels != 0)
score = (100*alarm_filter_pixels)/(max_filter_pixels);
else
score = (100*alarm_filter_pixels)/polygon.Area();
if ( score < 1 ) if ( score < 1 )
score = 1; /* Fix for score of 0 when frame meets thresholds but alarmed area is not big enough */ score = 1; /* Fix for score of 0 when frame meets thresholds but alarmed area is not big enough */
Debug(5, "Current score is %d", score); Debug(5, "Current score is %d", score);
@ -590,7 +598,11 @@ bool Zone::CheckAlarms(const Image *delta_image) {
return false; return false;
} }
score = (100*alarm_blob_pixels)/(polygon.Area()); if (max_blob_pixels != 0)
score = (100*alarm_blob_pixels)/(max_blob_pixels);
else
score = (100*alarm_blob_pixels)/polygon.Area();
if ( score < 1 ) if ( score < 1 )
score = 1; /* Fix for score of 0 when frame meets thresholds but alarmed area is not big enough */ score = 1; /* Fix for score of 0 when frame meets thresholds but alarmed area is not big enough */
Debug(5, "Current score is %d", score); Debug(5, "Current score is %d", score);