Further discussion about dealing with fog/vehicle lights at night...

Forum for questions and support relating to the 1.30.x releases only.
Locked
Tantamount
Posts: 76
Joined: Wed Feb 03, 2016 7:51 am

Further discussion about dealing with fog/vehicle lights at night...

Post by Tantamount »

In a previous response from knnniggett (thank you btw), this list was given as one recommended way to set up a camera for outdoor use. I wanted to discuss this further in its own thread since I had already done all of these steps previous to this list being posted.
knnniggett wrote:1) Delete all the preclusive zones. Do not advance w/o first doing this.
2) Read the documentation regarding run states. Your goal will be to set up two run states. One for day and the other for night.
3) With your run state in the "day" run state, tune your motion zone(s) for the day. I recommend you start with just one zone. Intentionally make the zone more sensitive than you need so you can see the motion statistics. Then gradually adjust the zone configuration to be less sensitive.
4) With the system in the "Night" run state, tune your motion zone(s) for the night. I recommend you start with just one zone. Intentionally make the zone more sensitive than you need so you can see the motion statistics. Then gradually adjust the zone configuration to be less sensitive. This zone is expected to be less sensitive than the "day" run state.
5) Instead of using preclusive zones, use the Max Alarm/Filtered/Blob fields to ignore events that are too big since they are likely to be headlights. Keep in mind that, if a car pulls into your driveway at night, then zoneminder will likely not record it as motion if you are using the Max Alarm/Filtered/Blob fields. A preclusive zone will have the same problem. At night, anything large that moves into your active motion zones could get ignored because, with the headlights on, it will have tripped a preclusive zone.
My system is currently configured for a "sunrise/sunset" configuration. This is done through two cron jobs running under the apache user:

Code: Select all

0 01 * * * /usr/local/bin/zm-sun.sh sunrise
0 13 * * * /usr/local/bin/zm-sun.sh sunset
Here's the script -- I think I got it from someone here? I have slightly modified it:

Code: Select all

#!/bin/bash

# script to start / stop ZoneMinder based on sunrise / sunset
#
# usage:
# zm-sun.sh sunrise
# zm-sun.sh sunset


if [[ "$1" == "sunrise" ]]
  then
    /usr/local/bin/sunwait sun up -00:30:00 00.000000N 000.000000W ; /usr/bin/zmpkg.pl 'sunrise'
    curl -XPUT -k https://127.0.0.1/zm/api/monitors/1.json -d "Monitor[AlarmFrameCount]=1"
    curl -XPUT -k https://127.0.0.1/zm/api/monitors/2.json -d "Monitor[AlarmFrameCount]=1"
    curl -XPUT -k https://127.0.0.1/zm/api/monitors/3.json -d "Monitor[AlarmFrameCount]=1"
    curl -XPUT -k https://127.0.0.1/zm/api/monitors/4.json -d "Monitor[AlarmFrameCount]=1"
    curl -XPUT -k https://127.0.0.1/zm/api/monitors/5.json -d "Monitor[AlarmFrameCount]=1"
    curl -XPUT -k https://127.0.0.1/zm/api/monitors/6.json -d "Monitor[AlarmFrameCount]=1"
elif [[ "$1" == "sunset" ]]
  then
    /usr/local/bin/sunwait sun down +00:30:00 00.000000N 000.000000W ; /usr/bin/zmpkg.pl 'sunset'
    curl -XPUT -k https://127.0.0.1/zm/api/monitors/1.json -d "Monitor[AlarmFrameCount]=2"
    curl -XPUT -k https://127.0.0.1/zm/api/monitors/2.json -d "Monitor[AlarmFrameCount]=2"
    curl -XPUT -k https://127.0.0.1/zm/api/monitors/3.json -d "Monitor[AlarmFrameCount]=2"
    curl -XPUT -k https://127.0.0.1/zm/api/monitors/4.json -d "Monitor[AlarmFrameCount]=2"
    curl -XPUT -k https://127.0.0.1/zm/api/monitors/5.json -d "Monitor[AlarmFrameCount]=2"
    curl -XPUT -k https://127.0.0.1/zm/api/monitors/6.json -d "Monitor[AlarmFrameCount]=2"
fi

echo [`date`] Zoneminder $1 >> /var/log/zoneminder/sunwait.log

exit
When the script runs, sunwait is called and will halt the script and wait until the sun has risen or fallen depending on the Earth coordinates given. (I've wiped my real coordinates from the example above). Once sunwait determines that the sun has risen or fallen, it will change the zone and then execute the rest of the code in the script and finally exit. The extra code was one workaround that works best for me for night video outside -- most false positives can be omitted just by setting the alarm frame count to a number higher than 1.

Now, as part of how I originally set this up, I had assumed each "run state" of zoneminder could have its own unique zones defined for each camera. Day time has to deal with fog and clouds, and night time has to deal with headlights sweeping across places, and neighbor's overly sensitive motion lights. I had found it easier to adjust the number and size/shape of the zones to deal with these situations.

I discovered however, that zoneminder did not support different zones per state: ( viewtopic.php?f=34&t=24305&p=92854#p92854 ).

In the instructions above (#3 and #4), it sounds like zone settings are adjustable by run state now. Have things changed since February?

As for #5, I was wondering if it is now possible to use the API to query each event for their alarmed frames and from each of these frames, the statistical information. What I'd like to do is crank the sensitivity up on my zones, let them run for a few days, manually go through the events and "archive" the positives (as a way to separate the good from the bad), and finally write something to retrieve the stats, first going through the archives to find the numbers of what I want to use to trigger the zones, and finally going through the rest to see what min/max settings I can apply to safely not trigger the zones. Has anyone already attempted this?
3 ReoLink RLC-410
2 Annke NC800
Kubernetes 1.22.6 statefulset of 5 Ubuntu 20.04 pods using iconnor's repository
ZoneMinder Version 1.36.12
mikb
Posts: 604
Joined: Mon Mar 25, 2013 12:34 pm

Re: Further discussion about dealing with fog/vehicle lights at night...

Post by mikb »

Just a guess: Step #3 and #4 may intend to refer to setting up two different ZM "cameras" (with their own zones and settings), both fed from the same physical (wired/ip/usb) camera. You then have camera-A enabled and camera-B disabled and vice versa in the two run states.
Locked