-
Notifications
You must be signed in to change notification settings - Fork 2
/
MotionDetector.hxx
43 lines (32 loc) · 978 Bytes
/
MotionDetector.hxx
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
#ifndef __MOTION_DETECTOR_HXX__
#define __MOTION_DETECTOR_HXX__
#include <deque>
#include <libconfig.h++>
#include "MotionState.hxx"
#include "FrameProcessor.hxx"
namespace ISentry
{
/**
* Detects motion and forwards frame to children only if detected.
* Additionally calls start/stop methods on children depending on
* motion state.
*/
class MotionDetector:public FrameProcessor
{
public:
MotionDetector(MotionState *tap, const libconfig::Setting& cfg);
virtual ~MotionDetector();
void setThreshold(float th) { threshold=th; }
// overloaded from FrameProcessor
virtual void addFrame(std::pair<cv::Mat,time_t> &m);
protected:
MotionState *tap;
float threshold;
private:
// pre-motion
size_t backup_frames;
std::deque<std::pair<cv::Mat,time_t> > buf;
bool in_motion;
};
};
#endif // __MOTION_DETECTOR_HXX__