Zivid C++ API 2.5.0+19fa6891-1
Defining the Future of 3D Machine Vision
CameraIntrinsics.h
Go to the documentation of this file.
1
2
3/*******************************************************************************
4
5 * This file is part of the Zivid 3D Camera API
6
7 *
8
9 * Copyright 2015-2021 (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{
120 {
121 public:
124
126 static constexpr const char *path{ "" };
127
129 static constexpr const char *name{ "CameraIntrinsics" };
130
132 static constexpr const char *description{
133 R"description(Information about the intrinsic parameters of the camera (OpenCV model))description"
134 };
135
136 static constexpr size_t version{ 1 };
137
138#ifndef NO_DOC
139 template<size_t>
140 struct Version;
141
142 using LatestVersion = Zivid::CameraIntrinsics;
143
144 // Short identifier. This value is not guaranteed to be universally unique
145 // Todo(ZIVID-2808): Move this to internal DataModelExt header
146 static constexpr std::array<uint8_t, 3> binaryId{ 'c', 'i', 'n' };
147
148#endif
149
152 {
153 public:
156
158 static constexpr const char *path{ "CameraMatrix" };
159
161 static constexpr const char *name{ "CameraMatrix" };
162
164 static constexpr const char *description{
165 R"description(The camera matrix K (=[fx,0,cx;0,fy,cy;0,0,1]))description"
166 };
167
170 {
171 public:
174
176 static constexpr const char *path{ "CameraMatrix/CX" };
177
179 static constexpr const char *name{ "CX" };
180
182 static constexpr const char *description{
183 R"description(x coordinate of the principal point)description"
184 };
185
187 using ValueType = double;
188
190 static constexpr Range<double> validRange()
191 {
192 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
193 }
194
196 CX() = default;
197
199 explicit constexpr CX(double value)
200 : m_value{ value }
201 {}
202
204 double value() const;
205
207 std::string toString() const;
208
210 bool operator==(const CX &other) const
211 {
212 return m_value == other.m_value;
213 }
214
216 bool operator!=(const CX &other) const
217 {
218 return m_value != other.m_value;
219 }
220
222 bool operator<(const CX &other) const
223 {
224 return m_value < other.m_value;
225 }
226
228 bool operator>(const CX &other) const
229 {
230 return m_value > other.m_value;
231 }
232
234 friend std::ostream &operator<<(std::ostream &stream, const CX &value)
235 {
236 return stream << value.toString();
237 }
238
239 private:
240 void setFromString(const std::string &value);
241
242 double m_value{ 0.0 };
243
244 friend struct DataModel::Detail::Befriend<CX>;
245 };
246
249 {
250 public:
253
255 static constexpr const char *path{ "CameraMatrix/CY" };
256
258 static constexpr const char *name{ "CY" };
259
261 static constexpr const char *description{
262 R"description(y coordinate of the principal point)description"
263 };
264
266 using ValueType = double;
267
269 static constexpr Range<double> validRange()
270 {
271 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
272 }
273
275 CY() = default;
276
278 explicit constexpr CY(double value)
279 : m_value{ value }
280 {}
281
283 double value() const;
284
286 std::string toString() const;
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 bool operator<(const CY &other) const
302 {
303 return m_value < other.m_value;
304 }
305
307 bool operator>(const CY &other) const
308 {
309 return m_value > other.m_value;
310 }
311
313 friend std::ostream &operator<<(std::ostream &stream, const CY &value)
314 {
315 return stream << value.toString();
316 }
317
318 private:
319 void setFromString(const std::string &value);
320
321 double m_value{ 0.0 };
322
323 friend struct DataModel::Detail::Befriend<CY>;
324 };
325
328 {
329 public:
332
334 static constexpr const char *path{ "CameraMatrix/FX" };
335
337 static constexpr const char *name{ "FX" };
338
340 static constexpr const char *description{ R"description(Focal length in x)description" };
341
343 using ValueType = double;
344
346 static constexpr Range<double> validRange()
347 {
348 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
349 }
350
352 FX() = default;
353
355 explicit constexpr FX(double value)
356 : m_value{ value }
357 {}
358
360 double value() const;
361
363 std::string toString() const;
364
366 bool operator==(const FX &other) const
367 {
368 return m_value == other.m_value;
369 }
370
372 bool operator!=(const FX &other) const
373 {
374 return m_value != other.m_value;
375 }
376
378 bool operator<(const FX &other) const
379 {
380 return m_value < other.m_value;
381 }
382
384 bool operator>(const FX &other) const
385 {
386 return m_value > other.m_value;
387 }
388
390 friend std::ostream &operator<<(std::ostream &stream, const FX &value)
391 {
392 return stream << value.toString();
393 }
394
395 private:
396 void setFromString(const std::string &value);
397
398 double m_value{ 0.0 };
399
400 friend struct DataModel::Detail::Befriend<FX>;
401 };
402
405 {
406 public:
409
411 static constexpr const char *path{ "CameraMatrix/FY" };
412
414 static constexpr const char *name{ "FY" };
415
417 static constexpr const char *description{ R"description(Focal length in y)description" };
418
420 using ValueType = double;
421
423 static constexpr Range<double> validRange()
424 {
425 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
426 }
427
429 FY() = default;
430
432 explicit constexpr FY(double value)
433 : m_value{ value }
434 {}
435
437 double value() const;
438
440 std::string toString() const;
441
443 bool operator==(const FY &other) const
444 {
445 return m_value == other.m_value;
446 }
447
449 bool operator!=(const FY &other) const
450 {
451 return m_value != other.m_value;
452 }
453
455 bool operator<(const FY &other) const
456 {
457 return m_value < other.m_value;
458 }
459
461 bool operator>(const FY &other) const
462 {
463 return m_value > other.m_value;
464 }
465
467 friend std::ostream &operator<<(std::ostream &stream, const FY &value)
468 {
469 return stream << value.toString();
470 }
471
472 private:
473 void setFromString(const std::string &value);
474
475 double m_value{ 0.0 };
476
477 friend struct DataModel::Detail::Befriend<FY>;
478 };
479
484
487
502#ifndef NO_DOC
503 template<typename... Args,
504 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
505 typename std::enable_if<
506 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants,
507 typename std::decay<Args>::type...>::value,
508 int>::type = 0>
509#else
510 template<typename... Args>
511#endif
512 explicit CameraMatrix(Args &&...args)
513 {
514 using namespace Zivid::Detail::TypeTraits;
515
516 static_assert(AllArgsDecayedAreUnique<Args...>::value,
517 "Found duplicate types among the arguments passed to CameraMatrix(...). "
518 "Types should be listed at most once.");
519
520 set(std::forward<Args>(args)...);
521 }
522
536#ifndef NO_DOC
537 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
538#else
539 template<typename... Args>
540#endif
541 void set(Args &&...args)
542 {
543 using namespace Zivid::Detail::TypeTraits;
544
545 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
546 static_assert(AllArgsAreDescendantNodes::value,
547 "All arguments passed to set(...) must be descendant nodes.");
548
549 static_assert(AllArgsDecayedAreUnique<Args...>::value,
550 "Found duplicate types among the arguments passed to set(...). "
551 "Types should be listed at most once.");
552
553 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
554 }
555
570#ifndef NO_DOC
571 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
572#else
573 template<typename... Args>
574#endif
575 CameraMatrix copyWith(Args &&...args) const
576 {
577 using namespace Zivid::Detail::TypeTraits;
578
579 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
580 static_assert(AllArgsAreDescendantNodes::value,
581 "All arguments passed to copyWith(...) must be descendant nodes.");
582
583 static_assert(AllArgsDecayedAreUnique<Args...>::value,
584 "Found duplicate types among the arguments passed to copyWith(...). "
585 "Types should be listed at most once.");
586
587 auto copy{ *this };
588 copy.set(std::forward<Args>(args)...);
589 return copy;
590 }
591
593 const CX &cx() const
594 {
595 return m_cx;
596 }
597
600 {
601 return m_cx;
602 }
603
605 CameraMatrix &set(const CX &value)
606 {
607 m_cx = value;
608 return *this;
609 }
610
612 const CY &cy() const
613 {
614 return m_cy;
615 }
616
619 {
620 return m_cy;
621 }
622
624 CameraMatrix &set(const CY &value)
625 {
626 m_cy = value;
627 return *this;
628 }
629
631 const FX &fx() const
632 {
633 return m_fx;
634 }
635
638 {
639 return m_fx;
640 }
641
643 CameraMatrix &set(const FX &value)
644 {
645 m_fx = value;
646 return *this;
647 }
648
650 const FY &fy() const
651 {
652 return m_fy;
653 }
654
657 {
658 return m_fy;
659 }
660
662 CameraMatrix &set(const FY &value)
663 {
664 m_fy = value;
665 return *this;
666 }
667
668 template<typename T,
669 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CX>::value, int>::type = 0>
671 {
672 return m_cx;
673 }
674
675 template<typename T,
676 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CY>::value, int>::type = 0>
678 {
679 return m_cy;
680 }
681
682 template<typename T,
683 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FX>::value, int>::type = 0>
685 {
686 return m_fx;
687 }
688
689 template<typename T,
690 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FY>::value, int>::type = 0>
692 {
693 return m_fy;
694 }
695
696 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
698 {
699 return m_cx;
700 }
701
702 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
704 {
705 return m_cy;
706 }
707
708 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
710 {
711 return m_fx;
712 }
713
714 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
716 {
717 return m_fy;
718 }
719
721 template<typename F>
722 void forEach(const F &f) const
723 {
724 f(m_cx);
725 f(m_cy);
726 f(m_fx);
727 f(m_fy);
728 }
729
731 template<typename F>
732 void forEach(const F &f)
733 {
734 f(m_cx);
735 f(m_cy);
736 f(m_fx);
737 f(m_fy);
738 }
739
741 bool operator==(const CameraMatrix &other) const;
742
744 bool operator!=(const CameraMatrix &other) const;
745
747 std::string toString() const;
748
750 friend std::ostream &operator<<(std::ostream &stream, const CameraMatrix &value)
751 {
752 return stream << value.toString();
753 }
754
755 private:
756 void setFromString(const std::string &value);
757
758 void setFromString(const std::string &fullPath, const std::string &value);
759
760 std::string getString(const std::string &fullPath) const;
761
762 CX m_cx;
763 CY m_cy;
764 FX m_fx;
765 FY m_fy;
766
767 friend struct DataModel::Detail::Befriend<CameraMatrix>;
768 };
769
772 {
773 public:
776
778 static constexpr const char *path{ "Distortion" };
779
781 static constexpr const char *name{ "Distortion" };
782
784 static constexpr const char *description{
785 R"description(The radial and tangential distortion parameters)description"
786 };
787
790 {
791 public:
794
796 static constexpr const char *path{ "Distortion/K1" };
797
799 static constexpr const char *name{ "K1" };
800
802 static constexpr const char *description{ R"description(First radial distortion term)description" };
803
805 using ValueType = double;
806
808 static constexpr Range<double> validRange()
809 {
810 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
811 }
812
814 K1() = default;
815
817 explicit constexpr K1(double value)
818 : m_value{ value }
819 {}
820
822 double value() const;
823
825 std::string toString() const;
826
828 bool operator==(const K1 &other) const
829 {
830 return m_value == other.m_value;
831 }
832
834 bool operator!=(const K1 &other) const
835 {
836 return m_value != other.m_value;
837 }
838
840 bool operator<(const K1 &other) const
841 {
842 return m_value < other.m_value;
843 }
844
846 bool operator>(const K1 &other) const
847 {
848 return m_value > other.m_value;
849 }
850
852 friend std::ostream &operator<<(std::ostream &stream, const K1 &value)
853 {
854 return stream << value.toString();
855 }
856
857 private:
858 void setFromString(const std::string &value);
859
860 double m_value{ 0.0 };
861
862 friend struct DataModel::Detail::Befriend<K1>;
863 };
864
867 {
868 public:
871
873 static constexpr const char *path{ "Distortion/K2" };
874
876 static constexpr const char *name{ "K2" };
877
879 static constexpr const char *description{ R"description(Second radial distortion term)description" };
880
882 using ValueType = double;
883
885 static constexpr Range<double> validRange()
886 {
887 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
888 }
889
891 K2() = default;
892
894 explicit constexpr K2(double value)
895 : m_value{ value }
896 {}
897
899 double value() const;
900
902 std::string toString() const;
903
905 bool operator==(const K2 &other) const
906 {
907 return m_value == other.m_value;
908 }
909
911 bool operator!=(const K2 &other) const
912 {
913 return m_value != other.m_value;
914 }
915
917 bool operator<(const K2 &other) const
918 {
919 return m_value < other.m_value;
920 }
921
923 bool operator>(const K2 &other) const
924 {
925 return m_value > other.m_value;
926 }
927
929 friend std::ostream &operator<<(std::ostream &stream, const K2 &value)
930 {
931 return stream << value.toString();
932 }
933
934 private:
935 void setFromString(const std::string &value);
936
937 double m_value{ 0.0 };
938
939 friend struct DataModel::Detail::Befriend<K2>;
940 };
941
944 {
945 public:
948
950 static constexpr const char *path{ "Distortion/K3" };
951
953 static constexpr const char *name{ "K3" };
954
956 static constexpr const char *description{ R"description(Third radial distortion term)description" };
957
959 using ValueType = double;
960
962 static constexpr Range<double> validRange()
963 {
964 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
965 }
966
968 K3() = default;
969
971 explicit constexpr K3(double value)
972 : m_value{ value }
973 {}
974
976 double value() const;
977
979 std::string toString() const;
980
982 bool operator==(const K3 &other) const
983 {
984 return m_value == other.m_value;
985 }
986
988 bool operator!=(const K3 &other) const
989 {
990 return m_value != other.m_value;
991 }
992
994 bool operator<(const K3 &other) const
995 {
996 return m_value < other.m_value;
997 }
998
1000 bool operator>(const K3 &other) const
1001 {
1002 return m_value > other.m_value;
1003 }
1004
1006 friend std::ostream &operator<<(std::ostream &stream, const K3 &value)
1007 {
1008 return stream << value.toString();
1009 }
1010
1011 private:
1012 void setFromString(const std::string &value);
1013
1014 double m_value{ 0.0 };
1015
1016 friend struct DataModel::Detail::Befriend<K3>;
1017 };
1018
1021 {
1022 public:
1025
1027 static constexpr const char *path{ "Distortion/P1" };
1028
1030 static constexpr const char *name{ "P1" };
1031
1033 static constexpr const char *description{ R"description(First tangential distortion term)description" };
1034
1036 using ValueType = double;
1037
1039 static constexpr Range<double> validRange()
1040 {
1041 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1042 }
1043
1045 P1() = default;
1046
1048 explicit constexpr P1(double value)
1049 : m_value{ value }
1050 {}
1051
1053 double value() const;
1054
1056 std::string toString() const;
1057
1059 bool operator==(const P1 &other) const
1060 {
1061 return m_value == other.m_value;
1062 }
1063
1065 bool operator!=(const P1 &other) const
1066 {
1067 return m_value != other.m_value;
1068 }
1069
1071 bool operator<(const P1 &other) const
1072 {
1073 return m_value < other.m_value;
1074 }
1075
1077 bool operator>(const P1 &other) const
1078 {
1079 return m_value > other.m_value;
1080 }
1081
1083 friend std::ostream &operator<<(std::ostream &stream, const P1 &value)
1084 {
1085 return stream << value.toString();
1086 }
1087
1088 private:
1089 void setFromString(const std::string &value);
1090
1091 double m_value{ 0.0 };
1092
1093 friend struct DataModel::Detail::Befriend<P1>;
1094 };
1095
1098 {
1099 public:
1102
1104 static constexpr const char *path{ "Distortion/P2" };
1105
1107 static constexpr const char *name{ "P2" };
1108
1110 static constexpr const char *description{
1111 R"description(Second tangential distortion term)description"
1112 };
1113
1115 using ValueType = double;
1116
1118 static constexpr Range<double> validRange()
1119 {
1120 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1121 }
1122
1124 P2() = default;
1125
1127 explicit constexpr P2(double value)
1128 : m_value{ value }
1129 {}
1130
1132 double value() const;
1133
1135 std::string toString() const;
1136
1138 bool operator==(const P2 &other) const
1139 {
1140 return m_value == other.m_value;
1141 }
1142
1144 bool operator!=(const P2 &other) const
1145 {
1146 return m_value != other.m_value;
1147 }
1148
1150 bool operator<(const P2 &other) const
1151 {
1152 return m_value < other.m_value;
1153 }
1154
1156 bool operator>(const P2 &other) const
1157 {
1158 return m_value > other.m_value;
1159 }
1160
1162 friend std::ostream &operator<<(std::ostream &stream, const P2 &value)
1163 {
1164 return stream << value.toString();
1165 }
1166
1167 private:
1168 void setFromString(const std::string &value);
1169
1170 double m_value{ 0.0 };
1171
1172 friend struct DataModel::Detail::Befriend<P2>;
1173 };
1174
1180
1183
1199#ifndef NO_DOC
1200 template<typename... Args,
1201 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1202 typename std::enable_if<
1203 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants,
1204 typename std::decay<Args>::type...>::value,
1205 int>::type = 0>
1206#else
1207 template<typename... Args>
1208#endif
1209 explicit Distortion(Args &&...args)
1210 {
1211 using namespace Zivid::Detail::TypeTraits;
1212
1213 static_assert(AllArgsDecayedAreUnique<Args...>::value,
1214 "Found duplicate types among the arguments passed to Distortion(...). "
1215 "Types should be listed at most once.");
1216
1217 set(std::forward<Args>(args)...);
1218 }
1219
1234#ifndef NO_DOC
1235 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1236#else
1237 template<typename... Args>
1238#endif
1239 void set(Args &&...args)
1240 {
1241 using namespace Zivid::Detail::TypeTraits;
1242
1243 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1244 static_assert(AllArgsAreDescendantNodes::value,
1245 "All arguments passed to set(...) must be descendant nodes.");
1246
1247 static_assert(AllArgsDecayedAreUnique<Args...>::value,
1248 "Found duplicate types among the arguments passed to set(...). "
1249 "Types should be listed at most once.");
1250
1251 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1252 }
1253
1269#ifndef NO_DOC
1270 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1271#else
1272 template<typename... Args>
1273#endif
1274 Distortion copyWith(Args &&...args) const
1275 {
1276 using namespace Zivid::Detail::TypeTraits;
1277
1278 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1279 static_assert(AllArgsAreDescendantNodes::value,
1280 "All arguments passed to copyWith(...) must be descendant nodes.");
1281
1282 static_assert(AllArgsDecayedAreUnique<Args...>::value,
1283 "Found duplicate types among the arguments passed to copyWith(...). "
1284 "Types should be listed at most once.");
1285
1286 auto copy{ *this };
1287 copy.set(std::forward<Args>(args)...);
1288 return copy;
1289 }
1290
1292 const K1 &k1() const
1293 {
1294 return m_k1;
1295 }
1296
1299 {
1300 return m_k1;
1301 }
1302
1304 Distortion &set(const K1 &value)
1305 {
1306 m_k1 = value;
1307 return *this;
1308 }
1309
1311 const K2 &k2() const
1312 {
1313 return m_k2;
1314 }
1315
1318 {
1319 return m_k2;
1320 }
1321
1323 Distortion &set(const K2 &value)
1324 {
1325 m_k2 = value;
1326 return *this;
1327 }
1328
1330 const K3 &k3() const
1331 {
1332 return m_k3;
1333 }
1334
1337 {
1338 return m_k3;
1339 }
1340
1342 Distortion &set(const K3 &value)
1343 {
1344 m_k3 = value;
1345 return *this;
1346 }
1347
1349 const P1 &p1() const
1350 {
1351 return m_p1;
1352 }
1353
1356 {
1357 return m_p1;
1358 }
1359
1361 Distortion &set(const P1 &value)
1362 {
1363 m_p1 = value;
1364 return *this;
1365 }
1366
1368 const P2 &p2() const
1369 {
1370 return m_p2;
1371 }
1372
1375 {
1376 return m_p2;
1377 }
1378
1380 Distortion &set(const P2 &value)
1381 {
1382 m_p2 = value;
1383 return *this;
1384 }
1385
1386 template<typename T,
1387 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K1>::value, int>::type = 0>
1389 {
1390 return m_k1;
1391 }
1392
1393 template<typename T,
1394 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K2>::value, int>::type = 0>
1396 {
1397 return m_k2;
1398 }
1399
1400 template<typename T,
1401 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K3>::value, int>::type = 0>
1403 {
1404 return m_k3;
1405 }
1406
1407 template<typename T,
1408 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P1>::value, int>::type = 0>
1410 {
1411 return m_p1;
1412 }
1413
1414 template<typename T,
1415 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P2>::value, int>::type = 0>
1417 {
1418 return m_p2;
1419 }
1420
1421 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1423 {
1424 return m_k1;
1425 }
1426
1427 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1429 {
1430 return m_k2;
1431 }
1432
1433 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
1435 {
1436 return m_k3;
1437 }
1438
1439 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
1441 {
1442 return m_p1;
1443 }
1444
1445 template<size_t i, typename std::enable_if<i == 4, int>::type = 0>
1447 {
1448 return m_p2;
1449 }
1450
1452 template<typename F>
1453 void forEach(const F &f) const
1454 {
1455 f(m_k1);
1456 f(m_k2);
1457 f(m_k3);
1458 f(m_p1);
1459 f(m_p2);
1460 }
1461
1463 template<typename F>
1464 void forEach(const F &f)
1465 {
1466 f(m_k1);
1467 f(m_k2);
1468 f(m_k3);
1469 f(m_p1);
1470 f(m_p2);
1471 }
1472
1474 bool operator==(const Distortion &other) const;
1475
1477 bool operator!=(const Distortion &other) const;
1478
1480 std::string toString() const;
1481
1483 friend std::ostream &operator<<(std::ostream &stream, const Distortion &value)
1484 {
1485 return stream << value.toString();
1486 }
1487
1488 private:
1489 void setFromString(const std::string &value);
1490
1491 void setFromString(const std::string &fullPath, const std::string &value);
1492
1493 std::string getString(const std::string &fullPath) const;
1494
1495 K1 m_k1;
1496 K2 m_k2;
1497 K3 m_k3;
1498 P1 m_p1;
1499 P2 m_p2;
1500
1501 friend struct DataModel::Detail::Befriend<Distortion>;
1502 };
1503
1515
1518
1520 explicit CameraIntrinsics(const std::string &fileName);
1521
1543#ifndef NO_DOC
1544 template<
1545 typename... Args,
1546 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1547 typename std::enable_if<
1548 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
1549 int>::type = 0>
1550#else
1551 template<typename... Args>
1552#endif
1553 explicit CameraIntrinsics(Args &&...args)
1554 {
1555 using namespace Zivid::Detail::TypeTraits;
1556
1557 static_assert(AllArgsDecayedAreUnique<Args...>::value,
1558 "Found duplicate types among the arguments passed to CameraIntrinsics(...). "
1559 "Types should be listed at most once.");
1560
1561 set(std::forward<Args>(args)...);
1562 }
1563
1584#ifndef NO_DOC
1585 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1586#else
1587 template<typename... Args>
1588#endif
1589 void set(Args &&...args)
1590 {
1591 using namespace Zivid::Detail::TypeTraits;
1592
1593 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1594 static_assert(AllArgsAreDescendantNodes::value,
1595 "All arguments passed to set(...) must be descendant nodes.");
1596
1597 static_assert(AllArgsDecayedAreUnique<Args...>::value,
1598 "Found duplicate types among the arguments passed to set(...). "
1599 "Types should be listed at most once.");
1600
1601 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1602 }
1603
1625#ifndef NO_DOC
1626 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1627#else
1628 template<typename... Args>
1629#endif
1630 CameraIntrinsics copyWith(Args &&...args) const
1631 {
1632 using namespace Zivid::Detail::TypeTraits;
1633
1634 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1635 static_assert(AllArgsAreDescendantNodes::value,
1636 "All arguments passed to copyWith(...) must be descendant nodes.");
1637
1638 static_assert(AllArgsDecayedAreUnique<Args...>::value,
1639 "Found duplicate types among the arguments passed to copyWith(...). "
1640 "Types should be listed at most once.");
1641
1642 auto copy{ *this };
1643 copy.set(std::forward<Args>(args)...);
1644 return copy;
1645 }
1646
1649 {
1650 return m_cameraMatrix;
1651 }
1652
1655 {
1656 return m_cameraMatrix;
1657 }
1658
1661 {
1662 m_cameraMatrix = value;
1663 return *this;
1664 }
1665
1668 {
1669 m_cameraMatrix.set(value);
1670 return *this;
1671 }
1672
1675 {
1676 m_cameraMatrix.set(value);
1677 return *this;
1678 }
1679
1682 {
1683 m_cameraMatrix.set(value);
1684 return *this;
1685 }
1686
1689 {
1690 m_cameraMatrix.set(value);
1691 return *this;
1692 }
1693
1695 const Distortion &distortion() const
1696 {
1697 return m_distortion;
1698 }
1699
1702 {
1703 return m_distortion;
1704 }
1705
1708 {
1709 m_distortion = value;
1710 return *this;
1711 }
1712
1715 {
1716 m_distortion.set(value);
1717 return *this;
1718 }
1719
1722 {
1723 m_distortion.set(value);
1724 return *this;
1725 }
1726
1729 {
1730 m_distortion.set(value);
1731 return *this;
1732 }
1733
1736 {
1737 m_distortion.set(value);
1738 return *this;
1739 }
1740
1743 {
1744 m_distortion.set(value);
1745 return *this;
1746 }
1747
1748 template<typename T,
1749 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix>::value, int>::type = 0>
1751 {
1752 return m_cameraMatrix;
1753 }
1754
1755 template<typename T,
1756 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CX>::value, int>::type = 0>
1758 {
1759 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::CX>();
1760 }
1761
1762 template<typename T,
1763 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CY>::value, int>::type = 0>
1765 {
1766 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::CY>();
1767 }
1768
1769 template<typename T,
1770 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FX>::value, int>::type = 0>
1772 {
1773 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::FX>();
1774 }
1775
1776 template<typename T,
1777 typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FY>::value, int>::type = 0>
1779 {
1780 return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::FY>();
1781 }
1782
1783 template<typename T,
1784 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion>::value, int>::type = 0>
1786 {
1787 return m_distortion;
1788 }
1789
1790 template<typename T,
1791 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K1>::value, int>::type = 0>
1793 {
1794 return m_distortion.get<CameraIntrinsics::Distortion::K1>();
1795 }
1796
1797 template<typename T,
1798 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K2>::value, int>::type = 0>
1800 {
1801 return m_distortion.get<CameraIntrinsics::Distortion::K2>();
1802 }
1803
1804 template<typename T,
1805 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K3>::value, int>::type = 0>
1807 {
1808 return m_distortion.get<CameraIntrinsics::Distortion::K3>();
1809 }
1810
1811 template<typename T,
1812 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P1>::value, int>::type = 0>
1814 {
1815 return m_distortion.get<CameraIntrinsics::Distortion::P1>();
1816 }
1817
1818 template<typename T,
1819 typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P2>::value, int>::type = 0>
1821 {
1822 return m_distortion.get<CameraIntrinsics::Distortion::P2>();
1823 }
1824
1825 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1827 {
1828 return m_cameraMatrix;
1829 }
1830
1831 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1833 {
1834 return m_distortion;
1835 }
1836
1838 template<typename F>
1839 void forEach(const F &f) const
1840 {
1841 f(m_cameraMatrix);
1842 f(m_distortion);
1843 }
1844
1846 template<typename F>
1847 void forEach(const F &f)
1848 {
1849 f(m_cameraMatrix);
1850 f(m_distortion);
1851 }
1852
1854 bool operator==(const CameraIntrinsics &other) const;
1855
1857 bool operator!=(const CameraIntrinsics &other) const;
1858
1860 std::string toString() const;
1861
1863 friend std::ostream &operator<<(std::ostream &stream, const CameraIntrinsics &value)
1864 {
1865 return stream << value.toString();
1866 }
1867
1869 void save(const std::string &fileName) const;
1870
1872 void load(const std::string &fileName);
1873
1874 private:
1875 void setFromString(const std::string &value);
1876
1877 void setFromString(const std::string &fullPath, const std::string &value);
1878
1879 std::string getString(const std::string &fullPath) const;
1880
1881 CameraMatrix m_cameraMatrix;
1882 Distortion m_distortion;
1883
1884 friend struct DataModel::Detail::Befriend<CameraIntrinsics>;
1885 };
1886
1887#ifndef NO_DOC
1888 template<>
1889 struct CameraIntrinsics::Version<1>
1890 {
1891 using Type = CameraIntrinsics;
1892 };
1893#endif
1894
1895} // namespace Zivid
1896
1897#ifdef _MSC_VER
1898# pragma warning(pop)
1899#endif
1900
1901#ifndef NO_DOC
1902# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
1903namespace std // NOLINT
1904{
1905 template<>
1906 struct tuple_size<Zivid::CameraIntrinsics::CameraMatrix> : integral_constant<size_t, 4>
1907 {};
1908
1909 template<size_t i>
1910 struct tuple_element<i, Zivid::CameraIntrinsics::CameraMatrix>
1911 {
1912 static_assert(i < tuple_size<Zivid::CameraIntrinsics::CameraMatrix>::value, "Index must be less than 4");
1913
1914 using type // NOLINT
1915 = decltype(declval<Zivid::CameraIntrinsics::CameraMatrix>().get<i>());
1916 };
1917
1918 template<>
1919 struct tuple_size<Zivid::CameraIntrinsics::Distortion> : integral_constant<size_t, 5>
1920 {};
1921
1922 template<size_t i>
1923 struct tuple_element<i, Zivid::CameraIntrinsics::Distortion>
1924 {
1925 static_assert(i < tuple_size<Zivid::CameraIntrinsics::Distortion>::value, "Index must be less than 5");
1926
1927 using type // NOLINT
1928 = decltype(declval<Zivid::CameraIntrinsics::Distortion>().get<i>());
1929 };
1930
1931 template<>
1932 struct tuple_size<Zivid::CameraIntrinsics> : integral_constant<size_t, 2>
1933 {};
1934
1935 template<size_t i>
1936 struct tuple_element<i, Zivid::CameraIntrinsics>
1937 {
1938 static_assert(i < tuple_size<Zivid::CameraIntrinsics>::value, "Index must be less than 2");
1939
1940 using type // NOLINT
1941 = decltype(declval<Zivid::CameraIntrinsics>().get<i>());
1942 };
1943
1944} // namespace std
1945# endif
1946#endif
#define ZIVID_CORE_EXPORT
Definition: CoreExport.h:101
x coordinate of the principal point
Definition: CameraIntrinsics.h:170
bool operator==(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:210
std::string toString() const
Get the value as string
bool operator<(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:222
constexpr CX(double value)
Constructor
Definition: CameraIntrinsics.h:199
bool operator>(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:228
bool operator!=(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:216
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:234
static constexpr Range< double > validRange()
The range of valid values for CX
Definition: CameraIntrinsics.h:190
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:187
y coordinate of the principal point
Definition: CameraIntrinsics.h:249
friend std::ostream & operator<<(std::ostream &stream, const CY &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:313
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:266
bool operator>(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:307
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:269
bool operator!=(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:295
std::string toString() const
Get the value as string
bool operator==(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:289
bool operator<(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:301
constexpr CY(double value)
Constructor
Definition: CameraIntrinsics.h:278
Focal length in x
Definition: CameraIntrinsics.h:328
static constexpr Range< double > validRange()
The range of valid values for FX
Definition: CameraIntrinsics.h:346
double value() const
Get the value
FX()=default
Default constructor
bool operator!=(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:372
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:343
constexpr FX(double value)
Constructor
Definition: CameraIntrinsics.h:355
bool operator==(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:366
bool operator>(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:384
friend std::ostream & operator<<(std::ostream &stream, const FX &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:390
std::string toString() const
Get the value as string
bool operator<(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:378
Focal length in y
Definition: CameraIntrinsics.h:405
bool operator>(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:461
bool operator!=(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:449
bool operator==(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:443
FY()=default
Default constructor
static constexpr Range< double > validRange()
The range of valid values for FY
Definition: CameraIntrinsics.h:423
double value() const
Get the value
bool operator<(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:455
friend std::ostream & operator<<(std::ostream &stream, const FY &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:467
std::string toString() const
Get the value as string
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:420
constexpr FY(double value)
Constructor
Definition: CameraIntrinsics.h:432
The camera matrix K (=[fx,0,cx;0,fy,cy;0,0,1])
Definition: CameraIntrinsics.h:152
const FX & fx() const
Get FX
Definition: CameraIntrinsics.h:631
const CameraIntrinsics::CameraMatrix::CX & get() const
Definition: CameraIntrinsics.h:670
void set(Args &&...args)
Set multiple arguments
Definition: CameraIntrinsics.h:541
CameraMatrix & set(const CY &value)
Set CY
Definition: CameraIntrinsics.h:624
const CameraIntrinsics::CameraMatrix::FX & get() const
Definition: CameraIntrinsics.h:684
bool operator!=(const CameraMatrix &other) const
Inequality operator
const CY & cy() const
Get CY
Definition: CameraIntrinsics.h:612
const CameraIntrinsics::CameraMatrix::FY & get() const
Definition: CameraIntrinsics.h:691
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:750
CameraMatrix & set(const CX &value)
Set CX
Definition: CameraIntrinsics.h:605
const CameraIntrinsics::CameraMatrix::CY & get() const
Definition: CameraIntrinsics.h:677
CameraMatrix & set(const FY &value)
Set FY
Definition: CameraIntrinsics.h:662
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:722
std::tuple< CameraIntrinsics::CameraMatrix::CX, CameraIntrinsics::CameraMatrix::CY, CameraIntrinsics::CameraMatrix::FX, CameraIntrinsics::CameraMatrix::FY > Descendants
Definition: CameraIntrinsics.h:483
CameraMatrix & set(const FX &value)
Set FX
Definition: CameraIntrinsics.h:643
FY & fy()
Get FY
Definition: CameraIntrinsics.h:656
CameraMatrix(Args &&...args)
Constructor taking variadic number of arguments
Definition: CameraIntrinsics.h:512
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:575
CX & cx()
Get CX
Definition: CameraIntrinsics.h:599
const FY & fy() const
Get FY
Definition: CameraIntrinsics.h:650
const CX & cx() const
Get CX
Definition: CameraIntrinsics.h:593
CY & cy()
Get CY
Definition: CameraIntrinsics.h:618
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter
Definition: CameraIntrinsics.h:732
FX & fx()
Get FX
Definition: CameraIntrinsics.h:637
First radial distortion term
Definition: CameraIntrinsics.h:790
bool operator<(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:840
K1()=default
Default constructor
bool operator!=(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:834
friend std::ostream & operator<<(std::ostream &stream, const K1 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:852
bool operator>(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:846
constexpr K1(double value)
Constructor
Definition: CameraIntrinsics.h:817
static constexpr Range< double > validRange()
The range of valid values for K1
Definition: CameraIntrinsics.h:808
bool operator==(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:828
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:805
Second radial distortion term
Definition: CameraIntrinsics.h:867
static constexpr Range< double > validRange()
The range of valid values for K2
Definition: CameraIntrinsics.h:885
bool operator>(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:923
bool operator!=(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:911
std::string toString() const
Get the value as string
bool operator==(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:905
bool operator<(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:917
friend std::ostream & operator<<(std::ostream &stream, const K2 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:929
K2()=default
Default constructor
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:882
constexpr K2(double value)
Constructor
Definition: CameraIntrinsics.h:894
double value() const
Get the value
Third radial distortion term
Definition: CameraIntrinsics.h:944
bool operator<(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:994
double value() const
Get the value
static constexpr Range< double > validRange()
The range of valid values for K3
Definition: CameraIntrinsics.h:962
K3()=default
Default constructor
std::string toString() const
Get the value as string
constexpr K3(double value)
Constructor
Definition: CameraIntrinsics.h:971
bool operator>(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1000
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:959
bool operator!=(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:988
friend std::ostream & operator<<(std::ostream &stream, const K3 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:1006
bool operator==(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:982
First tangential distortion term
Definition: CameraIntrinsics.h:1021
bool operator>(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1077
static constexpr Range< double > validRange()
The range of valid values for P1
Definition: CameraIntrinsics.h:1039
bool operator==(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1059
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:1083
bool operator<(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1071
P1()=default
Default constructor
double value() const
Get the value
constexpr P1(double value)
Constructor
Definition: CameraIntrinsics.h:1048
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:1036
bool operator!=(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1065
Second tangential distortion term
Definition: CameraIntrinsics.h:1098
static constexpr Range< double > validRange()
The range of valid values for P2
Definition: CameraIntrinsics.h:1118
bool operator==(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1138
friend std::ostream & operator<<(std::ostream &stream, const P2 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:1162
bool operator>(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1156
constexpr P2(double value)
Constructor
Definition: CameraIntrinsics.h:1127
P2()=default
Default constructor
double value() const
Get the value
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:1115
std::string toString() const
Get the value as string
bool operator<(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1150
bool operator!=(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1144
The radial and tangential distortion parameters
Definition: CameraIntrinsics.h:772
const CameraIntrinsics::Distortion::K3 & get() const
Definition: CameraIntrinsics.h:1402
Distortion(Args &&...args)
Constructor taking variadic number of arguments
Definition: CameraIntrinsics.h:1209
const P2 & p2() const
Get P2
Definition: CameraIntrinsics.h:1368
K3 & k3()
Get K3
Definition: CameraIntrinsics.h:1336
const K2 & k2() const
Get K2
Definition: CameraIntrinsics.h:1311
void set(Args &&...args)
Set multiple arguments
Definition: CameraIntrinsics.h:1239
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:1274
Distortion & set(const K2 &value)
Set K2
Definition: CameraIntrinsics.h:1323
K1 & k1()
Get K1
Definition: CameraIntrinsics.h:1298
std::string toString() const
Get the value as string
P1 & p1()
Get P1
Definition: CameraIntrinsics.h:1355
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:1464
const CameraIntrinsics::Distortion::K2 & get() const
Definition: CameraIntrinsics.h:1395
const CameraIntrinsics::Distortion::P2 & get() const
Definition: CameraIntrinsics.h:1416
Distortion & set(const K3 &value)
Set K3
Definition: CameraIntrinsics.h:1342
std::tuple< CameraIntrinsics::Distortion::K1, CameraIntrinsics::Distortion::K2, CameraIntrinsics::Distortion::K3, CameraIntrinsics::Distortion::P1, CameraIntrinsics::Distortion::P2 > Descendants
Definition: CameraIntrinsics.h:1179
const CameraIntrinsics::Distortion::P1 & get() const
Definition: CameraIntrinsics.h:1409
bool operator!=(const Distortion &other) const
Inequality operator
const P1 & p1() const
Get P1
Definition: CameraIntrinsics.h:1349
const K3 & k3() const
Get K3
Definition: CameraIntrinsics.h:1330
Distortion & set(const P1 &value)
Set P1
Definition: CameraIntrinsics.h:1361
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:1453
const CameraIntrinsics::Distortion::K1 & get() const
Definition: CameraIntrinsics.h:1388
const K1 & k1() const
Get K1
Definition: CameraIntrinsics.h:1292
Distortion & set(const P2 &value)
Set P2
Definition: CameraIntrinsics.h:1380
Distortion & set(const K1 &value)
Set K1
Definition: CameraIntrinsics.h:1304
P2 & p2()
Get P2
Definition: CameraIntrinsics.h:1374
K2 & k2()
Get K2
Definition: CameraIntrinsics.h:1317
friend std::ostream & operator<<(std::ostream &stream, const Distortion &value)
Operator to send the value as string to a stream
Definition: CameraIntrinsics.h:1483
Information about the intrinsic parameters of the camera (OpenCV model)
Definition: CameraIntrinsics.h:120
CameraIntrinsics & set(const Distortion::K3 &value)
Set Distortion::K3
Definition: CameraIntrinsics.h:1728
CameraMatrix & cameraMatrix()
Get CameraMatrix
Definition: CameraIntrinsics.h:1654
const CameraIntrinsics::CameraMatrix::CX & get() const
Definition: CameraIntrinsics.h:1757
const CameraIntrinsics::Distortion::K1 & get() const
Definition: CameraIntrinsics.h:1792
bool operator!=(const CameraIntrinsics &other) const
Inequality operator
const CameraIntrinsics::CameraMatrix::FY & get() const
Definition: CameraIntrinsics.h:1778
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:1839
CameraIntrinsics(Args &&...args)
Constructor taking variadic number of arguments
Definition: CameraIntrinsics.h:1553
std::string toString() const
Get the value as string
CameraIntrinsics & set(const Distortion::P1 &value)
Set Distortion::P1
Definition: CameraIntrinsics.h:1735
const Distortion & distortion() const
Get Distortion
Definition: CameraIntrinsics.h:1695
void set(Args &&...args)
Set multiple arguments
Definition: CameraIntrinsics.h:1589
CameraIntrinsics & set(const Distortion::K1 &value)
Set Distortion::K1
Definition: CameraIntrinsics.h:1714
const CameraIntrinsics::Distortion::K3 & get() const
Definition: CameraIntrinsics.h:1806
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:1630
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter
Definition: CameraIntrinsics.h:1847
CameraIntrinsics()
Default constructor
CameraIntrinsics & set(const CameraMatrix::FY &value)
Set CameraMatrix::FY
Definition: CameraIntrinsics.h:1688
void load(const std::string &fileName)
Load from the given file
const CameraIntrinsics::Distortion::P1 & get() const
Definition: CameraIntrinsics.h:1813
bool operator==(const CameraIntrinsics &other) const
Equality operator
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:1514
CameraIntrinsics & set(const CameraMatrix::CY &value)
Set CameraMatrix::CY
Definition: CameraIntrinsics.h:1674
CameraIntrinsics(const std::string &fileName)
Construct CameraIntrinsics by loading from file
CameraIntrinsics & set(const CameraMatrix &value)
Set CameraMatrix
Definition: CameraIntrinsics.h:1660
CameraIntrinsics & set(const Distortion::P2 &value)
Set Distortion::P2
Definition: CameraIntrinsics.h:1742
CameraIntrinsics & set(const Distortion &value)
Set Distortion
Definition: CameraIntrinsics.h:1707
const CameraIntrinsics::CameraMatrix::CY & get() const
Definition: CameraIntrinsics.h:1764
CameraIntrinsics & set(const CameraMatrix::CX &value)
Set CameraMatrix::CX
Definition: CameraIntrinsics.h:1667
void save(const std::string &fileName) const
Save to the given file
CameraIntrinsics & set(const CameraMatrix::FX &value)
Set CameraMatrix::FX
Definition: CameraIntrinsics.h:1681
const CameraIntrinsics::CameraMatrix & get() const
Definition: CameraIntrinsics.h:1750
const CameraIntrinsics::Distortion::K2 & get() const
Definition: CameraIntrinsics.h:1799
const CameraMatrix & cameraMatrix() const
Get CameraMatrix
Definition: CameraIntrinsics.h:1648
const CameraIntrinsics::Distortion::P2 & get() const
Definition: CameraIntrinsics.h:1820
const CameraIntrinsics::Distortion & get() const
Definition: CameraIntrinsics.h:1785
friend std::ostream & operator<<(std::ostream &stream, const CameraIntrinsics &value)
Operator to send the value as string to a stream
Definition: CameraIntrinsics.h:1863
const CameraIntrinsics::CameraMatrix::FX & get() const
Definition: CameraIntrinsics.h:1771
Distortion & distortion()
Get Distortion
Definition: CameraIntrinsics.h:1701
CameraIntrinsics & set(const Distortion::K2 &value)
Set Distortion::K2
Definition: CameraIntrinsics.h:1721
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