82
Script_language_On_the_page'>Examples of scripts in JScript language
On the page:
Example 1. Visualisation of operating the
Queue length detection in the Video
Surveillance
monitor
Example 2. Visualisation of operating the
People Counter detection in the Video
Surveillance monitor
Example 3. Setting the text for displaying
on the map
Example 4. Displaying camera on the
monitor by clicking the button on the
remote control
Example 5. Sending command to camera
using
the camera HTTPAPI
Example 6. Script for framing abandoned
objects in live video
Example 7. Using START and STOP events
for Failove
To illustrate available fields of application of scripts in Jscript see the following examples which can be used to create additional functions in the system on the basis of the
Script
object.
Example 1. Visualisation of operating the Queue length detection in the Video Surveillance monitor
The
object (is part of the Detector Pack package),
and
objects (instead of N, M, L symbols set the corresponding
numbers of the Queue
Queue length detection
Camera
Captioner
length detection, Camera and Captioner objects) are to be created and configured for correct script working in the
software.
Intellect
//Event reading by the queue length
if (Event.SourceType == "OCCUPANCY_COUNTER" && Event.SourceId == "N" && Event.Action == "OCCUPANCY") //N -
Number of Queue length detection
{
var n=Event.GetParam("occupancy");
//Displaying the queue number by the Captioner in the Monitor
DoReactStr("CAM","M","CLEAR_SUBTITLES","title_id
"); //M - Number of Camera L - Number of Captioner
DoReactStr("CAM","M","ADD_SUBTITLES","command,page,title_id");
//M, L - the same
}
83
As a result the text message about the current queue length will be imposed on the video image while displaying the corresponding camera in the Video Surveillance monitor.
Settings of the font, color and position of text is configured on the settings panel of the
object.
Captioner
Example 2. Visualisation of operating the People Counter detection in the Video Surveillance monitor
The
object (is part of the Detector Pack package),
,
and
objects (instead of N, M, L, P symbols set the corresponding numbers
Macro'>People Counter Detection
Camera Captioner
Macro
of
the People counter detection, Camera, Captioner and Macro objects) are to be created and configured for correct script working in the
software.
Intellect
//Event reading and counting of entered people
if (Event.SourceType == "PEOPLE_COUNTER" && Event.SourceId == "N" && Event.Action == "IN") //N - Number of
People Counter detection
{
i = Itv_var("counter_i");
k = Itv_var("counter_k");
i++;
Itv_var("counter_i")=i;
//Displaying the number of people
by Captioner in the Monitor
DoReactStr("CAM","M","CLEAR_SUBTITLES","title_id
"); //M - Number of Camera L - Number of Captioner
DoReactStr("CAM","M","ADD_SUBTITLES","command,
page,title_id"); //M, L - the same
}
//Event reading and counting of exitng people
if (Event.SourceType == "PEOPLE_COUNTER" && Event.SourceId == "N" && Event.Action == "OUT") //N - Number of
People Counter detection
{
i = Itv_var("counter_i");
k = Itv_var("counter_k");
k++;
Itv_var("counter_k")=k;
//Displaying the number of people by Captioner in the Monitor
DoReactStr("CAM","M","CLEAR_SUBTITLES","title_id"); //M - Number of Camera L - Number of Captioner
DoReactStr("CAM","M","ADD_SUBTITLES","command,
page,title_id"); //M, L - the same
84
}
//Null the counter by Macro (previously the Macro is to be created in the Intellect)
if (Event.SourceType == "MACRO" && Event.SourceId == "P" && Event.Action == "RUN") //P - Number of Macro
{
Itv_var("counter_i")=0;
Itv_var("counter_k")=0;
i=0;
k=0;
//Displaying number of people by Captioner in the Monitor
DoReactStr("CAM","M","CLEAR_SUBTITLES","title_id
"); //M - Number of Camera L - Number of Captioner
DoReactStr("CAM","M","ADD_SUBTITLES","command,
page,title_id"); //M, L - the same
}
As a result the text message about number of entering and exiting people will be imposed on the video image while displaying the corresponding camera in the Video Surveillance
monitor.
Settings of the font, color and position of text is configured on the settings panel of the
object (see the
section of the
Captioner
Configuring captions display on a video image
Administ
document).
rator’s Guide
Previously create the
object on the
tab to null the counter of visitors. The name of the object can be changed to “Null of people counter” for ease of using.
Macro
Programming
Macro of setting to zero can be run manually by main menu of the
software package or automatically in any specified time (use the
table on the settings panel of the
Intellect
Events
M
object where the previously configured
object is to be specified). Detailed information about using the
and
objects is given in the
acro
Time zone
Macro
Time zone
Administrator's
document).
Guide
Example 3. Setting the text for displaying on the map
It is possible to select the type of
displaying while attaching object to the map (see
, the
section). Also the
Text
Administrator Guide
Attaching objects to the layers of interactive map
script on the JScript language can be used for changing the displayed text.
Example. The Text type of display on the map is selected for the Camera 1. It's required to display value of the MyVar value read from the C:\test.ini file on the map and debug
window while processing the Macro 1.
if(Event.SourceType == "MACRO" && Event.Action == "RUN")
{
var result = parseInt(ReadIni("MyVar","C:\\test.ini"));
result += 2;
NotifyEventStr("CAM","1","ANALOG_PARAMS","text, blink_state<1>");