Girish Mahajan (Editor)

Background subtraction

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Background subtraction

Background subtraction, also known as foreground detection, is a technique in the fields of image processing and computer vision wherein an image's foreground is extracted for further processing (object recognition etc.). Generally an image's regions of interest are objects (humans, cars, text etc.) in its foreground. After the stage of image preprocessing (which may include image denoising, post processing like morphology etc.) object localisation is required which may make use of this technique.

Contents

Background subtraction is a widely used approach for detecting moving objects in videos from static cameras. The rationale in the approach is that of detecting the moving objects from the difference between the current frame and a reference frame, often called "background image", or "background model". Background subtraction is mostly done if the image in question is a part of a video stream. Background subtraction provides important cues for numerous applications in computer vision, for example surveillance tracking or human poses estimation.

Background subtraction is generally based on a static background hypothesis which is often not applicable in real environments. With indoor scenes, reflections or animated images on screens lead to background changes. Similarly, due to wind, rain or illumination changes brought by weather, static backgrounds methods have difficulties with outdoor scenes.

Conventional Approaches

A robust background subtraction algorithm should be able to handle lighting changes, repetitive motions from clutter and long-term scene changes. The following analyses make use of the function of V(x,y,t) as a video sequence where t is the time dimension, x and y are the pixel location variables. e.g. V(1,2,3) is the pixel intensity at (1,2) pixel location of the image at t = 3 in the video sequence.

Using frame differencing

A motion detection algorithm begins with the segmentation part where foreground or moving objects are segmented from the background. The simplest way to implement this is to take an image as background and take the frames obtained at the time t, denoted by I(t) to compare with the background image denoted by B. Here using simple arithmetic calculations, we can segment out the objects simply by using image subtraction technique of computer vision meaning for each pixels in I(t), take the pixel value denoted by P[I(t)] and subtract it with the corresponding pixels at the same position on the background image denoted as P[B].

In mathematical equation, it is written as:

P [ F ( t ) ] = P [ I ( t ) ] P [ B ]

The background is assumed to be the frame at time t. This difference image would only show some intensity for the pixel locations which have changed in the two frames. Though we have seemingly removed the background, this approach will only work for cases where all foreground pixels are moving and all background pixels are static. A threshold "Threshold" is put on this difference image to improve the subtraction (see Image thresholding).

| P [ F ( t ) ] P [ F ( t + 1 ) ] | > T h r e s h o l d

This means that the difference image's pixels' intensities are 'thresholded' or filtered on the basis of value of Threshold. The accuracy of this approach is dependent on speed of movement in the scene. Faster movements may require higher thresholds.

Mean filter

For calculating the image containing only the background, a series of preceding images are averaged. For calculating the background image at the instant t,

B ( x , y , t ) = 1 N i = 1 N V ( x , y , t i )

where N is the number of preceding images taken for averaging. This averaging refers to averaging corresponding pixels in the given images. N would depend on the video speed (number of images per second in the video) and the amount of movement in the video. After calculating the background B(x,y,t) we can then subtract it from the image V(x,y,t) at time t=t and threshold it. Thus the foreground is

| V ( x , y , t ) B ( x , y , t ) | > T h

where Th is threshold. Similarly we can also use median instead of mean in the above calculation of B(x,y,t).

Usage of global and time-independent Thresholds (same Th value for all pixels in the image) may limit the accuracy of the above two approaches.

Running Gaussian average

For this method, Wren et al. propose fitting a Gaussian probabilistic density function (pdf) on the most recent n frames. In order to avoid fitting the pdf from scratch at each new frame time t , a running (or on-line cumulative) average is computed.

The pdf of every pixel is characterized by mean μ t and variance σ t 2 . The following is a possible initial condition (assuming that initially every pixel is background):

μ 0 = I 0

σ 0 2 =< some default value >

where I t is the value of the pixel's intensity at time t . In order to initialize variance, we can, for example, use the variance in x and y from a small window around each pixel.

Note that background may change over time (e.g. due to illumination changes or non-static background objects). To accommodate for that change, at every frame t , every pixel's mean and variance must be updated, as follows:

μ t = ρ I t + ( 1 ρ ) μ t 1

σ t 2 = d 2 ρ + ( 1 ρ ) σ t 1 2

d = | ( I t μ t ) |

Where ρ determines the size of the temporal window that is used to fit the pdf (usually ρ = 0.01 ) and d is the Euclidean distance between the mean and the value of the pixel.

We can now classify a pixel as background if its current intensity lies within some confidence interval of its distribution's mean:

| ( I t μ t ) | σ t > k F o r e g r o u n d

| ( I t μ t ) | σ t k B a c k g r o u n d

where the parameter k is a free threshold (usually k = 2.5 ). A larger value for k allows for more dynamic background, while a smaller k increases the probability of a transition from background to foreground due to more subtle changes.

In a variant of the method, a pixel's distribution is only updated if it is classified as background. This is to prevent newly introduced foreground objects from fading into the background. The update formula for the mean is changed accordingly:

μ t = M μ t 1 + ( 1 M ) ( I t ρ + ( 1 ρ ) μ t 1 )

where M = 1 when I t is considered foreground and M = 0 otherwise. So when M = 1 , that is, when the pixel is detected as foreground, the mean will stay the same. As a result, a pixel, once it has become foreground, can only become background again when the intensity value gets close to what it was before turning foreground. This method, however, has several issues: It only works if all pixels are initially background pixels (or foreground pixels are annotated as such). Also, it cannot cope with gradual background changes: If a pixel is categorized as foreground for a too long period of time, the background intensity in that location might have changed (because illumination has changed etc.). As a result, once the foreground object is gone, the new background intensity might not be recognized as such anymore.

Background mixture models

Mixture of Gaussians method approaches by modelling each pixel as a mixture of Gaussians and uses an on-line approximation to update the model. In this technique, it is assumed that every pixel's intensity values in the video can be modeled using a Gaussian mixture model. A simple heuristic determines which intensities are most probably of the background. Then the pixels which do not match to these are called the foreground pixels. Foreground pixels are grouped using 2D connected component analysis.

At any time t, a particular pixel ( x 0 , y 0 )'s history is

X 1 , , X t = { V ( x 0 , y 0 , i ) : 1 i t }

This history is modeled by a mixture of K Gaussian distributions:

P ( X t ) = i = 1 K ω i , t N ( X t μ i , t , Σ i , t )

where

N ( X t μ i t , Σ i , t ) = 1 ( 2 π ) D / 2 1 | Σ i , t | 1 / 2 exp ( 1 2 ( X t μ i , t ) T Σ i , t 1 ( X t μ i , t ) )

First, each pixel is characterized by its intensity in RGB color space. Then probability of observing the current pixel is given by the following formula in the multidimensional case

P ( X t ) = i = 1 K ω i , t η ( X t μ i , t , Σ i , t )

Where the parameters are K is the number of distributions, ω is a weight associated to the ith Gaussian at time t with mean µ and standard deviation Σ .

η ( X t μ i , t , Σ i , t ) = 1 ( 2 / p i ) n / 2 Σ i , t 0.5 exp ( 1 2 ( X t μ i , t ) Σ i , t ( X t μ i , t ) )

Once the parameters initialization is made, a first foreground detection can be made then the parameters are updated. The first B Gaussian distribution which exceeds the threshold T is re-tained for a background distribution

B = a r g m i n ( Σ i 1 B ω i , t > T )

The other distributions are considered to represent a foreground distribution. Then, when the new frame incomes at times t + 1 , a match test is made of each pixel. A pixel matches a Gaussian distribution if the Mahalanobis distance

( ( X t + 1 μ t + 1 ) T Σ i 1 b ( X t + 1 μ t + 1 ) ) 0.5 < k σ i , t

where k is a constant threshold equal to 2.5 .Then, two cases can occur:

Case 1: A match is found with one of the K Gaussians. For the matched component, the update is done as follows

σ i , t + 1 = ( 1 ρ ) σ i , t 2 + ρ ( X x + 1 μ x + 1 ) ( X x + 1 μ x + 1 ) T

Power and Schoonees [3] used the same algorithm to segment the foreground of the image

σ i , t + 1 = ( 1 α ) ω i , t + α P ( k   X t , ϕ )

The essential approximation to P ( k   X t , ϕ ) is given by M k , t

M k , t = 1 ( m a t c h ) , M k , t = 0 ( o t h e r w i s e )

Case 2: No match is found with any of the K Gaussians. In this case, the least probable distribu-tion K is replaced with a new one with parameters

k i . t = l o w P r i o r W e i g h t μ i , t + 1 = X t + 1 k i . t + 1 = L a r g e I n i t i a l W e i g h t

Once the parameter maintenance is made, foreground detection can be made and so on. An on-line K-means approximation is used to update the Gaussians. Numerous improvements of this original method developed by Stauffer and Grimson have been proposed and a complete survey can be found in Bouwmans et al. A standard method of adaptive backgrounding is averaging the images over time, creating a background approximation which is similar to the current static scene except where motion occur.

Surveys

Several surveys which concern categories or sub-categories of models can be found as follows:

  • MOG Background Subtraction
  • Subspace Learning Background Subtraction
  • Statistical Background Subtraction
  • Fuzzy Background Subtraction
  • RPCA Background Subtraction (See Robust principal component analysis for more details)
  • Decomposition into Low-rank plus Additive Matrices for Background/Foreground Separation
  • Traditional and Recent Approaches for Background Subtraction
  • Comparison

    Several comparison/evaluation papers can be found in the literature:

  • A. Sobral, A. Vacavant. "A comprehensive review of background subtraction algorithms evaluated with synthetic and real videos". Computer Vision and Image Understanding, CVIU 2014, 2014.
  • A. Shahbaz, J. Hariyono, K. Jo, "Evaluation of Background Subtraction Algorithms for Video Surveillance", FCV 2015, 2015.
  • Y. Xu, J. Dong, B. Zhang, D. Xu, "Background modeling methods in video analysis: A review and comparative evaluation', CAAI Transactions on Intelligence Technology, pages 43-60, Volume 1, Issue 1, January 2016.
  • Books

    T. Bouwmans, F. Porikli, B. Horferlin, A. Vacavant, Handbook on "Background Modeling and Foreground Detection for Video Surveillance: Traditional and Recent Approaches, Implementations, Benchmarking and Evaluation", CRC Press, Taylor and Francis Group, June 2014. (For more information: http://www.crcpress.com/product/isbn/9781482205374)

    T. Bouwmans, N. Aybat, and E. Zahzah. Handbook on Robust Low-Rank and Sparse Matrix Decomposition: Applications in Image and Video Processing, CRC Press, Taylor and Francis Group, May 2016. (more information: http://www.crcpress.com/product/isbn/9781498724623)

    Journals

  • T. Bouwmans, L. Davis, J. Gonzalez, M. Piccardi, C. Shan, Special Issue on "Background Modeling for Foreground Detection in Real-World Dynamic Scenes", Special Issue in Machine Vision and Applications, July 2014.
  • A. Vacavant, L. Tougne, T. Chateau, "Special section on background models comparison", Computer Vision and Image Understanding, CVIU 2014, May 2014.
  • A. Petrosino, L. Maddalena, T. Bouwmans, Special Issue on "Scene Background Modeling and Initialization", Pattern Recognition Letters, December 2016.
  • Workshops

  • Scene Background Modeling and Initialization (SBMI 2015) Workshop in conjunction with ICIAP 2015. (For more information: http://sbmi2015.na.icar.cnr.it/)
  • IEEE Change Detection Workshop in conjunction with CVPR 2014. (For more information: http://www.changedetection.net/)
  • Workshop on Background Model Challenges (BMC 2012) in conjunction with ACCV 2012. (For more information: http://bmc.iut-auvergne.com/)
  • Contests

  • IEEE Scene Background Modeling Contest (SBMC 2016) in conjunction with ICPR 2016 (For more information: http://pione.dinf.usherbrooke.ca/sbmc2016/)
  • Applications

  • Video Surveillance
  • Optical Motion Capture
  • Human Computer Interaction
  • Content based Video Coding
  • Traffic monitoring
  • Real-time Motion Gesture Recognition
  • References

    Background subtraction Wikipedia