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


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:21