03. Background Subtraction Tracker - BioroboticsLab/biotracker_core GitHub Wiki

Background Subtraction Tracker

The Background Subtraction Tracker (BST) is a tracker which relies on finding objects by telling them apart from the background. Here background is defined as all the things which do hardly or not at all move. Hence this algorithm is not able to track objects which remain still for a longer period of time. Also it fails to distinguish objects once they are in too close vicinity.


Sample of a tracking situation of two guppies

How detection of moving objects work

The BST detects moving objects in a step-wise manner which can be summarized as: Background Determination, Binarizing, De-noising, Detection

First, the background is determined. Original image A is separated into background B and foreground C.


The foreground is then binarized into absolute black and white as depicted in (A)


De-noising steps

Afterwards, de-noising steps Erosion and Dilation are operated. Erosion (B) reduces the size of every white portion of the image and thus reduces small noise by elimninating the dots entirely. Dilation widens the remaining white portions again which results in larger white objects and closes holes in them, see (C). The dilated image is then used to detect objects by fitting ellipses around the largest white blobs. Objects are recognized to be the same as in the previous image by euclidian distance.

Defining detection parameters


The user interface (Parameter View) of the Background Subtraction Tracker

  1. Threshold for binarizing into black and white, where 0 is black and 255 is white. Here everything above 15 will be white.
  2. Size of denoising in pixels. For low noise and low resolution low values are recommended, higher ones otherwise.
  3. See (2). Usually chose the same as (2).
  4. The rate at how fast the new images merge into the background. "New Background" = (1 - alpha) * "Old Background" + alpha * "Next Image".
  5. Minimum size for an object (in a connected area of pixels) to be acknowledged as an object.
  6. Maximum size according to (5).
  7. Select a certain picture to be displayed. Each step of detection described in this guide can be viewed live. Use this to check on your choice of parameters.
  8. Resets the background to the current input image. This makes foreground equal to background.
⚠️ **GitHub.com Fallback** ⚠️