Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
json_loader.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 #pragma once
5 
6 #include <fstream>
7 
8 #include <chrono>
9 #include <thread>
10 #include <sstream>
11 #include <map>
12 #include <string>
13 #include <iomanip>
14 
15 #include "../../../third-party/json.hpp"
17 #include "types.h"
18 #include "presets.h"
19 
20 namespace librealsense
21 {
23 
24  template<class T>
25  struct param_group
26  {
27  using group_type = T;
28  T vals[3];
29  bool update = false;
30  };
31 
64 
65  preset_param_group(const preset& other)
66  {
67  copy(other);
68  }
69 
71  {
72  copy(other);
73  return *this;
74  }
75  private:
76  void copy(const preset& other)
77  {
79  rsm.vals[0] = other.rsm;
80  rsvc.vals[0] = other.rsvc;
81  color_control.vals[0] = other.color_control;
82  rctc.vals[0] = other.rctc;
83  sctc.vals[0] = other.sctc;
84  spc.vals[0] = other.spc;
85  hdad.vals[0] = other.hdad;
86  cc.vals[0] = other.cc;
87  depth_table.vals[0] = other.depth_table;
88  ae.vals[0] = other.ae;
89  census.vals[0] = other.census;
90  laser_state.vals[0] = other.laser_state;
91  laser_power.vals[0] = other.laser_power;
92  depth_exposure.vals[0] = other.depth_exposure;
94  depth_gain.vals[0] = other.depth_gain;
96  color_exposure.vals[0] = other.color_exposure;
99  color_brightness.vals[0] = other.color_brightness;
100  color_contrast.vals[0] = other.color_contrast;
101  color_gain.vals[0] = other.color_gain;
102  color_gamma.vals[0] = other.color_gamma;
103  color_hue.vals[0] = other.color_hue;
104  color_saturation.vals[0] = other.color_saturation;
105  color_sharpness.vals[0] = other.color_sharpness;
109  }
110  };
111 
112  struct json_field
113  {
114  virtual ~json_field() = default;
115 
116  bool was_set = false;
117  // Duplicated fields will not be in the generated JSON file but will be processed as an input for backward compatibility
118  bool is_duplicated = false;
119 
120  virtual void load(const std::string& value) = 0;
121  virtual std::string save() const = 0;
122  };
123 
124  template<class T, class S>
126  {
127  T* strct;
128  S T::group_type::* field;
129  float scale = 1.0f;
130  bool check_ranges = true;
131 
132  void load(const std::string& str) override
133  {
134  float value = static_cast<float>(::atof(str.c_str()));
135  strct->vals[0].*field = static_cast<S>(scale * value);
136  strct->update = true;
137  }
138 
139  std::string save() const override
140  {
141  std::stringstream ss;
142  ss << strct->vals[0].*field / scale;
143  return ss.str();
144  }
145  };
146 
148  {
149  void load(const std::string& str) override
150  {}
151 
152  std::string save() const override
153  {
154  return "";
155  }
156  };
157 
158  template<class T, class S>
160  {
161  json_string_struct_field(std::map<std::string, float> values)
162  : _values(values)
163  {}
164  T* strct;
165  S T::group_type::* field;
166 
167  std::map<std::string, float> _values;
168 
169  void load(const std::string& value) override
170  {
171  (strct->vals[0].*field) = static_cast<S>(_values[value]);
172  strct->update = true;
173  }
174 
175  std::string save() const override
176  {
177  std::stringstream ss;
178  auto val = strct->vals[0].*field;
179  auto res = std::find_if(std::begin(_values), std::end(_values), [&](const std::pair<std::string, float> &pair)
180  {
181  return pair.second == val;
182  });
183 
184  if (res == std::end(_values))
185  throw invalid_value_exception(to_string() << "Value not found in map! value=" << val);
186 
187  ss << res->first;
188  return ss.str();
189  }
190  };
191 
192  template<class T, class S>
194  {
197 
198  void load(const std::string& str) override
199  {
200  auto value = ::atof(str.c_str());
201  (strct->vals[0].*field) = (value > 0) ? 0 : 1;
202  strct->update = true;
203  }
204 
205  std::string save() const override
206  {
207  std::stringstream ss;
208  ss << ((strct->vals[0].*field > 0.f) ? 0.f : 1.f);
209  return ss.str();
210  }
211  };
212 
213  template<class T, class S>
214  std::shared_ptr<json_field> make_field(T& strct, S T::group_type::* field, float scale = 1.0f, bool is_duplicated_field = false)
215  {
216  std::shared_ptr<json_struct_field<T, S>> f(new json_struct_field<T, S>());
217  f->field = field;
218  f->strct = &strct;
219  f->scale = scale;
220  f->is_duplicated = is_duplicated_field;
221  return f;
222  }
223 
224  template<class T, class S>
225  std::shared_ptr<json_field> make_string_field(T& strct, S T::group_type::* field, const std::map<std::string, float>& values, bool is_duplicated_field = false)
226  {
227  std::shared_ptr<json_string_struct_field<T, S>> f(new json_string_struct_field<T, S>(values));
228  f->field = field;
229  f->strct = &strct;
230  f->is_duplicated = is_duplicated_field;
231  return f;
232  }
233 
234  std::shared_ptr<json_field> make_ignored_field()
235  {
236  return std::make_shared<json_ignored_field>();
237  }
238 
239  template<class T, class S>
240  std::shared_ptr<json_field> make_invert_field(T& strct, S T::group_type::* field, bool is_duplicated_field = false)
241  {
242  std::shared_ptr<json_invert_struct_field<T, S>> f(new json_invert_struct_field<T, S>());
243  f->field = field;
244  f->strct = &strct;
245  f->is_duplicated = is_duplicated_field;
246  return f;
247  }
248 
249  typedef std::map<std::string, std::shared_ptr<json_field>> parsers_map;
250 
251  template <class T, typename S>
252  void insert_control_to_map(parsers_map& map, bool was_set, const std::string& name,
253  param_group<T>& control, S field)
254  {
255  if (was_set)
256  map.insert({ name, make_field(control, field) });
257  }
258 
259  template <class T, typename S>
260  void insert_string_control_to_map(parsers_map& map, bool was_set, const std::string& name,
261  param_group<T>& control, S field,
262  const std::map<std::string, float>& values)
263  {
264  if (was_set)
265  map.insert({ name, make_string_field(control, field, values) });
266  }
267 
268  template <typename T>
269  void update_preset_control(T& preset_control, const param_group<T>& param)
270  {
271  if (param.update)
272  preset_control = param.vals[0];
273  }
274 
275  template <typename T>
276  void update_preset_camera_control(T& camera_control, const param_group<T>& param)
277  {
278  if (param.update)
279  {
280  camera_control = param.vals[0];
281  camera_control.was_set = true;
282  }
283  }
284 
286  {
287  parsers_map map = {
288  // Depth Control
289  { "param-leftrightthreshold", make_field(p.depth_controls, &STDepthControlGroup::lrAgreeThreshold) },
290  { "param-maxscorethreshb", make_field(p.depth_controls, &STDepthControlGroup::scoreThreshB) },
292  { "param-minscorethresha", make_field(p.depth_controls, &STDepthControlGroup::scoreThreshA) },
293  { "param-texturedifferencethresh", make_field(p.depth_controls, &STDepthControlGroup::textureDifferenceThreshold) },
296  { "param-texturecountthresh", make_field(p.depth_controls, &STDepthControlGroup::textureCountThreshold) },
297  { "param-robbinsmonrodecrement", make_field(p.depth_controls, &STDepthControlGroup::minusDecrement) },
298  { "param-robbinsmonroincrement", make_field(p.depth_controls, &STDepthControlGroup::plusIncrement) },
299 
300  // RSM
301  { "param-usersm", make_invert_field(p.rsm, &STRsm::rsmBypass) },
302  { "param-rsmdiffthreshold", make_field(p.rsm, &STRsm::diffThresh) },
303  { "param-rsmrauslodiffthreshold", make_field(p.rsm, &STRsm::sloRauDiffThresh) },
304  { "param-rsmremovethreshold", make_field(p.rsm, &STRsm::removeThresh, 168.f) },
305 
306  // RAU Support Vector Control
307  { "param-raumine", make_field(p.rsvc, &STRauSupportVectorControl::minEast) },
308  { "param-rauminn", make_field(p.rsvc, &STRauSupportVectorControl::minNorth) },
309  { "param-rauminnssum", make_field(p.rsvc, &STRauSupportVectorControl::minNSsum) },
310  { "param-raumins", make_field(p.rsvc, &STRauSupportVectorControl::minSouth) },
311  { "param-rauminw", make_field(p.rsvc, &STRauSupportVectorControl::minWest) },
312  { "param-rauminwesum", make_field(p.rsvc, &STRauSupportVectorControl::minWEsum) },
313  { "param-regionshrinku", make_field(p.rsvc, &STRauSupportVectorControl::uShrink) },
314  { "param-regionshrinkv", make_field(p.rsvc, &STRauSupportVectorControl::vShrink) },
315 
316  // Color Controls
317  { "param-disableraucolor", make_field(p.color_control, &STColorControl::disableRAUColor) },
318  { "param-disablesadcolor", make_field(p.color_control, &STColorControl::disableSADColor) },
319  { "param-disablesadnormalize", make_field(p.color_control, &STColorControl::disableSADNormalize) },
320  { "param-disablesloleftcolor", make_field(p.color_control, &STColorControl::disableSLOLeftColor) },
321  { "param-disableslorightcolor", make_field(p.color_control, &STColorControl::disableSLORightColor) },
322 
323  // RAU Color Thresholds Control
324  { "param-regioncolorthresholdb", make_field(p.rctc, &STRauColorThresholdsControl::rauDiffThresholdBlue, 1022.f) },
325  { "param-regioncolorthresholdg", make_field(p.rctc, &STRauColorThresholdsControl::rauDiffThresholdGreen, 1022.f) },
326  { "param-regioncolorthresholdr", make_field(p.rctc, &STRauColorThresholdsControl::rauDiffThresholdRed, 1022.f) },
327 
328  // SLO Color Thresholds Control
329  { "param-scanlineedgetaub", make_field(p.sctc, &STSloColorThresholdsControl::diffThresholdBlue) },
330  { "param-scanlineedgetaug", make_field(p.sctc, &STSloColorThresholdsControl::diffThresholdGreen) },
331  { "param-scanlineedgetaur", make_field(p.sctc, &STSloColorThresholdsControl::diffThresholdRed) },
332 
333  // SLO Penalty Control
334  { "param-scanlinep1", make_field(p.spc, &STSloPenaltyControl::sloK1Penalty) },
335  { "param-scanlinep1onediscon", make_field(p.spc, &STSloPenaltyControl::sloK1PenaltyMod1) },
336  { "param-scanlinep1twodiscon", make_field(p.spc, &STSloPenaltyControl::sloK1PenaltyMod2) },
337  { "param-scanlinep2", make_field(p.spc, &STSloPenaltyControl::sloK2Penalty) },
338  { "param-scanlinep2onediscon", make_field(p.spc, &STSloPenaltyControl::sloK2PenaltyMod1) },
339  { "param-scanlinep2twodiscon", make_field(p.spc, &STSloPenaltyControl::sloK2PenaltyMod2) },
340 
341  // HDAD
342  { "param-lambdaad", make_field(p.hdad, &STHdad::lambdaAD) },
343  { "param-lambdacensus", make_field(p.hdad, &STHdad::lambdaCensus) },
344  { "ignoreSAD", make_field(p.hdad, &STHdad::ignoreSAD) },
345 
346  // SLO Penalty Control
347  { "param-colorcorrection1", make_field(p.cc, &STColorCorrection::colorCorrection1, 1.f, true) },
348  { "param-colorcorrection2", make_field(p.cc, &STColorCorrection::colorCorrection2, 1.f, true) },
349  { "param-colorcorrection3", make_field(p.cc, &STColorCorrection::colorCorrection3, 1.f, true) },
350  { "param-colorcorrection4", make_field(p.cc, &STColorCorrection::colorCorrection4, 1.f, true) },
351  { "param-colorcorrection5", make_field(p.cc, &STColorCorrection::colorCorrection5, 1.f, true) },
352  { "param-colorcorrection6", make_field(p.cc, &STColorCorrection::colorCorrection6, 1.f, true) },
353  { "param-colorcorrection7", make_field(p.cc, &STColorCorrection::colorCorrection7, 1.f, true) },
354  { "param-colorcorrection8", make_field(p.cc, &STColorCorrection::colorCorrection8, 1.f, true) },
355  { "param-colorcorrection9", make_field(p.cc, &STColorCorrection::colorCorrection9, 1.f, true) },
356  { "param-colorcorrection10", make_field(p.cc, &STColorCorrection::colorCorrection10, 1.f, true) },
357  { "param-colorcorrection11", make_field(p.cc, &STColorCorrection::colorCorrection11, 1.f, true) },
358  { "param-colorcorrection12", make_field(p.cc, &STColorCorrection::colorCorrection12, 1.f, true) },
359 
360  { "aux-param-colorcorrection1", make_field(p.cc, &STColorCorrection::colorCorrection1) },
361  { "aux-param-colorcorrection2", make_field(p.cc, &STColorCorrection::colorCorrection2) },
362  { "aux-param-colorcorrection3", make_field(p.cc, &STColorCorrection::colorCorrection3) },
363  { "aux-param-colorcorrection4", make_field(p.cc, &STColorCorrection::colorCorrection4) },
364  { "aux-param-colorcorrection5", make_field(p.cc, &STColorCorrection::colorCorrection5) },
365  { "aux-param-colorcorrection6", make_field(p.cc, &STColorCorrection::colorCorrection6) },
366  { "aux-param-colorcorrection7", make_field(p.cc, &STColorCorrection::colorCorrection7) },
367  { "aux-param-colorcorrection8", make_field(p.cc, &STColorCorrection::colorCorrection8) },
368  { "aux-param-colorcorrection9", make_field(p.cc, &STColorCorrection::colorCorrection9) },
369  { "aux-param-colorcorrection10", make_field(p.cc, &STColorCorrection::colorCorrection10) },
370  { "aux-param-colorcorrection11", make_field(p.cc, &STColorCorrection::colorCorrection11) },
371  { "aux-param-colorcorrection12", make_field(p.cc, &STColorCorrection::colorCorrection12) },
372 
373  // Depth Table
374  { "param-depthunits", make_field(p.depth_table, &STDepthTableControl::depthUnits) },
375  { "param-zunits", make_field(p.depth_table, &STDepthTableControl::depthUnits) },
376  { "param-depthclampmin", make_field(p.depth_table, &STDepthTableControl::depthClampMin) },
377  { "param-depthclampmax", make_field(p.depth_table, &STDepthTableControl::depthClampMax) },
378  { "aux-param-depthclampmin", make_field(p.depth_table, &STDepthTableControl::depthClampMin) },
379  { "aux-param-depthclampmax", make_field(p.depth_table, &STDepthTableControl::depthClampMax) },
380  { "param-disparitymode", make_field(p.depth_table, &STDepthTableControl::disparityMode) },
381  { "param-disparityshift", make_field(p.depth_table, &STDepthTableControl::disparityShift) },
382  { "aux-param-disparityshift", make_field(p.depth_table, &STDepthTableControl::disparityShift) },
383 
384  // Auto-Exposure
385  { "param-autoexposure-setpoint", make_field(p.ae, &STAEControl::meanIntensitySetPoint) },
386  { "aux-param-autoexposure-setpoint", make_field(p.ae, &STAEControl::meanIntensitySetPoint) },
387 
388  // Census
389  { "param-censusenablereg-udiameter", make_field(p.census, &STCensusRadius::uDiameter) },
390  { "param-censusenablereg-vdiameter", make_field(p.census, &STCensusRadius::vDiameter) },
391  { "param-censususize", make_field(p.census, &STCensusRadius::uDiameter) },
392  { "param-censusvsize", make_field(p.census, &STCensusRadius::vDiameter) },
393 
394  // Ignored fields
395  { "param-regionspatialthresholdu", make_ignored_field() },
396  { "param-regionspatialthresholdv", make_ignored_field() },
397  { "result:", make_ignored_field() },
398  { "result", make_ignored_field() },
399  { "aux-param-disparitymultiplier", make_ignored_field() },
400  { "stream-depth-format", make_ignored_field() },
401  { "stream-ir-format", make_ignored_field() },
402  { "stream-width", make_ignored_field() },
403  { "stream-height", make_ignored_field() },
404  { "stream-fps", make_ignored_field() },
405  };
406 
407  static const std::map<std::string, float> auto_control_values{ { "False", 0.f }, { "True", 1.f } };
408  // Controls Group
409  // Depth controls
410  static const std::map<std::string, float> laser_state_values{ { "off", 0.f }, { "on", 1.f }, { "auto", 2.f } };
411  insert_string_control_to_map(map, p.laser_state.vals[0].was_set, "controls-laserstate", p.laser_state, &laser_state_control::laser_state, laser_state_values);
412  insert_control_to_map(map, p.laser_power.vals[0].was_set, "controls-laserpower", p.laser_power, &laser_power_control::laser_power);
413 
414  insert_control_to_map(map, p.depth_exposure.vals[0].was_set, "controls-autoexposure-manual", p.depth_exposure, &exposure_control::exposure);
415  insert_string_control_to_map(map, p.depth_auto_exposure.vals[0].was_set, "controls-autoexposure-auto", p.depth_auto_exposure, &auto_exposure_control::auto_exposure, auto_control_values);
416 
417  insert_control_to_map(map, p.depth_gain.vals[0].was_set, "controls-depth-gain", p.depth_gain, &gain_control::gain);
418  insert_string_control_to_map(map, p.depth_auto_white_balance.vals[0].was_set, "controls-depth-white-balance-auto", p.depth_auto_white_balance, &auto_white_balance_control::auto_white_balance, auto_control_values);
419 
420  // Color controls
421  insert_control_to_map(map, p.color_exposure.vals[0].was_set, "controls-color-autoexposure-manual", p.color_exposure, &exposure_control::exposure);
422  insert_string_control_to_map(map, p.color_auto_exposure.vals[0].was_set, "controls-color-autoexposure-auto", p.color_auto_exposure, &auto_exposure_control::auto_exposure, auto_control_values);
423 
425  insert_control_to_map(map, p.color_brightness.vals[0].was_set, "controls-color-brightness", p.color_brightness, &brightness_control::brightness);
426  insert_control_to_map(map, p.color_contrast.vals[0].was_set, "controls-color-contrast", p.color_contrast, &contrast_control::contrast);
427  insert_control_to_map(map, p.color_gain.vals[0].was_set, "controls-color-gain", p.color_gain, &gain_control::gain);
428  insert_control_to_map(map, p.color_gamma.vals[0].was_set, "controls-color-gamma", p.color_gamma, &gamma_control::gamma);
429  insert_control_to_map(map, p.color_hue.vals[0].was_set, "controls-color-hue", p.color_hue, &hue_control::hue);
430  insert_control_to_map(map, p.color_saturation.vals[0].was_set, "controls-color-saturation", p.color_saturation, &saturation_control::saturation);
431  insert_control_to_map(map, p.color_sharpness.vals[0].was_set, "controls-color-sharpness", p.color_sharpness, &sharpness_control::sharpness);
433 
434  insert_control_to_map(map, p.color_white_balance.vals[0].was_set, "controls-color-white-balance-manual", p.color_white_balance, &white_balance_control::white_balance);
435 
436  insert_string_control_to_map(map, p.color_auto_white_balance.vals[0].was_set, "controls-color-white-balance-auto", p.color_auto_white_balance, &auto_white_balance_control::auto_white_balance, auto_control_values);
437  return map;
438  }
439 
440  inline std::vector<uint8_t> generate_json(const preset& in_preset)
441  {
442  preset_param_group p = in_preset;
443  auto fields = initialize_field_parsers(p);
444 
445  json j;
446  for (auto&& f : fields)
447  {
448  if (f.second->is_duplicated) // Skip duplicated fields
449  continue;
450 
451  auto str = f.second->save();
452  if (!str.empty()) // Ignored fields return empty string
453  j[f.first.c_str()] = str;
454  }
455 
456  auto str = j.dump(4);
457  return std::vector<uint8_t>(str.begin(), str.end());
458  }
459 
460  inline void update_structs(const std::string& content, preset& in_preset)
461  {
462  preset_param_group p = in_preset;
463  json j = json::parse(content);
464  auto fields = initialize_field_parsers(p);
465 
466  for (auto it = j.begin(); it != j.end(); ++it)
467  {
468  auto kvp = fields.find(it.key());
469  if (kvp != fields.end())
470  {
471  try
472  {
473  if (it.value().type() != nlohmann::basic_json<>::value_t::string)
474  {
475  float val = it.value();
476  std::stringstream ss;
477  ss << val;
478  kvp->second->load(ss.str());
479  }
480  else
481  {
482  kvp->second->load(it.value());
483  }
484  kvp->second->was_set = true;
485  }
486  catch (...)
487  {
488  throw invalid_value_exception(to_string() << "Couldn't set \"" << it.key());
489  }
490  }
491  else
492  {
493  throw invalid_value_exception(to_string() << it.key() << " key is not supported by the connected device!");
494  }
495  }
496 
498  update_preset_control(in_preset.rsm , p.rsm);
499  update_preset_control(in_preset.rsvc , p.rsvc);
501  update_preset_control(in_preset.rctc , p.rctc);
502  update_preset_control(in_preset.sctc , p.sctc);
503  update_preset_control(in_preset.spc , p.spc);
504  update_preset_control(in_preset.hdad , p.hdad);
505  update_preset_control(in_preset.cc , p.cc);
507  update_preset_control(in_preset.ae , p.ae);
508  update_preset_control(in_preset.census , p.census);
528  }
529 }
std::string save() const override
Definition: json_loader.hpp:205
param_group< STColorControl > color_control
Definition: json_loader.hpp:36
int power_line_frequency
Definition: presets.h:95
uint32_t uDiameter
Definition: rs_advanced_mode_command.h:121
Definition: json_loader.hpp:159
param_group< sharpness_control > color_sharpness
Definition: json_loader.hpp:60
int auto_white_balance
Definition: presets.h:89
uint32_t minNorth
Definition: rs_advanced_mode_command.h:41
uint32_t sloK2PenaltyMod1
Definition: rs_advanced_mode_command.h:76
param_group< STRauSupportVectorControl > rsvc
Definition: json_loader.hpp:35
param_group< white_balance_control > color_white_balance
Definition: json_loader.hpp:61
float colorCorrection2
Definition: rs_advanced_mode_command.h:92
uint32_t rauDiffThresholdGreen
Definition: rs_advanced_mode_command.h:60
Definition: backend.h:347
param_group< gain_control > depth_gain
Definition: json_loader.hpp:49
param_group< STColorCorrection > cc
Definition: json_loader.hpp:41
Definition: backend.h:351
float exposure
Definition: presets.h:23
exposure_control color_exposure
Definition: presets.h:118
STColorControl color_control
Definition: presets.h:103
float brightness
Definition: presets.h:47
uint32_t scoreThreshA
Definition: rs_advanced_mode_command.h:19
uint32_t sloK1PenaltyMod1
Definition: rs_advanced_mode_command.h:75
laser_power_control laser_power
Definition: presets.h:113
void insert_control_to_map(parsers_map &map, bool was_set, const std::string &name, param_group< T > &control, S field)
Definition: json_loader.hpp:252
virtual void load(const std::string &value)=0
bool was_set
Definition: json_loader.hpp:116
float diffThresh
Definition: rs_advanced_mode_command.h:31
uint32_t scoreThreshB
Definition: rs_advanced_mode_command.h:20
bool check_ranges
Definition: json_loader.hpp:130
param_group< STDepthTableControl > depth_table
Definition: json_loader.hpp:42
float colorCorrection11
Definition: rs_advanced_mode_command.h:101
std::vector< uint8_t > generate_json(const preset &in_preset)
Definition: json_loader.hpp:440
uint32_t textureDifferenceThreshold
Definition: rs_advanced_mode_command.h:21
STSloColorThresholdsControl sctc
Definition: presets.h:105
void update_preset_camera_control(T &camera_control, const param_group< T > &param)
Definition: json_loader.hpp:276
uint32_t diffThresholdRed
Definition: rs_advanced_mode_command.h:66
auto_white_balance_control depth_auto_white_balance
Definition: presets.h:117
auto_exposure_control color_auto_exposure
Definition: presets.h:119
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
STDepthControlGroup depth_controls
Definition: presets.h:100
STCensusRadius census
Definition: presets.h:111
sql::statement::iterator end(sql::statement &stmt)
bool is_duplicated
Definition: json_loader.hpp:118
param_group< exposure_control > color_exposure
Definition: json_loader.hpp:51
uint32_t sloK2Penalty
Definition: rs_advanced_mode_command.h:74
virtual ~json_field()=default
STAEControl ae
Definition: presets.h:110
preset_param_group(const preset &other)
Definition: json_loader.hpp:65
Definition: json_loader.hpp:125
nlohmann::json json
Definition: json_loader.hpp:22
uint32_t ignoreSAD
Definition: rs_advanced_mode_command.h:86
void load(const std::string &str) override
Definition: json_loader.hpp:149
uint32_t rsmBypass
Definition: rs_advanced_mode_command.h:30
int auto_exposure
Definition: presets.h:29
float colorCorrection7
Definition: rs_advanced_mode_command.h:97
bool update
Definition: json_loader.hpp:29
std::shared_ptr< json_field > make_ignored_field()
Definition: json_loader.hpp:234
uint32_t sloK1PenaltyMod2
Definition: rs_advanced_mode_command.h:77
param_group< STSloPenaltyControl > spc
Definition: json_loader.hpp:39
void insert_string_control_to_map(parsers_map &map, bool was_set, const std::string &name, param_group< T > &control, S field, const std::map< std::string, float > &values)
Definition: json_loader.hpp:260
Definition: json_loader.hpp:25
uint32_t minWEsum
Definition: rs_advanced_mode_command.h:40
gain_control color_gain
Definition: presets.h:123
gain_control depth_gain
Definition: presets.h:116
param_group< power_line_frequency_control > color_power_line_frequency
Definition: json_loader.hpp:63
float saturation
Definition: presets.h:71
param_group< backlight_compensation_control > color_backlight_compensation
Definition: json_loader.hpp:53
Definition: algo.h:16
uint32_t textureCountThreshold
Definition: rs_advanced_mode_command.h:22
STRsm rsm
Definition: presets.h:101
float colorCorrection12
Definition: rs_advanced_mode_command.h:102
Definition: json_loader.hpp:193
uint32_t vDiameter
Definition: rs_advanced_mode_command.h:122
void update_structs(const std::string &content, preset &in_preset)
Definition: json_loader.hpp:460
float contrast
Definition: presets.h:53
laser_state_control laser_state
Definition: presets.h:112
param_group< auto_exposure_control > color_auto_exposure
Definition: json_loader.hpp:52
float sharpness
Definition: presets.h:77
param_group< gamma_control > color_gamma
Definition: json_loader.hpp:57
sharpness_control color_sharpness
Definition: presets.h:127
uint32_t sloK2PenaltyMod2
Definition: rs_advanced_mode_command.h:78
brightness_control color_brightness
Definition: presets.h:121
std::map< std::string, float > _values
Definition: json_loader.hpp:167
float laser_power
Definition: presets.h:11
Definition: json_loader.hpp:32
std::shared_ptr< json_field > make_invert_field(T &strct, S T::group_type::*field, bool is_duplicated_field=false)
Definition: json_loader.hpp:240
auto_exposure_control depth_auto_exposure
Definition: presets.h:115
white_balance_control color_white_balance
Definition: presets.h:128
uint32_t disableRAUColor
Definition: rs_advanced_mode_command.h:51
param_group< auto_white_balance_control > depth_auto_white_balance
Definition: json_loader.hpp:50
sql::statement::iterator begin(sql::statement &stmt)
void load(const std::string &str) override
Definition: json_loader.hpp:132
STSloPenaltyControl spc
Definition: presets.h:106
param_group< gain_control > color_gain
Definition: json_loader.hpp:56
uint32_t minEast
Definition: rs_advanced_mode_command.h:39
std::map< std::string, std::shared_ptr< json_field > > parsers_map
Definition: json_loader.hpp:249
float lambdaAD
Definition: rs_advanced_mode_command.h:85
std::string save() const override
Definition: json_loader.hpp:139
uint32_t vShrink
Definition: rs_advanced_mode_command.h:45
std::shared_ptr< json_field > make_field(T &strct, S T::group_type::*field, float scale=1.0f, bool is_duplicated_field=false)
Definition: json_loader.hpp:214
std::string save() const override
Definition: json_loader.hpp:175
uint32_t rauDiffThresholdBlue
Definition: rs_advanced_mode_command.h:61
T * strct
Definition: json_loader.hpp:164
void load(const std::string &value) override
Definition: json_loader.hpp:169
STRauSupportVectorControl rsvc
Definition: presets.h:102
json_string_struct_field(std::map< std::string, float > values)
Definition: json_loader.hpp:161
param_group< STHdad > hdad
Definition: json_loader.hpp:40
preset_param_group & operator=(const preset &other)
Definition: json_loader.hpp:70
hue_control color_hue
Definition: presets.h:125
gamma_control color_gamma
Definition: presets.h:124
float gain
Definition: presets.h:35
int laser_state
Definition: presets.h:17
uint32_t minusDecrement
Definition: rs_advanced_mode_command.h:17
float gamma
Definition: presets.h:59
param_group< STAEControl > ae
Definition: json_loader.hpp:43
uint32_t sloK1Penalty
Definition: rs_advanced_mode_command.h:73
T vals[3]
Definition: json_loader.hpp:28
void load(const std::string &str) override
Definition: json_loader.hpp:198
S T::group_type::* field
Definition: json_loader.hpp:128
uint32_t disableSLORightColor
Definition: rs_advanced_mode_command.h:52
uint32_t lrAgreeThreshold
Definition: rs_advanced_mode_command.h:25
auto_white_balance_control color_auto_white_balance
Definition: presets.h:129
virtual std::string save() const =0
param_group< STDepthControlGroup > depth_controls
Definition: json_loader.hpp:33
float colorCorrection3
Definition: rs_advanced_mode_command.h:93
Definition: types.h:54
float white_balance
Definition: presets.h:83
uint32_t deepSeaMedianThreshold
Definition: rs_advanced_mode_command.h:18
param_group< brightness_control > color_brightness
Definition: json_loader.hpp:54
float colorCorrection1
Definition: rs_advanced_mode_command.h:91
param_group< STSloColorThresholdsControl > sctc
Definition: json_loader.hpp:38
parsers_map initialize_field_parsers(preset_param_group &p)
Definition: json_loader.hpp:285
param_group< contrast_control > color_contrast
Definition: json_loader.hpp:55
STDepthTableControl depth_table
Definition: presets.h:109
Definition: presets.h:99
int32_t disparityShift
Definition: rs_advanced_mode_command.h:116
std::string save() const override
Definition: json_loader.hpp:152
uint32_t minNSsum
Definition: rs_advanced_mode_command.h:43
float colorCorrection6
Definition: rs_advanced_mode_command.h:96
void update_preset_control(T &preset_control, const param_group< T > &param)
Definition: json_loader.hpp:269
uint32_t minWest
Definition: rs_advanced_mode_command.h:38
contrast_control color_contrast
Definition: presets.h:122
uint32_t meanIntensitySetPoint
Definition: rs_advanced_mode_command.h:107
float colorCorrection5
Definition: rs_advanced_mode_command.h:95
uint32_t disableSADColor
Definition: rs_advanced_mode_command.h:50
STHdad hdad
Definition: presets.h:107
Definition: json_loader.hpp:147
int32_t depthClampMin
Definition: rs_advanced_mode_command.h:113
std::shared_ptr< json_field > make_string_field(T &strct, S T::group_type::*field, const std::map< std::string, float > &values, bool is_duplicated_field=false)
Definition: json_loader.hpp:225
float lambdaCensus
Definition: rs_advanced_mode_command.h:84
param_group< auto_white_balance_control > color_auto_white_balance
Definition: json_loader.hpp:62
uint32_t depthUnits
Definition: rs_advanced_mode_command.h:112
uint32_t diffThresholdBlue
Definition: rs_advanced_mode_command.h:68
exposure_control depth_exposure
Definition: presets.h:114
saturation_control color_saturation
Definition: presets.h:126
STColorCorrection cc
Definition: presets.h:108
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
param_group< STRsm > rsm
Definition: json_loader.hpp:34
backlight_compensation_control color_backlight_compensation
Definition: presets.h:120
Definition: rs_advanced_mode_command.h:57
float colorCorrection10
Definition: rs_advanced_mode_command.h:100
param_group< hue_control > color_hue
Definition: json_loader.hpp:58
param_group< STCensusRadius > census
Definition: json_loader.hpp:44
float hue
Definition: presets.h:65
param_group< STRauColorThresholdsControl > rctc
Definition: json_loader.hpp:37
param_group< laser_state_control > laser_state
Definition: json_loader.hpp:45
param_group< laser_power_control > laser_power
Definition: json_loader.hpp:46
uint32_t removeThresh
Definition: rs_advanced_mode_command.h:33
param_group< auto_exposure_control > depth_auto_exposure
Definition: json_loader.hpp:48
float colorCorrection9
Definition: rs_advanced_mode_command.h:99
power_line_frequency_control color_power_line_frequency
Definition: presets.h:130
uint32_t diffThresholdGreen
Definition: rs_advanced_mode_command.h:67
T * strct
Definition: json_loader.hpp:127
float scale
Definition: json_loader.hpp:129
int backlight_compensation
Definition: presets.h:41
float sloRauDiffThresh
Definition: rs_advanced_mode_command.h:32
S T::group_type::* field
Definition: json_loader.hpp:165
uint32_t uShrink
Definition: rs_advanced_mode_command.h:44
STRauColorThresholdsControl rctc
Definition: presets.h:104
param_group< saturation_control > color_saturation
Definition: json_loader.hpp:59
uint32_t minSouth
Definition: rs_advanced_mode_command.h:42
float colorCorrection8
Definition: rs_advanced_mode_command.h:98
Definition: json_loader.hpp:112
uint32_t disableSLOLeftColor
Definition: rs_advanced_mode_command.h:53
param_group< exposure_control > depth_exposure
Definition: json_loader.hpp:47
uint32_t deepSeaSecondPeakThreshold
Definition: rs_advanced_mode_command.h:23
uint32_t disableSADNormalize
Definition: rs_advanced_mode_command.h:54