Jump to content

SwisTrack/Components/AdaptiveBackgroundSubtractionGray

From Wikibooks, open books for an open world

Description

[edit | edit source]

This component subtracts a background image from the input image. If the camera is fixed, only the objects added to the scene remain after this subtraction. However, changing light condition or camera noise can also produce a difference between the two images. Subtracting the average intensity of the two images makes the system more robust towards changing light conditions.

This method doesn't need a background image file, as it approximates the background from the prior frames. However, depending on the configuration, moving objects tend to leave a trail behind them, or disappear if they stay too long at the same place.

Optionally, this component allows you to take the current image as background image, simply by clicking on a button. This comes in handy if you are changing your experimental setup in an ad hoc fashion (but not during one experiment), and avoid the overhead of saving the background image to a file. In this case, it is advised to set the update rate to zero.

Most of the time, a threshold is applied after this method, to separate the background from the tracked objects.

Input

[edit | edit source]

A grayscale image.

Output

[edit | edit source]

A grayscale image.

Parameters

[edit | edit source]

Correct mean

[edit | edit source]

Specifies whether to correct the average intensity value of the input image with the average intensity value of the background image. This option makes the tracking less sensitive to varying light conditions.

The subtraction mode:

  • Abs(I - B) calculates the absolute difference between the input image and the background image. This will cause moving objects to leave a trail behind them.
  • Truncate(I - B, 0..255) subtracts the background image from the input image and sets all negative values to zero. This will cause bright moving objects to slightly fade out towards where they are coming from. Dark moving objects will not be visible, but their trail will.
  • Truncate(B - I, 0..255) is similar, but subtracts the input image from the background. This inverts the behavior for bright and dark moving objects.

Update rate

[edit | edit source]

The background image is continuously updated with the update image following the following equation:

Therefore, increasing the proportion makes the update of the background more reactive, but will remove object moving slowly.

Reset background image

[edit | edit source]

Takes the next frame as background image, i.e.

instead of updating it. This is useful if you changed the environment significantly.