Clarification of using percentages when working with zones?

Support and queries relating to all previous versions of ZoneMinder
Locked
User avatar
MJN
Posts: 251
Joined: Wed Jan 17, 2007 10:29 am
Location: Wiltshire, UK

Clarification of using percentages when working with zones?

Post by MJN »

Firstly, may I take this opportunity to say what an amazing application ZoneMinder is - thanks to the Dapper Wiki guide I was up-and-running in only a couple hours (hey, that's quick for me!). Indeed, within a day it had achieved its initial intention and caught a perpetrator in the act and gave me the evidence I was after...

...in this case it was nothing more exciting than working out which cat from the street was coming in and nicking our cat's food but, hey, it's a start! :D

I'm still getting to grips with tweaking the settings to my needs and have a couple of questions that I've been unable to find the answers to:

1) Let's say I've got two active zones defined, one covering 50% of the frame and the other covering 5%. If my zone 'units' are percentages am I right in thinking that if I had the Min Alarmed Area set to, say, 8% that any movement within the smaller zone, however large, would never trigger an alarm? From what I understood by reading the documentation the use of percentages for this particular setting is referring to percentages of the whole frame and not the zone itself? To put it another way; given the zone is only 5% of the frame it could never generate enough altered pixels to reach the 8% minimum I've specified?

2) I currently have ZM_CREATE_ANALYSIS_IMAGES enabled and from reading the help for this setting it says 'during an alarm ZoneMinder records both the raw captured image and one that has been analysed and had areas where motion was detected outlined'. However, looking in my event folders I am finding raw pre/post-alarm images and motion-outlined alarm images - I was expecting to also find raw alarm images too given the help description?

Please bear with me during my steep learning curve - hopefully with persistance it won't be too long before I will be in a position to give something back...

Cheers,

Mathew
User avatar
MJN
Posts: 251
Joined: Wed Jan 17, 2007 10:29 am
Location: Wiltshire, UK

Re: Clarification of using percentages when working with zon

Post by MJN »

MJN wrote:2) I currently have ZM_CREATE_ANALYSIS_IMAGES enabled and from reading the help for this setting it says 'during an alarm ZoneMinder records both the raw captured image and one that has been analysed and had areas where motion was detected outlined'. However, looking in my event folders I am finding raw pre/post-alarm images and motion-outlined alarm images - I was expecting to also find raw alarm images too given the help description?
Aha... Error on my part here. Somehow I'd managed to move from Blobs to AlarmedPixels (think maybe it was the Fast preset that did it) and so motion-outlined images are not provided... hence the lack of them in my events folders. Now back to running on Blobs and I've got seperate ###-analyse.jpg and ###-capture.jpg alarm images.

Still unsure about the zone percentages if anyone can shed any light? Indeed, anyone got any good advice regarding these settings? I've read the docs and help hints and whilst they are good unfortunately I'm not so I'm sticking with the presets for now (which I must admit are working well).

Can't wait to move on from spying on my cats though... the novelty of being sent an SMS every time one of them goes through the kitchen is starting to wear off! :wink:

Mathew
jamescollings
Posts: 59
Joined: Wed Nov 22, 2006 11:26 am
Location: Bucks, UK

Post by jamescollings »

Still unsure about the zone percentages if anyone can shed any light? Indeed, anyone got any good advice regarding these settings?

The zone is calculated to consist of a number of pixels. The percentage relates to THIS number of pixels (Not of the whole image). So if you had a zone that covered 5% of a 320x240 image, then that zone would be 3840 pixels in size. If you set your min alarm pixel threshold to 8%, then you would need 308 pixels to be in an alarm state before a full Zone alarm will be caused.

My method of fine tuning zones is this:
Set each zone to be really sensitive (the presets help here). Let the monitor run until you have around 100 events. Log in to the SQL database and dump out the contents of Stats and Events (select * from Events; and select * from Stats;). I then feed these into an Excel spreadsheet, and by using some formulas I can tweak my zone settings to see what the impact would have been of raising thresholds. This way, you can see if you would have missed any REAL events by having less sensitive settings on some zones.

Its just my way... but it seems to work. It also allows me to see if any zones are too large/wrong shape. If there is no way of trimming a zone to ignore the falsies, then I check the images to see WHERE the false alarms eminate from (patch of sun flashing in a particular part of the zone).
User avatar
MJN
Posts: 251
Joined: Wed Jan 17, 2007 10:29 am
Location: Wiltshire, UK

Post by MJN »

jamescollings wrote:The zone is calculated to consist of a number of pixels. The percentage relates to THIS number of pixels (Not of the whole image). So if you had a zone that covered 5% of a 320x240 image, then that zone would be 3840 pixels in size. If you set your min alarm pixel threshold to 8%, then you would need 308 pixels to be in an alarm state before a full Zone alarm will be caused.
That's what I thought (and hoped) however the documentation seems to suggest otherwise:

Units - This setting which details whether certain of the following settings are in Pixels or Percent, where ‘Percent’ refers to a percentage area of the zone itself.

Okay, that's fine - percentages are definitely of the zone rather than the whole frame, however:

Min/Maximum Alarmed Area - The following two settings define the minimum and maximum number of pixels that exceed this threshold that would cause an alarm. If the units are Percent this (and following options) refers to the percentage of the frame and not the zone, this is so these values can be related between zones.

Can you see where my confusion is coming from?

Notwithstanding the above thanks for the ideas regarding further analysis of recorded stats - I'll rack up some more events and give that a try.

Mathew
Last edited by MJN on Fri Jan 19, 2007 7:27 pm, edited 2 times in total.
jamescollings
Posts: 59
Joined: Wed Nov 22, 2006 11:26 am
Location: Bucks, UK

Post by jamescollings »

MJN wrote:That's what I thought (and hoped) however the documentation seems to suggest otherwise:
[/i]Can you see where my confusion is coming from?
Ok.. I checked the contents of the MySQL database and the Zones table.
I'll choose one at random (and show the relevent columns)

Id,MonitorId,Name,Type,Units,Area,MinPixelThreshold,MaxPixelThreshold,MinAlarmPixels,MaxAlarmPixels
2,1,Garage,Active,Percent,22004,50,NULL,1760,15402

Now although it says that the MinAlarmPixels is 1760 and the MaxAlarmPixels is 15402... I actually entered the values 8% and 70%. Those percentages of the AREA produce the values shown in the extract of the database above. The picture image is a 240x320, I if THAT were to be used (for the percentages) then I'd see 2% and 20% in the zone definition screen (and I don't).

I guess the documentation is wrong?
User avatar
MJN
Posts: 251
Joined: Wed Jan 17, 2007 10:29 am
Location: Wiltshire, UK

Post by MJN »

Thanks for that James - most helpful.

I'm glad it is percentages of the zone as I'm finding it much easier to work in percentages when visualising a particular zone, particularly as I'm likely to require settings sufficient to ignore my cats. And I've never measured my cat in pixels.... ;)

The second line from the docs seem pretty clear though, even explaining the rationale behind the idea. :?

Of course, if I was working in pixels then it does of course make sense that we'd be talking in absolute terms which by definition is not zone/frame dependent.

Thanks again for your help.

Mathew
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

I will go check the docs and see if I can work out what I was talking about :lol:

I am thinking of putting the README on the Wiki so it can be edited directly when mistakes are found.
Phil
User avatar
MJN
Posts: 251
Joined: Wed Jan 17, 2007 10:29 am
Location: Wiltshire, UK

Post by MJN »

zoneminder wrote:I will go check the docs and see if I can work out what I was talking about :lol:
This will hopefully make things a little easier...

I happened to be reading through the changelogs and found that back in v1.19.0 the percentage control was changed from 'of image' to 'of zone':

'Zone Percentage Sizes. Zone motion detection parameters can be defined either in terms of total pixels or as a percentage. This percentage was defined relative to the size of the image as a whole. However this was difficult to calculate or estimate especially with several zones of varying sizes. In version 1.19.0 this has been changed so that the percentage relates to the size of the zone itself instead. This should make calculations somewhat easier.'

So just a case of the docs not keeping up with the package (very common situation I'm sure!). :)

Mathew
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Thanks for posting that. That makes things nice and simple :lol:
Phil
Locked