Zivid C++ API 2.6.1+6cec8609-3
Defining the Future of 3D Machine Vision
CameraIntrinsics.h
Go to the documentation of this file.
1
2
3/*******************************************************************************
4
5 * This file is part of the Zivid 3D Camera API
6
7 *
8
9 * Copyright 2015-2022 (C) Zivid AS
10
11 * All rights reserved.
12
13 *
14
15 * Zivid Software License, v1.0
16
17 *
18
19 * Redistribution and use in source and binary forms, with or without
20
21 * modification, are permitted provided that the following conditions are met:
22
23 *
24
25 * 1. Redistributions of source code must retain the above copyright notice,
26
27 * this list of conditions and the following disclaimer.
28
29 *
30
31 * 2. Redistributions in binary form must reproduce the above copyright notice,
32
33 * this list of conditions and the following disclaimer in the documentation
34
35 * and/or other materials provided with the distribution.
36
37 *
38
39 * 3. Neither the name of Zivid AS nor the names of its contributors may be used
40
41 * to endorse or promote products derived from this software without specific
42
43 * prior written permission.
44
45 *
46
47 * 4. This software, with or without modification, must not be used with any
48
49 * other 3D camera than from Zivid AS.
50
51 *
52
53 * 5. Any software provided in binary form under this license must not be
54
55 * reverse engineered, decompiled, modified and/or disassembled.
56
57 *
58
59 * THIS SOFTWARE IS PROVIDED BY ZIVID AS "AS IS" AND ANY EXPRESS OR IMPLIED
60
61 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
62
63 * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
64
65 * DISCLAIMED. IN NO EVENT SHALL ZIVID AS OR CONTRIBUTORS BE LIABLE FOR ANY
66
67 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
68
69 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
70
71 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
72
73 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
74
75 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
76
77 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
78
79 *
80
81 * Contact: Zivid Customer Success Team <customersuccess@zivid.com>
82
83 * Info: http://www.zivid.com
84
85 ******************************************************************************/
86
87
88
89#pragma once
90
91#include <array>
92#include <chrono>
93#include <cmath>
94#include <ctime>
95#include <iomanip>
96#include <memory>
97#include <set>
98#include <sstream>
99#include <string>
100#include <tuple>
101#include <utility>
102#include <vector>
103
109#include "Zivid/Range.h"
110
111#ifdef _MSC_VER
112# pragma warning(push)
113# pragma warning(disable : 4251) // "X needs to have dll-interface to be used by clients of class Y."
114#endif
115
116namespace Zivid
117{
118
121 {
122 public:
125
127 static constexpr const char *path{ "" };
128
130 static constexpr const char *name{ "CameraIntrinsics" };
131
133 static constexpr const char *description{
134 R"description(Information about the intrinsic parameters of the camera (OpenCV model))description"
135 };
136
137 static constexpr size_t version{ 1 };
138
139#ifndef NO_DOC
140 template<size_t>
141 struct Version;
142
143 using LatestVersion = Zivid::CameraIntrinsics;
144
145 // Short identifier. This value is not guaranteed to be universally unique
146 // Todo(ZIVID-2808): Move this to internal DataModelExt header
147 static constexpr std::array<uint8_t, 3> binaryId{ 'c', 'i', 'n' };
148
149#endif
150
153 {
154 public:
157
159 static constexpr const char *path{ "CameraMatrix" };
160
162 static constexpr const char *name{ "CameraMatrix" };
163
165 static constexpr const char *description{
166 R"description(The camera matrix K (=[fx,0,cx;0,fy,cy;0,0,1]))description"
167 };
168
171 {
172 public:
175
177 static constexpr const char *path{ "CameraMatrix/CX" };
178
180 static constexpr const char *name{ "CX" };
181
183 static constexpr const char *description{
184 R"description(x coordinate of the principal point)description"
185 };
186
188 using ValueType = double;
189
191 static constexpr Range<double> validRange()
192 {
193 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
194 }
195
197 CX() = default;
198
200 explicit constexpr CX(double value)
201 : m_value{ value }
202 {}
203
205 double value() const;
206
208 std::string toString() const;
209
211 bool operator==(const CX &other) const
212 {
213 return m_value == other.m_value;
214 }
215
217 bool operator!=(const CX &other) const
218 {
219 return m_value != other.m_value;
220 }
221
223 bool operator<(const CX &other) const
224 {
225 return m_value < other.m_value;
226 }
227
229 bool operator>(const CX &other) const
230 {
231 return m_value > other.m_value;
232 }
233
235 friend std::ostream &operator<<(std::ostream &stream, const CX &value)
236 {
237 return stream << value.toString();
238 }
239
240 private:
241 void setFromString(const std::string &value);
242
243 double m_value{ 0.0 };
244
245 friend struct DataModel::Detail::Befriend<CX>;
246 };
247
250 {
251 public:
254
256 static constexpr const char *path{ "CameraMatrix/CY" };
257
259 static constexpr const char *name{ "CY" };
260
262 static constexpr const char *description{
263 R"description(y coordinate of the principal point)description"
264 };
265
267 using ValueType = double;
268
270 static constexpr Range<double> validRange()
271 {
272 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
273 }
274
276 CY() = default;
277
279 explicit constexpr CY(double value)
280 : m_value{ value }
281 {}
282
284 double value() const;
285
287 std::string toString() const;
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 bool operator<(const CY &other) const
303 {
304 return m_value < other.m_value;
305 }
306
308 bool operator>(const CY &other) const
309 {
310 return m_value > other.m_value;
311 }
312
314 friend std::ostream &operator<<(std::ostream &stream, const CY &value)
315 {
316 return stream << value.toString();
317 }
318
319 private:
320 void setFromString(const std::string &value);
321
322 double m_value{ 0.0 };
323
324 friend struct DataModel::Detail::Befriend<CY>;
325 };
326
329 {
330 public:
333
335 static constexpr const char *path{ "CameraMatrix/FX" };
336
338 static constexpr const char *name{ "FX" };
339
341 static constexpr const char *description{ R"description(Focal length in x)description" };
342
344 using ValueType = double;
345
347 static constexpr Range<double> validRange()
348 {
349 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
350 }
351
353 FX() = default;
354
356 explicit constexpr FX(double value)
357 : m_value{ value }
358 {}
359
361 double value() const;
362
364 std::string toString() const;
365
367 bool operator==(const FX &other) const
368 {
369 return m_value == other.m_value;
370 }
371
373 bool operator!=(const FX &other) const
374 {
375 return m_value != other.m_value;
376 }
377
379 bool operator<(const FX &other) const
380 {
381 return m_value < other.m_value;
382 }
383
385 bool operator>(const FX &other) const
386 {
387 return m_value > other.m_value;
388 }
389
391 friend std::ostream &operator<<(std::ostream &stream, const FX &value)
392 {
393 return stream << value.toString();
394 }
395
396 private:
397 void setFromString(const std::string &value);
398
399 double m_value{ 0.0 };
400
401 friend struct DataModel::Detail::Befriend<FX>;
402 };
403
406 {
407 public:
410
412 static constexpr const char *path{ "CameraMatrix/FY" };
413
415 static constexpr const char *name{ "FY" };
416
418 static constexpr const char *description{ R"description(Focal length in y)description" };
419
421 using ValueType = double;
422
424 static constexpr Range<double> validRange()
425 {
426 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
427 }
428
430 FY() = default;
431
433 explicit constexpr FY(double value)
434 : m_value{ value }
435 {}
436
438 double value() const;
439
441 std::string toString() const;
442
444 bool operator==(const FY &other) const
445 {
446 return m_value == other.m_value;
447 }
448
450 bool operator!=(const FY &other) const
451 {
452 return m_value != other.m_value;
453 }
454
456 bool operator<(const FY &other) const
457 {
458 return m_value < other.m_value;
459 }
460
462 bool operator>(const FY &other) const
463 {
464 return m_value > other.m_value;
465 }
466
468 friend std::ostream &operator<<(std::ostream &stream, const FY &value)
469 {
470 return stream << value.toString();
471 }
472
473 private:
474 void setFromString(const std::string &value);
475
476 double m_value{ 0.0 };
477
478 friend struct DataModel::Detail::Befriend<FY>;
479 };
480
481 using Descendants = std::tuple<
486
489
504#ifndef NO_DOC
505 template<
506 typename... Args,
507 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
508 typename std::enable_if<
509 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
510 value,
511 int>::type = 0>
512#else
513 template<typename... Args>
514#endif
515 explicit CameraMatrix(Args &&...args)
516 {
517 using namespace Zivid::Detail::TypeTraits;
518
519 static_assert(
520 AllArgsDecayedAreUnique<Args...>::value,
521 "Found duplicate types among the arguments passed to CameraMatrix(...). "
522 "Types should be listed at most once.");
523
524 set(std::forward<Args>(args)...);
525 }
526
540#ifndef NO_DOC
541 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
542#else
543 template<typename... Args>
544#endif
545 void set(Args &&...args)
546 {
547 using namespace Zivid::Detail::TypeTraits;
548
549 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
550 static_assert(
551 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
552
553 static_assert(
554 AllArgsDecayedAreUnique<Args...>::value,
555 "Found duplicate types among the arguments passed to set(...). "
556 "Types should be listed at most once.");
557
558 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
559 }
560
575#ifndef NO_DOC
576 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
577#else
578 template<typename... Args>
579#endif
580 CameraMatrix copyWith(Args &&...args) const
581 {
582 using namespace Zivid::Detail::TypeTraits;
583
584 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
585 static_assert(
586 AllArgsAreDescendantNodes::value,
587 "All arguments passed to copyWith(...) must be descendant nodes.");
588
589 static_assert(
590 AllArgsDecayedAreUnique<Args...>::value,
591 "Found duplicate types among the arguments passed to copyWith(...). "
592 "Types should be listed at most once.");
593
594 auto copy{ *this };
595 copy.set(std::forward<Args>(args)...);
596 return copy;
597 }
598
600 const CX &cx() const
601 {
602 return m_cx;
603 }
604
607 {
608 return m_cx;
609 }
610
612 CameraMatrix &set(const CX &value)
613 {
614 m_cx = value;
615 return *this;
616 }
617
619 const CY &cy() const
620 {
621 return m_cy;
622 }
623
626 {
627 return m_cy;
628 }
629
631 CameraMatrix &set(const CY &value)
632 {
633 m_cy = value;
634 return *this;
635 }
636
638 const FX &fx() const
639 {
640 return m_fx;
641 }
642
645 {
646 return m_fx;
647 }
648
650 CameraMatrix &set(const FX &value)
651 {
652 m_fx = value;
653 return *this;
654 }
655
657 const FY &fy() const
658 {
659 return m_fy;
660 }
661
664 {
665 return m_fy;
666 }
667
669 CameraMatrix &set(const FY &value)
670 {
671 m_fy = value;
672 return *this;
673 }
674
675 template<
676 typename T,
677 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CX>::value, int>::type = 0>
679 {
680 return m_cx;
681 }
682
683 template<
684 typename T,
685 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CY>::value, int>::type = 0>
687 {
688 return m_cy;
689 }
690
691 template<
692 typename T,
693 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FX>::value, int>::type = 0>
695 {
696 return m_fx;
697 }
698
699 template<
700 typename T,
701 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FY>::value, int>::type = 0>
703 {
704 return m_fy;
705 }
706
707 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
709 {
710 return m_cx;
711 }
712
713 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
715 {
716 return m_cy;
717 }
718
719 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
721 {
722 return m_fx;
723 }
724
725 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
727 {
728 return m_fy;
729 }
730
732 template<typename F>
733 void forEach(const F &f) const
734 {
735 f(m_cx);
736 f(m_cy);
737 f(m_fx);
738 f(m_fy);
739 }
740
742 template<typename F>
743 void forEach(const F &f)
744 {
745 f(m_cx);
746 f(m_cy);
747 f(m_fx);
748 f(m_fy);
749 }
750
752 bool operator==(const CameraMatrix &other) const;
753
755 bool operator!=(const CameraMatrix &other) const;
756
758 std::string toString() const;
759
761 friend std::ostream &operator<<(std::ostream &stream, const CameraMatrix &value)
762 {
763 return stream << value.toString();
764 }
765
766 private:
767 void setFromString(const std::string &value);
768
769 void setFromString(const std::string &fullPath, const std::string &value);
770
771 std::string getString(const std::string &fullPath) const;
772
773 CX m_cx;
774 CY m_cy;
775 FX m_fx;
776 FY m_fy;
777
778 friend struct DataModel::Detail::Befriend<CameraMatrix>;
779 };
780
783 {
784 public:
787
789 static constexpr const char *path{ "Distortion" };
790
792 static constexpr const char *name{ "Distortion" };
793
795 static constexpr const char *description{
796 R"description(The radial and tangential distortion parameters)description"
797 };
798
801 {
802 public:
805
807 static constexpr const char *path{ "Distortion/K1" };
808
810 static constexpr const char *name{ "K1" };
811
813 static constexpr const char *description{ R"description(First radial distortion term)description" };
814
816 using ValueType = double;
817
819 static constexpr Range<double> validRange()
820 {
821 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
822 }
823
825 K1() = default;
826
828 explicit constexpr K1(double value)
829 : m_value{ value }
830 {}
831
833 double value() const;
834
836 std::string toString() const;
837
839 bool operator==(const K1 &other) const
840 {
841 return m_value == other.m_value;
842 }
843
845 bool operator!=(const K1 &other) const
846 {
847 return m_value != other.m_value;
848 }
849
851 bool operator<(const K1 &other) const
852 {
853 return m_value < other.m_value;
854 }
855
857 bool operator>(const K1 &other) const
858 {
859 return m_value > other.m_value;
860 }
861
863 friend std::ostream &operator<<(std::ostream &stream, const K1 &value)
864 {
865 return stream << value.toString();
866 }
867
868 private:
869 void setFromString(const std::string &value);
870
871 double m_value{ 0.0 };
872
873 friend struct DataModel::Detail::Befriend<K1>;
874 };
875
878 {
879 public:
882
884 static constexpr const char *path{ "Distortion/K2" };
885
887 static constexpr const char *name{ "K2" };
888
890 static constexpr const char *description{ R"description(Second radial distortion term)description" };
891
893 using ValueType = double;
894
896 static constexpr Range<double> validRange()
897 {
898 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
899 }
900
902 K2() = default;
903
905 explicit constexpr K2(double value)
906 : m_value{ value }
907 {}
908
910 double value() const;
911
913 std::string toString() const;
914
916 bool operator==(const K2 &other) const
917 {
918 return m_value == other.m_value;
919 }
920
922 bool operator!=(const K2 &other) const
923 {
924 return m_value != other.m_value;
925 }
926
928 bool operator<(const K2 &other) const
929 {
930 return m_value < other.m_value;
931 }
932
934 bool operator>(const K2 &other) const
935 {
936 return m_value > other.m_value;
937 }
938
940 friend std::ostream &operator<<(std::ostream &stream, const K2 &value)
941 {
942 return stream << value.toString();
943 }
944
945 private:
946 void setFromString(const std::string &value);
947
948 double m_value{ 0.0 };
949
950 friend struct DataModel::Detail::Befriend<K2>;
951 };
952
955 {
956 public:
959
961 static constexpr const char *path{ "Distortion/K3" };
962
964 static constexpr const char *name{ "K3" };
965
967 static constexpr const char *description{ R"description(Third radial distortion term)description" };
968
970 using ValueType = double;
971
973 static constexpr Range<double> validRange()
974 {
975 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
976 }
977
979 K3() = default;
980
982 explicit constexpr K3(double value)
983 : m_value{ value }
984 {}
985
987 double value() const;
988
990 std::string toString() const;
991
993 bool operator==(const K3 &other) const
994 {
995 return m_value == other.m_value;
996 }
997
999 bool operator!=(const K3 &other) const
1000 {
1001 return m_value != other.m_value;
1002 }
1003
1005 bool operator<(const K3 &other) const
1006 {
1007 return m_value < other.m_value;
1008 }
1009
1011 bool operator>(const K3 &other) const
1012 {
1013 return m_value > other.m_value;
1014 }
1015
1017 friend std::ostream &operator<<(std::ostream &stream, const K3 &value)
1018 {
1019 return stream << value.toString();
1020 }
1021
1022 private:
1023 void setFromString(const std::string &value);
1024
1025 double m_value{ 0.0 };
1026
1027 friend struct DataModel::Detail::Befriend<K3>;
1028 };
1029
1032 {
1033 public:
1036
1038 static constexpr const char *path{ "Distortion/P1" };
1039
1041 static constexpr const char *name{ "P1" };
1042
1044 static constexpr const char *description{ R"description(First tangential distortion term)description" };
1045
1047 using ValueType = double;
1048
1050 static constexpr Range<double> validRange()
1051 {
1052 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1053 }
1054
1056 P1() = default;
1057
1059 explicit constexpr P1(double value)
1060 : m_value{ value }
1061 {}
1062
1064 double value() const;
1065
1067 std::string toString() const;
1068
1070 bool operator==(const P1 &other) const
1071 {
1072 return m_value == other.m_value;
1073 }
1074
1076 bool operator!=(const P1 &other) const
1077 {
1078 return m_value != other.m_value;
1079 }
1080
1082 bool operator<(const P1 &other) const
1083 {
1084 return m_value < other.m_value;
1085 }
1086
1088 bool operator>(const P1 &other) const
1089 {
1090 return m_value > other.m_value;
1091 }
1092
1094 friend std::ostream &operator<<(std::ostream &stream, const P1 &value)
1095 {
1096 return stream << value.toString();
1097 }
1098
1099 private:
1100 void setFromString(const std::string &value);
1101
1102 double m_value{ 0.0 };
1103
1104 friend struct DataModel::Detail::Befriend<P1>;
1105 };
1106
1109 {
1110 public:
1113
1115 static constexpr const char *path{ "Distortion/P2" };
1116
1118 static constexpr const char *name{ "P2" };
1119
1121 static constexpr const char *description{
1122 R"description(Second tangential distortion term)description"
1123 };
1124
1126 using ValueType = double;
1127
1129 static constexpr Range<double> validRange()
1130 {
1131 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1132 }
1133
1135 P2() = default;
1136
1138 explicit constexpr P2(double value)
1139 : m_value{ value }
1140 {}
1141
1143 double value() const;
1144
1146 std::string toString() const;
1147
1149 bool operator==(const P2 &other) const
1150 {
1151 return m_value == other.m_value;
1152 }
1153
1155 bool operator!=(const P2 &other) const
1156 {
1157 return m_value != other.m_value;
1158 }
1159
1161 bool operator<(const P2 &other) const
1162 {
1163 return m_value < other.m_value;
1164 }
1165
1167 bool operator>(const P2 &other) const
1168 {
1169 return m_value > other.m_value;
1170 }
1171
1173 friend std::ostream &operator<<(std::ostream &stream, const P2 &value)
1174 {
1175 return stream << value.toString();
1176 }
1177
1178 private:
1179 void setFromString(const std::string &value);
1180
1181 double m_value{ 0.0 };
1182
1183 friend struct DataModel::Detail::Befriend<P2>;
1184 };
1185
1186 using Descendants = std::tuple<
1192
1195
1211#ifndef NO_DOC
1212 template<
1213 typename... Args,
1214 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1215 typename std::enable_if<
1216 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
1217 value,
1218 int>::type = 0>
1219#else
1220 template<typename... Args>
1221#endif
1222 explicit Distortion(Args &&...args)
1223 {
1224 using namespace Zivid::Detail::TypeTraits;
1225
1226 static_assert(
1227 AllArgsDecayedAreUnique<Args...>::value,
1228 "Found duplicate types among the arguments passed to Distortion(...). "
1229 "Types should be listed at most once.");
1230
1231 set(std::forward<Args>(args)...);
1232 }
1233
1248#ifndef NO_DOC
1249 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1250#else
1251 template<typename... Args>
1252#endif
1253 void set(Args &&...args)
1254 {
1255 using namespace Zivid::Detail::TypeTraits;
1256
1257 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1258 static_assert(
1259 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
1260
1261 static_assert(
1262 AllArgsDecayedAreUnique<Args...>::value,
1263 "Found duplicate types among the arguments passed to set(...). "
1264 "Types should be listed at most once.");
1265
1266 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1267 }
1268
1284#ifndef NO_DOC
1285 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1286#else
1287 template<typename... Args>
1288#endif
1289 Distortion copyWith(Args &&...args) const
1290 {
1291 using namespace Zivid::Detail::TypeTraits;
1292
1293 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1294 static_assert(
1295 AllArgsAreDescendantNodes::value,
1296 "All arguments passed to copyWith(...) must be descendant nodes.");
1297
1298 static_assert(
1299 AllArgsDecayedAreUnique<Args...>::value,
1300 "Found duplicate types among the arguments passed to copyWith(...). "
1301 "Types should be listed at most once.");
1302
1303 auto copy{ *this };
1304 copy.set(std::forward<Args>(args)...);
1305 return copy;
1306 }
1307
1309 const K1 &k1() const
1310 {
1311 return m_k1;
1312 }
1313
1316 {
1317 return m_k1;
1318 }
1319
1321 Distortion &set(const K1 &value)
1322 {
1323 m_k1 = value;
1324 return *this;
1325 }
1326
1328 const K2 &k2() const
1329 {
1330 return m_k2;
1331 }
1332
1335 {
1336 return m_k2;
1337 }
1338
1340 Distortion &set(const K2 &value)
1341 {
1342 m_k2 = value;
1343 return *this;
1344 }
1345
1347 const K3 &k3() const
1348 {
1349 return m_k3;
1350 }
1351
1354 {
1355 return m_k3;
1356 }
1357
1359 Distortion &set(const K3 &value)
1360 {
1361 m_k3 = value;
1362 return *this;
1363 }
1364
1366 const P1 &p1() const
1367 {
1368 return m_p1;
1369 }
1370
1373 {
1374 return m_p1;
1375 }
1376
1378 Distortion &set(const P1 &value)
1379 {
1380 m_p1 = value;
1381 return *this;
1382 }
1383
1385 const P2 &p2() const
1386 {
1387 return m_p2;
1388 }
1389
1392 {
1393 return m_p2;
1394 }
1395
1397 Distortion &set(const P2 &value)
1398 {
1399 m_p2 = value;
1400 return *this;
1401 }
1402
1403 template<
1404 typename T,
1405 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K1>::value, int>::type = 0>
1407 {
1408 return m_k1;
1409 }
1410
1411 template<
1412 typename T,
1413 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K2>::value, int>::type = 0>
1415 {
1416 return m_k2;
1417 }
1418
1419 template<
1420 typename T,
1421 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K3>::value, int>::type = 0>
1423 {
1424 return m_k3;
1425 }
1426
1427 template<
1428 typename T,
1429 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P1>::value, int>::type = 0>
1431 {
1432 return m_p1;
1433 }
1434
1435 template<
1436 typename T,
1437 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P2>::value, int>::type = 0>
1439 {
1440 return m_p2;
1441 }
1442
1443 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1445 {
1446 return m_k1;
1447 }
1448
1449 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1451 {
1452 return m_k2;
1453 }
1454
1455 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
1457 {
1458 return m_k3;
1459 }
1460
1461 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
1463 {
1464 return m_p1;
1465 }
1466
1467 template<size_t i, typename std::enable_if<i == 4, int>::type = 0>
1469 {
1470 return m_p2;
1471 }
1472
1474 template<typename F>
1475 void forEach(const F &f) const
1476 {
1477 f(m_k1);
1478 f(m_k2);
1479 f(m_k3);
1480 f(m_p1);
1481 f(m_p2);
1482 }
1483
1485 template<typename F>
1486 void forEach(const F &f)
1487 {
1488 f(m_k1);
1489 f(m_k2);
1490 f(m_k3);
1491 f(m_p1);
1492 f(m_p2);
1493 }
1494
1496 bool operator==(const Distortion &other) const;
1497
1499 bool operator!=(const Distortion &other) const;
1500
1502 std::string toString() const;
1503
1505 friend std::ostream &operator<<(std::ostream &stream, const Distortion &value)
1506 {
1507 return stream << value.toString();
1508 }
1509
1510 private:
1511 void setFromString(const std::string &value);
1512
1513 void setFromString(const std::string &fullPath, const std::string &value);
1514
1515 std::string getString(const std::string &fullPath) const;
1516
1517 K1 m_k1;
1518 K2 m_k2;
1519 K3 m_k3;
1520 P1 m_p1;
1521 P2 m_p2;
1522
1523 friend struct DataModel::Detail::Befriend<Distortion>;
1524 };
1525
1526 using Descendants = std::tuple<
1538
1541
1543 explicit CameraIntrinsics(const std::string &fileName);
1544
1566#ifndef NO_DOC
1567 template<
1568 typename... Args,
1569 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1570 typename std::enable_if<
1571 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
1572 int>::type = 0>
1573#else
1574 template<typename... Args>
1575#endif
1576 explicit CameraIntrinsics(Args &&...args)
1577 {
1578 using namespace Zivid::Detail::TypeTraits;
1579
1580 static_assert(
1581 AllArgsDecayedAreUnique<Args...>::value,
1582 "Found duplicate types among the arguments passed to CameraIntrinsics(...). "
1583 "Types should be listed at most once.");
1584
1585 set(std::forward<Args>(args)...);
1586 }
1587
1608#ifndef NO_DOC
1609 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1610#else
1611 template<typename... Args>
1612#endif
1613 void set(Args &&...args)
1614 {
1615 using namespace Zivid::Detail::TypeTraits;
1616
1617 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1618 static_assert(
1619 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
1620
1621 static_assert(
1622 AllArgsDecayedAreUnique<Args...>::value,
1623 "Found duplicate types among the arguments passed to set(...). "
1624 "Types should be listed at most once.");
1625
1626 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1627 }
1628
1650#ifndef NO_DOC
1651 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1652#else
1653 template<typename... Args>
1654#endif
1655 CameraIntrinsics copyWith(Args &&...args) const
1656 {
1657 using namespace Zivid::Detail::TypeTraits;
1658
1659 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1660 static_assert(
1661 AllArgsAreDescendantNodes::value, "All arguments passed to copyWith(...) must be descendant nodes.");
1662
1663 static_assert(
1664 AllArgsDecayedAreUnique<Args...>::value,
1665 "Found duplicate types among the arguments passed to copyWith(...). "
1666 "Types should be listed at most once.");
1667
1668 auto copy{ *this };
1669 copy.set(std::forward<Args>(args)...);
1670 return copy;
1671 }
1672
1675 {
1676 return m_cameraMatrix;
1677 }
1678
1681 {
1682 return m_cameraMatrix;
1683 }
1684
1687 {
1688 m_cameraMatrix = value;
1689 return *this;
1690 }
1691
1694 {
1695 m_cameraMatrix.set(value);
1696 return *this;
1697 }
1698
1701 {
1702 m_cameraMatrix.set(value);
1703 return *this;
1704 }
1705
1708 {
1709 m_cameraMatrix.set(value);
1710 return *this;
1711 }
1712
1715 {
1716 m_cameraMatrix.set(value);
1717 return *this;
1718 }
1719
1721 const Distortion &distortion() const
1722 {
1723 return m_distortion;
1724 }
1725
1728 {
1729 return m_distortion;
1730 }
1731
1734 {
1735 m_distortion = value;
1736 return *this;
1737 }
1738
1741 {
1742 m_distortion.set(value);
1743 return *this;
1744 }
1745
1748 {
1749 m_distortion.set(value);
1750 return *this;
1751 }
1752
1755 {
1756 m_distortion.set(value);
1757 return *this;
1758 }
1759
1762 {
1763 m_distortion.set(value);
1764 return *this;
1765 }
1766
1769 {
1770 m_distortion.set(value);
1771 return *this;
1772 }
1773
1774 template<
1775 typename T,
1776 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix>::value, int>::type = 0>
1778 {
1779 return m_cameraMatrix;
1780 }
1781
1782 template<
1783 typename T,
1784 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CX>::value, int>::type = 0>
1786 {
1787 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::CX>();
1788 }
1789
1790 template<
1791 typename T,
1792 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CY>::value, int>::type = 0>
1794 {
1795 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::CY>();
1796 }
1797
1798 template<
1799 typename T,
1800 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FX>::value, int>::type = 0>
1802 {
1803 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::FX>();
1804 }
1805
1806 template<
1807 typename T,
1808 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FY>::value, int>::type = 0>
1810 {
1811 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::FY>();
1812 }
1813
1814 template<
1815 typename T,
1816 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion>::value, int>::type = 0>
1818 {
1819 return m_distortion;
1820 }
1821
1822 template<
1823 typename T,
1824 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K1>::value, int>::type = 0>
1826 {
1827 return m_distortion.get<CameraIntrinsics::Distortion::K1>();
1828 }
1829
1830 template<
1831 typename T,
1832 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K2>::value, int>::type = 0>
1834 {
1835 return m_distortion.get<CameraIntrinsics::Distortion::K2>();
1836 }
1837
1838 template<
1839 typename T,
1840 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K3>::value, int>::type = 0>
1842 {
1843 return m_distortion.get<CameraIntrinsics::Distortion::K3>();
1844 }
1845
1846 template<
1847 typename T,
1848 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P1>::value, int>::type = 0>
1850 {
1851 return m_distortion.get<CameraIntrinsics::Distortion::P1>();
1852 }
1853
1854 template<
1855 typename T,
1856 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P2>::value, int>::type = 0>
1858 {
1859 return m_distortion.get<CameraIntrinsics::Distortion::P2>();
1860 }
1861
1862 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1864 {
1865 return m_cameraMatrix;
1866 }
1867
1868 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1870 {
1871 return m_distortion;
1872 }
1873
1875 template<typename F>
1876 void forEach(const F &f) const
1877 {
1878 f(m_cameraMatrix);
1879 f(m_distortion);
1880 }
1881
1883 template<typename F>
1884 void forEach(const F &f)
1885 {
1886 f(m_cameraMatrix);
1887 f(m_distortion);
1888 }
1889
1891 bool operator==(const CameraIntrinsics &other) const;
1892
1894 bool operator!=(const CameraIntrinsics &other) const;
1895
1897 std::string toString() const;
1898
1900 friend std::ostream &operator<<(std::ostream &stream, const CameraIntrinsics &value)
1901 {
1902 return stream << value.toString();
1903 }
1904
1906 void save(const std::string &fileName) const;
1907
1909 void load(const std::string &fileName);
1910
1911 private:
1912 void setFromString(const std::string &value);
1913
1914 void setFromString(const std::string &fullPath, const std::string &value);
1915
1916 std::string getString(const std::string &fullPath) const;
1917
1918 CameraMatrix m_cameraMatrix;
1919 Distortion m_distortion;
1920
1921 friend struct DataModel::Detail::Befriend<CameraIntrinsics>;
1922 };
1923
1924#ifndef NO_DOC
1925 template<>
1926 struct CameraIntrinsics::Version<1>
1927 {
1928 using Type = CameraIntrinsics;
1929 };
1930#endif
1931
1932} // namespace Zivid
1933
1934#ifdef _MSC_VER
1935# pragma warning(pop)
1936#endif
1937
1938#ifndef NO_DOC
1939# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
1940namespace std // NOLINT
1941{
1942
1943 template<>
1944 struct tuple_size<Zivid::CameraIntrinsics::CameraMatrix> : integral_constant<size_t, 4>
1945 {};
1946
1947 template<size_t i>
1948 struct tuple_element<i, Zivid::CameraIntrinsics::CameraMatrix>
1949 {
1950 static_assert(i < tuple_size<Zivid::CameraIntrinsics::CameraMatrix>::value, "Index must be less than 4");
1951
1952 using type // NOLINT
1953 = decltype(declval<Zivid::CameraIntrinsics::CameraMatrix>().get<i>());
1954 };
1955
1956 template<>
1957 struct tuple_size<Zivid::CameraIntrinsics::Distortion> : integral_constant<size_t, 5>
1958 {};
1959
1960 template<size_t i>
1961 struct tuple_element<i, Zivid::CameraIntrinsics::Distortion>
1962 {
1963 static_assert(i < tuple_size<Zivid::CameraIntrinsics::Distortion>::value, "Index must be less than 5");
1964
1965 using type // NOLINT
1966 = decltype(declval<Zivid::CameraIntrinsics::Distortion>().get<i>());
1967 };
1968
1969 template<>
1970 struct tuple_size<Zivid::CameraIntrinsics> : integral_constant<size_t, 2>
1971 {};
1972
1973 template<size_t i>
1974 struct tuple_element<i, Zivid::CameraIntrinsics>
1975 {
1976 static_assert(i < tuple_size<Zivid::CameraIntrinsics>::value, "Index must be less than 2");
1977
1978 using type // NOLINT
1979 = decltype(declval<Zivid::CameraIntrinsics>().get<i>());
1980 };
1981
1982} // namespace std
1983# endif
1984#endif
1985
1986// If we have access to the DataModel library, automatically include internal DataModel
1987// header. This header is necessary for serialization and deserialization.
1988#if defined(__has_include) && !defined(NO_DOC)
1989# if __has_include("Zivid/CameraIntrinsicsInternal.h") && __has_include("Zivid/DataModelSerializationMetaData.h")
1990# include "Zivid/CameraIntrinsicsInternal.h"
1991# endif
1992#endif
#define ZIVID_CORE_EXPORT
Definition: CoreExport.h:101
x coordinate of the principal point
Definition: CameraIntrinsics.h:171
bool operator==(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:211
std::string toString() const
Get the value as string
bool operator<(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:223
constexpr CX(double value)
Constructor
Definition: CameraIntrinsics.h:200
bool operator>(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:229
bool operator!=(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:217
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:235
static constexpr Range< double > validRange()
The range of valid values for CX
Definition: CameraIntrinsics.h:191
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:188
y coordinate of the principal point
Definition: CameraIntrinsics.h:250
friend std::ostream & operator<<(std::ostream &stream, const CY &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:314
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:267
bool operator>(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:308
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:270
bool operator!=(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:296
std::string toString() const
Get the value as string
bool operator==(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:290
bool operator<(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:302
constexpr CY(double value)
Constructor
Definition: CameraIntrinsics.h:279
Focal length in x
Definition: CameraIntrinsics.h:329
static constexpr Range< double > validRange()
The range of valid values for FX
Definition: CameraIntrinsics.h:347
double value() const
Get the value
FX()=default
Default constructor
bool operator!=(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:373
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:344
constexpr FX(double value)
Constructor
Definition: CameraIntrinsics.h:356
bool operator==(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:367
bool operator>(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:385
friend std::ostream & operator<<(std::ostream &stream, const FX &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:391
std::string toString() const
Get the value as string
bool operator<(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:379
Focal length in y
Definition: CameraIntrinsics.h:406
bool operator>(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:462
bool operator!=(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:450
bool operator==(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:444
FY()=default
Default constructor
static constexpr Range< double > validRange()
The range of valid values for FY
Definition: CameraIntrinsics.h:424
double value() const
Get the value
bool operator<(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:456
friend std::ostream & operator<<(std::ostream &stream, const FY &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:468
std::string toString() const
Get the value as string
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:421
constexpr FY(double value)
Constructor
Definition: CameraIntrinsics.h:433
The camera matrix K (=[fx,0,cx;0,fy,cy;0,0,1])
Definition: CameraIntrinsics.h:153
const FX & fx() const
Get FX
Definition: CameraIntrinsics.h:638
const CameraIntrinsics::CameraMatrix::CX & get() const
Definition: CameraIntrinsics.h:678
void set(Args &&...args)
Set multiple arguments
Definition: CameraIntrinsics.h:545
CameraMatrix & set(const CY &value)
Set CY
Definition: CameraIntrinsics.h:631
const CameraIntrinsics::CameraMatrix::FX & get() const
Definition: CameraIntrinsics.h:694
bool operator!=(const CameraMatrix &other) const
Inequality operator
const CY & cy() const
Get CY
Definition: CameraIntrinsics.h:619
std::tuple< CameraIntrinsics::CameraMatrix::CX, CameraIntrinsics::CameraMatrix::CY, CameraIntrinsics::CameraMatrix::FX, CameraIntrinsics::CameraMatrix::FY > Descendants
Definition: CameraIntrinsics.h:485
const CameraIntrinsics::CameraMatrix::FY & get() const
Definition: CameraIntrinsics.h:702
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:761
CameraMatrix & set(const CX &value)
Set CX
Definition: CameraIntrinsics.h:612
const CameraIntrinsics::CameraMatrix::CY & get() const
Definition: CameraIntrinsics.h:686
CameraMatrix & set(const FY &value)
Set FY
Definition: CameraIntrinsics.h:669
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:733
CameraMatrix & set(const FX &value)
Set FX
Definition: CameraIntrinsics.h:650
FY & fy()
Get FY
Definition: CameraIntrinsics.h:663
CameraMatrix(Args &&...args)
Constructor taking variadic number of arguments
Definition: CameraIntrinsics.h:515
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:580
CX & cx()
Get CX
Definition: CameraIntrinsics.h:606
const FY & fy() const
Get FY
Definition: CameraIntrinsics.h:657
const CX & cx() const
Get CX
Definition: CameraIntrinsics.h:600
CY & cy()
Get CY
Definition: CameraIntrinsics.h:625
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter
Definition: CameraIntrinsics.h:743
FX & fx()
Get FX
Definition: CameraIntrinsics.h:644
First radial distortion term
Definition: CameraIntrinsics.h:801
bool operator<(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:851
K1()=default
Default constructor
bool operator!=(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:845
friend std::ostream & operator<<(std::ostream &stream, const K1 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:863
bool operator>(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:857
constexpr K1(double value)
Constructor
Definition: CameraIntrinsics.h:828
static constexpr Range< double > validRange()
The range of valid values for K1
Definition: CameraIntrinsics.h:819
bool operator==(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:839
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:816
Second radial distortion term
Definition: CameraIntrinsics.h:878
static constexpr Range< double > validRange()
The range of valid values for K2
Definition: CameraIntrinsics.h:896
bool operator>(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:934
bool operator!=(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:922
std::string toString() const
Get the value as string
bool operator==(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:916
bool operator<(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:928
friend std::ostream & operator<<(std::ostream &stream, const K2 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:940
K2()=default
Default constructor
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:893
constexpr K2(double value)
Constructor
Definition: CameraIntrinsics.h:905
double value() const
Get the value
Third radial distortion term
Definition: CameraIntrinsics.h:955
bool operator<(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1005
double value() const
Get the value
static constexpr Range< double > validRange()
The range of valid values for K3
Definition: CameraIntrinsics.h:973
K3()=default
Default constructor
std::string toString() const
Get the value as string
constexpr K3(double value)
Constructor
Definition: CameraIntrinsics.h:982
bool operator>(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1011
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:970
bool operator!=(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:999
friend std::ostream & operator<<(std::ostream &stream, const K3 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:1017
bool operator==(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:993
First tangential distortion term
Definition: CameraIntrinsics.h:1032
bool operator>(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1088
static constexpr Range< double > validRange()
The range of valid values for P1
Definition: CameraIntrinsics.h:1050
bool operator==(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1070
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:1094
bool operator<(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1082
P1()=default
Default constructor
double value() const
Get the value
constexpr P1(double value)
Constructor
Definition: CameraIntrinsics.h:1059
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:1047
bool operator!=(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1076
Second tangential distortion term
Definition: CameraIntrinsics.h:1109
static constexpr Range< double > validRange()
The range of valid values for P2
Definition: CameraIntrinsics.h:1129
bool operator==(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1149
friend std::ostream & operator<<(std::ostream &stream, const P2 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:1173
bool operator>(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1167
constexpr P2(double value)
Constructor
Definition: CameraIntrinsics.h:1138
P2()=default
Default constructor
double value() const
Get the value
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:1126
std::string toString() const
Get the value as string
bool operator<(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1161
bool operator!=(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1155
The radial and tangential distortion parameters
Definition: CameraIntrinsics.h:783
const CameraIntrinsics::Distortion::K3 & get() const
Definition: CameraIntrinsics.h:1422
Distortion(Args &&...args)
Constructor taking variadic number of arguments
Definition: CameraIntrinsics.h:1222
const P2 & p2() const
Get P2
Definition: CameraIntrinsics.h:1385
K3 & k3()
Get K3
Definition: CameraIntrinsics.h:1353
const K2 & k2() const
Get K2
Definition: CameraIntrinsics.h:1328
std::tuple< CameraIntrinsics::Distortion::K1, CameraIntrinsics::Distortion::K2, CameraIntrinsics::Distortion::K3, CameraIntrinsics::Distortion::P1, CameraIntrinsics::Distortion::P2 > Descendants
Definition: CameraIntrinsics.h:1191
void set(Args &&...args)
Set multiple arguments
Definition: CameraIntrinsics.h:1253
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:1289
Distortion & set(const K2 &value)
Set K2
Definition: CameraIntrinsics.h:1340
K1 & k1()
Get K1
Definition: CameraIntrinsics.h:1315
std::string toString() const
Get the value as string
P1 & p1()
Get P1
Definition: CameraIntrinsics.h:1372
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:1486
const CameraIntrinsics::Distortion::K2 & get() const
Definition: CameraIntrinsics.h:1414
const CameraIntrinsics::Distortion::P2 & get() const
Definition: CameraIntrinsics.h:1438
Distortion & set(const K3 &value)
Set K3
Definition: CameraIntrinsics.h:1359
const CameraIntrinsics::Distortion::P1 & get() const
Definition: CameraIntrinsics.h:1430
bool operator!=(const Distortion &other) const
Inequality operator
const P1 & p1() const
Get P1
Definition: CameraIntrinsics.h:1366
const K3 & k3() const
Get K3
Definition: CameraIntrinsics.h:1347
Distortion & set(const P1 &value)
Set P1
Definition: CameraIntrinsics.h:1378
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:1475
const CameraIntrinsics::Distortion::K1 & get() const
Definition: CameraIntrinsics.h:1406
const K1 & k1() const
Get K1
Definition: CameraIntrinsics.h:1309
Distortion & set(const P2 &value)
Set P2
Definition: CameraIntrinsics.h:1397
Distortion & set(const K1 &value)
Set K1
Definition: CameraIntrinsics.h:1321
P2 & p2()
Get P2
Definition: CameraIntrinsics.h:1391
K2 & k2()
Get K2
Definition: CameraIntrinsics.h:1334
friend std::ostream & operator<<(std::ostream &stream, const Distortion &value)
Operator to send the value as string to a stream
Definition: CameraIntrinsics.h:1505
Information about the intrinsic parameters of the camera (OpenCV model)
Definition: CameraIntrinsics.h:121
CameraIntrinsics & set(const Distortion::K3 &value)
Set Distortion::K3
Definition: CameraIntrinsics.h:1754
CameraMatrix & cameraMatrix()
Get CameraMatrix
Definition: CameraIntrinsics.h:1680
const CameraIntrinsics::CameraMatrix::CX & get() const
Definition: CameraIntrinsics.h:1785
const CameraIntrinsics::Distortion::K1 & get() const
Definition: CameraIntrinsics.h:1825
bool operator!=(const CameraIntrinsics &other) const
Inequality operator
const CameraIntrinsics::CameraMatrix::FY & get() const
Definition: CameraIntrinsics.h:1809
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:1876
CameraIntrinsics(Args &&...args)
Constructor taking variadic number of arguments
Definition: CameraIntrinsics.h:1576
std::string toString() const
Get the value as string
CameraIntrinsics & set(const Distortion::P1 &value)
Set Distortion::P1
Definition: CameraIntrinsics.h:1761
const Distortion & distortion() const
Get Distortion
Definition: CameraIntrinsics.h:1721
void set(Args &&...args)
Set multiple arguments
Definition: CameraIntrinsics.h:1613
CameraIntrinsics & set(const Distortion::K1 &value)
Set Distortion::K1
Definition: CameraIntrinsics.h:1740
const CameraIntrinsics::Distortion::K3 & get() const
Definition: CameraIntrinsics.h:1841
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:1655
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter
Definition: CameraIntrinsics.h:1884
CameraIntrinsics()
Default constructor
CameraIntrinsics & set(const CameraMatrix::FY &value)
Set CameraMatrix::FY
Definition: CameraIntrinsics.h:1714
void load(const std::string &fileName)
Load from the given file
const CameraIntrinsics::Distortion::P1 & get() const
Definition: CameraIntrinsics.h:1849
bool operator==(const CameraIntrinsics &other) const
Equality operator
CameraIntrinsics & set(const CameraMatrix::CY &value)
Set CameraMatrix::CY
Definition: CameraIntrinsics.h:1700
CameraIntrinsics(const std::string &fileName)
Construct CameraIntrinsics by loading from file
CameraIntrinsics & set(const CameraMatrix &value)
Set CameraMatrix
Definition: CameraIntrinsics.h:1686
CameraIntrinsics & set(const Distortion::P2 &value)
Set Distortion::P2
Definition: CameraIntrinsics.h:1768
CameraIntrinsics & set(const Distortion &value)
Set Distortion
Definition: CameraIntrinsics.h:1733
const CameraIntrinsics::CameraMatrix::CY & get() const
Definition: CameraIntrinsics.h:1793
CameraIntrinsics & set(const CameraMatrix::CX &value)
Set CameraMatrix::CX
Definition: CameraIntrinsics.h:1693
void save(const std::string &fileName) const
Save to the given file
CameraIntrinsics & set(const CameraMatrix::FX &value)
Set CameraMatrix::FX
Definition: CameraIntrinsics.h:1707
const CameraIntrinsics::CameraMatrix & get() const
Definition: CameraIntrinsics.h:1777
const CameraIntrinsics::Distortion::K2 & get() const
Definition: CameraIntrinsics.h:1833
const CameraMatrix & cameraMatrix() const
Get CameraMatrix
Definition: CameraIntrinsics.h:1674
const CameraIntrinsics::Distortion::P2 & get() const
Definition: CameraIntrinsics.h:1857
const CameraIntrinsics::Distortion & get() const
Definition: CameraIntrinsics.h:1817
friend std::ostream & operator<<(std::ostream &stream, const CameraIntrinsics &value)
Operator to send the value as string to a stream
Definition: CameraIntrinsics.h:1900
const CameraIntrinsics::CameraMatrix::FX & get() const
Definition: CameraIntrinsics.h:1801
Distortion & distortion()
Get Distortion
Definition: CameraIntrinsics.h:1727
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:1537
CameraIntrinsics & set(const Distortion::K2 &value)
Set Distortion::K2
Definition: CameraIntrinsics.h:1747
Class describing a range of values for a given type T
Definition: Range.h:102
NodeType
Definition: NodeType.h:100
The main Zivid namespace. All Zivid code is found here
Definition: Application.h:99