forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rs_advanced_mode.hpp
386 lines (325 loc) · 11.9 KB
/
rs_advanced_mode.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
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
/* License: Apache 2.0. See LICENSE file in root directory.
Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
#ifndef R4XX_ADVANCED_MODE_HPP
#define R4XX_ADVANCED_MODE_HPP
#include <cmath>
#include "rs.hpp"
#include "rs_advanced_mode.h"
#include "hpp/rs_serializable_device.hpp"
namespace rs400
{
class advanced_mode : public rs2::serializable_device
{
public:
advanced_mode(rs2::device d)
: rs2::serializable_device(d)
{
rs2_error* e = nullptr;
if(_dev && rs2_is_device_extendable_to(_dev.get(), RS2_EXTENSION_ADVANCED_MODE, &e) == 0 && !e)
{
_dev = nullptr;
}
rs2::error::handle(e);
}
void toggle_advanced_mode(bool enable)
{
rs2_error* e = nullptr;
rs2_toggle_advanced_mode(_dev.get(), enable, &e);
rs2::error::handle(e);
}
bool is_enabled() const
{
rs2_error* e = nullptr;
int enabled=0;
rs2_is_enabled(_dev.get(), &enabled, &e);
rs2::error::handle(e);
return !!enabled;
}
void set_depth_control(const STDepthControlGroup& group)
{
rs2_error* e = nullptr;
rs2_set_depth_control(_dev.get(), &group, &e);
rs2::error::handle(e);
}
STDepthControlGroup get_depth_control(int mode = 0) const
{
rs2_error* e = nullptr;
STDepthControlGroup group{};
rs2_get_depth_control(_dev.get(), &group, mode, &e);
rs2::error::handle(e);
return group;
}
void set_rsm(const STRsm& group)
{
rs2_error* e = nullptr;
rs2_set_rsm(_dev.get(), &group, &e);
rs2::error::handle(e);
}
STRsm get_rsm(int mode = 0) const
{
rs2_error* e = nullptr;
STRsm group{};
rs2_get_rsm(_dev.get(), &group, mode, &e);
rs2::error::handle(e);
return group;
}
void set_rau_support_vector_control(const STRauSupportVectorControl& group)
{
rs2_error* e = nullptr;
rs2_set_rau_support_vector_control(_dev.get(), &group, &e);
rs2::error::handle(e);
}
STRauSupportVectorControl get_rau_support_vector_control(int mode = 0) const
{
rs2_error* e = nullptr;
STRauSupportVectorControl group{};
rs2_get_rau_support_vector_control(_dev.get(), &group, mode, &e);
rs2::error::handle(e);
return group;
}
void set_color_control(const STColorControl& group)
{
rs2_error* e = nullptr;
rs2_set_color_control(_dev.get(), &group, &e);
rs2::error::handle(e);
}
STColorControl get_color_control(int mode = 0) const
{
rs2_error* e = nullptr;
STColorControl group{};
rs2_get_color_control(_dev.get(), &group, mode, &e);
rs2::error::handle(e);
return group;
}
void set_rau_thresholds_control(const STRauColorThresholdsControl& group)
{
rs2_error* e = nullptr;
rs2_set_rau_thresholds_control(_dev.get(), &group, &e);
rs2::error::handle(e);
}
STRauColorThresholdsControl get_rau_thresholds_control(int mode = 0) const
{
rs2_error* e = nullptr;
STRauColorThresholdsControl group{};
rs2_get_rau_thresholds_control(_dev.get(), &group, mode, &e);
rs2::error::handle(e);
return group;
}
void set_slo_color_thresholds_control(const STSloColorThresholdsControl& group)
{
rs2_error* e = nullptr;
rs2_set_slo_color_thresholds_control(_dev.get(), &group, &e);
rs2::error::handle(e);
}
STSloColorThresholdsControl get_slo_color_thresholds_control(int mode = 0) const
{
rs2_error* e = nullptr;
STSloColorThresholdsControl group{};
rs2_get_slo_color_thresholds_control(_dev.get(), &group, mode, &e);
rs2::error::handle(e);
return group;
}
void set_slo_penalty_control(const STSloPenaltyControl& group)
{
rs2_error* e = nullptr;
rs2_set_slo_penalty_control(_dev.get(), &group, &e);
rs2::error::handle(e);
}
STSloPenaltyControl get_slo_penalty_control(int mode = 0) const
{
rs2_error* e = nullptr;
STSloPenaltyControl group{};
rs2_get_slo_penalty_control(_dev.get(), &group, mode, &e);
rs2::error::handle(e);
return group;
}
void set_hdad(const STHdad& group)
{
rs2_error* e = nullptr;
rs2_set_hdad(_dev.get(), &group, &e);
rs2::error::handle(e);
}
STHdad get_hdad(int mode = 0) const
{
rs2_error* e = nullptr;
STHdad group{};
rs2_get_hdad(_dev.get(), &group, mode, &e);
rs2::error::handle(e);
return group;
}
void set_color_correction(const STColorCorrection& group)
{
rs2_error* e = nullptr;
rs2_set_color_correction(_dev.get(), &group, &e);
rs2::error::handle(e);
}
STColorCorrection get_color_correction(int mode = 0) const
{
rs2_error* e = nullptr;
STColorCorrection group{};
rs2_get_color_correction(_dev.get(), &group, mode, &e);
rs2::error::handle(e);
return group;
}
void set_depth_table(const STDepthTableControl& group)
{
rs2_error* e = nullptr;
rs2_set_depth_table(_dev.get(), &group, &e);
rs2::error::handle(e);
}
STDepthTableControl get_depth_table(int mode = 0) const
{
rs2_error* e = nullptr;
STDepthTableControl group{};
rs2_get_depth_table(_dev.get(), &group, mode, &e);
rs2::error::handle(e);
return group;
}
void set_ae_control(const STAEControl& group)
{
rs2_error* e = nullptr;
rs2_set_ae_control(_dev.get(), &group, &e);
rs2::error::handle(e);
}
STAEControl get_ae_control(int mode = 0) const
{
rs2_error* e = nullptr;
STAEControl group{};
rs2_get_ae_control(_dev.get(), &group, mode, &e);
rs2::error::handle(e);
return group;
}
void set_census(const STCensusRadius& group)
{
rs2_error* e = nullptr;
rs2_set_census(_dev.get(), &group, &e);
rs2::error::handle(e);
}
STCensusRadius get_census(int mode = 0) const
{
rs2_error* e = nullptr;
STCensusRadius group{};
rs2_get_census(_dev.get(), &group, mode, &e);
rs2::error::handle(e);
return group;
}
void set_amp_factor(const STAFactor& group)
{
rs2_error* e = nullptr;
rs2_set_amp_factor(_dev.get(), &group, &e);
rs2::error::handle(e);
}
STAFactor get_amp_factor(int mode = 0) const
{
rs2_error* e = nullptr;
STAFactor group{};
rs2_get_amp_factor(_dev.get(), &group, mode, &e);
rs2::error::handle(e);
return group;
}
};
}
inline std::ostream & operator << (std::ostream & o, rs2_rs400_visual_preset preset) { return o << rs2_rs400_visual_preset_to_string(preset); }
inline bool operator==(const STDepthControlGroup& a, const STDepthControlGroup& b)
{
return (a.plusIncrement == b.plusIncrement &&
a.minusDecrement == b.minusDecrement &&
a.deepSeaMedianThreshold == b.deepSeaMedianThreshold &&
a.scoreThreshA == b.scoreThreshA &&
a.scoreThreshB == b.scoreThreshB &&
a.textureDifferenceThreshold == b.textureDifferenceThreshold &&
a.textureCountThreshold == b.textureCountThreshold &&
a.deepSeaSecondPeakThreshold == b.deepSeaSecondPeakThreshold &&
a.deepSeaNeighborThreshold == b.deepSeaNeighborThreshold &&
a.lrAgreeThreshold == b.lrAgreeThreshold);
}
inline bool operator==(const STRsm& a, const STRsm& b)
{
return (a.rsmBypass == b.rsmBypass &&
a.diffThresh == b.diffThresh &&
a.sloRauDiffThresh == b.sloRauDiffThresh &&
a.removeThresh == b.removeThresh);
}
inline bool operator==(const STRauSupportVectorControl& a, const STRauSupportVectorControl& b)
{
return (a.minWest == b.minWest &&
a.minEast == b.minEast &&
a.minWEsum == b.minWEsum &&
a.minNorth == b.minNorth &&
a.minSouth == b.minSouth &&
a.minNSsum == b.minNSsum &&
a.uShrink == b.uShrink &&
a.vShrink == b.vShrink);
}
inline bool operator==(const STColorControl& a, const STColorControl& b)
{
return (a.disableSADColor == b.disableSADColor &&
a.disableRAUColor == b.disableRAUColor &&
a.disableSLORightColor == b.disableSLORightColor &&
a.disableSLOLeftColor == b.disableSLOLeftColor &&
a.disableSADNormalize == b.disableSADNormalize);
}
inline bool operator==(const STRauColorThresholdsControl& a, const STRauColorThresholdsControl& b)
{
return (a.rauDiffThresholdRed == b.rauDiffThresholdRed &&
a.rauDiffThresholdGreen == b.rauDiffThresholdGreen &&
a.rauDiffThresholdBlue == b.rauDiffThresholdBlue);
}
inline bool operator==(const STSloColorThresholdsControl& a, const STSloColorThresholdsControl& b)
{
return (a.diffThresholdRed == b.diffThresholdRed &&
a.diffThresholdGreen == b.diffThresholdGreen &&
a.diffThresholdBlue == b.diffThresholdBlue);
}
inline bool operator==(const STSloPenaltyControl& a, const STSloPenaltyControl& b)
{
return (a.sloK1Penalty == b.sloK1Penalty &&
a.sloK2Penalty == b.sloK2Penalty &&
a.sloK1PenaltyMod1 == b.sloK1PenaltyMod1 &&
a.sloK2PenaltyMod1 == b.sloK2PenaltyMod1 &&
a.sloK1PenaltyMod2 == b.sloK1PenaltyMod2 &&
a.sloK2PenaltyMod2 == b.sloK2PenaltyMod2);
}
inline bool operator==(const STHdad& a, const STHdad& b)
{
return (a.lambdaCensus == b.lambdaCensus &&
a.lambdaAD == b.lambdaAD &&
a.ignoreSAD == b.ignoreSAD);
}
inline bool operator==(const STColorCorrection& a, const STColorCorrection& b)
{
return (a.colorCorrection1 == b.colorCorrection1 &&
a.colorCorrection2 == b.colorCorrection2 &&
a.colorCorrection3 == b.colorCorrection3 &&
a.colorCorrection4 == b.colorCorrection4 &&
a.colorCorrection5 == b.colorCorrection5 &&
a.colorCorrection6 == b.colorCorrection6 &&
a.colorCorrection7 == b.colorCorrection7 &&
a.colorCorrection8 == b.colorCorrection8 &&
a.colorCorrection9 == b.colorCorrection9 &&
a.colorCorrection10 == b.colorCorrection10 &&
a.colorCorrection11 == b.colorCorrection11 &&
a.colorCorrection12 == b.colorCorrection12);
}
inline bool operator==(const STAEControl& a, const STAEControl& b)
{
return (a.meanIntensitySetPoint == b.meanIntensitySetPoint);
}
inline bool operator==(const STDepthTableControl& a, const STDepthTableControl& b)
{
return (a.depthUnits == b.depthUnits &&
a.depthClampMin == b.depthClampMin &&
a.depthClampMax == b.depthClampMax &&
a.disparityMode == b.disparityMode &&
a.disparityShift == b.disparityShift);
}
inline bool operator==(const STCensusRadius& a, const STCensusRadius& b)
{
return (a.uDiameter == b.uDiameter &&
a.vDiameter == b.vDiameter);
}
inline bool operator==(const STAFactor& a, const STAFactor& b)
{
return (fabs(a.amplitude - b.amplitude) < std::numeric_limits<float>::epsilon());
}
#endif // R4XX_ADVANCED_MODE_HPP