motioneye icon indicating copy to clipboard operation
motioneye copied to clipboard

Changing threshold reference

Open atar-axis opened this issue 5 years ago • 2 comments

Hi there! First of all: thank you very much for your hard work in this project, I really appreciate it!

My "issue" is the following:

In MotionEye the Frame Change Threshold is refering to width*height of the image, so to the total pixels count - right? I guess this is the line in question: https://github.com/ccrisan/motioneye/blob/c918ced0b3b51c3b9601afec56b526c11ae621c2/motioneye/config.py#L811

The original threshold value in motion is defined as following:

Threshold for declaring motion. The threshold is the number of changed pixels counted after noise filtering, masking, despeckle, and labelling.

So on MotionEye, the value refers to the original image and on motion the value refers to the already filtered and masked one. Thats really not very intuitive in my eyes and may lead to confusion since the tooltip does not note if the value refers to the image before or after masking, ... It does not matter in pixels, but it does in percentage.

What I would propose:

I would change the order of the elements in Motion detection and group them into preprocessing (i.e. noise, mask, despeckle) and detection. In the latter I would change the Frame Change Threshold to the original threshold logic and name it threshold minimum (px) and the other one threshold maximum (px). In the tooltip I would make clear that this value refers to the already preprocessed image

What do you think? If this is something you are interested in, then I would make a PR.

atar-axis avatar Aug 21 '20 09:08 atar-axis

Furthermore, if you change the setting to 0.0%, then the threshold is 0 - which is not within the valid range, right?

Range / Valid values: 1 - 2147483647

atar-axis avatar Aug 21 '20 12:08 atar-axis

@MichaIng can you comment on this one? I noticed if I set 0.0% in the UI then it doesn't seem to trigger motion alerts at all. Is it a bug? And I also have the same question about whether discrepancy in how motion defines Threshold vs how MotionEye does. If there's no discrepancy, I agree with above suggestion to better communicate to the user

lowlyocean avatar Sep 14 '22 15:09 lowlyocean