Launched October 1, 2024
BGS Library

BGS Library

A C++ Background Subtraction Library with wrappers for Python, MATLAB, Java and GUI on QT

FreeAIOpen SourceCLI7,281 impressions#12 of its week

The BGSLibrary (Background Subtraction Library) is a comprehensive C++ framework designed for background subtraction in computer vision applications, particularly for detecting moving objects in video streams. The library is implemented in C++ and is based on OpenCV, a popular computer vision library.

BGSLibrary is a C++ framework for background subtraction with Python, MATLAB, Java wrappers and a Qt GUI.

for
Computer vision developers needing background-segmentation algorithms.
pricing
open source
license
MIT
andrewssobral/bgslibrary 2.3k 735C++updated 5 months ago
works withOpenCVPythonMATLABJavaQt

Key features

6 features of BGS Library
  • Multiple algorithms — Implements dozens of background subtraction methods such as LOBSTER, SuBSENSE, PAWCS.
  • C++ core — High-performance library built on OpenCV for real-time video processing.
  • Language wrappers — Provides Python (pybgs), MATLAB and Java bindings for easy integration.
  • Qt GUI — Includes a graphical interface for visualizing foreground masks and testing algorithms.
  • CMake integration — CMake target export enables simple linking with other CMake projects.
  • Docker support — Dockerfiles are available for containerised builds and testing.

Use cases

  • Detect moving objects in surveillance video streams.
  • Perform traffic flow analysis by segmenting vehicles from road footage.
  • Monitor wildlife activity using background subtraction on camera traps.
  • Pre-process video for object tracking pipelines.

BGS Library FAQ

How do I install the Python wrapper?+

Run `pip install pybgs`; a C++ compiler and OpenCV headers are required for the build.

Can I use the library with OpenCV 4?+

Yes, the library is built on OpenCV and supports recent OpenCV versions.

Is there a pre-built binary for Windows?+

The repository provides source; Windows builds require a compatible compiler and the CMake build steps.

How do I contribute new algorithms?+

Add the algorithm class under `modules`, update the IBGS interface, and submit a pull request.

What license is BGSLibrary released under?+

The project is released under the MIT license.

Summarized by DevHunt from github.com · Sep 29, 2026. Details may change; check the official site.