-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·63 lines (50 loc) · 1.56 KB
/
Copy pathmain.cpp
File metadata and controls
executable file
·63 lines (50 loc) · 1.56 KB
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
#include <thread>
#include "MyThread.hpp"
#include "preoptions.h"
using namespace rm;
using namespace cv;
using namespace std;
pthread_t producePThreadHandler;
pthread_t detectPThreadHandler;
pthread_t energyPThreadHandler;
pthread_t feedbackPThreadHandler;
#if SAVE_VIDEO == 1
int video_save_count;
#endif
int main(int argc, char** argv)
{
PreOptions(argc,argv);
#if SAVE_VIDEO == 1
std::ifstream fileVideoCountRead("../Log/video_count_file.txt", ios::in);
if(!fileVideoCountRead.is_open())
{
LOGE("VIDEO SAVE FAILED\n");
video_save_count = 0;
}
else
{
fileVideoCountRead >> video_save_count;
}
fileVideoCountRead.close();
std::ofstream fileVideoCountWrite("../Log/video_count_file.txt", ios::out);
if(!fileVideoCountWrite.is_open())
LOGE("VIDEO SAVE FAILED\n");
fileVideoCountWrite << video_save_count + 1 << endl;
fileVideoCountWrite.close();
#endif
ImgProdCons pro;
pro.Init();
std::thread produceThread(&rm::ImgProdCons::Produce, &pro);
producePThreadHandler = produceThread.native_handle();
std::thread detectThread(&rm::ImgProdCons::Detect, &pro);
detectPThreadHandler = detectThread.native_handle();
std::thread energyThread(&rm::ImgProdCons::Energy, &pro);
energyPThreadHandler = energyThread.native_handle();
std::thread feedbackThread(&rm::ImgProdCons::Feedback, &pro);
feedbackPThreadHandler = feedbackThread.native_handle();
produceThread.join();
detectThread.join();
energyThread.join();
feedbackThread.join();
return 0;
}