mask_file

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: Not defined
  • Option Topic

PGM file to use as a sensitivity mask. This picture MUST have the same width and height as the frames being captured and be in binary format.

Full path of the PGM (portable gray map) mask file (binary format).

If you have one or more areas of the camera image in which you do NOT want motion detected (e.g. a tree that moves in the wind or a corner of the picture where you can see cars/pedestrians passing by) you need a mask file. This file is a picture that you create in your favorite photo editing program. The areas that you want detected must be white. The error that you want ignored must be black. The pgm image must be the same size (number of pixels high and wide) as the pictures that are taken by the camera (video4linux device).

You can adjust sensitivity by using gray tones.

If you do not have a mask file disable this option by not having it in the config file or comment it out ("#"or ";" as first character in line). If you are using the rotate option, note that the mask is applied after the rotation.

Detailed Description

The mask file must be a pgm format image file (portable gray map). Note that you must choose the BINARY format.

The feature is simple. Create an image of exact the same size as the ones you get from your video device (camera). Make a purely white picture and paint the areas that you want to mask out black. You can also make gray areas where you want to lower the sensitivity to motion. Normally you will stick to pure black and white.

One easy method for generating the mask file is as follows.

You can just take a motion captured picture, edit it with black and white for the mask and save it as a pgm file. If you cannot save in this format save as a grayscale jpg and then you can convert it to pgm format with

djpeg -grayscale -pnm [inputfile] > mask.pgm

(assuming you have djpeg installed - part of the jpeg lib package).

Note that the mask file option masks off the detection of motion. The entire picture is still shown on the picture. This means that you cannot use the feature to mask off an area that you do not want people to see.

Below are an example of a webcam picture and a mask file to prevent the detection cars in the street.

Normal picture. Notice the street is visible through the hedge.

normal.jpg

Mask file (converted to png format so it can be shown by your web browser)

mask1.png

Comments


This same mask feature can be used to mask off individual pixels of unimportant motion. For example, any edge will typically show some noise. Leaves moving in the wind cause noise, but only at the edges of the leaves. You may not want to mask off the entire area.

In the above example, it would be best to mask off the space between the stems of the hedge (the street), but leave the hedge itself unmasked.

A program "makemask" is available to make masks like this.

-- JonZeeff - 29 Sep 2008


ConfigOptionForm edit

Option mask_file
Type String
Range Max 4095 characters
Default Not defined
Description PGM file to use as a sensitivity mask. This picture MUST have the same width and height as the frames being captured and be in binary format.
Group Motion Detection Settings
Topic revision: r5 - 29 Sep 2008 - 14:40:48 - JonZeeff
 
Motion - Config Option Mask File
Copyright © 1999-2010 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.