Added Preventive zone type.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@473 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
a0e29e0401
commit
aa1164a0e3
|
@ -4,6 +4,7 @@
|
||||||
alter table Monitors change column Colours Palette tinyint(3) unsigned NOT NULL default '1';
|
alter table Monitors change column Colours Palette tinyint(3) unsigned NOT NULL default '1';
|
||||||
update Monitors set Palette = 1 where Palette = 8;
|
update Monitors set Palette = 1 where Palette = 8;
|
||||||
update Monitors set Palette = 4 where Palette = 24;
|
update Monitors set Palette = 4 where Palette = 24;
|
||||||
|
alter table Zones modify column Type enum('Active','Inclusive','Exclusive','Inactive','Preventive') not null default 'Active';
|
||||||
-- These are optional, it just seemed a good time...
|
-- These are optional, it just seemed a good time...
|
||||||
optimize table Frames;
|
optimize table Frames;
|
||||||
optimize table Events;
|
optimize table Events;
|
||||||
|
|
|
@ -618,14 +618,14 @@ int LocalCamera::PostCapture( Image &image )
|
||||||
}
|
}
|
||||||
case VIDEO_PALETTE_GREY :
|
case VIDEO_PALETTE_GREY :
|
||||||
{
|
{
|
||||||
int size = width*height;
|
//int size = width*height;
|
||||||
for ( int i = 0; i < size; i++ )
|
//for ( int i = 0; i < size; i++ )
|
||||||
{
|
//{
|
||||||
if ( buffer[i] < 16 )
|
//if ( buffer[i] < 16 )
|
||||||
Info(( "Lo grey %d", buffer[i] ));
|
//Info(( "Lo grey %d", buffer[i] ));
|
||||||
if ( buffer[i] > 235 )
|
//if ( buffer[i] > 235 )
|
||||||
Info(( "Hi grey %d", buffer[i] ));
|
//Info(( "Hi grey %d", buffer[i] ));
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
default : // Everything else is straightforward, for now.
|
default : // Everything else is straightforward, for now.
|
||||||
{
|
{
|
||||||
|
|
|
@ -786,6 +786,31 @@ unsigned int Monitor::Compare( const Image &image )
|
||||||
delta_image->Fill( RGB_BLACK, &(zone->Limits()) );
|
delta_image->Fill( RGB_BLACK, &(zone->Limits()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check preventive zones first
|
||||||
|
for ( int n_zone = 0; n_zone < n_zones; n_zone++ )
|
||||||
|
{
|
||||||
|
Zone *zone = zones[n_zone];
|
||||||
|
if ( !zone->IsPreventive() )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Debug( 3, ( "Checking preventive zone %s", zone->Label() ));
|
||||||
|
if ( zone->CheckAlarms( delta_image ) )
|
||||||
|
{
|
||||||
|
alarm = true;
|
||||||
|
score += zone->Score();
|
||||||
|
Debug( 3, ( "Zone is alarmed, zone score = %d", zone->Score() ));
|
||||||
|
zone->ResetStats();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( alarm )
|
||||||
|
{
|
||||||
|
alarm = false;
|
||||||
|
score = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Find all alarm pixels in active zones
|
// Find all alarm pixels in active zones
|
||||||
for ( int n_zone = 0; n_zone < n_zones; n_zone++ )
|
for ( int n_zone = 0; n_zone < n_zones; n_zone++ )
|
||||||
{
|
{
|
||||||
|
@ -843,6 +868,7 @@ unsigned int Monitor::Compare( const Image &image )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
delete delta_image;
|
delete delta_image;
|
||||||
// This is a small and innocent hack to prevent scores of 0 being returned in alarm state
|
// This is a small and innocent hack to prevent scores of 0 being returned in alarm state
|
||||||
|
|
|
@ -478,8 +478,9 @@ bool Zone::DumpSettings( char *output, bool verbose )
|
||||||
type==ACTIVE?"Active":(
|
type==ACTIVE?"Active":(
|
||||||
type==INCLUSIVE?"Inclusive":(
|
type==INCLUSIVE?"Inclusive":(
|
||||||
type==EXCLUSIVE?"Exclusive":(
|
type==EXCLUSIVE?"Exclusive":(
|
||||||
type==INACTIVE?"Inactive":"Unknown"
|
type==INACTIVE?"Inactive":(
|
||||||
))));
|
type==PREVENTIVE?"Preventive":"Unknown"
|
||||||
|
)))));
|
||||||
sprintf( output+strlen(output), " Limits : %d,%d - %d,%d\n", limits.LoX(), limits.LoY(), limits.HiX(), limits.HiY() );
|
sprintf( output+strlen(output), " Limits : %d,%d - %d,%d\n", limits.LoX(), limits.LoY(), limits.HiX(), limits.HiY() );
|
||||||
sprintf( output+strlen(output), " Alarm RGB : %06x\n", alarm_rgb );
|
sprintf( output+strlen(output), " Alarm RGB : %06x\n", alarm_rgb );
|
||||||
sprintf( output+strlen(output), " Alarm Threshold : %d\n", alarm_threshold );
|
sprintf( output+strlen(output), " Alarm Threshold : %d\n", alarm_threshold );
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Monitor;
|
||||||
class Zone
|
class Zone
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef enum { ACTIVE=1, INCLUSIVE, EXCLUSIVE, INACTIVE } ZoneType;
|
typedef enum { ACTIVE=1, INCLUSIVE, EXCLUSIVE, INACTIVE, PREVENTIVE } ZoneType;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Inputs
|
// Inputs
|
||||||
|
@ -98,6 +98,7 @@ public:
|
||||||
inline bool IsInclusive() const { return( type == INCLUSIVE ); }
|
inline bool IsInclusive() const { return( type == INCLUSIVE ); }
|
||||||
inline bool IsExclusive() const { return( type == EXCLUSIVE ); }
|
inline bool IsExclusive() const { return( type == EXCLUSIVE ); }
|
||||||
inline bool IsInactive() const { return( type == INACTIVE ); }
|
inline bool IsInactive() const { return( type == INACTIVE ); }
|
||||||
|
inline bool IsPreventive() const { return( type == PREVENTIVE ); }
|
||||||
inline Image &AlarmImage() const { return( *image ); }
|
inline Image &AlarmImage() const { return( *image ); }
|
||||||
inline const Box &Limits() const { return( limits ); }
|
inline const Box &Limits() const { return( limits ); }
|
||||||
inline bool Alarmed() const { return( alarmed ); }
|
inline bool Alarmed() const { return( alarmed ); }
|
||||||
|
|
|
@ -77,7 +77,8 @@ switch( $view )
|
||||||
{
|
{
|
||||||
$row['zmc'] = zmcCheck( $row );
|
$row['zmc'] = zmcCheck( $row );
|
||||||
$row['zma'] = zmaCheck( $row );
|
$row['zma'] = zmaCheck( $row );
|
||||||
$sql = "select count(Id) as ZoneCount, count(if(Type='Active',1,NULL)) as ActZoneCount, count(if(Type='Inclusive',1,NULL)) as IncZoneCount, count(if(Type='Exclusive',1,NULL)) as ExcZoneCount, count(if(Type='Inactive',1,NULL)) as InactZoneCount from Zones where MonitorId = '$row[Id]'";
|
//$sql = "select count(Id) as ZoneCount, count(if(Type='Active',1,NULL)) as ActZoneCount, count(if(Type='Inclusive',1,NULL)) as IncZoneCount, count(if(Type='Exclusive',1,NULL)) as ExcZoneCount, count(if(Type='Inactive',1,NULL)) as InactZoneCount from Zones where MonitorId = '$row[Id]'";
|
||||||
|
$sql = "select count(Id) as ZoneCount from Zones where MonitorId = '$row[Id]'";
|
||||||
$result2 = mysql_query( $sql );
|
$result2 = mysql_query( $sql );
|
||||||
if ( !$result2 )
|
if ( !$result2 )
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
|
@ -2247,6 +2248,37 @@ function applyZoneType(theForm)
|
||||||
theForm.new_max_blobs.disabled = true;
|
theForm.new_max_blobs.disabled = true;
|
||||||
theForm.new_max_blobs.value = "";
|
theForm.new_max_blobs.value = "";
|
||||||
}
|
}
|
||||||
|
else if ( theForm.new_type.value == 'Preventive' )
|
||||||
|
{
|
||||||
|
theForm.new_alarm_rgb_r.disabled = true;
|
||||||
|
theForm.new_alarm_rgb_r.value = "";
|
||||||
|
theForm.new_alarm_rgb_g.disabled = true;
|
||||||
|
theForm.new_alarm_rgb_g.value = "";
|
||||||
|
theForm.new_alarm_rgb_b.disabled = true;
|
||||||
|
theForm.new_alarm_rgb_b.value = "";
|
||||||
|
theForm.new_alarm_threshold.disabled = false;
|
||||||
|
theForm.new_alarm_threshold.value = "<?= $zone[AlarmThreshold] ?>";
|
||||||
|
theForm.new_min_alarm_pixels.disabled = false;
|
||||||
|
theForm.new_min_alarm_pixels.value = "<?= $zone[MinAlarmPixels] ?>";
|
||||||
|
theForm.new_max_alarm_pixels.disabled = false;
|
||||||
|
theForm.new_max_alarm_pixels.value = "<?= $zone[MaxAlarmPixels] ?>";
|
||||||
|
theForm.new_filter_x.disabled = false;
|
||||||
|
theForm.new_filter_x.value = "<?= $zone[FilterX] ?>";
|
||||||
|
theForm.new_filter_y.disabled = false;
|
||||||
|
theForm.new_filter_y.value = "<?= $zone[FilterY] ?>";
|
||||||
|
theForm.new_min_filter_pixels.disabled = false;
|
||||||
|
theForm.new_min_filter_pixels.value = "<?= $zone[MinFilterPixels] ?>";
|
||||||
|
theForm.new_max_filter_pixels.disabled = false;
|
||||||
|
theForm.new_max_filter_pixels.value = "<?= $zone[MaxFilterPixels] ?>";
|
||||||
|
theForm.new_min_blob_pixels.disabled = false;
|
||||||
|
theForm.new_min_blob_pixels.value = "<?= $zone[MinBlobPixels] ?>";
|
||||||
|
theForm.new_max_blob_pixels.disabled = false;
|
||||||
|
theForm.new_max_blob_pixels.value = "<?= $zone[MaxBlobPixels] ?>";
|
||||||
|
theForm.new_min_blobs.disabled = false;
|
||||||
|
theForm.new_min_blobs.value = "<?= $zone[MinBlobs] ?>";
|
||||||
|
theForm.new_max_blobs.disabled = false;
|
||||||
|
theForm.new_max_blobs.value = "<?= $zone[MaxBlobs] ?>";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
theForm.new_alarm_rgb_r.disabled = false;
|
theForm.new_alarm_rgb_r.disabled = false;
|
||||||
|
|
Loading…
Reference in New Issue