Zivid C++ API 2.9.0+4dbba385-1
Defining the Future of 3D Machine Vision
CameraIntrinsics.h
Go to the documentation of this file.
1
2
3/*******************************************************************************
4
5 * This file is part of the Zivid 3D Camera API
6
7 *
8
9 * Copyright 2015-2023 (C) Zivid AS
10
11 * All rights reserved.
12
13 *
14
15 * Zivid Software License, v1.0
16
17 *
18
19 * Redistribution and use in source and binary forms, with or without
20
21 * modification, are permitted provided that the following conditions are met:
22
23 *
24
25 * 1. Redistributions of source code must retain the above copyright notice,
26
27 * this list of conditions and the following disclaimer.
28
29 *
30
31 * 2. Redistributions in binary form must reproduce the above copyright notice,
32
33 * this list of conditions and the following disclaimer in the documentation
34
35 * and/or other materials provided with the distribution.
36
37 *
38
39 * 3. Neither the name of Zivid AS nor the names of its contributors may be used
40
41 * to endorse or promote products derived from this software without specific
42
43 * prior written permission.
44
45 *
46
47 * 4. This software, with or without modification, must not be used with any
48
49 * other 3D camera than from Zivid AS.
50
51 *
52
53 * 5. Any software provided in binary form under this license must not be
54
55 * reverse engineered, decompiled, modified and/or disassembled.
56
57 *
58
59 * THIS SOFTWARE IS PROVIDED BY ZIVID AS "AS IS" AND ANY EXPRESS OR IMPLIED
60
61 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
62
63 * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
64
65 * DISCLAIMED. IN NO EVENT SHALL ZIVID AS OR CONTRIBUTORS BE LIABLE FOR ANY
66
67 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
68
69 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
70
71 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
72
73 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
74
75 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
76
77 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
78
79 *
80
81 * Contact: Zivid Customer Success Team <customersuccess@zivid.com>
82
83 * Info: http://www.zivid.com
84
85 ******************************************************************************/
86
87
88
89#pragma once
90
91#include <array>
92#include <chrono>
93#include <cmath>
94#include <ctime>
95#include <iomanip>
96#include <memory>
97#include <set>
98#include <sstream>
99#include <string>
100#include <tuple>
101#include <utility>
102#include <vector>
103
109#include "Zivid/Range.h"
110
111#ifdef _MSC_VER
112# pragma warning(push)
113# pragma warning(disable : 4251) // "X needs to have dll-interface to be used by clients of class Y."
114#endif
115
116namespace Zivid
117{
118
120
121 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
123 {
124 public:
127
129 static constexpr const char *path{ "" };
130
132 static constexpr const char *name{ "CameraIntrinsics" };
133
135 static constexpr const char *description{
136 R"description(Information about the intrinsic parameters of the camera (OpenCV model))description"
137 };
138
139 static constexpr size_t version{ 1 };
140
141#ifndef NO_DOC
142 template<size_t>
143 struct Version;
144
145 using LatestVersion = Zivid::CameraIntrinsics;
146
147 // Short identifier. This value is not guaranteed to be universally unique
148 // Todo(ZIVID-2808): Move this to internal DataModelExt header
149 static constexpr std::array<uint8_t, 3> binaryId{ 'c', 'i', 'n' };
150
151#endif
152
154
155 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
157 {
158 public:
161
163 static constexpr const char *path{ "CameraMatrix" };
164
166 static constexpr const char *name{ "CameraMatrix" };
167
169 static constexpr const char *description{
170 R"description(The camera matrix K (=[fx,0,cx;0,fy,cy;0,0,1]))description"
171 };
172
174
175 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
177 {
178 public:
181
183 static constexpr const char *path{ "CameraMatrix/CX" };
184
186 static constexpr const char *name{ "CX" };
187
189 static constexpr const char *description{
190 R"description(x coordinate of the principal point)description"
191 };
192
194 using ValueType = double;
195
197 static constexpr Range<double> validRange()
198 {
199 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
200 }
201
203 CX() = default;
204
206 explicit constexpr CX(double value)
207 : m_value{ value }
208 {}
209
211 double value() const;
212
214 std::string toString() const;
215
217 bool operator==(const CX &other) const
218 {
219 return m_value == other.m_value;
220 }
221
223 bool operator!=(const CX &other) const
224 {
225 return m_value != other.m_value;
226 }
227
229 bool operator<(const CX &other) const
230 {
231 return m_value < other.m_value;
232 }
233
235 bool operator>(const CX &other) const
236 {
237 return m_value > other.m_value;
238 }
239
241 bool operator<=(const CX &other) const
242 {
243 return m_value <= other.m_value;
244 }
245
247 bool operator>=(const CX &other) const
248 {
249 return m_value >= other.m_value;
250 }
251
253 friend std::ostream &operator<<(std::ostream &stream, const CX &value)
254 {
255 return stream << value.toString();
256 }
257
258 private:
259 void setFromString(const std::string &value);
260
261 double m_value{ 0.0 };
262
263 friend struct DataModel::Detail::Befriend<CX>;
264 };
265
267
268 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
270 {
271 public:
274
276 static constexpr const char *path{ "CameraMatrix/CY" };
277
279 static constexpr const char *name{ "CY" };
280
282 static constexpr const char *description{
283 R"description(y coordinate of the principal point)description"
284 };
285
287 using ValueType = double;
288
290 static constexpr Range<double> validRange()
291 {
292 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
293 }
294
296 CY() = default;
297
299 explicit constexpr CY(double value)
300 : m_value{ value }
301 {}
302
304 double value() const;
305
307 std::string toString() const;
308
310 bool operator==(const CY &other) const
311 {
312 return m_value == other.m_value;
313 }
314
316 bool operator!=(const CY &other) const
317 {
318 return m_value != other.m_value;
319 }
320
322 bool operator<(const CY &other) const
323 {
324 return m_value < other.m_value;
325 }
326
328 bool operator>(const CY &other) const
329 {
330 return m_value > other.m_value;
331 }
332
334 bool operator<=(const CY &other) const
335 {
336 return m_value <= other.m_value;
337 }
338
340 bool operator>=(const CY &other) const
341 {
342 return m_value >= other.m_value;
343 }
344
346 friend std::ostream &operator<<(std::ostream &stream, const CY &value)
347 {
348 return stream << value.toString();
349 }
350
351 private:
352 void setFromString(const std::string &value);
353
354 double m_value{ 0.0 };
355
356 friend struct DataModel::Detail::Befriend<CY>;
357 };
358
360
361 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
363 {
364 public:
367
369 static constexpr const char *path{ "CameraMatrix/FX" };
370
372 static constexpr const char *name{ "FX" };
373
375 static constexpr const char *description{ R"description(Focal length in x)description" };
376
378 using ValueType = double;
379
381 static constexpr Range<double> validRange()
382 {
383 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
384 }
385
387 FX() = default;
388
390 explicit constexpr FX(double value)
391 : m_value{ value }
392 {}
393
395 double value() const;
396
398 std::string toString() const;
399
401 bool operator==(const FX &other) const
402 {
403 return m_value == other.m_value;
404 }
405
407 bool operator!=(const FX &other) const
408 {
409 return m_value != other.m_value;
410 }
411
413 bool operator<(const FX &other) const
414 {
415 return m_value < other.m_value;
416 }
417
419 bool operator>(const FX &other) const
420 {
421 return m_value > other.m_value;
422 }
423
425 bool operator<=(const FX &other) const
426 {
427 return m_value <= other.m_value;
428 }
429
431 bool operator>=(const FX &other) const
432 {
433 return m_value >= other.m_value;
434 }
435
437 friend std::ostream &operator<<(std::ostream &stream, const FX &value)
438 {
439 return stream << value.toString();
440 }
441
442 private:
443 void setFromString(const std::string &value);
444
445 double m_value{ 0.0 };
446
447 friend struct DataModel::Detail::Befriend<FX>;
448 };
449
451
452 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
454 {
455 public:
458
460 static constexpr const char *path{ "CameraMatrix/FY" };
461
463 static constexpr const char *name{ "FY" };
464
466 static constexpr const char *description{ R"description(Focal length in y)description" };
467
469 using ValueType = double;
470
472 static constexpr Range<double> validRange()
473 {
474 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
475 }
476
478 FY() = default;
479
481 explicit constexpr FY(double value)
482 : m_value{ value }
483 {}
484
486 double value() const;
487
489 std::string toString() const;
490
492 bool operator==(const FY &other) const
493 {
494 return m_value == other.m_value;
495 }
496
498 bool operator!=(const FY &other) const
499 {
500 return m_value != other.m_value;
501 }
502
504 bool operator<(const FY &other) const
505 {
506 return m_value < other.m_value;
507 }
508
510 bool operator>(const FY &other) const
511 {
512 return m_value > other.m_value;
513 }
514
516 bool operator<=(const FY &other) const
517 {
518 return m_value <= other.m_value;
519 }
520
522 bool operator>=(const FY &other) const
523 {
524 return m_value >= other.m_value;
525 }
526
528 friend std::ostream &operator<<(std::ostream &stream, const FY &value)
529 {
530 return stream << value.toString();
531 }
532
533 private:
534 void setFromString(const std::string &value);
535
536 double m_value{ 0.0 };
537
538 friend struct DataModel::Detail::Befriend<FY>;
539 };
540
541 using Descendants = std::tuple<
546
549
564#ifndef NO_DOC
565 template<
566 typename... Args,
567 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
568 typename std::enable_if<
569 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
570 value,
571 int>::type = 0>
572#else
573 template<typename... Args>
574#endif
575 explicit CameraMatrix(Args &&...args)
576 {
577 using namespace Zivid::Detail::TypeTraits;
578
579 static_assert(
580 AllArgsDecayedAreUnique<Args...>::value,
581 "Found duplicate types among the arguments passed to CameraMatrix(...). "
582 "Types should be listed at most once.");
583
584 set(std::forward<Args>(args)...);
585 }
586
600#ifndef NO_DOC
601 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
602#else
603 template<typename... Args>
604#endif
605 void set(Args &&...args)
606 {
607 using namespace Zivid::Detail::TypeTraits;
608
609 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
610 static_assert(
611 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
612
613 static_assert(
614 AllArgsDecayedAreUnique<Args...>::value,
615 "Found duplicate types among the arguments passed to set(...). "
616 "Types should be listed at most once.");
617
618 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
619 }
620
635#ifndef NO_DOC
636 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
637#else
638 template<typename... Args>
639#endif
640 CameraMatrix copyWith(Args &&...args) const
641 {
642 using namespace Zivid::Detail::TypeTraits;
643
644 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
645 static_assert(
646 AllArgsAreDescendantNodes::value,
647 "All arguments passed to copyWith(...) must be descendant nodes.");
648
649 static_assert(
650 AllArgsDecayedAreUnique<Args...>::value,
651 "Found duplicate types among the arguments passed to copyWith(...). "
652 "Types should be listed at most once.");
653
654 auto copy{ *this };
655 copy.set(std::forward<Args>(args)...);
656 return copy;
657 }
658
660 const CX &cx() const
661 {
662 return m_cx;
663 }
664
667 {
668 return m_cx;
669 }
670
672 CameraMatrix &set(const CX &value)
673 {
674 m_cx = value;
675 return *this;
676 }
677
679 const CY &cy() const
680 {
681 return m_cy;
682 }
683
686 {
687 return m_cy;
688 }
689
691 CameraMatrix &set(const CY &value)
692 {
693 m_cy = value;
694 return *this;
695 }
696
698 const FX &fx() const
699 {
700 return m_fx;
701 }
702
705 {
706 return m_fx;
707 }
708
710 CameraMatrix &set(const FX &value)
711 {
712 m_fx = value;
713 return *this;
714 }
715
717 const FY &fy() const
718 {
719 return m_fy;
720 }
721
724 {
725 return m_fy;
726 }
727
729 CameraMatrix &set(const FY &value)
730 {
731 m_fy = value;
732 return *this;
733 }
734
735 template<
736 typename T,
737 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CX>::value, int>::type = 0>
739 {
740 return m_cx;
741 }
742
743 template<
744 typename T,
745 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CY>::value, int>::type = 0>
747 {
748 return m_cy;
749 }
750
751 template<
752 typename T,
753 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FX>::value, int>::type = 0>
755 {
756 return m_fx;
757 }
758
759 template<
760 typename T,
761 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FY>::value, int>::type = 0>
763 {
764 return m_fy;
765 }
766
767 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
769 {
770 return m_cx;
771 }
772
773 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
775 {
776 return m_cy;
777 }
778
779 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
781 {
782 return m_fx;
783 }
784
785 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
787 {
788 return m_fy;
789 }
790
792 template<typename F>
793 void forEach(const F &f) const
794 {
795 f(m_cx);
796 f(m_cy);
797 f(m_fx);
798 f(m_fy);
799 }
800
802 template<typename F>
803 void forEach(const F &f)
804 {
805 f(m_cx);
806 f(m_cy);
807 f(m_fx);
808 f(m_fy);
809 }
810
812 bool operator==(const CameraMatrix &other) const;
813
815 bool operator!=(const CameraMatrix &other) const;
816
818 std::string toString() const;
819
821 friend std::ostream &operator<<(std::ostream &stream, const CameraMatrix &value)
822 {
823 return stream << value.toString();
824 }
825
826 private:
827 void setFromString(const std::string &value);
828
829 void setFromString(const std::string &fullPath, const std::string &value);
830
831 std::string getString(const std::string &fullPath) const;
832
833 CX m_cx;
834 CY m_cy;
835 FX m_fx;
836 FY m_fy;
837
838 friend struct DataModel::Detail::Befriend<CameraMatrix>;
839 };
840
842
843 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
845 {
846 public:
849
851 static constexpr const char *path{ "Distortion" };
852
854 static constexpr const char *name{ "Distortion" };
855
857 static constexpr const char *description{
858 R"description(The radial and tangential distortion parameters)description"
859 };
860
862
863 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
865 {
866 public:
869
871 static constexpr const char *path{ "Distortion/K1" };
872
874 static constexpr const char *name{ "K1" };
875
877 static constexpr const char *description{ R"description(First radial distortion term)description" };
878
880 using ValueType = double;
881
883 static constexpr Range<double> validRange()
884 {
885 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
886 }
887
889 K1() = default;
890
892 explicit constexpr K1(double value)
893 : m_value{ value }
894 {}
895
897 double value() const;
898
900 std::string toString() const;
901
903 bool operator==(const K1 &other) const
904 {
905 return m_value == other.m_value;
906 }
907
909 bool operator!=(const K1 &other) const
910 {
911 return m_value != other.m_value;
912 }
913
915 bool operator<(const K1 &other) const
916 {
917 return m_value < other.m_value;
918 }
919
921 bool operator>(const K1 &other) const
922 {
923 return m_value > other.m_value;
924 }
925
927 bool operator<=(const K1 &other) const
928 {
929 return m_value <= other.m_value;
930 }
931
933 bool operator>=(const K1 &other) const
934 {
935 return m_value >= other.m_value;
936 }
937
939 friend std::ostream &operator<<(std::ostream &stream, const K1 &value)
940 {
941 return stream << value.toString();
942 }
943
944 private:
945 void setFromString(const std::string &value);
946
947 double m_value{ 0.0 };
948
949 friend struct DataModel::Detail::Befriend<K1>;
950 };
951
953
954 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
956 {
957 public:
960
962 static constexpr const char *path{ "Distortion/K2" };
963
965 static constexpr const char *name{ "K2" };
966
968 static constexpr const char *description{ R"description(Second radial distortion term)description" };
969
971 using ValueType = double;
972
974 static constexpr Range<double> validRange()
975 {
976 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
977 }
978
980 K2() = default;
981
983 explicit constexpr K2(double value)
984 : m_value{ value }
985 {}
986
988 double value() const;
989
991 std::string toString() const;
992
994 bool operator==(const K2 &other) const
995 {
996 return m_value == other.m_value;
997 }
998
1000 bool operator!=(const K2 &other) const
1001 {
1002 return m_value != other.m_value;
1003 }
1004
1006 bool operator<(const K2 &other) const
1007 {
1008 return m_value < other.m_value;
1009 }
1010
1012 bool operator>(const K2 &other) const
1013 {
1014 return m_value > other.m_value;
1015 }
1016
1018 bool operator<=(const K2 &other) const
1019 {
1020 return m_value <= other.m_value;
1021 }
1022
1024 bool operator>=(const K2 &other) const
1025 {
1026 return m_value >= other.m_value;
1027 }
1028
1030 friend std::ostream &operator<<(std::ostream &stream, const K2 &value)
1031 {
1032 return stream << value.toString();
1033 }
1034
1035 private:
1036 void setFromString(const std::string &value);
1037
1038 double m_value{ 0.0 };
1039
1040 friend struct DataModel::Detail::Befriend<K2>;
1041 };
1042
1044
1045 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1047 {
1048 public:
1051
1053 static constexpr const char *path{ "Distortion/K3" };
1054
1056 static constexpr const char *name{ "K3" };
1057
1059 static constexpr const char *description{ R"description(Third radial distortion term)description" };
1060
1062 using ValueType = double;
1063
1065 static constexpr Range<double> validRange()
1066 {
1067 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1068 }
1069
1071 K3() = default;
1072
1074 explicit constexpr K3(double value)
1075 : m_value{ value }
1076 {}
1077
1079 double value() const;
1080
1082 std::string toString() const;
1083
1085 bool operator==(const K3 &other) const
1086 {
1087 return m_value == other.m_value;
1088 }
1089
1091 bool operator!=(const K3 &other) const
1092 {
1093 return m_value != other.m_value;
1094 }
1095
1097 bool operator<(const K3 &other) const
1098 {
1099 return m_value < other.m_value;
1100 }
1101
1103 bool operator>(const K3 &other) const
1104 {
1105 return m_value > other.m_value;
1106 }
1107
1109 bool operator<=(const K3 &other) const
1110 {
1111 return m_value <= other.m_value;
1112 }
1113
1115 bool operator>=(const K3 &other) const
1116 {
1117 return m_value >= other.m_value;
1118 }
1119
1121 friend std::ostream &operator<<(std::ostream &stream, const K3 &value)
1122 {
1123 return stream << value.toString();
1124 }
1125
1126 private:
1127 void setFromString(const std::string &value);
1128
1129 double m_value{ 0.0 };
1130
1131 friend struct DataModel::Detail::Befriend<K3>;
1132 };
1133
1135
1136 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1138 {
1139 public:
1142
1144 static constexpr const char *path{ "Distortion/P1" };
1145
1147 static constexpr const char *name{ "P1" };
1148
1150 static constexpr const char *description{ R"description(First tangential distortion term)description" };
1151
1153 using ValueType = double;
1154
1156 static constexpr Range<double> validRange()
1157 {
1158 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1159 }
1160
1162 P1() = default;
1163
1165 explicit constexpr P1(double value)
1166 : m_value{ value }
1167 {}
1168
1170 double value() const;
1171
1173 std::string toString() const;
1174
1176 bool operator==(const P1 &other) const
1177 {
1178 return m_value == other.m_value;
1179 }
1180
1182 bool operator!=(const P1 &other) const
1183 {
1184 return m_value != other.m_value;
1185 }
1186
1188 bool operator<(const P1 &other) const
1189 {
1190 return m_value < other.m_value;
1191 }
1192
1194 bool operator>(const P1 &other) const
1195 {
1196 return m_value > other.m_value;
1197 }
1198
1200 bool operator<=(const P1 &other) const
1201 {
1202 return m_value <= other.m_value;
1203 }
1204
1206 bool operator>=(const P1 &other) const
1207 {
1208 return m_value >= other.m_value;
1209 }
1210
1212 friend std::ostream &operator<<(std::ostream &stream, const P1 &value)
1213 {
1214 return stream << value.toString();
1215 }
1216
1217 private:
1218 void setFromString(const std::string &value);
1219
1220 double m_value{ 0.0 };
1221
1222 friend struct DataModel::Detail::Befriend<P1>;
1223 };
1224
1226
1227 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1229 {
1230 public:
1233
1235 static constexpr const char *path{ "Distortion/P2" };
1236
1238 static constexpr const char *name{ "P2" };
1239
1241 static constexpr const char *description{
1242 R"description(Second tangential distortion term)description"
1243 };
1244
1246 using ValueType = double;
1247
1249 static constexpr Range<double> validRange()
1250 {
1251 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1252 }
1253
1255 P2() = default;
1256
1258 explicit constexpr P2(double value)
1259 : m_value{ value }
1260 {}
1261
1263 double value() const;
1264
1266 std::string toString() const;
1267
1269 bool operator==(const P2 &other) const
1270 {
1271 return m_value == other.m_value;
1272 }
1273
1275 bool operator!=(const P2 &other) const
1276 {
1277 return m_value != other.m_value;
1278 }
1279
1281 bool operator<(const P2 &other) const
1282 {
1283 return m_value < other.m_value;
1284 }
1285
1287 bool operator>(const P2 &other) const
1288 {
1289 return m_value > other.m_value;
1290 }
1291
1293 bool operator<=(const P2 &other) const
1294 {
1295 return m_value <= other.m_value;
1296 }
1297
1299 bool operator>=(const P2 &other) const
1300 {
1301 return m_value >= other.m_value;
1302 }
1303
1305 friend std::ostream &operator<<(std::ostream &stream, const P2 &value)
1306 {
1307 return stream << value.toString();
1308 }
1309
1310 private:
1311 void setFromString(const std::string &value);
1312
1313 double m_value{ 0.0 };
1314
1315 friend struct DataModel::Detail::Befriend<P2>;
1316 };
1317
1318 using Descendants = std::tuple<
1324
1327
1343#ifndef NO_DOC
1344 template<
1345 typename... Args,
1346 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1347 typename std::enable_if<
1348 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
1349 value,
1350 int>::type = 0>
1351#else
1352 template<typename... Args>
1353#endif
1354 explicit Distortion(Args &&...args)
1355 {
1356 using namespace Zivid::Detail::TypeTraits;
1357
1358 static_assert(
1359 AllArgsDecayedAreUnique<Args...>::value,
1360 "Found duplicate types among the arguments passed to Distortion(...). "
1361 "Types should be listed at most once.");
1362
1363 set(std::forward<Args>(args)...);
1364 }
1365
1380#ifndef NO_DOC
1381 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1382#else
1383 template<typename... Args>
1384#endif
1385 void set(Args &&...args)
1386 {
1387 using namespace Zivid::Detail::TypeTraits;
1388
1389 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1390 static_assert(
1391 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
1392
1393 static_assert(
1394 AllArgsDecayedAreUnique<Args...>::value,
1395 "Found duplicate types among the arguments passed to set(...). "
1396 "Types should be listed at most once.");
1397
1398 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1399 }
1400
1416#ifndef NO_DOC
1417 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1418#else
1419 template<typename... Args>
1420#endif
1421 Distortion copyWith(Args &&...args) const
1422 {
1423 using namespace Zivid::Detail::TypeTraits;
1424
1425 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1426 static_assert(
1427 AllArgsAreDescendantNodes::value,
1428 "All arguments passed to copyWith(...) must be descendant nodes.");
1429
1430 static_assert(
1431 AllArgsDecayedAreUnique<Args...>::value,
1432 "Found duplicate types among the arguments passed to copyWith(...). "
1433 "Types should be listed at most once.");
1434
1435 auto copy{ *this };
1436 copy.set(std::forward<Args>(args)...);
1437 return copy;
1438 }
1439
1441 const K1 &k1() const
1442 {
1443 return m_k1;
1444 }
1445
1448 {
1449 return m_k1;
1450 }
1451
1453 Distortion &set(const K1 &value)
1454 {
1455 m_k1 = value;
1456 return *this;
1457 }
1458
1460 const K2 &k2() const
1461 {
1462 return m_k2;
1463 }
1464
1467 {
1468 return m_k2;
1469 }
1470
1472 Distortion &set(const K2 &value)
1473 {
1474 m_k2 = value;
1475 return *this;
1476 }
1477
1479 const K3 &k3() const
1480 {
1481 return m_k3;
1482 }
1483
1486 {
1487 return m_k3;
1488 }
1489
1491 Distortion &set(const K3 &value)
1492 {
1493 m_k3 = value;
1494 return *this;
1495 }
1496
1498 const P1 &p1() const
1499 {
1500 return m_p1;
1501 }
1502
1505 {
1506 return m_p1;
1507 }
1508
1510 Distortion &set(const P1 &value)
1511 {
1512 m_p1 = value;
1513 return *this;
1514 }
1515
1517 const P2 &p2() const
1518 {
1519 return m_p2;
1520 }
1521
1524 {
1525 return m_p2;
1526 }
1527
1529 Distortion &set(const P2 &value)
1530 {
1531 m_p2 = value;
1532 return *this;
1533 }
1534
1535 template<
1536 typename T,
1537 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K1>::value, int>::type = 0>
1539 {
1540 return m_k1;
1541 }
1542
1543 template<
1544 typename T,
1545 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K2>::value, int>::type = 0>
1547 {
1548 return m_k2;
1549 }
1550
1551 template<
1552 typename T,
1553 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K3>::value, int>::type = 0>
1555 {
1556 return m_k3;
1557 }
1558
1559 template<
1560 typename T,
1561 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P1>::value, int>::type = 0>
1563 {
1564 return m_p1;
1565 }
1566
1567 template<
1568 typename T,
1569 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P2>::value, int>::type = 0>
1571 {
1572 return m_p2;
1573 }
1574
1575 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1577 {
1578 return m_k1;
1579 }
1580
1581 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1583 {
1584 return m_k2;
1585 }
1586
1587 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
1589 {
1590 return m_k3;
1591 }
1592
1593 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
1595 {
1596 return m_p1;
1597 }
1598
1599 template<size_t i, typename std::enable_if<i == 4, int>::type = 0>
1601 {
1602 return m_p2;
1603 }
1604
1606 template<typename F>
1607 void forEach(const F &f) const
1608 {
1609 f(m_k1);
1610 f(m_k2);
1611 f(m_k3);
1612 f(m_p1);
1613 f(m_p2);
1614 }
1615
1617 template<typename F>
1618 void forEach(const F &f)
1619 {
1620 f(m_k1);
1621 f(m_k2);
1622 f(m_k3);
1623 f(m_p1);
1624 f(m_p2);
1625 }
1626
1628 bool operator==(const Distortion &other) const;
1629
1631 bool operator!=(const Distortion &other) const;
1632
1634 std::string toString() const;
1635
1637 friend std::ostream &operator<<(std::ostream &stream, const Distortion &value)
1638 {
1639 return stream << value.toString();
1640 }
1641
1642 private:
1643 void setFromString(const std::string &value);
1644
1645 void setFromString(const std::string &fullPath, const std::string &value);
1646
1647 std::string getString(const std::string &fullPath) const;
1648
1649 K1 m_k1;
1650 K2 m_k2;
1651 K3 m_k3;
1652 P1 m_p1;
1653 P2 m_p2;
1654
1655 friend struct DataModel::Detail::Befriend<Distortion>;
1656 };
1657
1658 using Descendants = std::tuple<
1670
1673
1675 explicit CameraIntrinsics(const std::string &fileName);
1676
1698#ifndef NO_DOC
1699 template<
1700 typename... Args,
1701 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1702 typename std::enable_if<
1703 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
1704 int>::type = 0>
1705#else
1706 template<typename... Args>
1707#endif
1708 explicit CameraIntrinsics(Args &&...args)
1709 {
1710 using namespace Zivid::Detail::TypeTraits;
1711
1712 static_assert(
1713 AllArgsDecayedAreUnique<Args...>::value,
1714 "Found duplicate types among the arguments passed to CameraIntrinsics(...). "
1715 "Types should be listed at most once.");
1716
1717 set(std::forward<Args>(args)...);
1718 }
1719
1740#ifndef NO_DOC
1741 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1742#else
1743 template<typename... Args>
1744#endif
1745 void set(Args &&...args)
1746 {
1747 using namespace Zivid::Detail::TypeTraits;
1748
1749 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1750 static_assert(
1751 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
1752
1753 static_assert(
1754 AllArgsDecayedAreUnique<Args...>::value,
1755 "Found duplicate types among the arguments passed to set(...). "
1756 "Types should be listed at most once.");
1757
1758 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1759 }
1760
1782#ifndef NO_DOC
1783 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1784#else
1785 template<typename... Args>
1786#endif
1787 CameraIntrinsics copyWith(Args &&...args) const
1788 {
1789 using namespace Zivid::Detail::TypeTraits;
1790
1791 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1792 static_assert(
1793 AllArgsAreDescendantNodes::value, "All arguments passed to copyWith(...) must be descendant nodes.");
1794
1795 static_assert(
1796 AllArgsDecayedAreUnique<Args...>::value,
1797 "Found duplicate types among the arguments passed to copyWith(...). "
1798 "Types should be listed at most once.");
1799
1800 auto copy{ *this };
1801 copy.set(std::forward<Args>(args)...);
1802 return copy;
1803 }
1804
1807 {
1808 return m_cameraMatrix;
1809 }
1810
1813 {
1814 return m_cameraMatrix;
1815 }
1816
1819 {
1820 m_cameraMatrix = value;
1821 return *this;
1822 }
1823
1826 {
1827 m_cameraMatrix.set(value);
1828 return *this;
1829 }
1830
1833 {
1834 m_cameraMatrix.set(value);
1835 return *this;
1836 }
1837
1840 {
1841 m_cameraMatrix.set(value);
1842 return *this;
1843 }
1844
1847 {
1848 m_cameraMatrix.set(value);
1849 return *this;
1850 }
1851
1853 const Distortion &distortion() const
1854 {
1855 return m_distortion;
1856 }
1857
1860 {
1861 return m_distortion;
1862 }
1863
1866 {
1867 m_distortion = value;
1868 return *this;
1869 }
1870
1873 {
1874 m_distortion.set(value);
1875 return *this;
1876 }
1877
1880 {
1881 m_distortion.set(value);
1882 return *this;
1883 }
1884
1887 {
1888 m_distortion.set(value);
1889 return *this;
1890 }
1891
1894 {
1895 m_distortion.set(value);
1896 return *this;
1897 }
1898
1901 {
1902 m_distortion.set(value);
1903 return *this;
1904 }
1905
1906 template<
1907 typename T,
1908 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix>::value, int>::type = 0>
1910 {
1911 return m_cameraMatrix;
1912 }
1913
1914 template<
1915 typename T,
1916 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CX>::value, int>::type = 0>
1918 {
1919 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::CX>();
1920 }
1921
1922 template<
1923 typename T,
1924 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CY>::value, int>::type = 0>
1926 {
1927 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::CY>();
1928 }
1929
1930 template<
1931 typename T,
1932 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FX>::value, int>::type = 0>
1934 {
1935 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::FX>();
1936 }
1937
1938 template<
1939 typename T,
1940 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FY>::value, int>::type = 0>
1942 {
1943 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::FY>();
1944 }
1945
1946 template<
1947 typename T,
1948 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion>::value, int>::type = 0>
1950 {
1951 return m_distortion;
1952 }
1953
1954 template<
1955 typename T,
1956 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K1>::value, int>::type = 0>
1958 {
1959 return m_distortion.get<CameraIntrinsics::Distortion::K1>();
1960 }
1961
1962 template<
1963 typename T,
1964 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K2>::value, int>::type = 0>
1966 {
1967 return m_distortion.get<CameraIntrinsics::Distortion::K2>();
1968 }
1969
1970 template<
1971 typename T,
1972 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K3>::value, int>::type = 0>
1974 {
1975 return m_distortion.get<CameraIntrinsics::Distortion::K3>();
1976 }
1977
1978 template<
1979 typename T,
1980 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P1>::value, int>::type = 0>
1982 {
1983 return m_distortion.get<CameraIntrinsics::Distortion::P1>();
1984 }
1985
1986 template<
1987 typename T,
1988 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P2>::value, int>::type = 0>
1990 {
1991 return m_distortion.get<CameraIntrinsics::Distortion::P2>();
1992 }
1993
1994 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1996 {
1997 return m_cameraMatrix;
1998 }
1999
2000 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
2002 {
2003 return m_distortion;
2004 }
2005
2007 template<typename F>
2008 void forEach(const F &f) const
2009 {
2010 f(m_cameraMatrix);
2011 f(m_distortion);
2012 }
2013
2015 template<typename F>
2016 void forEach(const F &f)
2017 {
2018 f(m_cameraMatrix);
2019 f(m_distortion);
2020 }
2021
2023 bool operator==(const CameraIntrinsics &other) const;
2024
2026 bool operator!=(const CameraIntrinsics &other) const;
2027
2029 std::string toString() const;
2030
2032 friend std::ostream &operator<<(std::ostream &stream, const CameraIntrinsics &value)
2033 {
2034 return stream << value.toString();
2035 }
2036
2038 void save(const std::string &fileName) const;
2039
2041 void load(const std::string &fileName);
2042
2043 private:
2044 void setFromString(const std::string &value);
2045
2046 void setFromString(const std::string &fullPath, const std::string &value);
2047
2048 std::string getString(const std::string &fullPath) const;
2049
2050 CameraMatrix m_cameraMatrix;
2051 Distortion m_distortion;
2052
2053 friend struct DataModel::Detail::Befriend<CameraIntrinsics>;
2054 };
2055
2056#ifndef NO_DOC
2058 namespace Detail
2059 {
2060 ZIVID_CORE_EXPORT void save(const CameraIntrinsics &dataModel, std::ostream &ostream);
2061 ZIVID_CORE_EXPORT void load(CameraIntrinsics &dataModel, std::istream &istream);
2062 } // namespace Detail
2063#endif
2064
2065#ifndef NO_DOC
2066 template<>
2067 struct CameraIntrinsics::Version<1>
2068 {
2069 using Type = CameraIntrinsics;
2070 };
2071#endif
2072
2073} // namespace Zivid
2074
2075#ifdef _MSC_VER
2076# pragma warning(pop)
2077#endif
2078
2079#ifndef NO_DOC
2080# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
2081namespace std // NOLINT
2082{
2083
2084 template<>
2085 struct tuple_size<Zivid::CameraIntrinsics::CameraMatrix> : integral_constant<size_t, 4>
2086 {};
2087
2088 template<size_t i>
2089 struct tuple_element<i, Zivid::CameraIntrinsics::CameraMatrix>
2090 {
2091 static_assert(i < tuple_size<Zivid::CameraIntrinsics::CameraMatrix>::value, "Index must be less than 4");
2092
2093 using type // NOLINT
2094 = decltype(declval<Zivid::CameraIntrinsics::CameraMatrix>().get<i>());
2095 };
2096
2097 template<>
2098 struct tuple_size<Zivid::CameraIntrinsics::Distortion> : integral_constant<size_t, 5>
2099 {};
2100
2101 template<size_t i>
2102 struct tuple_element<i, Zivid::CameraIntrinsics::Distortion>
2103 {
2104 static_assert(i < tuple_size<Zivid::CameraIntrinsics::Distortion>::value, "Index must be less than 5");
2105
2106 using type // NOLINT
2107 = decltype(declval<Zivid::CameraIntrinsics::Distortion>().get<i>());
2108 };
2109
2110 template<>
2111 struct tuple_size<Zivid::CameraIntrinsics> : integral_constant<size_t, 2>
2112 {};
2113
2114 template<size_t i>
2115 struct tuple_element<i, Zivid::CameraIntrinsics>
2116 {
2117 static_assert(i < tuple_size<Zivid::CameraIntrinsics>::value, "Index must be less than 2");
2118
2119 using type // NOLINT
2120 = decltype(declval<Zivid::CameraIntrinsics>().get<i>());
2121 };
2122
2123} // namespace std
2124# endif
2125#endif
2126
2127// If we have access to the DataModel library, automatically include internal DataModel
2128// header. This header is necessary for serialization and deserialization.
2129#if defined(__has_include) && !defined(NO_DOC)
2130# if __has_include("Zivid/CameraIntrinsicsInternal.h") && __has_include("Zivid/DataModelNodeMetaData.h")
2131# include "Zivid/CameraIntrinsicsInternal.h"
2132# endif
2133#endif
#define ZIVID_CORE_EXPORT
Definition: CoreExport.h:101
x coordinate of the principal point
Definition: CameraIntrinsics.h:177
bool operator==(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:217
std::string toString() const
Get the value as string
bool operator<(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:229
bool operator>=(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:247
constexpr CX(double value)
Constructor
Definition: CameraIntrinsics.h:206
bool operator>(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:235
bool operator!=(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:223
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:253
static constexpr Range< double > validRange()
The range of valid values for CX
Definition: CameraIntrinsics.h:197
bool operator<=(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:241
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:194
y coordinate of the principal point
Definition: CameraIntrinsics.h:270
friend std::ostream & operator<<(std::ostream &stream, const CY &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:346
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:287
bool operator<=(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:334
bool operator>(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:328
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:290
bool operator!=(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:316
std::string toString() const
Get the value as string
bool operator==(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:310
bool operator<(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:322
constexpr CY(double value)
Constructor
Definition: CameraIntrinsics.h:299
bool operator>=(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:340
Focal length in x
Definition: CameraIntrinsics.h:363
static constexpr Range< double > validRange()
The range of valid values for FX
Definition: CameraIntrinsics.h:381
double value() const
Get the value
FX()=default
Default constructor
bool operator!=(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:407
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:378
constexpr FX(double value)
Constructor
Definition: CameraIntrinsics.h:390
bool operator==(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:401
bool operator>(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:419
bool operator<=(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:425
bool operator>=(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:431
friend std::ostream & operator<<(std::ostream &stream, const FX &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:437
std::string toString() const
Get the value as string
bool operator<(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:413
Focal length in y
Definition: CameraIntrinsics.h:454
bool operator>(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:510
bool operator!=(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:498
bool operator==(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:492
FY()=default
Default constructor
static constexpr Range< double > validRange()
The range of valid values for FY
Definition: CameraIntrinsics.h:472
double value() const
Get the value
bool operator<(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:504
friend std::ostream & operator<<(std::ostream &stream, const FY &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:528
std::string toString() const
Get the value as string
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:469
bool operator>=(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:522
constexpr FY(double value)
Constructor
Definition: CameraIntrinsics.h:481
bool operator<=(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:516
The camera matrix K (=[fx,0,cx;0,fy,cy;0,0,1])
Definition: CameraIntrinsics.h:157
const FX & fx() const
Get FX
Definition: CameraIntrinsics.h:698
const CameraIntrinsics::CameraMatrix::CX & get() const
Definition: CameraIntrinsics.h:738
void set(Args &&...args)
Set multiple arguments
Definition: CameraIntrinsics.h:605
CameraMatrix & set(const CY &value)
Set CY
Definition: CameraIntrinsics.h:691
const CameraIntrinsics::CameraMatrix::FX & get() const
Definition: CameraIntrinsics.h:754
bool operator!=(const CameraMatrix &other) const
Inequality operator
const CY & cy() const
Get CY
Definition: CameraIntrinsics.h:679
std::tuple< CameraIntrinsics::CameraMatrix::CX, CameraIntrinsics::CameraMatrix::CY, CameraIntrinsics::CameraMatrix::FX, CameraIntrinsics::CameraMatrix::FY > Descendants
Definition: CameraIntrinsics.h:545
const CameraIntrinsics::CameraMatrix::FY & get() const
Definition: CameraIntrinsics.h:762
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:821
CameraMatrix & set(const CX &value)
Set CX
Definition: CameraIntrinsics.h:672
const CameraIntrinsics::CameraMatrix::CY & get() const
Definition: CameraIntrinsics.h:746
CameraMatrix & set(const FY &value)
Set FY
Definition: CameraIntrinsics.h:729
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:793
CameraMatrix & set(const FX &value)
Set FX
Definition: CameraIntrinsics.h:710
FY & fy()
Get FY
Definition: CameraIntrinsics.h:723
CameraMatrix(Args &&...args)
Constructor taking variadic number of arguments
Definition: CameraIntrinsics.h:575
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:640
CX & cx()
Get CX
Definition: CameraIntrinsics.h:666
const FY & fy() const
Get FY
Definition: CameraIntrinsics.h:717
const CX & cx() const
Get CX
Definition: CameraIntrinsics.h:660
CY & cy()
Get CY
Definition: CameraIntrinsics.h:685
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter
Definition: CameraIntrinsics.h:803
FX & fx()
Get FX
Definition: CameraIntrinsics.h:704
First radial distortion term
Definition: CameraIntrinsics.h:865
bool operator<(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:915
K1()=default
Default constructor
bool operator!=(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:909
friend std::ostream & operator<<(std::ostream &stream, const K1 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:939
bool operator>(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:921
constexpr K1(double value)
Constructor
Definition: CameraIntrinsics.h:892
bool operator>=(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:933
bool operator<=(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:927
static constexpr Range< double > validRange()
The range of valid values for K1
Definition: CameraIntrinsics.h:883
bool operator==(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:903
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:880
Second radial distortion term
Definition: CameraIntrinsics.h:956
bool operator>=(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1024
static constexpr Range< double > validRange()
The range of valid values for K2
Definition: CameraIntrinsics.h:974
bool operator>(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1012
bool operator!=(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1000
std::string toString() const
Get the value as string
bool operator==(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:994
bool operator<(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1006
friend std::ostream & operator<<(std::ostream &stream, const K2 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:1030
K2()=default
Default constructor
bool operator<=(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1018
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:971
constexpr K2(double value)
Constructor
Definition: CameraIntrinsics.h:983
double value() const
Get the value
Third radial distortion term
Definition: CameraIntrinsics.h:1047
bool operator<(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1097
double value() const
Get the value
static constexpr Range< double > validRange()
The range of valid values for K3
Definition: CameraIntrinsics.h:1065
K3()=default
Default constructor
std::string toString() const
Get the value as string
constexpr K3(double value)
Constructor
Definition: CameraIntrinsics.h:1074
bool operator>(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1103
bool operator<=(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1109
bool operator>=(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1115
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:1062
bool operator!=(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1091
friend std::ostream & operator<<(std::ostream &stream, const K3 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:1121
bool operator==(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1085
First tangential distortion term
Definition: CameraIntrinsics.h:1138
bool operator>(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1194
static constexpr Range< double > validRange()
The range of valid values for P1
Definition: CameraIntrinsics.h:1156
bool operator==(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1176
bool operator>=(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1206
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:1212
bool operator<(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1188
P1()=default
Default constructor
bool operator<=(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1200
double value() const
Get the value
constexpr P1(double value)
Constructor
Definition: CameraIntrinsics.h:1165
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:1153
bool operator!=(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1182
Second tangential distortion term
Definition: CameraIntrinsics.h:1229
static constexpr Range< double > validRange()
The range of valid values for P2
Definition: CameraIntrinsics.h:1249
bool operator==(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1269
friend std::ostream & operator<<(std::ostream &stream, const P2 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:1305
bool operator>(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1287
constexpr P2(double value)
Constructor
Definition: CameraIntrinsics.h:1258
P2()=default
Default constructor
double value() const
Get the value
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:1246
std::string toString() const
Get the value as string
bool operator<(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1281
bool operator>=(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1299
bool operator<=(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1293
bool operator!=(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1275
The radial and tangential distortion parameters
Definition: CameraIntrinsics.h:845
const CameraIntrinsics::Distortion::K3 & get() const
Definition: CameraIntrinsics.h:1554
Distortion(Args &&...args)
Constructor taking variadic number of arguments
Definition: CameraIntrinsics.h:1354
const P2 & p2() const
Get P2
Definition: CameraIntrinsics.h:1517
K3 & k3()
Get K3
Definition: CameraIntrinsics.h:1485
const K2 & k2() const
Get K2
Definition: CameraIntrinsics.h:1460
std::tuple< CameraIntrinsics::Distortion::K1, CameraIntrinsics::Distortion::K2, CameraIntrinsics::Distortion::K3, CameraIntrinsics::Distortion::P1, CameraIntrinsics::Distortion::P2 > Descendants
Definition: CameraIntrinsics.h:1323
void set(Args &&...args)
Set multiple arguments
Definition: CameraIntrinsics.h:1385
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:1421
Distortion & set(const K2 &value)
Set K2
Definition: CameraIntrinsics.h:1472
K1 & k1()
Get K1
Definition: CameraIntrinsics.h:1447
std::string toString() const
Get the value as string
P1 & p1()
Get P1
Definition: CameraIntrinsics.h:1504
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:1618
const CameraIntrinsics::Distortion::K2 & get() const
Definition: CameraIntrinsics.h:1546
const CameraIntrinsics::Distortion::P2 & get() const
Definition: CameraIntrinsics.h:1570
Distortion & set(const K3 &value)
Set K3
Definition: CameraIntrinsics.h:1491
const CameraIntrinsics::Distortion::P1 & get() const
Definition: CameraIntrinsics.h:1562
bool operator!=(const Distortion &other) const
Inequality operator
const P1 & p1() const
Get P1
Definition: CameraIntrinsics.h:1498
const K3 & k3() const
Get K3
Definition: CameraIntrinsics.h:1479
Distortion & set(const P1 &value)
Set P1
Definition: CameraIntrinsics.h:1510
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:1607
const CameraIntrinsics::Distortion::K1 & get() const
Definition: CameraIntrinsics.h:1538
const K1 & k1() const
Get K1
Definition: CameraIntrinsics.h:1441
Distortion & set(const P2 &value)
Set P2
Definition: CameraIntrinsics.h:1529
Distortion & set(const K1 &value)
Set K1
Definition: CameraIntrinsics.h:1453
P2 & p2()
Get P2
Definition: CameraIntrinsics.h:1523
K2 & k2()
Get K2
Definition: CameraIntrinsics.h:1466
friend std::ostream & operator<<(std::ostream &stream, const Distortion &value)
Operator to send the value as string to a stream
Definition: CameraIntrinsics.h:1637
Information about the intrinsic parameters of the camera (OpenCV model)
Definition: CameraIntrinsics.h:123
CameraIntrinsics & set(const Distortion::K3 &value)
Set Distortion::K3
Definition: CameraIntrinsics.h:1886
CameraMatrix & cameraMatrix()
Get CameraMatrix
Definition: CameraIntrinsics.h:1812
const CameraIntrinsics::CameraMatrix::CX & get() const
Definition: CameraIntrinsics.h:1917
const CameraIntrinsics::Distortion::K1 & get() const
Definition: CameraIntrinsics.h:1957
bool operator!=(const CameraIntrinsics &other) const
Inequality operator
const CameraIntrinsics::CameraMatrix::FY & get() const
Definition: CameraIntrinsics.h:1941
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:2008
CameraIntrinsics(Args &&...args)
Constructor taking variadic number of arguments
Definition: CameraIntrinsics.h:1708
std::string toString() const
Get the value as string
CameraIntrinsics & set(const Distortion::P1 &value)
Set Distortion::P1
Definition: CameraIntrinsics.h:1893
const Distortion & distortion() const
Get Distortion
Definition: CameraIntrinsics.h:1853
void set(Args &&...args)
Set multiple arguments
Definition: CameraIntrinsics.h:1745
CameraIntrinsics & set(const Distortion::K1 &value)
Set Distortion::K1
Definition: CameraIntrinsics.h:1872
const CameraIntrinsics::Distortion::K3 & get() const
Definition: CameraIntrinsics.h:1973
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:1787
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter
Definition: CameraIntrinsics.h:2016
CameraIntrinsics()
Default constructor
CameraIntrinsics & set(const CameraMatrix::FY &value)
Set CameraMatrix::FY
Definition: CameraIntrinsics.h:1846
void load(const std::string &fileName)
Load from the given file
const CameraIntrinsics::Distortion::P1 & get() const
Definition: CameraIntrinsics.h:1981
bool operator==(const CameraIntrinsics &other) const
Equality operator
CameraIntrinsics & set(const CameraMatrix::CY &value)
Set CameraMatrix::CY
Definition: CameraIntrinsics.h:1832
CameraIntrinsics(const std::string &fileName)
Construct CameraIntrinsics by loading from file
CameraIntrinsics & set(const CameraMatrix &value)
Set CameraMatrix
Definition: CameraIntrinsics.h:1818
CameraIntrinsics & set(const Distortion::P2 &value)
Set Distortion::P2
Definition: CameraIntrinsics.h:1900
CameraIntrinsics & set(const Distortion &value)
Set Distortion
Definition: CameraIntrinsics.h:1865
const CameraIntrinsics::CameraMatrix::CY & get() const
Definition: CameraIntrinsics.h:1925
CameraIntrinsics & set(const CameraMatrix::CX &value)
Set CameraMatrix::CX
Definition: CameraIntrinsics.h:1825
void save(const std::string &fileName) const
Save to the given file
CameraIntrinsics & set(const CameraMatrix::FX &value)
Set CameraMatrix::FX
Definition: CameraIntrinsics.h:1839
const CameraIntrinsics::CameraMatrix & get() const
Definition: CameraIntrinsics.h:1909
const CameraIntrinsics::Distortion::K2 & get() const
Definition: CameraIntrinsics.h:1965
const CameraMatrix & cameraMatrix() const
Get CameraMatrix
Definition: CameraIntrinsics.h:1806
const CameraIntrinsics::Distortion::P2 & get() const
Definition: CameraIntrinsics.h:1989
const CameraIntrinsics::Distortion & get() const
Definition: CameraIntrinsics.h:1949
friend std::ostream & operator<<(std::ostream &stream, const CameraIntrinsics &value)
Operator to send the value as string to a stream
Definition: CameraIntrinsics.h:2032
const CameraIntrinsics::CameraMatrix::FX & get() const
Definition: CameraIntrinsics.h:1933
Distortion & distortion()
Get Distortion
Definition: CameraIntrinsics.h:1859
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:1669
CameraIntrinsics & set(const Distortion::K2 &value)
Set Distortion::K2
Definition: CameraIntrinsics.h:1879
Class describing a range of values for a given type T
Definition: Range.h:118
NodeType
Definition: NodeType.h:100
The main Zivid namespace. All Zivid code is found here
Definition: Application.h:99