Skip to main content

BGSLibrary

A Background Subtraction Library

Release License: GPL v3 Platform: Windows, Linux, OS X OpenCV Wrapper: Python, MATLAB Algorithms

Last page update: 04/03/2023

Library Version: 3.3.0 (see Build Status and Release Notes for more info)

The BGSLibrary was developed in early 2012 by Andrews Sobral as a C++ framework (with wrappers available for Python, Java and MATLAB) for foreground-background separation in videos using OpenCV. The bgslibrary is compatible with OpenCV versions 2.4.x, 3.x and 4.x, and can be compiled on Windows, Linux, and Mac OS X. It currently contains 43 algorithms and is available free of charge to all users, both academic and commercial. The library's source code is available under the MIT license.

You can either install BGSLibrary via pre-built binary package or build it from source

Supported Compilers are:

GCC 4.8 and above
Clang 3.4 and above
MSVC 2015, 2017, 2019 or newer

Other compilers might work, but are not officially supported. The bgslibrary requires some features from the ISO C++ 2014 standard.

Algorithm compatibility across OpenCV versions


Algorithm OpenCV < 3.0 (42) 3.0 <= OpenCV <= 3.4.7 (41) 3.4.7 < OpenCV < 4.0 (39) OpenCV >= 4.0 (26)
AdaptiveBackgroundLearning :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
AdaptiveSelectiveBackgroundLearning :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
CodeBook :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
DPAdaptiveMedian :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x:
DPEigenbackground :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x:
DPGrimsonGMM :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x:
DPMean :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x:
DPPratiMediod :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x:
DPTexture :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x:
DPWrenGA :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x:
DPZivkovicAGMM :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x:
FrameDifference :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
FuzzyChoquetIntegral :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
FuzzySugenoIntegral :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
GMG :heavy_check_mark: :x: :x: :x:
IndependentMultimodal :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
KDE :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
KNN :x: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
LBAdaptiveSOM :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
LBFuzzyAdaptiveSOM :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
LBFuzzyGaussian :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
LBMixtureOfGaussians :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
LBP_MRF :heavy_check_mark: :heavy_check_mark: :x: :x:
LBSimpleGaussian :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
LOBSTER :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
MixtureOfGaussianV1 :heavy_check_mark: :x: :x: :x:
MixtureOfGaussianV2 :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
MultiCue :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x:
MultiLayer :heavy_check_mark: :heavy_check_mark: :x: :x:
PAWCS :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
PixelBasedAdaptiveSegmenter :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
SigmaDelta :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
StaticFrameDifference :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
SuBSENSE :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
T2FGMM_UM :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x:
T2FGMM_UV :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x:
T2FMRF_UM :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x:
T2FMRF_UV :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x:
TwoPoints :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
ViBe :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
VuMeter :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
WeightedMovingMean :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
WeightedMovingVariance :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:

Stargazers over time

Stargazers over time

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}
}

A chapter about the BGSLibrary has been published in the handbook on Background Modeling and Foreground Detection for Video Surveillance.

@incollection{bgslibrarychapter,
author    = {Sobral, Andrews and Bouwmans, Thierry},
title     = {BGS Library: A Library Framework for Algorithm’s Evaluation in Foreground/Background Segmentation},
booktitle = {Background Modeling and Foreground Detection for Video Surveillance},
publisher = {CRC Press, Taylor and Francis Group.}
year      = {2014},
}

Download PDF:

  • Sobral, Andrews. BGSLibrary: An OpenCV C++ Background Subtraction Library. IX Workshop de Visão Computacional (WVC'2013), Rio de Janeiro, Brazil, Jun. 2013. (PDF in brazilian-portuguese containing an english abstract).

  • Sobral, Andrews; Bouwmans, Thierry. "BGS Library: A Library Framework for Algorithm’s Evaluation in Foreground/Background Segmentation". Chapter on the handbook "Background Modeling and Foreground Detection for Video Surveillance", CRC Press, Taylor and Francis Group, 2014. (PDF in english).

Some references

Some algorithms of the BGSLibrary were 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) (PDF)

  • (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) (PDF)

Videos

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybgs-3.3.0.post0.tar.gz (622.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybgs-3.3.0.post0-cp39-cp39-macosx_11_0_x86_64.whl (280.5 kB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

File details

Details for the file pybgs-3.3.0.post0.tar.gz.

File metadata

  • Download URL: pybgs-3.3.0.post0.tar.gz
  • Upload date:
  • Size: 622.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for pybgs-3.3.0.post0.tar.gz
Algorithm Hash digest
SHA256 c50f79e09484cca2d5006dbf7fd2372f10bd6d83e8ebaecffc00d77d91aef671
MD5 076b97e0c071faf7b62a2e0b7de2bd70
BLAKE2b-256 c80f6d5935e0b974fa8fae2e378fcccd67e7fa116978fa6d8cdb952354f92673

See more details on using hashes here.

File details

Details for the file pybgs-3.3.0.post0-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pybgs-3.3.0.post0-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 17f70ae7ab2f52b273a2741f6e498f19775fbc12b948cf731f777009e2d1cfb9
MD5 e148f8d05ae2873ff64e9e951dd80395
BLAKE2b-256 ca2eac48d02db1ef9f1198549f5146890af2f8af28ca705aa34a6fe9abb6dc06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page