Mask for motion

If you get a lot of false positives from the motion detection with your webcam or raspicam you should consider masking out the susceptible parts (busy streets, moving leaves etc.).

Simply take a false positive frame from your motion setup e.g. with VLC -> Video -> Snapshot. The mask must have exactly the same size as the image:


Select the area where the motion should be masked out, fill it with black, invert the selection and fill the rest white. Save as jpeg and convert to pgm with imagemagick

or a jpeg-to-pgm converter.


Now you can transfer the mask via scp or directly download the pgm file with:

and add the mask in your motion config file by:

and adjusting the mask_file path as follows:

# PGM file to use as a sensitivity mask.
# Full path name to. (Default: not defined)
mask_file /home/motion/mask.pgm

Finally restart the motion daemon:

and you should get a lot less false positive motion detections.

War dieser Beitrag hilfreich?
[Gesamt:4    Durchschnitt: 4.5/5]