Skip to content

Commit

Permalink
Added simple example code in getting started
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewssobral committed Jul 16, 2024
1 parent 2a6cd01 commit 2edf68c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,33 @@ The library's source code is available under the [MIT license](https://opensourc
* [Which algorithms really matter?](https://github.com/andrewssobral/bgslibrary/wiki/Which-algorithms-really-matter%3F)
* [Library architecture](https://github.com/andrewssobral/bgslibrary/wiki/Library-architecture)

```cpp
#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>

// Include the OpenCV and BGSLibrary libraries
#include <opencv2/opencv.hpp>
#include <bgslibrary/algorithms/algorithms.h>

int main( int argc, char** argv )
{
// Gets the names of the background subtraction algorithms registered in the BGSLibrary factory
auto algorithmsName = BGS_Factory::Instance()->GetRegisteredAlgorithmsName();

// Displays the number of available background subtraction algorithms in the BGSLibrary
std::cout << "Number of available algorithms: " << algorithmsName.size() << std::endl;

// Displays the list of available background subtraction algorithms in the BGSLibrary
std::cout << "List of available algorithms:" << std::endl;
std::copy(algorithmsName.begin(), algorithmsName.end(), std::ostream_iterator<std::string>(std::cout, "\n"));

// Returns 0 to indicate that the execution was successful
return 0;
}
```
### Installation instructions
You can either install BGSLibrary via [pre-built binary package](https://github.com/andrewssobral/bgslibrary/releases) or build it from source
Expand Down

0 comments on commit 2edf68c

Please sign in to comment.