Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
rs_advanced_mode.hpp
Go to the documentation of this file.
1 /* License: Apache 2.0. See LICENSE file in root directory.
2  Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
3 
4 #ifndef R4XX_ADVANCED_MODE_HPP
5 #define R4XX_ADVANCED_MODE_HPP
6 
7 #include <cmath>
8 #include "rs.hpp"
9 #include "rs_advanced_mode.h"
11 
12 namespace rs400
13 {
15  {
16  public:
19  {
20  rs2_error* e = nullptr;
22  {
23  _dev = nullptr;
24  }
26  }
27 
28  void toggle_advanced_mode(bool enable)
29  {
30  rs2_error* e = nullptr;
31  rs2_toggle_advanced_mode(_dev.get(), enable, &e);
33  }
34 
35  bool is_enabled() const
36  {
37  rs2_error* e = nullptr;
38  int enabled=0;
39  rs2_is_enabled(_dev.get(), &enabled, &e);
41 
42  return !!enabled;
43  }
44 
46  {
47  rs2_error* e = nullptr;
48  rs2_set_depth_control(_dev.get(), &group, &e);
50  }
51 
53  {
54  rs2_error* e = nullptr;
55  STDepthControlGroup group{};
56  rs2_get_depth_control(_dev.get(), &group, mode, &e);
58 
59  return group;
60  }
61 
62  void set_rsm(const STRsm& group)
63  {
64  rs2_error* e = nullptr;
65  rs2_set_rsm(_dev.get(), &group, &e);
67  }
68 
69  STRsm get_rsm(int mode = 0) const
70  {
71  rs2_error* e = nullptr;
72  STRsm group{};
73  rs2_get_rsm(_dev.get(), &group, mode, &e);
75 
76  return group;
77  }
78 
80  {
81  rs2_error* e = nullptr;
82  rs2_set_rau_support_vector_control(_dev.get(), &group, &e);
84  }
85 
87  {
88  rs2_error* e = nullptr;
90  rs2_get_rau_support_vector_control(_dev.get(), &group, mode, &e);
92 
93  return group;
94  }
95 
96  void set_color_control(const STColorControl& group)
97  {
98  rs2_error* e = nullptr;
99  rs2_set_color_control(_dev.get(), &group, &e);
101  }
102 
103  STColorControl get_color_control(int mode = 0) const
104  {
105  rs2_error* e = nullptr;
106  STColorControl group{};
107  rs2_get_color_control(_dev.get(), &group, mode, &e);
109 
110  return group;
111  }
112 
114  {
115  rs2_error* e = nullptr;
116  rs2_set_rau_thresholds_control(_dev.get(), &group, &e);
118  }
119 
121  {
122  rs2_error* e = nullptr;
124  rs2_get_rau_thresholds_control(_dev.get(), &group, mode, &e);
126 
127  return group;
128  }
129 
131  {
132  rs2_error* e = nullptr;
133  rs2_set_slo_color_thresholds_control(_dev.get(), &group, &e);
135  }
136 
138  {
139  rs2_error* e = nullptr;
141  rs2_get_slo_color_thresholds_control(_dev.get(), &group, mode, &e);
143 
144  return group;
145  }
146 
148  {
149  rs2_error* e = nullptr;
150  rs2_set_slo_penalty_control(_dev.get(), &group, &e);
152  }
153 
155  {
156  rs2_error* e = nullptr;
157  STSloPenaltyControl group{};
158  rs2_get_slo_penalty_control(_dev.get(), &group, mode, &e);
160 
161  return group;
162  }
163 
164  void set_hdad(const STHdad& group)
165  {
166  rs2_error* e = nullptr;
167  rs2_set_hdad(_dev.get(), &group, &e);
169  }
170 
171  STHdad get_hdad(int mode = 0) const
172  {
173  rs2_error* e = nullptr;
174  STHdad group{};
175  rs2_get_hdad(_dev.get(), &group, mode, &e);
177 
178  return group;
179  }
180 
182  {
183  rs2_error* e = nullptr;
184  rs2_set_color_correction(_dev.get(), &group, &e);
186  }
187 
189  {
190  rs2_error* e = nullptr;
191  STColorCorrection group{};
192  rs2_get_color_correction(_dev.get(), &group, mode, &e);
194 
195  return group;
196  }
197 
199  {
200  rs2_error* e = nullptr;
201  rs2_set_depth_table(_dev.get(), &group, &e);
203  }
204 
206  {
207  rs2_error* e = nullptr;
208  STDepthTableControl group{};
209  rs2_get_depth_table(_dev.get(), &group, mode, &e);
211 
212  return group;
213  }
214 
215  void set_ae_control(const STAEControl& group)
216  {
217  rs2_error* e = nullptr;
218  rs2_set_ae_control(_dev.get(), &group, &e);
220  }
221 
222  STAEControl get_ae_control(int mode = 0) const
223  {
224  rs2_error* e = nullptr;
225  STAEControl group{};
226  rs2_get_ae_control(_dev.get(), &group, mode, &e);
228 
229  return group;
230  }
231 
232  void set_census(const STCensusRadius& group)
233  {
234  rs2_error* e = nullptr;
235  rs2_set_census(_dev.get(), &group, &e);
237  }
238 
239  STCensusRadius get_census(int mode = 0) const
240  {
241  rs2_error* e = nullptr;
242  STCensusRadius group{};
243  rs2_get_census(_dev.get(), &group, mode, &e);
245 
246  return group;
247  }
248 
249  void set_amp_factor(const STAFactor& group)
250  {
251  rs2_error* e = nullptr;
252  rs2_set_amp_factor(_dev.get(), &group, &e);
254  }
255 
256  STAFactor get_amp_factor(int mode = 0) const
257  {
258  rs2_error* e = nullptr;
259  STAFactor group{};
260  rs2_get_amp_factor(_dev.get(), &group, mode, &e);
262 
263  return group;
264  }
265  };
266 }
267 
268 inline std::ostream & operator << (std::ostream & o, rs2_rs400_visual_preset preset) { return o << rs2_rs400_visual_preset_to_string(preset); }
269 
270 inline bool operator==(const STDepthControlGroup& a, const STDepthControlGroup& b)
271 {
272  return (a.plusIncrement == b.plusIncrement &&
275  a.scoreThreshA == b.scoreThreshA &&
276  a.scoreThreshB == b.scoreThreshB &&
282 }
283 
284 inline bool operator==(const STRsm& a, const STRsm& b)
285 {
286  return (a.rsmBypass == b.rsmBypass &&
287  a.diffThresh == b.diffThresh &&
289  a.removeThresh == b.removeThresh);
290 }
291 
293 {
294  return (a.minWest == b.minWest &&
295  a.minEast == b.minEast &&
296  a.minWEsum == b.minWEsum &&
297  a.minNorth == b.minNorth &&
298  a.minSouth == b.minSouth &&
299  a.minNSsum == b.minNSsum &&
300  a.uShrink == b.uShrink &&
301  a.vShrink == b.vShrink);
302 }
303 
304 inline bool operator==(const STColorControl& a, const STColorControl& b)
305 {
306  return (a.disableSADColor == b.disableSADColor &&
311 }
312 
314 {
315  return (a.rauDiffThresholdRed == b.rauDiffThresholdRed &&
318 }
319 
321 {
322  return (a.diffThresholdRed == b.diffThresholdRed &&
325 }
326 
327 inline bool operator==(const STSloPenaltyControl& a, const STSloPenaltyControl& b)
328 {
329  return (a.sloK1Penalty == b.sloK1Penalty &&
330  a.sloK2Penalty == b.sloK2Penalty &&
335 }
336 
337 inline bool operator==(const STHdad& a, const STHdad& b)
338 {
339  return (a.lambdaCensus == b.lambdaCensus &&
340  a.lambdaAD == b.lambdaAD &&
341  a.ignoreSAD == b.ignoreSAD);
342 }
343 
344 inline bool operator==(const STColorCorrection& a, const STColorCorrection& b)
345 {
346  return (a.colorCorrection1 == b.colorCorrection1 &&
358 }
359 
360 inline bool operator==(const STAEControl& a, const STAEControl& b)
361 {
363 }
364 
365 inline bool operator==(const STDepthTableControl& a, const STDepthTableControl& b)
366 {
367  return (a.depthUnits == b.depthUnits &&
368  a.depthClampMin == b.depthClampMin &&
369  a.depthClampMax == b.depthClampMax &&
370  a.disparityMode == b.disparityMode &&
372 }
373 
374 inline bool operator==(const STCensusRadius& a, const STCensusRadius& b)
375 {
376  return (a.uDiameter == b.uDiameter &&
377  a.vDiameter == b.vDiameter);
378 }
379 
380 inline bool operator==(const STAFactor& a, const STAFactor& b)
381 {
382  return (fabs(a.amplitude - b.amplitude) < std::numeric_limits<float>::epsilon());
383 }
384 
385 
386 #endif // R4XX_ADVANCED_MODE_HPP
STCensusRadius get_census(int mode=0) const
Definition: rs_advanced_mode.hpp:239
void set_color_control(const STColorControl &group)
Definition: rs_advanced_mode.hpp:96
uint32_t uDiameter
Definition: rs_advanced_mode_command.h:121
STSloColorThresholdsControl get_slo_color_thresholds_control(int mode=0) const
Definition: rs_advanced_mode.hpp:137
void set_slo_color_thresholds_control(const STSloColorThresholdsControl &group)
Definition: rs_advanced_mode.hpp:130
uint32_t minNorth
Definition: rs_advanced_mode_command.h:41
void rs2_set_depth_table(rs2_device *dev, const STDepthTableControl *group, rs2_error **error)
uint32_t sloK2PenaltyMod1
Definition: rs_advanced_mode_command.h:76
void rs2_set_hdad(rs2_device *dev, const STHdad *group, rs2_error **error)
void rs2_toggle_advanced_mode(rs2_device *dev, int enable, rs2_error **error)
float colorCorrection2
Definition: rs_advanced_mode_command.h:92
uint32_t rauDiffThresholdGreen
Definition: rs_advanced_mode_command.h:60
void rs2_get_depth_control(rs2_device *dev, STDepthControlGroup *group, int mode, rs2_error **error)
Definition: rs_advanced_mode_command.h:48
void rs2_set_depth_control(rs2_device *dev, const STDepthControlGroup *group, rs2_error **error)
STHdad get_hdad(int mode=0) const
Definition: rs_advanced_mode.hpp:171
void rs2_set_rau_support_vector_control(rs2_device *dev, const STRauSupportVectorControl *group, rs2_error **error)
uint32_t scoreThreshA
Definition: rs_advanced_mode_command.h:19
uint32_t sloK1PenaltyMod1
Definition: rs_advanced_mode_command.h:75
void set_slo_penalty_control(const STSloPenaltyControl &group)
Definition: rs_advanced_mode.hpp:147
float diffThresh
Definition: rs_advanced_mode_command.h:31
uint32_t scoreThreshB
Definition: rs_advanced_mode_command.h:20
void rs2_get_rau_support_vector_control(rs2_device *dev, STRauSupportVectorControl *group, int mode, rs2_error **error)
float colorCorrection11
Definition: rs_advanced_mode_command.h:101
uint32_t textureDifferenceThreshold
Definition: rs_advanced_mode_command.h:21
Definition: rs_advanced_mode_command.h:14
uint32_t diffThresholdRed
Definition: rs_advanced_mode_command.h:66
void set_ae_control(const STAEControl &group)
Definition: rs_advanced_mode.hpp:215
uint32_t plusIncrement
Definition: rs_advanced_mode_command.h:16
int32_t depthClampMax
Definition: rs_advanced_mode_command.h:114
uint32_t rauDiffThresholdRed
Definition: rs_advanced_mode_command.h:59
void set_census(const STCensusRadius &group)
Definition: rs_advanced_mode.hpp:232
uint32_t sloK2Penalty
Definition: rs_advanced_mode_command.h:74
STDepthTableControl get_depth_table(int mode=0) const
Definition: rs_advanced_mode.hpp:205
Definition: rs_context.hpp:11
Definition: rs_types.h:151
uint32_t ignoreSAD
Definition: rs_advanced_mode_command.h:86
uint32_t rsmBypass
Definition: rs_advanced_mode_command.h:30
float colorCorrection7
Definition: rs_advanced_mode_command.h:97
void rs2_is_enabled(rs2_device *dev, int *enabled, rs2_error **error)
uint32_t sloK1PenaltyMod2
Definition: rs_advanced_mode_command.h:77
uint32_t minWEsum
Definition: rs_advanced_mode_command.h:40
STSloPenaltyControl get_slo_penalty_control(int mode=0) const
Definition: rs_advanced_mode.hpp:154
Definition: rs_advanced_mode_command.h:71
void rs2_get_rau_thresholds_control(rs2_device *dev, STRauColorThresholdsControl *group, int mode, rs2_error **error)
void rs2_set_color_control(rs2_device *dev, const STColorControl *group, rs2_error **error)
void set_depth_control(const STDepthControlGroup &group)
Definition: rs_advanced_mode.hpp:45
advanced_mode(rs2::device d)
Definition: rs_advanced_mode.hpp:17
void rs2_set_ae_control(rs2_device *dev, const STAEControl *group, rs2_error **error)
Definition: rs_advanced_mode_command.h:28
void rs2_get_hdad(rs2_device *dev, STHdad *group, int mode, rs2_error **error)
void rs2_set_slo_color_thresholds_control(rs2_device *dev, const STSloColorThresholdsControl *group, rs2_error **error)
STColorControl get_color_control(int mode=0) const
Definition: rs_advanced_mode.hpp:103
uint32_t textureCountThreshold
Definition: rs_advanced_mode_command.h:22
void rs2_get_amp_factor(rs2_device *dev, STAFactor *group, int mode, rs2_error **error)
float colorCorrection12
Definition: rs_advanced_mode_command.h:102
void rs2_get_color_control(rs2_device *dev, STColorControl *group, int mode, rs2_error **error)
uint32_t vDiameter
Definition: rs_advanced_mode_command.h:122
void set_depth_table(const STDepthTableControl &group)
Definition: rs_advanced_mode.hpp:198
void rs2_set_amp_factor(rs2_device *dev, const STAFactor *group, rs2_error **error)
uint32_t sloK2PenaltyMod2
Definition: rs_advanced_mode_command.h:78
STRauColorThresholdsControl get_rau_thresholds_control(int mode=0) const
Definition: rs_advanced_mode.hpp:120
bool is_enabled() const
Definition: rs_advanced_mode.hpp:35
STColorCorrection get_color_correction(int mode=0) const
Definition: rs_advanced_mode.hpp:188
Definition: rs_advanced_mode_command.h:125
uint32_t disableRAUColor
Definition: rs_advanced_mode_command.h:51
float amplitude
Definition: rs_advanced_mode_command.h:127
void rs2_get_census(rs2_device *dev, STCensusRadius *group, int mode, rs2_error **error)
void set_rau_thresholds_control(const STRauColorThresholdsControl &group)
Definition: rs_advanced_mode.hpp:113
int rs2_is_device_extendable_to(const rs2_device *device, rs2_extension extension, rs2_error **error)
uint32_t minEast
Definition: rs_advanced_mode_command.h:39
Definition: rs_advanced_mode_command.h:64
float lambdaAD
Definition: rs_advanced_mode_command.h:85
uint32_t vShrink
Definition: rs_advanced_mode_command.h:45
uint32_t rauDiffThresholdBlue
Definition: rs_advanced_mode_command.h:61
std::shared_ptr< rs2_device > _dev
Definition: rs_device.hpp:207
Definition: rs_advanced_mode_command.h:89
serializable_device(rs2::device d)
Definition: rs_serializable_device.hpp:15
STDepthControlGroup get_depth_control(int mode=0) const
Definition: rs_advanced_mode.hpp:52
void rs2_get_depth_table(rs2_device *dev, STDepthTableControl *group, int mode, rs2_error **error)
void toggle_advanced_mode(bool enable)
Definition: rs_advanced_mode.hpp:28
Definition: rs_advanced_mode_command.h:105
Definition: rs_advanced_mode_command.h:119
uint32_t minusDecrement
Definition: rs_advanced_mode_command.h:17
uint32_t sloK1Penalty
Definition: rs_advanced_mode_command.h:73
static void handle(rs2_error *e)
Definition: rs_types.hpp:162
STAFactor get_amp_factor(int mode=0) const
Definition: rs_advanced_mode.hpp:256
void rs2_get_ae_control(rs2_device *dev, STAEControl *group, int mode, rs2_error **error)
bool operator==(const STDepthControlGroup &a, const STDepthControlGroup &b)
Definition: rs_advanced_mode.hpp:270
uint32_t disableSLORightColor
Definition: rs_advanced_mode_command.h:52
uint32_t lrAgreeThreshold
Definition: rs_advanced_mode_command.h:25
float colorCorrection3
Definition: rs_advanced_mode_command.h:93
void set_hdad(const STHdad &group)
Definition: rs_advanced_mode.hpp:164
STAEControl get_ae_control(int mode=0) const
Definition: rs_advanced_mode.hpp:222
uint32_t deepSeaMedianThreshold
Definition: rs_advanced_mode_command.h:18
Definition: rs_advanced_mode.hpp:12
float colorCorrection1
Definition: rs_advanced_mode_command.h:91
void rs2_set_rsm(rs2_device *dev, const STRsm *group, rs2_error **error)
int32_t disparityShift
Definition: rs_advanced_mode_command.h:116
Definition: rs_advanced_mode_command.h:82
uint32_t minNSsum
Definition: rs_advanced_mode_command.h:43
float colorCorrection6
Definition: rs_advanced_mode_command.h:96
uint32_t minWest
Definition: rs_advanced_mode_command.h:38
uint32_t meanIntensitySetPoint
Definition: rs_advanced_mode_command.h:107
void set_rau_support_vector_control(const STRauSupportVectorControl &group)
Definition: rs_advanced_mode.hpp:79
void rs2_set_census(rs2_device *dev, const STCensusRadius *group, rs2_error **error)
float colorCorrection5
Definition: rs_advanced_mode_command.h:95
uint32_t disableSADColor
Definition: rs_advanced_mode_command.h:50
int32_t depthClampMin
Definition: rs_advanced_mode_command.h:113
rs2_rs400_visual_preset
For RS400 devices: provides optimized settings (presets) for specific types of usage.
Definition: rs_option.h:212
float lambdaCensus
Definition: rs_advanced_mode_command.h:84
Definition: rs_advanced_mode.hpp:14
void set_color_correction(const STColorCorrection &group)
Definition: rs_advanced_mode.hpp:181
void rs2_set_color_correction(rs2_device *dev, const STColorCorrection *group, rs2_error **error)
void rs2_get_slo_penalty_control(rs2_device *dev, STSloPenaltyControl *group, int mode, rs2_error **error)
void rs2_get_slo_color_thresholds_control(rs2_device *dev, STSloColorThresholdsControl *group, int mode, rs2_error **error)
uint32_t depthUnits
Definition: rs_advanced_mode_command.h:112
uint32_t diffThresholdBlue
Definition: rs_advanced_mode_command.h:68
void rs2_get_rsm(rs2_device *dev, STRsm *group, int mode, rs2_error **error)
uint32_t deepSeaNeighborThreshold
Definition: rs_advanced_mode_command.h:24
float colorCorrection4
Definition: rs_advanced_mode_command.h:94
uint32_t disparityMode
Definition: rs_advanced_mode_command.h:115
Definition: rs_advanced_mode_command.h:57
float colorCorrection10
Definition: rs_advanced_mode_command.h:100
std::ostream & operator<<(std::ostream &o, rs2_rs400_visual_preset preset)
Definition: rs_advanced_mode.hpp:268
void set_rsm(const STRsm &group)
Definition: rs_advanced_mode.hpp:62
uint32_t removeThresh
Definition: rs_advanced_mode_command.h:33
const char * rs2_rs400_visual_preset_to_string(rs2_rs400_visual_preset preset)
STRsm get_rsm(int mode=0) const
Definition: rs_advanced_mode.hpp:69
float colorCorrection9
Definition: rs_advanced_mode_command.h:99
void rs2_set_rau_thresholds_control(rs2_device *dev, const STRauColorThresholdsControl *group, rs2_error **error)
struct rs2_error rs2_error
Definition: rs_types.h:229
Definition: rs_advanced_mode_command.h:110
Definition: rs_device.hpp:19
void set_amp_factor(const STAFactor &group)
Definition: rs_advanced_mode.hpp:249
uint32_t diffThresholdGreen
Definition: rs_advanced_mode_command.h:67
STRauSupportVectorControl get_rau_support_vector_control(int mode=0) const
Definition: rs_advanced_mode.hpp:86
void rs2_set_slo_penalty_control(rs2_device *dev, const STSloPenaltyControl *group, rs2_error **error)
Definition: rs_serializable_device.hpp:12
float sloRauDiffThresh
Definition: rs_advanced_mode_command.h:32
void rs2_get_color_correction(rs2_device *dev, STColorCorrection *group, int mode, rs2_error **error)
uint32_t uShrink
Definition: rs_advanced_mode_command.h:44
Definition: rs_advanced_mode_command.h:36
uint32_t minSouth
Definition: rs_advanced_mode_command.h:42
float colorCorrection8
Definition: rs_advanced_mode_command.h:98
uint32_t disableSLOLeftColor
Definition: rs_advanced_mode_command.h:53
uint32_t deepSeaSecondPeakThreshold
Definition: rs_advanced_mode_command.h:23
uint32_t disableSADNormalize
Definition: rs_advanced_mode_command.h:54