Fixed problem with debug images ending up as analysis images.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1003 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
2ff1a27ef3
commit
2465a916b2
|
@ -703,7 +703,7 @@ bool Monitor::Analyse()
|
|||
}
|
||||
if ( score )
|
||||
{
|
||||
if ( state == IDLE )
|
||||
if ( state == IDLE || state == TAPE )
|
||||
{
|
||||
Info(( "%s: %03d - Gone into alarm state", name, image_count ));
|
||||
if ( function != MOCORD )
|
||||
|
@ -757,18 +757,25 @@ bool Monitor::Analyse()
|
|||
{
|
||||
if ( create_analysis_images )
|
||||
{
|
||||
bool got_anal_image = false;
|
||||
Image alarm_image( *snap_image );
|
||||
for( int i = 0; i < n_zones; i++ )
|
||||
{
|
||||
if ( zones[i]->Alarmed() )
|
||||
{
|
||||
alarm_image.Overlay( zones[i]->AlarmImage() );
|
||||
if ( zones[i]->AlarmImage() )
|
||||
{
|
||||
alarm_image.Overlay( *(zones[i]->AlarmImage()) );
|
||||
got_anal_image = true;
|
||||
}
|
||||
if ( record_event_stats )
|
||||
{
|
||||
zones[i]->RecordStats( event );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( got_anal_image )
|
||||
{
|
||||
event->AddFrame( snap_image, *timestamp, score, &alarm_image );
|
||||
}
|
||||
else
|
||||
|
@ -776,6 +783,11 @@ bool Monitor::Analyse()
|
|||
event->AddFrame( snap_image, *timestamp, score );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
event->AddFrame( snap_image, *timestamp, score );
|
||||
}
|
||||
}
|
||||
else if ( state == ALERT )
|
||||
{
|
||||
event->AddFrame( snap_image, *timestamp );
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
bool Zone::initialised = false;
|
||||
bool Zone::record_diag_images;
|
||||
bool Zone::create_analysis_images;
|
||||
|
||||
void Zone::Setup( Monitor *p_monitor, int p_id, const char *p_label, ZoneType p_type, const Box &p_limits, const Rgb p_alarm_rgb, CheckMethod p_check_method, int p_min_pixel_threshold, int p_max_pixel_threshold, int p_min_alarm_pixels, int p_max_alarm_pixels, const Coord &p_filter_box, int p_min_filter_pixels, int p_max_filter_pixels, int p_min_blob_pixels, int p_max_blob_pixels, int p_min_blobs, int p_max_blobs )
|
||||
{
|
||||
|
@ -335,7 +336,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
}
|
||||
}
|
||||
}
|
||||
if ( (bool)config.Item( ZM_RECORD_DIAG_IMAGES ) )
|
||||
if ( record_diag_images )
|
||||
{
|
||||
static char diag_path[PATH_MAX] = "";
|
||||
if ( !diag_path[0] )
|
||||
|
@ -434,12 +435,17 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
|
||||
alarm_box = Box( Coord( alarm_lo_x, alarm_lo_y ), Coord( alarm_hi_x, alarm_hi_y ) );
|
||||
|
||||
if ( (type < PRECLUSIVE) && check_method >= BLOBS && (bool)config.Item( ZM_CREATE_ANALYSIS_IMAGES ) )
|
||||
if ( (type < PRECLUSIVE) && check_method >= BLOBS && create_analysis_images )
|
||||
{
|
||||
image = diff_image->HighlightEdges( alarm_rgb, &limits );
|
||||
// Only need to delete this when 'image' becomes detached and points somewhere else
|
||||
delete diff_image;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete image;
|
||||
image = 0;
|
||||
}
|
||||
|
||||
Debug( 1, ( "%s: Alarm Pixels: %d, Filter Pixels: %d, Blob Pixels: %d, Blobs: %d, Score: %d", Label(), alarm_pixels, alarm_filter_pixels, alarm_blob_pixels, alarm_blobs, score ));
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
protected:
|
||||
static bool initialised;
|
||||
static bool record_diag_images;
|
||||
static bool create_analysis_images;
|
||||
|
||||
protected:
|
||||
// Inputs
|
||||
|
@ -85,6 +86,7 @@ protected:
|
|||
{
|
||||
initialised = true;
|
||||
record_diag_images = (bool)config.Item( ZM_RECORD_DIAG_IMAGES );
|
||||
create_analysis_images = (bool)config.Item( ZM_CREATE_ANALYSIS_IMAGES );
|
||||
}
|
||||
|
||||
void Setup( Monitor *p_monitor, int p_id, const char *p_label, ZoneType p_type, const Box &p_limits, const Rgb p_alarm_rgb, CheckMethod p_check_method, int p_min_pixel_threshold, int p_max_pixel_threshold, int p_min_alarm_pixels, int p_max_alarm_pixels, const Coord &p_filter_box, int p_min_filter_pixels, int p_max_filter_pixels, int p_min_blob_pixels, int p_max_blob_pixels, int p_min_blobs, int p_max_blobs );
|
||||
|
@ -113,7 +115,7 @@ public:
|
|||
inline bool IsExclusive() const { return( type == EXCLUSIVE ); }
|
||||
inline bool IsPreclusive() const { return( type == PRECLUSIVE ); }
|
||||
inline bool IsInactive() const { return( type == INACTIVE ); }
|
||||
inline Image &AlarmImage() const { return( *image ); }
|
||||
inline const Image *AlarmImage() const { return( image ); }
|
||||
inline const Box &Limits() const { return( limits ); }
|
||||
inline bool Alarmed() const { return( alarmed ); }
|
||||
inline void SetAlarm() { alarmed = true; }
|
||||
|
|
Loading…
Reference in New Issue