forked from JARVIS-MoCap/JARVIS-AcquisitionTool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
globals.hpp
executable file
·100 lines (86 loc) · 2.48 KB
/
globals.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
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
/*******************************************************************************
* File: globals.hpp
* Created: 23. October 2020
* Author: Timo Hueser
* Contact: [email protected]
* Copyright: 2021 Timo Hueser
* License: LGPL v3.0
******************************************************************************/
#ifndef GLOBALS_H
#define GLOBALS_H
#ifdef _WIN32
#define NOMINMAX
#define _WINSOCKAPI_
#endif
#include <QAction>
#include <QCoreApplication>
#include <QDebug>
#include <QDir>
#include <QTime>
#include <QToolButton>
#include <iostream>
#include <stdint.h>
#define NUM_CAMS 16
inline void delayl(int ms) {
// delay function that doesn't interrupt the QEventLoop
QTime dieTime = QTime::currentTime().addMSecs(ms);
while (QTime::currentTime() < dieTime)
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
}
//----- Structs Definitions ----//
enum statusType { Connecting, Ready, Streaming, Warning, Error };
enum RecorderType { RawRecorderType, BaseRecorderType, CudaRecorderType };
enum PixelFormat {
BayerRG8,
BayerGB8,
BayerGR8,
BayerBG8,
BGR8,
RGB8,
Mono8,
YCbCr422
};
extern QMap<statusType, QIcon> statusIcons;
extern QMap<statusType, QString> statusTexts;
// Not have this live in global forever please, thank you <3!
struct GlobalSettings {
QString recorderType = "Cuda Recorder";
bool recordVideos = true;
int jpegQualityFactor = 95;
bool metadataEnabled = true;
int streamingSubsamplingRatio = 4;
bool streamingEnabled = true;
int recordingSubsamplingRatio = 2;
};
extern GlobalSettings globalSettings;
typedef struct frameSize_t {
unsigned int width;
unsigned int height;
} frameSize_t;
typedef uint frameRate_t;
typedef struct AcquisitionSpecs {
bool record = false;
QDir recordingDir;
RecorderType recorderType;
int frameRate;
frameSize_t frameSize;
int streamingSamplingRatio = 2;
PixelFormat pixelFormat;
} AcquisitionSpecs;
struct CameraSettings {
bool loadDefaults = true;
bool useExternalTrigger = true;
bool exposureAuto = false;
float exposureTime = 2.0;
bool gainAuto = false;
float gain = 10.0;
};
typedef struct statusLog {
statusType type;
QTime time;
QString message;
} statusLog;
void createToolBarButton(QToolButton *button, QAction *action, QIcon icon,
bool enabled = true, bool checkable = false,
QSize minSize = QSize(20, 20));
#endif