{"id":13436292,"url":"https://github.com/andrewssobral/bgslibrary","last_synced_at":"2025-05-14T07:08:27.352Z","repository":{"id":14188314,"uuid":"16894733","full_name":"andrewssobral/bgslibrary","owner":"andrewssobral","description":"A C++ Background Subtraction Library with wrappers for Python, MATLAB, Java and GUI on QT","archived":false,"fork":false,"pushed_at":"2024-07-27T18:32:47.000Z","size":85916,"stargazers_count":2227,"open_issues_count":90,"forks_count":743,"subscribers_count":131,"default_branch":"master","last_synced_at":"2025-05-10T15:16:56.575Z","etag":null,"topics":["background-subtraction","bgs","computer-vision","foreground-detection","moving-object-detection","opencv","pybgs"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrewssobral.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://www.paypal.me/andrewssobral"}},"created_at":"2014-02-16T21:35:54.000Z","updated_at":"2025-05-08T18:52:38.000Z","dependencies_parsed_at":"2024-03-16T14:38:08.721Z","dependency_job_id":"83a75d9a-aea0-4688-8149-9116a75c515d","html_url":"https://github.com/andrewssobral/bgslibrary","commit_stats":{"total_commits":303,"total_committers":23,"mean_commits":"13.173913043478262","dds":0.2376237623762376,"last_synced_commit":"64dec9e538494beb44cd5a48112f29841f97e919"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewssobral%2Fbgslibrary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewssobral%2Fbgslibrary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewssobral%2Fbgslibrary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewssobral%2Fbgslibrary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewssobral","download_url":"https://codeload.github.com/andrewssobral/bgslibrary/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254092776,"owners_count":22013290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["background-subtraction","bgs","computer-vision","foreground-detection","moving-object-detection","opencv","pybgs"],"created_at":"2024-07-31T03:00:46.286Z","updated_at":"2025-05-14T07:08:27.326Z","avatar_url":"https://github.com/andrewssobral.png","language":"C++","funding_links":["https://www.paypal.me/andrewssobral"],"categories":["Uncategorized","Awesome Resources","C++","人工智能"],"sub_categories":["Uncategorized","Datasets","2017 Papers"],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/andrewssobral/bgslibrary/blob/master/docs/images/bgslibrary-logo.jpg?raw=true\" alt=\"BGSLibrary\" width=\"200\"\u003e\n\u003c/p\u003e\n\n# BGSLibrary: A Background Subtraction Library\n\n[![Release](https://img.shields.io/badge/Release-3.3.0-blue.svg)](https://github.com/andrewssobral/bgslibrary/wiki/Build-status) [![License: GPL v3](https://img.shields.io/badge/License-MIT-blue.svg)](http://www.gnu.org/licenses/gpl-3.0) [![Platform: Windows, Linux, OS X](https://img.shields.io/badge/Platform-Windows%2C%20Linux%2C%20OS%20X-blue.svg)](https://github.com/andrewssobral/bgslibrary/wiki/Build-status) [![OpenCV](https://img.shields.io/badge/OpenCV-2.4.x%2C%203.x%2C%204.x-blue.svg)](https://github.com/andrewssobral/bgslibrary/wiki/Build-status) [![Wrapper: Python, MATLAB](https://img.shields.io/badge/Wrapper-Java%2C%20Python%2C%20MATLAB-orange.svg)](https://github.com/andrewssobral/bgslibrary/wiki/Build-status) [![Algorithms](https://img.shields.io/badge/Algorithms-43-red.svg)](https://github.com/andrewssobral/bgslibrary/wiki/List-of-available-algorithms) \u003ca href=\"https://app.commanddash.io/agent?github=https://github.com/andrewssobral/bgslibrary\"\u003e\u003cimg src=\"https://img.shields.io/badge/AI-Code%20Gen-EB9FDA\"\u003e\u003c/a\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://youtu.be/_UbERwuQ0OU\" target=\"_blank\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/andrewssobral/bgslibrary/master/docs/images/bgs_giphy2.gif\" border=\"0\" /\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n## Introduction\n\nThe **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. It provides an easy-to-use and extensible platform for researchers and developers to experiment with and implement various background subtraction techniques.\n\n## Library Version\n\n**3.3.0** (see **[Build Status](https://github.com/andrewssobral/bgslibrary/wiki/Build-status)** and **[Release Notes](https://github.com/andrewssobral/bgslibrary/wiki/Release-notes)** for more info)\n\n## Background and Development\n\nThe BGSLibrary was developed in early 2012 by [Andrews Cordolino Sobral](http://andrewssobral.wixsite.com/home) as a C++ framework with wrappers available for Python, Java, and MATLAB. It aims to facilitate foreground-background separation in videos using the OpenCV library.\n\n## Compatibility\n\nThe library is compatible with OpenCV versions 2.4.x, 3.x, and 4.x. It can be compiled and used on Windows, Linux, and Mac OS X systems.\n\n## Licensing\n\nThe library's source code is available under the [MIT license](https://opensource.org/licenses/MIT), making it free for both academic and commercial use.\n\n## Getting started\n\n* [List of available algorithms](https://github.com/andrewssobral/bgslibrary/wiki/List-of-available-algorithms)\n* [Algorithms benchmark](https://github.com/andrewssobral/bgslibrary/wiki/Algorithms-benchmark)\n* [Which algorithms really matter?](https://github.com/andrewssobral/bgslibrary/wiki/Which-algorithms-really-matter%3F)\n* [Library architecture](https://github.com/andrewssobral/bgslibrary/wiki/Library-architecture)\n\n\u003ca href=\"https://app.commanddash.io/agent?github=https://github.com/andrewssobral/bgslibrary\"\u003e\u003cimg src=\"https://img.shields.io/badge/AI-Code%20Gen-EB9FDA\"\u003e\u003c/a\u003e\n```cpp\n#include \u003ciostream\u003e\n#include \u003calgorithm\u003e\n#include \u003citerator\u003e\n#include \u003cvector\u003e\n\n// Include the OpenCV and BGSLibrary libraries\n#include \u003copencv2/opencv.hpp\u003e\n#include \u003cbgslibrary/algorithms/algorithms.h\u003e\n\nint main( int argc, char** argv )\n{\n    // Gets the names of the background subtraction algorithms registered in the BGSLibrary factory\n    auto algorithmsName = BGS_Factory::Instance()-\u003eGetRegisteredAlgorithmsName();\n\n    // Displays the number of available background subtraction algorithms in the BGSLibrary\n    std::cout \u003c\u003c \"Number of available algorithms: \" \u003c\u003c algorithmsName.size() \u003c\u003c std::endl;\n\n    // Displays the list of available background subtraction algorithms in the BGSLibrary\n    std::cout \u003c\u003c \"List of available algorithms:\" \u003c\u003c std::endl;\n    std::copy(algorithmsName.begin(), algorithmsName.end(), std::ostream_iterator\u003cstd::string\u003e(std::cout, \"\\n\"));\n\n    // Returns 0 to indicate that the execution was successful\n    return 0;\n}\n```\n\n### Installation instructions\n\nYou can either install BGSLibrary via [pre-built binary package](https://github.com/andrewssobral/bgslibrary/releases) or build it from source\n\n* [Windows installation](https://github.com/andrewssobral/bgslibrary/wiki/Installation-instructions---Windows)\n* [Ubuntu / OS X installation](https://github.com/andrewssobral/bgslibrary/wiki/Installation-instructions-Ubuntu-or-OSX)\n\nSupported Compilers:\n\n* GCC 4.8 and above\n* Clang 3.4 and above\n* MSVC 2015, 2017, 2019 or newer\n\nOther compilers might work, but are not officially supported.\nThe bgslibrary requires some features from the ISO C++ 2014 standard.\n\n### Graphical User Interface\n\n* [C++ QT](https://github.com/andrewssobral/bgslibrary/wiki/Graphical-User-Interface:-QT) ***(Official)***\n* [C++ MFC](https://github.com/andrewssobral/bgslibrary/wiki/Graphical-User-Interface:-MFC) ***(Deprecated)***\n* [Java](https://github.com/andrewssobral/bgslibrary/wiki/Graphical-User-Interface:-Java) ***(Obsolete)***\n\n### Wrappers\n\n* [Python](https://github.com/andrewssobral/bgslibrary/wiki/Wrapper:-Python) [![Downloads](https://static.pepy.tech/badge/pybgs)](https://pepy.tech/project/pybgs) [![Downloads](https://static.pepy.tech/badge/pybgs/month)](https://pepy.tech/project/pybgs) [![Downloads](https://static.pepy.tech/badge/pybgs/week)](https://pepy.tech/project/pybgs)\n* [MATLAB](https://github.com/andrewssobral/bgslibrary/wiki/Wrapper:-MATLAB)\n* [Java](https://github.com/andrewssobral/bgslibrary/wiki/Wrapper:-Java)\n\n### Usage examples\n\n* BGSlibrary examples folder\n* * \u003chttps://github.com/andrewssobral/bgslibrary/tree/master/examples\u003e\n* BGSlibrary examples in C++\n* * \u003chttps://github.com/andrewssobral/bgslibrary-examples-cpp\u003e\n* BGSlibrary examples in Python\n* * \u003chttps://github.com/andrewssobral/bgslibrary-examples-python\u003e\n\n### More\n\n* [Docker images](https://github.com/andrewssobral/bgslibrary/wiki/Docker-images)\n* [How to integrate BGSLibrary in your own CPP code](https://github.com/andrewssobral/bgslibrary/wiki/How-to-integrate-BGSLibrary-in-your-own-CPP-code)\n* [How to contribute](https://github.com/andrewssobral/bgslibrary/wiki/How-to-contribute)\n* [List of collaborators](https://github.com/andrewssobral/bgslibrary/wiki/List-of-collaborators)\n* [Release notes](https://github.com/andrewssobral/bgslibrary/wiki/Release-notes)\n\n## Algorithm compatibility across OpenCV versions\n\n| Algorithm | OpenCV \u003c 3.0 (42) | 3.0 \u003c= OpenCV \u003c= 3.4.7 (41) | 3.4.7 \u003c OpenCV \u003c 4.0 (39) | OpenCV \u003e= 4.0 (26) |\n|--------------------------------|:-----------:|:----------------------:|:---------------------:|:------------:|\n| AdaptiveBackgroundLearning | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| AdaptiveSelectiveBackgroundLearning | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| CodeBook | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| DPAdaptiveMedian | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |\n| DPEigenbackground | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |\n| DPGrimsonGMM | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |\n| DPMean | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |\n| DPPratiMediod | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |\n| DPTexture | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |\n| DPWrenGA | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |\n| DPZivkovicAGMM | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |\n| FrameDifference | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| FuzzyChoquetIntegral | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| FuzzySugenoIntegral | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| GMG | :heavy_check_mark: | :x: | :x: | :x: |\n| IndependentMultimodal | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| KDE | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| KNN | :x: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| LBAdaptiveSOM | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| LBFuzzyAdaptiveSOM | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| LBFuzzyGaussian | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| LBMixtureOfGaussians | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| LBP_MRF | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: |\n| LBSimpleGaussian | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| LOBSTER | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| MixtureOfGaussianV1 | :heavy_check_mark: | :x: | :x: | :x: |\n| MixtureOfGaussianV2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| MultiCue | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |\n| MultiLayer | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: |\n| PAWCS | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| PixelBasedAdaptiveSegmenter | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| SigmaDelta | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| StaticFrameDifference | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| SuBSENSE | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| T2FGMM_UM | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |\n| T2FGMM_UV | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |\n| T2FMRF_UM | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |\n| T2FMRF_UV | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |\n| TwoPoints | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| ViBe | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| VuMeter | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| WeightedMovingMean | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| WeightedMovingVariance | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n\n## Stargazers over time\n\n[![Stargazers over time](https://starchart.cc/andrewssobral/bgslibrary.svg)](https://starchart.cc/andrewssobral/bgslibrary)\n\n## Citation\n\nIf you use this library for your publications, please cite it as:\n\n```\n@inproceedings{bgslibrary,\nauthor    = {Sobral, Andrews},\ntitle     = {{BGSLibrary}: An OpenCV C++ Background Subtraction Library},\nbooktitle = {IX Workshop de Visão Computacional (WVC'2013)},\naddress   = {Rio de Janeiro, Brazil},\nyear      = {2013},\nmonth     = {Jun},\nurl       = {https://github.com/andrewssobral/bgslibrary}\n}\n```\n\nA chapter about the BGSLibrary has been published in the handbook on [Background Modeling and Foreground Detection for Video Surveillance](https://sites.google.com/site/backgroundsubtraction/).\n\n```\n@incollection{bgslibrarychapter,\nauthor    = {Sobral, Andrews and Bouwmans, Thierry},\ntitle     = {BGS Library: A Library Framework for Algorithm’s Evaluation in Foreground/Background Segmentation},\nbooktitle = {Background Modeling and Foreground Detection for Video Surveillance},\npublisher = {CRC Press, Taylor and Francis Group.}\nyear      = {2014},\n}\n```\n\n## References\n\n* Sobral, Andrews. BGSLibrary: An OpenCV C++ Background Subtraction Library. IX Workshop de Visão Computacional (WVC'2013), Rio de Janeiro, Brazil, Jun. 2013. ([PDF](http://www.researchgate.net/publication/257424214_BGSLibrary_An_OpenCV_C_Background_Subtraction_Library) in brazilian-portuguese containing an english abstract).\n\n* 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](http://www.researchgate.net/publication/257424214_BGSLibrary_An_OpenCV_C_Background_Subtraction_Library) in english).\n\nSome algorithms of the BGSLibrary were used successfully in the following papers:\n\n* (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](http://dx.doi.org/10.1016/j.cviu.2013.12.005)) ([PDF](http://www.researchgate.net/publication/259340906_A_comprehensive_review_of_background_subtraction_algorithms_evaluated_with_synthetic_and_real_videos))\n\n* (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](http://dx.doi.org/10.2316/P.2013.798-105)) ([PDF](http://www.researchgate.net/publication/233427564_HIGHWAY_TRAFFIC_CONGESTION_CLASSIFICATION_USING_HOLISTIC_PROPERTIES))\n\n## Videos\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://www.youtube.com/watch?v=_UbERwuQ0OU\" target=\"_blank\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/andrewssobral/bgslibrary/master/docs/images/bgslibrary_qt_gui_video.png\" width=\"600\" border=\"0\" /\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://www.youtube.com/watch?v=Ccqa9KBO9_U\" target=\"_blank\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/andrewssobral/bgslibrary/master/docs/images/bgslibrary_youtube.png\" width=\"600\" border=\"0\" /\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewssobral%2Fbgslibrary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewssobral%2Fbgslibrary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewssobral%2Fbgslibrary/lists"}