threshold
- Type: Integer
- Range / Valid values: 1 - 2147483647
- Default: 1500
- Option Topic
Threshold for declaring motion. The threshold is the number of changed pixels counted after noise filtering, masking, despeckle, and labelling.
The 'threshold' option is the most important detection setting. When motion runs it compares the current image frame with the previous and counts the number of changed pixels after having processed the image with noise filtering, masking, despeckle and labeling. If more pixels than defined by 'threshold' have changed we assume that we have detected motion. Set the threshold as low as possible so that you get the motion you want detected but large enough so that you do not get detections from noise and plants moving. Note that the larger your frames are, the more pixels you have. So for large picture frame sizes you need a higher threshold.
Use the -s (setup mode) command line option and/or the text_changes config file option to experiment to find the right threshold value. If you do not get small movements detected (see the mouse on the kitchen floor) lower the value. If motion detects too many birds or moving trees, increase the number. Practical values would be from a few hundred to 2000 indoors and 1000-10000 outdoors.
Comments
Maybe there's a option like threshold_max but I don't find it.
I need a threshold max because one of my camera has a bug and changes light sensitivity that causes motion detection of more than half the image.
I have added it to the code (that is well documnented, indented, and more) and it seems to work
506c506
< /* Set threshold value */
>
/* Set threshold values */
507a508
>
cnt->threshold_limit=cnt->conf.min_changes;
692c693
< if (cnt->diffs > cnt->threshold) {
>
if (cnt->diffs > cnt->threshold && cnt->diffs < cnt->threshold_limit) {
732c733
< } else if (cnt->diffs > cnt->threshold) {
>
} else if (cnt->diffs > cnt->threshold && cnt->diffs < cnt->threshold_limit) {
motion-3.2.1/motion.h motion-3.2.1_mh/motion.h
77a78
>
#define DEF_CHANGELIMIT 20000
263a265
>
int threshold_limit;
motion-3.2.1/conf.c motion-3.2.1_mh/conf.c
45a46
>
min_changes: DEF_CHANGELIMIT,
345a347,357
>
copy_int,
>
print_int
>
},
>
{
>
"threshold_limit",
>
"\n############################################################\n"
>
"# Motion Detection Settings:\n"
>
"############################################################\n\n"
>
"# Threshold limit for number of changed pixels in an image that\n"
>
"# triggers motion detection (default: 20000)",
>
CONF_OFFSET(min_changes),
motion-3.2.1/conf.h motion-3.2.1_mh/conf.h
27a28
>
int min_changes;
--
MarcH - 22 Jul 2005
Check the lightswitch option. It can do what you need.
--
JoergWeber - 24 Jul 2005
if there are more cameras, must be placed "threshold" in motion.conf or thread.conf???
--
AntonioChiuchiolo - 04 May 2009
- Please read carefully here :
http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionGuideOneLargeDocument#The_Config_Files
An option that is unique to a camera must be defined in each thread file.
It is often seen that people copy the entire motion.conf into the thread config files and change a few options. This works but it not recommended because it is more difficult to maintain and overview. Keep all the common options in motion.conf and the few unique only in the thread config files.
--
FlorinAnton - 04 May 2009