/
frame_definitions.h
287 lines (249 loc) · 7.87 KB
/
frame_definitions.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
/*
* BSD 3-Clause License
*
* Copyright (c) 2019, Analog Devices, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FRAME_DEFINITIONS_H
#define FRAME_DEFINITIONS_H
#include <iostream>
#include <string>
#include <vector>
/**
* @brief Namespace aditof
*/
namespace aditof {
/**
* @struct FrameDataDetails
* @brief Describes the properties of a data that embedded within the frame
*/
struct FrameDataDetails {
/**
* @brief The type of data that can be found in a frame. For example it
* could be depth data or IR data, etc.
*/
std::string type;
/**
* @brief The width of the frame data
*/
unsigned int width;
/**
* @brief The height of the frame data
*/
unsigned int height;
/**
* @brief The size in bytes of a sub-element.
* A sub-element is a sub-component of an element. All sub-elements make up
* an element. For instance a 3D point (which is an element) has X, Y and Z
* coordinates which are sub-elements of the 3D point.
*/
unsigned int subelementSize;
/**
* @brief The number of sub-elements that an element has.
* An element is the smallest part of the image (a.k.a. captured scene) that
* together with other elements make up the entire image.
*/
unsigned int subelementsPerElement;
/**
* @brief The total number of bytes that the data has.
* This can be useful when copying data to another location or when saving
* data to a file or any other usecase where the size in bytes needs to be
* known.
*/
unsigned int bytesCount;
};
/**
* @struct FrameDetails
* @brief Describes the properties of a frame.
*/
struct FrameDetails {
/**
* @brief The type of the frame. Can be one of the types provided by the
* camera.
*/
std::string type;
/**
* @brief A frame can have multiple types of data. For example it could
* hold data about depth and/or data about IR.
*/
std::vector<FrameDataDetails> dataDetails;
/**
* @brief The mode the camera was set when the frame was captured.
*/
std::string cameraMode;
/**
* @brief The width of the frame.
*/
unsigned int width;
/**
* @brief The height of the frame.
*/
unsigned int height;
/**
* @brief totalCaptures or subframes in a frame
*/
uint8_t totalCaptures;
/**
* @brief is a passive IR frame appended
*/
bool passiveIRCaptured;
};
/**
* @struct Point3I
* @brief Holds the xyz values of a frame
*/
struct Point3I {
int16_t a; //!< X Information
int16_t b; //!< Y Information
int16_t c; //!< Z Information
};
#pragma pack(push, 1)
/**
* @struct Metadata
* @brief Contains all of the metadata components
*/
struct Metadata {
/**
* @brief Width of frame
*/
uint16_t width;
/**
* @brief Height of frame
*/
uint16_t height;
/**
* @brief ADSD3500 Output Configuration:
* 0 Full Depth Frame
* 1 Phase Frame (Partial Depth)
* 2 AB Frame
* 3 Confidence Frame
* 4 Depth AB Interleaved
* 5 Phase and AB Interleaved
* 6 Phase, JBLF Confidence and AB Interleaved
* 7 Depth, Confidence and AB Interleaved
*/
uint8_t outputConfiguration;
/**
* @brief Number of bits in depth
*/
uint8_t bitsInDepth;
/**
* @brief Number of bits in AB
*/
uint8_t bitsInAb;
/**
* @brief Number of bits in confidence
*/
uint8_t bitsInConfidence;
/**
* @brief invalidPhaseValue:
* In partial depth case, the host must know the invalid phase value used by the ADSD3500, which is used for invalidation during full depth compute.
*/
uint16_t invalidPhaseValue;
/**
* @brief frequencyIndex: Stores index of the frequency for which the phase frame is outputted.
*/
uint8_t frequencyIndex;
/**
* @brief abFrequencyIndex:
* AB Frequency Index:
* 0 AB of frequency 0
* 1 AB of frequency 1
* 2 AB of frequency 2
* 3 AB Averaged
*/
uint8_t abFrequencyIndex;
/**
* @brief Frame number
*/
uint32_t frameNumber;
/**
* @brief Imager mode
*/
uint8_t imagerMode;
/**
* @brief number of phases:
* Number of phases in the input raw capture fed to the ADSD3500
*/
uint8_t numberOfPhases;
/**
* @brief number of frequencies:
* Number of frequencies in the input raw capture fed to the ADSD3500.
*/
uint8_t numberOfFrequencies;
/**
* @brief True if xyz is being generated for the current frame. (set by sdk)
*/
uint8_t xyzEnabled;
/**
* @brief elapsedTimeFractionalValue:
* 32-bit fractional value out of total elapsed time.
*/
uint32_t elapsedTimeFractionalValue;
/**
* @brief elapsedTimeSecondsValue:
* 32-bit seconds value out of total elapsed time.
*/
uint32_t elapsedTimeSecondsValue;
/**
* @brief Sensor temperature in degrees Celsius
*/
int32_t sensorTemperature;
/**
* @brief Laser temperature in degrees Celsius
*/
int32_t laserTemperature;
};
#pragma pack(pop)
/**
* @brief prints human readable metadata structure
*/
inline std::ostream &operator<<(std::ostream &o, const struct Metadata &meta) {
o << "\tWidth: " << meta.width << "\tHeight: " << meta.height
<< "\tOutputConfiguration: "
<< static_cast<unsigned int>(meta.outputConfiguration)
<< "\tBitsInDepth: " << static_cast<unsigned int>(meta.bitsInDepth)
<< "\tBitsInAb: " << static_cast<unsigned int>(meta.bitsInAb)
<< "\tBitsInConfidenc: "
<< static_cast<unsigned int>(meta.bitsInConfidence)
<< "\tInvalidPhaseValue: " << meta.invalidPhaseValue
<< "\tFrequencyIndex: " << static_cast<unsigned int>(meta.frequencyIndex)
<< "\tFrameNumber: " << meta.frameNumber
<< "\tImagerMode: " << static_cast<unsigned int>(meta.imagerMode)
<< "\tNumberOfPhases: " << static_cast<unsigned int>(meta.numberOfPhases)
<< "\tNumberOfFrequencies: "
<< static_cast<unsigned int>(meta.numberOfFrequencies)
<< "\tXYZEnabled: " << static_cast<unsigned int>(meta.xyzEnabled)
<< "\tElapsedTimeFractionalValue: " << meta.elapsedTimeFractionalValue
<< "\tElapsedTimeSecondsValue: " << meta.elapsedTimeSecondsValue
<< "\tSensorTemperature: " << meta.sensorTemperature
<< "\tLaserTemperature: " << meta.laserTemperature << "\n";
return o;
}
} // namespace aditof
#endif // FRAME_DEFINITIONS_H