Zivid C++ API 2.12.0+6afd4961-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 <set>
53#include <sstream>
54#include <string>
55#include <tuple>
56#include <utility>
57#include <vector>
58
64#include "Zivid/Range.h"
65
66#ifdef _MSC_VER
67# pragma warning(push)
68# pragma warning(disable : 4251) // "X needs to have dll-interface to be used by clients of class Y."
69#endif
70
71namespace Zivid
72{
73
75
76 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
78 {
79 public:
81 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
82
84 static constexpr const char *path{ "" };
85
87 static constexpr const char *name{ "Settings2D" };
88
90 static constexpr const char *description{
91 R"description(Settings used when capturing 2D images with a Zivid camera.)description"
92 };
93
94 static constexpr size_t version{ 4 };
95
96#ifndef NO_DOC
97 template<size_t>
98 struct Version;
99
100 using LatestVersion = Zivid::Settings2D;
101
102 // Short identifier. This value is not guaranteed to be universally unique
103 // Todo(ZIVID-2808): Move this to internal DataModelExt header
104 static constexpr std::array<uint8_t, 3> binaryId{ 's', 't', '2' };
105
106#endif
107
109
110 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
112 {
113 public:
115 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
116
118 static constexpr const char *path{ "Acquisition" };
119
121 static constexpr const char *name{ "Acquisition" };
122
124 static constexpr const char *description{ R"description(Settings for a single acquisition.)description" };
125
129
130 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
132 {
133 public:
135 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
136
138 static constexpr const char *path{ "Acquisition/Aperture" };
139
141 static constexpr const char *name{ "Aperture" };
142
144 static constexpr const char *description{
145 R"description(Aperture setting for the camera. Specified as an f-number (the ratio of lens focal length to
146the effective aperture diameter).
147)description"
148 };
149
151 using ValueType = double;
152
154 static constexpr Range<double> validRange()
155 {
156 return { 1.4, 32.0 };
157 }
158
160 Aperture() = default;
161
163 explicit constexpr Aperture(double value)
164 : m_opt{ verifyValue(value) }
165 {}
166
171 double value() const;
172
174 bool hasValue() const;
175
177 void reset();
178
180 std::string toString() const;
181
183 bool operator==(const Aperture &other) const
184 {
185 return m_opt == other.m_opt;
186 }
187
189 bool operator!=(const Aperture &other) const
190 {
191 return m_opt != other.m_opt;
192 }
193
195 bool operator<(const Aperture &other) const
196 {
197 return m_opt < other.m_opt;
198 }
199
201 bool operator>(const Aperture &other) const
202 {
203 return m_opt > other.m_opt;
204 }
205
207 bool operator<=(const Aperture &other) const
208 {
209 return m_opt <= other.m_opt;
210 }
211
213 bool operator>=(const Aperture &other) const
214 {
215 return m_opt >= other.m_opt;
216 }
217
219 friend std::ostream &operator<<(std::ostream &stream, const Aperture &value)
220 {
221 return stream << value.toString();
222 }
223
224 private:
225 void setFromString(const std::string &value);
226
227 constexpr ValueType static verifyValue(const ValueType &value)
228 {
229 return validRange().isInRange(value)
230 ? value
231 : throw std::out_of_range{ "Aperture{ " + std::to_string(value) + " } is not in range ["
232 + std::to_string(validRange().min()) + ", "
233 + std::to_string(validRange().max()) + "]" };
234 }
235
236 Zivid::DataModel::Detail::Optional<double> m_opt;
237
238 friend struct DataModel::Detail::Befriend<Aperture>;
239 };
240
252
253 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
255 {
256 public:
258 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
259
261 static constexpr const char *path{ "Acquisition/Brightness" };
262
264 static constexpr const char *name{ "Brightness" };
265
267 static constexpr const char *description{
268 R"description(Brightness controls the light output from the projector.
269
270Brightness above 1.0 may be needed when the distance between the camera and the scene is large,
271or in case of high levels of ambient lighting.
272
273When brightness is above 1.0 the duty cycle of the camera (the percentage of time the camera
274can capture) will be reduced. The duty cycle in boost mode is 50%. The duty cycle is calculated
275over a 10 second period. This limitation is enforced automatically by the camera. Calling capture
276when the duty cycle limit has been reached will cause the camera to first wait (sleep) for a
277duration of time to cool down, before capture will start.
278)description"
279 };
280
282 using ValueType = double;
283
285 static constexpr Range<double> validRange()
286 {
287 return { 0, 2.5 };
288 }
289
291 Brightness() = default;
292
294 explicit constexpr Brightness(double value)
295 : m_opt{ verifyValue(value) }
296 {}
297
302 double value() const;
303
305 bool hasValue() const;
306
308 void reset();
309
311 std::string toString() const;
312
314 bool operator==(const Brightness &other) const
315 {
316 return m_opt == other.m_opt;
317 }
318
320 bool operator!=(const Brightness &other) const
321 {
322 return m_opt != other.m_opt;
323 }
324
326 bool operator<(const Brightness &other) const
327 {
328 return m_opt < other.m_opt;
329 }
330
332 bool operator>(const Brightness &other) const
333 {
334 return m_opt > other.m_opt;
335 }
336
338 bool operator<=(const Brightness &other) const
339 {
340 return m_opt <= other.m_opt;
341 }
342
344 bool operator>=(const Brightness &other) const
345 {
346 return m_opt >= other.m_opt;
347 }
348
350 friend std::ostream &operator<<(std::ostream &stream, const Brightness &value)
351 {
352 return stream << value.toString();
353 }
354
355 private:
356 void setFromString(const std::string &value);
357
358 constexpr ValueType static verifyValue(const ValueType &value)
359 {
360 return validRange().isInRange(value)
361 ? value
362 : throw std::out_of_range{ "Brightness{ " + std::to_string(value)
363 + " } is not in range [" + std::to_string(validRange().min())
364 + ", " + std::to_string(validRange().max()) + "]" };
365 }
366
367 Zivid::DataModel::Detail::Optional<double> m_opt;
368
369 friend struct DataModel::Detail::Befriend<Brightness>;
370 };
371
373
374 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
376 {
377 public:
379 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
380
382 static constexpr const char *path{ "Acquisition/ExposureTime" };
383
385 static constexpr const char *name{ "ExposureTime" };
386
388 static constexpr const char *description{ R"description(Exposure time for the image.)description" };
389
391 using ValueType = std::chrono::microseconds;
392
395 {
396 return { std::chrono::microseconds{ 1677 }, std::chrono::microseconds{ 100000 } };
397 }
398
400 ExposureTime() = default;
401
403 explicit constexpr ExposureTime(std::chrono::microseconds value)
404 : m_opt{ verifyValue(value) }
405 {}
406
411 std::chrono::microseconds value() const;
412
414 bool hasValue() const;
415
417 void reset();
418
420 std::string toString() const;
421
423 bool operator==(const ExposureTime &other) const
424 {
425 return m_opt == other.m_opt;
426 }
427
429 bool operator!=(const ExposureTime &other) const
430 {
431 return m_opt != other.m_opt;
432 }
433
435 bool operator<(const ExposureTime &other) const
436 {
437 return m_opt < other.m_opt;
438 }
439
441 bool operator>(const ExposureTime &other) const
442 {
443 return m_opt > other.m_opt;
444 }
445
447 bool operator<=(const ExposureTime &other) const
448 {
449 return m_opt <= other.m_opt;
450 }
451
453 bool operator>=(const ExposureTime &other) const
454 {
455 return m_opt >= other.m_opt;
456 }
457
459 friend std::ostream &operator<<(std::ostream &stream, const ExposureTime &value)
460 {
461 return stream << value.toString();
462 }
463
464 private:
465 void setFromString(const std::string &value);
466
467 constexpr ValueType static verifyValue(const ValueType &value)
468 {
469 return validRange().isInRange(value)
470 ? value
471 : throw std::out_of_range{ "ExposureTime{ " + std::to_string(value.count())
472 + " } is not in range ["
473 + std::to_string(validRange().min().count()) + ", "
474 + std::to_string(validRange().max().count()) + "]" };
475 }
476
477 Zivid::DataModel::Detail::Optional<std::chrono::microseconds> m_opt;
478
479 friend struct DataModel::Detail::Befriend<ExposureTime>;
480 };
481
483
484 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
486 {
487 public:
489 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
490
492 static constexpr const char *path{ "Acquisition/Gain" };
493
495 static constexpr const char *name{ "Gain" };
496
498 static constexpr const char *description{ R"description(Analog gain in the camera.)description" };
499
501 using ValueType = double;
502
504 static constexpr Range<double> validRange()
505 {
506 return { 1, 16 };
507 }
508
510 Gain() = default;
511
513 explicit constexpr Gain(double value)
514 : m_opt{ verifyValue(value) }
515 {}
516
521 double value() const;
522
524 bool hasValue() const;
525
527 void reset();
528
530 std::string toString() const;
531
533 bool operator==(const Gain &other) const
534 {
535 return m_opt == other.m_opt;
536 }
537
539 bool operator!=(const Gain &other) const
540 {
541 return m_opt != other.m_opt;
542 }
543
545 bool operator<(const Gain &other) const
546 {
547 return m_opt < other.m_opt;
548 }
549
551 bool operator>(const Gain &other) const
552 {
553 return m_opt > other.m_opt;
554 }
555
557 bool operator<=(const Gain &other) const
558 {
559 return m_opt <= other.m_opt;
560 }
561
563 bool operator>=(const Gain &other) const
564 {
565 return m_opt >= other.m_opt;
566 }
567
569 friend std::ostream &operator<<(std::ostream &stream, const Gain &value)
570 {
571 return stream << value.toString();
572 }
573
574 private:
575 void setFromString(const std::string &value);
576
577 constexpr ValueType static verifyValue(const ValueType &value)
578 {
579 return validRange().isInRange(value)
580 ? value
581 : throw std::out_of_range{ "Gain{ " + std::to_string(value) + " } is not in range ["
582 + std::to_string(validRange().min()) + ", "
583 + std::to_string(validRange().max()) + "]" };
584 }
585
586 Zivid::DataModel::Detail::Optional<double> m_opt;
587
588 friend struct DataModel::Detail::Befriend<Gain>;
589 };
590
591 using Descendants = std::tuple<
596
599
614#ifndef NO_DOC
615 template<
616 typename... Args,
617 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
618 typename std::enable_if<
619 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
620 value,
621 int>::type = 0>
622#else
623 template<typename... Args>
624#endif
625 explicit Acquisition(Args &&...args)
626 {
627 using namespace Zivid::Detail::TypeTraits;
628
629 static_assert(
630 AllArgsDecayedAreUnique<Args...>::value,
631 "Found duplicate types among the arguments passed to Acquisition(...). "
632 "Types should be listed at most once.");
633
634 set(std::forward<Args>(args)...);
635 }
636
650#ifndef NO_DOC
651 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
652#else
653 template<typename... Args>
654#endif
655 void set(Args &&...args)
656 {
657 using namespace Zivid::Detail::TypeTraits;
658
659 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
660 static_assert(
661 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
662
663 static_assert(
664 AllArgsDecayedAreUnique<Args...>::value,
665 "Found duplicate types among the arguments passed to set(...). "
666 "Types should be listed at most once.");
667
668 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
669 }
670
685#ifndef NO_DOC
686 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
687#else
688 template<typename... Args>
689#endif
690 Acquisition copyWith(Args &&...args) const
691 {
692 using namespace Zivid::Detail::TypeTraits;
693
694 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
695 static_assert(
696 AllArgsAreDescendantNodes::value,
697 "All arguments passed to copyWith(...) must be descendant nodes.");
698
699 static_assert(
700 AllArgsDecayedAreUnique<Args...>::value,
701 "Found duplicate types among the arguments passed to copyWith(...). "
702 "Types should be listed at most once.");
703
704 auto copy{ *this };
705 copy.set(std::forward<Args>(args)...);
706 return copy;
707 }
708
710 const Aperture &aperture() const
711 {
712 return m_aperture;
713 }
714
717 {
718 return m_aperture;
719 }
720
722 Acquisition &set(const Aperture &value)
723 {
724 m_aperture = value;
725 return *this;
726 }
727
729 const Brightness &brightness() const
730 {
731 return m_brightness;
732 }
733
736 {
737 return m_brightness;
738 }
739
742 {
743 m_brightness = value;
744 return *this;
745 }
746
749 {
750 return m_exposureTime;
751 }
752
755 {
756 return m_exposureTime;
757 }
758
761 {
762 m_exposureTime = value;
763 return *this;
764 }
765
767 const Gain &gain() const
768 {
769 return m_gain;
770 }
771
774 {
775 return m_gain;
776 }
777
779 Acquisition &set(const Gain &value)
780 {
781 m_gain = value;
782 return *this;
783 }
784
785 template<
786 typename T,
787 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::Aperture>::value, int>::type = 0>
789 {
790 return m_aperture;
791 }
792
793 template<
794 typename T,
795 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::Brightness>::value, int>::type = 0>
797 {
798 return m_brightness;
799 }
800
801 template<
802 typename T,
803 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::ExposureTime>::value, int>::type = 0>
805 {
806 return m_exposureTime;
807 }
808
809 template<
810 typename T,
811 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::Gain>::value, int>::type = 0>
813 {
814 return m_gain;
815 }
816
817 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
819 {
820 return m_aperture;
821 }
822
823 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
825 {
826 return m_brightness;
827 }
828
829 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
831 {
832 return m_exposureTime;
833 }
834
835 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
837 {
838 return m_gain;
839 }
840
842 template<typename F>
843 void forEach(const F &f) const
844 {
845 f(m_aperture);
846 f(m_brightness);
847 f(m_exposureTime);
848 f(m_gain);
849 }
850
852 template<typename F>
853 void forEach(const F &f)
854 {
855 f(m_aperture);
856 f(m_brightness);
857 f(m_exposureTime);
858 f(m_gain);
859 }
860
862 bool operator==(const Acquisition &other) const;
863
865 bool operator!=(const Acquisition &other) const;
866
868 std::string toString() const;
869
871 friend std::ostream &operator<<(std::ostream &stream, const Acquisition &value)
872 {
873 return stream << value.toString();
874 }
875
876 private:
877 void setFromString(const std::string &value);
878
879 void setFromString(const std::string &fullPath, const std::string &value);
880
881 std::string getString(const std::string &fullPath) const;
882
883 Aperture m_aperture;
884 Brightness m_brightness;
885 ExposureTime m_exposureTime;
886 Gain m_gain;
887
888 friend struct DataModel::Detail::Befriend<Acquisition>;
889 };
890
892
893 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
895 {
896 public:
898 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafDataModelList;
899
901 static constexpr const char *path{ "Acquisitions" };
902
904 static constexpr const char *name{ "Acquisitions" };
905
907 static constexpr const char *description{
908 R"description(List of acquisitions. Note that the Zivid SDK only supports a single acquisition per capture in 2D mode.)description"
909 };
910
912 using ValueType = std::vector<Settings2D::Acquisition>;
913
916 {
917 return { 0, std::numeric_limits<ValueType::size_type>::max() };
918 }
919
921 Acquisitions() = default;
922
924 explicit Acquisitions(std::vector<Settings2D::Acquisition> value)
925 : m_value{ std::move(value) }
926 {}
927
929 explicit Acquisitions(std::initializer_list<Settings2D::Acquisition> value)
930 : Acquisitions{ ValueType{ value } }
931 {}
932
934 const std::vector<Settings2D::Acquisition> &value() const;
935
937 std::string toString() const;
938
940 std::size_t size() const noexcept;
941
943 bool isEmpty() const noexcept;
944
950 template<typename... Args>
951 void emplaceBack(Args &&...args)
952 {
953 m_value.emplace_back(std::forward<Args>(args)...);
954 }
955
961 Settings2D::Acquisition &at(std::size_t pos);
962
968 const Settings2D::Acquisition &at(std::size_t pos) const;
969
976
982 const Settings2D::Acquisition &operator[](std::size_t pos) const;
983
985 template<typename F>
986 void forEach(const F &f)
987 {
988 for(auto &child : m_value)
989 {
990 f(child);
991 }
992 }
993
995 template<typename F>
996 void forEach(const F &f) const
997 {
998 for(const auto &child : m_value)
999 {
1000 f(child);
1001 }
1002 }
1003
1005 using Iterator = std::vector<Settings2D::Acquisition>::iterator;
1006
1008 Iterator begin() noexcept;
1009
1011 Iterator end() noexcept;
1012
1014 using ConstIterator = std::vector<Settings2D::Acquisition>::const_iterator;
1015
1017 ConstIterator begin() const noexcept;
1018
1020 ConstIterator end() const noexcept;
1021
1023 ConstIterator cbegin() const noexcept;
1024
1026 ConstIterator cend() const noexcept;
1027
1029 bool operator==(const Acquisitions &other) const
1030 {
1031 return m_value == other.m_value;
1032 }
1033
1035 bool operator!=(const Acquisitions &other) const
1036 {
1037 return m_value != other.m_value;
1038 }
1039
1041 friend std::ostream &operator<<(std::ostream &stream, const Acquisitions &value)
1042 {
1043 return stream << value.toString();
1044 }
1045
1046 private:
1047 void setFromString(const std::string &value);
1048
1049 std::vector<Settings2D::Acquisition> m_value{};
1050
1051 friend struct DataModel::Detail::Befriend<Acquisitions>;
1052 };
1053
1055
1056 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1058 {
1059 public:
1061 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
1062
1064 static constexpr const char *path{ "Processing" };
1065
1067 static constexpr const char *name{ "Processing" };
1068
1070 static constexpr const char *description{ R"description(Processing related settings.)description" };
1071
1073
1074 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1076 {
1077 public:
1079 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
1080
1082 static constexpr const char *path{ "Processing/Color" };
1083
1085 static constexpr const char *name{ "Color" };
1086
1088 static constexpr const char *description{ R"description(Color settings.)description" };
1089
1091
1092 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1094 {
1095 public:
1097 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
1098
1100 static constexpr const char *path{ "Processing/Color/Balance" };
1101
1103 static constexpr const char *name{ "Balance" };
1104
1106 static constexpr const char *description{ R"description(Color balance settings.)description" };
1107
1109
1110 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1112 {
1113 public:
1115 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1116
1118 static constexpr const char *path{ "Processing/Color/Balance/Blue" };
1119
1121 static constexpr const char *name{ "Blue" };
1122
1124 static constexpr const char *description{
1125 R"description(Digital gain applied to blue channel.)description"
1126 };
1127
1129 using ValueType = double;
1130
1132 static constexpr Range<double> validRange()
1133 {
1134 return { 1.0, 8.0 };
1135 }
1136
1138 Blue() = default;
1139
1141 explicit constexpr Blue(double value)
1142 : m_opt{ verifyValue(value) }
1143 {}
1144
1149 double value() const;
1150
1152 bool hasValue() const;
1153
1155 void reset();
1156
1158 std::string toString() const;
1159
1161 bool operator==(const Blue &other) const
1162 {
1163 return m_opt == other.m_opt;
1164 }
1165
1167 bool operator!=(const Blue &other) const
1168 {
1169 return m_opt != other.m_opt;
1170 }
1171
1173 bool operator<(const Blue &other) const
1174 {
1175 return m_opt < other.m_opt;
1176 }
1177
1179 bool operator>(const Blue &other) const
1180 {
1181 return m_opt > other.m_opt;
1182 }
1183
1185 bool operator<=(const Blue &other) const
1186 {
1187 return m_opt <= other.m_opt;
1188 }
1189
1191 bool operator>=(const Blue &other) const
1192 {
1193 return m_opt >= other.m_opt;
1194 }
1195
1197 friend std::ostream &operator<<(std::ostream &stream, const Blue &value)
1198 {
1199 return stream << value.toString();
1200 }
1201
1202 private:
1203 void setFromString(const std::string &value);
1204
1205 constexpr ValueType static verifyValue(const ValueType &value)
1206 {
1207 return validRange().isInRange(value)
1208 ? value
1209 : throw std::out_of_range{ "Blue{ " + std::to_string(value)
1210 + " } is not in range ["
1211 + std::to_string(validRange().min()) + ", "
1212 + std::to_string(validRange().max()) + "]" };
1213 }
1214
1215 Zivid::DataModel::Detail::Optional<double> m_opt;
1216
1217 friend struct DataModel::Detail::Befriend<Blue>;
1218 };
1219
1221
1222 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1224 {
1225 public:
1227 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1228
1230 static constexpr const char *path{ "Processing/Color/Balance/Green" };
1231
1233 static constexpr const char *name{ "Green" };
1234
1236 static constexpr const char *description{
1237 R"description(Digital gain applied to green channel.)description"
1238 };
1239
1241 using ValueType = double;
1242
1244 static constexpr Range<double> validRange()
1245 {
1246 return { 1.0, 8.0 };
1247 }
1248
1250 Green() = default;
1251
1253 explicit constexpr Green(double value)
1254 : m_opt{ verifyValue(value) }
1255 {}
1256
1261 double value() const;
1262
1264 bool hasValue() const;
1265
1267 void reset();
1268
1270 std::string toString() const;
1271
1273 bool operator==(const Green &other) const
1274 {
1275 return m_opt == other.m_opt;
1276 }
1277
1279 bool operator!=(const Green &other) const
1280 {
1281 return m_opt != other.m_opt;
1282 }
1283
1285 bool operator<(const Green &other) const
1286 {
1287 return m_opt < other.m_opt;
1288 }
1289
1291 bool operator>(const Green &other) const
1292 {
1293 return m_opt > other.m_opt;
1294 }
1295
1297 bool operator<=(const Green &other) const
1298 {
1299 return m_opt <= other.m_opt;
1300 }
1301
1303 bool operator>=(const Green &other) const
1304 {
1305 return m_opt >= other.m_opt;
1306 }
1307
1309 friend std::ostream &operator<<(std::ostream &stream, const Green &value)
1310 {
1311 return stream << value.toString();
1312 }
1313
1314 private:
1315 void setFromString(const std::string &value);
1316
1317 constexpr ValueType static verifyValue(const ValueType &value)
1318 {
1319 return validRange().isInRange(value)
1320 ? value
1321 : throw std::out_of_range{ "Green{ " + std::to_string(value)
1322 + " } is not in range ["
1323 + std::to_string(validRange().min()) + ", "
1324 + std::to_string(validRange().max()) + "]" };
1325 }
1326
1327 Zivid::DataModel::Detail::Optional<double> m_opt;
1328
1329 friend struct DataModel::Detail::Befriend<Green>;
1330 };
1331
1333
1334 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1336 {
1337 public:
1339 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1340
1342 static constexpr const char *path{ "Processing/Color/Balance/Red" };
1343
1345 static constexpr const char *name{ "Red" };
1346
1348 static constexpr const char *description{
1349 R"description(Digital gain applied to red channel.)description"
1350 };
1351
1353 using ValueType = double;
1354
1356 static constexpr Range<double> validRange()
1357 {
1358 return { 1.0, 8.0 };
1359 }
1360
1362 Red() = default;
1363
1365 explicit constexpr Red(double value)
1366 : m_opt{ verifyValue(value) }
1367 {}
1368
1373 double value() const;
1374
1376 bool hasValue() const;
1377
1379 void reset();
1380
1382 std::string toString() const;
1383
1385 bool operator==(const Red &other) const
1386 {
1387 return m_opt == other.m_opt;
1388 }
1389
1391 bool operator!=(const Red &other) const
1392 {
1393 return m_opt != other.m_opt;
1394 }
1395
1397 bool operator<(const Red &other) const
1398 {
1399 return m_opt < other.m_opt;
1400 }
1401
1403 bool operator>(const Red &other) const
1404 {
1405 return m_opt > other.m_opt;
1406 }
1407
1409 bool operator<=(const Red &other) const
1410 {
1411 return m_opt <= other.m_opt;
1412 }
1413
1415 bool operator>=(const Red &other) const
1416 {
1417 return m_opt >= other.m_opt;
1418 }
1419
1421 friend std::ostream &operator<<(std::ostream &stream, const Red &value)
1422 {
1423 return stream << value.toString();
1424 }
1425
1426 private:
1427 void setFromString(const std::string &value);
1428
1429 constexpr ValueType static verifyValue(const ValueType &value)
1430 {
1431 return validRange().isInRange(value)
1432 ? value
1433 : throw std::out_of_range{ "Red{ " + std::to_string(value)
1434 + " } is not in range ["
1435 + std::to_string(validRange().min()) + ", "
1436 + std::to_string(validRange().max()) + "]" };
1437 }
1438
1439 Zivid::DataModel::Detail::Optional<double> m_opt;
1440
1441 friend struct DataModel::Detail::Befriend<Red>;
1442 };
1443
1444 using Descendants = std::tuple<
1448
1451
1465#ifndef NO_DOC
1466 template<
1467 typename... Args,
1468 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1469 typename std::enable_if<
1470 Zivid::Detail::TypeTraits::
1471 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
1472 int>::type = 0>
1473#else
1474 template<typename... Args>
1475#endif
1476 explicit Balance(Args &&...args)
1477 {
1478 using namespace Zivid::Detail::TypeTraits;
1479
1480 static_assert(
1481 AllArgsDecayedAreUnique<Args...>::value,
1482 "Found duplicate types among the arguments passed to Balance(...). "
1483 "Types should be listed at most once.");
1484
1485 set(std::forward<Args>(args)...);
1486 }
1487
1500#ifndef NO_DOC
1501 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1502#else
1503 template<typename... Args>
1504#endif
1505 void set(Args &&...args)
1506 {
1507 using namespace Zivid::Detail::TypeTraits;
1508
1509 using AllArgsAreDescendantNodes =
1510 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1511 static_assert(
1512 AllArgsAreDescendantNodes::value,
1513 "All arguments passed to set(...) must be descendant nodes.");
1514
1515 static_assert(
1516 AllArgsDecayedAreUnique<Args...>::value,
1517 "Found duplicate types among the arguments passed to set(...). "
1518 "Types should be listed at most once.");
1519
1520 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1521 }
1522
1536#ifndef NO_DOC
1537 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1538#else
1539 template<typename... Args>
1540#endif
1541 Balance copyWith(Args &&...args) const
1542 {
1543 using namespace Zivid::Detail::TypeTraits;
1544
1545 using AllArgsAreDescendantNodes =
1546 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1547 static_assert(
1548 AllArgsAreDescendantNodes::value,
1549 "All arguments passed to copyWith(...) must be descendant nodes.");
1550
1551 static_assert(
1552 AllArgsDecayedAreUnique<Args...>::value,
1553 "Found duplicate types among the arguments passed to copyWith(...). "
1554 "Types should be listed at most once.");
1555
1556 auto copy{ *this };
1557 copy.set(std::forward<Args>(args)...);
1558 return copy;
1559 }
1560
1562 const Blue &blue() const
1563 {
1564 return m_blue;
1565 }
1566
1569 {
1570 return m_blue;
1571 }
1572
1574 Balance &set(const Blue &value)
1575 {
1576 m_blue = value;
1577 return *this;
1578 }
1579
1581 const Green &green() const
1582 {
1583 return m_green;
1584 }
1585
1588 {
1589 return m_green;
1590 }
1591
1593 Balance &set(const Green &value)
1594 {
1595 m_green = value;
1596 return *this;
1597 }
1598
1600 const Red &red() const
1601 {
1602 return m_red;
1603 }
1604
1607 {
1608 return m_red;
1609 }
1610
1612 Balance &set(const Red &value)
1613 {
1614 m_red = value;
1615 return *this;
1616 }
1617
1618 template<
1619 typename T,
1620 typename std::enable_if<
1621 std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value,
1622 int>::type = 0>
1624 {
1625 return m_blue;
1626 }
1627
1628 template<
1629 typename T,
1630 typename std::enable_if<
1631 std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value,
1632 int>::type = 0>
1634 {
1635 return m_green;
1636 }
1637
1638 template<
1639 typename T,
1640 typename std::enable_if<
1641 std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value,
1642 int>::type = 0>
1644 {
1645 return m_red;
1646 }
1647
1648 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1650 {
1651 return m_blue;
1652 }
1653
1654 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1656 {
1657 return m_green;
1658 }
1659
1660 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
1662 {
1663 return m_red;
1664 }
1665
1667 template<typename F>
1668 void forEach(const F &f) const
1669 {
1670 f(m_blue);
1671 f(m_green);
1672 f(m_red);
1673 }
1674
1676 template<typename F>
1677 void forEach(const F &f)
1678 {
1679 f(m_blue);
1680 f(m_green);
1681 f(m_red);
1682 }
1683
1685 bool operator==(const Balance &other) const;
1686
1688 bool operator!=(const Balance &other) const;
1689
1691 std::string toString() const;
1692
1694 friend std::ostream &operator<<(std::ostream &stream, const Balance &value)
1695 {
1696 return stream << value.toString();
1697 }
1698
1699 private:
1700 void setFromString(const std::string &value);
1701
1702 void setFromString(const std::string &fullPath, const std::string &value);
1703
1704 std::string getString(const std::string &fullPath) const;
1705
1706 Blue m_blue;
1707 Green m_green;
1708 Red m_red;
1709
1710 friend struct DataModel::Detail::Befriend<Balance>;
1711 };
1712
1716
1717 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1719 {
1720 public:
1722 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1723
1725 static constexpr const char *path{ "Processing/Color/Gamma" };
1726
1728 static constexpr const char *name{ "Gamma" };
1729
1731 static constexpr const char *description{
1732 R"description(Gamma applied to the color values. Gamma less than 1 makes the colors brighter, while gamma
1733greater than 1 makes the colors darker.
1734)description"
1735 };
1736
1738 using ValueType = double;
1739
1741 static constexpr Range<double> validRange()
1742 {
1743 return { 0.25, 1.5 };
1744 }
1745
1747 Gamma() = default;
1748
1750 explicit constexpr Gamma(double value)
1751 : m_opt{ verifyValue(value) }
1752 {}
1753
1758 double value() const;
1759
1761 bool hasValue() const;
1762
1764 void reset();
1765
1767 std::string toString() const;
1768
1770 bool operator==(const Gamma &other) const
1771 {
1772 return m_opt == other.m_opt;
1773 }
1774
1776 bool operator!=(const Gamma &other) const
1777 {
1778 return m_opt != other.m_opt;
1779 }
1780
1782 bool operator<(const Gamma &other) const
1783 {
1784 return m_opt < other.m_opt;
1785 }
1786
1788 bool operator>(const Gamma &other) const
1789 {
1790 return m_opt > other.m_opt;
1791 }
1792
1794 bool operator<=(const Gamma &other) const
1795 {
1796 return m_opt <= other.m_opt;
1797 }
1798
1800 bool operator>=(const Gamma &other) const
1801 {
1802 return m_opt >= other.m_opt;
1803 }
1804
1806 friend std::ostream &operator<<(std::ostream &stream, const Gamma &value)
1807 {
1808 return stream << value.toString();
1809 }
1810
1811 private:
1812 void setFromString(const std::string &value);
1813
1814 constexpr ValueType static verifyValue(const ValueType &value)
1815 {
1816 return validRange().isInRange(value)
1817 ? value
1818 : throw std::out_of_range{ "Gamma{ " + std::to_string(value) + " } is not in range ["
1819 + std::to_string(validRange().min()) + ", "
1820 + std::to_string(validRange().max()) + "]" };
1821 }
1822
1823 Zivid::DataModel::Detail::Optional<double> m_opt;
1824
1825 friend struct DataModel::Detail::Befriend<Gamma>;
1826 };
1827
1828 using Descendants = std::tuple<
1834
1837
1853#ifndef NO_DOC
1854 template<
1855 typename... Args,
1856 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1857 typename std::enable_if<
1858 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
1859 value,
1860 int>::type = 0>
1861#else
1862 template<typename... Args>
1863#endif
1864 explicit Color(Args &&...args)
1865 {
1866 using namespace Zivid::Detail::TypeTraits;
1867
1868 static_assert(
1869 AllArgsDecayedAreUnique<Args...>::value,
1870 "Found duplicate types among the arguments passed to Color(...). "
1871 "Types should be listed at most once.");
1872
1873 set(std::forward<Args>(args)...);
1874 }
1875
1890#ifndef NO_DOC
1891 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1892#else
1893 template<typename... Args>
1894#endif
1895 void set(Args &&...args)
1896 {
1897 using namespace Zivid::Detail::TypeTraits;
1898
1899 using AllArgsAreDescendantNodes =
1900 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1901 static_assert(
1902 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
1903
1904 static_assert(
1905 AllArgsDecayedAreUnique<Args...>::value,
1906 "Found duplicate types among the arguments passed to set(...). "
1907 "Types should be listed at most once.");
1908
1909 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1910 }
1911
1927#ifndef NO_DOC
1928 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1929#else
1930 template<typename... Args>
1931#endif
1932 Color copyWith(Args &&...args) const
1933 {
1934 using namespace Zivid::Detail::TypeTraits;
1935
1936 using AllArgsAreDescendantNodes =
1937 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1938 static_assert(
1939 AllArgsAreDescendantNodes::value,
1940 "All arguments passed to copyWith(...) must be descendant nodes.");
1941
1942 static_assert(
1943 AllArgsDecayedAreUnique<Args...>::value,
1944 "Found duplicate types among the arguments passed to copyWith(...). "
1945 "Types should be listed at most once.");
1946
1947 auto copy{ *this };
1948 copy.set(std::forward<Args>(args)...);
1949 return copy;
1950 }
1951
1953 const Balance &balance() const
1954 {
1955 return m_balance;
1956 }
1957
1960 {
1961 return m_balance;
1962 }
1963
1965 Color &set(const Balance &value)
1966 {
1967 m_balance = value;
1968 return *this;
1969 }
1970
1972 Color &set(const Balance::Blue &value)
1973 {
1974 m_balance.set(value);
1975 return *this;
1976 }
1977
1979 Color &set(const Balance::Green &value)
1980 {
1981 m_balance.set(value);
1982 return *this;
1983 }
1984
1986 Color &set(const Balance::Red &value)
1987 {
1988 m_balance.set(value);
1989 return *this;
1990 }
1991
1993 const Gamma &gamma() const
1994 {
1995 return m_gamma;
1996 }
1997
2000 {
2001 return m_gamma;
2002 }
2003
2005 Color &set(const Gamma &value)
2006 {
2007 m_gamma = value;
2008 return *this;
2009 }
2010
2011 template<
2012 typename T,
2013 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance>::value, int>::type =
2014 0>
2016 {
2017 return m_balance;
2018 }
2019
2020 template<
2021 typename T,
2022 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value, int>::
2023 type = 0>
2025 {
2026 return m_balance.get<Settings2D::Processing::Color::Balance::Blue>();
2027 }
2028
2029 template<
2030 typename T,
2031 typename std::
2032 enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value, int>::type = 0>
2034 {
2035 return m_balance.get<Settings2D::Processing::Color::Balance::Green>();
2036 }
2037
2038 template<
2039 typename T,
2040 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value, int>::
2041 type = 0>
2043 {
2044 return m_balance.get<Settings2D::Processing::Color::Balance::Red>();
2045 }
2046
2047 template<
2048 typename T,
2049 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Gamma>::value, int>::type =
2050 0>
2052 {
2053 return m_gamma;
2054 }
2055
2056 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2058 {
2059 return m_balance;
2060 }
2061
2062 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
2064 {
2065 return m_gamma;
2066 }
2067
2069 template<typename F>
2070 void forEach(const F &f) const
2071 {
2072 f(m_balance);
2073 f(m_gamma);
2074 }
2075
2077 template<typename F>
2078 void forEach(const F &f)
2079 {
2080 f(m_balance);
2081 f(m_gamma);
2082 }
2083
2085 bool operator==(const Color &other) const;
2086
2088 bool operator!=(const Color &other) const;
2089
2091 std::string toString() const;
2092
2094 friend std::ostream &operator<<(std::ostream &stream, const Color &value)
2095 {
2096 return stream << value.toString();
2097 }
2098
2099 private:
2100 void setFromString(const std::string &value);
2101
2102 void setFromString(const std::string &fullPath, const std::string &value);
2103
2104 std::string getString(const std::string &fullPath) const;
2105
2106 Balance m_balance;
2107 Gamma m_gamma;
2108
2109 friend struct DataModel::Detail::Befriend<Color>;
2110 };
2111
2112 using Descendants = std::tuple<
2119
2122
2139#ifndef NO_DOC
2140 template<
2141 typename... Args,
2142 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
2143 typename std::enable_if<
2144 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
2145 value,
2146 int>::type = 0>
2147#else
2148 template<typename... Args>
2149#endif
2150 explicit Processing(Args &&...args)
2151 {
2152 using namespace Zivid::Detail::TypeTraits;
2153
2154 static_assert(
2155 AllArgsDecayedAreUnique<Args...>::value,
2156 "Found duplicate types among the arguments passed to Processing(...). "
2157 "Types should be listed at most once.");
2158
2159 set(std::forward<Args>(args)...);
2160 }
2161
2177#ifndef NO_DOC
2178 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
2179#else
2180 template<typename... Args>
2181#endif
2182 void set(Args &&...args)
2183 {
2184 using namespace Zivid::Detail::TypeTraits;
2185
2186 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2187 static_assert(
2188 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
2189
2190 static_assert(
2191 AllArgsDecayedAreUnique<Args...>::value,
2192 "Found duplicate types among the arguments passed to set(...). "
2193 "Types should be listed at most once.");
2194
2195 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
2196 }
2197
2214#ifndef NO_DOC
2215 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
2216#else
2217 template<typename... Args>
2218#endif
2219 Processing copyWith(Args &&...args) const
2220 {
2221 using namespace Zivid::Detail::TypeTraits;
2222
2223 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2224 static_assert(
2225 AllArgsAreDescendantNodes::value,
2226 "All arguments passed to copyWith(...) must be descendant nodes.");
2227
2228 static_assert(
2229 AllArgsDecayedAreUnique<Args...>::value,
2230 "Found duplicate types among the arguments passed to copyWith(...). "
2231 "Types should be listed at most once.");
2232
2233 auto copy{ *this };
2234 copy.set(std::forward<Args>(args)...);
2235 return copy;
2236 }
2237
2239 const Color &color() const
2240 {
2241 return m_color;
2242 }
2243
2246 {
2247 return m_color;
2248 }
2249
2251 Processing &set(const Color &value)
2252 {
2253 m_color = value;
2254 return *this;
2255 }
2256
2259 {
2260 m_color.set(value);
2261 return *this;
2262 }
2263
2266 {
2267 m_color.set(value);
2268 return *this;
2269 }
2270
2273 {
2274 m_color.set(value);
2275 return *this;
2276 }
2277
2280 {
2281 m_color.set(value);
2282 return *this;
2283 }
2284
2287 {
2288 m_color.set(value);
2289 return *this;
2290 }
2291
2292 template<
2293 typename T,
2294 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color>::value, int>::type = 0>
2296 {
2297 return m_color;
2298 }
2299
2300 template<
2301 typename T,
2302 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance>::value, int>::type = 0>
2304 {
2306 }
2307
2308 template<
2309 typename T,
2310 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value, int>::
2311 type = 0>
2313 {
2315 }
2316
2317 template<
2318 typename T,
2319 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value, int>::
2320 type = 0>
2322 {
2324 }
2325
2326 template<
2327 typename T,
2328 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value, int>::
2329 type = 0>
2331 {
2332 return m_color.get<Settings2D::Processing::Color::Balance::Red>();
2333 }
2334
2335 template<
2336 typename T,
2337 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Gamma>::value, int>::type = 0>
2339 {
2340 return m_color.get<Settings2D::Processing::Color::Gamma>();
2341 }
2342
2343 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2345 {
2346 return m_color;
2347 }
2348
2350 template<typename F>
2351 void forEach(const F &f) const
2352 {
2353 f(m_color);
2354 }
2355
2357 template<typename F>
2358 void forEach(const F &f)
2359 {
2360 f(m_color);
2361 }
2362
2364 bool operator==(const Processing &other) const;
2365
2367 bool operator!=(const Processing &other) const;
2368
2370 std::string toString() const;
2371
2373 friend std::ostream &operator<<(std::ostream &stream, const Processing &value)
2374 {
2375 return stream << value.toString();
2376 }
2377
2378 private:
2379 void setFromString(const std::string &value);
2380
2381 void setFromString(const std::string &fullPath, const std::string &value);
2382
2383 std::string getString(const std::string &fullPath) const;
2384
2385 Color m_color;
2386
2387 friend struct DataModel::Detail::Befriend<Processing>;
2388 };
2389
2392
2393 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
2395 {
2396 public:
2398 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
2399
2401 static constexpr const char *path{ "Sampling" };
2402
2404 static constexpr const char *name{ "Sampling" };
2405
2407 static constexpr const char *description{ R"description(Sampling settings.
2408)description" };
2409
2412
2413 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
2415 {
2416 public:
2418 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
2419
2421 static constexpr const char *path{ "Sampling/Pixel" };
2422
2424 static constexpr const char *name{ "Pixel" };
2425
2427 static constexpr const char *description{
2428 R"description(Use this setting to obtain an image that matches a point cloud captured with the equivalent sampling setting.
2429)description"
2430 };
2431
2433 enum class ValueType
2434 {
2435 all,
2436 blueSubsample2x2,
2437 redSubsample2x2,
2438 blueSubsample4x4,
2439 redSubsample4x4
2440 };
2441 static const Pixel all;
2443 static const Pixel redSubsample2x2;
2445 static const Pixel redSubsample4x4;
2446
2448 static std::set<ValueType> validValues()
2449 {
2450 return { ValueType::all,
2451 ValueType::blueSubsample2x2,
2452 ValueType::redSubsample2x2,
2453 ValueType::blueSubsample4x4,
2454 ValueType::redSubsample4x4 };
2455 }
2456
2458 Pixel() = default;
2459
2461 explicit constexpr Pixel(ValueType value)
2462 : m_opt{ verifyValue(value) }
2463 {}
2464
2470
2472 bool hasValue() const;
2473
2475 void reset();
2476
2478 std::string toString() const;
2479
2481 friend std::ostream &operator<<(std::ostream &stream, const Pixel::ValueType &value)
2482 {
2483 return stream << Pixel{ value }.toString();
2484 }
2485
2487 bool operator==(const Pixel &other) const
2488 {
2489 return m_opt == other.m_opt;
2490 }
2491
2493 bool operator!=(const Pixel &other) const
2494 {
2495 return m_opt != other.m_opt;
2496 }
2497
2499 friend std::ostream &operator<<(std::ostream &stream, const Pixel &value)
2500 {
2501 return stream << value.toString();
2502 }
2503
2504 private:
2505 void setFromString(const std::string &value);
2506
2507 constexpr ValueType static verifyValue(const ValueType &value)
2508 {
2509 return value == ValueType::all || value == ValueType::blueSubsample2x2
2510 || value == ValueType::redSubsample2x2 || value == ValueType::blueSubsample4x4
2511 || value == ValueType::redSubsample4x4
2512 ? value
2513 : throw std::invalid_argument{
2514 "Invalid value: Pixel{ "
2515 + std::to_string(static_cast<std::underlying_type<ValueType>::type>(value)) + " }"
2516 };
2517 }
2518
2519 Zivid::DataModel::Detail::Optional<ValueType> m_opt;
2520
2521 friend struct DataModel::Detail::Befriend<Pixel>;
2522 };
2523
2524 using Descendants = std::tuple<Settings2D::Sampling::Pixel>;
2525
2528
2540#ifndef NO_DOC
2541 template<
2542 typename... Args,
2543 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
2544 typename std::enable_if<
2545 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
2546 value,
2547 int>::type = 0>
2548#else
2549 template<typename... Args>
2550#endif
2551 explicit Sampling(Args &&...args)
2552 {
2553 using namespace Zivid::Detail::TypeTraits;
2554
2555 static_assert(
2556 AllArgsDecayedAreUnique<Args...>::value,
2557 "Found duplicate types among the arguments passed to Sampling(...). "
2558 "Types should be listed at most once.");
2559
2560 set(std::forward<Args>(args)...);
2561 }
2562
2573#ifndef NO_DOC
2574 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
2575#else
2576 template<typename... Args>
2577#endif
2578 void set(Args &&...args)
2579 {
2580 using namespace Zivid::Detail::TypeTraits;
2581
2582 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2583 static_assert(
2584 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
2585
2586 static_assert(
2587 AllArgsDecayedAreUnique<Args...>::value,
2588 "Found duplicate types among the arguments passed to set(...). "
2589 "Types should be listed at most once.");
2590
2591 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
2592 }
2593
2605#ifndef NO_DOC
2606 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
2607#else
2608 template<typename... Args>
2609#endif
2610 Sampling copyWith(Args &&...args) const
2611 {
2612 using namespace Zivid::Detail::TypeTraits;
2613
2614 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2615 static_assert(
2616 AllArgsAreDescendantNodes::value,
2617 "All arguments passed to copyWith(...) must be descendant nodes.");
2618
2619 static_assert(
2620 AllArgsDecayedAreUnique<Args...>::value,
2621 "Found duplicate types among the arguments passed to copyWith(...). "
2622 "Types should be listed at most once.");
2623
2624 auto copy{ *this };
2625 copy.set(std::forward<Args>(args)...);
2626 return copy;
2627 }
2628
2630 const Pixel &pixel() const
2631 {
2632 return m_pixel;
2633 }
2634
2637 {
2638 return m_pixel;
2639 }
2640
2642 Sampling &set(const Pixel &value)
2643 {
2644 m_pixel = value;
2645 return *this;
2646 }
2647
2648 template<
2649 typename T,
2650 typename std::enable_if<std::is_same<T, Settings2D::Sampling::Pixel>::value, int>::type = 0>
2652 {
2653 return m_pixel;
2654 }
2655
2656 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2658 {
2659 return m_pixel;
2660 }
2661
2663 template<typename F>
2664 void forEach(const F &f) const
2665 {
2666 f(m_pixel);
2667 }
2668
2670 template<typename F>
2671 void forEach(const F &f)
2672 {
2673 f(m_pixel);
2674 }
2675
2677 bool operator==(const Sampling &other) const;
2678
2680 bool operator!=(const Sampling &other) const;
2681
2683 std::string toString() const;
2684
2686 friend std::ostream &operator<<(std::ostream &stream, const Sampling &value)
2687 {
2688 return stream << value.toString();
2689 }
2690
2691 private:
2692 void setFromString(const std::string &value);
2693
2694 void setFromString(const std::string &fullPath, const std::string &value);
2695
2696 std::string getString(const std::string &fullPath) const;
2697
2698 Pixel m_pixel;
2699
2700 friend struct DataModel::Detail::Befriend<Sampling>;
2701 };
2702
2703 using Descendants = std::tuple<
2714
2717
2719 explicit Settings2D(const std::string &fileName);
2720
2741#ifndef NO_DOC
2742 template<
2743 typename... Args,
2744 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
2745 typename std::enable_if<
2746 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
2747 int>::type = 0>
2748#else
2749 template<typename... Args>
2750#endif
2751 explicit Settings2D(Args &&...args)
2752 {
2753 using namespace Zivid::Detail::TypeTraits;
2754
2755 static_assert(
2756 AllArgsDecayedAreUnique<Args...>::value,
2757 "Found duplicate types among the arguments passed to Settings2D(...). "
2758 "Types should be listed at most once.");
2759
2760 set(std::forward<Args>(args)...);
2761 }
2762
2782#ifndef NO_DOC
2783 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
2784#else
2785 template<typename... Args>
2786#endif
2787 void set(Args &&...args)
2788 {
2789 using namespace Zivid::Detail::TypeTraits;
2790
2791 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2792 static_assert(
2793 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
2794
2795 static_assert(
2796 AllArgsDecayedAreUnique<Args...>::value,
2797 "Found duplicate types among the arguments passed to set(...). "
2798 "Types should be listed at most once.");
2799
2800 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
2801 }
2802
2823#ifndef NO_DOC
2824 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
2825#else
2826 template<typename... Args>
2827#endif
2828 Settings2D copyWith(Args &&...args) const
2829 {
2830 using namespace Zivid::Detail::TypeTraits;
2831
2832 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2833 static_assert(
2834 AllArgsAreDescendantNodes::value, "All arguments passed to copyWith(...) must be descendant nodes.");
2835
2836 static_assert(
2837 AllArgsDecayedAreUnique<Args...>::value,
2838 "Found duplicate types among the arguments passed to copyWith(...). "
2839 "Types should be listed at most once.");
2840
2841 auto copy{ *this };
2842 copy.set(std::forward<Args>(args)...);
2843 return copy;
2844 }
2845
2848 {
2849 return m_acquisitions;
2850 }
2851
2854 {
2855 return m_acquisitions;
2856 }
2857
2860 {
2861 m_acquisitions = value;
2862 return *this;
2863 }
2864
2866 const Processing &processing() const
2867 {
2868 return m_processing;
2869 }
2870
2873 {
2874 return m_processing;
2875 }
2876
2879 {
2880 m_processing = value;
2881 return *this;
2882 }
2883
2886 {
2887 m_processing.set(value);
2888 return *this;
2889 }
2890
2893 {
2894 m_processing.set(value);
2895 return *this;
2896 }
2897
2900 {
2901 m_processing.set(value);
2902 return *this;
2903 }
2904
2907 {
2908 m_processing.set(value);
2909 return *this;
2910 }
2911
2914 {
2915 m_processing.set(value);
2916 return *this;
2917 }
2918
2921 {
2922 m_processing.set(value);
2923 return *this;
2924 }
2925
2927 const Sampling &sampling() const
2928 {
2929 return m_sampling;
2930 }
2931
2934 {
2935 return m_sampling;
2936 }
2937
2939 Settings2D &set(const Sampling &value)
2940 {
2941 m_sampling = value;
2942 return *this;
2943 }
2944
2947 {
2948 m_sampling.set(value);
2949 return *this;
2950 }
2951
2952 template<typename T, typename std::enable_if<std::is_same<T, Settings2D::Acquisitions>::value, int>::type = 0>
2954 {
2955 return m_acquisitions;
2956 }
2957
2958 template<typename T, typename std::enable_if<std::is_same<T, Settings2D::Processing>::value, int>::type = 0>
2960 {
2961 return m_processing;
2962 }
2963
2964 template<
2965 typename T,
2966 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color>::value, int>::type = 0>
2968 {
2969 return m_processing.get<Settings2D::Processing::Color>();
2970 }
2971
2972 template<
2973 typename T,
2974 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance>::value, int>::type = 0>
2976 {
2977 return m_processing.get<Settings2D::Processing::Color::Balance>();
2978 }
2979
2980 template<
2981 typename T,
2982 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value, int>::type =
2983 0>
2985 {
2986 return m_processing.get<Settings2D::Processing::Color::Balance::Blue>();
2987 }
2988
2989 template<
2990 typename T,
2991 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value, int>::type =
2992 0>
2994 {
2995 return m_processing.get<Settings2D::Processing::Color::Balance::Green>();
2996 }
2997
2998 template<
2999 typename T,
3000 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value, int>::type = 0>
3002 {
3003 return m_processing.get<Settings2D::Processing::Color::Balance::Red>();
3004 }
3005
3006 template<
3007 typename T,
3008 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Gamma>::value, int>::type = 0>
3010 {
3011 return m_processing.get<Settings2D::Processing::Color::Gamma>();
3012 }
3013
3014 template<typename T, typename std::enable_if<std::is_same<T, Settings2D::Sampling>::value, int>::type = 0>
3016 {
3017 return m_sampling;
3018 }
3019
3020 template<
3021 typename T,
3022 typename std::enable_if<std::is_same<T, Settings2D::Sampling::Pixel>::value, int>::type = 0>
3024 {
3025 return m_sampling.get<Settings2D::Sampling::Pixel>();
3026 }
3027
3028 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
3030 {
3031 return m_acquisitions;
3032 }
3033
3034 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
3036 {
3037 return m_processing;
3038 }
3039
3040 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
3042 {
3043 return m_sampling;
3044 }
3045
3047 template<typename F>
3048 void forEach(const F &f) const
3049 {
3050 f(m_acquisitions);
3051 f(m_processing);
3052 f(m_sampling);
3053 }
3054
3056 template<typename F>
3057 void forEach(const F &f)
3058 {
3059 f(m_acquisitions);
3060 f(m_processing);
3061 f(m_sampling);
3062 }
3063
3065 bool operator==(const Settings2D &other) const;
3066
3068 bool operator!=(const Settings2D &other) const;
3069
3071 std::string toString() const;
3072
3074 friend std::ostream &operator<<(std::ostream &stream, const Settings2D &value)
3075 {
3076 return stream << value.toString();
3077 }
3078
3080 void save(const std::string &fileName) const;
3081
3083 void load(const std::string &fileName);
3084
3085 private:
3086 void setFromString(const std::string &value);
3087
3088 void setFromString(const std::string &fullPath, const std::string &value);
3089
3090 std::string getString(const std::string &fullPath) const;
3091
3092 Acquisitions m_acquisitions;
3093 Processing m_processing;
3094 Sampling m_sampling;
3095
3096 friend struct DataModel::Detail::Befriend<Settings2D>;
3097 };
3098
3099#ifndef NO_DOC
3101 namespace Detail
3102 {
3103 ZIVID_CORE_EXPORT void save(const Settings2D &dataModel, std::ostream &ostream);
3104 ZIVID_CORE_EXPORT void load(Settings2D &dataModel, std::istream &istream);
3105 } // namespace Detail
3106#endif
3107
3108#ifndef NO_DOC
3109 template<>
3110 struct Settings2D::Version<4>
3111 {
3112 using Type = Settings2D;
3113 };
3114#endif
3115
3116} // namespace Zivid
3117
3118#ifdef _MSC_VER
3119# pragma warning(pop)
3120#endif
3121
3122#ifndef NO_DOC
3123# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
3124namespace std // NOLINT
3125{
3126
3127 template<>
3128 struct tuple_size<Zivid::Settings2D::Processing> : integral_constant<size_t, 1>
3129 {};
3130
3131 template<size_t i>
3132 struct tuple_element<i, Zivid::Settings2D::Processing>
3133 {
3134 static_assert(i < tuple_size<Zivid::Settings2D::Processing>::value, "Index must be less than 1");
3135
3136 using type // NOLINT
3137 = decltype(declval<Zivid::Settings2D::Processing>().get<i>());
3138 };
3139
3140 template<>
3141 struct tuple_size<Zivid::Settings2D::Processing::Color> : integral_constant<size_t, 2>
3142 {};
3143
3144 template<size_t i>
3145 struct tuple_element<i, Zivid::Settings2D::Processing::Color>
3146 {
3147 static_assert(i < tuple_size<Zivid::Settings2D::Processing::Color>::value, "Index must be less than 2");
3148
3149 using type // NOLINT
3150 = decltype(declval<Zivid::Settings2D::Processing::Color>().get<i>());
3151 };
3152
3153 template<>
3154 struct tuple_size<Zivid::Settings2D::Processing::Color::Balance> : integral_constant<size_t, 3>
3155 {};
3156
3157 template<size_t i>
3158 struct tuple_element<i, Zivid::Settings2D::Processing::Color::Balance>
3159 {
3160 static_assert(
3161 i < tuple_size<Zivid::Settings2D::Processing::Color::Balance>::value,
3162 "Index must be less than 3");
3163
3164 using type // NOLINT
3165 = decltype(declval<Zivid::Settings2D::Processing::Color::Balance>().get<i>());
3166 };
3167
3168 template<>
3169 struct tuple_size<Zivid::Settings2D::Sampling> : integral_constant<size_t, 1>
3170 {};
3171
3172 template<size_t i>
3173 struct tuple_element<i, Zivid::Settings2D::Sampling>
3174 {
3175 static_assert(i < tuple_size<Zivid::Settings2D::Sampling>::value, "Index must be less than 1");
3176
3177 using type // NOLINT
3178 = decltype(declval<Zivid::Settings2D::Sampling>().get<i>());
3179 };
3180
3181 template<>
3182 struct tuple_size<Zivid::Settings2D> : integral_constant<size_t, 3>
3183 {};
3184
3185 template<size_t i>
3186 struct tuple_element<i, Zivid::Settings2D>
3187 {
3188 static_assert(i < tuple_size<Zivid::Settings2D>::value, "Index must be less than 3");
3189
3190 using type // NOLINT
3191 = decltype(declval<Zivid::Settings2D>().get<i>());
3192 };
3193
3194} // namespace std
3195# endif
3196#endif
3197
3198// If we have access to the DataModel library, automatically include internal DataModel
3199// header. This header is necessary for serialization and deserialization.
3200#if defined(__has_include) && !defined(NO_DOC)
3201# if __has_include("Zivid/Settings2DInternal.h") && __has_include("Zivid/DataModelNodeMetaData.h")
3202# include "Zivid/Settings2DInternal.h"
3203# endif
3204#endif
#define ZIVID_CORE_EXPORT
Definition CoreExport.h:56
Class describing a range of values for a given type T.
Definition Range.h:73
Aperture setting for the camera. Specified as an f-number (the ratio of lens focal length to the effe...
Definition Settings2D.h:132
void reset()
Reset the node to unset state.
bool operator!=(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:189
friend std::ostream & operator<<(std::ostream &stream, const Aperture &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:219
bool operator<(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:195
constexpr Aperture(double value)
Constructor.
Definition Settings2D.h:163
static constexpr Range< double > validRange()
The range of valid values for Aperture.
Definition Settings2D.h:154
bool operator>=(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:213
bool operator<=(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:207
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:201
Aperture()=default
Default constructor.
double ValueType
The type of the underlying value.
Definition Settings2D.h:151
bool operator==(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:183
bool hasValue() const
Check if the value is set.
Brightness controls the light output from the projector.
Definition Settings2D.h:255
bool operator==(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:314
bool operator<=(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:338
bool operator>(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:332
bool operator<(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:326
static constexpr Range< double > validRange()
The range of valid values for Brightness.
Definition Settings2D.h:285
constexpr Brightness(double value)
Constructor.
Definition Settings2D.h:294
std::string toString() const
Get the value as string.
bool operator!=(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:320
bool operator>=(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:344
friend std::ostream & operator<<(std::ostream &stream, const Brightness &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:350
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:282
Exposure time for the image.
Definition Settings2D.h:376
bool operator>(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:441
std::chrono::microseconds ValueType
The type of the underlying value.
Definition Settings2D.h:391
bool operator>=(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:453
void reset()
Reset the node to unset state.
constexpr ExposureTime(std::chrono::microseconds value)
Constructor.
Definition Settings2D.h:403
std::chrono::microseconds value() const
Get the value.
bool operator<(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:435
bool operator<=(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:447
static constexpr Range< std::chrono::microseconds > validRange()
The range of valid values for ExposureTime.
Definition Settings2D.h:394
bool operator!=(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:429
std::string toString() const
Get the value as string.
ExposureTime()=default
Default constructor.
bool operator==(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:423
friend std::ostream & operator<<(std::ostream &stream, const ExposureTime &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:459
bool hasValue() const
Check if the value is set.
Analog gain in the camera.
Definition Settings2D.h:486
bool operator>(const Gain &other) const
Comparison operator.
Definition Settings2D.h:551
bool operator!=(const Gain &other) const
Comparison operator.
Definition Settings2D.h:539
bool operator==(const Gain &other) const
Comparison operator.
Definition Settings2D.h:533
friend std::ostream & operator<<(std::ostream &stream, const Gain &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:569
double ValueType
The type of the underlying value.
Definition Settings2D.h:501
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:513
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:563
bool operator<=(const Gain &other) const
Comparison operator.
Definition Settings2D.h:557
static constexpr Range< double > validRange()
The range of valid values for Gain.
Definition Settings2D.h:504
bool operator<(const Gain &other) const
Comparison operator.
Definition Settings2D.h:545
Settings for a single acquisition.
Definition Settings2D.h:112
const Settings2D::Acquisition::Gain & get() const
Definition Settings2D.h:812
const ExposureTime & exposureTime() const
Get ExposureTime.
Definition Settings2D.h:748
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:843
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:853
const Settings2D::Acquisition::Aperture & get() const
Definition Settings2D.h:788
ExposureTime & exposureTime()
Get ExposureTime.
Definition Settings2D.h:754
friend std::ostream & operator<<(std::ostream &stream, const Acquisition &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:871
bool operator!=(const Acquisition &other) const
Inequality operator.
Acquisition & set(const Gain &value)
Set Gain.
Definition Settings2D.h:779
std::string toString() const
Get the value as string.
Acquisition & set(const Aperture &value)
Set Aperture.
Definition Settings2D.h:722
Gain & gain()
Get Gain.
Definition Settings2D.h:773
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:690
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:655
const Settings2D::Acquisition::ExposureTime & get() const
Definition Settings2D.h:804
Acquisition()
Default constructor.
Aperture & aperture()
Get Aperture.
Definition Settings2D.h:716
const Aperture & aperture() const
Get Aperture.
Definition Settings2D.h:710
Acquisition & set(const Brightness &value)
Set Brightness.
Definition Settings2D.h:741
const Brightness & brightness() const
Get Brightness.
Definition Settings2D.h:729
Brightness & brightness()
Get Brightness.
Definition Settings2D.h:735
std::tuple< Settings2D::Acquisition::Aperture, Settings2D::Acquisition::Brightness, Settings2D::Acquisition::ExposureTime, Settings2D::Acquisition::Gain > Descendants
Definition Settings2D.h:591
const Gain & gain() const
Get Gain.
Definition Settings2D.h:767
const Settings2D::Acquisition::Brightness & get() const
Definition Settings2D.h:796
Acquisition & set(const ExposureTime &value)
Set ExposureTime.
Definition Settings2D.h:760
List of acquisitions. Note that the Zivid SDK only supports a single acquisition per capture in 2D mo...
Definition Settings2D.h:895
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:915
Acquisitions(std::initializer_list< Settings2D::Acquisition > value)
Constructor.
Definition Settings2D.h:929
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:924
void forEach(const F &f)
Run the given function on each element in the list.
Definition Settings2D.h:986
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:996
std::vector< Settings2D::Acquisition > ValueType
The type of the underlying value.
Definition Settings2D.h:912
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:1041
std::vector< Settings2D::Acquisition >::iterator Iterator
Iterator type for Acquisitions.
Definition Settings2D.h:1005
std::vector< Settings2D::Acquisition >::const_iterator ConstIterator
Constant iterator type for Acquisitions.
Definition Settings2D.h:1014
std::size_t size() const noexcept
Get the size of the list.
bool operator!=(const Acquisitions &other) const
Comparison operator.
Definition Settings2D.h:1035
Acquisitions()=default
Default constructor.
const std::vector< Settings2D::Acquisition > & value() const
Get the value.
Digital gain applied to blue channel.
Definition Settings2D.h:1112
friend std::ostream & operator<<(std::ostream &stream, const Blue &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:1197
bool operator<=(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1185
bool operator==(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1161
void reset()
Reset the node to unset state.
double ValueType
The type of the underlying value.
Definition Settings2D.h:1129
bool operator>(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1179
std::string toString() const
Get the value as string.
constexpr Blue(double value)
Constructor.
Definition Settings2D.h:1141
bool operator!=(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1167
bool hasValue() const
Check if the value is set.
static constexpr Range< double > validRange()
The range of valid values for Blue.
Definition Settings2D.h:1132
bool operator<(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1173
bool operator>=(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1191
Digital gain applied to green channel.
Definition Settings2D.h:1224
double ValueType
The type of the underlying value.
Definition Settings2D.h:1241
static constexpr Range< double > validRange()
The range of valid values for Green.
Definition Settings2D.h:1244
bool operator==(const Green &other) const
Comparison operator.
Definition Settings2D.h:1273
std::string toString() const
Get the value as string.
constexpr Green(double value)
Constructor.
Definition Settings2D.h:1253
friend std::ostream & operator<<(std::ostream &stream, const Green &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:1309
bool operator<(const Green &other) const
Comparison operator.
Definition Settings2D.h:1285
bool hasValue() const
Check if the value is set.
bool operator<=(const Green &other) const
Comparison operator.
Definition Settings2D.h:1297
bool operator>=(const Green &other) const
Comparison operator.
Definition Settings2D.h:1303
bool operator!=(const Green &other) const
Comparison operator.
Definition Settings2D.h:1279
bool operator>(const Green &other) const
Comparison operator.
Definition Settings2D.h:1291
void reset()
Reset the node to unset state.
Digital gain applied to red channel.
Definition Settings2D.h:1336
double ValueType
The type of the underlying value.
Definition Settings2D.h:1353
friend std::ostream & operator<<(std::ostream &stream, const Red &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:1421
bool operator>=(const Red &other) const
Comparison operator.
Definition Settings2D.h:1415
bool operator<(const Red &other) const
Comparison operator.
Definition Settings2D.h:1397
bool operator<=(const Red &other) const
Comparison operator.
Definition Settings2D.h:1409
std::string toString() const
Get the value as string.
static constexpr Range< double > validRange()
The range of valid values for Red.
Definition Settings2D.h:1356
bool hasValue() const
Check if the value is set.
bool operator!=(const Red &other) const
Comparison operator.
Definition Settings2D.h:1391
constexpr Red(double value)
Constructor.
Definition Settings2D.h:1365
bool operator==(const Red &other) const
Comparison operator.
Definition Settings2D.h:1385
void reset()
Reset the node to unset state.
bool operator>(const Red &other) const
Comparison operator.
Definition Settings2D.h:1403
Color balance settings.
Definition Settings2D.h:1094
const Settings2D::Processing::Color::Balance::Red & get() const
Definition Settings2D.h:1643
Blue & blue()
Get Blue.
Definition Settings2D.h:1568
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:1677
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:1668
std::tuple< Settings2D::Processing::Color::Balance::Blue, Settings2D::Processing::Color::Balance::Green, Settings2D::Processing::Color::Balance::Red > Descendants
Definition Settings2D.h:1444
const Blue & blue() const
Get Blue.
Definition Settings2D.h:1562
bool operator==(const Balance &other) const
Equality operator.
Balance & set(const Blue &value)
Set Blue.
Definition Settings2D.h:1574
Red & red()
Get Red.
Definition Settings2D.h:1606
Green & green()
Get Green.
Definition Settings2D.h:1587
Balance & set(const Green &value)
Set Green.
Definition Settings2D.h:1593
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:1541
const Green & green() const
Get Green.
Definition Settings2D.h:1581
Balance & set(const Red &value)
Set Red.
Definition Settings2D.h:1612
const Settings2D::Processing::Color::Balance::Green & get() const
Definition Settings2D.h:1633
const Red & red() const
Get Red.
Definition Settings2D.h:1600
std::string toString() const
Get the value as string.
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:1505
friend std::ostream & operator<<(std::ostream &stream, const Balance &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:1694
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition Settings2D.h:1623
Gamma applied to the color values. Gamma less than 1 makes the colors brighter, while gamma greater t...
Definition Settings2D.h:1719
double ValueType
The type of the underlying value.
Definition Settings2D.h:1738
static constexpr Range< double > validRange()
The range of valid values for Gamma.
Definition Settings2D.h:1741
bool operator>(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:1788
bool operator==(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:1770
friend std::ostream & operator<<(std::ostream &stream, const Gamma &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:1806
bool operator!=(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:1776
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:1782
void reset()
Reset the node to unset state.
bool operator>=(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:1800
constexpr Gamma(double value)
Constructor.
Definition Settings2D.h:1750
Gamma()=default
Default constructor.
bool operator<=(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:1794
double value() const
Get the value.
Color settings.
Definition Settings2D.h:1076
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:1895
Color & set(const Balance::Green &value)
Set Balance::Green.
Definition Settings2D.h:1979
bool operator!=(const Color &other) const
Inequality operator.
bool operator==(const Color &other) const
Equality operator.
std::string toString() const
Get the value as string.
const Balance & balance() const
Get Balance.
Definition Settings2D.h:1953
Color & set(const Balance::Blue &value)
Set Balance::Blue.
Definition Settings2D.h:1972
Balance & balance()
Get Balance.
Definition Settings2D.h:1959
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:2070
friend std::ostream & operator<<(std::ostream &stream, const Color &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:2094
const Settings2D::Processing::Color::Gamma & get() const
Definition Settings2D.h:2051
std::tuple< Settings2D::Processing::Color::Balance, Settings2D::Processing::Color::Balance::Blue, Settings2D::Processing::Color::Balance::Green, Settings2D::Processing::Color::Balance::Red, Settings2D::Processing::Color::Gamma > Descendants
Definition Settings2D.h:1828
const Settings2D::Processing::Color::Balance::Green & get() const
Definition Settings2D.h:2033
Gamma & gamma()
Get Gamma.
Definition Settings2D.h:1999
const Settings2D::Processing::Color::Balance::Red & get() const
Definition Settings2D.h:2042
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:1932
const Settings2D::Processing::Color::Balance & get() const
Definition Settings2D.h:2015
const Gamma & gamma() const
Get Gamma.
Definition Settings2D.h:1993
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition Settings2D.h:2024
Color & set(const Balance &value)
Set Balance.
Definition Settings2D.h:1965
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:2078
Color & set(const Gamma &value)
Set Gamma.
Definition Settings2D.h:2005
Color & set(const Balance::Red &value)
Set Balance::Red.
Definition Settings2D.h:1986
Processing related settings.
Definition Settings2D.h:1058
const Settings2D::Processing::Color & get() const
Definition Settings2D.h:2295
Processing & set(const Color::Gamma &value)
Set Color::Gamma.
Definition Settings2D.h:2286
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:2251
const Settings2D::Processing::Color::Balance & get() const
Definition Settings2D.h:2303
friend std::ostream & operator<<(std::ostream &stream, const Processing &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:2373
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:2351
Color & color()
Get Color.
Definition Settings2D.h:2245
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:2182
Processing & set(const Color::Balance::Blue &value)
Set Color::Balance::Blue.
Definition Settings2D.h:2265
Processing & set(const Color::Balance &value)
Set Color::Balance.
Definition Settings2D.h:2258
const Color & color() const
Get Color.
Definition Settings2D.h:2239
Processing & set(const Color::Balance::Red &value)
Set Color::Balance::Red.
Definition Settings2D.h:2279
const Settings2D::Processing::Color::Gamma & get() const
Definition Settings2D.h:2338
const Settings2D::Processing::Color::Balance::Red & get() const
Definition Settings2D.h:2330
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:2219
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition Settings2D.h:2312
const Settings2D::Processing::Color::Balance::Green & get() const
Definition Settings2D.h:2321
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:2358
Processing()
Default constructor.
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::Gamma > Descendants
Definition Settings2D.h:2112
Processing & set(const Color::Balance::Green &value)
Set Color::Balance::Green.
Definition Settings2D.h:2272
Use this setting to obtain an image that matches a point cloud captured with the equivalent sampling ...
Definition Settings2D.h:2415
static const Pixel redSubsample4x4
redSubsample4x4
Definition Settings2D.h:2445
Pixel()=default
Default constructor.
constexpr Pixel(ValueType value)
Constructor.
Definition Settings2D.h:2461
ValueType
The type of the underlying value.
Definition Settings2D.h:2434
bool operator!=(const Pixel &other) const
Comparison operator.
Definition Settings2D.h:2493
ValueType value() const
Get the value.
bool operator==(const Pixel &other) const
Comparison operator.
Definition Settings2D.h:2487
static const Pixel redSubsample2x2
redSubsample2x2
Definition Settings2D.h:2443
static const Pixel all
all
Definition Settings2D.h:2441
static std::set< ValueType > validValues()
All valid values of Pixel.
Definition Settings2D.h:2448
std::string toString() const
Get the value as string.
static const Pixel blueSubsample2x2
blueSubsample2x2
Definition Settings2D.h:2442
friend std::ostream & operator<<(std::ostream &stream, const Pixel::ValueType &value)
Operator to serialize ValueType to a stream.
Definition Settings2D.h:2481
friend std::ostream & operator<<(std::ostream &stream, const Pixel &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:2499
void reset()
Reset the node to unset state.
static const Pixel blueSubsample4x4
blueSubsample4x4
Definition Settings2D.h:2444
bool hasValue() const
Check if the value is set.
Sampling settings.
Definition Settings2D.h:2395
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:2671
bool operator==(const Sampling &other) const
Equality operator.
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:2578
const Settings2D::Sampling::Pixel & get() const
Definition Settings2D.h:2651
Sampling & set(const Pixel &value)
Set Pixel.
Definition Settings2D.h:2642
const Pixel & pixel() const
Get Pixel.
Definition Settings2D.h:2630
Pixel & pixel()
Get Pixel.
Definition Settings2D.h:2636
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:2664
std::tuple< Settings2D::Sampling::Pixel > Descendants
Definition Settings2D.h:2524
friend std::ostream & operator<<(std::ostream &stream, const Sampling &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:2686
bool operator!=(const Sampling &other) const
Inequality operator.
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:2610
Sampling()
Default constructor.
Settings used when capturing 2D images with a Zivid camera.
Definition Settings2D.h:78
Settings2D & set(const Processing &value)
Set Processing.
Definition Settings2D.h:2878
const Settings2D::Sampling::Pixel & get() const
Definition Settings2D.h:3023
const Settings2D::Processing::Color & get() const
Definition Settings2D.h:2967
Sampling & sampling()
Get Sampling.
Definition Settings2D.h:2933
const Settings2D::Processing::Color::Balance::Red & get() const
Definition Settings2D.h:3001
const Settings2D::Processing::Color::Balance::Green & get() const
Definition Settings2D.h:2993
void save(const std::string &fileName) const
Save to the given file.
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition Settings2D.h:2984
const Acquisitions & acquisitions() const
Get Acquisitions.
Definition Settings2D.h:2847
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:3057
Settings2D & set(const Sampling &value)
Set Sampling.
Definition Settings2D.h:2939
Settings2D(Args &&...args)
Constructor taking variadic number of arguments.
Definition Settings2D.h:2751
const Settings2D::Acquisitions & get() const
Definition Settings2D.h:2953
Settings2D()
Default constructor.
const Settings2D::Processing::Color::Gamma & get() const
Definition Settings2D.h:3009
Settings2D & set(const Acquisitions &value)
Set Acquisitions.
Definition Settings2D.h:2859
Settings2D(const std::string &fileName)
Construct Settings2D by loading from file.
const Settings2D::Sampling & get() const
Definition Settings2D.h:3015
void load(const std::string &fileName)
Load from the given file.
const Settings2D::Processing::Color::Balance & get() const
Definition Settings2D.h:2975
Settings2D & set(const Processing::Color::Balance::Green &value)
Set Processing::Color::Balance::Green.
Definition Settings2D.h:2906
bool operator!=(const Settings2D &other) const
Inequality operator.
Settings2D & set(const Processing::Color::Balance &value)
Set Processing::Color::Balance.
Definition Settings2D.h:2892
const Settings2D::Processing & get() const
Definition Settings2D.h:2959
Settings2D & set(const Processing::Color::Balance::Red &value)
Set Processing::Color::Balance::Red.
Definition Settings2D.h:2913
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:2787
Processing & processing()
Get Processing.
Definition Settings2D.h:2872
const Processing & processing() const
Get Processing.
Definition Settings2D.h:2866
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::Gamma, Settings2D::Sampling, Settings2D::Sampling::Pixel > Descendants
Definition Settings2D.h:2703
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:2828
Settings2D & set(const Processing::Color::Balance::Blue &value)
Set Processing::Color::Balance::Blue.
Definition Settings2D.h:2899
Acquisitions & acquisitions()
Get Acquisitions.
Definition Settings2D.h:2853
std::string toString() const
Get the value as string.
Settings2D & set(const Sampling::Pixel &value)
Set Sampling::Pixel.
Definition Settings2D.h:2946
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:3048
bool operator==(const Settings2D &other) const
Equality operator.
const Sampling & sampling() const
Get Sampling.
Definition Settings2D.h:2927
friend std::ostream & operator<<(std::ostream &stream, const Settings2D &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:3074
Settings2D & set(const Processing::Color &value)
Set Processing::Color.
Definition Settings2D.h:2885
Settings2D & set(const Processing::Color::Gamma &value)
Set Processing::Color::Gamma.
Definition Settings2D.h:2920
NodeType
Definition NodeType.h:55
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:54