Go to documentation repository
Example 1. Script to select abandoned objects with a frame in live video
If you use the object tracking on a video image (see Creating and configuring the Tracker object), then when you view archive, the detected abandoned objects will be selected with a framed in video. To select the abandoned objects with a frame in a live video, use the script to select an abandoned object with a frame when receiving an alarm from VMDA detection tool:
if (Event.SourceType=="CAM_VMDA_DETECTOR")
{
cam=GetObjectParentId("CAM_VMDA_DETECTOR",Event.SourceId,"CAM");
if (Event.Action=="ALARM")
{
var x1,x2,y1,y2;
x1=Event.GetParam("x");
x2=Event.GetParam("w");
y1=Event.GetParam("y");
y2=Event.GetParam("h");
x2=parseInt(x1)+parseInt(x2);
y2=parseInt(y1)+parseInt(y2);
DoReactStr("MONITOR","","SET_MARKRECT","cam<"+cam+">,color<255>,id<"+cam+">,x1<"+x1+">,x2<"+x2+">,y1<"+y1+">,y2<"+y2+">");
DebugLogString("x1:"+x1+" x2:"+x2+" y1:"+y1+" y2:"+y2);
}
else
{
DoReactStr("MONITOR","","DEL_MARKRECT","cam<"+cam+">,id<"+cam+">");
}
}
When the number of people reaches 20 on the embedded people counter detection of the Bosch FLEXIDOME IP dynamic 7000 VR IP camera (with ID 1), call macro 1.
n=20;
if(Event.SourceType == "CAM_IP_DETECTOR" && Event.SourceId=="1" && Event.Action == "DETECTED")
{
v=Event.GetParam("param0").split(";")[1];
if (parseInt(v.split(":")[1])==n)
{
DoReactStr("MACRO","1","RUN","");
}
}