Intel® RealSense™ Cross Platform API  2.13.0
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 "rs.hpp"
8 #include "rs_advanced_mode.h"
9 
10 namespace rs400
11 {
12  class advanced_mode : public rs2::device
13  {
14  public:
16  : rs2::device(d.get())
17  {
18  rs2_error* e = nullptr;
20  {
21  _dev = nullptr;
22  }
24  }
25 
26  void toggle_advanced_mode(bool enable)
27  {
28  rs2_error* e = nullptr;
29  rs2_toggle_advanced_mode(_dev.get(), enable, &e);
31  }
32 
33  bool is_enabled() const
34  {
35  rs2_error* e = nullptr;
36  int enabled=0;
37  rs2_is_enabled(_dev.get(), &enabled, &e);
39 
40  return !!enabled;
41  }
42 
44  {
45  rs2_error* e = nullptr;
46  rs2_set_depth_control(_dev.get(), &group, &e);
48  }
49 
51  {
52  rs2_error* e = nullptr;
53  STDepthControlGroup group{};
54  rs2_get_depth_control(_dev.get(), &group, mode, &e);
56 
57  return group;
58  }
59 
60  void set_rsm(const STRsm& group)
61  {
62  rs2_error* e = nullptr;
63  rs2_set_rsm(_dev.get(), &group, &e);
65  }
66 
67  STRsm get_rsm(int mode = 0) const
68  {
69  rs2_error* e = nullptr;
70  STRsm group{};
71  rs2_get_rsm(_dev.get(), &group, mode, &e);
73 
74  return group;
75  }
76 
78  {
79  rs2_error* e = nullptr;
80  rs2_set_rau_support_vector_control(_dev.get(), &group, &e);
82  }
83 
85  {
86  rs2_error* e = nullptr;
88  rs2_get_rau_support_vector_control(_dev.get(), &group, mode, &e);
90 
91  return group;
92  }
93 
94  void set_color_control(const STColorControl& group)
95  {
96  rs2_error* e = nullptr;
97  rs2_set_color_control(_dev.get(), &group, &e);
99  }
100 
101  STColorControl get_color_control(int mode = 0) const
102  {
103  rs2_error* e = nullptr;
104  STColorControl group{};
105  rs2_get_color_control(_dev.get(), &group, mode, &e);
107 
108  return group;
109  }
110 
112  {
113  rs2_error* e = nullptr;
114  rs2_set_rau_thresholds_control(_dev.get(), &group, &e);
116  }
117 
119  {
120  rs2_error* e = nullptr;
122  rs2_get_rau_thresholds_control(_dev.get(), &group, mode, &e);
124 
125  return group;
126  }
127 
129  {
130  rs2_error* e = nullptr;
131  rs2_set_slo_color_thresholds_control(_dev.get(), &group, &e);
133  }
134 
136  {
137  rs2_error* e = nullptr;
139  rs2_get_slo_color_thresholds_control(_dev.get(), &group, mode, &e);
141 
142  return group;
143  }
144 
146  {
147  rs2_error* e = nullptr;
148  rs2_set_slo_penalty_control(_dev.get(), &group, &e);
150  }
151 
153  {
154  rs2_error* e = nullptr;
155  STSloPenaltyControl group{};
156  rs2_get_slo_penalty_control(_dev.get(), &group, mode, &e);
158 
159  return group;
160  }
161 
162  void set_hdad(const STHdad& group)
163  {
164  rs2_error* e = nullptr;
165  rs2_set_hdad(_dev.get(), &group, &e);
167  }
168 
169  STHdad get_hdad(int mode = 0) const
170  {
171  rs2_error* e = nullptr;
172  STHdad group{};
173  rs2_get_hdad(_dev.get(), &group, mode, &e);
175 
176  return group;
177  }
178 
180  {
181  rs2_error* e = nullptr;
182  rs2_set_color_correction(_dev.get(), &group, &e);
184  }
185 
187  {
188  rs2_error* e = nullptr;
189  STColorCorrection group{};
190  rs2_get_color_correction(_dev.get(), &group, mode, &e);
192 
193  return group;
194  }
195 
197  {
198  rs2_error* e = nullptr;
199  rs2_set_depth_table(_dev.get(), &group, &e);
201  }
202 
204  {
205  rs2_error* e = nullptr;
206  STDepthTableControl group{};
207  rs2_get_depth_table(_dev.get(), &group, mode, &e);
209 
210  return group;
211  }
212 
213  void set_ae_control(const STAEControl& group)
214  {
215  rs2_error* e = nullptr;
216  rs2_set_ae_control(_dev.get(), &group, &e);
218  }
219 
220  STAEControl get_ae_control(int mode = 0) const
221  {
222  rs2_error* e = nullptr;
223  STAEControl group{};
224  rs2_get_ae_control(_dev.get(), &group, mode, &e);
226 
227  return group;
228  }
229 
230  void set_census(const STCensusRadius& group)
231  {
232  rs2_error* e = nullptr;
233  rs2_set_census(_dev.get(), &group, &e);
235  }
236 
237  STCensusRadius get_census(int mode = 0) const
238  {
239  rs2_error* e = nullptr;
240  STCensusRadius group{};
241  rs2_get_census(_dev.get(), &group, mode, &e);
243 
244  return group;
245  }
246 
247  std::string serialize_json() const
248  {
249  std::string results;
250 
251  rs2_error* e = nullptr;
252  std::shared_ptr<rs2_raw_data_buffer> json_data(
253  rs2_serialize_json(_dev.get(), &e),
256 
257  auto size = rs2_get_raw_data_size(json_data.get(), &e);
259 
260  auto start = rs2_get_raw_data(json_data.get(), &e);
262 
263  results.insert(results.begin(), start, start + size);
264 
265  return results;
266  }
267 
268  void load_json(const std::string& json_content)
269  {
270  rs2_error* e = nullptr;
271  rs2_load_json(_dev.get(),
272  json_content.data(),
273  (unsigned int)json_content.size(),
274  &e);
276  }
277  };
278 }
279 
280 inline std::ostream & operator << (std::ostream & o, rs2_rs400_visual_preset preset) { return o << rs2_rs400_visual_preset_to_string(preset); }
281 
282 inline bool operator==(const STDepthControlGroup& a, const STDepthControlGroup& b)
283 {
284  return (a.plusIncrement == b.plusIncrement &&
287  a.scoreThreshA == b.scoreThreshA &&
288  a.scoreThreshB == b.scoreThreshB &&
294 }
295 
296 inline bool operator==(const STRsm& a, const STRsm& b)
297 {
298  return (a.rsmBypass == b.rsmBypass &&
299  a.diffThresh == b.diffThresh &&
301  a.removeThresh == b.removeThresh);
302 }
303 
305 {
306  return (a.minWest == b.minWest &&
307  a.minEast == b.minEast &&
308  a.minWEsum == b.minWEsum &&
309  a.minNorth == b.minNorth &&
310  a.minSouth == b.minSouth &&
311  a.minNSsum == b.minNSsum &&
312  a.uShrink == b.uShrink &&
313  a.vShrink == b.vShrink);
314 }
315 
316 inline bool operator==(const STColorControl& a, const STColorControl& b)
317 {
318  return (a.disableSADColor == b.disableSADColor &&
323 }
324 
326 {
327  return (a.rauDiffThresholdRed == b.rauDiffThresholdRed &&
330 }
331 
333 {
334  return (a.diffThresholdRed == b.diffThresholdRed &&
337 }
338 
339 inline bool operator==(const STSloPenaltyControl& a, const STSloPenaltyControl& b)
340 {
341  return (a.sloK1Penalty == b.sloK1Penalty &&
342  a.sloK2Penalty == b.sloK2Penalty &&
347 }
348 
349 inline bool operator==(const STHdad& a, const STHdad& b)
350 {
351  return (a.lambdaCensus == b.lambdaCensus &&
352  a.lambdaAD == b.lambdaAD &&
353  a.ignoreSAD == b.ignoreSAD);
354 }
355 
356 inline bool operator==(const STColorCorrection& a, const STColorCorrection& b)
357 {
358  return (a.colorCorrection1 == b.colorCorrection1 &&
370 }
371 
372 inline bool operator==(const STAEControl& a, const STAEControl& b)
373 {
375 }
376 
377 inline bool operator==(const STDepthTableControl& a, const STDepthTableControl& b)
378 {
379  return (a.depthUnits == b.depthUnits &&
380  a.depthClampMin == b.depthClampMin &&
381  a.depthClampMax == b.depthClampMax &&
382  a.disparityMode == b.disparityMode &&
384 }
385 
386 inline bool operator==(const STCensusRadius& a, const STCensusRadius& b)
387 {
388  return (a.uDiameter == b.uDiameter &&
389  a.vDiameter == b.vDiameter);
390 }
391 
392 
393 #endif // R4XX_ADVANCED_MODE_HPP
STCensusRadius get_census(int mode=0) const
Definition: rs_advanced_mode.hpp:237
void set_color_control(const STColorControl &group)
Definition: rs_advanced_mode.hpp:94
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:135
void set_slo_color_thresholds_control(const STSloColorThresholdsControl &group)
Definition: rs_advanced_mode.hpp:128
uint32_t minNorth
Definition: rs_advanced_mode_command.h:41
void load_json(const std::string &json_content)
Definition: rs_advanced_mode.hpp:268
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)
device()
Definition: rs_device.hpp:110
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:169
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:145
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:213
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:230
const unsigned char * rs2_get_raw_data(const rs2_raw_data_buffer *buffer, rs2_error **error)
uint32_t sloK2Penalty
Definition: rs_advanced_mode_command.h:74
STDepthTableControl get_depth_table(int mode=0) const
Definition: rs_advanced_mode.hpp:203
Definition: rs_context.hpp:11
void rs2_delete_raw_data(const rs2_raw_data_buffer *buffer)
Definition: rs_types.h:109
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:152
int rs2_get_raw_data_size(const rs2_raw_data_buffer *buffer, rs2_error **error)
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:43
advanced_mode(rs2::device d)
Definition: rs_advanced_mode.hpp:15
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:101
uint32_t textureCountThreshold
Definition: rs_advanced_mode_command.h:22
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:196
std::string serialize_json() const
Definition: rs_advanced_mode.hpp:247
uint32_t sloK2PenaltyMod2
Definition: rs_advanced_mode_command.h:78
STRauColorThresholdsControl get_rau_thresholds_control(int mode=0) const
Definition: rs_advanced_mode.hpp:118
bool is_enabled() const
Definition: rs_advanced_mode.hpp:33
STColorCorrection get_color_correction(int mode=0) const
Definition: rs_advanced_mode.hpp:186
uint32_t disableRAUColor
Definition: rs_advanced_mode_command.h:51
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:111
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
const std::shared_ptr< rs2_device > & get() const
Definition: rs_device.hpp:116
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:143
Definition: rs_advanced_mode_command.h:89
STDepthControlGroup get_depth_control(int mode=0) const
Definition: rs_advanced_mode.hpp:50
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:26
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:121
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:282
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:162
STAEControl get_ae_control(int mode=0) const
Definition: rs_advanced_mode.hpp:220
void rs2_load_json(rs2_device *dev, const void *json_content, unsigned content_size, rs2_error **error)
uint32_t deepSeaMedianThreshold
Definition: rs_advanced_mode_command.h:18
Definition: rs_advanced_mode.hpp:10
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:77
void rs2_set_census(rs2_device *dev, const STCensusRadius *group, rs2_error **error)
rs2_raw_data_buffer * rs2_serialize_json(rs2_device *dev, 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:90
float lambdaCensus
Definition: rs_advanced_mode_command.h:84
Definition: rs_advanced_mode.hpp:12
void set_color_correction(const STColorCorrection &group)
Definition: rs_advanced_mode.hpp:179
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:280
void set_rsm(const STRsm &group)
Definition: rs_advanced_mode.hpp:60
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:67
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:149
Definition: rs_advanced_mode_command.h:110
Definition: rs_device.hpp:18
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:84
void rs2_set_slo_penalty_control(rs2_device *dev, const STSloPenaltyControl *group, rs2_error **error)
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