Page 1 of 1

Day/night detection...

Posted: Thu Oct 27, 2016 6:53 am
by Tantamount
So I've been using cron jobs to change from day to night mode in ZM. This works well up to a point -- it doesn't take into consideration things like rain, clouds, or fog and their effects on the brightness of the shot.

What I'm interested in doing instead is taking advantage of the camera's built-in ability to switch between day and night mode. In particular, I'm wondering if it is possible to detect when captured video goes from color to b/w and use that as the trigger to switch modes in ZM. Is there any place in the code that could get this information without much/any cpu cost?

Re: Day/night detection...

Posted: Fri Oct 28, 2016 7:29 am
by Christo
Hello Tantamount,

With the use of imagemagick, it is possible to analyse the images on color within a camera stream. (identify -format %k)
Depending on the calculated color quantity, you'll know if the camera is disconnected.. bluemuted or low on IR etc.
see topic: Blue Mute detection

Furthermore ill suggest Sunwait for a more acurate switch to nighttime mode.
Because of changing weather conditions ill use a brightness calculation sequence.
see topic: Brightness Control

Success and regards,

Re: Day/night detection...

Posted: Sat Oct 29, 2016 7:52 am
by Tantamount

I think a more efficient method of detecting Blue Mute would be to get the current FPS of the monitor -- I've noticed that when a monitor is blue muted, the FPS increases tremendously. A check for FPS > 40 should work nicely. I'm just not sure how to get ZM to report the real-time FPS of the monitor -- the API doesn't seem to provide this information.

I've been using sunwait (that's how my cron jobs know when to change from day to night), however, it doesn't account for things like fog or dark clouds. If I understand what you're suggesting, I should continue to use sunwait so that I'm at least "close" to when the camera will toggle from color to b&W, and then start polling the monitors for images at some interval... then I just need to feed these images into imagemagik to tell me when the color mode has triggered.

How are you grabbing the real-time images from your monitors? Can this be done from the API?

Re: Day/night detection...

Posted: Tue Nov 08, 2016 11:09 am
by Christo
Sorry to keep you waiting:)

This is how it's done:
wget -O $LOGDIRIMG/Monitor_$CNT.jpg "$HOST:$PORT/cgi-bin/nph-zms?mode=single&monitor=$CNT&scale=100&user=$ZMUSER&pass=$ZMPASS"

(make sure that the above user is authorized for viewing these monitors)

Or.. use the ZoneMinder Capture deamon options (zmc deamon)!!

see: ... zmc.8.html

Re: Day/night detection...

Posted: Tue Nov 08, 2016 11:14 am
by Christo