-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTheCarCV.hpp
61 lines (44 loc) · 1.34 KB
/
TheCarCV.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
//
// Created by rege on 08.03.17.
//
#ifndef THECAR_THECARCV_HPP
#define THECAR_THECARCV_HPP
#include <functional>
#define WIN if (TheCarCV::getInstance().isShowingWindows())
//TODO: this enum to sign detect hpp
typedef enum RoadSign
{ ONLY_FORWARD, ONLY_RIGHT, ONLY_LEFT, ONLY_FORWARD_AND_RIGHT, ONLY_FORWARD_AND_LEFT,
TRAFFIC_LIGHT, STOP, WAY_IS_BUNNED}
RoadSign;
const int RESOLUTION_OF_IMAGE_FOR_DETECTION = 20;
class OnItemFoundListener
{
/** mat is a resolution-fixed black-white image for item detection */
public:
virtual int operator()
(int mat[RESOLUTION_OF_IMAGE_FOR_DETECTION][RESOLUTION_OF_IMAGE_FOR_DETECTION], int size);
};
// singleton
class TheCarCV
{
private:
bool createWindows = false;
TheCarCV ();
TheCarCV (const TheCarCV &);
TheCarCV & operator= (TheCarCV &);
void init ();
public:
static TheCarCV & getInstance ()
{
static TheCarCV instance;
return instance;
}
// initialize windows and turn on showing of it
void turnOnWindows ();
// if windows are showing on screen return true, else false
bool isShowingWindows ();
// warning: this method block the thread (road sign detection start)
// thread must be unlocked only at program shutdown
void start (void (* onItemFoundListener) (int **, int));
};
#endif //THECAR_THECARCV_HPP