BGSLibrary: A Background Subtraction Library


Last Update: 01/04/2017

The BGSLibrary was developed by Andrews Sobral and provides an easy-to-use C++ framework based on OpenCV to perform foreground-background separation in videos. The bgslibrary is compatible with OpenCV 2.x and 3.x, and compiles under Windows, Linux, and Mac OS X. Currently the library contains 43 algorithms. The source code is available under GNU GPLv3 license, the library is free and open source for academic purposes.

¹ The PBAS algorithm was removed from BGSLibrary because it is based on patented algorithm ViBE.

² Some algorithms of the bgslibrary are free for commercial purposes and others not. First you need to contact the authors of your desired background subtraction method and check with them the appropriate license. For more additional information, please see: Can I use a GPLv3 software as a part of my commercial application?.

Algorithms benchmark

Which algorithms really matter?

Frequently, the main question is: what is the best algorithm to choose? Unfortunately there is no an exact response. The performance of each algorithm may vary due to the application and scene/environment. However, the following resources are available to help you in this big challenge:

Release Notes:

    • 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, ...