-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainInterface.h
173 lines (137 loc) · 3.65 KB
/
MainInterface.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
// File: MainInterface.h
// Author: Seongdo Kim
// Contact: [email protected]
//
// Copyright (c) 2017, Seongdo Kim <[email protected]>
// All rights reserved.
// The copyright to the computer program(s) herein is
// the property of Seongdo Kim. The program(s) may be
// used and/or copied only with the written permission
// of Seongdo Kim or in accordance with the terms and
// conditions stipulated in the agreement/contract under
// which the program(s) have been supplied.
//
// Written by Seongdo Kim <[email protected]>, June, 2017
#pragma once
#include "SerialVideoReader.h"
#include "ServerNetworkHandler.h"
#include "TCPSocketListener.h"
#include "ParkingSpot.h"
#include "Settings.h"
//#include "LPR.h"
#include <boost/thread.hpp>
//----------------------------------------------------------
// mush link python with option !
#include <python3.6/Python.h>
//#include <numpy/arrayobject.h>
#define NULL_PATH "./null.jpg"
#define LOCALIZER_V_PATH "./model/frozen_inference_graph_1210_mo.pb"
#define L_LABEL_MAP_V "./model/label_map.pbtxt"
//----------------------------------------------------------
char *parseToBrand(PyObject*, int);
namespace seevider {
/**
* Main interface class. An instance of the class must be run within the main thread.
* Otherwise, the application will be crashed due to the OpenCV windows.
* The purpose of having this class is to manage various resources easily.
*/
class MainInterface {
private:
/*
* ====juhee
*/
/**
* Must be true while the system is operating.
*/
bool mOperation;
/**
* IPv4 Address of this machine, if any
*/
std::string mIPv4Address;
/**
* IPv6 Address of this machine, if any
*/
std::string mIPv6Address;
/**
* Mutual condition variable to update the data from TCP socket connection.
*/
MutualConditionVariable mMutualConditionVariable;
/**
* Settings
*/
std::shared_ptr<Settings> mSettings;
/**
* Pointer of the video reader.
*/
std::shared_ptr<SerialVideoReader> mVideoReader;
/**
* The massage queue for the server communication
*/
std::shared_ptr<MessageQueue> mServMsgQueue;
/**
* The server-side network handler
*/
std::unique_ptr<ServerNetworkHandler> mHTTPServUploader;
/**
* The manager connection handler
*/
std::unique_ptr<TCPSocketListener> mTCPSocketListener;
/**
* License plate recognizer
*/
//std::unique_ptr<LPR> mLPR;
/**
* Parking spot manager
*/
std::shared_ptr<ParkingSpotManager> mParkingSpotManager;
/**
* Window name for debugging
*/
cv::String mDebugWindowName = "Debugging Camera View";
/**
*
*/
cv::String mInitializeWindow = "Parking Spot Initialization";
/**
* localizer and recognizer
*/
// ======================
PyObject* p_detector;
PyObject* p_inference;
PyObject* localizer_v;
int tmp;
// ============================
public:
MainInterface();
~MainInterface();
/**
* Main entry of the class
*/
void run();
private:
/**
* Retrive and store network addresses of this machine
*/
void retrieveNetworkAddresses();
/**
* Initialize parking spots. Use this function only for debugging purpose.
*/
void initParkingSpots();
/**
* Add one parking spot
*/
void addParkingSpot(int id, cv::Rect roi);
/**
* Remove the last parking spot
*/
void removeLastParkingSpot();
/**
* Update occupancy status of parking spots
*/
void updateSpots(const cv::Mat &frame, const boost::posix_time::ptime& now);
/**
* Print the instruction to use the ROI setting window
*/
void print_usage_roi_settings();
};
}