bgslibrary

A Background Subtraction Library

BGSLibrary

A Background Subtraction Library

Last Page Update: 26/04/2014

Latest Library Version: 1.9.1 (see Release Notes for more info)

The BGSLibrary was developed by Andrews Sobral and provides a C++ framework to perform background subtraction (BGS). The code works either on Windows or on Linux. Currently the library offers 35 BGS algorithms (the PBAS algorithm was removed from BGSLibrary because it is based on patented algorithm ViBE). A large amount of algorithms were provided by several authors. The source code is available under GNU GPL v3 license, the library is free and open source for academic purposes. Any user can be download latest project source code using SVN client. In Windows, a demo project for Visual Studio 2010 is provided. An executable version of BGSLibrary is available for Windows 32 bits and 64 bits. For Linux users, a Makefile can be used to compile all files and generate an executable example.

Have you found this software useful? Consider donating US$10 so it can get even better!

This software is completely free and will always stay free. Enjoy!

Citation

If you use this library for your publications, please cite it as:

@inproceedings{bgslibrary,
author    = {Sobral, Andrews},
title     = {{BGSLibrary}: An OpenCV C++ Background Subtraction Library},
booktitle = {IX Workshop de Visão Computacional (WVC'2013)},
address   = {Rio de Janeiro, Brazil},
year      = {2013},
month     = {Jun},
url       = {https://github.com/andrewssobral/bgslibrary}
}

Sobral, Andrews. BGSLibrary: An OpenCV C++ Background Subtraction Library. IX Workshop de Visão Computacional (WVC’2013), Rio de Janeiro, Brazil, Jun. 2013. (PDF)

Some algorithms of the BGSLibrary was used successfully in the following papers: * (2014) Sobral, Andrews; Vacavant, Antoine. A comprehensive review of background subtraction algorithms evaluated with synthetic and real videos. Computer Vision and Image Understanding (CVIU), 2014. (Online) * (2014) Hettiarachchi, C.; Nanayakkara, A.; Dissanayaka, A.; Wijenayake, C.; De Silva, C. Abandoned object detection with logical reasoning. IEEE International Advance Computing Conference (IACC), pp.1137,1141, 21-22 Feb. 2014. (Online) * (2013) Beleznai, C.; Gemeiner, P.; Zinner, C. Reliable Left Luggage Detection Using Stereo Depth and Intensity Cues. IEEE International Conference on Computer Vision Workshops (ICCVW), pp.59,66, 2-8 Dec. 2013. (Online) * (2013) Mukherjee, D.; Wu, Q.M.J.; Nguyen, T.M. Multiresolution Based Gaussian Mixture Model for Background Suppression. IEEE Transactions on Image Processing, vol.22, no.12, pp.5022,5035, Dec. 2013. (Online) * (2013) Mukherjee, D.; Wu, Q.; Nguyen, T. Gaussian Mixture Model with Advanced Distance Measure based on Support Weights and Histogram of Gradients for Background Suppression. IEEE Transactions on Industrial Informatics, no.99, pp.1, Dec. 2013. (Online) * (2013) Nanayakkara, A.; Dissanayaka, A.; Wijenayake, C.; Hettiarachchi, C.; De Silva, C. NoobaVSS: Video Processing Framework to Enhance Processing and Automated Manipulation of Surveillance Videos. Proceedings of the Research Symposium of Uva Wellassa University, December 12-13, 2013. * (2013) DeMarco, K.J.; West, M.E.; Howard, A.M. Sonar-Based Detection and Tracking of a Diver for Underwater Human-Robot Interaction Scenarios. IEEE International Conference on Systems, Man, and Cybernetics (SMC), pp.2378,2383, 13-16 Oct. 2013. (Online) * (2013) Varadarajan, S.; Miller, P.; Huiyu Zhou. Spatial mixture of Gaussians for dynamic background modelling. 10th IEEE International Conference on Advanced Video and Signal Based Surveillance (AVSS), pp.63,68, 27-30 Aug. 2013. (Online) * (2013) Liem, M. C.; Gavrila, D. M. A comparative study on multi-person tracking using overlapping cameras. Proc. of the International Conference on Computer Vision Systems (ICVS), St. Petersburg, Russia, 2013. (Online) * (2013) Kostyrev, Dmitry; Anishchenko, Sergey; Petrushan, Mikhail. Time Invariant Hand Gesture Recognition For Human-Computer Interaction. Russian International Workshop on Assessment Methods Information Retrieval, 2013. (Online) * (2013) Paul, Manoranjan; Haque, Shah M E; Chakraborty, Subrata. Human detection in surveillance videos and its applications - a review. EURASIP Journal on Advances in Signal Processing 2013. (Online) * (2013) Subudhi, BadriNarayan; Ghosh, Susmita; Ghosh, Ashish. Change detection for moving object segmentation with robust background construction under Wronskian framework. Machine Vision and Applications, vol.24, n.4, pp.795-809, May 2013. (Online) * (2013) Sobral, Andrews; Oliveira, Luciano; Schnitman, Leizer; Souza, Felippe. (Best Paper Award) Highway Traffic Congestion Classification Using Holistic Properties. In International Conference on Signal Processing, Pattern Recognition and Applications (SPPRA’2013), Innsbruck, Austria, Feb 2013. (Online)

List of the algorithms available in BGSLibrary

  • Basic methods, mean and variance over time:

    • Static Frame Difference
    • Frame Difference
    • Weighted Moving Mean
    • Weighted Moving Variance
    • Adaptive Background Learning
    • Adaptive-Selective Background Learning
    • (1) Temporal Mean
    • (1) Adaptive Median of McFarlane and Schofield (1995) (paper)
    • (1) Temporal Median of Cucchiara et al (2003) and Calderara et al (2006) (paper1) (paper2) (paper3)
    • (11) Sigma-Delta of Manzanera and Richefeu (2004) (paper1) (paper2)
  • Fuzzy based methods:

    • (2) Fuzzy Sugeno Integral (with Adaptive-Selective Update) of Hongxun Zhang and De Xu (2006) (paper)
    • (2) Fuzzy Choquet Integral (with Adaptive-Selective Update) of Baf et al (2008) (paper)
    • (3) Fuzzy Gaussian of Laurence Bender (adapted version of Wren (1997) with Sigari et al (2008) approach) (paper)
  • Statistical methods using one gaussian:

    • (1) Gaussian Average of Wren (1997) (paper)
    • (3) Simple Gaussian of Benezeth et al (2008) (paper)
  • Statistical methods using multiple gaussians:

    • (1) Gaussian Mixture Model of Stauffer and Grimson (1999) (paper)
    • (0) Gaussian Mixture Model of KadewTraKuPong and Bowden (2001) (paper)
    • (0) Gaussian Mixture Model of Zivkovic (2004) (paper1) (paper2)
    • (1) Gaussian Mixture Model of Zivkovic (2004)
    • (3) Gaussian Mixture Model of Laurence Bender (implements the classic GMM with Mahalanobis distance) (paper)
  • Type-2 Fuzzy based methods:

    • (2) Type-2 Fuzzy GMM-UM of Baf et al (2008) (paper)
    • (2) Type-2 Fuzzy GMM-UV of Baf et al (2008) (paper)
    • (2) Type-2 Fuzzy GMM-UM with MRF of Zhao et al (2012) (paper1) (paper2)
    • (2) Type-2 Fuzzy GMM-UV with MRF of Zhao et al (2012) (paper1) (paper2)
  • Statistical methods using color and texture features:

    • (1) Texture BGS of Heikkila et al. (2006) (paper)
    • (8) Texture-Based Foreground Detection with MRF of Csaba Kertész (2011) (paper)
    • (4) Multi-Layer BGS of Jian Yao and Jean-Marc Odobez (2007) (paper)
    • (10) MultiCue BGS of SeungJong Noh and Moongu Jeon (2012) (paper)
  • Non-parametric methods:

    • (5) Pixel-Based Adaptive Segmenter (PBAS) of Hofmann et al (2012) The PBAS algorithm was removed from BGSLibrary because it is based on patented algorithm ViBE. (paper)
    • (0) GMG of Godbehere et al (2012) (paper)
    • (6) VuMeter of Goyat et al (2006) (paper)
    • (7) KDE of Elgammal et al (2000) (paper)
    • (9) IMBS of Domenico Bloisi and Luca Iocchi (2012) (paper)
  • Eigenspace-based methods:

    • (1) Eigenbackground / SL-PCA of Oliver et al (2000) (paper)
  • Neural and neuro-fuzzy methods:

    • (3) Adaptive SOM of Maddalena and Petrosino (2008) (paper)
    • (3) Fuzzy Adaptive SOM of Maddalena and Petrosino (2010) (paper)

Legend: * (0) native from OpenCV * (1) thanks to Donovan Parks * (2) thanks to Thierry Bouwmans, Fida EL BAF and Zhenjie Zhao * (3) thanks to Laurence Bender * (4) thanks to Jian Yao and Jean-Marc Odobez * (5) thanks to Martin Hofmann, Philipp Tiefenbacher and Gerhard Rigoll * (6) thanks to Lionel Robinault and Antoine Vacavant * (7) thanks to Ahmed Elgammal * (8) thanks to Csaba Kertész * (9) thanks to Domenico Daniele Bloisi * (10) thanks to SeungJong Noh * (11) thanks to Benjamin Laugraud

Full list of BGSLibrary collaborators

I would like to thanks all those who have contributed in some way to the success of this library, especially, the following peoples (in alphabetical order):

Ahmed Elgammal (USA), Antoine Vacavant (France), Benjamin Laugraud (Belgium), Csaba Kertész (Finland), Domenico Bloisi (Italy), Donovan Parks (Canada), Eduardo Barreto Alexandre (Brazil), Fida EL BAF (France), Iñigo Martínez , Jean-Marc Odobez (Switzerland), Jean-Philippe Jodoin (Canada), JIA Pei (China), Jian Yao (China), Laurence Bender (Argentina), Lionel Robinault (France), Luca Iocchi (Italy), Luiz Vitor Martinez Cardoso (Brazil), Martin Hofmann, Philipp Tiefenbacher and Gerhard Rigoll (Germany), Rim Trabelsi (Tunisia), Simone Gasparini (France), Stefano Tommesani (Italy), Thierry Bouwmans (France), Vikas Reddy (Australia), Yani Ioannou (Canada), Zhenjie Zhao (China) and Zoran Zivkovic (Netherlands).

Algorithms benchmark

Download links

  • BGSLibrary v1.9.1 with MFC GUI v1.4.1 (x86/x64) (+src)

https://github.com/andrewssobral/bgslibrary/blob/master/binaries/mfc_bgslibrary_x86_v1.4.1.zip

Old versions:

  • BGSLibrary v1.9.0 with MFC GUI v1.4.0 (x86/x64) (+src)

https://github.com/andrewssobral/bgslibrary/blob/master/binaries/mfc_bgslibrary_x86_v1.4.0.7z

  • BGSLibrary v1.5.0 with Java GUI for Windows 32bits (x86)

https://github.com/andrewssobral/bgslibrary/blob/master/binaries/bgs_library_x86_v1.5.0_with_gui.7z

  • BGSLibrary v1.5.0 with Java GUI for Windows 64bits (x64)

https://github.com/andrewssobral/bgslibrary/blob/master/binaries/bgs_library_x64_v1.5.0_with_gui.7z

MFC BGSLibrary

For Linux users

Check out latest project source code.

Read instructions in README.txt file.

How to use BGS Library in other C++ code

Download latest project source code, copy package_bgs directory to your project and create config folder (bgslibrary use it to store xml configuration files). For Windows users, a demo project for Visual Studio 2010 is provided.

See Demo.cpp example source code at: https://github.com/andrewssobral/bgslibrary/blob/master/Demo.cpp

How to contribute with BGSLibrary project

Everyone is invited to cooperate with the BGSLibrary project by sending any implementation of background subtraction (BS) algorithms. Please see the following tutorial: https://github.com/andrewssobral/bgslibrary/blob/master/docs/bgslibrary_how_to_contribute.pdf

Example code

#include <iostream>
#include <cv.h>
#include <highgui.h>

#include "package_bgs/FrameDifferenceBGS.h"

void main(int argc, char **argv)
{
  CvCapture *capture = 0;
  capture = cvCaptureFromCAM(0);
  
  if(!capture){
    std::cerr << "Cannot initialize video!" << std::endl;
    return;
  }
  
  IBGS *bgs;
  bgs = new FrameDifferenceBGS;
  
  IplImage *frame;
  int key = 0;
  while(key != 'q')
  {
    frame = cvQueryFrame(capture);
    if(!frame) break;

    cv::Mat img_input(frame);
    cv::imshow("Input", img_input);

    cv::Mat img_mask;
    cv::Mat img_bkgmodel;
    
    // by default, it shows automatically the foreground mask image
    bgs->process(img_input, img_mask, img_bkgmodel);
    
    //if(!img_mask.empty())
    //  cv::imshow("Foreground", img_mask);
    //  do something
    
    key = cvWaitKey(33);
  }

  delete bgs;

  cvDestroyAllWindows();
  cvReleaseCapture(&capture);
}

Best public video databases

Alt text * ChangeDetection: http://changedetection.net/ * BMC: http://bmc.univ-bpclermont.fr/

Videos

Project Diagram

Java GUI

Release Notes:

  • Version 1.9.1: Added Sigma-Delta background subtraction algorithm (SigmaDeltaBGS) of Manzanera and Richefeu (2004).

  • Version 1.9.0: Added A New Framework for Background Subtraction Using Multiple Cues (SJN_MultiCueBGS) of SeungJong Noh and Moongu Jeon (2012). Added OpenCV 2.4.8 support (all dependencies are linked statically).

  • Version 1.8.0: Added Independent Multimodal Background Subtraction (IMBS) of Domenico Daniele Bloisi (2012). Added Adaptive-Selective Background Model Learning.

  • Version 1.7.0: Added Texture-Based Foreground Detection with MRF of Csaba Kertész (2011). Some improvements and bug fixes, …

  • Version 1.6.0: Added KDE of A. Elgammal, D. Harwood, L. S. Davis, “Non-parametric Model for Background Subtraction” ECCV’00 (thanks to Elgammal). Added Texture-based Background Subtraction of Marko Heikkila and Matti Pietikainen “A texture-based method for modeling the background and detecting moving objects” PAMI’06. Added OpenCV 2.4.5 support, some improvements and bug fixes, …

  • Version 1.5.0: Added VuMeter of Yann Goyat, Thierry Chateau, Laurent Malaterre and Laurent Trassoudaine (thanks to Antoine Vacavant). Added OpenCV C++ MFC App (with source code) using BGS Library for Windows users. Added OpenCV 2.4.4 support (all dependencies are linked statically – bye DLL’s), some improvements and bug fixes, …

  • Version 1.4.0: Added PBAS (Pixel-based adaptive Segmenter) of M. Hofmann, P. Tiefenbacher and G. Rigoll. Added T2F-GMM with MRF of Zhenjie Zhao, Thierry Bouwmans, Xubo Zhang and Yongchun Fang. (thanks to Zhenjie Zhao and Thierry Bouwmans) Added GMG of A. Godbehere, A. Matsukawa, K. Goldberg (opencv native). Added OpenCV 2.4.3 support (all dependencies are linked statically – bye DLL’s), some improvements and bug fixes, …

  • Version 1.3.0: Added Fuzzy Sugeno and Choquet Integral with Adaptive-Selective Background Model Update (thanks to Thierry Bouwmans) Foreground Mask Analysis upgrade, now with number of True Positives (TP), True Negatives (TN), False Positives (FP), False Negatives (FN), Detection Rate, Precision, Fmeasure, Accuracy, False Negative Rate (FNR), False Positive Rate (FPR), True Positive Rate (TPR) and ROC images (thanks to Thierry Bouwmans) Added OpenCV 2.4 support Some improvements, bug fixes, …

  • Version 1.2.0: Added Multi-Layer BGS (thanks to Jian Yao and Jean-Marc Odobez) Added Background Subtraction Models from Laurence Bender (Simple Gaussian, Fuzzy Gaussian, Mixture of Gaussians, Adaptive SOM and Fuzzy Adaptive SOM) Added Foreground Mask Analysis (Similarity Measure)

  • Version 1.1.0: Added Type2-Fuzzy GMM UM and UV (thanks to Thierry Bouwmans) Added support to calculate average time of algorithms (see param tictoc in ./config/FrameProcessor.xml)

  • Version 1.0.0: First stable version Added 14 background subtraction algorithms (07 adapted from Donovan Parks)

Related Repositories

bgslibrary

bgslibrary

A Background Subtraction Library ...

ofxBGS

ofxBGS

Background Subtraction Library using bgslibrary and OpenCV ...

bgslibrary

bgslibrary

A Background Subtraction Library ...

bgslibrary

bgslibrary

SVN mirror for bgslibrary ...


Top Contributors

andrewssobral