-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbewis.hpp
74 lines (64 loc) · 1.44 KB
/
bewis.hpp
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
//
// cwisard.hpp
//
//
// Created by Maurizio Giordano on 25/05/15.
//
//
#ifndef _cwisard_hpp
#define _cwisard_hpp
#include <stdio.h>
#include <list>
#include <iostream>
#include <sys/time.h>
#include <iostream>
#include <getopt.h>
#include <dirent.h>
#include <iomanip>
// OpenCV include
#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/video/background_segm.hpp>
#include <bgwis.hpp>
#include <sys/stat.h>
using namespace cv;
using namespace std;
int MAXWIDTH = 30;
int CHARSKIP1 = 17;
int CHARSKIP2 = 14;
char filler = ' ';
// String Tokenizer
vector<string> tokenizer(string str, char delimiter) {
vector<string> v;
istringstream buf(str);
for(string token; getline(buf, token, delimiter); ) {
v.push_back(token);
}
return v;
}
bool is_file(const char* path) {
struct stat buf;
stat(path, &buf);
return S_ISREG(buf.st_mode);
}
bool is_dir(const char* path) {
struct stat buf;
stat(path, &buf);
return S_ISDIR(buf.st_mode);
}
int parsePolicy(string settings,double &incr, double &decr) {
vector<string> args = tokenizer(settings, ':') ;
if (args.size() != 2) {
return -1;
} else {
incr = (double)atof(args[0].c_str());
decr = (double)atof(args[1].c_str());
if (incr < 1 || decr < 0) {
return -1;
}
return 0;
}
}
#endif