PAlarmVerificationAnalytics Class Reference

Detailed Description

The PAlarmVerificationAnalytics class performs alarm validation on an incoming video.

Many cameras currently have their own motion detection systems built in. However, many of these are very limited given the computing power available to them. This results in many false positives being generated. This algorithm can be used to do a secondary check of those alarms using more powerful intelligent motion detection algorithms available within Papillon. To use, all you have to do is supply a small video clip of the alarm and this function will return with a probability that the alarm was a true or false positive. The function can also produce a video with an overlay of the detected motion.

The current version of Alarm Verification has been optimised for not removing actual alarms. This comes at a cost of not filtering out as many false-positives as possible. However, most scenarios prefer this type of behaviour. Please, contact us if you require further explanation.

dot_inline_dotgraph_8.png

If you are using a 32-bit version of this SDK then note that Alarm Verification can only cope with relatively short videos. If in-memory memory requirements exceed 512Mb, the analytics not be carried out on frames exceeding this limit.

An example of its use is shown in the following code.

/*
* Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
* Contact: http://www.digitalbarriers.com/
*
* This file is part of the Papillon SDK.
*
* You can't use, modify or distribute any part of this file without
* the explicit written agreements of Digital Barriers.
*/
#include <PapillonCore.h>
USING_NAMESPACE_PAPILLON
const PString SAMPLE_DIR = PPath::Join(PUtils::GetEnv("PAPILLON_INSTALL_DIR"), "Data", "Samples");
PResult AlarmVerification(const PString& inputVideoFile, const PString& outputVideoFile)
{
ReturnIfFailed(PInputVideoStream::Open(inputVideoFile, ivs));
int probability; // value in 0..100
ReturnIfFailed(PAlarmVerificationAnalytics::Apply(ivs, outputVideoFile, probability));
std::cout << std::endl << "Alarm Verification for " << inputVideoFile.Quote() << ": " << probability << "%" << std::endl << std::endl;
ReturnIfFailed(PInputVideoStream::Open(outputVideoFile, ivs));
PFrame frame;
while (ivs.GetFrame(frame).Ok())
{
frame.Resize(2.0f);
frame.Display("Papillon SDK - Alarm Verification", 50); // wait for 50 ms between each frame
}
return PResult::C_OK;
}
int main()
{
PString outputVideoFile = "alarm_with_osd.avi"; // Output video with overlay.
AlarmVerification(PPath::Join(SAMPLE_DIR, "alarm.avi"), outputVideoFile).OrDie();
return 0;
}

Definition at line 62 of file PAlarmVerificationAnalytics.h.

#include <PAlarmVerificationAnalytics.h>

Member Function Documentation

◆ Apply()

static papillon::PResult PAlarmVerificationAnalytics::Apply ( papillon::PInputVideoStream &  i_stream,
const papillon::PString &  i_outVideoPath,
int &  o_result 
)
static

Checks whether video contains an alarm.

Parameters
i_streamThe input video stream.
i_outVideoPathWrite the output video to this path. Video is saved as h264, regardless of the extension. If left empty, no output video will be produced.
o_resultOutput value between 0 and 100. A low value indicates that video does not seem to contain an alarm and a high value indicates an alarm is more likely. Returns PResult::C_OK if success, another value otherwise.