forked from Smorodov/Multitarget-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBackgroundSubtractorLBSP.cpp
More file actions
59 lines (51 loc) · 1.61 KB
/
BackgroundSubtractorLBSP.cpp
File metadata and controls
59 lines (51 loc) · 1.61 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
50
51
52
53
54
55
56
57
58
59
#include "BackgroundSubtractorLBSP.h"
#include "DistanceUtils.h"
#include "RandUtils.h"
#include <iostream>
#include <iomanip>
#include <exception>
// local define used to determine the default median blur kernel size
#define DEFAULT_MEDIAN_BLUR_KERNEL_SIZE (9)
BackgroundSubtractorLBSP::BackgroundSubtractorLBSP(float fRelLBSPThreshold, size_t nLBSPThresholdOffset)
: m_nImgChannels(0)
,m_nImgType(0)
,m_nLBSPThresholdOffset(nLBSPThresholdOffset)
,m_fRelLBSPThreshold(fRelLBSPThreshold)
,m_nTotPxCount(0)
,m_nTotRelevantPxCount(0)
,m_nFrameIndex(SIZE_MAX)
,m_nFramesSinceLastReset(0)
,m_nModelResetCooldown(0)
,m_aPxIdxLUT(nullptr)
,m_aPxInfoLUT(nullptr)
,m_nDefaultMedianBlurKernelSize(DEFAULT_MEDIAN_BLUR_KERNEL_SIZE)
,m_bInitialized(false)
,m_bAutoModelResetEnabled(true)
,m_bUsingMovingCamera(false)
,nDebugCoordX(0),nDebugCoordY(0) {
CV_Assert(m_fRelLBSPThreshold>=0);
}
BackgroundSubtractorLBSP::~BackgroundSubtractorLBSP() {}
void BackgroundSubtractorLBSP::initialize(const cv::Mat& oInitImg) {
this->initialize(oInitImg,cv::Mat());
}
//cv::Algorithm* BackgroundSubtractorLBSP::info() const {
// return nullptr;
//}
cv::Mat BackgroundSubtractorLBSP::getROICopy() const {
return m_oROI.clone();
}
void BackgroundSubtractorLBSP::setROI(cv::Mat& oROI) {
LBSP::validateROI(oROI);
CV_Assert(cv::countNonZero(oROI)>0);
if(m_bInitialized) {
cv::Mat oLatestBackgroundImage;
getBackgroundImage(oLatestBackgroundImage);
initialize(oLatestBackgroundImage,oROI);
}
else
m_oROI = oROI.clone();
}
void BackgroundSubtractorLBSP::setAutomaticModelReset(bool bVal) {
m_bAutoModelResetEnabled = bVal;
}