-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBackgroundSubtractor.h
80 lines (45 loc) · 1.75 KB
/
BackgroundSubtractor.h
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//
// BackgroundSubtractor.h
// segmenthreetion
//
// Created by Cristina Palmero Cantariño on 05/03/14.
//
//
#ifndef __segmenthreetion__BackgroundSubtractor__
#define __segmenthreetion__BackgroundSubtractor__
#include <iostream>
#include <boost/algorithm/string.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include "ModalityData.hpp"
using namespace std;
class BackgroundSubtractor {
private:
unsigned char m_masksOffset;
enum boolPerson {
FALSE = 0,
TRUE = 1,
UNDEFINED = -1
};
cv::Point getTopLeftPoint(cv::Point p1, cv::Point p2);
cv::Point getBottomRightPoint(cv::Point p1, cv::Point p2);
public:
BackgroundSubtractor();
void setMasksOffset(unsigned char masksOffset);
unsigned char getMasksOffset();
void getGroundTruthBoundingRects(ModalityData& md);
void getRoiTags(ModalityData& md, bool manualAid);
protected:
void getMaximalBoundingBox(vector<cv::Rect> &boundingBox, cv::Size limits, cv::Rect & outputBoundingBox);
void changePixelValue(cv::Mat & mask, int pixelValue);
void changePixelValue(cv::Mat & mask, int threshold, int pixelValue);
void checkWhitePixels(cv::Rect & box, cv::Mat frame);
int countBoundingBoxes(vector<vector<cv::Rect> > boundingBoxes);
void getMaskBoundingBoxes(cv::Mat mask, vector<cv::Rect> & boundingBoxes);
bool checkMinimumBoundingBoxes(cv::Rect box, int min);
bool isBoxWithinMargins(cv::Rect box, cv::Size limits);
cv::Rect getMinimumBoundingBox(cv::Rect box, int min);
int isPersonBox(cv::Rect r1, cv::Rect r2);
};
#endif /* defined(__segmenthreetion__BackgroundSubtractor__) */