People Counting

Syrus can communicate with people counting cameras in order to help you count the total number of people that have passed by a location and take actions over it.

General Overview

  • The way it works is that you connect a compatible people counting camera
  • Configure the camera to be on the same network as the Syrus
  • Configure the Syrus with the IP address of the people counting camera
  • Send the system tool command to enable the people camera
  • Create the Syruslang script that takes actions and configures events based on people count

Installation / Wiring Diagrams

Dual-Lens People Counting Network Camera

The people counting camera connects to the Syrus via wifi, so we just need to install and setup the camera and then configure the Syrus to find it.

Camera Installation

In order to install the camera you can follow this guide.
Installation / Quick Start Guide

Guide: Hikvision DS-2CD6825G0

Use the user manual in order to connect the camera to your network: User Manual.

Set the IP

Once you have access to the web management UI go to the network settings and set a fixed IP address.

Set the destination IP and Port to one that's available in your network, here are the settings we used:

  • IP: 192.168.0.63
  • Port: 61126
  • ANR: Enable

Enable People Counting

To enable the people counting on the camera, head to the VCA tab and select People Counting

And then enable the Real-Time Upload Data option from the People Counting -> Data uploading section. This will instruct the camera to send a message to the Syrus when someone enters or leaves the selected area.People Counting Rules

Set up the people counting area to monitor underneath the camera.

  • Enable People counting
  • Select "Auto" in calibration
  • Select the hexagonal icon in the left side of the preview and with the right button of the mouse build a square into the red square (this automatic build), click on left button to exit
  • Click on the diagonal line button down the previous one to put the "enter" guideline, adjust the size to fit into the previously built square, the direction can be changed clicking on the two arrow button.

Add camera config on Syrus

Now you're ready to add the people counting camera to the Syrus via the Syrus Cloud video profile section.

The video profile saved will look like this:

{
  "destination": "sd",
  "reserved_percentage": 100,
  "cameras": [
    {
      "type": "people_counting",
      "name": "door_cam",
      "mode": "on_demand",
      "ip": "192.168.0.63",
      "user": "admin",
      "pass": "*********",
      "resolution": "HD",
      "codec": "H264",
      "audio": false,
      "uri": "rtsp://admin:*********@192.168.0.63:554/ISAPI/streaming/channels/101"
    }
  ]
}

Enable people counting

Next, you should use the apx system tools to enable the people counting

# Enable people counting
$ apx-ndm-pc start

Use Syruslang to take actions

Now you can use Syruslang to build custom logic depending on different conditions. Here's some examples of a simple people counting application.

#### PEOPLE COUNTER #####
# Send an event whenever an adult leaves or enters the room
define event ev_pc_enter group=tracking fieldset=default ack=seq label=pcenter code=60 [email protected]_enter
define event ev_pc_exit group=tracking fieldset=default ack=seq label=pcexit code=61 [email protected]_exit

# Send an event when the room gets a little crowded
define signal sg_pc_max $people.adults_inside >= 20
define event ev_pc_max group=tracking fieldset=default ack=seq label=pcmax code=62 trigger=sg_pc_max

Now let's try a more complex example, the following script starts and stop the people counter given a working hours schedule (time window).

   
############# TIME WINDOWS ##############
define window working_hours start=01/01/2023 end=30/12/2023 from=13:00:00 to=22:00:00 days=0,1,1,1,1,1,0 enabled=true type=periodic

define action start_working [email protected]_hours.start
    exec apx-ndm-pc start

define action end_working [email protected]_hours.end
    exec apx-ndm-pc stop
    exec apx-ndm-pc reset

define event ev_start group=tracking fieldset=default 
    [email protected]_hours.start
    ack=seq label=strtwrk code=10

define event ev_stop group=tracking fieldset=default 
    [email protected]_hours.end
    ack=seq label=endwrk code=11
		
############### PEOPLE COUNTER ###########
define event ev_pc_enter group=tracking fieldset=default ack=seq label=pcenter code=60 [email protected]_enter
define event ev_pc_exit group=tracking fieldset=default ack=seq label=pcexit code=61 [email protected]_exit