
Background subtraction
This tool automatically extracts background image from multiple images or a video sequence and separates foreground layer from the background image. One example is shown here.Source images:

Extracted background image:

- In the following dialog, you can select input images either from video frames or from a folder with specified extension or you can choose the files directly from a file open dialog.

- If the background image is given (for example, you have extracted it previously), check the "Known Background" option; otherwise, uncheck the option and the background image will be generated.
- You can save the subtracted foreground images into a folder or a video sequence.
- You can choose from median or mode based algorithm, which are two basic algorithms for background extraction. Let's consider a sequence of pixels at the same location of each frame. These two algorithms choose the median or the mode of this sequence as the background color at this pixel location.
- The difference threshold is critical for background subtraction. If the difference between a pixel's intensity (of each channel) and the corresponding background intensity (of each channel) is larger than the threshold, the algorithm considers it as a foreground pixel. A larger difference threshold results in fewer foreground pixels.
- You can apply median filter to the foreground pixels to remove noises. To disable this feature, set the size of the median filter to 1.
- You can apply a dilation operation to fill in small holes on the foreground layer.
- VIPBase extracts Connected Components (CC) instead of pixels on the foreground layer. You can change settings of the CC detection algorithm by clicking the "Foreground component settings" button. The following dialog will show up.

- The connectivity option specifies how many neighbor pixels need to be considered when searching for a CC.
- The background color option tells the algorithm what the background color is. By default it is black.
- There are two thresholds. The first one sets the lower limit on the number of foreground pixels contained in a CC so that small components will be discarded. The second on sets the upper limit on the number of detected CC. If the video contains only one moving object, set this number to 1; otherwise set a larger number.
- You can use the original color for background pixels or replace them with a solid color, e.g. a white background layer.
- You can overlay a colored layer onto the foreground layer. The transparency value is the transparency of this colored layer. Therefore, if it is 1, the colored layer is totally transparent and thus invisible. If it is 0, the foreground pixels are completely replaced with the solid color. Results using different settings of the background and the foreground layer are shown as follows.

![]() |
VIPBase © 2006 Fengjun Lv |
Last update: 08/01/2006 (check html) |
