Zivid C++ API 2.14.0+e4a0c4a9-1
CameraIntrinsics.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{ "CameraIntrinsics" };
88
90 static constexpr const char *description{
91 R"description(Information about the intrinsic parameters of the camera (OpenCV model))description"
92 };
93
94 static constexpr size_t version{ 1 };
95
96#ifndef NO_DOC
97 template<size_t>
98 struct Version;
99
100 using LatestVersion = Zivid::CameraIntrinsics;
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{ 'c', 'i', 'n' };
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{ "CameraMatrix" };
119
121 static constexpr const char *name{ "CameraMatrix" };
122
124 static constexpr const char *description{
125 R"description(The camera matrix K (=[fx,0,cx;0,fy,cy;0,0,1]))description"
126 };
127
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{ "CameraMatrix/CX" };
139
141 static constexpr const char *name{ "CX" };
142
144 static constexpr const char *description{
145 R"description(x coordinate of the principal point)description"
146 };
147
149 using ValueType = double;
150
152 static constexpr Range<double> validRange()
153 {
154 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
155 }
156
158 CX() = default;
159
161 explicit constexpr CX(double value)
162 : m_value{ value }
163 {}
164
166 double value() const;
167
169 std::string toString() const;
170
172 bool operator==(const CX &other) const
173 {
174 return m_value == other.m_value;
175 }
176
178 bool operator!=(const CX &other) const
179 {
180 return m_value != other.m_value;
181 }
182
184 bool operator<(const CX &other) const
185 {
186 return m_value < other.m_value;
187 }
188
190 bool operator>(const CX &other) const
191 {
192 return m_value > other.m_value;
193 }
194
196 bool operator<=(const CX &other) const
197 {
198 return m_value <= other.m_value;
199 }
200
202 bool operator>=(const CX &other) const
203 {
204 return m_value >= other.m_value;
205 }
206
208 friend std::ostream &operator<<(std::ostream &stream, const CX &value)
209 {
210 return stream << value.toString();
211 }
212
213 private:
214 void setFromString(const std::string &value);
215
216 double m_value{ 0.0 };
217
218 friend struct DataModel::Detail::Befriend<CX>;
219 };
220
222
223 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
225 {
226 public:
228 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
229
231 static constexpr const char *path{ "CameraMatrix/CY" };
232
234 static constexpr const char *name{ "CY" };
235
237 static constexpr const char *description{
238 R"description(y coordinate of the principal point)description"
239 };
240
242 using ValueType = double;
243
245 static constexpr Range<double> validRange()
246 {
247 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
248 }
249
251 CY() = default;
252
254 explicit constexpr CY(double value)
255 : m_value{ value }
256 {}
257
259 double value() const;
260
262 std::string toString() const;
263
265 bool operator==(const CY &other) const
266 {
267 return m_value == other.m_value;
268 }
269
271 bool operator!=(const CY &other) const
272 {
273 return m_value != other.m_value;
274 }
275
277 bool operator<(const CY &other) const
278 {
279 return m_value < other.m_value;
280 }
281
283 bool operator>(const CY &other) const
284 {
285 return m_value > other.m_value;
286 }
287
289 bool operator<=(const CY &other) const
290 {
291 return m_value <= other.m_value;
292 }
293
295 bool operator>=(const CY &other) const
296 {
297 return m_value >= other.m_value;
298 }
299
301 friend std::ostream &operator<<(std::ostream &stream, const CY &value)
302 {
303 return stream << value.toString();
304 }
305
306 private:
307 void setFromString(const std::string &value);
308
309 double m_value{ 0.0 };
310
311 friend struct DataModel::Detail::Befriend<CY>;
312 };
313
315
316 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
318 {
319 public:
321 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
322
324 static constexpr const char *path{ "CameraMatrix/FX" };
325
327 static constexpr const char *name{ "FX" };
328
330 static constexpr const char *description{ R"description(Focal length in x)description" };
331
333 using ValueType = double;
334
336 static constexpr Range<double> validRange()
337 {
338 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
339 }
340
342 FX() = default;
343
345 explicit constexpr FX(double value)
346 : m_value{ value }
347 {}
348
350 double value() const;
351
353 std::string toString() const;
354
356 bool operator==(const FX &other) const
357 {
358 return m_value == other.m_value;
359 }
360
362 bool operator!=(const FX &other) const
363 {
364 return m_value != other.m_value;
365 }
366
368 bool operator<(const FX &other) const
369 {
370 return m_value < other.m_value;
371 }
372
374 bool operator>(const FX &other) const
375 {
376 return m_value > other.m_value;
377 }
378
380 bool operator<=(const FX &other) const
381 {
382 return m_value <= other.m_value;
383 }
384
386 bool operator>=(const FX &other) const
387 {
388 return m_value >= other.m_value;
389 }
390
392 friend std::ostream &operator<<(std::ostream &stream, const FX &value)
393 {
394 return stream << value.toString();
395 }
396
397 private:
398 void setFromString(const std::string &value);
399
400 double m_value{ 0.0 };
401
402 friend struct DataModel::Detail::Befriend<FX>;
403 };
404
406
407 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
409 {
410 public:
412 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
413
415 static constexpr const char *path{ "CameraMatrix/FY" };
416
418 static constexpr const char *name{ "FY" };
419
421 static constexpr const char *description{ R"description(Focal length in y)description" };
422
424 using ValueType = double;
425
427 static constexpr Range<double> validRange()
428 {
429 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
430 }
431
433 FY() = default;
434
436 explicit constexpr FY(double value)
437 : m_value{ value }
438 {}
439
441 double value() const;
442
444 std::string toString() const;
445
447 bool operator==(const FY &other) const
448 {
449 return m_value == other.m_value;
450 }
451
453 bool operator!=(const FY &other) const
454 {
455 return m_value != other.m_value;
456 }
457
459 bool operator<(const FY &other) const
460 {
461 return m_value < other.m_value;
462 }
463
465 bool operator>(const FY &other) const
466 {
467 return m_value > other.m_value;
468 }
469
471 bool operator<=(const FY &other) const
472 {
473 return m_value <= other.m_value;
474 }
475
477 bool operator>=(const FY &other) const
478 {
479 return m_value >= other.m_value;
480 }
481
483 friend std::ostream &operator<<(std::ostream &stream, const FY &value)
484 {
485 return stream << value.toString();
486 }
487
488 private:
489 void setFromString(const std::string &value);
490
491 double m_value{ 0.0 };
492
493 friend struct DataModel::Detail::Befriend<FY>;
494 };
495
496 using Descendants = std::tuple<
501
504
519#ifndef NO_DOC
520 template<
521 typename... Args,
522 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
523 typename std::enable_if<
524 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
525 value,
526 int>::type = 0>
527#else
528 template<typename... Args>
529#endif
530 explicit CameraMatrix(Args &&...args)
531 {
532 using namespace Zivid::Detail::TypeTraits;
533
534 static_assert(
535 AllArgsDecayedAreUnique<Args...>::value,
536 "Found duplicate types among the arguments passed to CameraMatrix(...). "
537 "Types should be listed at most once.");
538
539 set(std::forward<Args>(args)...);
540 }
541
555#ifndef NO_DOC
556 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
557#else
558 template<typename... Args>
559#endif
560 void set(Args &&...args)
561 {
562 using namespace Zivid::Detail::TypeTraits;
563
564 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
565 static_assert(
566 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
567
568 static_assert(
569 AllArgsDecayedAreUnique<Args...>::value,
570 "Found duplicate types among the arguments passed to set(...). "
571 "Types should be listed at most once.");
572
573 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
574 }
575
590#ifndef NO_DOC
591 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
592#else
593 template<typename... Args>
594#endif
595 CameraMatrix copyWith(Args &&...args) const
596 {
597 using namespace Zivid::Detail::TypeTraits;
598
599 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
600 static_assert(
601 AllArgsAreDescendantNodes::value,
602 "All arguments passed to copyWith(...) must be descendant nodes.");
603
604 static_assert(
605 AllArgsDecayedAreUnique<Args...>::value,
606 "Found duplicate types among the arguments passed to copyWith(...). "
607 "Types should be listed at most once.");
608
609 auto copy{ *this };
610 copy.set(std::forward<Args>(args)...);
611 return copy;
612 }
613
615 const CX &cx() const
616 {
617 return m_cx;
618 }
619
622 {
623 return m_cx;
624 }
625
627 CameraMatrix &set(const CX &value)
628 {
629 m_cx = value;
630 return *this;
631 }
632
634 const CY &cy() const
635 {
636 return m_cy;
637 }
638
641 {
642 return m_cy;
643 }
644
646 CameraMatrix &set(const CY &value)
647 {
648 m_cy = value;
649 return *this;
650 }
651
653 const FX &fx() const
654 {
655 return m_fx;
656 }
657
660 {
661 return m_fx;
662 }
663
665 CameraMatrix &set(const FX &value)
666 {
667 m_fx = value;
668 return *this;
669 }
670
672 const FY &fy() const
673 {
674 return m_fy;
675 }
676
679 {
680 return m_fy;
681 }
682
684 CameraMatrix &set(const FY &value)
685 {
686 m_fy = value;
687 return *this;
688 }
689
690 template<
691 typename T,
692 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CX>::value, int>::type = 0>
694 {
695 return m_cx;
696 }
697
698 template<
699 typename T,
700 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CY>::value, int>::type = 0>
702 {
703 return m_cy;
704 }
705
706 template<
707 typename T,
708 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FX>::value, int>::type = 0>
710 {
711 return m_fx;
712 }
713
714 template<
715 typename T,
716 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FY>::value, int>::type = 0>
718 {
719 return m_fy;
720 }
721
722 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
724 {
725 return m_cx;
726 }
727
728 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
730 {
731 return m_cy;
732 }
733
734 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
736 {
737 return m_fx;
738 }
739
740 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
742 {
743 return m_fy;
744 }
745
747 template<typename F>
748 void forEach(const F &f) const
749 {
750 f(m_cx);
751 f(m_cy);
752 f(m_fx);
753 f(m_fy);
754 }
755
757 template<typename F>
758 void forEach(const F &f)
759 {
760 f(m_cx);
761 f(m_cy);
762 f(m_fx);
763 f(m_fy);
764 }
765
767 bool operator==(const CameraMatrix &other) const;
768
770 bool operator!=(const CameraMatrix &other) const;
771
773 std::string toString() const;
774
776 friend std::ostream &operator<<(std::ostream &stream, const CameraMatrix &value)
777 {
778 return stream << value.toString();
779 }
780
781 private:
782 void setFromString(const std::string &value);
783
784 void setFromString(const std::string &fullPath, const std::string &value);
785
786 std::string getString(const std::string &fullPath) const;
787
788 CX m_cx;
789 CY m_cy;
790 FX m_fx;
791 FY m_fy;
792
793 friend struct DataModel::Detail::Befriend<CameraMatrix>;
794 };
795
797
798 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
800 {
801 public:
803 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
804
806 static constexpr const char *path{ "Distortion" };
807
809 static constexpr const char *name{ "Distortion" };
810
812 static constexpr const char *description{
813 R"description(The radial and tangential distortion parameters)description"
814 };
815
817
818 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
820 {
821 public:
823 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
824
826 static constexpr const char *path{ "Distortion/K1" };
827
829 static constexpr const char *name{ "K1" };
830
832 static constexpr const char *description{ R"description(First radial distortion term)description" };
833
835 using ValueType = double;
836
838 static constexpr Range<double> validRange()
839 {
840 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
841 }
842
844 K1() = default;
845
847 explicit constexpr K1(double value)
848 : m_value{ value }
849 {}
850
852 double value() const;
853
855 std::string toString() const;
856
858 bool operator==(const K1 &other) const
859 {
860 return m_value == other.m_value;
861 }
862
864 bool operator!=(const K1 &other) const
865 {
866 return m_value != other.m_value;
867 }
868
870 bool operator<(const K1 &other) const
871 {
872 return m_value < other.m_value;
873 }
874
876 bool operator>(const K1 &other) const
877 {
878 return m_value > other.m_value;
879 }
880
882 bool operator<=(const K1 &other) const
883 {
884 return m_value <= other.m_value;
885 }
886
888 bool operator>=(const K1 &other) const
889 {
890 return m_value >= other.m_value;
891 }
892
894 friend std::ostream &operator<<(std::ostream &stream, const K1 &value)
895 {
896 return stream << value.toString();
897 }
898
899 private:
900 void setFromString(const std::string &value);
901
902 double m_value{ 0.0 };
903
904 friend struct DataModel::Detail::Befriend<K1>;
905 };
906
908
909 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
911 {
912 public:
914 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
915
917 static constexpr const char *path{ "Distortion/K2" };
918
920 static constexpr const char *name{ "K2" };
921
923 static constexpr const char *description{ R"description(Second radial distortion term)description" };
924
926 using ValueType = double;
927
929 static constexpr Range<double> validRange()
930 {
931 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
932 }
933
935 K2() = default;
936
938 explicit constexpr K2(double value)
939 : m_value{ value }
940 {}
941
943 double value() const;
944
946 std::string toString() const;
947
949 bool operator==(const K2 &other) const
950 {
951 return m_value == other.m_value;
952 }
953
955 bool operator!=(const K2 &other) const
956 {
957 return m_value != other.m_value;
958 }
959
961 bool operator<(const K2 &other) const
962 {
963 return m_value < other.m_value;
964 }
965
967 bool operator>(const K2 &other) const
968 {
969 return m_value > other.m_value;
970 }
971
973 bool operator<=(const K2 &other) const
974 {
975 return m_value <= other.m_value;
976 }
977
979 bool operator>=(const K2 &other) const
980 {
981 return m_value >= other.m_value;
982 }
983
985 friend std::ostream &operator<<(std::ostream &stream, const K2 &value)
986 {
987 return stream << value.toString();
988 }
989
990 private:
991 void setFromString(const std::string &value);
992
993 double m_value{ 0.0 };
994
995 friend struct DataModel::Detail::Befriend<K2>;
996 };
997
999
1000 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1002 {
1003 public:
1005 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1006
1008 static constexpr const char *path{ "Distortion/K3" };
1009
1011 static constexpr const char *name{ "K3" };
1012
1014 static constexpr const char *description{ R"description(Third radial distortion term)description" };
1015
1017 using ValueType = double;
1018
1020 static constexpr Range<double> validRange()
1021 {
1022 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1023 }
1024
1026 K3() = default;
1027
1029 explicit constexpr K3(double value)
1030 : m_value{ value }
1031 {}
1032
1034 double value() const;
1035
1037 std::string toString() const;
1038
1040 bool operator==(const K3 &other) const
1041 {
1042 return m_value == other.m_value;
1043 }
1044
1046 bool operator!=(const K3 &other) const
1047 {
1048 return m_value != other.m_value;
1049 }
1050
1052 bool operator<(const K3 &other) const
1053 {
1054 return m_value < other.m_value;
1055 }
1056
1058 bool operator>(const K3 &other) const
1059 {
1060 return m_value > other.m_value;
1061 }
1062
1064 bool operator<=(const K3 &other) const
1065 {
1066 return m_value <= other.m_value;
1067 }
1068
1070 bool operator>=(const K3 &other) const
1071 {
1072 return m_value >= other.m_value;
1073 }
1074
1076 friend std::ostream &operator<<(std::ostream &stream, const K3 &value)
1077 {
1078 return stream << value.toString();
1079 }
1080
1081 private:
1082 void setFromString(const std::string &value);
1083
1084 double m_value{ 0.0 };
1085
1086 friend struct DataModel::Detail::Befriend<K3>;
1087 };
1088
1090
1091 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1093 {
1094 public:
1096 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1097
1099 static constexpr const char *path{ "Distortion/P1" };
1100
1102 static constexpr const char *name{ "P1" };
1103
1105 static constexpr const char *description{ R"description(First tangential distortion term)description" };
1106
1108 using ValueType = double;
1109
1111 static constexpr Range<double> validRange()
1112 {
1113 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1114 }
1115
1117 P1() = default;
1118
1120 explicit constexpr P1(double value)
1121 : m_value{ value }
1122 {}
1123
1125 double value() const;
1126
1128 std::string toString() const;
1129
1131 bool operator==(const P1 &other) const
1132 {
1133 return m_value == other.m_value;
1134 }
1135
1137 bool operator!=(const P1 &other) const
1138 {
1139 return m_value != other.m_value;
1140 }
1141
1143 bool operator<(const P1 &other) const
1144 {
1145 return m_value < other.m_value;
1146 }
1147
1149 bool operator>(const P1 &other) const
1150 {
1151 return m_value > other.m_value;
1152 }
1153
1155 bool operator<=(const P1 &other) const
1156 {
1157 return m_value <= other.m_value;
1158 }
1159
1161 bool operator>=(const P1 &other) const
1162 {
1163 return m_value >= other.m_value;
1164 }
1165
1167 friend std::ostream &operator<<(std::ostream &stream, const P1 &value)
1168 {
1169 return stream << value.toString();
1170 }
1171
1172 private:
1173 void setFromString(const std::string &value);
1174
1175 double m_value{ 0.0 };
1176
1177 friend struct DataModel::Detail::Befriend<P1>;
1178 };
1179
1181
1182 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1184 {
1185 public:
1187 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1188
1190 static constexpr const char *path{ "Distortion/P2" };
1191
1193 static constexpr const char *name{ "P2" };
1194
1196 static constexpr const char *description{
1197 R"description(Second tangential distortion term)description"
1198 };
1199
1201 using ValueType = double;
1202
1204 static constexpr Range<double> validRange()
1205 {
1206 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1207 }
1208
1210 P2() = default;
1211
1213 explicit constexpr P2(double value)
1214 : m_value{ value }
1215 {}
1216
1218 double value() const;
1219
1221 std::string toString() const;
1222
1224 bool operator==(const P2 &other) const
1225 {
1226 return m_value == other.m_value;
1227 }
1228
1230 bool operator!=(const P2 &other) const
1231 {
1232 return m_value != other.m_value;
1233 }
1234
1236 bool operator<(const P2 &other) const
1237 {
1238 return m_value < other.m_value;
1239 }
1240
1242 bool operator>(const P2 &other) const
1243 {
1244 return m_value > other.m_value;
1245 }
1246
1248 bool operator<=(const P2 &other) const
1249 {
1250 return m_value <= other.m_value;
1251 }
1252
1254 bool operator>=(const P2 &other) const
1255 {
1256 return m_value >= other.m_value;
1257 }
1258
1260 friend std::ostream &operator<<(std::ostream &stream, const P2 &value)
1261 {
1262 return stream << value.toString();
1263 }
1264
1265 private:
1266 void setFromString(const std::string &value);
1267
1268 double m_value{ 0.0 };
1269
1270 friend struct DataModel::Detail::Befriend<P2>;
1271 };
1272
1273 using Descendants = std::tuple<
1279
1282
1298#ifndef NO_DOC
1299 template<
1300 typename... Args,
1301 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1302 typename std::enable_if<
1303 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
1304 value,
1305 int>::type = 0>
1306#else
1307 template<typename... Args>
1308#endif
1309 explicit Distortion(Args &&...args)
1310 {
1311 using namespace Zivid::Detail::TypeTraits;
1312
1313 static_assert(
1314 AllArgsDecayedAreUnique<Args...>::value,
1315 "Found duplicate types among the arguments passed to Distortion(...). "
1316 "Types should be listed at most once.");
1317
1318 set(std::forward<Args>(args)...);
1319 }
1320
1335#ifndef NO_DOC
1336 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1337#else
1338 template<typename... Args>
1339#endif
1340 void set(Args &&...args)
1341 {
1342 using namespace Zivid::Detail::TypeTraits;
1343
1344 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1345 static_assert(
1346 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
1347
1348 static_assert(
1349 AllArgsDecayedAreUnique<Args...>::value,
1350 "Found duplicate types among the arguments passed to set(...). "
1351 "Types should be listed at most once.");
1352
1353 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1354 }
1355
1371#ifndef NO_DOC
1372 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1373#else
1374 template<typename... Args>
1375#endif
1376 Distortion copyWith(Args &&...args) const
1377 {
1378 using namespace Zivid::Detail::TypeTraits;
1379
1380 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1381 static_assert(
1382 AllArgsAreDescendantNodes::value,
1383 "All arguments passed to copyWith(...) must be descendant nodes.");
1384
1385 static_assert(
1386 AllArgsDecayedAreUnique<Args...>::value,
1387 "Found duplicate types among the arguments passed to copyWith(...). "
1388 "Types should be listed at most once.");
1389
1390 auto copy{ *this };
1391 copy.set(std::forward<Args>(args)...);
1392 return copy;
1393 }
1394
1396 const K1 &k1() const
1397 {
1398 return m_k1;
1399 }
1400
1403 {
1404 return m_k1;
1405 }
1406
1408 Distortion &set(const K1 &value)
1409 {
1410 m_k1 = value;
1411 return *this;
1412 }
1413
1415 const K2 &k2() const
1416 {
1417 return m_k2;
1418 }
1419
1422 {
1423 return m_k2;
1424 }
1425
1427 Distortion &set(const K2 &value)
1428 {
1429 m_k2 = value;
1430 return *this;
1431 }
1432
1434 const K3 &k3() const
1435 {
1436 return m_k3;
1437 }
1438
1441 {
1442 return m_k3;
1443 }
1444
1446 Distortion &set(const K3 &value)
1447 {
1448 m_k3 = value;
1449 return *this;
1450 }
1451
1453 const P1 &p1() const
1454 {
1455 return m_p1;
1456 }
1457
1460 {
1461 return m_p1;
1462 }
1463
1465 Distortion &set(const P1 &value)
1466 {
1467 m_p1 = value;
1468 return *this;
1469 }
1470
1472 const P2 &p2() const
1473 {
1474 return m_p2;
1475 }
1476
1479 {
1480 return m_p2;
1481 }
1482
1484 Distortion &set(const P2 &value)
1485 {
1486 m_p2 = value;
1487 return *this;
1488 }
1489
1490 template<
1491 typename T,
1492 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K1>::value, int>::type = 0>
1494 {
1495 return m_k1;
1496 }
1497
1498 template<
1499 typename T,
1500 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K2>::value, int>::type = 0>
1502 {
1503 return m_k2;
1504 }
1505
1506 template<
1507 typename T,
1508 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K3>::value, int>::type = 0>
1510 {
1511 return m_k3;
1512 }
1513
1514 template<
1515 typename T,
1516 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P1>::value, int>::type = 0>
1518 {
1519 return m_p1;
1520 }
1521
1522 template<
1523 typename T,
1524 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P2>::value, int>::type = 0>
1526 {
1527 return m_p2;
1528 }
1529
1530 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1532 {
1533 return m_k1;
1534 }
1535
1536 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1538 {
1539 return m_k2;
1540 }
1541
1542 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
1544 {
1545 return m_k3;
1546 }
1547
1548 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
1550 {
1551 return m_p1;
1552 }
1553
1554 template<size_t i, typename std::enable_if<i == 4, int>::type = 0>
1556 {
1557 return m_p2;
1558 }
1559
1561 template<typename F>
1562 void forEach(const F &f) const
1563 {
1564 f(m_k1);
1565 f(m_k2);
1566 f(m_k3);
1567 f(m_p1);
1568 f(m_p2);
1569 }
1570
1572 template<typename F>
1573 void forEach(const F &f)
1574 {
1575 f(m_k1);
1576 f(m_k2);
1577 f(m_k3);
1578 f(m_p1);
1579 f(m_p2);
1580 }
1581
1583 bool operator==(const Distortion &other) const;
1584
1586 bool operator!=(const Distortion &other) const;
1587
1589 std::string toString() const;
1590
1592 friend std::ostream &operator<<(std::ostream &stream, const Distortion &value)
1593 {
1594 return stream << value.toString();
1595 }
1596
1597 private:
1598 void setFromString(const std::string &value);
1599
1600 void setFromString(const std::string &fullPath, const std::string &value);
1601
1602 std::string getString(const std::string &fullPath) const;
1603
1604 K1 m_k1;
1605 K2 m_k2;
1606 K3 m_k3;
1607 P1 m_p1;
1608 P2 m_p2;
1609
1610 friend struct DataModel::Detail::Befriend<Distortion>;
1611 };
1612
1613 using Descendants = std::tuple<
1625
1628
1630 explicit CameraIntrinsics(const std::string &fileName);
1631
1637 [[nodiscard]] static CameraIntrinsics fromSerialized(const std::string &value);
1638
1644 std::string serialize() const;
1645
1667#ifndef NO_DOC
1668 template<
1669 typename... Args,
1670 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1671 typename std::enable_if<
1672 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
1673 int>::type = 0>
1674#else
1675 template<typename... Args>
1676#endif
1677 explicit CameraIntrinsics(Args &&...args)
1678 {
1679 using namespace Zivid::Detail::TypeTraits;
1680
1681 static_assert(
1682 AllArgsDecayedAreUnique<Args...>::value,
1683 "Found duplicate types among the arguments passed to CameraIntrinsics(...). "
1684 "Types should be listed at most once.");
1685
1686 set(std::forward<Args>(args)...);
1687 }
1688
1709#ifndef NO_DOC
1710 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1711#else
1712 template<typename... Args>
1713#endif
1714 void set(Args &&...args)
1715 {
1716 using namespace Zivid::Detail::TypeTraits;
1717
1718 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1719 static_assert(
1720 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
1721
1722 static_assert(
1723 AllArgsDecayedAreUnique<Args...>::value,
1724 "Found duplicate types among the arguments passed to set(...). "
1725 "Types should be listed at most once.");
1726
1727 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1728 }
1729
1751#ifndef NO_DOC
1752 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1753#else
1754 template<typename... Args>
1755#endif
1756 CameraIntrinsics copyWith(Args &&...args) const
1757 {
1758 using namespace Zivid::Detail::TypeTraits;
1759
1760 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1761 static_assert(
1762 AllArgsAreDescendantNodes::value, "All arguments passed to copyWith(...) must be descendant nodes.");
1763
1764 static_assert(
1765 AllArgsDecayedAreUnique<Args...>::value,
1766 "Found duplicate types among the arguments passed to copyWith(...). "
1767 "Types should be listed at most once.");
1768
1769 auto copy{ *this };
1770 copy.set(std::forward<Args>(args)...);
1771 return copy;
1772 }
1773
1776 {
1777 return m_cameraMatrix;
1778 }
1779
1782 {
1783 return m_cameraMatrix;
1784 }
1785
1788 {
1789 m_cameraMatrix = value;
1790 return *this;
1791 }
1792
1795 {
1796 m_cameraMatrix.set(value);
1797 return *this;
1798 }
1799
1802 {
1803 m_cameraMatrix.set(value);
1804 return *this;
1805 }
1806
1809 {
1810 m_cameraMatrix.set(value);
1811 return *this;
1812 }
1813
1816 {
1817 m_cameraMatrix.set(value);
1818 return *this;
1819 }
1820
1822 const Distortion &distortion() const
1823 {
1824 return m_distortion;
1825 }
1826
1829 {
1830 return m_distortion;
1831 }
1832
1835 {
1836 m_distortion = value;
1837 return *this;
1838 }
1839
1842 {
1843 m_distortion.set(value);
1844 return *this;
1845 }
1846
1849 {
1850 m_distortion.set(value);
1851 return *this;
1852 }
1853
1856 {
1857 m_distortion.set(value);
1858 return *this;
1859 }
1860
1863 {
1864 m_distortion.set(value);
1865 return *this;
1866 }
1867
1870 {
1871 m_distortion.set(value);
1872 return *this;
1873 }
1874
1875 template<
1876 typename T,
1877 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix>::value, int>::type = 0>
1879 {
1880 return m_cameraMatrix;
1881 }
1882
1883 template<
1884 typename T,
1885 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CX>::value, int>::type = 0>
1887 {
1888 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::CX>();
1889 }
1890
1891 template<
1892 typename T,
1893 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CY>::value, int>::type = 0>
1895 {
1896 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::CY>();
1897 }
1898
1899 template<
1900 typename T,
1901 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FX>::value, int>::type = 0>
1903 {
1904 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::FX>();
1905 }
1906
1907 template<
1908 typename T,
1909 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FY>::value, int>::type = 0>
1911 {
1912 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::FY>();
1913 }
1914
1915 template<
1916 typename T,
1917 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion>::value, int>::type = 0>
1919 {
1920 return m_distortion;
1921 }
1922
1923 template<
1924 typename T,
1925 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K1>::value, int>::type = 0>
1927 {
1928 return m_distortion.get<CameraIntrinsics::Distortion::K1>();
1929 }
1930
1931 template<
1932 typename T,
1933 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K2>::value, int>::type = 0>
1935 {
1936 return m_distortion.get<CameraIntrinsics::Distortion::K2>();
1937 }
1938
1939 template<
1940 typename T,
1941 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K3>::value, int>::type = 0>
1943 {
1944 return m_distortion.get<CameraIntrinsics::Distortion::K3>();
1945 }
1946
1947 template<
1948 typename T,
1949 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P1>::value, int>::type = 0>
1951 {
1952 return m_distortion.get<CameraIntrinsics::Distortion::P1>();
1953 }
1954
1955 template<
1956 typename T,
1957 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P2>::value, int>::type = 0>
1959 {
1960 return m_distortion.get<CameraIntrinsics::Distortion::P2>();
1961 }
1962
1963 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1965 {
1966 return m_cameraMatrix;
1967 }
1968
1969 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1971 {
1972 return m_distortion;
1973 }
1974
1976 template<typename F>
1977 void forEach(const F &f) const
1978 {
1979 f(m_cameraMatrix);
1980 f(m_distortion);
1981 }
1982
1984 template<typename F>
1985 void forEach(const F &f)
1986 {
1987 f(m_cameraMatrix);
1988 f(m_distortion);
1989 }
1990
1992 bool operator==(const CameraIntrinsics &other) const;
1993
1995 bool operator!=(const CameraIntrinsics &other) const;
1996
1998 std::string toString() const;
1999
2001 friend std::ostream &operator<<(std::ostream &stream, const CameraIntrinsics &value)
2002 {
2003 return stream << value.toString();
2004 }
2005
2007 void save(const std::string &fileName) const;
2008
2010 void load(const std::string &fileName);
2011
2012 private:
2013 void setFromString(const std::string &value);
2014
2015 void setFromString(const std::string &fullPath, const std::string &value);
2016
2017 std::string getString(const std::string &fullPath) const;
2018
2019 CameraMatrix m_cameraMatrix;
2020 Distortion m_distortion;
2021
2022 friend struct DataModel::Detail::Befriend<CameraIntrinsics>;
2023 };
2024
2025#ifndef NO_DOC
2026 template<>
2027 struct CameraIntrinsics::Version<1>
2028 {
2029 using Type = CameraIntrinsics;
2030 };
2031#endif
2032
2033} // namespace Zivid
2034
2035#ifndef NO_DOC
2037namespace Zivid::Detail
2038{
2039
2040 ZIVID_CORE_EXPORT void save(const Zivid::CameraIntrinsics &dataModel, std::ostream &ostream);
2041 ZIVID_CORE_EXPORT void load(Zivid::CameraIntrinsics &dataModel, std::istream &istream);
2042
2043 ZIVID_CORE_EXPORT std::vector<uint8_t> serializeToBinaryVector(const Zivid::CameraIntrinsics &source);
2044 ZIVID_CORE_EXPORT void deserializeFromBinaryVector(Zivid::CameraIntrinsics &dest, const std::vector<uint8_t> &data);
2045
2046} // namespace Zivid::Detail
2047#endif
2048
2049#ifdef _MSC_VER
2050# pragma warning(pop)
2051#endif
2052
2053#ifndef NO_DOC
2054# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
2055namespace std // NOLINT
2056{
2057
2058 template<>
2059 struct tuple_size<Zivid::CameraIntrinsics::CameraMatrix> : integral_constant<size_t, 4>
2060 {};
2061
2062 template<size_t i>
2063 struct tuple_element<i, Zivid::CameraIntrinsics::CameraMatrix>
2064 {
2065 static_assert(i < tuple_size<Zivid::CameraIntrinsics::CameraMatrix>::value, "Index must be less than 4");
2066
2067 using type // NOLINT
2068 = decltype(declval<Zivid::CameraIntrinsics::CameraMatrix>().get<i>());
2069 };
2070
2071 template<>
2072 struct tuple_size<Zivid::CameraIntrinsics::Distortion> : integral_constant<size_t, 5>
2073 {};
2074
2075 template<size_t i>
2076 struct tuple_element<i, Zivid::CameraIntrinsics::Distortion>
2077 {
2078 static_assert(i < tuple_size<Zivid::CameraIntrinsics::Distortion>::value, "Index must be less than 5");
2079
2080 using type // NOLINT
2081 = decltype(declval<Zivid::CameraIntrinsics::Distortion>().get<i>());
2082 };
2083
2084 template<>
2085 struct tuple_size<Zivid::CameraIntrinsics> : integral_constant<size_t, 2>
2086 {};
2087
2088 template<size_t i>
2089 struct tuple_element<i, Zivid::CameraIntrinsics>
2090 {
2091 static_assert(i < tuple_size<Zivid::CameraIntrinsics>::value, "Index must be less than 2");
2092
2093 using type // NOLINT
2094 = decltype(declval<Zivid::CameraIntrinsics>().get<i>());
2095 };
2096
2097} // namespace std
2098# endif
2099#endif
2100
2101// If we have access to the DataModel library, automatically include internal DataModel
2102// header. This header is necessary for serialization and deserialization.
2103#if defined(__has_include) && !defined(NO_DOC)
2104# if __has_include("Zivid/CameraIntrinsicsInternal.h") && __has_include("Zivid/DataModelNodeMetaData.h")
2105# include "Zivid/CameraIntrinsicsInternal.h"
2106# endif
2107#endif
#define ZIVID_CORE_EXPORT
Definition CoreExport.h:56
x coordinate of the principal point
Definition CameraIntrinsics.h:132
bool operator==(const CX &other) const
Comparison operator.
Definition CameraIntrinsics.h:172
std::string toString() const
Get the value as string.
bool operator<(const CX &other) const
Comparison operator.
Definition CameraIntrinsics.h:184
bool operator>=(const CX &other) const
Comparison operator.
Definition CameraIntrinsics.h:202
constexpr CX(double value)
Constructor.
Definition CameraIntrinsics.h:161
bool operator>(const CX &other) const
Comparison operator.
Definition CameraIntrinsics.h:190
bool operator!=(const CX &other) const
Comparison operator.
Definition CameraIntrinsics.h:178
double value() const
Get the value.
CX()=default
Default constructor.
friend std::ostream & operator<<(std::ostream &stream, const CX &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:208
static constexpr Range< double > validRange()
The range of valid values for CX.
Definition CameraIntrinsics.h:152
bool operator<=(const CX &other) const
Comparison operator.
Definition CameraIntrinsics.h:196
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:149
y coordinate of the principal point
Definition CameraIntrinsics.h:225
friend std::ostream & operator<<(std::ostream &stream, const CY &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:301
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:242
bool operator<=(const CY &other) const
Comparison operator.
Definition CameraIntrinsics.h:289
bool operator>(const CY &other) const
Comparison operator.
Definition CameraIntrinsics.h:283
double value() const
Get the value.
CY()=default
Default constructor.
static constexpr Range< double > validRange()
The range of valid values for CY.
Definition CameraIntrinsics.h:245
bool operator!=(const CY &other) const
Comparison operator.
Definition CameraIntrinsics.h:271
std::string toString() const
Get the value as string.
bool operator==(const CY &other) const
Comparison operator.
Definition CameraIntrinsics.h:265
bool operator<(const CY &other) const
Comparison operator.
Definition CameraIntrinsics.h:277
constexpr CY(double value)
Constructor.
Definition CameraIntrinsics.h:254
bool operator>=(const CY &other) const
Comparison operator.
Definition CameraIntrinsics.h:295
Focal length in x.
Definition CameraIntrinsics.h:318
static constexpr Range< double > validRange()
The range of valid values for FX.
Definition CameraIntrinsics.h:336
double value() const
Get the value.
FX()=default
Default constructor.
bool operator!=(const FX &other) const
Comparison operator.
Definition CameraIntrinsics.h:362
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:333
constexpr FX(double value)
Constructor.
Definition CameraIntrinsics.h:345
bool operator==(const FX &other) const
Comparison operator.
Definition CameraIntrinsics.h:356
bool operator>(const FX &other) const
Comparison operator.
Definition CameraIntrinsics.h:374
bool operator<=(const FX &other) const
Comparison operator.
Definition CameraIntrinsics.h:380
bool operator>=(const FX &other) const
Comparison operator.
Definition CameraIntrinsics.h:386
friend std::ostream & operator<<(std::ostream &stream, const FX &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:392
std::string toString() const
Get the value as string.
bool operator<(const FX &other) const
Comparison operator.
Definition CameraIntrinsics.h:368
Focal length in y.
Definition CameraIntrinsics.h:409
bool operator>(const FY &other) const
Comparison operator.
Definition CameraIntrinsics.h:465
bool operator!=(const FY &other) const
Comparison operator.
Definition CameraIntrinsics.h:453
bool operator==(const FY &other) const
Comparison operator.
Definition CameraIntrinsics.h:447
FY()=default
Default constructor.
static constexpr Range< double > validRange()
The range of valid values for FY.
Definition CameraIntrinsics.h:427
double value() const
Get the value.
bool operator<(const FY &other) const
Comparison operator.
Definition CameraIntrinsics.h:459
friend std::ostream & operator<<(std::ostream &stream, const FY &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:483
std::string toString() const
Get the value as string.
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:424
bool operator>=(const FY &other) const
Comparison operator.
Definition CameraIntrinsics.h:477
constexpr FY(double value)
Constructor.
Definition CameraIntrinsics.h:436
bool operator<=(const FY &other) const
Comparison operator.
Definition CameraIntrinsics.h:471
The camera matrix K (=[fx,0,cx;0,fy,cy;0,0,1])
Definition CameraIntrinsics.h:112
const FX & fx() const
Get FX.
Definition CameraIntrinsics.h:653
const CameraIntrinsics::CameraMatrix::CX & get() const
Definition CameraIntrinsics.h:693
void set(Args &&...args)
Set multiple arguments.
Definition CameraIntrinsics.h:560
CameraMatrix & set(const CY &value)
Set CY.
Definition CameraIntrinsics.h:646
const CameraIntrinsics::CameraMatrix::FX & get() const
Definition CameraIntrinsics.h:709
bool operator!=(const CameraMatrix &other) const
Inequality operator.
const CY & cy() const
Get CY.
Definition CameraIntrinsics.h:634
const CameraIntrinsics::CameraMatrix::FY & get() const
Definition CameraIntrinsics.h:717
bool operator==(const CameraMatrix &other) const
Equality operator.
std::string toString() const
Get the value as string.
friend std::ostream & operator<<(std::ostream &stream, const CameraMatrix &value)
Operator to send the value as string to a stream.
Definition CameraIntrinsics.h:776
CameraMatrix & set(const CX &value)
Set CX.
Definition CameraIntrinsics.h:627
const CameraIntrinsics::CameraMatrix::CY & get() const
Definition CameraIntrinsics.h:701
CameraMatrix & set(const FY &value)
Set FY.
Definition CameraIntrinsics.h:684
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition CameraIntrinsics.h:748
CameraMatrix & set(const FX &value)
Set FX.
Definition CameraIntrinsics.h:665
FY & fy()
Get FY.
Definition CameraIntrinsics.h:678
CameraMatrix copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition CameraIntrinsics.h:595
CX & cx()
Get CX.
Definition CameraIntrinsics.h:621
std::tuple< CameraIntrinsics::CameraMatrix::CX, CameraIntrinsics::CameraMatrix::CY, CameraIntrinsics::CameraMatrix::FX, CameraIntrinsics::CameraMatrix::FY > Descendants
Definition CameraIntrinsics.h:496
const FY & fy() const
Get FY.
Definition CameraIntrinsics.h:672
const CX & cx() const
Get CX.
Definition CameraIntrinsics.h:615
CY & cy()
Get CY.
Definition CameraIntrinsics.h:640
CameraMatrix()
Default constructor.
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition CameraIntrinsics.h:758
FX & fx()
Get FX.
Definition CameraIntrinsics.h:659
First radial distortion term.
Definition CameraIntrinsics.h:820
bool operator<(const K1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:870
K1()=default
Default constructor.
bool operator!=(const K1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:864
friend std::ostream & operator<<(std::ostream &stream, const K1 &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:894
bool operator>(const K1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:876
constexpr K1(double value)
Constructor.
Definition CameraIntrinsics.h:847
bool operator>=(const K1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:888
bool operator<=(const K1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:882
static constexpr Range< double > validRange()
The range of valid values for K1.
Definition CameraIntrinsics.h:838
bool operator==(const K1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:858
double value() const
Get the value.
std::string toString() const
Get the value as string.
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:835
Second radial distortion term.
Definition CameraIntrinsics.h:911
bool operator>=(const K2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:979
static constexpr Range< double > validRange()
The range of valid values for K2.
Definition CameraIntrinsics.h:929
bool operator>(const K2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:967
bool operator!=(const K2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:955
std::string toString() const
Get the value as string.
bool operator==(const K2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:949
bool operator<(const K2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:961
friend std::ostream & operator<<(std::ostream &stream, const K2 &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:985
K2()=default
Default constructor.
bool operator<=(const K2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:973
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:926
constexpr K2(double value)
Constructor.
Definition CameraIntrinsics.h:938
double value() const
Get the value.
Third radial distortion term.
Definition CameraIntrinsics.h:1002
bool operator<(const K3 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1052
double value() const
Get the value.
static constexpr Range< double > validRange()
The range of valid values for K3.
Definition CameraIntrinsics.h:1020
K3()=default
Default constructor.
std::string toString() const
Get the value as string.
constexpr K3(double value)
Constructor.
Definition CameraIntrinsics.h:1029
bool operator>(const K3 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1058
bool operator<=(const K3 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1064
bool operator>=(const K3 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1070
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:1017
bool operator!=(const K3 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1046
friend std::ostream & operator<<(std::ostream &stream, const K3 &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:1076
bool operator==(const K3 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1040
First tangential distortion term.
Definition CameraIntrinsics.h:1093
bool operator>(const P1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1149
static constexpr Range< double > validRange()
The range of valid values for P1.
Definition CameraIntrinsics.h:1111
bool operator==(const P1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1131
bool operator>=(const P1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1161
std::string toString() const
Get the value as string.
friend std::ostream & operator<<(std::ostream &stream, const P1 &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:1167
bool operator<(const P1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1143
P1()=default
Default constructor.
bool operator<=(const P1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1155
double value() const
Get the value.
constexpr P1(double value)
Constructor.
Definition CameraIntrinsics.h:1120
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:1108
bool operator!=(const P1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1137
Second tangential distortion term.
Definition CameraIntrinsics.h:1184
static constexpr Range< double > validRange()
The range of valid values for P2.
Definition CameraIntrinsics.h:1204
bool operator==(const P2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1224
friend std::ostream & operator<<(std::ostream &stream, const P2 &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:1260
bool operator>(const P2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1242
constexpr P2(double value)
Constructor.
Definition CameraIntrinsics.h:1213
P2()=default
Default constructor.
double value() const
Get the value.
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:1201
std::string toString() const
Get the value as string.
bool operator<(const P2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1236
bool operator>=(const P2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1254
bool operator<=(const P2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1248
bool operator!=(const P2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1230
The radial and tangential distortion parameters.
Definition CameraIntrinsics.h:800
const CameraIntrinsics::Distortion::K3 & get() const
Definition CameraIntrinsics.h:1509
const P2 & p2() const
Get P2.
Definition CameraIntrinsics.h:1472
std::tuple< CameraIntrinsics::Distortion::K1, CameraIntrinsics::Distortion::K2, CameraIntrinsics::Distortion::K3, CameraIntrinsics::Distortion::P1, CameraIntrinsics::Distortion::P2 > Descendants
Definition CameraIntrinsics.h:1273
K3 & k3()
Get K3.
Definition CameraIntrinsics.h:1440
const K2 & k2() const
Get K2.
Definition CameraIntrinsics.h:1415
void set(Args &&...args)
Set multiple arguments.
Definition CameraIntrinsics.h:1340
Distortion copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition CameraIntrinsics.h:1376
Distortion & set(const K2 &value)
Set K2.
Definition CameraIntrinsics.h:1427
K1 & k1()
Get K1.
Definition CameraIntrinsics.h:1402
std::string toString() const
Get the value as string.
P1 & p1()
Get P1.
Definition CameraIntrinsics.h:1459
Distortion()
Default constructor.
bool operator==(const Distortion &other) const
Equality operator.
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition CameraIntrinsics.h:1573
const CameraIntrinsics::Distortion::K2 & get() const
Definition CameraIntrinsics.h:1501
const CameraIntrinsics::Distortion::P2 & get() const
Definition CameraIntrinsics.h:1525
Distortion & set(const K3 &value)
Set K3.
Definition CameraIntrinsics.h:1446
const CameraIntrinsics::Distortion::P1 & get() const
Definition CameraIntrinsics.h:1517
bool operator!=(const Distortion &other) const
Inequality operator.
const P1 & p1() const
Get P1.
Definition CameraIntrinsics.h:1453
const K3 & k3() const
Get K3.
Definition CameraIntrinsics.h:1434
Distortion & set(const P1 &value)
Set P1.
Definition CameraIntrinsics.h:1465
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition CameraIntrinsics.h:1562
const CameraIntrinsics::Distortion::K1 & get() const
Definition CameraIntrinsics.h:1493
const K1 & k1() const
Get K1.
Definition CameraIntrinsics.h:1396
Distortion & set(const P2 &value)
Set P2.
Definition CameraIntrinsics.h:1484
Distortion & set(const K1 &value)
Set K1.
Definition CameraIntrinsics.h:1408
P2 & p2()
Get P2.
Definition CameraIntrinsics.h:1478
K2 & k2()
Get K2.
Definition CameraIntrinsics.h:1421
friend std::ostream & operator<<(std::ostream &stream, const Distortion &value)
Operator to send the value as string to a stream.
Definition CameraIntrinsics.h:1592
Information about the intrinsic parameters of the camera (OpenCV model)
Definition CameraIntrinsics.h:78
CameraIntrinsics & set(const Distortion::K3 &value)
Set Distortion::K3.
Definition CameraIntrinsics.h:1855
CameraMatrix & cameraMatrix()
Get CameraMatrix.
Definition CameraIntrinsics.h:1781
const CameraIntrinsics::CameraMatrix::CX & get() const
Definition CameraIntrinsics.h:1886
const CameraIntrinsics::Distortion::K1 & get() const
Definition CameraIntrinsics.h:1926
std::string serialize() const
Serialize to a string.
bool operator!=(const CameraIntrinsics &other) const
Inequality operator.
const CameraIntrinsics::CameraMatrix::FY & get() const
Definition CameraIntrinsics.h:1910
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition CameraIntrinsics.h:1977
CameraIntrinsics(Args &&...args)
Constructor taking variadic number of arguments.
Definition CameraIntrinsics.h:1677
std::string toString() const
Get the value as string.
CameraIntrinsics & set(const Distortion::P1 &value)
Set Distortion::P1.
Definition CameraIntrinsics.h:1862
const Distortion & distortion() const
Get Distortion.
Definition CameraIntrinsics.h:1822
void set(Args &&...args)
Set multiple arguments.
Definition CameraIntrinsics.h:1714
CameraIntrinsics & set(const Distortion::K1 &value)
Set Distortion::K1.
Definition CameraIntrinsics.h:1841
const CameraIntrinsics::Distortion::K3 & get() const
Definition CameraIntrinsics.h:1942
CameraIntrinsics copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition CameraIntrinsics.h:1756
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition CameraIntrinsics.h:1985
CameraIntrinsics()
Default constructor.
CameraIntrinsics & set(const CameraMatrix::FY &value)
Set CameraMatrix::FY.
Definition CameraIntrinsics.h:1815
void load(const std::string &fileName)
Load from the given file.
std::tuple< CameraIntrinsics::CameraMatrix, CameraIntrinsics::CameraMatrix::CX, CameraIntrinsics::CameraMatrix::CY, CameraIntrinsics::CameraMatrix::FX, CameraIntrinsics::CameraMatrix::FY, CameraIntrinsics::Distortion, CameraIntrinsics::Distortion::K1, CameraIntrinsics::Distortion::K2, CameraIntrinsics::Distortion::K3, CameraIntrinsics::Distortion::P1, CameraIntrinsics::Distortion::P2 > Descendants
Definition CameraIntrinsics.h:1613
const CameraIntrinsics::Distortion::P1 & get() const
Definition CameraIntrinsics.h:1950
bool operator==(const CameraIntrinsics &other) const
Equality operator.
static CameraIntrinsics fromSerialized(const std::string &value)
Construct a new CameraIntrinsics instance from a previously serialized string.
CameraIntrinsics & set(const CameraMatrix::CY &value)
Set CameraMatrix::CY.
Definition CameraIntrinsics.h:1801
CameraIntrinsics(const std::string &fileName)
Construct CameraIntrinsics by loading from file.
CameraIntrinsics & set(const CameraMatrix &value)
Set CameraMatrix.
Definition CameraIntrinsics.h:1787
CameraIntrinsics & set(const Distortion::P2 &value)
Set Distortion::P2.
Definition CameraIntrinsics.h:1869
CameraIntrinsics & set(const Distortion &value)
Set Distortion.
Definition CameraIntrinsics.h:1834
const CameraIntrinsics::CameraMatrix::CY & get() const
Definition CameraIntrinsics.h:1894
CameraIntrinsics & set(const CameraMatrix::CX &value)
Set CameraMatrix::CX.
Definition CameraIntrinsics.h:1794
void save(const std::string &fileName) const
Save to the given file.
CameraIntrinsics & set(const CameraMatrix::FX &value)
Set CameraMatrix::FX.
Definition CameraIntrinsics.h:1808
const CameraIntrinsics::CameraMatrix & get() const
Definition CameraIntrinsics.h:1878
const CameraIntrinsics::Distortion::K2 & get() const
Definition CameraIntrinsics.h:1934
const CameraMatrix & cameraMatrix() const
Get CameraMatrix.
Definition CameraIntrinsics.h:1775
const CameraIntrinsics::Distortion::P2 & get() const
Definition CameraIntrinsics.h:1958
const CameraIntrinsics::Distortion & get() const
Definition CameraIntrinsics.h:1918
friend std::ostream & operator<<(std::ostream &stream, const CameraIntrinsics &value)
Operator to send the value as string to a stream.
Definition CameraIntrinsics.h:2001
const CameraIntrinsics::CameraMatrix::FX & get() const
Definition CameraIntrinsics.h:1902
Distortion & distortion()
Get Distortion.
Definition CameraIntrinsics.h:1828
CameraIntrinsics & set(const Distortion::K2 &value)
Set Distortion::K2.
Definition CameraIntrinsics.h:1848
Class describing a range of values for a given type T.
Definition Range.h:75
NodeType
Definition NodeType.h:49
Definition EnvironmentInfo.h:74
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:84