-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathglobals.hpp
More file actions
executable file
·167 lines (139 loc) · 3.83 KB
/
globals.hpp
File metadata and controls
executable file
·167 lines (139 loc) · 3.83 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
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
/*****************************************************************
* File: globals.hpp
* Created: 23. October 2020
* Author: Timo Hueser
* Contact: timo.hueser@gmail.com
* Copyright: 2022 Timo Hueser
* License: GPL v2.1
*****************************************************************/
#ifndef GLOBALS_H
#define GLOBALS_H
#include <iostream>
#include <stdint.h>
#include <QCoreApplication>
#include <QDebug>
#include <QTime>
#include <QToolButton>
#include <QAction>
class Keypoint;
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);
}
enum KeypointState {NotAnnotated, Annotated, Reprojected, Suppressed};
enum class KeypointShape {Circle, Rectangle, Triangle};
//----- Structs Definitions ----//
struct Frame {
QString imagePath;
QSize imageDimensions;
int numKeypoints;
QList<Keypoint*> keypoints;
QMap<QString, Keypoint*> keypointMap;
};
struct ImgSet {
int numCameras;
QList<Frame*> frames;
};
struct SkeletonComponent {
QString name;
QString keypointA;
QString keypointB;
float length;
};
Q_DECLARE_METATYPE(SkeletonComponent)
struct DatasetConfig {
QString datasetName = "New Dataset";
QString datasetPath = ".";
QString videoFormat = "";
int numCameras= 12;
int frameSetsRecording = 10;
QString samplingMethod = "kmeans";
QList<QString> validRecordingFormats = {"avi", "mp4", "mov", "wmv", "AVI", "MP4", "WMV"};
};
struct TimeLineWindow {
QString name;
int start;
int end;
friend bool operator< (const TimeLineWindow &lhs, const TimeLineWindow &rhs){
if(lhs.start < rhs.start )return true;
else return false;
}
friend bool operator== (const TimeLineWindow &lhs, const TimeLineWindow &rhs){
if (lhs.name == rhs.name && lhs.start == rhs.start && lhs.end == rhs.end) return true;
else return false;
}
};
struct RecordingItem {
QString name;
QString path;
QList<TimeLineWindow> timeLineList;
int frameCount = 0;
};
struct CalibrationConfig {
bool debug = false;
QString calibrationSetName;
QString calibrationSetPath;
bool seperateIntrinsics;
QString intrinsicsPath;
QString extrinsicsPath;
int framesForIntrinsics;
int framesForExtrinsics;
QString boardType;
int charucoPatternIdx;
int patternWidth;
int patternHeight;
double patternSideLength;
double markerSideLength;
int patternSize;
QList<QString> cameraNames;
QList<QList<QString>> cameraPairs;
bool single_primary = false;
};
struct AnnotationCount {
int annotated = 0;
int reprojected = 0;
int notAnnotated = 0;
friend AnnotationCount operator+ (const AnnotationCount &lhs, const AnnotationCount &rhs){
AnnotationCount res;
res.annotated = rhs.annotated+lhs.annotated;
res.reprojected = rhs.reprojected+lhs.reprojected;
res.notAnnotated = rhs.notAnnotated+lhs.notAnnotated;
return res;
}
};
struct DatasetExportItem {
QString name;
QString basePath;
QString configFilePath;
QList<QPair<QString, bool>> subSets;
AnnotationCount annotationCount;
int frameCount = 0;
};
struct ExportConfig {
QString trainingSetName;
QString savePath;
QString trainingSetType;
double validationFraction;
bool shuffleBeforeSplit;
bool useRandomShuffleSeed;
int shuffleSeed;
QList<QPair<QString,bool>> entitiesList;
QList<QPair<QString,bool>> keypointsList;
QList<SkeletonComponent> skeleton;
};
struct ExportKeypoint {
QPointF point;
KeypointState state;
};
struct ExportFrameSet {
QString originalPath;
QString basePath;
QString datasetName;
QList<QString> cameras;
QList<QString> frameNames;
QMap<QString, QPair<QString,QList<ExportKeypoint>>> keypoints;
};
void createToolBarButton(QToolButton * button, QAction* action, QIcon icon, bool enabled = true,
bool checkable = false, QSize minSize = QSize(20,20));
#endif