Zivid C++ API  1.8.1+6967bc1b-1
Defining the Future of 3D Machine Vision
Settings.h
Go to the documentation of this file.
1 
2 /*******************************************************************************
3  * This file is part of the Zivid 3D Camera API
4  *
5  * Copyright 2015-2020 (C) Zivid AS
6  * All rights reserved.
7  *
8  * Zivid Software License, v1.0
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  *
20  * 3. Neither the name of Zivid AS nor the names of its contributors may be used
21  * to endorse or promote products derived from this software without specific
22  * prior written permission.
23  *
24  * 4. This software, with or without modification, must not be used with any
25  * other 3D camera than from Zivid AS.
26  *
27  * 5. Any software provided in binary form under this license must not be
28  * reverse engineered, decompiled, modified and/or disassembled.
29  *
30  * THIS SOFTWARE IS PROVIDED BY ZIVID AS "AS IS" AND ANY EXPRESS OR IMPLIED
31  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
32  * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
33  * DISCLAIMED. IN NO EVENT SHALL ZIVID AS OR CONTRIBUTORS BE LIABLE FOR ANY
34  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
37  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  *
41  * Contact: Zivid Support <support@zivid.com>
42  * Info: http://www.zivid.com
43  ******************************************************************************/
44 
45 #pragma once
46 
47 #include <chrono>
48 #include <ctime>
49 #include <iomanip>
50 #include <memory>
51 #include <sstream>
52 #include <string>
53 #include <tuple>
54 #include <utility>
55 #include <vector>
56 
57 #include "Zivid/APIExport.h"
58 #include "Zivid/Range.h"
59 
60 #ifdef _MSC_VER
61 # pragma warning(push)
62 # pragma warning(disable : 4251) // "X needs to have dll-interface to be used by clients of class Y."
63 #endif
64 
65 namespace Zivid
66 {
68  class ZIVID_API_EXPORT Settings
69  {
70  public:
71  static constexpr size_t version{ 3 };
72 
73 #ifndef NO_DOC
74  template<size_t>
75  struct Version;
76 
77  using LatestVersion = Zivid::Settings;
78 #endif
79 
81  ~Settings();
82 
84  Settings(const Settings &other);
85 
87  Settings &operator=(const Settings &other);
88 
90  Settings(Settings &&other) noexcept;
91 
93  Settings &operator=(Settings &&other) noexcept;
94 
96  Settings() = default;
97 
99  static constexpr bool isContainer{ true };
100 
102  static constexpr const char *path{ "" };
103 
105  static constexpr const char *name{ "Settings" };
106 
108  static constexpr const char *description{ R"description(Settings for a Zivid camera)description" };
109 
111  void set(const std::string &fullPath, const std::string &value);
112 
114  std::string getString(const std::string &fullPath) const;
115 
117  class ZIVID_API_EXPORT Bidirectional
118  {
119  public:
121  using ValueType = bool;
122  static const Bidirectional yes;
123  static const Bidirectional no;
124 
126  static constexpr bool isContainer{ false };
127 
129  static constexpr const char *path{ "Bidirectional" };
130 
132  static constexpr const char *name{ "Bidirectional" };
133 
135  static constexpr const char *description{
136  R"description(Enable or disable the use of bi-directional patterns (requires twice as many patterns as well as increased exposure time))description"
137  };
138 
140  Bidirectional() = default;
141 
143  explicit constexpr Bidirectional(ValueType value) noexcept(
144  std::is_nothrow_copy_constructible<ValueType>::value)
145  : m_value{ value }
146  {}
147 
149  const ValueType &value() const
150  {
151  return m_value;
152  }
153 
155  void setFromString(const std::string &value)
156  {
157  if(value == "yes")
158  {
159  m_value = true;
160  }
161  else if(value == "no")
162  {
163  m_value = false;
164  }
165  else
166  {
167  throw std::invalid_argument("Bidirectional{ " + value + " } is not in range [yes, no]");
168  }
169  }
170 
172  std::string toString() const
173  {
174  return m_value ? "yes" : "no";
175  }
176 
178  explicit operator bool() const
179  {
180  return m_value;
181  }
182 
184  bool operator==(const Bidirectional &other) const
185  {
186  return m_value == other.m_value;
187  }
188 
190  bool operator!=(const Bidirectional &other) const
191  {
192  return m_value != other.m_value;
193  }
194 
196  friend std::ostream &operator<<(std::ostream &stream, const Bidirectional &value)
197  {
198  return stream << value.toString();
199  }
200 
202  friend std::istream &operator>>(std::istream &stream, Bidirectional &value)
203  {
204  value.setFromString(
205  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
206  return stream;
207  }
208 
209  private:
210  ValueType m_value{ false };
211  };
212 
215  {
216  public:
218  using ValueType = double;
219 
221  static constexpr bool isContainer{ false };
222 
224  static constexpr const char *path{ "BlueBalance" };
225 
227  static constexpr const char *name{ "BlueBalance" };
228 
230  static constexpr const char *description{
231  R"description(White balance of blue channel in the camera)description"
232  };
233 
235  BlueBalance() = default;
236 
238  explicit constexpr BlueBalance(ValueType value) noexcept(
239  std::is_nothrow_copy_constructible<ValueType>::value)
240  : m_value{ value }
241  {}
242 
244  const ValueType &value() const
245  {
246  return m_value;
247  }
248 
250  Range<ValueType> range() const
251  {
252  return { 1.0, 8.0 };
253  }
254 
256  void setFromString(const std::string &value)
257  {
258  m_value = std::stod(value);
259  }
260 
262  std::string toString() const
263  {
264  return std::to_string(m_value);
265  }
266 
268  bool operator==(const BlueBalance &other) const
269  {
270  return m_value == other.m_value;
271  }
272 
274  bool operator!=(const BlueBalance &other) const
275  {
276  return m_value != other.m_value;
277  }
278 
280  bool operator<(const BlueBalance &other) const
281  {
282  return m_value < other.m_value;
283  }
284 
286  bool operator>(const BlueBalance &other) const
287  {
288  return m_value > other.m_value;
289  }
290 
292  friend std::ostream &operator<<(std::ostream &stream, const BlueBalance &value)
293  {
294  return stream << value.toString();
295  }
296 
298  friend std::istream &operator>>(std::istream &stream, BlueBalance &value)
299  {
301  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
302  return stream;
303  }
304 
305  private:
306  ValueType m_value{ 1.081 };
307  };
308 
324  class ZIVID_API_EXPORT Brightness
325  {
326  public:
328  using ValueType = double;
329 
331  static constexpr bool isContainer{ false };
332 
334  static constexpr const char *path{ "Brightness" };
335 
337  static constexpr const char *name{ "Brightness" };
338 
340  static constexpr const char *description{
341  R"description(Brightness controls the light output from the projector.
342 
343 Brightness above 1.0 may be needed when the distance between the camera and the
344 scene is large, or in case of high levels of ambient lighting. Brightness above 1.0
345 is only supported on Zivid One Plus.
346 
347 When brightness is above 1.0 some limitations apply:
348 
349 1) Live mode is not supported.
350 
351 2) The duty cycle of the camera (the percentage of time the camera can capture frames) will be reduced.
352 The lights in the projector can be lit for at most 50% of the time during a 10 second period. This limitation
353 is enforced automatically by the camera. Calling capture when the duty cycle limit has been reached will cause
354 the camera to first wait (sleep) for a duration of time to cool down, before capture will start.
355 )description"
356  };
357 
359  Brightness() = default;
360 
362  explicit constexpr Brightness(ValueType value) noexcept(
363  std::is_nothrow_copy_constructible<ValueType>::value)
364  : m_value{ value }
365  {}
366 
368  const ValueType &value() const
369  {
370  return m_value;
371  }
372 
374  Range<ValueType> range() const
375  {
376  return { 0, 1.8 };
377  }
378 
380  void setFromString(const std::string &value)
381  {
382  m_value = std::stod(value);
383  }
384 
386  std::string toString() const
387  {
388  return std::to_string(m_value);
389  }
390 
392  bool operator==(const Brightness &other) const
393  {
394  return m_value == other.m_value;
395  }
396 
398  bool operator!=(const Brightness &other) const
399  {
400  return m_value != other.m_value;
401  }
402 
404  bool operator<(const Brightness &other) const
405  {
406  return m_value < other.m_value;
407  }
408 
410  bool operator>(const Brightness &other) const
411  {
412  return m_value > other.m_value;
413  }
414 
416  friend std::ostream &operator<<(std::ostream &stream, const Brightness &value)
417  {
418  return stream << value.toString();
419  }
420 
422  friend std::istream &operator>>(std::istream &stream, Brightness &value)
423  {
424  value.setFromString(
425  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
426  return stream;
427  }
428 
429  private:
430  ValueType m_value{ 1 };
431  };
432 
434  class ZIVID_API_EXPORT ExposureTime
435  {
436  public:
438  using ValueType = std::chrono::microseconds;
439 
441  static constexpr bool isContainer{ false };
442 
444  static constexpr const char *path{ "ExposureTime" };
445 
447  static constexpr const char *name{ "ExposureTime" };
448 
450  static constexpr const char *description{
451  R"description(Exposure time for each single image in the measurement. Affects frame rate.)description"
452  };
453 
455  ExposureTime() = default;
456 
458  explicit constexpr ExposureTime(ValueType value) noexcept(
459  std::is_nothrow_copy_constructible<ValueType>::value)
460  : m_value{ value }
461  {}
462 
464  const ValueType &value() const
465  {
466  return m_value;
467  }
468 
470  Range<ValueType> range() const
471  {
472  return { ValueType{ 6500 }, ValueType{ 100000 } };
473  }
474 
476  void setFromString(const std::string &value)
477  {
478  m_value = ValueType{ std::stoll(value) };
479  }
480 
482  std::string toString() const
483  {
484  return std::to_string(m_value.count());
485  }
486 
488  bool operator==(const ExposureTime &other) const
489  {
490  return m_value == other.m_value;
491  }
492 
494  bool operator!=(const ExposureTime &other) const
495  {
496  return m_value != other.m_value;
497  }
498 
500  bool operator<(const ExposureTime &other) const
501  {
502  return m_value < other.m_value;
503  }
504 
506  bool operator>(const ExposureTime &other) const
507  {
508  return m_value > other.m_value;
509  }
510 
512  friend std::ostream &operator<<(std::ostream &stream, const ExposureTime &value)
513  {
514  return stream << value.toString();
515  }
516 
518  friend std::istream &operator>>(std::istream &stream, ExposureTime &value)
519  {
521  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
522  return stream;
523  }
524 
525  private:
526  ValueType m_value{ 8333 };
527  };
528 
530  class ZIVID_API_EXPORT Filters
531  {
532  public:
534  Filters() = default;
535 
537  static constexpr bool isContainer{ true };
538 
540  static constexpr const char *path{ "Filters" };
541 
543  static constexpr const char *name{ "Filters" };
544 
546  static constexpr const char *description{ R"description(Collection of filters)description" };
547 
549  void set(const std::string &fullPath, const std::string &value);
550 
552  std::string getString(const std::string &fullPath) const;
553 
555  class ZIVID_API_EXPORT Contrast
556  {
557  public:
559  Contrast() = default;
560 
562  static constexpr bool isContainer{ true };
563 
565  static constexpr const char *path{ "Filters/Contrast" };
566 
568  static constexpr const char *name{ "Contrast" };
569 
571  static constexpr const char *description{
572  R"description(Discard points with contrast values below a threshold)description"
573  };
574 
576  void set(const std::string &fullPath, const std::string &value);
577 
579  std::string getString(const std::string &fullPath) const;
580 
582  class ZIVID_API_EXPORT Enabled
583  {
584  public:
586  using ValueType = bool;
587  static const Enabled yes;
588  static const Enabled no;
589 
591  static constexpr bool isContainer{ false };
592 
594  static constexpr const char *path{ "Filters/Contrast/Enabled" };
595 
597  static constexpr const char *name{ "Enabled" };
598 
600  static constexpr const char *description{
601  R"description(Enable or disable the contrast filter)description"
602  };
603 
605  Enabled() = default;
606 
608  explicit constexpr Enabled(ValueType value) noexcept(
609  std::is_nothrow_copy_constructible<ValueType>::value)
610  : m_value{ value }
611  {}
612 
614  const ValueType &value() const
615  {
616  return m_value;
617  }
618 
620  void setFromString(const std::string &value)
621  {
622  if(value == "yes")
623  {
624  m_value = true;
625  }
626  else if(value == "no")
627  {
628  m_value = false;
629  }
630  else
631  {
632  throw std::invalid_argument("Enabled{ " + value + " } is not in range [yes, no]");
633  }
634  }
635 
637  std::string toString() const
638  {
639  return m_value ? "yes" : "no";
640  }
641 
643  explicit operator bool() const
644  {
645  return m_value;
646  }
647 
649  bool operator==(const Enabled &other) const
650  {
651  return m_value == other.m_value;
652  }
653 
655  bool operator!=(const Enabled &other) const
656  {
657  return m_value != other.m_value;
658  }
659 
661  friend std::ostream &operator<<(std::ostream &stream, const Enabled &value)
662  {
663  return stream << value.toString();
664  }
665 
667  friend std::istream &operator>>(std::istream &stream, Enabled &value)
668  {
669  value.setFromString(
670  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
671  return stream;
672  }
673 
674  private:
675  ValueType m_value{ true };
676  };
677 
680  {
681  public:
683  using ValueType = double;
684 
686  static constexpr bool isContainer{ false };
687 
689  static constexpr const char *path{ "Filters/Contrast/Threshold" };
690 
692  static constexpr const char *name{ "Threshold" };
693 
695  static constexpr const char *description{
696  R"description(Discard points with contrast below the given value)description"
697  };
698 
700  Threshold() = default;
701 
703  explicit constexpr Threshold(ValueType value) noexcept(
704  std::is_nothrow_copy_constructible<ValueType>::value)
705  : m_value{ value }
706  {}
707 
709  const ValueType &value() const
710  {
711  return m_value;
712  }
713 
715  Range<ValueType> range() const
716  {
717  return { std::numeric_limits<ValueType>::lowest(), std::numeric_limits<ValueType>::max() };
718  }
719 
721  void setFromString(const std::string &value)
722  {
723  m_value = std::stod(value);
724  }
725 
727  std::string toString() const
728  {
729  return std::to_string(m_value);
730  }
731 
733  bool operator==(const Threshold &other) const
734  {
735  return m_value == other.m_value;
736  }
737 
739  bool operator!=(const Threshold &other) const
740  {
741  return m_value != other.m_value;
742  }
743 
745  bool operator<(const Threshold &other) const
746  {
747  return m_value < other.m_value;
748  }
749 
751  bool operator>(const Threshold &other) const
752  {
753  return m_value > other.m_value;
754  }
755 
757  friend std::ostream &operator<<(std::ostream &stream, const Threshold &value)
758  {
759  return stream << value.toString();
760  }
761 
763  friend std::istream &operator>>(std::istream &stream, Threshold &value)
764  {
766  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
767  return stream;
768  }
769 
770  private:
771  ValueType m_value{ 5 };
772  };
773 
774  template<typename T,
775  typename std::enable_if<std::is_same<T, Settings::Filters::Contrast::Enabled>::value,
776  int>::type = 0>
777  const Settings::Filters::Contrast::Enabled &get() const
778  {
779  return m_enabled;
780  }
781 
782  template<typename T,
783  typename std::enable_if<std::is_same<T, Settings::Filters::Contrast::Threshold>::value,
784  int>::type = 0>
785  const Settings::Filters::Contrast::Threshold &get() const
786  {
787  return m_threshold;
788  }
789 
790  template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
791  const Settings::Filters::Contrast::Enabled &get() const
792  {
793  return m_enabled;
794  }
795 
796  template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
797  const Settings::Filters::Contrast::Threshold &get() const
798  {
799  return m_threshold;
800  }
801 
803  explicit Contrast(const Enabled &enabled, const Threshold &threshold);
804 
805  private:
806  Enabled m_enabled{};
807 
808  public:
810  Contrast &set(const Enabled &value)
811  {
812  m_enabled = value;
813  return *this;
814  }
816  const Enabled &isEnabled() const
817  {
818  return m_enabled;
819  }
820 
821  private:
822  Threshold m_threshold{};
823 
824  public:
826  Contrast &set(const Threshold &value)
827  {
828  if(value.value() < value.range().min() || value.value() > value.range().max())
829  {
830  throw std::out_of_range("Threshold{ " + std::to_string(value.value()) + " } is not in range ["
831  + std::to_string(value.range().min()) + ", "
832  + std::to_string(value.range().max()) + "]");
833  }
834 
835  m_threshold = value;
836  return *this;
837  }
839  const Threshold &threshold() const
840  {
841  return m_threshold;
842  }
843 
845  template<typename F>
846  void forEach(const F &f) const
847  {
848  f(m_enabled);
849  f(m_threshold);
850  }
851 
853  template<typename F>
854  void forEach(const F &f)
855  {
856  f(m_enabled);
857  f(m_threshold);
858  }
859 
861  template<typename F>
862  void traverseValues(const F &f) const
863  {
864  f(m_enabled);
865  f(m_threshold);
866  }
867 
869  template<typename F>
870  void traverseValues(const F &f)
871  {
872  f(m_enabled);
873  f(m_threshold);
874  }
875 
877  std::string toString() const;
878 
880  friend std::ostream &operator<<(std::ostream &stream, const Contrast &value)
881  {
882  return stream << value.toString();
883  }
884 
886  void setFromString(const std::string &value);
887 
889  friend std::istream &operator>>(std::istream &stream, Contrast &value)
890  {
891  value.setFromString(
892  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
893  return stream;
894  }
895 
897  bool operator==(const Contrast &other) const;
898 
900  bool operator!=(const Contrast &other) const;
901  };
902 
905  {
906  public:
908  Gaussian() = default;
909 
911  static constexpr bool isContainer{ true };
912 
914  static constexpr const char *path{ "Filters/Gaussian" };
915 
917  static constexpr const char *name{ "Gaussian" };
918 
920  static constexpr const char *description{
921  R"description(Gaussian smoothing of the point cloud)description"
922  };
923 
925  void set(const std::string &fullPath, const std::string &value);
926 
928  std::string getString(const std::string &fullPath) const;
929 
932  {
933  public:
935  using ValueType = bool;
936  static const Enabled yes;
937  static const Enabled no;
938 
940  static constexpr bool isContainer{ false };
941 
943  static constexpr const char *path{ "Filters/Gaussian/Enabled" };
944 
946  static constexpr const char *name{ "Enabled" };
947 
949  static constexpr const char *description{
950  R"description(Enable or disable the smoothing filter)description"
951  };
952 
954  Enabled() = default;
955 
957  explicit constexpr Enabled(ValueType value) noexcept(
958  std::is_nothrow_copy_constructible<ValueType>::value)
959  : m_value{ value }
960  {}
961 
963  const ValueType &value() const
964  {
965  return m_value;
966  }
967 
969  void setFromString(const std::string &value)
970  {
971  if(value == "yes")
972  {
973  m_value = true;
974  }
975  else if(value == "no")
976  {
977  m_value = false;
978  }
979  else
980  {
981  throw std::invalid_argument("Enabled{ " + value + " } is not in range [yes, no]");
982  }
983  }
984 
986  std::string toString() const
987  {
988  return m_value ? "yes" : "no";
989  }
990 
992  explicit operator bool() const
993  {
994  return m_value;
995  }
996 
998  bool operator==(const Enabled &other) const
999  {
1000  return m_value == other.m_value;
1001  }
1002 
1004  bool operator!=(const Enabled &other) const
1005  {
1006  return m_value != other.m_value;
1007  }
1008 
1010  friend std::ostream &operator<<(std::ostream &stream, const Enabled &value)
1011  {
1012  return stream << value.toString();
1013  }
1016  friend std::istream &operator>>(std::istream &stream, Enabled &value)
1017  {
1018  value.setFromString(
1019  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1020  return stream;
1021  }
1023  private:
1024  ValueType m_value{ false };
1025  };
1026 
1029  {
1030  public:
1032  using ValueType = double;
1033 
1035  static constexpr bool isContainer{ false };
1038  static constexpr const char *path{ "Filters/Gaussian/Sigma" };
1039 
1041  static constexpr const char *name{ "Sigma" };
1044  static constexpr const char *description{
1045  R"description(Higher values result in smoother point clouds (Standard deviation of the filter coefficients))description"
1046  };
1047 
1049  Sigma() = default;
1050 
1052  explicit constexpr Sigma(ValueType value) noexcept(
1053  std::is_nothrow_copy_constructible<ValueType>::value)
1054  : m_value{ value }
1055  {}
1056 
1058  const ValueType &value() const
1059  {
1060  return m_value;
1061  }
1062 
1064  Range<ValueType> range() const
1065  {
1066  return { 0.5, 5 };
1067  }
1068 
1070  void setFromString(const std::string &value)
1071  {
1072  m_value = std::stod(value);
1073  }
1074 
1076  std::string toString() const
1077  {
1078  return std::to_string(m_value);
1079  }
1080 
1082  bool operator==(const Sigma &other) const
1083  {
1084  return m_value == other.m_value;
1085  }
1086 
1088  bool operator!=(const Sigma &other) const
1089  {
1090  return m_value != other.m_value;
1091  }
1092 
1094  bool operator<(const Sigma &other) const
1095  {
1096  return m_value < other.m_value;
1097  }
1098 
1100  bool operator>(const Sigma &other) const
1101  {
1102  return m_value > other.m_value;
1103  }
1104 
1106  friend std::ostream &operator<<(std::ostream &stream, const Sigma &value)
1107  {
1108  return stream << value.toString();
1109  }
1110 
1112  friend std::istream &operator>>(std::istream &stream, Sigma &value)
1113  {
1115  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1116  return stream;
1117  }
1118 
1119  private:
1120  ValueType m_value{ 1.5 };
1121  };
1122 
1123  template<typename T,
1124  typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian::Enabled>::value,
1125  int>::type = 0>
1126  const Settings::Filters::Gaussian::Enabled &get() const
1127  {
1128  return m_enabled;
1129  }
1130 
1131  template<
1132  typename T,
1133  typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian::Sigma>::value, int>::type = 0>
1134  const Settings::Filters::Gaussian::Sigma &get() const
1135  {
1136  return m_sigma;
1137  }
1138 
1139  template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1140  const Settings::Filters::Gaussian::Enabled &get() const
1141  {
1142  return m_enabled;
1143  }
1144 
1145  template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1146  const Settings::Filters::Gaussian::Sigma &get() const
1147  {
1148  return m_sigma;
1149  }
1150 
1152  explicit Gaussian(const Enabled &enabled, const Sigma &sigma);
1153 
1154  private:
1155  Enabled m_enabled{};
1156 
1157  public:
1159  Gaussian &set(const Enabled &value)
1160  {
1161  m_enabled = value;
1162  return *this;
1163  }
1165  const Enabled &isEnabled() const
1166  {
1167  return m_enabled;
1168  }
1169 
1170  private:
1171  Sigma m_sigma{};
1172 
1173  public:
1175  Gaussian &set(const Sigma &value)
1176  {
1177  if(value.value() < value.range().min() || value.value() > value.range().max())
1178  {
1179  throw std::out_of_range("Sigma{ " + std::to_string(value.value()) + " } is not in range ["
1180  + std::to_string(value.range().min()) + ", "
1181  + std::to_string(value.range().max()) + "]");
1182  }
1183 
1184  m_sigma = value;
1185  return *this;
1186  }
1188  const Sigma &sigma() const
1189  {
1190  return m_sigma;
1191  }
1192 
1194  template<typename F>
1195  void forEach(const F &f) const
1196  {
1197  f(m_enabled);
1198  f(m_sigma);
1199  }
1200 
1202  template<typename F>
1203  void forEach(const F &f)
1204  {
1205  f(m_enabled);
1206  f(m_sigma);
1207  }
1208 
1210  template<typename F>
1211  void traverseValues(const F &f) const
1212  {
1213  f(m_enabled);
1214  f(m_sigma);
1215  }
1216 
1218  template<typename F>
1219  void traverseValues(const F &f)
1220  {
1221  f(m_enabled);
1222  f(m_sigma);
1223  }
1224 
1226  std::string toString() const;
1227 
1229  friend std::ostream &operator<<(std::ostream &stream, const Gaussian &value)
1230  {
1231  return stream << value.toString();
1232  }
1233 
1235  void setFromString(const std::string &value);
1236 
1238  friend std::istream &operator>>(std::istream &stream, Gaussian &value)
1239  {
1240  value.setFromString(
1241  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1242  return stream;
1243  }
1246  bool operator==(const Gaussian &other) const;
1247 
1249  bool operator!=(const Gaussian &other) const;
1250  };
1251 
1254  {
1255  public:
1257  Outlier() = default;
1258 
1260  static constexpr bool isContainer{ true };
1261 
1263  static constexpr const char *path{ "Filters/Outlier" };
1264 
1266  static constexpr const char *name{ "Outlier" };
1269  static constexpr const char *description{
1270  R"description(Discard point if Euclidean distance to neighboring points is above a threshold)description"
1271  };
1272 
1274  void set(const std::string &fullPath, const std::string &value);
1275 
1277  std::string getString(const std::string &fullPath) const;
1278 
1281  {
1282  public:
1284  using ValueType = bool;
1285  static const Enabled yes;
1286  static const Enabled no;
1287 
1289  static constexpr bool isContainer{ false };
1292  static constexpr const char *path{ "Filters/Outlier/Enabled" };
1293 
1295  static constexpr const char *name{ "Enabled" };
1296 
1298  static constexpr const char *description{
1299  R"description(Enable or disable the outlier filter)description"
1300  };
1301 
1303  Enabled() = default;
1304 
1306  explicit constexpr Enabled(ValueType value) noexcept(
1307  std::is_nothrow_copy_constructible<ValueType>::value)
1308  : m_value{ value }
1309  {}
1310 
1312  const ValueType &value() const
1313  {
1314  return m_value;
1315  }
1316 
1318  void setFromString(const std::string &value)
1319  {
1320  if(value == "yes")
1321  {
1322  m_value = true;
1323  }
1324  else if(value == "no")
1325  {
1326  m_value = false;
1327  }
1328  else
1329  {
1330  throw std::invalid_argument("Enabled{ " + value + " } is not in range [yes, no]");
1331  }
1332  }
1333 
1335  std::string toString() const
1336  {
1337  return m_value ? "yes" : "no";
1338  }
1341  explicit operator bool() const
1342  {
1343  return m_value;
1344  }
1347  bool operator==(const Enabled &other) const
1348  {
1349  return m_value == other.m_value;
1350  }
1351 
1353  bool operator!=(const Enabled &other) const
1354  {
1355  return m_value != other.m_value;
1356  }
1357 
1359  friend std::ostream &operator<<(std::ostream &stream, const Enabled &value)
1360  {
1361  return stream << value.toString();
1362  }
1365  friend std::istream &operator>>(std::istream &stream, Enabled &value)
1366  {
1367  value.setFromString(
1368  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1369  return stream;
1370  }
1372  private:
1373  ValueType m_value{ true };
1374  };
1375 
1378  {
1379  public:
1381  using ValueType = double;
1382 
1384  static constexpr bool isContainer{ false };
1387  static constexpr const char *path{ "Filters/Outlier/Threshold" };
1388 
1390  static constexpr const char *name{ "Threshold" };
1393  static constexpr const char *description{
1394  R"description(Discard point if Euclidean distance to neighboring points is above the given value)description"
1395  };
1396 
1398  Threshold() = default;
1399 
1401  explicit constexpr Threshold(ValueType value) noexcept(
1402  std::is_nothrow_copy_constructible<ValueType>::value)
1403  : m_value{ value }
1404  {}
1405 
1407  const ValueType &value() const
1408  {
1409  return m_value;
1410  }
1411 
1413  Range<ValueType> range() const
1414  {
1415  return { std::numeric_limits<ValueType>::lowest(), std::numeric_limits<ValueType>::max() };
1416  }
1417 
1419  void setFromString(const std::string &value)
1420  {
1421  m_value = std::stod(value);
1422  }
1423 
1425  std::string toString() const
1426  {
1427  return std::to_string(m_value);
1428  }
1429 
1431  bool operator==(const Threshold &other) const
1432  {
1433  return m_value == other.m_value;
1434  }
1435 
1437  bool operator!=(const Threshold &other) const
1438  {
1439  return m_value != other.m_value;
1440  }
1441 
1443  bool operator<(const Threshold &other) const
1444  {
1445  return m_value < other.m_value;
1446  }
1447 
1449  bool operator>(const Threshold &other) const
1450  {
1451  return m_value > other.m_value;
1452  }
1453 
1455  friend std::ostream &operator<<(std::ostream &stream, const Threshold &value)
1456  {
1457  return stream << value.toString();
1458  }
1459 
1461  friend std::istream &operator>>(std::istream &stream, Threshold &value)
1462  {
1464  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1465  return stream;
1466  }
1467 
1468  private:
1469  ValueType m_value{ 5 };
1470  };
1471 
1472  template<
1473  typename T,
1474  typename std::enable_if<std::is_same<T, Settings::Filters::Outlier::Enabled>::value, int>::type = 0>
1475  const Settings::Filters::Outlier::Enabled &get() const
1476  {
1477  return m_enabled;
1478  }
1479 
1480  template<typename T,
1481  typename std::enable_if<std::is_same<T, Settings::Filters::Outlier::Threshold>::value,
1482  int>::type = 0>
1483  const Settings::Filters::Outlier::Threshold &get() const
1484  {
1485  return m_threshold;
1486  }
1487 
1488  template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1489  const Settings::Filters::Outlier::Enabled &get() const
1490  {
1491  return m_enabled;
1492  }
1493 
1494  template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1495  const Settings::Filters::Outlier::Threshold &get() const
1496  {
1497  return m_threshold;
1498  }
1499 
1501  explicit Outlier(const Enabled &enabled, const Threshold &threshold);
1502 
1503  private:
1504  Enabled m_enabled{};
1505 
1506  public:
1508  Outlier &set(const Enabled &value)
1509  {
1510  m_enabled = value;
1511  return *this;
1512  }
1514  const Enabled &isEnabled() const
1515  {
1516  return m_enabled;
1517  }
1518 
1519  private:
1520  Threshold m_threshold{};
1521 
1522  public:
1524  Outlier &set(const Threshold &value)
1525  {
1526  if(value.value() < value.range().min() || value.value() > value.range().max())
1527  {
1528  throw std::out_of_range("Threshold{ " + std::to_string(value.value()) + " } is not in range ["
1529  + std::to_string(value.range().min()) + ", "
1530  + std::to_string(value.range().max()) + "]");
1531  }
1532 
1533  m_threshold = value;
1534  return *this;
1535  }
1537  const Threshold &threshold() const
1538  {
1539  return m_threshold;
1540  }
1541 
1543  template<typename F>
1544  void forEach(const F &f) const
1545  {
1546  f(m_enabled);
1547  f(m_threshold);
1548  }
1549 
1551  template<typename F>
1552  void forEach(const F &f)
1553  {
1554  f(m_enabled);
1555  f(m_threshold);
1556  }
1557 
1559  template<typename F>
1560  void traverseValues(const F &f) const
1561  {
1562  f(m_enabled);
1563  f(m_threshold);
1564  }
1565 
1567  template<typename F>
1568  void traverseValues(const F &f)
1569  {
1570  f(m_enabled);
1571  f(m_threshold);
1572  }
1573 
1575  std::string toString() const;
1576 
1578  friend std::ostream &operator<<(std::ostream &stream, const Outlier &value)
1579  {
1580  return stream << value.toString();
1581  }
1582 
1584  void setFromString(const std::string &value);
1585 
1587  friend std::istream &operator>>(std::istream &stream, Outlier &value)
1588  {
1589  value.setFromString(
1590  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1591  return stream;
1592  }
1595  bool operator==(const Outlier &other) const;
1596 
1598  bool operator!=(const Outlier &other) const;
1599  };
1600 
1603  {
1604  public:
1606  Reflection() = default;
1607 
1609  static constexpr bool isContainer{ true };
1610 
1612  static constexpr const char *path{ "Filters/Reflection" };
1613 
1615  static constexpr const char *name{ "Reflection" };
1618  static constexpr const char *description{
1619  R"description(Discard points likely introduced by reflections (useful for shiny materials))description"
1620  };
1621 
1623  void set(const std::string &fullPath, const std::string &value);
1624 
1626  std::string getString(const std::string &fullPath) const;
1627 
1630  {
1631  public:
1633  using ValueType = bool;
1634  static const Enabled yes;
1635  static const Enabled no;
1636 
1638  static constexpr bool isContainer{ false };
1641  static constexpr const char *path{ "Filters/Reflection/Enabled" };
1642 
1644  static constexpr const char *name{ "Enabled" };
1645 
1647  static constexpr const char *description{
1648  R"description(Enable or disable the reflection filter. Note that this filter is computationally intensive and may affect the frame rate)description"
1649  };
1650 
1652  Enabled() = default;
1653 
1655  explicit constexpr Enabled(ValueType value) noexcept(
1656  std::is_nothrow_copy_constructible<ValueType>::value)
1657  : m_value{ value }
1658  {}
1659 
1661  const ValueType &value() const
1662  {
1663  return m_value;
1664  }
1665 
1667  void setFromString(const std::string &value)
1668  {
1669  if(value == "yes")
1670  {
1671  m_value = true;
1672  }
1673  else if(value == "no")
1674  {
1675  m_value = false;
1676  }
1677  else
1678  {
1679  throw std::invalid_argument("Enabled{ " + value + " } is not in range [yes, no]");
1680  }
1681  }
1682 
1684  std::string toString() const
1685  {
1686  return m_value ? "yes" : "no";
1687  }
1690  explicit operator bool() const
1691  {
1692  return m_value;
1693  }
1696  bool operator==(const Enabled &other) const
1697  {
1698  return m_value == other.m_value;
1699  }
1700 
1702  bool operator!=(const Enabled &other) const
1703  {
1704  return m_value != other.m_value;
1705  }
1706 
1708  friend std::ostream &operator<<(std::ostream &stream, const Enabled &value)
1709  {
1710  return stream << value.toString();
1711  }
1714  friend std::istream &operator>>(std::istream &stream, Enabled &value)
1715  {
1716  value.setFromString(
1717  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1718  return stream;
1719  }
1721  private:
1722  ValueType m_value{ false };
1723  };
1724 
1725  template<typename T,
1726  typename std::enable_if<std::is_same<T, Settings::Filters::Reflection::Enabled>::value,
1727  int>::type = 0>
1728  const Settings::Filters::Reflection::Enabled &get() const
1729  {
1730  return m_enabled;
1731  }
1732 
1733  template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1735  {
1736  return m_enabled;
1737  }
1738 
1740  explicit Reflection(const Enabled &enabled);
1741 
1742  private:
1743  Enabled m_enabled{};
1744 
1745  public:
1747  Reflection &set(const Enabled &value)
1748  {
1749  m_enabled = value;
1750  return *this;
1751  }
1753  const Enabled &isEnabled() const
1754  {
1755  return m_enabled;
1756  }
1757 
1759  template<typename F>
1760  void forEach(const F &f) const
1761  {
1762  f(m_enabled);
1763  }
1764 
1766  template<typename F>
1767  void forEach(const F &f)
1768  {
1769  f(m_enabled);
1770  }
1771 
1773  template<typename F>
1774  void traverseValues(const F &f) const
1775  {
1776  f(m_enabled);
1777  }
1778 
1780  template<typename F>
1781  void traverseValues(const F &f)
1782  {
1783  f(m_enabled);
1784  }
1785 
1787  std::string toString() const;
1788 
1790  friend std::ostream &operator<<(std::ostream &stream, const Reflection &value)
1791  {
1792  return stream << value.toString();
1793  }
1794 
1796  void setFromString(const std::string &value);
1797 
1799  friend std::istream &operator>>(std::istream &stream, Reflection &value)
1800  {
1801  value.setFromString(
1802  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1803  return stream;
1804  }
1805 
1807  bool operator==(const Reflection &other) const;
1808 
1810  bool operator!=(const Reflection &other) const;
1811  };
1812 
1815  {
1816  public:
1818  Saturated() = default;
1819 
1821  static constexpr bool isContainer{ true };
1822 
1824  static constexpr const char *path{ "Filters/Saturated" };
1825 
1827  static constexpr const char *name{ "Saturated" };
1828 
1830  static constexpr const char *description{
1831  R"description(Discard points that are saturated)description"
1832  };
1833 
1835  void set(const std::string &fullPath, const std::string &value);
1836 
1838  std::string getString(const std::string &fullPath) const;
1842  {
1843  public:
1845  using ValueType = bool;
1846  static const Enabled yes;
1847  static const Enabled no;
1848 
1850  static constexpr bool isContainer{ false };
1851 
1853  static constexpr const char *path{ "Filters/Saturated/Enabled" };
1854 
1856  static constexpr const char *name{ "Enabled" };
1857 
1859  static constexpr const char *description{
1860  R"description(Enable or disable the saturation filter)description"
1861  };
1862 
1864  Enabled() = default;
1865 
1867  explicit constexpr Enabled(ValueType value) noexcept(
1868  std::is_nothrow_copy_constructible<ValueType>::value)
1869  : m_value{ value }
1870  {}
1871 
1873  const ValueType &value() const
1874  {
1875  return m_value;
1876  }
1877 
1879  void setFromString(const std::string &value)
1880  {
1881  if(value == "yes")
1882  {
1883  m_value = true;
1884  }
1885  else if(value == "no")
1886  {
1887  m_value = false;
1888  }
1889  else
1890  {
1891  throw std::invalid_argument("Enabled{ " + value + " } is not in range [yes, no]");
1892  }
1893  }
1894 
1896  std::string toString() const
1897  {
1898  return m_value ? "yes" : "no";
1899  }
1902  explicit operator bool() const
1903  {
1904  return m_value;
1905  }
1908  bool operator==(const Enabled &other) const
1909  {
1910  return m_value == other.m_value;
1911  }
1912 
1914  bool operator!=(const Enabled &other) const
1915  {
1916  return m_value != other.m_value;
1917  }
1918 
1920  friend std::ostream &operator<<(std::ostream &stream, const Enabled &value)
1921  {
1922  return stream << value.toString();
1923  }
1926  friend std::istream &operator>>(std::istream &stream, Enabled &value)
1927  {
1928  value.setFromString(
1929  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1930  return stream;
1931  }
1933  private:
1934  ValueType m_value{ true };
1935  };
1936 
1937  template<typename T,
1938  typename std::enable_if<std::is_same<T, Settings::Filters::Saturated::Enabled>::value,
1939  int>::type = 0>
1940  const Settings::Filters::Saturated::Enabled &get() const
1941  {
1942  return m_enabled;
1943  }
1944 
1945  template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1947  {
1948  return m_enabled;
1949  }
1950 
1952  explicit Saturated(const Enabled &enabled);
1953 
1954  private:
1955  Enabled m_enabled{};
1956 
1957  public:
1959  Saturated &set(const Enabled &value)
1960  {
1961  m_enabled = value;
1962  return *this;
1963  }
1965  const Enabled &isEnabled() const
1966  {
1967  return m_enabled;
1968  }
1969 
1971  template<typename F>
1972  void forEach(const F &f) const
1973  {
1974  f(m_enabled);
1975  }
1976 
1978  template<typename F>
1979  void forEach(const F &f)
1980  {
1981  f(m_enabled);
1982  }
1983 
1985  template<typename F>
1986  void traverseValues(const F &f) const
1987  {
1988  f(m_enabled);
1989  }
1990 
1992  template<typename F>
1993  void traverseValues(const F &f)
1994  {
1995  f(m_enabled);
1996  }
1997 
1999  std::string toString() const;
2000 
2002  friend std::ostream &operator<<(std::ostream &stream, const Saturated &value)
2003  {
2004  return stream << value.toString();
2005  }
2006 
2008  void setFromString(const std::string &value);
2009 
2011  friend std::istream &operator>>(std::istream &stream, Saturated &value)
2012  {
2013  value.setFromString(
2014  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
2015  return stream;
2016  }
2017 
2019  bool operator==(const Saturated &other) const;
2020 
2022  bool operator!=(const Saturated &other) const;
2023  };
2024 
2025  template<typename T,
2026  typename std::enable_if<std::is_same<T, Settings::Filters::Contrast>::value, int>::type = 0>
2027  const Settings::Filters::Contrast &get() const
2028  {
2029  return m_contrast;
2030  }
2031 
2032  template<
2033  typename T,
2034  typename std::enable_if<std::is_same<T, Settings::Filters::Contrast::Enabled>::value, int>::type = 0>
2035  const Settings::Filters::Contrast::Enabled &get() const
2036  {
2037  return m_contrast.get<Settings::Filters::Contrast::Enabled>();
2038  }
2039 
2040  template<
2041  typename T,
2042  typename std::enable_if<std::is_same<T, Settings::Filters::Contrast::Threshold>::value, int>::type = 0>
2043  const Settings::Filters::Contrast::Threshold &get() const
2044  {
2045  return m_contrast.get<Settings::Filters::Contrast::Threshold>();
2046  }
2047 
2048  template<typename T,
2049  typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian>::value, int>::type = 0>
2050  const Settings::Filters::Gaussian &get() const
2051  {
2052  return m_gaussian;
2053  }
2054 
2055  template<
2056  typename T,
2057  typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian::Enabled>::value, int>::type = 0>
2059  {
2060  return m_gaussian.get<Settings::Filters::Gaussian::Enabled>();
2061  }
2062 
2063  template<typename T,
2064  typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian::Sigma>::value, int>::type = 0>
2066  {
2067  return m_gaussian.get<Settings::Filters::Gaussian::Sigma>();
2068  }
2069 
2070  template<typename T,
2071  typename std::enable_if<std::is_same<T, Settings::Filters::Outlier>::value, int>::type = 0>
2072  const Settings::Filters::Outlier &get() const
2073  {
2074  return m_outlier;
2075  }
2076 
2077  template<
2078  typename T,
2079  typename std::enable_if<std::is_same<T, Settings::Filters::Outlier::Enabled>::value, int>::type = 0>
2080  const Settings::Filters::Outlier::Enabled &get() const
2081  {
2082  return m_outlier.get<Settings::Filters::Outlier::Enabled>();
2083  }
2084 
2085  template<
2086  typename T,
2087  typename std::enable_if<std::is_same<T, Settings::Filters::Outlier::Threshold>::value, int>::type = 0>
2088  const Settings::Filters::Outlier::Threshold &get() const
2089  {
2090  return m_outlier.get<Settings::Filters::Outlier::Threshold>();
2091  }
2092 
2093  template<typename T,
2094  typename std::enable_if<std::is_same<T, Settings::Filters::Reflection>::value, int>::type = 0>
2095  const Settings::Filters::Reflection &get() const
2096  {
2097  return m_reflection;
2098  }
2099 
2100  template<
2101  typename T,
2102  typename std::enable_if<std::is_same<T, Settings::Filters::Reflection::Enabled>::value, int>::type = 0>
2103  const Settings::Filters::Reflection::Enabled &get() const
2104  {
2105  return m_reflection.get<Settings::Filters::Reflection::Enabled>();
2106  }
2107 
2108  template<typename T,
2109  typename std::enable_if<std::is_same<T, Settings::Filters::Saturated>::value, int>::type = 0>
2110  const Settings::Filters::Saturated &get() const
2111  {
2112  return m_saturated;
2113  }
2115  template<
2116  typename T,
2117  typename std::enable_if<std::is_same<T, Settings::Filters::Saturated::Enabled>::value, int>::type = 0>
2118  const Settings::Filters::Saturated::Enabled &get() const
2119  {
2120  return m_saturated.get<Settings::Filters::Saturated::Enabled>();
2121  }
2123  template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2124  const Settings::Filters::Contrast &get() const
2125  {
2126  return m_contrast;
2127  }
2128 
2129  template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
2130  const Settings::Filters::Gaussian &get() const
2131  {
2132  return m_gaussian;
2133  }
2134 
2135  template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
2136  const Settings::Filters::Outlier &get() const
2137  {
2138  return m_outlier;
2139  }
2140 
2141  template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
2142  const Settings::Filters::Reflection &get() const
2143  {
2144  return m_reflection;
2145  }
2146 
2147  template<size_t i, typename std::enable_if<i == 4, int>::type = 0>
2148  const Settings::Filters::Saturated &get() const
2149  {
2150  return m_saturated;
2151  }
2152 
2154  explicit Filters(const Contrast &contrast,
2155  const Gaussian &gaussian,
2156  const Outlier &outlier,
2157  const Reflection &reflection,
2158  const Saturated &saturated);
2160  private:
2161  Contrast m_contrast{};
2162 
2163  public:
2165  Filters &set(const Contrast &value)
2166  {
2167  m_contrast = value;
2168  return *this;
2169  }
2171  const Contrast &contrast() const
2172  {
2173  return m_contrast;
2174  }
2175 
2177  Filters &set(const Contrast::Enabled &value)
2178  {
2179  m_contrast.set(value);
2180  return *this;
2181  }
2184  Filters &set(const Contrast::Threshold &value)
2185  {
2186  m_contrast.set(value);
2187  return *this;
2188  }
2190  private:
2191  Gaussian m_gaussian{};
2192 
2193  public:
2195  Filters &set(const Gaussian &value)
2196  {
2197  m_gaussian = value;
2198  return *this;
2199  }
2201  const Gaussian &gaussian() const
2202  {
2203  return m_gaussian;
2204  }
2205 
2207  Filters &set(const Gaussian::Enabled &value)
2208  {
2209  m_gaussian.set(value);
2210  return *this;
2211  }
2212 
2214  Filters &set(const Gaussian::Sigma &value)
2215  {
2216  m_gaussian.set(value);
2217  return *this;
2218  }
2219 
2220  private:
2221  Outlier m_outlier{};
2222 
2223  public:
2225  Filters &set(const Outlier &value)
2226  {
2227  m_outlier = value;
2228  return *this;
2229  }
2231  const Outlier &outlier() const
2232  {
2233  return m_outlier;
2234  }
2235 
2237  Filters &set(const Outlier::Enabled &value)
2238  {
2239  m_outlier.set(value);
2240  return *this;
2241  }
2242 
2245  {
2246  m_outlier.set(value);
2247  return *this;
2248  }
2249 
2250  private:
2251  Reflection m_reflection{};
2252 
2253  public:
2255  Filters &set(const Reflection &value)
2256  {
2257  m_reflection = value;
2258  return *this;
2259  }
2261  const Reflection &reflection() const
2262  {
2263  return m_reflection;
2264  }
2265 
2267  Filters &set(const Reflection::Enabled &value)
2268  {
2269  m_reflection.set(value);
2270  return *this;
2271  }
2272 
2273  private:
2274  Saturated m_saturated{};
2275 
2276  public:
2278  Filters &set(const Saturated &value)
2279  {
2280  m_saturated = value;
2281  return *this;
2282  }
2284  const Saturated &saturated() const
2285  {
2286  return m_saturated;
2287  }
2288 
2290  Filters &set(const Saturated::Enabled &value)
2291  {
2292  m_saturated.set(value);
2293  return *this;
2294  }
2295 
2297  template<typename F>
2298  void forEach(const F &f) const
2299  {
2300  f(m_contrast);
2301  f(m_gaussian);
2302  f(m_outlier);
2303  f(m_reflection);
2304  f(m_saturated);
2305  }
2306 
2308  template<typename F>
2309  void forEach(const F &f)
2310  {
2311  f(m_contrast);
2312  f(m_gaussian);
2313  f(m_outlier);
2314  f(m_reflection);
2315  f(m_saturated);
2316  }
2317 
2319  template<typename F>
2320  void traverseValues(const F &f) const
2321  {
2322  m_contrast.traverseValues(f);
2323  m_gaussian.traverseValues(f);
2324  m_outlier.traverseValues(f);
2325  m_reflection.traverseValues(f);
2326  m_saturated.traverseValues(f);
2327  }
2328 
2330  template<typename F>
2331  void traverseValues(const F &f)
2332  {
2333  m_contrast.traverseValues(f);
2334  m_gaussian.traverseValues(f);
2335  m_outlier.traverseValues(f);
2336  m_reflection.traverseValues(f);
2337  m_saturated.traverseValues(f);
2338  }
2339 
2341  std::string toString() const;
2342 
2344  friend std::ostream &operator<<(std::ostream &stream, const Filters &value)
2345  {
2346  return stream << value.toString();
2347  }
2348 
2350  void setFromString(const std::string &value);
2351 
2353  friend std::istream &operator>>(std::istream &stream, Filters &value)
2354  {
2355  value.setFromString(
2356  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
2357  return stream;
2358  }
2359 
2361  bool operator==(const Filters &other) const;
2362 
2364  bool operator!=(const Filters &other) const;
2365  };
2366 
2368  class ZIVID_API_EXPORT Gain
2369  {
2370  public:
2372  using ValueType = double;
2373 
2375  static constexpr bool isContainer{ false };
2376 
2378  static constexpr const char *path{ "Gain" };
2379 
2381  static constexpr const char *name{ "Gain" };
2382 
2384  static constexpr const char *description{ R"description(Analog gain in the camera)description" };
2385 
2387  Gain() = default;
2390  explicit constexpr Gain(ValueType value) noexcept(std::is_nothrow_copy_constructible<ValueType>::value)
2391  : m_value{ value }
2392  {}
2393 
2395  const ValueType &value() const
2396  {
2397  return m_value;
2398  }
2401  Range<ValueType> range() const
2402  {
2403  return { 1, 16 };
2404  }
2405 
2407  void setFromString(const std::string &value)
2408  {
2409  m_value = std::stod(value);
2410  }
2411 
2413  std::string toString() const
2414  {
2415  return std::to_string(m_value);
2416  }
2417 
2419  bool operator==(const Gain &other) const
2420  {
2421  return m_value == other.m_value;
2422  }
2425  bool operator!=(const Gain &other) const
2426  {
2427  return m_value != other.m_value;
2428  }
2429 
2431  bool operator<(const Gain &other) const
2432  {
2433  return m_value < other.m_value;
2434  }
2435 
2437  bool operator>(const Gain &other) const
2438  {
2439  return m_value > other.m_value;
2440  }
2441 
2443  friend std::ostream &operator<<(std::ostream &stream, const Gain &value)
2444  {
2445  return stream << value.toString();
2446  }
2449  friend std::istream &operator>>(std::istream &stream, Gain &value)
2450  {
2452  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
2453  return stream;
2454  }
2455 
2456  private:
2457  ValueType m_value{ 2 };
2458  };
2459 
2461  class ZIVID_API_EXPORT Iris
2462  {
2463  public:
2465  using ValueType = size_t;
2466 
2468  static constexpr bool isContainer{ false };
2471  static constexpr const char *path{ "Iris" };
2472 
2474  static constexpr const char *name{ "Iris" };
2475 
2477  static constexpr const char *description{
2478  R"description(Iris (aperture) setting for the camera)description"
2479  };
2482  Iris() = default;
2483 
2485  explicit constexpr Iris(ValueType value) noexcept(std::is_nothrow_copy_constructible<ValueType>::value)
2486  : m_value{ value }
2487  {}
2488 
2490  const ValueType &value() const
2491  {
2492  return m_value;
2493  }
2494 
2496  Range<ValueType> range() const
2497  {
2498  return { 0, 72 };
2499  }
2500 
2502  void setFromString(const std::string &value)
2503  {
2504  m_value = std::stoull(value);
2505  }
2506 
2508  std::string toString() const
2509  {
2510  return std::to_string(m_value);
2511  }
2512 
2514  bool operator==(const Iris &other) const
2515  {
2516  return m_value == other.m_value;
2517  }
2518 
2520  bool operator!=(const Iris &other) const
2521  {
2522  return m_value != other.m_value;
2523  }
2524 
2526  bool operator<(const Iris &other) const
2527  {
2528  return m_value < other.m_value;
2529  }
2530 
2532  bool operator>(const Iris &other) const
2533  {
2534  return m_value > other.m_value;
2535  }
2536 
2538  friend std::ostream &operator<<(std::ostream &stream, const Iris &value)
2539  {
2540  return stream << value.toString();
2541  }
2542 
2544  friend std::istream &operator>>(std::istream &stream, Iris &value)
2545  {
2546  value.setFromString(
2547  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
2548  return stream;
2549  }
2551  private:
2552  ValueType m_value{ 22 };
2553  };
2554 
2557  {
2558  public:
2560  using ValueType = double;
2561 
2563  static constexpr bool isContainer{ false };
2566  static constexpr const char *path{ "RedBalance" };
2567 
2569  static constexpr const char *name{ "RedBalance" };
2570 
2572  static constexpr const char *description{
2573  R"description(White balance of red channel in the camera)description"
2574  };
2577  RedBalance() = default;
2578 
2580  explicit constexpr RedBalance(ValueType value) noexcept(
2581  std::is_nothrow_copy_constructible<ValueType>::value)
2582  : m_value{ value }
2583  {}
2584 
2586  const ValueType &value() const
2587  {
2588  return m_value;
2589  }
2590 
2592  Range<ValueType> range() const
2593  {
2594  return { 1.0, 8.0 };
2595  }
2596 
2598  void setFromString(const std::string &value)
2599  {
2600  m_value = std::stod(value);
2601  }
2602 
2604  std::string toString() const
2605  {
2606  return std::to_string(m_value);
2607  }
2608 
2610  bool operator==(const RedBalance &other) const
2611  {
2612  return m_value == other.m_value;
2613  }
2614 
2616  bool operator!=(const RedBalance &other) const
2617  {
2618  return m_value != other.m_value;
2619  }
2620 
2622  bool operator<(const RedBalance &other) const
2623  {
2624  return m_value < other.m_value;
2625  }
2626 
2628  bool operator>(const RedBalance &other) const
2629  {
2630  return m_value > other.m_value;
2631  }
2632 
2634  friend std::ostream &operator<<(std::ostream &stream, const RedBalance &value)
2635  {
2636  return stream << value.toString();
2637  }
2638 
2640  friend std::istream &operator>>(std::istream &stream, RedBalance &value)
2641  {
2643  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
2644  return stream;
2645  }
2646 
2647  private:
2648  ValueType m_value{ 1.709 };
2649  };
2650 
2651  template<typename T, typename std::enable_if<std::is_same<T, Settings::Bidirectional>::value, int>::type = 0>
2652  const Settings::Bidirectional &get() const
2653  {
2654  return m_bidirectional;
2655  }
2656 
2657  template<typename T, typename std::enable_if<std::is_same<T, Settings::BlueBalance>::value, int>::type = 0>
2658  const Settings::BlueBalance &get() const
2659  {
2660  return m_blueBalance;
2661  }
2662 
2663  template<typename T, typename std::enable_if<std::is_same<T, Settings::Brightness>::value, int>::type = 0>
2664  const Settings::Brightness &get() const
2665  {
2666  return m_brightness;
2667  }
2668 
2669  template<typename T, typename std::enable_if<std::is_same<T, Settings::ExposureTime>::value, int>::type = 0>
2670  const Settings::ExposureTime &get() const
2671  {
2672  return m_exposureTime;
2673  }
2674 
2675  template<typename T, typename std::enable_if<std::is_same<T, Settings::Filters>::value, int>::type = 0>
2676  const Settings::Filters &get() const
2677  {
2678  return m_filters;
2679  }
2680 
2681  template<typename T,
2682  typename std::enable_if<std::is_same<T, Settings::Filters::Contrast>::value, int>::type = 0>
2683  const Settings::Filters::Contrast &get() const
2684  {
2685  return m_filters.get<Settings::Filters::Contrast>();
2686  }
2687 
2688  template<typename T,
2689  typename std::enable_if<std::is_same<T, Settings::Filters::Contrast::Enabled>::value, int>::type = 0>
2690  const Settings::Filters::Contrast::Enabled &get() const
2691  {
2692  return m_filters.get<Settings::Filters::Contrast::Enabled>();
2693  }
2694 
2695  template<typename T,
2696  typename std::enable_if<std::is_same<T, Settings::Filters::Contrast::Threshold>::value, int>::type = 0>
2697  const Settings::Filters::Contrast::Threshold &get() const
2698  {
2699  return m_filters.get<Settings::Filters::Contrast::Threshold>();
2700  }
2702  template<typename T,
2703  typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian>::value, int>::type = 0>
2704  const Settings::Filters::Gaussian &get() const
2705  {
2706  return m_filters.get<Settings::Filters::Gaussian>();
2707  }
2708 
2709  template<typename T,
2710  typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian::Enabled>::value, int>::type = 0>
2711  const Settings::Filters::Gaussian::Enabled &get() const
2712  {
2713  return m_filters.get<Settings::Filters::Gaussian::Enabled>();
2714  }
2715 
2716  template<typename T,
2717  typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian::Sigma>::value, int>::type = 0>
2718  const Settings::Filters::Gaussian::Sigma &get() const
2719  {
2720  return m_filters.get<Settings::Filters::Gaussian::Sigma>();
2721  }
2722 
2723  template<typename T, typename std::enable_if<std::is_same<T, Settings::Filters::Outlier>::value, int>::type = 0>
2724  const Settings::Filters::Outlier &get() const
2725  {
2726  return m_filters.get<Settings::Filters::Outlier>();
2727  }
2728 
2729  template<typename T,
2730  typename std::enable_if<std::is_same<T, Settings::Filters::Outlier::Enabled>::value, int>::type = 0>
2732  {
2733  return m_filters.get<Settings::Filters::Outlier::Enabled>();
2734  }
2735 
2736  template<typename T,
2737  typename std::enable_if<std::is_same<T, Settings::Filters::Outlier::Threshold>::value, int>::type = 0>
2738  const Settings::Filters::Outlier::Threshold &get() const
2739  {
2740  return m_filters.get<Settings::Filters::Outlier::Threshold>();
2741  }
2742 
2743  template<typename T,
2744  typename std::enable_if<std::is_same<T, Settings::Filters::Reflection>::value, int>::type = 0>
2745  const Settings::Filters::Reflection &get() const
2746  {
2747  return m_filters.get<Settings::Filters::Reflection>();
2748  }
2750  template<typename T,
2751  typename std::enable_if<std::is_same<T, Settings::Filters::Reflection::Enabled>::value, int>::type = 0>
2752  const Settings::Filters::Reflection::Enabled &get() const
2753  {
2754  return m_filters.get<Settings::Filters::Reflection::Enabled>();
2755  }
2756 
2757  template<typename T,
2758  typename std::enable_if<std::is_same<T, Settings::Filters::Saturated>::value, int>::type = 0>
2759  const Settings::Filters::Saturated &get() const
2760  {
2761  return m_filters.get<Settings::Filters::Saturated>();
2762  }
2763 
2764  template<typename T,
2765  typename std::enable_if<std::is_same<T, Settings::Filters::Saturated::Enabled>::value, int>::type = 0>
2766  const Settings::Filters::Saturated::Enabled &get() const
2767  {
2768  return m_filters.get<Settings::Filters::Saturated::Enabled>();
2769  }
2770 
2771  template<typename T, typename std::enable_if<std::is_same<T, Settings::Gain>::value, int>::type = 0>
2772  const Settings::Gain &get() const
2773  {
2774  return m_gain;
2775  }
2777  template<typename T, typename std::enable_if<std::is_same<T, Settings::Iris>::value, int>::type = 0>
2778  const Settings::Iris &get() const
2779  {
2780  return m_iris;
2781  }
2782 
2783  template<typename T, typename std::enable_if<std::is_same<T, Settings::RedBalance>::value, int>::type = 0>
2784  const Settings::RedBalance &get() const
2785  {
2786  return m_redBalance;
2787  }
2788 
2789  template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2791  {
2792  return m_bidirectional;
2793  }
2794 
2795  template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
2796  const Settings::BlueBalance &get() const
2797  {
2798  return m_blueBalance;
2799  }
2800 
2801  template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
2802  const Settings::Brightness &get() const
2803  {
2804  return m_brightness;
2805  }
2806 
2807  template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
2808  const Settings::ExposureTime &get() const
2809  {
2810  return m_exposureTime;
2811  }
2812 
2813  template<size_t i, typename std::enable_if<i == 4, int>::type = 0>
2814  const Settings::Filters &get() const
2815  {
2816  return m_filters;
2817  }
2818 
2819  template<size_t i, typename std::enable_if<i == 5, int>::type = 0>
2820  const Settings::Gain &get() const
2821  {
2822  return m_gain;
2823  }
2825  template<size_t i, typename std::enable_if<i == 6, int>::type = 0>
2826  const Settings::Iris &get() const
2827  {
2828  return m_iris;
2829  }
2830 
2831  template<size_t i, typename std::enable_if<i == 7, int>::type = 0>
2832  const Settings::RedBalance &get() const
2833  {
2834  return m_redBalance;
2835  }
2836 
2838  explicit Settings(const Bidirectional &bidirectional,
2839  const BlueBalance &blueBalance,
2840  const Brightness &brightness,
2841  const ExposureTime &exposureTime,
2842  const Filters &filters,
2843  const Gain &gain,
2844  const Iris &iris,
2845  const RedBalance &redBalance);
2846 
2847  private:
2848  Bidirectional m_bidirectional{};
2849 
2850  public:
2852  Settings &set(const Bidirectional &value)
2853  {
2854  m_bidirectional = value;
2855  return *this;
2856  }
2858  const Bidirectional &bidirectional() const
2859  {
2860  return m_bidirectional;
2861  }
2862 
2863  private:
2864  BlueBalance m_blueBalance{};
2865 
2866  public:
2868  Settings &set(const BlueBalance &value)
2869  {
2870  if(value.value() < value.range().min() || value.value() > value.range().max())
2871  {
2872  throw std::out_of_range("BlueBalance{ " + std::to_string(value.value()) + " } is not in range ["
2873  + std::to_string(value.range().min()) + ", "
2874  + std::to_string(value.range().max()) + "]");
2875  }
2876 
2877  m_blueBalance = value;
2878  return *this;
2879  }
2881  const BlueBalance &blueBalance() const
2882  {
2883  return m_blueBalance;
2884  }
2885 
2886  private:
2887  Brightness m_brightness{};
2888 
2889  public:
2891  Settings &set(const Brightness &value)
2892  {
2893  if(value.value() < value.range().min() || value.value() > value.range().max())
2894  {
2895  throw std::out_of_range("Brightness{ " + std::to_string(value.value()) + " } is not in range ["
2896  + std::to_string(value.range().min()) + ", "
2897  + std::to_string(value.range().max()) + "]");
2898  }
2900  m_brightness = value;
2901  return *this;
2902  }
2904  const Brightness &brightness() const
2905  {
2906  return m_brightness;
2907  }
2908 
2909  private:
2910  ExposureTime m_exposureTime{};
2912  public:
2914  Settings &set(const ExposureTime &value)
2915  {
2916  if(value.value().count() < value.range().min().count()
2917  || value.value().count() > value.range().max().count())
2918  {
2919  throw std::out_of_range("ExposureTime{ " + std::to_string(value.value().count())
2920  + " } is not in range [" + std::to_string(value.range().min().count()) + ", "
2921  + std::to_string(value.range().max().count()) + "]");
2922  }
2923 
2924  m_exposureTime = value;
2925  return *this;
2926  }
2928  const ExposureTime &exposureTime() const
2929  {
2930  return m_exposureTime;
2931  }
2932 
2933  private:
2934  Filters m_filters{};
2935 
2936  public:
2938  Settings &set(const Filters &value)
2939  {
2940  m_filters = value;
2941  return *this;
2942  }
2944  const Filters &filters() const
2945  {
2946  return m_filters;
2947  }
2948 
2950  Settings &set(const Filters::Contrast &value)
2951  {
2952  m_filters.set(value);
2953  return *this;
2954  }
2955 
2957  Settings &set(const Filters::Contrast::Enabled &value)
2958  {
2959  m_filters.set(value);
2960  return *this;
2961  }
2962 
2964  Settings &set(const Filters::Contrast::Threshold &value)
2965  {
2966  m_filters.set(value);
2967  return *this;
2968  }
2969 
2971  Settings &set(const Filters::Gaussian &value)
2972  {
2973  m_filters.set(value);
2974  return *this;
2975  }
2976 
2978  Settings &set(const Filters::Gaussian::Enabled &value)
2979  {
2980  m_filters.set(value);
2981  return *this;
2982  }
2985  Settings &set(const Filters::Gaussian::Sigma &value)
2986  {
2987  m_filters.set(value);
2988  return *this;
2989  }
2990 
2992  Settings &set(const Filters::Outlier &value)
2993  {
2994  m_filters.set(value);
2995  return *this;
2996  }
2997 
2999  Settings &set(const Filters::Outlier::Enabled &value)
3000  {
3001  m_filters.set(value);
3002  return *this;
3003  }
3004 
3006  Settings &set(const Filters::Outlier::Threshold &value)
3007  {
3008  m_filters.set(value);
3009  return *this;
3010  }
3011 
3013  Settings &set(const Filters::Reflection &value)
3014  {
3015  m_filters.set(value);
3016  return *this;
3017  }
3018 
3020  Settings &set(const Filters::Reflection::Enabled &value)
3021  {
3022  m_filters.set(value);
3023  return *this;
3024  }
3025 
3027  Settings &set(const Filters::Saturated &value)
3028  {
3029  m_filters.set(value);
3030  return *this;
3031  }
3032 
3034  Settings &set(const Filters::Saturated::Enabled &value)
3035  {
3036  m_filters.set(value);
3037  return *this;
3038  }
3039 
3040  private:
3041  Gain m_gain{};
3042 
3043  public:
3045  Settings &set(const Gain &value)
3046  {
3047  if(value.value() < value.range().min() || value.value() > value.range().max())
3048  {
3049  throw std::out_of_range("Gain{ " + std::to_string(value.value()) + " } is not in range ["
3050  + std::to_string(value.range().min()) + ", "
3051  + std::to_string(value.range().max()) + "]");
3052  }
3053 
3054  m_gain = value;
3055  return *this;
3056  }
3058  const Gain &gain() const
3059  {
3060  return m_gain;
3061  }
3062 
3063  private:
3064  Iris m_iris{};
3065 
3066  public:
3068  Settings &set(const Iris &value)
3069  {
3070  if(value.value() < value.range().min() || value.value() > value.range().max())
3071  {
3072  throw std::out_of_range("Iris{ " + std::to_string(value.value()) + " } is not in range ["
3073  + std::to_string(value.range().min()) + ", "
3074  + std::to_string(value.range().max()) + "]");
3075  }
3076 
3077  m_iris = value;
3078  return *this;
3079  }
3081  const Iris &iris() const
3082  {
3083  return m_iris;
3084  }
3086  private:
3087  RedBalance m_redBalance{};
3088 
3089  public:
3091  Settings &set(const RedBalance &value)
3092  {
3093  if(value.value() < value.range().min() || value.value() > value.range().max())
3094  {
3095  throw std::out_of_range("RedBalance{ " + std::to_string(value.value()) + " } is not in range ["
3096  + std::to_string(value.range().min()) + ", "
3097  + std::to_string(value.range().max()) + "]");
3098  }
3100  m_redBalance = value;
3101  return *this;
3102  }
3104  const RedBalance &redBalance() const
3105  {
3106  return m_redBalance;
3107  }
3108 
3110  template<typename F>
3111  void forEach(const F &f) const
3112  {
3113  f(m_bidirectional);
3114  f(m_blueBalance);
3115  f(m_brightness);
3116  f(m_exposureTime);
3117  f(m_filters);
3118  f(m_gain);
3119  f(m_iris);
3120  f(m_redBalance);
3121  }
3122 
3124  template<typename F>
3125  void forEach(const F &f)
3126  {
3127  f(m_bidirectional);
3128  f(m_blueBalance);
3129  f(m_brightness);
3130  f(m_exposureTime);
3131  f(m_filters);
3132  f(m_gain);
3133  f(m_iris);
3134  f(m_redBalance);
3135  }
3136 
3138  template<typename F>
3139  void traverseValues(const F &f) const
3140  {
3141  f(m_bidirectional);
3142  f(m_blueBalance);
3143  f(m_brightness);
3144  f(m_exposureTime);
3145  m_filters.traverseValues(f);
3146  f(m_gain);
3147  f(m_iris);
3148  f(m_redBalance);
3149  }
3150 
3152  template<typename F>
3153  void traverseValues(const F &f)
3154  {
3155  f(m_bidirectional);
3156  f(m_blueBalance);
3157  f(m_brightness);
3158  f(m_exposureTime);
3159  m_filters.traverseValues(f);
3160  f(m_gain);
3161  f(m_iris);
3162  f(m_redBalance);
3163  }
3164 
3166  std::string toString() const;
3167 
3169  friend std::ostream &operator<<(std::ostream &stream, const Settings &value)
3170  {
3171  return stream << value.toString();
3172  }
3173 
3175  void setFromString(const std::string &value);
3176 
3178  friend std::istream &operator>>(std::istream &stream, Settings &value)
3179  {
3180  value.setFromString(
3181  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
3182  return stream;
3183  }
3184 
3186  bool operator==(const Settings &other) const;
3187 
3189  bool operator!=(const Settings &other) const;
3192  explicit Settings(const std::string &fileName);
3193 
3195  void save(const std::string &fileName) const;
3196 
3198  void load(const std::string &fileName);
3199  };
3200 
3201 #ifndef NO_DOC
3202  template<>
3203  struct Settings::Version<3>
3204  {
3205  using Type = Settings;
3206  };
3207 #endif
3208 
3209 } // namespace Zivid
3210 
3211 #ifdef _MSC_VER
3212 # pragma warning(pop)
3213 #endif
3214 
3215 #ifndef NO_DOC
3216 # if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
3217 namespace std // NOLINT
3219  template<>
3220  struct tuple_size<Zivid::Settings::Filters::Contrast> : integral_constant<size_t, 2>
3221  {};
3222 
3223  template<size_t i>
3224  struct tuple_element<i, Zivid::Settings::Filters::Contrast>
3225  {
3226  using type // NOLINT
3227  = decltype(declval<Zivid::Settings::Filters::Contrast>().get<i>());
3228  };
3229 
3230  template<>
3231  struct tuple_size<Zivid::Settings::Filters::Gaussian> : integral_constant<size_t, 2>
3232  {};
3233 
3234  template<size_t i>
3235  struct tuple_element<i, Zivid::Settings::Filters::Gaussian>
3236  {
3237  using type // NOLINT
3238  = decltype(declval<Zivid::Settings::Filters::Gaussian>().get<i>());
3239  };
3240 
3241  template<>
3242  struct tuple_size<Zivid::Settings::Filters::Outlier> : integral_constant<size_t, 2>
3243  {};
3244 
3245  template<size_t i>
3246  struct tuple_element<i, Zivid::Settings::Filters::Outlier>
3247  {
3248  using type // NOLINT
3249  = decltype(declval<Zivid::Settings::Filters::Outlier>().get<i>());
3250  };
3251 
3252  template<>
3253  struct tuple_size<Zivid::Settings::Filters::Reflection> : integral_constant<size_t, 1>
3254  {};
3255 
3256  template<size_t i>
3257  struct tuple_element<i, Zivid::Settings::Filters::Reflection>
3258  {
3259  using type // NOLINT
3260  = decltype(declval<Zivid::Settings::Filters::Reflection>().get<i>());
3261  };
3262 
3263  template<>
3264  struct tuple_size<Zivid::Settings::Filters::Saturated> : integral_constant<size_t, 1>
3265  {};
3266 
3267  template<size_t i>
3268  struct tuple_element<i, Zivid::Settings::Filters::Saturated>
3269  {
3270  using type // NOLINT
3271  = decltype(declval<Zivid::Settings::Filters::Saturated>().get<i>());
3272  };
3273 
3274  template<>
3275  struct tuple_size<Zivid::Settings::Filters> : integral_constant<size_t, 5>
3276  {};
3277 
3278  template<size_t i>
3279  struct tuple_element<i, Zivid::Settings::Filters>
3280  {
3281  using type // NOLINT
3282  = decltype(declval<Zivid::Settings::Filters>().get<i>());
3283  };
3284 
3285  template<>
3286  struct tuple_size<Zivid::Settings> : integral_constant<size_t, 8>
3287  {};
3288 
3289  template<size_t i>
3290  struct tuple_element<i, Zivid::Settings>
3291  {
3292  using type // NOLINT
3293  = decltype(declval<Zivid::Settings>().get<i>());
3294  };
3295 
3296 } // namespace std
3297 # endif
3298 #endif
Zivid::Settings::Filters::Gaussian::Sigma
Higher values result in smoother point clouds (Standard deviation of the filter coefficients)
Definition: Settings.h:1107
Zivid::toString
ZIVID_API_EXPORT std::string toString(const std::exception &exception)
Get string representation of the exception
Zivid::Settings::RedBalance
White balance of red channel in the camera
Definition: Settings.h:2635
Zivid::Settings::Filters::Gaussian::Enabled::ValueType
bool ValueType
The type of the underlying value
Definition: Settings.h:1014
Zivid::Settings::Filters::Contrast
Discard points with contrast values below a threshold
Definition: Settings.h:634
Zivid::Settings::Filters::Contrast::Threshold::ValueType
double ValueType
The type of the underlying value
Definition: Settings.h:762
Zivid::Settings::Filters::Outlier::Enabled
Enable or disable the outlier filter
Definition: Settings.h:1359
Zivid::Settings::Filters::Outlier::Enabled::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: Settings.h:1397
Zivid::Settings::Filters::set
Filters & set(const Contrast &value)
Set Contrast
Definition: Settings.h:2244
Zivid::Settings::get
const Settings::Filters::Gaussian::Enabled & get() const
Definition: Settings.h:2790
Zivid::Settings::RedBalance::ValueType
double ValueType
The type of the underlying value
Definition: Settings.h:2639
Zivid::Settings::Bidirectional::toString
std::string toString() const
Get the value as string
Definition: Settings.h:251
Zivid::Settings::Filters::Outlier::Enabled::ValueType
bool ValueType
The type of the underlying value
Definition: Settings.h:1363
Zivid::Settings::Filters::Reflection::setFromString
void setFromString(const std::string &value)
Set from the given string
Zivid::Settings::Gain::value
const ValueType & value() const
Get the value
Definition: Settings.h:2474
Zivid::Settings::ExposureTime::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: Settings.h:555
Zivid::Settings::Filters::Contrast::Threshold::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: Settings.h:800
Zivid::Settings::Filters::Outlier::Threshold::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: Settings.h:1498
Zivid::Settings::toString
std::string toString() const
Get the value as string
Zivid::Settings::Filters::Contrast::Threshold
Discard points with contrast below the given value
Definition: Settings.h:758
Zivid::Settings::Filters::Contrast::Enabled
Enable or disable the contrast filter
Definition: Settings.h:661
Zivid::Settings::Filters::Contrast::Enabled::toString
std::string toString() const
Get the value as string
Definition: Settings.h:716
Zivid::Settings::Iris::ValueType
size_t ValueType
The type of the underlying value
Definition: Settings.h:2544
Zivid::Settings::Filters::Contrast::Threshold::range
Range< ValueType > range() const
The range of valid values
Definition: Settings.h:794
Zivid::Settings::Filters::toString
std::string toString() const
Get the value as string
Zivid::Settings::Filters::Saturated::setFromString
void setFromString(const std::string &value)
Set from the given string
Zivid::Settings::Filters::Reflection::Enabled::ValueType
bool ValueType
The type of the underlying value
Definition: Settings.h:1712
Zivid::Settings::Gain::range
Range< ValueType > range() const
The range of valid values
Definition: Settings.h:2480
Zivid::Settings::Filters::Outlier::Threshold::range
Range< ValueType > range() const
The range of valid values
Definition: Settings.h:1492
Zivid::Settings::Filters::Gaussian::Enabled::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: Settings.h:1048
Zivid::Settings::Filters::Gaussian
Gaussian smoothing of the point cloud
Definition: Settings.h:983
Zivid::Settings::Filters::set
void set(const std::string &fullPath, const std::string &value)
Set a value from string by specifying the path
Zivid::Settings::Filters::Contrast::get
const Settings::Filters::Contrast::Enabled & get() const
Definition: Settings.h:856
Zivid::Settings::Filters::Reflection::Enabled::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: Settings.h:1746
Zivid::Settings::Filters::Outlier::Threshold::ValueType
double ValueType
The type of the underlying value
Definition: Settings.h:1460
Zivid::Settings::Filters::Reflection::Enabled::toString
std::string toString() const
Get the value as string
Definition: Settings.h:1763
Zivid::Settings::Bidirectional::ValueType
bool ValueType
The type of the underlying value
Definition: Settings.h:200
Zivid::Settings::ExposureTime
Exposure time for each single image in the measurement. Affects frame rate.
Definition: Settings.h:513
Zivid::Settings::Filters::Outlier::Threshold::value
const ValueType & value() const
Get the value
Definition: Settings.h:1486
Zivid::Settings::ExposureTime::value
const ValueType & value() const
Get the value
Definition: Settings.h:543
Zivid::Settings::Filters::Contrast::Threshold::value
const ValueType & value() const
Get the value
Definition: Settings.h:788
Zivid::Settings::Filters::Saturated::Enabled
Enable or disable the saturation filter
Definition: Settings.h:1920
Zivid::Settings::Filters::Gaussian::Enabled
Enable or disable the smoothing filter
Definition: Settings.h:1010
Zivid::Settings::Filters::Saturated
Discard points that are saturated
Definition: Settings.h:1893
Zivid::Settings::Filters::Gaussian::Sigma::ValueType
double ValueType
The type of the underlying value
Definition: Settings.h:1111
Zivid::Settings::Filters::Gaussian::get
const Settings::Filters::Gaussian::Enabled & get() const
Definition: Settings.h:1205
Zivid::Settings::Filters::Outlier::setFromString
void setFromString(const std::string &value)
Set from the given string
Zivid::Settings::Filters::Contrast::toString
std::string toString() const
Get the value as string
Zivid::Settings::Filters::Saturated::Enabled::ValueType
bool ValueType
The type of the underlying value
Definition: Settings.h:1924
Zivid::Settings::setFromString
void setFromString(const std::string &value)
Set from the given string
Range.h
Zivid::Settings::Filters::Saturated::get
const Settings::Filters::Saturated::Enabled & get() const
Definition: Settings.h:2019
Zivid::Settings
Settings for a Zivid camera
Definition: Settings.h:107
Zivid::Settings::Filters::Gaussian::Sigma::range
Range< ValueType > range() const
The range of valid values
Definition: Settings.h:1143
Zivid::Settings::get
const Settings::Bidirectional & get() const
Definition: Settings.h:2731
APIExport.h
Zivid::Settings::set
void set(const std::string &fullPath, const std::string &value)
Set a value from string by specifying the path
Zivid::Settings::RedBalance::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: Settings.h:2677
Zivid::Settings::Filters::Saturated::Enabled::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: Settings.h:1958
Zivid::Settings::Filters::Contrast::setFromString
void setFromString(const std::string &value)
Set from the given string
Zivid::Settings::Filters::Outlier
Discard point if Euclidean distance to neighboring points is above a threshold
Definition: Settings.h:1332
Zivid::Settings::Filters::setFromString
void setFromString(const std::string &value)
Set from the given string
Zivid::Settings::Filters::Reflection::get
const Settings::Filters::Reflection::Enabled & get() const
Definition: Settings.h:1807
Zivid::Settings::BlueBalance::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: Settings.h:335
Zivid::Settings::BlueBalance
White balance of blue channel in the camera
Definition: Settings.h:293
Zivid::Settings::Filters::Gaussian::Enabled::toString
std::string toString() const
Get the value as string
Definition: Settings.h:1065
Zivid::Settings::Gain::ValueType
double ValueType
The type of the underlying value
Definition: Settings.h:2451
Zivid::Settings::Gain
Analog gain in the camera
Definition: Settings.h:2447
Zivid::Settings::Brightness::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: Settings.h:459
Zivid::Settings::Filters::Outlier::toString
std::string toString() const
Get the value as string
Zivid::Settings::Filters::Gaussian::Sigma::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: Settings.h:1149
Zivid::Settings::Filters::Saturated::toString
std::string toString() const
Get the value as string
Zivid::Settings::Brightness::toString
std::string toString() const
Get the value as string
Definition: Settings.h:465
Zivid::Settings::Filters::Reflection::toString
std::string toString() const
Get the value as string
Zivid::Settings::Filters
Collection of filters
Definition: Settings.h:609
Zivid::Settings::Filters::Gaussian::Sigma::value
const ValueType & value() const
Get the value
Definition: Settings.h:1137
Zivid::Settings::Brightness
Brightness controls the light output from the projector.
Definition: Settings.h:403
Zivid::Settings::BlueBalance::ValueType
double ValueType
The type of the underlying value
Definition: Settings.h:297
Zivid::Settings::Gain::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: Settings.h:2486
Zivid
The main Zivid namespace. All Zivid code is found here
Definition: Application.h:52
Zivid::Settings::Filters::Gaussian::setFromString
void setFromString(const std::string &value)
Set from the given string
Zivid::Settings::Settings
Settings()=default
Default constructor
Zivid::Settings::Filters::Reflection
Discard points likely introduced by reflections (useful for shiny materials)
Definition: Settings.h:1681
ZIVID_API_EXPORT
#define ZIVID_API_EXPORT
Definition: APIExport.h:56
Zivid::Settings::ExposureTime::ValueType
std::chrono::microseconds ValueType
The type of the underlying value
Definition: Settings.h:517
Zivid::Settings::Filters::Outlier::get
const Settings::Filters::Outlier::Enabled & get() const
Definition: Settings.h:1554
Zivid::Settings::Filters::Gaussian::toString
std::string toString() const
Get the value as string
Zivid::Settings::Filters::Contrast::Enabled::ValueType
bool ValueType
The type of the underlying value
Definition: Settings.h:665
Zivid::Settings::ExposureTime::range
Range< ValueType > range() const
The range of valid values
Definition: Settings.h:549
Zivid::Settings::Bidirectional
Enable or disable the use of bi-directional patterns (requires twice as many patterns as well as incr...
Definition: Settings.h:196
Zivid::Settings::Filters::Saturated::Enabled::toString
std::string toString() const
Get the value as string
Definition: Settings.h:1975
Zivid::Settings::Iris::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: Settings.h:2581
Zivid::operator<<
ZIVID_API_EXPORT std::ostream & operator<<(std::ostream &stream, const Camera &camera)
Serialize the value to a stream
Zivid::Settings::Filters::Reflection::Enabled
Enable or disable the reflection filter. Note that this filter is computationally intensive and may a...
Definition: Settings.h:1708
Zivid::Settings::Filters::Outlier::Enabled::toString
std::string toString() const
Get the value as string
Definition: Settings.h:1414
Zivid::Settings::Iris
Iris (aperture) setting for the camera
Definition: Settings.h:2540
Zivid::Settings::Filters::Outlier::Threshold
Discard point if Euclidean distance to neighboring points is above the given value
Definition: Settings.h:1456
Zivid::Settings::Filters::Contrast::Enabled::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: Settings.h:699
Zivid::Range
Class describing a range of values for a given type T The range boudaries for both minimum and maximu...
Definition: Range.h:95
Zivid::Settings::Bidirectional::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: Settings.h:234
Zivid::Settings::Brightness::ValueType
double ValueType
The type of the underlying value
Definition: Settings.h:407