Counting people

Forum for questions and support relating to the 1.31.x releases only.
Locked
davsilveira
Posts: 2
Joined: Wed Oct 18, 2017 11:12 am

Counting people

Post by davsilveira »

Hi guys, I would like to use Zone Minder to create a monitoring system that counts how many people reach an specific point in the camera, this point will be a door, and every time someone pass through this door I want to add to counter.

I've been studing Zone Minder and other open source solutions, and I've been thinking if using Zone Minder blobs and events I can achieve something like that.

Is that possible?
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Counting people

Post by rockedge »

yes it is possible. There is a user that did a counter for cars going by on a street. You need to create a zone for the door and then retrieve the count from the amount of events that the zone for the door creates.
this is the thread that contains the code for how one solution works.
viewtopic.php?f=36&t=26066
davsilveira
Posts: 2
Joined: Wed Oct 18, 2017 11:12 am

Re: Counting people

Post by davsilveira »

Thanks rockedge, that was exactly what I was looking for.
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Counting people

Post by rockedge »

I added the corrected line to the script for the count per day :
set $which_monitor to your monitor id.

Code: Select all

<?php
$which_monitor = 2;
$link = mysqli_connect("localhost", "zmuser", "zmpass", "zm");  

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
} 

if ($result = mysqli_query($link, "SELECT * FROM `Events` WHERE `MonitorId`=$which_monitor AND `StartTime` >= DATE_SUB(CURDATE(), INTERVAL 0 DAY)"))  {

    echo "Total # of Events :".mysqli_num_rows($result);
    
    /* free result set */
    mysqli_free_result($result);
}
?>
Locked