How To Achieve Effective Motion Detection

SecuritySpy’s motion detection algorithm employs many techniques in order to accurately detect real motion events while minimising the rate of false-positive detections. But besides an effective algorithm, there are many choices about the setup and configuration of your video surveillance system that will help achieve reliable motion detection – these are outlined below.

1. Camera Angle

How you position and point the camera, as well as the focal length of the lens (how wide-angle it is) makes a big difference to the effectiveness of motion detection. The key points to consider are as follows:

  • The activity you want to capture should be relatively large in the frame. Don’t use a camera with a very wide-angle lens, as this will make objects and people appear very small – too small to trigger motion detection or make out any important features such as faces.
  • Point the camera downwards and don’t include any sky in the frame. At certain times of the day the sun may glare into the camera which would impair the its ability to render the scene with good enough definition, and may even damage its sensor.
  • Include just the area you want to capture in the frame; don’t include any irrelevant areas as this simply wastes the resolution of your camera.

Here is an example of a bad camera angle for motion detection:

Bad Camera Angle

Bad Camera Angle For Motion Detection

This is bad because: 1. the lens is too wide-angle, so the details of the cars are difficult to make out, let alone people; 2. lots of sky is included; and 3. unless you want to capture boats, the large area of water on the left is irrelevant wasted pixels.

Here is an example of a good camera angle for motion detection:

Good Camera Angle

Good Camera Angle For Motion Detection

This is good because the lens has the perfect length to focus on the area under surveillance, so that the people are large enough in the frame both for effective triggering of motion detection and for distinguishing facial features.

2. Mounting

It is vital that the camera itself does not move, as this would significantly compromised the effectiveness of motion detection. Make sure to mount the camera securely, using a sturdy bracket, on a fixed object such as a building. Avoid mounting cameras on trees or flimsy poles that can move in the wind.

3. Lighting

In low-light conditions, the camera may produce a significant amount of noise. This is because there is less light falling on each pixel in the image sensor, so the camera has to boost the signal from the sensor in order to produce a bright enough image, which also boosts the noise. Here is what this noise looks like – this is an enhanced crop of an image that shows a road at night:

Noisy Image

Noisy Image

SecuritySpy’s motion detection algorithm detects and accounts for such noise, in order to prevent it from triggering motion detection. It calculates the average amount of noise present in each pixel, and uses this to set a threshold above which to consider a change in the pixel intensity as “real” motion. Therefore, if the image is very noisy, this threshold is high, and it will take a lot more movement than normal to trigger motion detection. This results in real events being less likely to be detected (i.e. false negatives).

The solution is to install better lighting for the scene you want to capture – either visible or infra-red (if your camera is IR-sensitive).

Many cameras have built-in infrared LEDs for night vision. These work fine in limited circumstances, however they are typically not very effective beyond a few meters. They also have a further disadvantage when used outdoors in that they tend to attract insects, which fly around the camera, brightly lit by the IR light, triggering motion detection. You will get far better results if you use separate IR illuminators, which are typically much more powerful.

Infrared Illuminator

Infrared Illuminator

 

 4. Compression Settings

Video from IP cameras is compressed in one of three formats: JPEG, MPEG-4 or H.264. With the right compression settings, these formats can provide very high quality, but with the wrong compression settings they can cause unacceptable image degradation. Here is an example of an image with noticeable compression artefacts from low-quality H.264 compression, cropped and enhanced:

Bad Compression Artefacts

Bad Compression Artefacts

There will be a number of parameters that you can set in your network camera in order to control the quality of the image produced:

  • CBR vs. VBR [MPEG-4 and H.264]: CBR (Constant Bit Rate) compression produces a fixed amount of data per second, and tends to be what most cameras are set to by default. In this mode, the camera will increase and decrease its compression quality as required, in order to maintain this fixed bit rate. For complex scenes with a lot of movement, which would otherwise need more bits to encode accurately, this can result in the camera reducing its compression quality to unacceptable levels, thereby introducing the kind of artefacts shown above. VBR (Variable Bit Rate) is a much better mode to use as it does not suffer from this problem; after all we don’t really care about the precise bit rate produced by the camera, we just want good quality video. With VBR, the compressor will simply use more bits as required, in order to encode the scene accurately.
  • I-frame rate / GOV Length / Key frame rate [MPEG-4 and H.264]: this specifies how often the video stream contains I-frames, which are self-contained frames that encode the entire image. Between I-frames there are multiple P-frames (delta frames), which contain only the changes in the image since the last frame. A good value for this setting is to have an I-frame every 2 seconds or so (so if the frame rate is 10fps then an I-frame rate of 20 is good).
  • Quality setting [all formats]: this is as simple as it sounds: the higher this setting, the higher visual quality you are going to get (at the expense of larger files of course). Typically a medium-to-high value, or 60 on a 1-100 scale, will give good results, though this does vary between cameras so you may have to experiment a bit.

5. Frame Rate

Low frame rates will impair SecuritySpy’s ability to detect motion. The algorithm works best at around 10fps, but in general you should use a frame rate of at least 5fps for effective motion detection.

6. Masking

In SecuritySpy you can specify a mask in order to ignore certain parts of the video image for motion detection; this can be an effective way to reduce false-positive detections. Typically you will want to mask out objects that move in the wind (e.g. trees and plants), or areas of the image where you are not interested in detecting motion. However, make sure that you do not mask out more of the frame than necessary – the algorithm works best when it has plenty of pixels to work with. Here is an example of effective masking to ignore the road and the tree on the right side of the frame:

 

Cyclist - Original

Original

Cyclist - With Mask

With Mask

7. Trigger Time

In the Setup section of the Camera Settings window in SecuritySpy, there is a trigger time setting. This specifies the minimum duration of continuous motion that will cause a motion detection trigger. By default this is 1 second, and you should not reduce this unless you have good reason to do so. Real motion (e.g. a person walking) is continuous movement that will typically last significantly longer than one second and hence will be detected, whereas many types of false motion (e.g. leaves blowing in the wind or snow falling close to the camera) exhibits a staccato start-stop-start-stop pattern, which will be effectively filtered out by this feature. If your camera angle is sufficiently wide so that the motion you want to capture lasts much longer than one second, then you may want to increase the trigger time for more effective rejection of false motion, if you are finding this a problem.

Leave a Reply

Your email address will not be published. Required fields are marked *