Zivid C++ API 2.14.0+e4a0c4a9-1
Settings2D.h
Go to the documentation of this file.
1/*******************************************************************************
2 * This file is part of the Zivid API
3 *
4 * Copyright 2015-2024 (C) Zivid AS
5 * All rights reserved.
6 *
7 * Zivid Software License, v1.0
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * 3. Neither the name of Zivid AS nor the names of its contributors may be used
20 * to endorse or promote products derived from this software without specific
21 * prior written permission.
22 *
23 * 4. This software, with or without modification, must not be used with any
24 * other 3D camera than from Zivid AS.
25 *
26 * 5. Any software provided in binary form under this license must not be
27 * reverse engineered, decompiled, modified and/or disassembled.
28 *
29 * THIS SOFTWARE IS PROVIDED BY ZIVID AS "AS IS" AND ANY EXPRESS OR IMPLIED
30 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
31 * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
32 * DISCLAIMED. IN NO EVENT SHALL ZIVID AS OR CONTRIBUTORS BE LIABLE FOR ANY
33 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
36 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 * Contact: Zivid Customer Success Team <customersuccess@zivid.com>
41 * Info: http://www.zivid.com
42 ******************************************************************************/
43
44#pragma once
45
46#include <array>
47#include <chrono>
48#include <cmath>
49#include <ctime>
50#include <iomanip>
51#include <memory>
52#include <optional>
53#include <set>
54#include <sstream>
55#include <string>
56#include <tuple>
57#include <utility>
58#include <vector>
59
65#include "Zivid/Range.h"
66
67#ifdef _MSC_VER
68# pragma warning(push)
69# pragma warning(disable : 4251) // "X needs to have dll-interface to be used by clients of class Y."
70#endif
71
72namespace Zivid
73{
74
76
77 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
79 {
80 public:
82 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
83
85 static constexpr const char *path{ "" };
86
88 static constexpr const char *name{ "Settings2D" };
89
91 static constexpr const char *description{
92 R"description(Settings used when capturing 2D images with a Zivid camera.)description"
93 };
94
95 static constexpr size_t version{ 7 };
96
97#ifndef NO_DOC
98 template<size_t>
99 struct Version;
100
101 using LatestVersion = Zivid::Settings2D;
102
103 // Short identifier. This value is not guaranteed to be universally unique
104 // Todo(ZIVID-2808): Move this to internal DataModelExt header
105 static constexpr std::array<uint8_t, 3> binaryId{ 's', 't', '2' };
106
107#endif
108
114
115 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
117 {
118 public:
120 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
121
123 static constexpr const char *path{ "Acquisition" };
124
126 static constexpr const char *name{ "Acquisition" };
127
129 static constexpr const char *description{ R"description(Settings for one 2D acquisition.
130
131When capturing 2D HDR, all 2D acquisitions must have the same Aperture setting. Use Exposure Time
132or Gain to control the exposure instead.
133)description" };
134
141
142 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
144 {
145 public:
147 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
148
150 static constexpr const char *path{ "Acquisition/Aperture" };
151
153 static constexpr const char *name{ "Aperture" };
154
156 static constexpr const char *description{
157 R"description(Aperture setting for the camera. Specified as an f-number (the ratio of lens focal length to
158the effective aperture diameter).
159
160When capturing 2D HDR, all 2D acquisitions must have the same Aperture setting. Use Exposure Time
161or Gain to control the exposure instead.
162)description"
163 };
164
166 using ValueType = double;
167
169 static constexpr Range<double> validRange()
170 {
171 return { 1.4, 32.0 };
172 }
173
175 Aperture() = default;
176
178 explicit constexpr Aperture(double value)
179 : m_opt{ verifyValue(value) }
180 {}
181
186 double value() const;
187
189 bool hasValue() const;
190
192 void reset();
193
195 std::string toString() const;
196
198 bool operator==(const Aperture &other) const
199 {
200 return m_opt == other.m_opt;
201 }
202
204 bool operator!=(const Aperture &other) const
205 {
206 return m_opt != other.m_opt;
207 }
208
210 bool operator<(const Aperture &other) const
211 {
212 return m_opt < other.m_opt;
213 }
214
216 bool operator>(const Aperture &other) const
217 {
218 return m_opt > other.m_opt;
219 }
220
222 bool operator<=(const Aperture &other) const
223 {
224 return m_opt <= other.m_opt;
225 }
226
228 bool operator>=(const Aperture &other) const
229 {
230 return m_opt >= other.m_opt;
231 }
232
234 friend std::ostream &operator<<(std::ostream &stream, const Aperture &value)
235 {
236 return stream << value.toString();
237 }
238
239 private:
240 void setFromString(const std::string &value);
241
242 constexpr ValueType static verifyValue(const ValueType &value)
243 {
244 return validRange().isInRange(value)
245 ? value
246 : throw std::out_of_range{ "Aperture{ " + std::to_string(value) + " } is not in range ["
247 + std::to_string(validRange().min()) + ", "
248 + std::to_string(validRange().max()) + "]" };
249 }
250
251 std::optional<double> m_opt;
252
253 friend struct DataModel::Detail::Befriend<Aperture>;
254 };
255
267
268 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
270 {
271 public:
273 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
274
276 static constexpr const char *path{ "Acquisition/Brightness" };
277
279 static constexpr const char *name{ "Brightness" };
280
282 static constexpr const char *description{
283 R"description(Brightness controls the light output from the projector.
284
285Brightness above 1.0 may be needed when the distance between the camera and the scene is large,
286or in case of high levels of ambient lighting.
287
288When brightness is above 1.0 the duty cycle of the camera (the percentage of time the camera
289can capture) will be reduced. The duty cycle in boost mode is 50%. The duty cycle is calculated
290over a 10 second period. This limitation is enforced automatically by the camera. Calling capture
291when the duty cycle limit has been reached will cause the camera to first wait (sleep) for a
292duration of time to cool down, before capture will start.
293)description"
294 };
295
297 using ValueType = double;
298
300 static constexpr Range<double> validRange()
301 {
302 return { 0, 2.5 };
303 }
304
306 Brightness() = default;
307
309 explicit constexpr Brightness(double value)
310 : m_opt{ verifyValue(value) }
311 {}
312
317 double value() const;
318
320 bool hasValue() const;
321
323 void reset();
324
326 std::string toString() const;
327
329 bool operator==(const Brightness &other) const
330 {
331 return m_opt == other.m_opt;
332 }
333
335 bool operator!=(const Brightness &other) const
336 {
337 return m_opt != other.m_opt;
338 }
339
341 bool operator<(const Brightness &other) const
342 {
343 return m_opt < other.m_opt;
344 }
345
347 bool operator>(const Brightness &other) const
348 {
349 return m_opt > other.m_opt;
350 }
351
353 bool operator<=(const Brightness &other) const
354 {
355 return m_opt <= other.m_opt;
356 }
357
359 bool operator>=(const Brightness &other) const
360 {
361 return m_opt >= other.m_opt;
362 }
363
365 friend std::ostream &operator<<(std::ostream &stream, const Brightness &value)
366 {
367 return stream << value.toString();
368 }
369
370 private:
371 void setFromString(const std::string &value);
372
373 constexpr ValueType static verifyValue(const ValueType &value)
374 {
375 return validRange().isInRange(value)
376 ? value
377 : throw std::out_of_range{ "Brightness{ " + std::to_string(value)
378 + " } is not in range [" + std::to_string(validRange().min())
379 + ", " + std::to_string(validRange().max()) + "]" };
380 }
381
382 std::optional<double> m_opt;
383
384 friend struct DataModel::Detail::Befriend<Brightness>;
385 };
386
388
389 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
391 {
392 public:
394 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
395
397 static constexpr const char *path{ "Acquisition/ExposureTime" };
398
400 static constexpr const char *name{ "ExposureTime" };
401
403 static constexpr const char *description{ R"description(Exposure time for the image.)description" };
404
406 using ValueType = std::chrono::microseconds;
407
410 {
411 return { std::chrono::microseconds{ 900 }, std::chrono::microseconds{ 100000 } };
412 }
413
415 ExposureTime() = default;
416
418 explicit constexpr ExposureTime(std::chrono::microseconds value)
419 : m_opt{ verifyValue(value) }
420 {}
421
426 std::chrono::microseconds value() const;
427
429 bool hasValue() const;
430
432 void reset();
433
435 std::string toString() const;
436
438 bool operator==(const ExposureTime &other) const
439 {
440 return m_opt == other.m_opt;
441 }
442
444 bool operator!=(const ExposureTime &other) const
445 {
446 return m_opt != other.m_opt;
447 }
448
450 bool operator<(const ExposureTime &other) const
451 {
452 return m_opt < other.m_opt;
453 }
454
456 bool operator>(const ExposureTime &other) const
457 {
458 return m_opt > other.m_opt;
459 }
460
462 bool operator<=(const ExposureTime &other) const
463 {
464 return m_opt <= other.m_opt;
465 }
466
468 bool operator>=(const ExposureTime &other) const
469 {
470 return m_opt >= other.m_opt;
471 }
472
474 friend std::ostream &operator<<(std::ostream &stream, const ExposureTime &value)
475 {
476 return stream << value.toString();
477 }
478
479 private:
480 void setFromString(const std::string &value);
481
482 constexpr ValueType static verifyValue(const ValueType &value)
483 {
484 return validRange().isInRange(value)
485 ? value
486 : throw std::out_of_range{ "ExposureTime{ " + std::to_string(value.count())
487 + " } is not in range ["
488 + std::to_string(validRange().min().count()) + ", "
489 + std::to_string(validRange().max().count()) + "]" };
490 }
491
492 std::optional<std::chrono::microseconds> m_opt;
493
494 friend struct DataModel::Detail::Befriend<ExposureTime>;
495 };
496
498
499 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
501 {
502 public:
504 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
505
507 static constexpr const char *path{ "Acquisition/Gain" };
508
510 static constexpr const char *name{ "Gain" };
511
513 static constexpr const char *description{ R"description(Analog gain in the camera.)description" };
514
516 using ValueType = double;
517
519 static constexpr Range<double> validRange()
520 {
521 return { 1, 16 };
522 }
523
525 Gain() = default;
526
528 explicit constexpr Gain(double value)
529 : m_opt{ verifyValue(value) }
530 {}
531
536 double value() const;
537
539 bool hasValue() const;
540
542 void reset();
543
545 std::string toString() const;
546
548 bool operator==(const Gain &other) const
549 {
550 return m_opt == other.m_opt;
551 }
552
554 bool operator!=(const Gain &other) const
555 {
556 return m_opt != other.m_opt;
557 }
558
560 bool operator<(const Gain &other) const
561 {
562 return m_opt < other.m_opt;
563 }
564
566 bool operator>(const Gain &other) const
567 {
568 return m_opt > other.m_opt;
569 }
570
572 bool operator<=(const Gain &other) const
573 {
574 return m_opt <= other.m_opt;
575 }
576
578 bool operator>=(const Gain &other) const
579 {
580 return m_opt >= other.m_opt;
581 }
582
584 friend std::ostream &operator<<(std::ostream &stream, const Gain &value)
585 {
586 return stream << value.toString();
587 }
588
589 private:
590 void setFromString(const std::string &value);
591
592 constexpr ValueType static verifyValue(const ValueType &value)
593 {
594 return validRange().isInRange(value)
595 ? value
596 : throw std::out_of_range{ "Gain{ " + std::to_string(value) + " } is not in range ["
597 + std::to_string(validRange().min()) + ", "
598 + std::to_string(validRange().max()) + "]" };
599 }
600
601 std::optional<double> m_opt;
602
603 friend struct DataModel::Detail::Befriend<Gain>;
604 };
605
606 using Descendants = std::tuple<
611
614
629#ifndef NO_DOC
630 template<
631 typename... Args,
632 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
633 typename std::enable_if<
634 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
635 value,
636 int>::type = 0>
637#else
638 template<typename... Args>
639#endif
640 explicit Acquisition(Args &&...args)
641 {
642 using namespace Zivid::Detail::TypeTraits;
643
644 static_assert(
645 AllArgsDecayedAreUnique<Args...>::value,
646 "Found duplicate types among the arguments passed to Acquisition(...). "
647 "Types should be listed at most once.");
648
649 set(std::forward<Args>(args)...);
650 }
651
665#ifndef NO_DOC
666 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
667#else
668 template<typename... Args>
669#endif
670 void set(Args &&...args)
671 {
672 using namespace Zivid::Detail::TypeTraits;
673
674 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
675 static_assert(
676 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
677
678 static_assert(
679 AllArgsDecayedAreUnique<Args...>::value,
680 "Found duplicate types among the arguments passed to set(...). "
681 "Types should be listed at most once.");
682
683 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
684 }
685
700#ifndef NO_DOC
701 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
702#else
703 template<typename... Args>
704#endif
705 Acquisition copyWith(Args &&...args) const
706 {
707 using namespace Zivid::Detail::TypeTraits;
708
709 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
710 static_assert(
711 AllArgsAreDescendantNodes::value,
712 "All arguments passed to copyWith(...) must be descendant nodes.");
713
714 static_assert(
715 AllArgsDecayedAreUnique<Args...>::value,
716 "Found duplicate types among the arguments passed to copyWith(...). "
717 "Types should be listed at most once.");
718
719 auto copy{ *this };
720 copy.set(std::forward<Args>(args)...);
721 return copy;
722 }
723
725 const Aperture &aperture() const
726 {
727 return m_aperture;
728 }
729
732 {
733 return m_aperture;
734 }
735
737 Acquisition &set(const Aperture &value)
738 {
739 m_aperture = value;
740 return *this;
741 }
742
744 const Brightness &brightness() const
745 {
746 return m_brightness;
747 }
748
751 {
752 return m_brightness;
753 }
754
757 {
758 m_brightness = value;
759 return *this;
760 }
761
764 {
765 return m_exposureTime;
766 }
767
770 {
771 return m_exposureTime;
772 }
773
776 {
777 m_exposureTime = value;
778 return *this;
779 }
780
782 const Gain &gain() const
783 {
784 return m_gain;
785 }
786
789 {
790 return m_gain;
791 }
792
794 Acquisition &set(const Gain &value)
795 {
796 m_gain = value;
797 return *this;
798 }
799
800 template<
801 typename T,
802 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::Aperture>::value, int>::type = 0>
804 {
805 return m_aperture;
806 }
807
808 template<
809 typename T,
810 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::Brightness>::value, int>::type = 0>
812 {
813 return m_brightness;
814 }
815
816 template<
817 typename T,
818 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::ExposureTime>::value, int>::type = 0>
820 {
821 return m_exposureTime;
822 }
823
824 template<
825 typename T,
826 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::Gain>::value, int>::type = 0>
828 {
829 return m_gain;
830 }
831
832 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
834 {
835 return m_aperture;
836 }
837
838 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
840 {
841 return m_brightness;
842 }
843
844 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
846 {
847 return m_exposureTime;
848 }
849
850 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
852 {
853 return m_gain;
854 }
855
857 template<typename F>
858 void forEach(const F &f) const
859 {
860 f(m_aperture);
861 f(m_brightness);
862 f(m_exposureTime);
863 f(m_gain);
864 }
865
867 template<typename F>
868 void forEach(const F &f)
869 {
870 f(m_aperture);
871 f(m_brightness);
872 f(m_exposureTime);
873 f(m_gain);
874 }
875
877 bool operator==(const Acquisition &other) const;
878
880 bool operator!=(const Acquisition &other) const;
881
883 std::string toString() const;
884
886 friend std::ostream &operator<<(std::ostream &stream, const Acquisition &value)
887 {
888 return stream << value.toString();
889 }
890
891 private:
892 void setFromString(const std::string &value);
893
894 void setFromString(const std::string &fullPath, const std::string &value);
895
896 std::string getString(const std::string &fullPath) const;
897
898 Aperture m_aperture;
899 Brightness m_brightness;
900 ExposureTime m_exposureTime;
901 Gain m_gain;
902
903 friend struct DataModel::Detail::Befriend<Acquisition>;
904 };
905
907
908 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
910 {
911 public:
913 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafDataModelList;
914
916 static constexpr const char *path{ "Acquisitions" };
917
919 static constexpr const char *name{ "Acquisitions" };
920
922 static constexpr const char *description{
923 R"description(List of acquisitions used for 2D capture.)description"
924 };
925
927 using ValueType = std::vector<Settings2D::Acquisition>;
928
931 {
932 return { 0, std::numeric_limits<ValueType::size_type>::max() };
933 }
934
936 Acquisitions() = default;
937
939 explicit Acquisitions(std::vector<Settings2D::Acquisition> value)
940 : m_value{ std::move(value) }
941 {}
942
944 explicit Acquisitions(std::initializer_list<Settings2D::Acquisition> value)
945 : Acquisitions{ ValueType{ value } }
946 {}
947
949 const std::vector<Settings2D::Acquisition> &value() const;
950
952 std::string toString() const;
953
955 std::size_t size() const noexcept;
956
958 bool isEmpty() const noexcept;
959
965 template<typename... Args>
966 void emplaceBack(Args &&...args)
967 {
968 m_value.emplace_back(std::forward<Args>(args)...);
969 }
970
976 Settings2D::Acquisition &at(std::size_t pos);
977
983 const Settings2D::Acquisition &at(std::size_t pos) const;
984
991
997 const Settings2D::Acquisition &operator[](std::size_t pos) const;
998
1000 template<typename F>
1001 void forEach(const F &f)
1002 {
1003 for(auto &child : m_value)
1004 {
1005 f(child);
1006 }
1007 }
1008
1010 template<typename F>
1011 void forEach(const F &f) const
1012 {
1013 for(const auto &child : m_value)
1014 {
1015 f(child);
1016 }
1017 }
1018
1020 using Iterator = std::vector<Settings2D::Acquisition>::iterator;
1021
1023 Iterator begin() noexcept;
1024
1026 Iterator end() noexcept;
1027
1029 using ConstIterator = std::vector<Settings2D::Acquisition>::const_iterator;
1030
1032 ConstIterator begin() const noexcept;
1033
1035 ConstIterator end() const noexcept;
1036
1038 ConstIterator cbegin() const noexcept;
1039
1041 ConstIterator cend() const noexcept;
1042
1044 bool operator==(const Acquisitions &other) const
1045 {
1046 return m_value == other.m_value;
1047 }
1048
1050 bool operator!=(const Acquisitions &other) const
1051 {
1052 return m_value != other.m_value;
1053 }
1054
1056 friend std::ostream &operator<<(std::ostream &stream, const Acquisitions &value)
1057 {
1058 return stream << value.toString();
1059 }
1060
1061 private:
1062 void setFromString(const std::string &value);
1063
1064 std::vector<Settings2D::Acquisition> m_value{};
1065
1066 friend struct DataModel::Detail::Befriend<Acquisitions>;
1067 };
1068
1070
1071 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1073 {
1074 public:
1076 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
1077
1079 static constexpr const char *path{ "Processing" };
1080
1082 static constexpr const char *name{ "Processing" };
1083
1085 static constexpr const char *description{ R"description(2D processing settings.)description" };
1086
1088
1089 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1091 {
1092 public:
1094 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
1095
1097 static constexpr const char *path{ "Processing/Color" };
1098
1100 static constexpr const char *name{ "Color" };
1101
1103 static constexpr const char *description{ R"description(Color settings.)description" };
1104
1106
1107 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1109 {
1110 public:
1112 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
1113
1115 static constexpr const char *path{ "Processing/Color/Balance" };
1116
1118 static constexpr const char *name{ "Balance" };
1119
1121 static constexpr const char *description{ R"description(Color balance settings.)description" };
1122
1124
1125 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1127 {
1128 public:
1130 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1131
1133 static constexpr const char *path{ "Processing/Color/Balance/Blue" };
1134
1136 static constexpr const char *name{ "Blue" };
1137
1139 static constexpr const char *description{
1140 R"description(Digital gain applied to blue channel.)description"
1141 };
1142
1144 using ValueType = double;
1145
1147 static constexpr Range<double> validRange()
1148 {
1149 return { 1.0, 8.0 };
1150 }
1151
1153 Blue() = default;
1154
1156 explicit constexpr Blue(double value)
1157 : m_opt{ verifyValue(value) }
1158 {}
1159
1164 double value() const;
1165
1167 bool hasValue() const;
1168
1170 void reset();
1171
1173 std::string toString() const;
1174
1176 bool operator==(const Blue &other) const
1177 {
1178 return m_opt == other.m_opt;
1179 }
1180
1182 bool operator!=(const Blue &other) const
1183 {
1184 return m_opt != other.m_opt;
1185 }
1186
1188 bool operator<(const Blue &other) const
1189 {
1190 return m_opt < other.m_opt;
1191 }
1192
1194 bool operator>(const Blue &other) const
1195 {
1196 return m_opt > other.m_opt;
1197 }
1198
1200 bool operator<=(const Blue &other) const
1201 {
1202 return m_opt <= other.m_opt;
1203 }
1204
1206 bool operator>=(const Blue &other) const
1207 {
1208 return m_opt >= other.m_opt;
1209 }
1210
1212 friend std::ostream &operator<<(std::ostream &stream, const Blue &value)
1213 {
1214 return stream << value.toString();
1215 }
1216
1217 private:
1218 void setFromString(const std::string &value);
1219
1220 constexpr ValueType static verifyValue(const ValueType &value)
1221 {
1222 return validRange().isInRange(value)
1223 ? value
1224 : throw std::out_of_range{ "Blue{ " + std::to_string(value)
1225 + " } is not in range ["
1226 + std::to_string(validRange().min()) + ", "
1227 + std::to_string(validRange().max()) + "]" };
1228 }
1229
1230 std::optional<double> m_opt;
1231
1232 friend struct DataModel::Detail::Befriend<Blue>;
1233 };
1234
1236
1237 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1239 {
1240 public:
1242 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1243
1245 static constexpr const char *path{ "Processing/Color/Balance/Green" };
1246
1248 static constexpr const char *name{ "Green" };
1249
1251 static constexpr const char *description{
1252 R"description(Digital gain applied to green channel.)description"
1253 };
1254
1256 using ValueType = double;
1257
1259 static constexpr Range<double> validRange()
1260 {
1261 return { 1.0, 8.0 };
1262 }
1263
1265 Green() = default;
1266
1268 explicit constexpr Green(double value)
1269 : m_opt{ verifyValue(value) }
1270 {}
1271
1276 double value() const;
1277
1279 bool hasValue() const;
1280
1282 void reset();
1283
1285 std::string toString() const;
1286
1288 bool operator==(const Green &other) const
1289 {
1290 return m_opt == other.m_opt;
1291 }
1292
1294 bool operator!=(const Green &other) const
1295 {
1296 return m_opt != other.m_opt;
1297 }
1298
1300 bool operator<(const Green &other) const
1301 {
1302 return m_opt < other.m_opt;
1303 }
1304
1306 bool operator>(const Green &other) const
1307 {
1308 return m_opt > other.m_opt;
1309 }
1310
1312 bool operator<=(const Green &other) const
1313 {
1314 return m_opt <= other.m_opt;
1315 }
1316
1318 bool operator>=(const Green &other) const
1319 {
1320 return m_opt >= other.m_opt;
1321 }
1322
1324 friend std::ostream &operator<<(std::ostream &stream, const Green &value)
1325 {
1326 return stream << value.toString();
1327 }
1328
1329 private:
1330 void setFromString(const std::string &value);
1331
1332 constexpr ValueType static verifyValue(const ValueType &value)
1333 {
1334 return validRange().isInRange(value)
1335 ? value
1336 : throw std::out_of_range{ "Green{ " + std::to_string(value)
1337 + " } is not in range ["
1338 + std::to_string(validRange().min()) + ", "
1339 + std::to_string(validRange().max()) + "]" };
1340 }
1341
1342 std::optional<double> m_opt;
1343
1344 friend struct DataModel::Detail::Befriend<Green>;
1345 };
1346
1348
1349 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1351 {
1352 public:
1354 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1355
1357 static constexpr const char *path{ "Processing/Color/Balance/Red" };
1358
1360 static constexpr const char *name{ "Red" };
1361
1363 static constexpr const char *description{
1364 R"description(Digital gain applied to red channel.)description"
1365 };
1366
1368 using ValueType = double;
1369
1371 static constexpr Range<double> validRange()
1372 {
1373 return { 1.0, 8.0 };
1374 }
1375
1377 Red() = default;
1378
1380 explicit constexpr Red(double value)
1381 : m_opt{ verifyValue(value) }
1382 {}
1383
1388 double value() const;
1389
1391 bool hasValue() const;
1392
1394 void reset();
1395
1397 std::string toString() const;
1398
1400 bool operator==(const Red &other) const
1401 {
1402 return m_opt == other.m_opt;
1403 }
1404
1406 bool operator!=(const Red &other) const
1407 {
1408 return m_opt != other.m_opt;
1409 }
1410
1412 bool operator<(const Red &other) const
1413 {
1414 return m_opt < other.m_opt;
1415 }
1416
1418 bool operator>(const Red &other) const
1419 {
1420 return m_opt > other.m_opt;
1421 }
1422
1424 bool operator<=(const Red &other) const
1425 {
1426 return m_opt <= other.m_opt;
1427 }
1428
1430 bool operator>=(const Red &other) const
1431 {
1432 return m_opt >= other.m_opt;
1433 }
1434
1436 friend std::ostream &operator<<(std::ostream &stream, const Red &value)
1437 {
1438 return stream << value.toString();
1439 }
1440
1441 private:
1442 void setFromString(const std::string &value);
1443
1444 constexpr ValueType static verifyValue(const ValueType &value)
1445 {
1446 return validRange().isInRange(value)
1447 ? value
1448 : throw std::out_of_range{ "Red{ " + std::to_string(value)
1449 + " } is not in range ["
1450 + std::to_string(validRange().min()) + ", "
1451 + std::to_string(validRange().max()) + "]" };
1452 }
1453
1454 std::optional<double> m_opt;
1455
1456 friend struct DataModel::Detail::Befriend<Red>;
1457 };
1458
1459 using Descendants = std::tuple<
1463
1466
1480#ifndef NO_DOC
1481 template<
1482 typename... Args,
1483 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1484 typename std::enable_if<
1485 Zivid::Detail::TypeTraits::
1486 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
1487 int>::type = 0>
1488#else
1489 template<typename... Args>
1490#endif
1491 explicit Balance(Args &&...args)
1492 {
1493 using namespace Zivid::Detail::TypeTraits;
1494
1495 static_assert(
1496 AllArgsDecayedAreUnique<Args...>::value,
1497 "Found duplicate types among the arguments passed to Balance(...). "
1498 "Types should be listed at most once.");
1499
1500 set(std::forward<Args>(args)...);
1501 }
1502
1515#ifndef NO_DOC
1516 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1517#else
1518 template<typename... Args>
1519#endif
1520 void set(Args &&...args)
1521 {
1522 using namespace Zivid::Detail::TypeTraits;
1523
1524 using AllArgsAreDescendantNodes =
1525 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1526 static_assert(
1527 AllArgsAreDescendantNodes::value,
1528 "All arguments passed to set(...) must be descendant nodes.");
1529
1530 static_assert(
1531 AllArgsDecayedAreUnique<Args...>::value,
1532 "Found duplicate types among the arguments passed to set(...). "
1533 "Types should be listed at most once.");
1534
1535 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1536 }
1537
1551#ifndef NO_DOC
1552 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1553#else
1554 template<typename... Args>
1555#endif
1556 Balance copyWith(Args &&...args) const
1557 {
1558 using namespace Zivid::Detail::TypeTraits;
1559
1560 using AllArgsAreDescendantNodes =
1561 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1562 static_assert(
1563 AllArgsAreDescendantNodes::value,
1564 "All arguments passed to copyWith(...) must be descendant nodes.");
1565
1566 static_assert(
1567 AllArgsDecayedAreUnique<Args...>::value,
1568 "Found duplicate types among the arguments passed to copyWith(...). "
1569 "Types should be listed at most once.");
1570
1571 auto copy{ *this };
1572 copy.set(std::forward<Args>(args)...);
1573 return copy;
1574 }
1575
1577 const Blue &blue() const
1578 {
1579 return m_blue;
1580 }
1581
1584 {
1585 return m_blue;
1586 }
1587
1589 Balance &set(const Blue &value)
1590 {
1591 m_blue = value;
1592 return *this;
1593 }
1594
1596 const Green &green() const
1597 {
1598 return m_green;
1599 }
1600
1603 {
1604 return m_green;
1605 }
1606
1608 Balance &set(const Green &value)
1609 {
1610 m_green = value;
1611 return *this;
1612 }
1613
1615 const Red &red() const
1616 {
1617 return m_red;
1618 }
1619
1622 {
1623 return m_red;
1624 }
1625
1627 Balance &set(const Red &value)
1628 {
1629 m_red = value;
1630 return *this;
1631 }
1632
1633 template<
1634 typename T,
1635 typename std::enable_if<
1636 std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value,
1637 int>::type = 0>
1639 {
1640 return m_blue;
1641 }
1642
1643 template<
1644 typename T,
1645 typename std::enable_if<
1646 std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value,
1647 int>::type = 0>
1649 {
1650 return m_green;
1651 }
1652
1653 template<
1654 typename T,
1655 typename std::enable_if<
1656 std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value,
1657 int>::type = 0>
1659 {
1660 return m_red;
1661 }
1662
1663 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1665 {
1666 return m_blue;
1667 }
1668
1669 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1671 {
1672 return m_green;
1673 }
1674
1675 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
1677 {
1678 return m_red;
1679 }
1680
1682 template<typename F>
1683 void forEach(const F &f) const
1684 {
1685 f(m_blue);
1686 f(m_green);
1687 f(m_red);
1688 }
1689
1691 template<typename F>
1692 void forEach(const F &f)
1693 {
1694 f(m_blue);
1695 f(m_green);
1696 f(m_red);
1697 }
1698
1700 bool operator==(const Balance &other) const;
1701
1703 bool operator!=(const Balance &other) const;
1704
1706 std::string toString() const;
1707
1709 friend std::ostream &operator<<(std::ostream &stream, const Balance &value)
1710 {
1711 return stream << value.toString();
1712 }
1713
1714 private:
1715 void setFromString(const std::string &value);
1716
1717 void setFromString(const std::string &fullPath, const std::string &value);
1718
1719 std::string getString(const std::string &fullPath) const;
1720
1721 Blue m_blue;
1722 Green m_green;
1723 Red m_red;
1724
1725 friend struct DataModel::Detail::Befriend<Balance>;
1726 };
1727
1729
1730 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1732 {
1733 public:
1735 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
1736
1738 static constexpr const char *path{ "Processing/Color/Experimental" };
1739
1741 static constexpr const char *name{ "Experimental" };
1742
1744 static constexpr const char *description{
1745 R"description(Experimental color settings. These may be renamed, moved or deleted in the future.)description"
1746 };
1747
1763
1764 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1766 {
1767 public:
1769 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1770
1772 static constexpr const char *path{ "Processing/Color/Experimental/Mode" };
1773
1775 static constexpr const char *name{ "Mode" };
1776
1778 static constexpr const char *description{
1779 R"description(This setting controls how the color image is computed.
1780
1781`automatic` is the default option. It performs tone mapping for HDR captures, but not for
1782single-acquisition captures. Use this mode with a single acquisition if you want to have
1783the most control over the colors in the image.
1784
1785`toneMapping` uses all the acquisitions to create one merged and normalized color image. For
1786HDR captures the dynamic range of the captured images is usually higher than the 8-bit color
1787image range. `toneMapping` will map the HDR color data to the 8-bit color output range by
1788applying a scaling factor. `toneMapping` can also be used for single-acquisition captures to
1789normalize the captured color image to the full 8-bit output. Note that when using `toneMapping`
1790mode the color values can be inconsistent over repeated captures if you move, add or remove
1791objects in the scene. For the most control over the colors in the single-acquisition case,
1792select the `automatic` mode.
1793)description"
1794 };
1795
1797 enum class ValueType
1798 {
1799 automatic,
1800 toneMapping
1801 };
1802 static const Mode automatic;
1803 static const Mode toneMapping;
1804
1806 static std::set<ValueType> validValues()
1807 {
1808 return { ValueType::automatic, ValueType::toneMapping };
1809 }
1810
1812 Mode() = default;
1813
1815 explicit constexpr Mode(ValueType value)
1816 : m_opt{ verifyValue(value) }
1817 {}
1818
1824
1826 bool hasValue() const;
1827
1829 void reset();
1830
1832 std::string toString() const;
1833
1835 friend std::ostream &operator<<(std::ostream &stream, const Mode::ValueType &value)
1836 {
1837 return stream << Mode{ value }.toString();
1838 }
1839
1841 bool operator==(const Mode &other) const
1842 {
1843 return m_opt == other.m_opt;
1844 }
1845
1847 bool operator!=(const Mode &other) const
1848 {
1849 return m_opt != other.m_opt;
1850 }
1851
1853 friend std::ostream &operator<<(std::ostream &stream, const Mode &value)
1854 {
1855 return stream << value.toString();
1856 }
1857
1858 private:
1859 void setFromString(const std::string &value);
1860
1861 constexpr ValueType static verifyValue(const ValueType &value)
1862 {
1863 return value == ValueType::automatic || value == ValueType::toneMapping
1864 ? value
1865 : throw std::invalid_argument{
1866 "Invalid value: Mode{ "
1867 + std::to_string(static_cast<std::underlying_type<ValueType>::type>(value))
1868 + " }"
1869 };
1870 }
1871
1872 std::optional<ValueType> m_opt;
1873
1874 friend struct DataModel::Detail::Befriend<Mode>;
1875 };
1876
1877 using Descendants = std::tuple<Settings2D::Processing::Color::Experimental::Mode>;
1878
1881
1893#ifndef NO_DOC
1894 template<
1895 typename... Args,
1896 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1897 typename std::enable_if<
1898 Zivid::Detail::TypeTraits::
1899 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
1900 int>::type = 0>
1901#else
1902 template<typename... Args>
1903#endif
1904 explicit Experimental(Args &&...args)
1905 {
1906 using namespace Zivid::Detail::TypeTraits;
1907
1908 static_assert(
1909 AllArgsDecayedAreUnique<Args...>::value,
1910 "Found duplicate types among the arguments passed to Experimental(...). "
1911 "Types should be listed at most once.");
1912
1913 set(std::forward<Args>(args)...);
1914 }
1915
1926#ifndef NO_DOC
1927 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1928#else
1929 template<typename... Args>
1930#endif
1931 void set(Args &&...args)
1932 {
1933 using namespace Zivid::Detail::TypeTraits;
1934
1935 using AllArgsAreDescendantNodes =
1936 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1937 static_assert(
1938 AllArgsAreDescendantNodes::value,
1939 "All arguments passed to set(...) must be descendant nodes.");
1940
1941 static_assert(
1942 AllArgsDecayedAreUnique<Args...>::value,
1943 "Found duplicate types among the arguments passed to set(...). "
1944 "Types should be listed at most once.");
1945
1946 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1947 }
1948
1960#ifndef NO_DOC
1961 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1962#else
1963 template<typename... Args>
1964#endif
1965 Experimental copyWith(Args &&...args) const
1966 {
1967 using namespace Zivid::Detail::TypeTraits;
1968
1969 using AllArgsAreDescendantNodes =
1970 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1971 static_assert(
1972 AllArgsAreDescendantNodes::value,
1973 "All arguments passed to copyWith(...) must be descendant nodes.");
1974
1975 static_assert(
1976 AllArgsDecayedAreUnique<Args...>::value,
1977 "Found duplicate types among the arguments passed to copyWith(...). "
1978 "Types should be listed at most once.");
1979
1980 auto copy{ *this };
1981 copy.set(std::forward<Args>(args)...);
1982 return copy;
1983 }
1984
1986 const Mode &mode() const
1987 {
1988 return m_mode;
1989 }
1990
1993 {
1994 return m_mode;
1995 }
1996
1998 Experimental &set(const Mode &value)
1999 {
2000 m_mode = value;
2001 return *this;
2002 }
2003
2004 template<
2005 typename T,
2006 typename std::enable_if<
2007 std::is_same<T, Settings2D::Processing::Color::Experimental::Mode>::value,
2008 int>::type = 0>
2010 {
2011 return m_mode;
2012 }
2013
2014 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2016 {
2017 return m_mode;
2018 }
2019
2021 template<typename F>
2022 void forEach(const F &f) const
2023 {
2024 f(m_mode);
2025 }
2026
2028 template<typename F>
2029 void forEach(const F &f)
2030 {
2031 f(m_mode);
2032 }
2033
2035 bool operator==(const Experimental &other) const;
2036
2038 bool operator!=(const Experimental &other) const;
2039
2041 std::string toString() const;
2042
2044 friend std::ostream &operator<<(std::ostream &stream, const Experimental &value)
2045 {
2046 return stream << value.toString();
2047 }
2048
2049 private:
2050 void setFromString(const std::string &value);
2051
2052 void setFromString(const std::string &fullPath, const std::string &value);
2053
2054 std::string getString(const std::string &fullPath) const;
2055
2056 Mode m_mode;
2057
2058 friend struct DataModel::Detail::Befriend<Experimental>;
2059 };
2060
2064
2065 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
2067 {
2068 public:
2070 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
2071
2073 static constexpr const char *path{ "Processing/Color/Gamma" };
2074
2076 static constexpr const char *name{ "Gamma" };
2077
2079 static constexpr const char *description{
2080 R"description(Gamma applied to the color values. Gamma less than 1 makes the colors brighter, while gamma
2081greater than 1 makes the colors darker.
2082)description"
2083 };
2084
2086 using ValueType = double;
2087
2089 static constexpr Range<double> validRange()
2090 {
2091 return { 0.25, 1.5 };
2092 }
2093
2095 Gamma() = default;
2096
2098 explicit constexpr Gamma(double value)
2099 : m_opt{ verifyValue(value) }
2100 {}
2101
2106 double value() const;
2107
2109 bool hasValue() const;
2110
2112 void reset();
2113
2115 std::string toString() const;
2116
2118 bool operator==(const Gamma &other) const
2119 {
2120 return m_opt == other.m_opt;
2121 }
2122
2124 bool operator!=(const Gamma &other) const
2125 {
2126 return m_opt != other.m_opt;
2127 }
2128
2130 bool operator<(const Gamma &other) const
2131 {
2132 return m_opt < other.m_opt;
2133 }
2134
2136 bool operator>(const Gamma &other) const
2137 {
2138 return m_opt > other.m_opt;
2139 }
2140
2142 bool operator<=(const Gamma &other) const
2143 {
2144 return m_opt <= other.m_opt;
2145 }
2146
2148 bool operator>=(const Gamma &other) const
2149 {
2150 return m_opt >= other.m_opt;
2151 }
2152
2154 friend std::ostream &operator<<(std::ostream &stream, const Gamma &value)
2155 {
2156 return stream << value.toString();
2157 }
2158
2159 private:
2160 void setFromString(const std::string &value);
2161
2162 constexpr ValueType static verifyValue(const ValueType &value)
2163 {
2164 return validRange().isInRange(value)
2165 ? value
2166 : throw std::out_of_range{ "Gamma{ " + std::to_string(value) + " } is not in range ["
2167 + std::to_string(validRange().min()) + ", "
2168 + std::to_string(validRange().max()) + "]" };
2169 }
2170
2171 std::optional<double> m_opt;
2172
2173 friend struct DataModel::Detail::Befriend<Gamma>;
2174 };
2175
2176 using Descendants = std::tuple<
2184
2187
2205#ifndef NO_DOC
2206 template<
2207 typename... Args,
2208 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
2209 typename std::enable_if<
2210 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
2211 value,
2212 int>::type = 0>
2213#else
2214 template<typename... Args>
2215#endif
2216 explicit Color(Args &&...args)
2217 {
2218 using namespace Zivid::Detail::TypeTraits;
2219
2220 static_assert(
2221 AllArgsDecayedAreUnique<Args...>::value,
2222 "Found duplicate types among the arguments passed to Color(...). "
2223 "Types should be listed at most once.");
2224
2225 set(std::forward<Args>(args)...);
2226 }
2227
2244#ifndef NO_DOC
2245 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
2246#else
2247 template<typename... Args>
2248#endif
2249 void set(Args &&...args)
2250 {
2251 using namespace Zivid::Detail::TypeTraits;
2252
2253 using AllArgsAreDescendantNodes =
2254 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2255 static_assert(
2256 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
2257
2258 static_assert(
2259 AllArgsDecayedAreUnique<Args...>::value,
2260 "Found duplicate types among the arguments passed to set(...). "
2261 "Types should be listed at most once.");
2262
2263 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
2264 }
2265
2283#ifndef NO_DOC
2284 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
2285#else
2286 template<typename... Args>
2287#endif
2288 Color copyWith(Args &&...args) const
2289 {
2290 using namespace Zivid::Detail::TypeTraits;
2291
2292 using AllArgsAreDescendantNodes =
2293 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2294 static_assert(
2295 AllArgsAreDescendantNodes::value,
2296 "All arguments passed to copyWith(...) must be descendant nodes.");
2297
2298 static_assert(
2299 AllArgsDecayedAreUnique<Args...>::value,
2300 "Found duplicate types among the arguments passed to copyWith(...). "
2301 "Types should be listed at most once.");
2302
2303 auto copy{ *this };
2304 copy.set(std::forward<Args>(args)...);
2305 return copy;
2306 }
2307
2309 const Balance &balance() const
2310 {
2311 return m_balance;
2312 }
2313
2316 {
2317 return m_balance;
2318 }
2319
2321 Color &set(const Balance &value)
2322 {
2323 m_balance = value;
2324 return *this;
2325 }
2326
2328 Color &set(const Balance::Blue &value)
2329 {
2330 m_balance.set(value);
2331 return *this;
2332 }
2333
2335 Color &set(const Balance::Green &value)
2336 {
2337 m_balance.set(value);
2338 return *this;
2339 }
2340
2342 Color &set(const Balance::Red &value)
2343 {
2344 m_balance.set(value);
2345 return *this;
2346 }
2347
2350 {
2351 return m_experimental;
2352 }
2353
2356 {
2357 return m_experimental;
2358 }
2359
2361 Color &set(const Experimental &value)
2362 {
2363 m_experimental = value;
2364 return *this;
2365 }
2366
2369 {
2370 m_experimental.set(value);
2371 return *this;
2372 }
2373
2375 const Gamma &gamma() const
2376 {
2377 return m_gamma;
2378 }
2379
2382 {
2383 return m_gamma;
2384 }
2385
2387 Color &set(const Gamma &value)
2388 {
2389 m_gamma = value;
2390 return *this;
2391 }
2392
2393 template<
2394 typename T,
2395 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance>::value, int>::type =
2396 0>
2398 {
2399 return m_balance;
2400 }
2401
2402 template<
2403 typename T,
2404 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value, int>::
2405 type = 0>
2407 {
2408 return m_balance.get<Settings2D::Processing::Color::Balance::Blue>();
2409 }
2410
2411 template<
2412 typename T,
2413 typename std::
2414 enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value, int>::type = 0>
2416 {
2417 return m_balance.get<Settings2D::Processing::Color::Balance::Green>();
2418 }
2419
2420 template<
2421 typename T,
2422 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value, int>::
2423 type = 0>
2425 {
2426 return m_balance.get<Settings2D::Processing::Color::Balance::Red>();
2427 }
2428
2429 template<
2430 typename T,
2431 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Experimental>::value, int>::
2432 type = 0>
2434 {
2435 return m_experimental;
2436 }
2437
2438 template<
2439 typename T,
2440 typename std::enable_if<
2441 std::is_same<T, Settings2D::Processing::Color::Experimental::Mode>::value,
2442 int>::type = 0>
2444 {
2445 return m_experimental.get<Settings2D::Processing::Color::Experimental::Mode>();
2446 }
2447
2448 template<
2449 typename T,
2450 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Gamma>::value, int>::type =
2451 0>
2453 {
2454 return m_gamma;
2455 }
2456
2457 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2459 {
2460 return m_balance;
2461 }
2462
2463 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
2465 {
2466 return m_experimental;
2467 }
2468
2469 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
2471 {
2472 return m_gamma;
2473 }
2474
2476 template<typename F>
2477 void forEach(const F &f) const
2478 {
2479 f(m_balance);
2480 f(m_experimental);
2481 f(m_gamma);
2482 }
2483
2485 template<typename F>
2486 void forEach(const F &f)
2487 {
2488 f(m_balance);
2489 f(m_experimental);
2490 f(m_gamma);
2491 }
2492
2494 bool operator==(const Color &other) const;
2495
2497 bool operator!=(const Color &other) const;
2498
2500 std::string toString() const;
2501
2503 friend std::ostream &operator<<(std::ostream &stream, const Color &value)
2504 {
2505 return stream << value.toString();
2506 }
2507
2508 private:
2509 void setFromString(const std::string &value);
2510
2511 void setFromString(const std::string &fullPath, const std::string &value);
2512
2513 std::string getString(const std::string &fullPath) const;
2514
2515 Balance m_balance;
2516 Experimental m_experimental;
2517 Gamma m_gamma;
2518
2519 friend struct DataModel::Detail::Befriend<Color>;
2520 };
2521
2522 using Descendants = std::tuple<
2531
2534
2553#ifndef NO_DOC
2554 template<
2555 typename... Args,
2556 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
2557 typename std::enable_if<
2558 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
2559 value,
2560 int>::type = 0>
2561#else
2562 template<typename... Args>
2563#endif
2564 explicit Processing(Args &&...args)
2565 {
2566 using namespace Zivid::Detail::TypeTraits;
2567
2568 static_assert(
2569 AllArgsDecayedAreUnique<Args...>::value,
2570 "Found duplicate types among the arguments passed to Processing(...). "
2571 "Types should be listed at most once.");
2572
2573 set(std::forward<Args>(args)...);
2574 }
2575
2593#ifndef NO_DOC
2594 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
2595#else
2596 template<typename... Args>
2597#endif
2598 void set(Args &&...args)
2599 {
2600 using namespace Zivid::Detail::TypeTraits;
2601
2602 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2603 static_assert(
2604 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
2605
2606 static_assert(
2607 AllArgsDecayedAreUnique<Args...>::value,
2608 "Found duplicate types among the arguments passed to set(...). "
2609 "Types should be listed at most once.");
2610
2611 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
2612 }
2613
2632#ifndef NO_DOC
2633 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
2634#else
2635 template<typename... Args>
2636#endif
2637 Processing copyWith(Args &&...args) const
2638 {
2639 using namespace Zivid::Detail::TypeTraits;
2640
2641 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2642 static_assert(
2643 AllArgsAreDescendantNodes::value,
2644 "All arguments passed to copyWith(...) must be descendant nodes.");
2645
2646 static_assert(
2647 AllArgsDecayedAreUnique<Args...>::value,
2648 "Found duplicate types among the arguments passed to copyWith(...). "
2649 "Types should be listed at most once.");
2650
2651 auto copy{ *this };
2652 copy.set(std::forward<Args>(args)...);
2653 return copy;
2654 }
2655
2657 const Color &color() const
2658 {
2659 return m_color;
2660 }
2661
2664 {
2665 return m_color;
2666 }
2667
2669 Processing &set(const Color &value)
2670 {
2671 m_color = value;
2672 return *this;
2673 }
2674
2677 {
2678 m_color.set(value);
2679 return *this;
2680 }
2681
2684 {
2685 m_color.set(value);
2686 return *this;
2687 }
2688
2691 {
2692 m_color.set(value);
2693 return *this;
2694 }
2695
2698 {
2699 m_color.set(value);
2700 return *this;
2701 }
2702
2705 {
2706 m_color.set(value);
2707 return *this;
2708 }
2709
2712 {
2713 m_color.set(value);
2714 return *this;
2715 }
2716
2719 {
2720 m_color.set(value);
2721 return *this;
2722 }
2723
2724 template<
2725 typename T,
2726 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color>::value, int>::type = 0>
2728 {
2729 return m_color;
2730 }
2731
2732 template<
2733 typename T,
2734 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance>::value, int>::type = 0>
2736 {
2738 }
2739
2740 template<
2741 typename T,
2742 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value, int>::
2743 type = 0>
2745 {
2747 }
2748
2749 template<
2750 typename T,
2751 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value, int>::
2752 type = 0>
2754 {
2756 }
2757
2758 template<
2759 typename T,
2760 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value, int>::
2761 type = 0>
2763 {
2764 return m_color.get<Settings2D::Processing::Color::Balance::Red>();
2765 }
2766
2767 template<
2768 typename T,
2769 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Experimental>::value, int>::
2770 type = 0>
2772 {
2774 }
2775
2776 template<
2777 typename T,
2778 typename std::
2779 enable_if<std::is_same<T, Settings2D::Processing::Color::Experimental::Mode>::value, int>::type = 0>
2781 {
2783 }
2784
2785 template<
2786 typename T,
2787 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Gamma>::value, int>::type = 0>
2789 {
2790 return m_color.get<Settings2D::Processing::Color::Gamma>();
2791 }
2792
2793 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2795 {
2796 return m_color;
2797 }
2798
2800 template<typename F>
2801 void forEach(const F &f) const
2802 {
2803 f(m_color);
2804 }
2805
2807 template<typename F>
2808 void forEach(const F &f)
2809 {
2810 f(m_color);
2811 }
2812
2814 bool operator==(const Processing &other) const;
2815
2817 bool operator!=(const Processing &other) const;
2818
2820 std::string toString() const;
2821
2823 friend std::ostream &operator<<(std::ostream &stream, const Processing &value)
2824 {
2825 return stream << value.toString();
2826 }
2827
2828 private:
2829 void setFromString(const std::string &value);
2830
2831 void setFromString(const std::string &fullPath, const std::string &value);
2832
2833 std::string getString(const std::string &fullPath) const;
2834
2835 Color m_color;
2836
2837 friend struct DataModel::Detail::Befriend<Processing>;
2838 };
2839
2842
2843 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
2845 {
2846 public:
2848 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
2849
2851 static constexpr const char *path{ "Sampling" };
2852
2854 static constexpr const char *name{ "Sampling" };
2855
2857 static constexpr const char *description{ R"description(Sampling settings.
2858)description" };
2859
2866
2867 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
2869 {
2870 public:
2872 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
2873
2875 static constexpr const char *path{ "Sampling/Color" };
2876
2878 static constexpr const char *name{ "Color" };
2879
2881 static constexpr const char *description{
2882 R"description(Choose how to sample colors for the 2D image. The `rgb` option gives an image
2883with full colors. The `grayscale` option gives a grayscale (r=g=b) image, which
2884can be acquired faster than full colors.
2885
2886The `grayscale` option is not available on all camera models.
2887)description"
2888 };
2889
2891 enum class ValueType
2892 {
2893 rgb,
2894 grayscale
2895 };
2896 static const Color rgb;
2897 static const Color grayscale;
2898
2900 static std::set<ValueType> validValues()
2901 {
2902 return { ValueType::rgb, ValueType::grayscale };
2903 }
2904
2906 Color() = default;
2907
2909 explicit constexpr Color(ValueType value)
2910 : m_opt{ verifyValue(value) }
2911 {}
2912
2918
2920 bool hasValue() const;
2921
2923 void reset();
2924
2926 std::string toString() const;
2927
2929 friend std::ostream &operator<<(std::ostream &stream, const Color::ValueType &value)
2930 {
2931 return stream << Color{ value }.toString();
2932 }
2933
2935 bool operator==(const Color &other) const
2936 {
2937 return m_opt == other.m_opt;
2938 }
2939
2941 bool operator!=(const Color &other) const
2942 {
2943 return m_opt != other.m_opt;
2944 }
2945
2947 friend std::ostream &operator<<(std::ostream &stream, const Color &value)
2948 {
2949 return stream << value.toString();
2950 }
2951
2952 private:
2953 void setFromString(const std::string &value);
2954
2955 constexpr ValueType static verifyValue(const ValueType &value)
2956 {
2957 return value == ValueType::rgb || value == ValueType::grayscale
2958 ? value
2959 : throw std::invalid_argument{
2960 "Invalid value: Color{ "
2961 + std::to_string(static_cast<std::underlying_type<ValueType>::type>(value)) + " }"
2962 };
2963 }
2964
2965 std::optional<ValueType> m_opt;
2966
2967 friend struct DataModel::Detail::Befriend<Color>;
2968 };
2969
2973
2974 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
2976 {
2977 public:
2979 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
2980
2982 static constexpr const char *path{ "Sampling/Pixel" };
2983
2985 static constexpr const char *name{ "Pixel" };
2986
2988 static constexpr const char *description{
2989 R"description(Set the pixel sampling to use for the 2D capture. This setting defines how the camera sensor is sampled.
2990When doing 2D+3D capture, picking the same value that is used for 3D is generally recommended.
2991)description"
2992 };
2993
2995 enum class ValueType
2996 {
2997 all,
2998 blueSubsample2x2,
2999 redSubsample2x2,
3000 blueSubsample4x4,
3001 redSubsample4x4,
3002 by2x2,
3003 by4x4
3004 };
3005 static const Pixel all;
3007 static const Pixel redSubsample2x2;
3009 static const Pixel redSubsample4x4;
3010 static const Pixel by2x2;
3011 static const Pixel by4x4;
3012
3014 static std::set<ValueType> validValues()
3015 {
3016 return { ValueType::all,
3017 ValueType::blueSubsample2x2,
3018 ValueType::redSubsample2x2,
3019 ValueType::blueSubsample4x4,
3020 ValueType::redSubsample4x4,
3021 ValueType::by2x2,
3022 ValueType::by4x4 };
3023 }
3024
3026 Pixel() = default;
3027
3029 explicit constexpr Pixel(ValueType value)
3030 : m_opt{ verifyValue(value) }
3031 {}
3032
3038
3040 bool hasValue() const;
3041
3043 void reset();
3044
3046 std::string toString() const;
3047
3049 friend std::ostream &operator<<(std::ostream &stream, const Pixel::ValueType &value)
3050 {
3051 return stream << Pixel{ value }.toString();
3052 }
3053
3055 bool operator==(const Pixel &other) const
3056 {
3057 return m_opt == other.m_opt;
3058 }
3059
3061 bool operator!=(const Pixel &other) const
3062 {
3063 return m_opt != other.m_opt;
3064 }
3065
3067 friend std::ostream &operator<<(std::ostream &stream, const Pixel &value)
3068 {
3069 return stream << value.toString();
3070 }
3071
3072 private:
3073 void setFromString(const std::string &value);
3074
3075 constexpr ValueType static verifyValue(const ValueType &value)
3076 {
3077 return value == ValueType::all || value == ValueType::blueSubsample2x2
3078 || value == ValueType::redSubsample2x2 || value == ValueType::blueSubsample4x4
3079 || value == ValueType::redSubsample4x4 || value == ValueType::by2x2
3080 || value == ValueType::by4x4
3081 ? value
3082 : throw std::invalid_argument{
3083 "Invalid value: Pixel{ "
3084 + std::to_string(static_cast<std::underlying_type<ValueType>::type>(value)) + " }"
3085 };
3086 }
3087
3088 std::optional<ValueType> m_opt;
3089
3090 friend struct DataModel::Detail::Befriend<Pixel>;
3091 };
3092
3093 using Descendants = std::tuple<Settings2D::Sampling::Color, Settings2D::Sampling::Pixel>;
3094
3097
3110#ifndef NO_DOC
3111 template<
3112 typename... Args,
3113 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
3114 typename std::enable_if<
3115 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
3116 value,
3117 int>::type = 0>
3118#else
3119 template<typename... Args>
3120#endif
3121 explicit Sampling(Args &&...args)
3122 {
3123 using namespace Zivid::Detail::TypeTraits;
3124
3125 static_assert(
3126 AllArgsDecayedAreUnique<Args...>::value,
3127 "Found duplicate types among the arguments passed to Sampling(...). "
3128 "Types should be listed at most once.");
3129
3130 set(std::forward<Args>(args)...);
3131 }
3132
3144#ifndef NO_DOC
3145 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
3146#else
3147 template<typename... Args>
3148#endif
3149 void set(Args &&...args)
3150 {
3151 using namespace Zivid::Detail::TypeTraits;
3152
3153 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
3154 static_assert(
3155 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
3156
3157 static_assert(
3158 AllArgsDecayedAreUnique<Args...>::value,
3159 "Found duplicate types among the arguments passed to set(...). "
3160 "Types should be listed at most once.");
3161
3162 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
3163 }
3164
3177#ifndef NO_DOC
3178 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
3179#else
3180 template<typename... Args>
3181#endif
3182 Sampling copyWith(Args &&...args) const
3183 {
3184 using namespace Zivid::Detail::TypeTraits;
3185
3186 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
3187 static_assert(
3188 AllArgsAreDescendantNodes::value,
3189 "All arguments passed to copyWith(...) must be descendant nodes.");
3190
3191 static_assert(
3192 AllArgsDecayedAreUnique<Args...>::value,
3193 "Found duplicate types among the arguments passed to copyWith(...). "
3194 "Types should be listed at most once.");
3195
3196 auto copy{ *this };
3197 copy.set(std::forward<Args>(args)...);
3198 return copy;
3199 }
3200
3202 const Color &color() const
3203 {
3204 return m_color;
3205 }
3206
3209 {
3210 return m_color;
3211 }
3212
3214 Sampling &set(const Color &value)
3215 {
3216 m_color = value;
3217 return *this;
3218 }
3219
3221 const Pixel &pixel() const
3222 {
3223 return m_pixel;
3224 }
3225
3228 {
3229 return m_pixel;
3230 }
3231
3233 Sampling &set(const Pixel &value)
3234 {
3235 m_pixel = value;
3236 return *this;
3237 }
3238
3239 template<
3240 typename T,
3241 typename std::enable_if<std::is_same<T, Settings2D::Sampling::Color>::value, int>::type = 0>
3243 {
3244 return m_color;
3245 }
3246
3247 template<
3248 typename T,
3249 typename std::enable_if<std::is_same<T, Settings2D::Sampling::Pixel>::value, int>::type = 0>
3251 {
3252 return m_pixel;
3253 }
3254
3255 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
3257 {
3258 return m_color;
3259 }
3260
3261 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
3263 {
3264 return m_pixel;
3265 }
3266
3268 template<typename F>
3269 void forEach(const F &f) const
3270 {
3271 f(m_color);
3272 f(m_pixel);
3273 }
3274
3276 template<typename F>
3277 void forEach(const F &f)
3278 {
3279 f(m_color);
3280 f(m_pixel);
3281 }
3282
3284 bool operator==(const Sampling &other) const;
3285
3287 bool operator!=(const Sampling &other) const;
3288
3290 std::string toString() const;
3291
3293 friend std::ostream &operator<<(std::ostream &stream, const Sampling &value)
3294 {
3295 return stream << value.toString();
3296 }
3297
3298 private:
3299 void setFromString(const std::string &value);
3300
3301 void setFromString(const std::string &fullPath, const std::string &value);
3302
3303 std::string getString(const std::string &fullPath) const;
3304
3305 Color m_color;
3306 Pixel m_pixel;
3307
3308 friend struct DataModel::Detail::Befriend<Sampling>;
3309 };
3310
3311 using Descendants = std::tuple<
3325
3328
3330 explicit Settings2D(const std::string &fileName);
3331
3337 [[nodiscard]] static Settings2D fromSerialized(const std::string &value);
3338
3344 std::string serialize() const;
3345
3369#ifndef NO_DOC
3370 template<
3371 typename... Args,
3372 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
3373 typename std::enable_if<
3374 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
3375 int>::type = 0>
3376#else
3377 template<typename... Args>
3378#endif
3379 explicit Settings2D(Args &&...args)
3380 {
3381 using namespace Zivid::Detail::TypeTraits;
3382
3383 static_assert(
3384 AllArgsDecayedAreUnique<Args...>::value,
3385 "Found duplicate types among the arguments passed to Settings2D(...). "
3386 "Types should be listed at most once.");
3387
3388 set(std::forward<Args>(args)...);
3389 }
3390
3413#ifndef NO_DOC
3414 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
3415#else
3416 template<typename... Args>
3417#endif
3418 void set(Args &&...args)
3419 {
3420 using namespace Zivid::Detail::TypeTraits;
3421
3422 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
3423 static_assert(
3424 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
3425
3426 static_assert(
3427 AllArgsDecayedAreUnique<Args...>::value,
3428 "Found duplicate types among the arguments passed to set(...). "
3429 "Types should be listed at most once.");
3430
3431 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
3432 }
3433
3457#ifndef NO_DOC
3458 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
3459#else
3460 template<typename... Args>
3461#endif
3462 Settings2D copyWith(Args &&...args) const
3463 {
3464 using namespace Zivid::Detail::TypeTraits;
3465
3466 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
3467 static_assert(
3468 AllArgsAreDescendantNodes::value, "All arguments passed to copyWith(...) must be descendant nodes.");
3469
3470 static_assert(
3471 AllArgsDecayedAreUnique<Args...>::value,
3472 "Found duplicate types among the arguments passed to copyWith(...). "
3473 "Types should be listed at most once.");
3474
3475 auto copy{ *this };
3476 copy.set(std::forward<Args>(args)...);
3477 return copy;
3478 }
3479
3482 {
3483 return m_acquisitions;
3484 }
3485
3488 {
3489 return m_acquisitions;
3490 }
3491
3494 {
3495 m_acquisitions = value;
3496 return *this;
3497 }
3498
3500 const Processing &processing() const
3501 {
3502 return m_processing;
3503 }
3504
3507 {
3508 return m_processing;
3509 }
3510
3513 {
3514 m_processing = value;
3515 return *this;
3516 }
3517
3520 {
3521 m_processing.set(value);
3522 return *this;
3523 }
3524
3527 {
3528 m_processing.set(value);
3529 return *this;
3530 }
3531
3534 {
3535 m_processing.set(value);
3536 return *this;
3537 }
3538
3541 {
3542 m_processing.set(value);
3543 return *this;
3544 }
3545
3548 {
3549 m_processing.set(value);
3550 return *this;
3551 }
3552
3555 {
3556 m_processing.set(value);
3557 return *this;
3558 }
3559
3562 {
3563 m_processing.set(value);
3564 return *this;
3565 }
3566
3569 {
3570 m_processing.set(value);
3571 return *this;
3572 }
3573
3575 const Sampling &sampling() const
3576 {
3577 return m_sampling;
3578 }
3579
3582 {
3583 return m_sampling;
3584 }
3585
3587 Settings2D &set(const Sampling &value)
3588 {
3589 m_sampling = value;
3590 return *this;
3591 }
3592
3595 {
3596 m_sampling.set(value);
3597 return *this;
3598 }
3599
3602 {
3603 m_sampling.set(value);
3604 return *this;
3605 }
3606
3607 template<typename T, typename std::enable_if<std::is_same<T, Settings2D::Acquisitions>::value, int>::type = 0>
3609 {
3610 return m_acquisitions;
3611 }
3612
3613 template<typename T, typename std::enable_if<std::is_same<T, Settings2D::Processing>::value, int>::type = 0>
3615 {
3616 return m_processing;
3617 }
3618
3619 template<
3620 typename T,
3621 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color>::value, int>::type = 0>
3623 {
3624 return m_processing.get<Settings2D::Processing::Color>();
3625 }
3626
3627 template<
3628 typename T,
3629 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance>::value, int>::type = 0>
3631 {
3632 return m_processing.get<Settings2D::Processing::Color::Balance>();
3633 }
3634
3635 template<
3636 typename T,
3637 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value, int>::type =
3638 0>
3640 {
3641 return m_processing.get<Settings2D::Processing::Color::Balance::Blue>();
3642 }
3643
3644 template<
3645 typename T,
3646 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value, int>::type =
3647 0>
3649 {
3650 return m_processing.get<Settings2D::Processing::Color::Balance::Green>();
3651 }
3652
3653 template<
3654 typename T,
3655 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value, int>::type = 0>
3657 {
3658 return m_processing.get<Settings2D::Processing::Color::Balance::Red>();
3659 }
3660
3661 template<
3662 typename T,
3663 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Experimental>::value, int>::type = 0>
3665 {
3666 return m_processing.get<Settings2D::Processing::Color::Experimental>();
3667 }
3668
3669 template<
3670 typename T,
3671 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Experimental::Mode>::value, int>::
3672 type = 0>
3674 {
3675 return m_processing.get<Settings2D::Processing::Color::Experimental::Mode>();
3676 }
3677
3678 template<
3679 typename T,
3680 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Gamma>::value, int>::type = 0>
3682 {
3683 return m_processing.get<Settings2D::Processing::Color::Gamma>();
3684 }
3685
3686 template<typename T, typename std::enable_if<std::is_same<T, Settings2D::Sampling>::value, int>::type = 0>
3688 {
3689 return m_sampling;
3690 }
3691
3692 template<
3693 typename T,
3694 typename std::enable_if<std::is_same<T, Settings2D::Sampling::Color>::value, int>::type = 0>
3696 {
3697 return m_sampling.get<Settings2D::Sampling::Color>();
3698 }
3699
3700 template<
3701 typename T,
3702 typename std::enable_if<std::is_same<T, Settings2D::Sampling::Pixel>::value, int>::type = 0>
3704 {
3705 return m_sampling.get<Settings2D::Sampling::Pixel>();
3706 }
3707
3708 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
3710 {
3711 return m_acquisitions;
3712 }
3713
3714 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
3716 {
3717 return m_processing;
3718 }
3719
3720 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
3722 {
3723 return m_sampling;
3724 }
3725
3727 template<typename F>
3728 void forEach(const F &f) const
3729 {
3730 f(m_acquisitions);
3731 f(m_processing);
3732 f(m_sampling);
3733 }
3734
3736 template<typename F>
3737 void forEach(const F &f)
3738 {
3739 f(m_acquisitions);
3740 f(m_processing);
3741 f(m_sampling);
3742 }
3743
3745 bool operator==(const Settings2D &other) const;
3746
3748 bool operator!=(const Settings2D &other) const;
3749
3751 std::string toString() const;
3752
3754 friend std::ostream &operator<<(std::ostream &stream, const Settings2D &value)
3755 {
3756 return stream << value.toString();
3757 }
3758
3760 void save(const std::string &fileName) const;
3761
3763 void load(const std::string &fileName);
3764
3765 private:
3766 void setFromString(const std::string &value);
3767
3768 void setFromString(const std::string &fullPath, const std::string &value);
3769
3770 std::string getString(const std::string &fullPath) const;
3771
3772 Acquisitions m_acquisitions;
3773 Processing m_processing;
3774 Sampling m_sampling;
3775
3776 friend struct DataModel::Detail::Befriend<Settings2D>;
3777 };
3778
3779#ifndef NO_DOC
3780 template<>
3781 struct Settings2D::Version<7>
3782 {
3783 using Type = Settings2D;
3784 };
3785#endif
3786
3787} // namespace Zivid
3788
3789#ifndef NO_DOC
3791namespace Zivid::Detail
3792{
3793
3794 ZIVID_CORE_EXPORT void save(const Zivid::Settings2D &dataModel, std::ostream &ostream);
3795 ZIVID_CORE_EXPORT void load(Zivid::Settings2D &dataModel, std::istream &istream);
3796
3797 ZIVID_CORE_EXPORT std::vector<uint8_t> serializeToBinaryVector(const Zivid::Settings2D &source);
3798 ZIVID_CORE_EXPORT void deserializeFromBinaryVector(Zivid::Settings2D &dest, const std::vector<uint8_t> &data);
3799
3800} // namespace Zivid::Detail
3801#endif
3802
3803#ifdef _MSC_VER
3804# pragma warning(pop)
3805#endif
3806
3807#ifndef NO_DOC
3808# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
3809namespace std // NOLINT
3810{
3811
3812 template<>
3813 struct tuple_size<Zivid::Settings2D::Processing> : integral_constant<size_t, 1>
3814 {};
3815
3816 template<size_t i>
3817 struct tuple_element<i, Zivid::Settings2D::Processing>
3818 {
3819 static_assert(i < tuple_size<Zivid::Settings2D::Processing>::value, "Index must be less than 1");
3820
3821 using type // NOLINT
3822 = decltype(declval<Zivid::Settings2D::Processing>().get<i>());
3823 };
3824
3825 template<>
3826 struct tuple_size<Zivid::Settings2D::Processing::Color> : integral_constant<size_t, 3>
3827 {};
3828
3829 template<size_t i>
3830 struct tuple_element<i, Zivid::Settings2D::Processing::Color>
3831 {
3832 static_assert(i < tuple_size<Zivid::Settings2D::Processing::Color>::value, "Index must be less than 3");
3833
3834 using type // NOLINT
3835 = decltype(declval<Zivid::Settings2D::Processing::Color>().get<i>());
3836 };
3837
3838 template<>
3839 struct tuple_size<Zivid::Settings2D::Processing::Color::Balance> : integral_constant<size_t, 3>
3840 {};
3841
3842 template<size_t i>
3843 struct tuple_element<i, Zivid::Settings2D::Processing::Color::Balance>
3844 {
3845 static_assert(
3846 i < tuple_size<Zivid::Settings2D::Processing::Color::Balance>::value,
3847 "Index must be less than 3");
3848
3849 using type // NOLINT
3850 = decltype(declval<Zivid::Settings2D::Processing::Color::Balance>().get<i>());
3851 };
3852
3853 template<>
3854 struct tuple_size<Zivid::Settings2D::Processing::Color::Experimental> : integral_constant<size_t, 1>
3855 {};
3856
3857 template<size_t i>
3858 struct tuple_element<i, Zivid::Settings2D::Processing::Color::Experimental>
3859 {
3860 static_assert(
3861 i < tuple_size<Zivid::Settings2D::Processing::Color::Experimental>::value,
3862 "Index must be less than 1");
3863
3864 using type // NOLINT
3865 = decltype(declval<Zivid::Settings2D::Processing::Color::Experimental>().get<i>());
3866 };
3867
3868 template<>
3869 struct tuple_size<Zivid::Settings2D::Sampling> : integral_constant<size_t, 2>
3870 {};
3871
3872 template<size_t i>
3873 struct tuple_element<i, Zivid::Settings2D::Sampling>
3874 {
3875 static_assert(i < tuple_size<Zivid::Settings2D::Sampling>::value, "Index must be less than 2");
3876
3877 using type // NOLINT
3878 = decltype(declval<Zivid::Settings2D::Sampling>().get<i>());
3879 };
3880
3881 template<>
3882 struct tuple_size<Zivid::Settings2D> : integral_constant<size_t, 3>
3883 {};
3884
3885 template<size_t i>
3886 struct tuple_element<i, Zivid::Settings2D>
3887 {
3888 static_assert(i < tuple_size<Zivid::Settings2D>::value, "Index must be less than 3");
3889
3890 using type // NOLINT
3891 = decltype(declval<Zivid::Settings2D>().get<i>());
3892 };
3893
3894} // namespace std
3895# endif
3896#endif
3897
3898// If we have access to the DataModel library, automatically include internal DataModel
3899// header. This header is necessary for serialization and deserialization.
3900#if defined(__has_include) && !defined(NO_DOC)
3901# if __has_include("Zivid/Settings2DInternal.h") && __has_include("Zivid/DataModelNodeMetaData.h")
3902# include "Zivid/Settings2DInternal.h"
3903# endif
3904#endif
#define ZIVID_CORE_EXPORT
Definition CoreExport.h:56
Class describing a range of values for a given type T.
Definition Range.h:75
Aperture setting for the camera. Specified as an f-number (the ratio of lens focal length to the effe...
Definition Settings2D.h:144
void reset()
Reset the node to unset state.
bool operator!=(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:204
friend std::ostream & operator<<(std::ostream &stream, const Aperture &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:234
bool operator<(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:210
constexpr Aperture(double value)
Constructor.
Definition Settings2D.h:178
static constexpr Range< double > validRange()
The range of valid values for Aperture.
Definition Settings2D.h:169
bool operator>=(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:228
bool operator<=(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:222
std::string toString() const
Get the value as string.
double value() const
Get the value.
bool operator>(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:216
Aperture()=default
Default constructor.
double ValueType
The type of the underlying value.
Definition Settings2D.h:166
bool operator==(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:198
bool hasValue() const
Check if the value is set.
Brightness controls the light output from the projector.
Definition Settings2D.h:270
bool operator==(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:329
bool operator<=(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:353
bool operator>(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:347
bool operator<(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:341
static constexpr Range< double > validRange()
The range of valid values for Brightness.
Definition Settings2D.h:300
constexpr Brightness(double value)
Constructor.
Definition Settings2D.h:309
std::string toString() const
Get the value as string.
bool operator!=(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:335
bool operator>=(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:359
friend std::ostream & operator<<(std::ostream &stream, const Brightness &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:365
double value() const
Get the value.
Brightness()=default
Default constructor.
bool hasValue() const
Check if the value is set.
void reset()
Reset the node to unset state.
double ValueType
The type of the underlying value.
Definition Settings2D.h:297
Exposure time for the image.
Definition Settings2D.h:391
bool operator>(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:456
std::chrono::microseconds ValueType
The type of the underlying value.
Definition Settings2D.h:406
bool operator>=(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:468
void reset()
Reset the node to unset state.
constexpr ExposureTime(std::chrono::microseconds value)
Constructor.
Definition Settings2D.h:418
std::chrono::microseconds value() const
Get the value.
bool operator<(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:450
bool operator<=(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:462
static constexpr Range< std::chrono::microseconds > validRange()
The range of valid values for ExposureTime.
Definition Settings2D.h:409
bool operator!=(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:444
std::string toString() const
Get the value as string.
ExposureTime()=default
Default constructor.
bool operator==(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:438
friend std::ostream & operator<<(std::ostream &stream, const ExposureTime &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:474
bool hasValue() const
Check if the value is set.
Analog gain in the camera.
Definition Settings2D.h:501
bool operator>(const Gain &other) const
Comparison operator.
Definition Settings2D.h:566
bool operator!=(const Gain &other) const
Comparison operator.
Definition Settings2D.h:554
bool operator==(const Gain &other) const
Comparison operator.
Definition Settings2D.h:548
friend std::ostream & operator<<(std::ostream &stream, const Gain &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:584
double ValueType
The type of the underlying value.
Definition Settings2D.h:516
Gain()=default
Default constructor.
std::string toString() const
Get the value as string.
void reset()
Reset the node to unset state.
constexpr Gain(double value)
Constructor.
Definition Settings2D.h:528
double value() const
Get the value.
bool hasValue() const
Check if the value is set.
bool operator>=(const Gain &other) const
Comparison operator.
Definition Settings2D.h:578
bool operator<=(const Gain &other) const
Comparison operator.
Definition Settings2D.h:572
static constexpr Range< double > validRange()
The range of valid values for Gain.
Definition Settings2D.h:519
bool operator<(const Gain &other) const
Comparison operator.
Definition Settings2D.h:560
Settings for one 2D acquisition.
Definition Settings2D.h:117
const Settings2D::Acquisition::Gain & get() const
Definition Settings2D.h:827
const ExposureTime & exposureTime() const
Get ExposureTime.
Definition Settings2D.h:763
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:858
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:868
const Settings2D::Acquisition::Aperture & get() const
Definition Settings2D.h:803
ExposureTime & exposureTime()
Get ExposureTime.
Definition Settings2D.h:769
friend std::ostream & operator<<(std::ostream &stream, const Acquisition &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:886
bool operator!=(const Acquisition &other) const
Inequality operator.
Acquisition & set(const Gain &value)
Set Gain.
Definition Settings2D.h:794
std::string toString() const
Get the value as string.
Acquisition & set(const Aperture &value)
Set Aperture.
Definition Settings2D.h:737
Gain & gain()
Get Gain.
Definition Settings2D.h:788
bool operator==(const Acquisition &other) const
Equality operator.
Acquisition copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition Settings2D.h:705
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:670
const Settings2D::Acquisition::ExposureTime & get() const
Definition Settings2D.h:819
Acquisition()
Default constructor.
Aperture & aperture()
Get Aperture.
Definition Settings2D.h:731
const Aperture & aperture() const
Get Aperture.
Definition Settings2D.h:725
Acquisition & set(const Brightness &value)
Set Brightness.
Definition Settings2D.h:756
const Brightness & brightness() const
Get Brightness.
Definition Settings2D.h:744
Brightness & brightness()
Get Brightness.
Definition Settings2D.h:750
std::tuple< Settings2D::Acquisition::Aperture, Settings2D::Acquisition::Brightness, Settings2D::Acquisition::ExposureTime, Settings2D::Acquisition::Gain > Descendants
Definition Settings2D.h:606
const Gain & gain() const
Get Gain.
Definition Settings2D.h:782
const Settings2D::Acquisition::Brightness & get() const
Definition Settings2D.h:811
Acquisition & set(const ExposureTime &value)
Set ExposureTime.
Definition Settings2D.h:775
List of acquisitions used for 2D capture.
Definition Settings2D.h:910
const Settings2D::Acquisition & at(std::size_t pos) const
Returns a const reference to the element at position pos in the list.
static constexpr Range< ValueType::size_type > validSize()
The valid sizes for Acquisitions.
Definition Settings2D.h:930
Acquisitions(std::initializer_list< Settings2D::Acquisition > value)
Constructor.
Definition Settings2D.h:944
Settings2D::Acquisition & operator[](std::size_t pos)
Returns a reference to the element at position pos in the list.
const Settings2D::Acquisition & operator[](std::size_t pos) const
Returns a const reference to the element at position pos in the list.
Acquisitions(std::vector< Settings2D::Acquisition > value)
Constructor.
Definition Settings2D.h:939
void forEach(const F &f)
Run the given function on each element in the list.
Definition Settings2D.h:1001
Settings2D::Acquisition & at(std::size_t pos)
Returns a reference to the element at position pos in the list.
void forEach(const F &f) const
Run the given function on each element in the list.
Definition Settings2D.h:1011
std::vector< Settings2D::Acquisition > ValueType
The type of the underlying value.
Definition Settings2D.h:927
Iterator begin() noexcept
Returns an iterator to the first element of the list.
std::string toString() const
Get the value as string.
friend std::ostream & operator<<(std::ostream &stream, const Acquisitions &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:1056
std::vector< Settings2D::Acquisition >::iterator Iterator
Iterator type for Acquisitions.
Definition Settings2D.h:1020
std::vector< Settings2D::Acquisition >::const_iterator ConstIterator
Constant iterator type for Acquisitions.
Definition Settings2D.h:1029
std::size_t size() const noexcept
Get the size of the list.
bool operator!=(const Acquisitions &other) const
Comparison operator.
Definition Settings2D.h:1050
Acquisitions()=default
Default constructor.
const std::vector< Settings2D::Acquisition > & value() const
Get the value.
Digital gain applied to blue channel.
Definition Settings2D.h:1127
friend std::ostream & operator<<(std::ostream &stream, const Blue &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:1212
bool operator<=(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1200
bool operator==(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1176
void reset()
Reset the node to unset state.
double ValueType
The type of the underlying value.
Definition Settings2D.h:1144
bool operator>(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1194
std::string toString() const
Get the value as string.
constexpr Blue(double value)
Constructor.
Definition Settings2D.h:1156
bool operator!=(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1182
bool hasValue() const
Check if the value is set.
static constexpr Range< double > validRange()
The range of valid values for Blue.
Definition Settings2D.h:1147
bool operator<(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1188
bool operator>=(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1206
Digital gain applied to green channel.
Definition Settings2D.h:1239
double ValueType
The type of the underlying value.
Definition Settings2D.h:1256
static constexpr Range< double > validRange()
The range of valid values for Green.
Definition Settings2D.h:1259
bool operator==(const Green &other) const
Comparison operator.
Definition Settings2D.h:1288
std::string toString() const
Get the value as string.
constexpr Green(double value)
Constructor.
Definition Settings2D.h:1268
friend std::ostream & operator<<(std::ostream &stream, const Green &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:1324
bool operator<(const Green &other) const
Comparison operator.
Definition Settings2D.h:1300
bool hasValue() const
Check if the value is set.
bool operator<=(const Green &other) const
Comparison operator.
Definition Settings2D.h:1312
bool operator>=(const Green &other) const
Comparison operator.
Definition Settings2D.h:1318
bool operator!=(const Green &other) const
Comparison operator.
Definition Settings2D.h:1294
bool operator>(const Green &other) const
Comparison operator.
Definition Settings2D.h:1306
void reset()
Reset the node to unset state.
Digital gain applied to red channel.
Definition Settings2D.h:1351
double ValueType
The type of the underlying value.
Definition Settings2D.h:1368
friend std::ostream & operator<<(std::ostream &stream, const Red &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:1436
bool operator>=(const Red &other) const
Comparison operator.
Definition Settings2D.h:1430
bool operator<(const Red &other) const
Comparison operator.
Definition Settings2D.h:1412
bool operator<=(const Red &other) const
Comparison operator.
Definition Settings2D.h:1424
std::string toString() const
Get the value as string.
static constexpr Range< double > validRange()
The range of valid values for Red.
Definition Settings2D.h:1371
bool hasValue() const
Check if the value is set.
bool operator!=(const Red &other) const
Comparison operator.
Definition Settings2D.h:1406
constexpr Red(double value)
Constructor.
Definition Settings2D.h:1380
bool operator==(const Red &other) const
Comparison operator.
Definition Settings2D.h:1400
void reset()
Reset the node to unset state.
bool operator>(const Red &other) const
Comparison operator.
Definition Settings2D.h:1418
Color balance settings.
Definition Settings2D.h:1109
const Settings2D::Processing::Color::Balance::Red & get() const
Definition Settings2D.h:1658
Blue & blue()
Get Blue.
Definition Settings2D.h:1583
bool operator!=(const Balance &other) const
Inequality operator.
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:1692
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:1683
std::tuple< Settings2D::Processing::Color::Balance::Blue, Settings2D::Processing::Color::Balance::Green, Settings2D::Processing::Color::Balance::Red > Descendants
Definition Settings2D.h:1459
const Blue & blue() const
Get Blue.
Definition Settings2D.h:1577
bool operator==(const Balance &other) const
Equality operator.
Balance & set(const Blue &value)
Set Blue.
Definition Settings2D.h:1589
Red & red()
Get Red.
Definition Settings2D.h:1621
Green & green()
Get Green.
Definition Settings2D.h:1602
Balance & set(const Green &value)
Set Green.
Definition Settings2D.h:1608
Balance copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition Settings2D.h:1556
const Green & green() const
Get Green.
Definition Settings2D.h:1596
Balance & set(const Red &value)
Set Red.
Definition Settings2D.h:1627
const Settings2D::Processing::Color::Balance::Green & get() const
Definition Settings2D.h:1648
const Red & red() const
Get Red.
Definition Settings2D.h:1615
std::string toString() const
Get the value as string.
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:1520
friend std::ostream & operator<<(std::ostream &stream, const Balance &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:1709
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition Settings2D.h:1638
This setting controls how the color image is computed.
Definition Settings2D.h:1766
friend std::ostream & operator<<(std::ostream &stream, const Mode &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:1853
static const Mode toneMapping
toneMapping
Definition Settings2D.h:1803
bool operator==(const Mode &other) const
Comparison operator.
Definition Settings2D.h:1841
static const Mode automatic
automatic
Definition Settings2D.h:1802
bool operator!=(const Mode &other) const
Comparison operator.
Definition Settings2D.h:1847
void reset()
Reset the node to unset state.
constexpr Mode(ValueType value)
Constructor.
Definition Settings2D.h:1815
bool hasValue() const
Check if the value is set.
static std::set< ValueType > validValues()
All valid values of Mode.
Definition Settings2D.h:1806
friend std::ostream & operator<<(std::ostream &stream, const Mode::ValueType &value)
Operator to serialize ValueType to a stream.
Definition Settings2D.h:1835
std::string toString() const
Get the value as string.
ValueType
The type of the underlying value.
Definition Settings2D.h:1798
Experimental color settings. These may be renamed, moved or deleted in the future.
Definition Settings2D.h:1732
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:2029
Mode & mode()
Get Mode.
Definition Settings2D.h:1992
const Mode & mode() const
Get Mode.
Definition Settings2D.h:1986
friend std::ostream & operator<<(std::ostream &stream, const Experimental &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:2044
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:2022
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:1931
std::tuple< Settings2D::Processing::Color::Experimental::Mode > Descendants
Definition Settings2D.h:1877
std::string toString() const
Get the value as string.
const Settings2D::Processing::Color::Experimental::Mode & get() const
Definition Settings2D.h:2009
bool operator!=(const Experimental &other) const
Inequality operator.
bool operator==(const Experimental &other) const
Equality operator.
Experimental & set(const Mode &value)
Set Mode.
Definition Settings2D.h:1998
Experimental copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition Settings2D.h:1965
Gamma applied to the color values. Gamma less than 1 makes the colors brighter, while gamma greater t...
Definition Settings2D.h:2067
double ValueType
The type of the underlying value.
Definition Settings2D.h:2086
static constexpr Range< double > validRange()
The range of valid values for Gamma.
Definition Settings2D.h:2089
bool operator>(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:2136
bool operator==(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:2118
friend std::ostream & operator<<(std::ostream &stream, const Gamma &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:2154
bool operator!=(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:2124
bool hasValue() const
Check if the value is set.
std::string toString() const
Get the value as string.
bool operator<(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:2130
void reset()
Reset the node to unset state.
bool operator>=(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:2148
constexpr Gamma(double value)
Constructor.
Definition Settings2D.h:2098
Gamma()=default
Default constructor.
bool operator<=(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:2142
double value() const
Get the value.
Color settings.
Definition Settings2D.h:1091
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:2249
Color & set(const Balance::Green &value)
Set Balance::Green.
Definition Settings2D.h:2335
bool operator!=(const Color &other) const
Inequality operator.
bool operator==(const Color &other) const
Equality operator.
const Experimental & experimental() const
Get Experimental.
Definition Settings2D.h:2349
std::string toString() const
Get the value as string.
const Balance & balance() const
Get Balance.
Definition Settings2D.h:2309
Color & set(const Balance::Blue &value)
Set Balance::Blue.
Definition Settings2D.h:2328
Balance & balance()
Get Balance.
Definition Settings2D.h:2315
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:2477
friend std::ostream & operator<<(std::ostream &stream, const Color &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:2503
Experimental & experimental()
Get Experimental.
Definition Settings2D.h:2355
const Settings2D::Processing::Color::Experimental::Mode & get() const
Definition Settings2D.h:2443
const Settings2D::Processing::Color::Gamma & get() const
Definition Settings2D.h:2452
Color & set(const Experimental::Mode &value)
Set Experimental::Mode.
Definition Settings2D.h:2368
const Settings2D::Processing::Color::Balance::Green & get() const
Definition Settings2D.h:2415
Gamma & gamma()
Get Gamma.
Definition Settings2D.h:2381
const Settings2D::Processing::Color::Balance::Red & get() const
Definition Settings2D.h:2424
const Settings2D::Processing::Color::Experimental & get() const
Definition Settings2D.h:2433
Color copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition Settings2D.h:2288
const Settings2D::Processing::Color::Balance & get() const
Definition Settings2D.h:2397
std::tuple< Settings2D::Processing::Color::Balance, Settings2D::Processing::Color::Balance::Blue, Settings2D::Processing::Color::Balance::Green, Settings2D::Processing::Color::Balance::Red, Settings2D::Processing::Color::Experimental, Settings2D::Processing::Color::Experimental::Mode, Settings2D::Processing::Color::Gamma > Descendants
Definition Settings2D.h:2176
const Gamma & gamma() const
Get Gamma.
Definition Settings2D.h:2375
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition Settings2D.h:2406
Color & set(const Balance &value)
Set Balance.
Definition Settings2D.h:2321
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:2486
Color & set(const Gamma &value)
Set Gamma.
Definition Settings2D.h:2387
Color & set(const Experimental &value)
Set Experimental.
Definition Settings2D.h:2361
Color & set(const Balance::Red &value)
Set Balance::Red.
Definition Settings2D.h:2342
2D processing settings.
Definition Settings2D.h:1073
const Settings2D::Processing::Color & get() const
Definition Settings2D.h:2727
Processing & set(const Color::Gamma &value)
Set Color::Gamma.
Definition Settings2D.h:2718
bool operator!=(const Processing &other) const
Inequality operator.
bool operator==(const Processing &other) const
Equality operator.
Processing & set(const Color &value)
Set Color.
Definition Settings2D.h:2669
Processing & set(const Color::Experimental &value)
Set Color::Experimental.
Definition Settings2D.h:2704
const Settings2D::Processing::Color::Balance & get() const
Definition Settings2D.h:2735
Processing & set(const Color::Experimental::Mode &value)
Set Color::Experimental::Mode.
Definition Settings2D.h:2711
friend std::ostream & operator<<(std::ostream &stream, const Processing &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:2823
const Settings2D::Processing::Color::Experimental & get() const
Definition Settings2D.h:2771
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:2801
Color & color()
Get Color.
Definition Settings2D.h:2663
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:2598
std::tuple< Settings2D::Processing::Color, Settings2D::Processing::Color::Balance, Settings2D::Processing::Color::Balance::Blue, Settings2D::Processing::Color::Balance::Green, Settings2D::Processing::Color::Balance::Red, Settings2D::Processing::Color::Experimental, Settings2D::Processing::Color::Experimental::Mode, Settings2D::Processing::Color::Gamma > Descendants
Definition Settings2D.h:2522
Processing & set(const Color::Balance::Blue &value)
Set Color::Balance::Blue.
Definition Settings2D.h:2683
const Settings2D::Processing::Color::Experimental::Mode & get() const
Definition Settings2D.h:2780
Processing & set(const Color::Balance &value)
Set Color::Balance.
Definition Settings2D.h:2676
const Color & color() const
Get Color.
Definition Settings2D.h:2657
Processing & set(const Color::Balance::Red &value)
Set Color::Balance::Red.
Definition Settings2D.h:2697
const Settings2D::Processing::Color::Gamma & get() const
Definition Settings2D.h:2788
const Settings2D::Processing::Color::Balance::Red & get() const
Definition Settings2D.h:2762
Processing copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition Settings2D.h:2637
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition Settings2D.h:2744
const Settings2D::Processing::Color::Balance::Green & get() const
Definition Settings2D.h:2753
std::string toString() const
Get the value as string.
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:2808
Processing()
Default constructor.
Processing & set(const Color::Balance::Green &value)
Set Color::Balance::Green.
Definition Settings2D.h:2690
Choose how to sample colors for the 2D image. The rgb option gives an image with full colors....
Definition Settings2D.h:2869
ValueType
The type of the underlying value.
Definition Settings2D.h:2892
Color()=default
Default constructor.
void reset()
Reset the node to unset state.
static const Color grayscale
grayscale
Definition Settings2D.h:2897
static std::set< ValueType > validValues()
All valid values of Color.
Definition Settings2D.h:2900
ValueType value() const
Get the value.
friend std::ostream & operator<<(std::ostream &stream, const Color &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:2947
constexpr Color(ValueType value)
Constructor.
Definition Settings2D.h:2909
bool hasValue() const
Check if the value is set.
static const Color rgb
rgb
Definition Settings2D.h:2896
bool operator==(const Color &other) const
Comparison operator.
Definition Settings2D.h:2935
bool operator!=(const Color &other) const
Comparison operator.
Definition Settings2D.h:2941
std::string toString() const
Get the value as string.
friend std::ostream & operator<<(std::ostream &stream, const Color::ValueType &value)
Operator to serialize ValueType to a stream.
Definition Settings2D.h:2929
Set the pixel sampling to use for the 2D capture. This setting defines how the camera sensor is sampl...
Definition Settings2D.h:2976
static const Pixel redSubsample4x4
redSubsample4x4
Definition Settings2D.h:3009
static const Pixel by2x2
by2x2
Definition Settings2D.h:3010
Pixel()=default
Default constructor.
constexpr Pixel(ValueType value)
Constructor.
Definition Settings2D.h:3029
ValueType
The type of the underlying value.
Definition Settings2D.h:2996
static const Pixel by4x4
by4x4
Definition Settings2D.h:3011
bool operator!=(const Pixel &other) const
Comparison operator.
Definition Settings2D.h:3061
ValueType value() const
Get the value.
bool operator==(const Pixel &other) const
Comparison operator.
Definition Settings2D.h:3055
static const Pixel redSubsample2x2
redSubsample2x2
Definition Settings2D.h:3007
static const Pixel all
all
Definition Settings2D.h:3005
static std::set< ValueType > validValues()
All valid values of Pixel.
Definition Settings2D.h:3014
std::string toString() const
Get the value as string.
static const Pixel blueSubsample2x2
blueSubsample2x2
Definition Settings2D.h:3006
friend std::ostream & operator<<(std::ostream &stream, const Pixel::ValueType &value)
Operator to serialize ValueType to a stream.
Definition Settings2D.h:3049
friend std::ostream & operator<<(std::ostream &stream, const Pixel &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:3067
void reset()
Reset the node to unset state.
static const Pixel blueSubsample4x4
blueSubsample4x4
Definition Settings2D.h:3008
bool hasValue() const
Check if the value is set.
Sampling settings.
Definition Settings2D.h:2845
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:3277
bool operator==(const Sampling &other) const
Equality operator.
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:3149
const Settings2D::Sampling::Pixel & get() const
Definition Settings2D.h:3250
Sampling & set(const Pixel &value)
Set Pixel.
Definition Settings2D.h:3233
const Pixel & pixel() const
Get Pixel.
Definition Settings2D.h:3221
Pixel & pixel()
Get Pixel.
Definition Settings2D.h:3227
std::string toString() const
Get the value as string.
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:3269
const Settings2D::Sampling::Color & get() const
Definition Settings2D.h:3242
friend std::ostream & operator<<(std::ostream &stream, const Sampling &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:3293
bool operator!=(const Sampling &other) const
Inequality operator.
const Color & color() const
Get Color.
Definition Settings2D.h:3202
Sampling & set(const Color &value)
Set Color.
Definition Settings2D.h:3214
Sampling copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition Settings2D.h:3182
Color & color()
Get Color.
Definition Settings2D.h:3208
Sampling()
Default constructor.
std::tuple< Settings2D::Sampling::Color, Settings2D::Sampling::Pixel > Descendants
Definition Settings2D.h:3093
Settings used when capturing 2D images with a Zivid camera.
Definition Settings2D.h:79
Settings2D & set(const Processing &value)
Set Processing.
Definition Settings2D.h:3512
const Settings2D::Sampling::Pixel & get() const
Definition Settings2D.h:3703
const Settings2D::Processing::Color & get() const
Definition Settings2D.h:3622
Sampling & sampling()
Get Sampling.
Definition Settings2D.h:3581
const Settings2D::Sampling::Color & get() const
Definition Settings2D.h:3695
const Settings2D::Processing::Color::Balance::Red & get() const
Definition Settings2D.h:3656
const Settings2D::Processing::Color::Balance::Green & get() const
Definition Settings2D.h:3648
Settings2D & set(const Sampling::Color &value)
Set Sampling::Color.
Definition Settings2D.h:3594
void save(const std::string &fileName) const
Save to the given file.
std::string serialize() const
Serialize to a string.
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition Settings2D.h:3639
const Acquisitions & acquisitions() const
Get Acquisitions.
Definition Settings2D.h:3481
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:3737
Settings2D & set(const Sampling &value)
Set Sampling.
Definition Settings2D.h:3587
Settings2D(Args &&...args)
Constructor taking variadic number of arguments.
Definition Settings2D.h:3379
const Settings2D::Acquisitions & get() const
Definition Settings2D.h:3608
Settings2D()
Default constructor.
const Settings2D::Processing::Color::Gamma & get() const
Definition Settings2D.h:3681
Settings2D & set(const Acquisitions &value)
Set Acquisitions.
Definition Settings2D.h:3493
Settings2D(const std::string &fileName)
Construct Settings2D by loading from file.
const Settings2D::Sampling & get() const
Definition Settings2D.h:3687
void load(const std::string &fileName)
Load from the given file.
const Settings2D::Processing::Color::Balance & get() const
Definition Settings2D.h:3630
Settings2D & set(const Processing::Color::Balance::Green &value)
Set Processing::Color::Balance::Green.
Definition Settings2D.h:3540
bool operator!=(const Settings2D &other) const
Inequality operator.
Settings2D & set(const Processing::Color::Balance &value)
Set Processing::Color::Balance.
Definition Settings2D.h:3526
const Settings2D::Processing::Color::Experimental & get() const
Definition Settings2D.h:3664
std::tuple< Settings2D::Acquisitions, Settings2D::Processing, Settings2D::Processing::Color, Settings2D::Processing::Color::Balance, Settings2D::Processing::Color::Balance::Blue, Settings2D::Processing::Color::Balance::Green, Settings2D::Processing::Color::Balance::Red, Settings2D::Processing::Color::Experimental, Settings2D::Processing::Color::Experimental::Mode, Settings2D::Processing::Color::Gamma, Settings2D::Sampling, Settings2D::Sampling::Color, Settings2D::Sampling::Pixel > Descendants
Definition Settings2D.h:3311
const Settings2D::Processing & get() const
Definition Settings2D.h:3614
static Settings2D fromSerialized(const std::string &value)
Construct a new Settings2D instance from a previously serialized string.
Settings2D & set(const Processing::Color::Balance::Red &value)
Set Processing::Color::Balance::Red.
Definition Settings2D.h:3547
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:3418
Processing & processing()
Get Processing.
Definition Settings2D.h:3506
const Processing & processing() const
Get Processing.
Definition Settings2D.h:3500
Settings2D copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition Settings2D.h:3462
Settings2D & set(const Processing::Color::Balance::Blue &value)
Set Processing::Color::Balance::Blue.
Definition Settings2D.h:3533
Settings2D & set(const Processing::Color::Experimental::Mode &value)
Set Processing::Color::Experimental::Mode.
Definition Settings2D.h:3561
Acquisitions & acquisitions()
Get Acquisitions.
Definition Settings2D.h:3487
std::string toString() const
Get the value as string.
Settings2D & set(const Processing::Color::Experimental &value)
Set Processing::Color::Experimental.
Definition Settings2D.h:3554
Settings2D & set(const Sampling::Pixel &value)
Set Sampling::Pixel.
Definition Settings2D.h:3601
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:3728
const Settings2D::Processing::Color::Experimental::Mode & get() const
Definition Settings2D.h:3673
bool operator==(const Settings2D &other) const
Equality operator.
const Sampling & sampling() const
Get Sampling.
Definition Settings2D.h:3575
friend std::ostream & operator<<(std::ostream &stream, const Settings2D &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:3754
Settings2D & set(const Processing::Color &value)
Set Processing::Color.
Definition Settings2D.h:3519
Settings2D & set(const Processing::Color::Gamma &value)
Set Processing::Color::Gamma.
Definition Settings2D.h:3568
NodeType
Definition NodeType.h:49
Definition EnvironmentInfo.h:74
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:84