IMBS Background Subtraction Library - Old code

Domenico Daniele Bloisi

WARNING. This is the old page for IMBS. A new version of IMBS is available here

Independent Multimodal Background Subtraction (IMBS) Library is a C++ library designed for performing an accurate foreground extraction in real-time. IMBS creates a multimodal model of the background in order to deal with illumination changes, camera jitter, movements of small background elements, and changes in the background geometry. A statistical analysis of the frames in input is performed to obtain the background model. Bootstrap is required in order to build the initial background model. IMBS exploits OpenCV and cvBlobsLib libraries.


A detailed description of the IMBS method can be found in the paper "Independent Multimodal Background Subtraction" (draft) in the proceedings of Computational Modeling of Objects Presented in Images: Fundamentals, Methods, and Applications (CompImage) 2012


IMBS is available as executable file both for Linux ( and Windows (

Source code (Eclipse Makefile Project with MinGW compiler) can be downloaded here.

IMBS is provided without any warranty about its usability. It is for educational purposes and should be regarded as such.

IMBS Prerequisites


For running IMBS on Linux

  • ./imbs [options]

For running IMBS on Windows

  • imbs.exe [options]

IMBS Options

  • -img <first image name>: input from a list of images.
    Notice that <first image name> must be in the form of "img%d.jpg" where "%d" is the image number (e.g., "img000.jpg").

  • -vid <filename>: input from video files (e.g., .avi files)

  • -fps <fps value>: set the fps value (default value 25)

  • -out <filename>: save the foreground images as a video

  • -savefg <path>: save the current foreground image in <path>

  • -slow: process one frame and wait

  • -nogui: no graphical user interface will be shown

  • -verbose

  • -th <foreground threshold>: default value 6

  • -bw <histogram bin width>: default value 5

  • -p <sampling period in ms>: default value 1000

  • -d <minimal bin height>: default value 2

  • -n <number of samples>: default value 30

  • -loadbg <filename>: load the prebuilt background model

  • -savebg <filename>: save the initial background model

  • -alpha <value>:shadow suppression parameter alpha (default value 0.75)

  • -beta <value>:shadow suppression parameter beta(default value 1.15)

  • -tau_s <value>:shadow suppression parameter tau_s (default value 30)

  • -tau_h <value>:shadow suppression parameter tau_h (default value 20)

  • -area <value>:filter out the observations smaller than <value> (default value 100)

  • -h: print help information

Examples of use

  • imbs -verbose

    • receive input from the camera connected to the pc (if any) and print log data to standard output.

  • imbs -img images/000.jpg -fps 7

    • use a set of images as input, with "images/000.jpg" as the first image and assume a frame rate equal to 7 fps (the default value is 25 fps).

  • imbs -vid video.avi -out fg.mp4

    • use "video.avi" as input and save the foreground images as an .mp4 video file.

  • imbs -vid video.avi -savebg bg.txt

    • use "video.avi" as input and save the initial background model as text file "bg.txt"

  • imbs -vid video.avi -loadbg bg.txt

    • use "video.avi" as input and use the file "bg.txt" as the initial background model (to avoid bootstrap).
  • imbs -img images/frame_0000.png -savefg results

    • use a set of images as input, with "images/frame_0000.png" as the first image, assume a frame rate equal to 25 fps (default value),
      and save the foreground images in the folder "results".

IMBS Results

IMBS has been tested on a series of publicly available video sequences. The following videos contain the results obtained using both IMBS and the OpenCV's function cvCreateGaussianBGModel

All the five videos have been created using OpenCV video codec FourCC('D','I','V','X') in AVI file container.

DivX codec can be downloaded from

The files can be viewed with VideoLAN VLC media player (


IMBS has been written by Domenico Daniele Bloisi.

The author thanks Dr. Loris Bazzani for the useful discussion.