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