Zivid C++ API 2.13.1+18e79e79-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
65#include "Zivid/Range.h"
66
67#ifdef _MSC_VER
68# pragma warning(push)
69# pragma warning(disable : 4251) // "X needs to have dll-interface to be used by clients of class Y."
70#endif
71
72namespace Zivid
73{
74
76
77 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
79 {
80 public:
82 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
83
85 static constexpr const char *path{ "" };
86
88 static constexpr const char *name{ "CameraIntrinsics" };
89
91 static constexpr const char *description{
92 R"description(Information about the intrinsic parameters of the camera (OpenCV model))description"
93 };
94
95 static constexpr size_t version{ 1 };
96
97#ifndef NO_DOC
98 template<size_t>
99 struct Version;
100
101 using LatestVersion = Zivid::CameraIntrinsics;
102
103 // Short identifier. This value is not guaranteed to be universally unique
104 // Todo(ZIVID-2808): Move this to internal DataModelExt header
105 static constexpr std::array<uint8_t, 3> binaryId{ 'c', 'i', 'n' };
106
107#endif
108
110
111 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
113 {
114 public:
116 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
117
119 static constexpr const char *path{ "CameraMatrix" };
120
122 static constexpr const char *name{ "CameraMatrix" };
123
125 static constexpr const char *description{
126 R"description(The camera matrix K (=[fx,0,cx;0,fy,cy;0,0,1]))description"
127 };
128
130
131 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
133 {
134 public:
136 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
137
139 static constexpr const char *path{ "CameraMatrix/CX" };
140
142 static constexpr const char *name{ "CX" };
143
145 static constexpr const char *description{
146 R"description(x coordinate of the principal point)description"
147 };
148
150 using ValueType = double;
151
153 static constexpr Range<double> validRange()
154 {
155 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
156 }
157
159 CX() = default;
160
162 explicit constexpr CX(double value)
163 : m_value{ value }
164 {}
165
167 double value() const;
168
170 std::string toString() const;
171
173 bool operator==(const CX &other) const
174 {
175 return m_value == other.m_value;
176 }
177
179 bool operator!=(const CX &other) const
180 {
181 return m_value != other.m_value;
182 }
183
185 bool operator<(const CX &other) const
186 {
187 return m_value < other.m_value;
188 }
189
191 bool operator>(const CX &other) const
192 {
193 return m_value > other.m_value;
194 }
195
197 bool operator<=(const CX &other) const
198 {
199 return m_value <= other.m_value;
200 }
201
203 bool operator>=(const CX &other) const
204 {
205 return m_value >= other.m_value;
206 }
207
209 friend std::ostream &operator<<(std::ostream &stream, const CX &value)
210 {
211 return stream << value.toString();
212 }
213
214 private:
215 void setFromString(const std::string &value);
216
217 double m_value{ 0.0 };
218
219 friend struct DataModel::Detail::Befriend<CX>;
220 };
221
223
224 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
226 {
227 public:
229 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
230
232 static constexpr const char *path{ "CameraMatrix/CY" };
233
235 static constexpr const char *name{ "CY" };
236
238 static constexpr const char *description{
239 R"description(y coordinate of the principal point)description"
240 };
241
243 using ValueType = double;
244
246 static constexpr Range<double> validRange()
247 {
248 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
249 }
250
252 CY() = default;
253
255 explicit constexpr CY(double value)
256 : m_value{ value }
257 {}
258
260 double value() const;
261
263 std::string toString() const;
264
266 bool operator==(const CY &other) const
267 {
268 return m_value == other.m_value;
269 }
270
272 bool operator!=(const CY &other) const
273 {
274 return m_value != other.m_value;
275 }
276
278 bool operator<(const CY &other) const
279 {
280 return m_value < other.m_value;
281 }
282
284 bool operator>(const CY &other) const
285 {
286 return m_value > other.m_value;
287 }
288
290 bool operator<=(const CY &other) const
291 {
292 return m_value <= other.m_value;
293 }
294
296 bool operator>=(const CY &other) const
297 {
298 return m_value >= other.m_value;
299 }
300
302 friend std::ostream &operator<<(std::ostream &stream, const CY &value)
303 {
304 return stream << value.toString();
305 }
306
307 private:
308 void setFromString(const std::string &value);
309
310 double m_value{ 0.0 };
311
312 friend struct DataModel::Detail::Befriend<CY>;
313 };
314
316
317 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
319 {
320 public:
322 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
323
325 static constexpr const char *path{ "CameraMatrix/FX" };
326
328 static constexpr const char *name{ "FX" };
329
331 static constexpr const char *description{ R"description(Focal length in x)description" };
332
334 using ValueType = double;
335
337 static constexpr Range<double> validRange()
338 {
339 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
340 }
341
343 FX() = default;
344
346 explicit constexpr FX(double value)
347 : m_value{ value }
348 {}
349
351 double value() const;
352
354 std::string toString() const;
355
357 bool operator==(const FX &other) const
358 {
359 return m_value == other.m_value;
360 }
361
363 bool operator!=(const FX &other) const
364 {
365 return m_value != other.m_value;
366 }
367
369 bool operator<(const FX &other) const
370 {
371 return m_value < other.m_value;
372 }
373
375 bool operator>(const FX &other) const
376 {
377 return m_value > other.m_value;
378 }
379
381 bool operator<=(const FX &other) const
382 {
383 return m_value <= other.m_value;
384 }
385
387 bool operator>=(const FX &other) const
388 {
389 return m_value >= other.m_value;
390 }
391
393 friend std::ostream &operator<<(std::ostream &stream, const FX &value)
394 {
395 return stream << value.toString();
396 }
397
398 private:
399 void setFromString(const std::string &value);
400
401 double m_value{ 0.0 };
402
403 friend struct DataModel::Detail::Befriend<FX>;
404 };
405
407
408 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
410 {
411 public:
413 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
414
416 static constexpr const char *path{ "CameraMatrix/FY" };
417
419 static constexpr const char *name{ "FY" };
420
422 static constexpr const char *description{ R"description(Focal length in y)description" };
423
425 using ValueType = double;
426
428 static constexpr Range<double> validRange()
429 {
430 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
431 }
432
434 FY() = default;
435
437 explicit constexpr FY(double value)
438 : m_value{ value }
439 {}
440
442 double value() const;
443
445 std::string toString() const;
446
448 bool operator==(const FY &other) const
449 {
450 return m_value == other.m_value;
451 }
452
454 bool operator!=(const FY &other) const
455 {
456 return m_value != other.m_value;
457 }
458
460 bool operator<(const FY &other) const
461 {
462 return m_value < other.m_value;
463 }
464
466 bool operator>(const FY &other) const
467 {
468 return m_value > other.m_value;
469 }
470
472 bool operator<=(const FY &other) const
473 {
474 return m_value <= other.m_value;
475 }
476
478 bool operator>=(const FY &other) const
479 {
480 return m_value >= other.m_value;
481 }
482
484 friend std::ostream &operator<<(std::ostream &stream, const FY &value)
485 {
486 return stream << value.toString();
487 }
488
489 private:
490 void setFromString(const std::string &value);
491
492 double m_value{ 0.0 };
493
494 friend struct DataModel::Detail::Befriend<FY>;
495 };
496
497 using Descendants = std::tuple<
502
505
520#ifndef NO_DOC
521 template<
522 typename... Args,
523 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
524 typename std::enable_if<
525 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
526 value,
527 int>::type = 0>
528#else
529 template<typename... Args>
530#endif
531 explicit CameraMatrix(Args &&...args)
532 {
533 using namespace Zivid::Detail::TypeTraits;
534
535 static_assert(
536 AllArgsDecayedAreUnique<Args...>::value,
537 "Found duplicate types among the arguments passed to CameraMatrix(...). "
538 "Types should be listed at most once.");
539
540 set(std::forward<Args>(args)...);
541 }
542
556#ifndef NO_DOC
557 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
558#else
559 template<typename... Args>
560#endif
561 void set(Args &&...args)
562 {
563 using namespace Zivid::Detail::TypeTraits;
564
565 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
566 static_assert(
567 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
568
569 static_assert(
570 AllArgsDecayedAreUnique<Args...>::value,
571 "Found duplicate types among the arguments passed to set(...). "
572 "Types should be listed at most once.");
573
574 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
575 }
576
591#ifndef NO_DOC
592 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
593#else
594 template<typename... Args>
595#endif
596 CameraMatrix copyWith(Args &&...args) const
597 {
598 using namespace Zivid::Detail::TypeTraits;
599
600 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
601 static_assert(
602 AllArgsAreDescendantNodes::value,
603 "All arguments passed to copyWith(...) must be descendant nodes.");
604
605 static_assert(
606 AllArgsDecayedAreUnique<Args...>::value,
607 "Found duplicate types among the arguments passed to copyWith(...). "
608 "Types should be listed at most once.");
609
610 auto copy{ *this };
611 copy.set(std::forward<Args>(args)...);
612 return copy;
613 }
614
616 const CX &cx() const
617 {
618 return m_cx;
619 }
620
623 {
624 return m_cx;
625 }
626
628 CameraMatrix &set(const CX &value)
629 {
630 m_cx = value;
631 return *this;
632 }
633
635 const CY &cy() const
636 {
637 return m_cy;
638 }
639
642 {
643 return m_cy;
644 }
645
647 CameraMatrix &set(const CY &value)
648 {
649 m_cy = value;
650 return *this;
651 }
652
654 const FX &fx() const
655 {
656 return m_fx;
657 }
658
661 {
662 return m_fx;
663 }
664
666 CameraMatrix &set(const FX &value)
667 {
668 m_fx = value;
669 return *this;
670 }
671
673 const FY &fy() const
674 {
675 return m_fy;
676 }
677
680 {
681 return m_fy;
682 }
683
685 CameraMatrix &set(const FY &value)
686 {
687 m_fy = value;
688 return *this;
689 }
690
691 template<
692 typename T,
693 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CX>::value, int>::type = 0>
695 {
696 return m_cx;
697 }
698
699 template<
700 typename T,
701 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CY>::value, int>::type = 0>
703 {
704 return m_cy;
705 }
706
707 template<
708 typename T,
709 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FX>::value, int>::type = 0>
711 {
712 return m_fx;
713 }
714
715 template<
716 typename T,
717 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FY>::value, int>::type = 0>
719 {
720 return m_fy;
721 }
722
723 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
725 {
726 return m_cx;
727 }
728
729 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
731 {
732 return m_cy;
733 }
734
735 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
737 {
738 return m_fx;
739 }
740
741 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
743 {
744 return m_fy;
745 }
746
748 template<typename F>
749 void forEach(const F &f) const
750 {
751 f(m_cx);
752 f(m_cy);
753 f(m_fx);
754 f(m_fy);
755 }
756
758 template<typename F>
759 void forEach(const F &f)
760 {
761 f(m_cx);
762 f(m_cy);
763 f(m_fx);
764 f(m_fy);
765 }
766
768 bool operator==(const CameraMatrix &other) const;
769
771 bool operator!=(const CameraMatrix &other) const;
772
774 std::string toString() const;
775
777 friend std::ostream &operator<<(std::ostream &stream, const CameraMatrix &value)
778 {
779 return stream << value.toString();
780 }
781
782 private:
783 void setFromString(const std::string &value);
784
785 void setFromString(const std::string &fullPath, const std::string &value);
786
787 std::string getString(const std::string &fullPath) const;
788
789 CX m_cx;
790 CY m_cy;
791 FX m_fx;
792 FY m_fy;
793
794 friend struct DataModel::Detail::Befriend<CameraMatrix>;
795 };
796
798
799 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
801 {
802 public:
804 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
805
807 static constexpr const char *path{ "Distortion" };
808
810 static constexpr const char *name{ "Distortion" };
811
813 static constexpr const char *description{
814 R"description(The radial and tangential distortion parameters)description"
815 };
816
818
819 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
821 {
822 public:
824 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
825
827 static constexpr const char *path{ "Distortion/K1" };
828
830 static constexpr const char *name{ "K1" };
831
833 static constexpr const char *description{ R"description(First radial distortion term)description" };
834
836 using ValueType = double;
837
839 static constexpr Range<double> validRange()
840 {
841 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
842 }
843
845 K1() = default;
846
848 explicit constexpr K1(double value)
849 : m_value{ value }
850 {}
851
853 double value() const;
854
856 std::string toString() const;
857
859 bool operator==(const K1 &other) const
860 {
861 return m_value == other.m_value;
862 }
863
865 bool operator!=(const K1 &other) const
866 {
867 return m_value != other.m_value;
868 }
869
871 bool operator<(const K1 &other) const
872 {
873 return m_value < other.m_value;
874 }
875
877 bool operator>(const K1 &other) const
878 {
879 return m_value > other.m_value;
880 }
881
883 bool operator<=(const K1 &other) const
884 {
885 return m_value <= other.m_value;
886 }
887
889 bool operator>=(const K1 &other) const
890 {
891 return m_value >= other.m_value;
892 }
893
895 friend std::ostream &operator<<(std::ostream &stream, const K1 &value)
896 {
897 return stream << value.toString();
898 }
899
900 private:
901 void setFromString(const std::string &value);
902
903 double m_value{ 0.0 };
904
905 friend struct DataModel::Detail::Befriend<K1>;
906 };
907
909
910 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
912 {
913 public:
915 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
916
918 static constexpr const char *path{ "Distortion/K2" };
919
921 static constexpr const char *name{ "K2" };
922
924 static constexpr const char *description{ R"description(Second radial distortion term)description" };
925
927 using ValueType = double;
928
930 static constexpr Range<double> validRange()
931 {
932 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
933 }
934
936 K2() = default;
937
939 explicit constexpr K2(double value)
940 : m_value{ value }
941 {}
942
944 double value() const;
945
947 std::string toString() const;
948
950 bool operator==(const K2 &other) const
951 {
952 return m_value == other.m_value;
953 }
954
956 bool operator!=(const K2 &other) const
957 {
958 return m_value != other.m_value;
959 }
960
962 bool operator<(const K2 &other) const
963 {
964 return m_value < other.m_value;
965 }
966
968 bool operator>(const K2 &other) const
969 {
970 return m_value > other.m_value;
971 }
972
974 bool operator<=(const K2 &other) const
975 {
976 return m_value <= other.m_value;
977 }
978
980 bool operator>=(const K2 &other) const
981 {
982 return m_value >= other.m_value;
983 }
984
986 friend std::ostream &operator<<(std::ostream &stream, const K2 &value)
987 {
988 return stream << value.toString();
989 }
990
991 private:
992 void setFromString(const std::string &value);
993
994 double m_value{ 0.0 };
995
996 friend struct DataModel::Detail::Befriend<K2>;
997 };
998
1000
1001 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1003 {
1004 public:
1006 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1007
1009 static constexpr const char *path{ "Distortion/K3" };
1010
1012 static constexpr const char *name{ "K3" };
1013
1015 static constexpr const char *description{ R"description(Third radial distortion term)description" };
1016
1018 using ValueType = double;
1019
1021 static constexpr Range<double> validRange()
1022 {
1023 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1024 }
1025
1027 K3() = default;
1028
1030 explicit constexpr K3(double value)
1031 : m_value{ value }
1032 {}
1033
1035 double value() const;
1036
1038 std::string toString() const;
1039
1041 bool operator==(const K3 &other) const
1042 {
1043 return m_value == other.m_value;
1044 }
1045
1047 bool operator!=(const K3 &other) const
1048 {
1049 return m_value != other.m_value;
1050 }
1051
1053 bool operator<(const K3 &other) const
1054 {
1055 return m_value < other.m_value;
1056 }
1057
1059 bool operator>(const K3 &other) const
1060 {
1061 return m_value > other.m_value;
1062 }
1063
1065 bool operator<=(const K3 &other) const
1066 {
1067 return m_value <= other.m_value;
1068 }
1069
1071 bool operator>=(const K3 &other) const
1072 {
1073 return m_value >= other.m_value;
1074 }
1075
1077 friend std::ostream &operator<<(std::ostream &stream, const K3 &value)
1078 {
1079 return stream << value.toString();
1080 }
1081
1082 private:
1083 void setFromString(const std::string &value);
1084
1085 double m_value{ 0.0 };
1086
1087 friend struct DataModel::Detail::Befriend<K3>;
1088 };
1089
1091
1092 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1094 {
1095 public:
1097 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1098
1100 static constexpr const char *path{ "Distortion/P1" };
1101
1103 static constexpr const char *name{ "P1" };
1104
1106 static constexpr const char *description{ R"description(First tangential distortion term)description" };
1107
1109 using ValueType = double;
1110
1112 static constexpr Range<double> validRange()
1113 {
1114 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1115 }
1116
1118 P1() = default;
1119
1121 explicit constexpr P1(double value)
1122 : m_value{ value }
1123 {}
1124
1126 double value() const;
1127
1129 std::string toString() const;
1130
1132 bool operator==(const P1 &other) const
1133 {
1134 return m_value == other.m_value;
1135 }
1136
1138 bool operator!=(const P1 &other) const
1139 {
1140 return m_value != other.m_value;
1141 }
1142
1144 bool operator<(const P1 &other) const
1145 {
1146 return m_value < other.m_value;
1147 }
1148
1150 bool operator>(const P1 &other) const
1151 {
1152 return m_value > other.m_value;
1153 }
1154
1156 bool operator<=(const P1 &other) const
1157 {
1158 return m_value <= other.m_value;
1159 }
1160
1162 bool operator>=(const P1 &other) const
1163 {
1164 return m_value >= other.m_value;
1165 }
1166
1168 friend std::ostream &operator<<(std::ostream &stream, const P1 &value)
1169 {
1170 return stream << value.toString();
1171 }
1172
1173 private:
1174 void setFromString(const std::string &value);
1175
1176 double m_value{ 0.0 };
1177
1178 friend struct DataModel::Detail::Befriend<P1>;
1179 };
1180
1182
1183 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1185 {
1186 public:
1188 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1189
1191 static constexpr const char *path{ "Distortion/P2" };
1192
1194 static constexpr const char *name{ "P2" };
1195
1197 static constexpr const char *description{
1198 R"description(Second tangential distortion term)description"
1199 };
1200
1202 using ValueType = double;
1203
1205 static constexpr Range<double> validRange()
1206 {
1207 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1208 }
1209
1211 P2() = default;
1212
1214 explicit constexpr P2(double value)
1215 : m_value{ value }
1216 {}
1217
1219 double value() const;
1220
1222 std::string toString() const;
1223
1225 bool operator==(const P2 &other) const
1226 {
1227 return m_value == other.m_value;
1228 }
1229
1231 bool operator!=(const P2 &other) const
1232 {
1233 return m_value != other.m_value;
1234 }
1235
1237 bool operator<(const P2 &other) const
1238 {
1239 return m_value < other.m_value;
1240 }
1241
1243 bool operator>(const P2 &other) const
1244 {
1245 return m_value > other.m_value;
1246 }
1247
1249 bool operator<=(const P2 &other) const
1250 {
1251 return m_value <= other.m_value;
1252 }
1253
1255 bool operator>=(const P2 &other) const
1256 {
1257 return m_value >= other.m_value;
1258 }
1259
1261 friend std::ostream &operator<<(std::ostream &stream, const P2 &value)
1262 {
1263 return stream << value.toString();
1264 }
1265
1266 private:
1267 void setFromString(const std::string &value);
1268
1269 double m_value{ 0.0 };
1270
1271 friend struct DataModel::Detail::Befriend<P2>;
1272 };
1273
1274 using Descendants = std::tuple<
1280
1283
1299#ifndef NO_DOC
1300 template<
1301 typename... Args,
1302 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1303 typename std::enable_if<
1304 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
1305 value,
1306 int>::type = 0>
1307#else
1308 template<typename... Args>
1309#endif
1310 explicit Distortion(Args &&...args)
1311 {
1312 using namespace Zivid::Detail::TypeTraits;
1313
1314 static_assert(
1315 AllArgsDecayedAreUnique<Args...>::value,
1316 "Found duplicate types among the arguments passed to Distortion(...). "
1317 "Types should be listed at most once.");
1318
1319 set(std::forward<Args>(args)...);
1320 }
1321
1336#ifndef NO_DOC
1337 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1338#else
1339 template<typename... Args>
1340#endif
1341 void set(Args &&...args)
1342 {
1343 using namespace Zivid::Detail::TypeTraits;
1344
1345 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1346 static_assert(
1347 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
1348
1349 static_assert(
1350 AllArgsDecayedAreUnique<Args...>::value,
1351 "Found duplicate types among the arguments passed to set(...). "
1352 "Types should be listed at most once.");
1353
1354 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1355 }
1356
1372#ifndef NO_DOC
1373 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1374#else
1375 template<typename... Args>
1376#endif
1377 Distortion copyWith(Args &&...args) const
1378 {
1379 using namespace Zivid::Detail::TypeTraits;
1380
1381 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1382 static_assert(
1383 AllArgsAreDescendantNodes::value,
1384 "All arguments passed to copyWith(...) must be descendant nodes.");
1385
1386 static_assert(
1387 AllArgsDecayedAreUnique<Args...>::value,
1388 "Found duplicate types among the arguments passed to copyWith(...). "
1389 "Types should be listed at most once.");
1390
1391 auto copy{ *this };
1392 copy.set(std::forward<Args>(args)...);
1393 return copy;
1394 }
1395
1397 const K1 &k1() const
1398 {
1399 return m_k1;
1400 }
1401
1404 {
1405 return m_k1;
1406 }
1407
1409 Distortion &set(const K1 &value)
1410 {
1411 m_k1 = value;
1412 return *this;
1413 }
1414
1416 const K2 &k2() const
1417 {
1418 return m_k2;
1419 }
1420
1423 {
1424 return m_k2;
1425 }
1426
1428 Distortion &set(const K2 &value)
1429 {
1430 m_k2 = value;
1431 return *this;
1432 }
1433
1435 const K3 &k3() const
1436 {
1437 return m_k3;
1438 }
1439
1442 {
1443 return m_k3;
1444 }
1445
1447 Distortion &set(const K3 &value)
1448 {
1449 m_k3 = value;
1450 return *this;
1451 }
1452
1454 const P1 &p1() const
1455 {
1456 return m_p1;
1457 }
1458
1461 {
1462 return m_p1;
1463 }
1464
1466 Distortion &set(const P1 &value)
1467 {
1468 m_p1 = value;
1469 return *this;
1470 }
1471
1473 const P2 &p2() const
1474 {
1475 return m_p2;
1476 }
1477
1480 {
1481 return m_p2;
1482 }
1483
1485 Distortion &set(const P2 &value)
1486 {
1487 m_p2 = value;
1488 return *this;
1489 }
1490
1491 template<
1492 typename T,
1493 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K1>::value, int>::type = 0>
1495 {
1496 return m_k1;
1497 }
1498
1499 template<
1500 typename T,
1501 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K2>::value, int>::type = 0>
1503 {
1504 return m_k2;
1505 }
1506
1507 template<
1508 typename T,
1509 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K3>::value, int>::type = 0>
1511 {
1512 return m_k3;
1513 }
1514
1515 template<
1516 typename T,
1517 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P1>::value, int>::type = 0>
1519 {
1520 return m_p1;
1521 }
1522
1523 template<
1524 typename T,
1525 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P2>::value, int>::type = 0>
1527 {
1528 return m_p2;
1529 }
1530
1531 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1533 {
1534 return m_k1;
1535 }
1536
1537 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1539 {
1540 return m_k2;
1541 }
1542
1543 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
1545 {
1546 return m_k3;
1547 }
1548
1549 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
1551 {
1552 return m_p1;
1553 }
1554
1555 template<size_t i, typename std::enable_if<i == 4, int>::type = 0>
1557 {
1558 return m_p2;
1559 }
1560
1562 template<typename F>
1563 void forEach(const F &f) const
1564 {
1565 f(m_k1);
1566 f(m_k2);
1567 f(m_k3);
1568 f(m_p1);
1569 f(m_p2);
1570 }
1571
1573 template<typename F>
1574 void forEach(const F &f)
1575 {
1576 f(m_k1);
1577 f(m_k2);
1578 f(m_k3);
1579 f(m_p1);
1580 f(m_p2);
1581 }
1582
1584 bool operator==(const Distortion &other) const;
1585
1587 bool operator!=(const Distortion &other) const;
1588
1590 std::string toString() const;
1591
1593 friend std::ostream &operator<<(std::ostream &stream, const Distortion &value)
1594 {
1595 return stream << value.toString();
1596 }
1597
1598 private:
1599 void setFromString(const std::string &value);
1600
1601 void setFromString(const std::string &fullPath, const std::string &value);
1602
1603 std::string getString(const std::string &fullPath) const;
1604
1605 K1 m_k1;
1606 K2 m_k2;
1607 K3 m_k3;
1608 P1 m_p1;
1609 P2 m_p2;
1610
1611 friend struct DataModel::Detail::Befriend<Distortion>;
1612 };
1613
1614 using Descendants = std::tuple<
1626
1629
1631 explicit CameraIntrinsics(const std::string &fileName);
1632
1638 ZIVID_NODISCARD static CameraIntrinsics fromSerialized(const std::string &value);
1639
1645 std::string serialize() const;
1646
1668#ifndef NO_DOC
1669 template<
1670 typename... Args,
1671 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1672 typename std::enable_if<
1673 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
1674 int>::type = 0>
1675#else
1676 template<typename... Args>
1677#endif
1678 explicit CameraIntrinsics(Args &&...args)
1679 {
1680 using namespace Zivid::Detail::TypeTraits;
1681
1682 static_assert(
1683 AllArgsDecayedAreUnique<Args...>::value,
1684 "Found duplicate types among the arguments passed to CameraIntrinsics(...). "
1685 "Types should be listed at most once.");
1686
1687 set(std::forward<Args>(args)...);
1688 }
1689
1710#ifndef NO_DOC
1711 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1712#else
1713 template<typename... Args>
1714#endif
1715 void set(Args &&...args)
1716 {
1717 using namespace Zivid::Detail::TypeTraits;
1718
1719 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1720 static_assert(
1721 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
1722
1723 static_assert(
1724 AllArgsDecayedAreUnique<Args...>::value,
1725 "Found duplicate types among the arguments passed to set(...). "
1726 "Types should be listed at most once.");
1727
1728 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1729 }
1730
1752#ifndef NO_DOC
1753 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1754#else
1755 template<typename... Args>
1756#endif
1757 CameraIntrinsics copyWith(Args &&...args) const
1758 {
1759 using namespace Zivid::Detail::TypeTraits;
1760
1761 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1762 static_assert(
1763 AllArgsAreDescendantNodes::value, "All arguments passed to copyWith(...) must be descendant nodes.");
1764
1765 static_assert(
1766 AllArgsDecayedAreUnique<Args...>::value,
1767 "Found duplicate types among the arguments passed to copyWith(...). "
1768 "Types should be listed at most once.");
1769
1770 auto copy{ *this };
1771 copy.set(std::forward<Args>(args)...);
1772 return copy;
1773 }
1774
1777 {
1778 return m_cameraMatrix;
1779 }
1780
1783 {
1784 return m_cameraMatrix;
1785 }
1786
1789 {
1790 m_cameraMatrix = value;
1791 return *this;
1792 }
1793
1796 {
1797 m_cameraMatrix.set(value);
1798 return *this;
1799 }
1800
1803 {
1804 m_cameraMatrix.set(value);
1805 return *this;
1806 }
1807
1810 {
1811 m_cameraMatrix.set(value);
1812 return *this;
1813 }
1814
1817 {
1818 m_cameraMatrix.set(value);
1819 return *this;
1820 }
1821
1823 const Distortion &distortion() const
1824 {
1825 return m_distortion;
1826 }
1827
1830 {
1831 return m_distortion;
1832 }
1833
1836 {
1837 m_distortion = value;
1838 return *this;
1839 }
1840
1843 {
1844 m_distortion.set(value);
1845 return *this;
1846 }
1847
1850 {
1851 m_distortion.set(value);
1852 return *this;
1853 }
1854
1857 {
1858 m_distortion.set(value);
1859 return *this;
1860 }
1861
1864 {
1865 m_distortion.set(value);
1866 return *this;
1867 }
1868
1871 {
1872 m_distortion.set(value);
1873 return *this;
1874 }
1875
1876 template<
1877 typename T,
1878 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix>::value, int>::type = 0>
1880 {
1881 return m_cameraMatrix;
1882 }
1883
1884 template<
1885 typename T,
1886 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CX>::value, int>::type = 0>
1888 {
1889 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::CX>();
1890 }
1891
1892 template<
1893 typename T,
1894 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CY>::value, int>::type = 0>
1896 {
1897 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::CY>();
1898 }
1899
1900 template<
1901 typename T,
1902 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FX>::value, int>::type = 0>
1904 {
1905 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::FX>();
1906 }
1907
1908 template<
1909 typename T,
1910 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FY>::value, int>::type = 0>
1912 {
1913 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::FY>();
1914 }
1915
1916 template<
1917 typename T,
1918 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion>::value, int>::type = 0>
1920 {
1921 return m_distortion;
1922 }
1923
1924 template<
1925 typename T,
1926 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K1>::value, int>::type = 0>
1928 {
1929 return m_distortion.get<CameraIntrinsics::Distortion::K1>();
1930 }
1931
1932 template<
1933 typename T,
1934 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K2>::value, int>::type = 0>
1936 {
1937 return m_distortion.get<CameraIntrinsics::Distortion::K2>();
1938 }
1939
1940 template<
1941 typename T,
1942 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K3>::value, int>::type = 0>
1944 {
1945 return m_distortion.get<CameraIntrinsics::Distortion::K3>();
1946 }
1947
1948 template<
1949 typename T,
1950 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P1>::value, int>::type = 0>
1952 {
1953 return m_distortion.get<CameraIntrinsics::Distortion::P1>();
1954 }
1955
1956 template<
1957 typename T,
1958 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P2>::value, int>::type = 0>
1960 {
1961 return m_distortion.get<CameraIntrinsics::Distortion::P2>();
1962 }
1963
1964 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1966 {
1967 return m_cameraMatrix;
1968 }
1969
1970 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1972 {
1973 return m_distortion;
1974 }
1975
1977 template<typename F>
1978 void forEach(const F &f) const
1979 {
1980 f(m_cameraMatrix);
1981 f(m_distortion);
1982 }
1983
1985 template<typename F>
1986 void forEach(const F &f)
1987 {
1988 f(m_cameraMatrix);
1989 f(m_distortion);
1990 }
1991
1993 bool operator==(const CameraIntrinsics &other) const;
1994
1996 bool operator!=(const CameraIntrinsics &other) const;
1997
1999 std::string toString() const;
2000
2002 friend std::ostream &operator<<(std::ostream &stream, const CameraIntrinsics &value)
2003 {
2004 return stream << value.toString();
2005 }
2006
2008 void save(const std::string &fileName) const;
2009
2011 void load(const std::string &fileName);
2012
2013 private:
2014 void setFromString(const std::string &value);
2015
2016 void setFromString(const std::string &fullPath, const std::string &value);
2017
2018 std::string getString(const std::string &fullPath) const;
2019
2020 CameraMatrix m_cameraMatrix;
2021 Distortion m_distortion;
2022
2023 friend struct DataModel::Detail::Befriend<CameraIntrinsics>;
2024 };
2025
2026#ifndef NO_DOC
2028 namespace Detail
2029 {
2030 ZIVID_CORE_EXPORT void save(const CameraIntrinsics &dataModel, std::ostream &ostream);
2031 ZIVID_CORE_EXPORT void load(CameraIntrinsics &dataModel, std::istream &istream);
2032 } // namespace Detail
2033#endif
2034
2035#ifndef NO_DOC
2036 template<>
2037 struct CameraIntrinsics::Version<1>
2038 {
2039 using Type = CameraIntrinsics;
2040 };
2041#endif
2042
2043} // namespace Zivid
2044
2045#ifdef _MSC_VER
2046# pragma warning(pop)
2047#endif
2048
2049#ifndef NO_DOC
2050# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
2051namespace std // NOLINT
2052{
2053
2054 template<>
2055 struct tuple_size<Zivid::CameraIntrinsics::CameraMatrix> : integral_constant<size_t, 4>
2056 {};
2057
2058 template<size_t i>
2059 struct tuple_element<i, Zivid::CameraIntrinsics::CameraMatrix>
2060 {
2061 static_assert(i < tuple_size<Zivid::CameraIntrinsics::CameraMatrix>::value, "Index must be less than 4");
2062
2063 using type // NOLINT
2064 = decltype(declval<Zivid::CameraIntrinsics::CameraMatrix>().get<i>());
2065 };
2066
2067 template<>
2068 struct tuple_size<Zivid::CameraIntrinsics::Distortion> : integral_constant<size_t, 5>
2069 {};
2070
2071 template<size_t i>
2072 struct tuple_element<i, Zivid::CameraIntrinsics::Distortion>
2073 {
2074 static_assert(i < tuple_size<Zivid::CameraIntrinsics::Distortion>::value, "Index must be less than 5");
2075
2076 using type // NOLINT
2077 = decltype(declval<Zivid::CameraIntrinsics::Distortion>().get<i>());
2078 };
2079
2080 template<>
2081 struct tuple_size<Zivid::CameraIntrinsics> : integral_constant<size_t, 2>
2082 {};
2083
2084 template<size_t i>
2085 struct tuple_element<i, Zivid::CameraIntrinsics>
2086 {
2087 static_assert(i < tuple_size<Zivid::CameraIntrinsics>::value, "Index must be less than 2");
2088
2089 using type // NOLINT
2090 = decltype(declval<Zivid::CameraIntrinsics>().get<i>());
2091 };
2092
2093} // namespace std
2094# endif
2095#endif
2096
2097// If we have access to the DataModel library, automatically include internal DataModel
2098// header. This header is necessary for serialization and deserialization.
2099#if defined(__has_include) && !defined(NO_DOC)
2100# if __has_include("Zivid/CameraIntrinsicsInternal.h") && __has_include("Zivid/DataModelNodeMetaData.h")
2101# include "Zivid/CameraIntrinsicsInternal.h"
2102# endif
2103#endif
#define ZIVID_NODISCARD
Definition Attributes.h:49
#define ZIVID_CORE_EXPORT
Definition CoreExport.h:56
x coordinate of the principal point
Definition CameraIntrinsics.h:133
bool operator==(const CX &other) const
Comparison operator.
Definition CameraIntrinsics.h:173
std::string toString() const
Get the value as string.
bool operator<(const CX &other) const
Comparison operator.
Definition CameraIntrinsics.h:185
bool operator>=(const CX &other) const
Comparison operator.
Definition CameraIntrinsics.h:203
constexpr CX(double value)
Constructor.
Definition CameraIntrinsics.h:162
bool operator>(const CX &other) const
Comparison operator.
Definition CameraIntrinsics.h:191
bool operator!=(const CX &other) const
Comparison operator.
Definition CameraIntrinsics.h:179
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:209
static constexpr Range< double > validRange()
The range of valid values for CX.
Definition CameraIntrinsics.h:153
bool operator<=(const CX &other) const
Comparison operator.
Definition CameraIntrinsics.h:197
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:150
y coordinate of the principal point
Definition CameraIntrinsics.h:226
friend std::ostream & operator<<(std::ostream &stream, const CY &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:302
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:243
bool operator<=(const CY &other) const
Comparison operator.
Definition CameraIntrinsics.h:290
bool operator>(const CY &other) const
Comparison operator.
Definition CameraIntrinsics.h:284
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:246
bool operator!=(const CY &other) const
Comparison operator.
Definition CameraIntrinsics.h:272
std::string toString() const
Get the value as string.
bool operator==(const CY &other) const
Comparison operator.
Definition CameraIntrinsics.h:266
bool operator<(const CY &other) const
Comparison operator.
Definition CameraIntrinsics.h:278
constexpr CY(double value)
Constructor.
Definition CameraIntrinsics.h:255
bool operator>=(const CY &other) const
Comparison operator.
Definition CameraIntrinsics.h:296
Focal length in x.
Definition CameraIntrinsics.h:319
static constexpr Range< double > validRange()
The range of valid values for FX.
Definition CameraIntrinsics.h:337
double value() const
Get the value.
FX()=default
Default constructor.
bool operator!=(const FX &other) const
Comparison operator.
Definition CameraIntrinsics.h:363
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:334
constexpr FX(double value)
Constructor.
Definition CameraIntrinsics.h:346
bool operator==(const FX &other) const
Comparison operator.
Definition CameraIntrinsics.h:357
bool operator>(const FX &other) const
Comparison operator.
Definition CameraIntrinsics.h:375
bool operator<=(const FX &other) const
Comparison operator.
Definition CameraIntrinsics.h:381
bool operator>=(const FX &other) const
Comparison operator.
Definition CameraIntrinsics.h:387
friend std::ostream & operator<<(std::ostream &stream, const FX &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:393
std::string toString() const
Get the value as string.
bool operator<(const FX &other) const
Comparison operator.
Definition CameraIntrinsics.h:369
Focal length in y.
Definition CameraIntrinsics.h:410
bool operator>(const FY &other) const
Comparison operator.
Definition CameraIntrinsics.h:466
bool operator!=(const FY &other) const
Comparison operator.
Definition CameraIntrinsics.h:454
bool operator==(const FY &other) const
Comparison operator.
Definition CameraIntrinsics.h:448
FY()=default
Default constructor.
static constexpr Range< double > validRange()
The range of valid values for FY.
Definition CameraIntrinsics.h:428
double value() const
Get the value.
bool operator<(const FY &other) const
Comparison operator.
Definition CameraIntrinsics.h:460
friend std::ostream & operator<<(std::ostream &stream, const FY &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:484
std::string toString() const
Get the value as string.
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:425
bool operator>=(const FY &other) const
Comparison operator.
Definition CameraIntrinsics.h:478
constexpr FY(double value)
Constructor.
Definition CameraIntrinsics.h:437
bool operator<=(const FY &other) const
Comparison operator.
Definition CameraIntrinsics.h:472
The camera matrix K (=[fx,0,cx;0,fy,cy;0,0,1])
Definition CameraIntrinsics.h:113
const FX & fx() const
Get FX.
Definition CameraIntrinsics.h:654
const CameraIntrinsics::CameraMatrix::CX & get() const
Definition CameraIntrinsics.h:694
void set(Args &&...args)
Set multiple arguments.
Definition CameraIntrinsics.h:561
CameraMatrix & set(const CY &value)
Set CY.
Definition CameraIntrinsics.h:647
const CameraIntrinsics::CameraMatrix::FX & get() const
Definition CameraIntrinsics.h:710
bool operator!=(const CameraMatrix &other) const
Inequality operator.
const CY & cy() const
Get CY.
Definition CameraIntrinsics.h:635
const CameraIntrinsics::CameraMatrix::FY & get() const
Definition CameraIntrinsics.h:718
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:777
CameraMatrix & set(const CX &value)
Set CX.
Definition CameraIntrinsics.h:628
const CameraIntrinsics::CameraMatrix::CY & get() const
Definition CameraIntrinsics.h:702
CameraMatrix & set(const FY &value)
Set FY.
Definition CameraIntrinsics.h:685
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:749
CameraMatrix & set(const FX &value)
Set FX.
Definition CameraIntrinsics.h:666
FY & fy()
Get FY.
Definition CameraIntrinsics.h:679
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:596
CX & cx()
Get CX.
Definition CameraIntrinsics.h:622
std::tuple< CameraIntrinsics::CameraMatrix::CX, CameraIntrinsics::CameraMatrix::CY, CameraIntrinsics::CameraMatrix::FX, CameraIntrinsics::CameraMatrix::FY > Descendants
Definition CameraIntrinsics.h:497
const FY & fy() const
Get FY.
Definition CameraIntrinsics.h:673
const CX & cx() const
Get CX.
Definition CameraIntrinsics.h:616
CY & cy()
Get CY.
Definition CameraIntrinsics.h:641
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:759
FX & fx()
Get FX.
Definition CameraIntrinsics.h:660
First radial distortion term.
Definition CameraIntrinsics.h:821
bool operator<(const K1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:871
K1()=default
Default constructor.
bool operator!=(const K1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:865
friend std::ostream & operator<<(std::ostream &stream, const K1 &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:895
bool operator>(const K1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:877
constexpr K1(double value)
Constructor.
Definition CameraIntrinsics.h:848
bool operator>=(const K1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:889
bool operator<=(const K1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:883
static constexpr Range< double > validRange()
The range of valid values for K1.
Definition CameraIntrinsics.h:839
bool operator==(const K1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:859
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:836
Second radial distortion term.
Definition CameraIntrinsics.h:912
bool operator>=(const K2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:980
static constexpr Range< double > validRange()
The range of valid values for K2.
Definition CameraIntrinsics.h:930
bool operator>(const K2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:968
bool operator!=(const K2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:956
std::string toString() const
Get the value as string.
bool operator==(const K2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:950
bool operator<(const K2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:962
friend std::ostream & operator<<(std::ostream &stream, const K2 &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:986
K2()=default
Default constructor.
bool operator<=(const K2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:974
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:927
constexpr K2(double value)
Constructor.
Definition CameraIntrinsics.h:939
double value() const
Get the value.
Third radial distortion term.
Definition CameraIntrinsics.h:1003
bool operator<(const K3 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1053
double value() const
Get the value.
static constexpr Range< double > validRange()
The range of valid values for K3.
Definition CameraIntrinsics.h:1021
K3()=default
Default constructor.
std::string toString() const
Get the value as string.
constexpr K3(double value)
Constructor.
Definition CameraIntrinsics.h:1030
bool operator>(const K3 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1059
bool operator<=(const K3 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1065
bool operator>=(const K3 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1071
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:1018
bool operator!=(const K3 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1047
friend std::ostream & operator<<(std::ostream &stream, const K3 &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:1077
bool operator==(const K3 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1041
First tangential distortion term.
Definition CameraIntrinsics.h:1094
bool operator>(const P1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1150
static constexpr Range< double > validRange()
The range of valid values for P1.
Definition CameraIntrinsics.h:1112
bool operator==(const P1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1132
bool operator>=(const P1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1162
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:1168
bool operator<(const P1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1144
P1()=default
Default constructor.
bool operator<=(const P1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1156
double value() const
Get the value.
constexpr P1(double value)
Constructor.
Definition CameraIntrinsics.h:1121
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:1109
bool operator!=(const P1 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1138
Second tangential distortion term.
Definition CameraIntrinsics.h:1185
static constexpr Range< double > validRange()
The range of valid values for P2.
Definition CameraIntrinsics.h:1205
bool operator==(const P2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1225
friend std::ostream & operator<<(std::ostream &stream, const P2 &value)
Operator to serialize the value to a stream.
Definition CameraIntrinsics.h:1261
bool operator>(const P2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1243
constexpr P2(double value)
Constructor.
Definition CameraIntrinsics.h:1214
P2()=default
Default constructor.
double value() const
Get the value.
double ValueType
The type of the underlying value.
Definition CameraIntrinsics.h:1202
std::string toString() const
Get the value as string.
bool operator<(const P2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1237
bool operator>=(const P2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1255
bool operator<=(const P2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1249
bool operator!=(const P2 &other) const
Comparison operator.
Definition CameraIntrinsics.h:1231
The radial and tangential distortion parameters.
Definition CameraIntrinsics.h:801
const CameraIntrinsics::Distortion::K3 & get() const
Definition CameraIntrinsics.h:1510
const P2 & p2() const
Get P2.
Definition CameraIntrinsics.h:1473
std::tuple< CameraIntrinsics::Distortion::K1, CameraIntrinsics::Distortion::K2, CameraIntrinsics::Distortion::K3, CameraIntrinsics::Distortion::P1, CameraIntrinsics::Distortion::P2 > Descendants
Definition CameraIntrinsics.h:1274
K3 & k3()
Get K3.
Definition CameraIntrinsics.h:1441
const K2 & k2() const
Get K2.
Definition CameraIntrinsics.h:1416
void set(Args &&...args)
Set multiple arguments.
Definition CameraIntrinsics.h:1341
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:1377
Distortion & set(const K2 &value)
Set K2.
Definition CameraIntrinsics.h:1428
K1 & k1()
Get K1.
Definition CameraIntrinsics.h:1403
std::string toString() const
Get the value as string.
P1 & p1()
Get P1.
Definition CameraIntrinsics.h:1460
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:1574
const CameraIntrinsics::Distortion::K2 & get() const
Definition CameraIntrinsics.h:1502
const CameraIntrinsics::Distortion::P2 & get() const
Definition CameraIntrinsics.h:1526
Distortion & set(const K3 &value)
Set K3.
Definition CameraIntrinsics.h:1447
const CameraIntrinsics::Distortion::P1 & get() const
Definition CameraIntrinsics.h:1518
bool operator!=(const Distortion &other) const
Inequality operator.
const P1 & p1() const
Get P1.
Definition CameraIntrinsics.h:1454
const K3 & k3() const
Get K3.
Definition CameraIntrinsics.h:1435
Distortion & set(const P1 &value)
Set P1.
Definition CameraIntrinsics.h:1466
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:1563
const CameraIntrinsics::Distortion::K1 & get() const
Definition CameraIntrinsics.h:1494
const K1 & k1() const
Get K1.
Definition CameraIntrinsics.h:1397
Distortion & set(const P2 &value)
Set P2.
Definition CameraIntrinsics.h:1485
Distortion & set(const K1 &value)
Set K1.
Definition CameraIntrinsics.h:1409
P2 & p2()
Get P2.
Definition CameraIntrinsics.h:1479
K2 & k2()
Get K2.
Definition CameraIntrinsics.h:1422
friend std::ostream & operator<<(std::ostream &stream, const Distortion &value)
Operator to send the value as string to a stream.
Definition CameraIntrinsics.h:1593
Information about the intrinsic parameters of the camera (OpenCV model)
Definition CameraIntrinsics.h:79
CameraIntrinsics & set(const Distortion::K3 &value)
Set Distortion::K3.
Definition CameraIntrinsics.h:1856
CameraMatrix & cameraMatrix()
Get CameraMatrix.
Definition CameraIntrinsics.h:1782
const CameraIntrinsics::CameraMatrix::CX & get() const
Definition CameraIntrinsics.h:1887
const CameraIntrinsics::Distortion::K1 & get() const
Definition CameraIntrinsics.h:1927
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:1911
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:1978
CameraIntrinsics(Args &&...args)
Constructor taking variadic number of arguments.
Definition CameraIntrinsics.h:1678
std::string toString() const
Get the value as string.
CameraIntrinsics & set(const Distortion::P1 &value)
Set Distortion::P1.
Definition CameraIntrinsics.h:1863
const Distortion & distortion() const
Get Distortion.
Definition CameraIntrinsics.h:1823
void set(Args &&...args)
Set multiple arguments.
Definition CameraIntrinsics.h:1715
CameraIntrinsics & set(const Distortion::K1 &value)
Set Distortion::K1.
Definition CameraIntrinsics.h:1842
const CameraIntrinsics::Distortion::K3 & get() const
Definition CameraIntrinsics.h:1943
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:1757
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition CameraIntrinsics.h:1986
CameraIntrinsics()
Default constructor.
CameraIntrinsics & set(const CameraMatrix::FY &value)
Set CameraMatrix::FY.
Definition CameraIntrinsics.h:1816
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:1614
const CameraIntrinsics::Distortion::P1 & get() const
Definition CameraIntrinsics.h:1951
bool operator==(const CameraIntrinsics &other) const
Equality operator.
CameraIntrinsics & set(const CameraMatrix::CY &value)
Set CameraMatrix::CY.
Definition CameraIntrinsics.h:1802
static ZIVID_NODISCARD CameraIntrinsics fromSerialized(const std::string &value)
Construct a new CameraIntrinsics instance from a previously serialized string.
CameraIntrinsics(const std::string &fileName)
Construct CameraIntrinsics by loading from file.
CameraIntrinsics & set(const CameraMatrix &value)
Set CameraMatrix.
Definition CameraIntrinsics.h:1788
CameraIntrinsics & set(const Distortion::P2 &value)
Set Distortion::P2.
Definition CameraIntrinsics.h:1870
CameraIntrinsics & set(const Distortion &value)
Set Distortion.
Definition CameraIntrinsics.h:1835
const CameraIntrinsics::CameraMatrix::CY & get() const
Definition CameraIntrinsics.h:1895
CameraIntrinsics & set(const CameraMatrix::CX &value)
Set CameraMatrix::CX.
Definition CameraIntrinsics.h:1795
void save(const std::string &fileName) const
Save to the given file.
CameraIntrinsics & set(const CameraMatrix::FX &value)
Set CameraMatrix::FX.
Definition CameraIntrinsics.h:1809
const CameraIntrinsics::CameraMatrix & get() const
Definition CameraIntrinsics.h:1879
const CameraIntrinsics::Distortion::K2 & get() const
Definition CameraIntrinsics.h:1935
const CameraMatrix & cameraMatrix() const
Get CameraMatrix.
Definition CameraIntrinsics.h:1776
const CameraIntrinsics::Distortion::P2 & get() const
Definition CameraIntrinsics.h:1959
const CameraIntrinsics::Distortion & get() const
Definition CameraIntrinsics.h:1919
friend std::ostream & operator<<(std::ostream &stream, const CameraIntrinsics &value)
Operator to send the value as string to a stream.
Definition CameraIntrinsics.h:2002
const CameraIntrinsics::CameraMatrix::FX & get() const
Definition CameraIntrinsics.h:1903
Distortion & distortion()
Get Distortion.
Definition CameraIntrinsics.h:1829
CameraIntrinsics & set(const Distortion::K2 &value)
Set Distortion::K2.
Definition CameraIntrinsics.h:1849
Class describing a range of values for a given type T.
Definition Range.h:73
NodeType
Definition NodeType.h:55
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:56