forked from Smorodov/Multitarget-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBackgroundSubtract.h
More file actions
49 lines (38 loc) · 1 KB
/
BackgroundSubtract.h
File metadata and controls
49 lines (38 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#include "defines.h"
#include "vibe_src/vibe.hpp"
#include "Subsense/BackgroundSubtractorSuBSENSE.h"
#include "Subsense/BackgroundSubtractorLOBSTER.h"
#ifdef USE_OCV_BGFG
#include <opencv2/bgsegm.hpp>
#endif
///
/// \brief The BackgroundSubtract class
///
class BackgroundSubtract
{
public:
enum BGFG_ALGS
{
ALG_VIBE,
ALG_MOG,
ALG_GMG,
ALG_CNT,
ALG_SuBSENSE,
ALG_LOBSTER,
ALG_MOG2
};
BackgroundSubtract(BGFG_ALGS algType, int channels);
~BackgroundSubtract() = default;
bool Init(const config_t& config);
void Subtract(const cv::UMat& image, cv::UMat& foreground);
void ResetModel(const cv::UMat& img, const cv::Rect& roiRect);
int m_channels = 1;
BGFG_ALGS m_algType = BGFG_ALGS::ALG_MOG2;
private:
std::unique_ptr<vibe::VIBE> m_modelVibe;
cv::Ptr<cv::BackgroundSubtractor> m_modelOCV;
std::unique_ptr<BackgroundSubtractorLBSP> m_modelSuBSENSE;
cv::UMat m_rawForeground;
cv::UMat GetImg(const cv::UMat& image);
};