Zivid C++ API  2.3.1+1a22cbf1-1
Defining the Future of 3D Machine Vision
CameraIntrinsics.h
Go to the documentation of this file.
1 
2 /*******************************************************************************
3  * This file is part of the Zivid 3D Camera API
4  *
5  * Copyright 2015-2022 (C) Zivid AS
6  * All rights reserved.
7  *
8  * Zivid Software License, v1.0
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  *
20  * 3. Neither the name of Zivid AS nor the names of its contributors may be used
21  * to endorse or promote products derived from this software without specific
22  * prior written permission.
23  *
24  * 4. This software, with or without modification, must not be used with any
25  * other 3D camera than from Zivid AS.
26  *
27  * 5. Any software provided in binary form under this license must not be
28  * reverse engineered, decompiled, modified and/or disassembled.
29  *
30  * THIS SOFTWARE IS PROVIDED BY ZIVID AS "AS IS" AND ANY EXPRESS OR IMPLIED
31  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
32  * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
33  * DISCLAIMED. IN NO EVENT SHALL ZIVID AS OR CONTRIBUTORS BE LIABLE FOR ANY
34  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
37  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  *
41  * Contact: Zivid Customer Success Team <customersuccess@zivid.com>
42  * Info: http://www.zivid.com
43  ******************************************************************************/
44 
45 #pragma once
46 
47 #include <array>
48 #include <chrono>
49 #include <cmath>
50 #include <ctime>
51 #include <iomanip>
52 #include <memory>
53 #include <set>
54 #include <sstream>
55 #include <string>
56 #include <tuple>
57 #include <utility>
58 #include <vector>
59 
62 #include "Zivid/DataModel/Traits.h"
65 #include "Zivid/Range.h"
66 
67 #ifdef _MSC_VER
68 # pragma warning(push)
69 # pragma warning(disable : 4251) // "X needs to have dll-interface to be used by clients of class Y."
70 #endif
71 
72 namespace Zivid
73 {
76  {
77  public:
79  static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
80 
82  static constexpr const char *path{ "" };
83 
85  static constexpr const char *name{ "CameraIntrinsics" };
86 
88  static constexpr const char *description{
89  R"description(Information about the intrinsic parameters of the camera (OpenCV model))description"
90  };
91 
92  static constexpr size_t version{ 1 };
93 
94 #ifndef NO_DOC
95  template<size_t>
96  struct Version;
97 
98  using LatestVersion = Zivid::CameraIntrinsics;
99 
100  // Short identifier. This value is not guaranteed to be universally unique
101  // Todo(ZIVID-2808): Move this to internal DataModelExt header
102  static constexpr std::array<uint8_t, 3> binaryId{ 'c', 'i', 'n' };
103 
104 #endif
105 
108  {
109  public:
111  static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
112 
114  static constexpr const char *path{ "CameraMatrix" };
115 
117  static constexpr const char *name{ "CameraMatrix" };
118 
120  static constexpr const char *description{
121  R"description(The camera matrix K (=[fx,0,cx;0,fy,cy;0,0,1]))description"
122  };
123 
126  {
127  public:
130 
132  static constexpr const char *path{ "CameraMatrix/CX" };
133 
135  static constexpr const char *name{ "CX" };
136 
138  static constexpr const char *description{
139  R"description(x coordinate of the principal point)description"
140  };
141 
143  using ValueType = double;
144 
146  static constexpr Range<double> validRange()
147  {
148  return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
149  }
150 
152  CX() = default;
153 
155  explicit constexpr CX(double value)
156  : m_value{ value }
157  {}
158 
160  double value() const;
161 
163  std::string toString() const;
164 
166  bool operator==(const CX &other) const
167  {
168  return m_value == other.m_value;
169  }
170 
172  bool operator!=(const CX &other) const
173  {
174  return m_value != other.m_value;
175  }
176 
178  bool operator<(const CX &other) const
179  {
180  return m_value < other.m_value;
181  }
182 
184  bool operator>(const CX &other) const
185  {
186  return m_value > other.m_value;
187  }
188 
190  friend std::ostream &operator<<(std::ostream &stream, const CX &value)
191  {
192  return stream << value.toString();
193  }
194 
195  private:
196  void setFromString(const std::string &value);
197 
198  double m_value{ 0.0 };
199 
200  friend struct DataModel::Detail::Befriend<CX>;
201  };
202 
205  {
206  public:
209 
211  static constexpr const char *path{ "CameraMatrix/CY" };
212 
214  static constexpr const char *name{ "CY" };
215 
217  static constexpr const char *description{
218  R"description(y coordinate of the principal point)description"
219  };
220 
222  using ValueType = double;
223 
225  static constexpr Range<double> validRange()
226  {
227  return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
228  }
229 
231  CY() = default;
232 
234  explicit constexpr CY(double value)
235  : m_value{ value }
236  {}
237 
239  double value() const;
240 
242  std::string toString() const;
243 
245  bool operator==(const CY &other) const
246  {
247  return m_value == other.m_value;
248  }
249 
251  bool operator!=(const CY &other) const
252  {
253  return m_value != other.m_value;
254  }
255 
257  bool operator<(const CY &other) const
258  {
259  return m_value < other.m_value;
260  }
261 
263  bool operator>(const CY &other) const
264  {
265  return m_value > other.m_value;
266  }
267 
269  friend std::ostream &operator<<(std::ostream &stream, const CY &value)
270  {
271  return stream << value.toString();
272  }
273 
274  private:
275  void setFromString(const std::string &value);
276 
277  double m_value{ 0.0 };
278 
279  friend struct DataModel::Detail::Befriend<CY>;
280  };
281 
284  {
285  public:
288 
290  static constexpr const char *path{ "CameraMatrix/FX" };
291 
293  static constexpr const char *name{ "FX" };
294 
296  static constexpr const char *description{ R"description(Focal length in x)description" };
297 
299  using ValueType = double;
300 
302  static constexpr Range<double> validRange()
303  {
304  return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
305  }
306 
308  FX() = default;
309 
311  explicit constexpr FX(double value)
312  : m_value{ value }
313  {}
314 
316  double value() const;
317 
319  std::string toString() const;
320 
322  bool operator==(const FX &other) const
323  {
324  return m_value == other.m_value;
325  }
326 
328  bool operator!=(const FX &other) const
329  {
330  return m_value != other.m_value;
331  }
332 
334  bool operator<(const FX &other) const
335  {
336  return m_value < other.m_value;
337  }
338 
340  bool operator>(const FX &other) const
341  {
342  return m_value > other.m_value;
343  }
344 
346  friend std::ostream &operator<<(std::ostream &stream, const FX &value)
347  {
348  return stream << value.toString();
349  }
350 
351  private:
352  void setFromString(const std::string &value);
353 
354  double m_value{ 0.0 };
355 
356  friend struct DataModel::Detail::Befriend<FX>;
357  };
358 
361  {
362  public:
365 
367  static constexpr const char *path{ "CameraMatrix/FY" };
368 
370  static constexpr const char *name{ "FY" };
371 
373  static constexpr const char *description{ R"description(Focal length in y)description" };
374 
376  using ValueType = double;
377 
379  static constexpr Range<double> validRange()
380  {
381  return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
382  }
383 
385  FY() = default;
386 
388  explicit constexpr FY(double value)
389  : m_value{ value }
390  {}
391 
393  double value() const;
394 
396  std::string toString() const;
397 
399  bool operator==(const FY &other) const
400  {
401  return m_value == other.m_value;
402  }
403 
405  bool operator!=(const FY &other) const
406  {
407  return m_value != other.m_value;
408  }
409 
411  bool operator<(const FY &other) const
412  {
413  return m_value < other.m_value;
414  }
415 
417  bool operator>(const FY &other) const
418  {
419  return m_value > other.m_value;
420  }
421 
423  friend std::ostream &operator<<(std::ostream &stream, const FY &value)
424  {
425  return stream << value.toString();
426  }
427 
428  private:
429  void setFromString(const std::string &value);
430 
431  double m_value{ 0.0 };
432 
433  friend struct DataModel::Detail::Befriend<FY>;
434  };
435 
440 
443 
458 #ifndef NO_DOC
459  template<typename... Args,
460  typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
461  typename std::enable_if<
462  Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants,
463  typename std::decay<Args>::type...>::value,
464  int>::type = 0>
465 #else
466  template<typename... Args>
467 #endif
468  explicit CameraMatrix(Args &&...args)
469  {
470  using namespace Zivid::Detail::TypeTraits;
471 
472  static_assert(AllArgsDecayedAreUnique<Args...>::value,
473  "Found duplicate types among the arguments passed to CameraMatrix(...). "
474  "Types should be listed at most once.");
475 
476  set(std::forward<Args>(args)...);
477  }
478 
492 #ifndef NO_DOC
493  template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
494 #else
495  template<typename... Args>
496 #endif
497  void set(Args &&...args)
498  {
499  using namespace Zivid::Detail::TypeTraits;
500 
501  using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
502  static_assert(AllArgsAreDescendantNodes::value,
503  "All arguments passed to set(...) must be descendant nodes.");
504 
505  static_assert(AllArgsDecayedAreUnique<Args...>::value,
506  "Found duplicate types among the arguments passed to set(...). "
507  "Types should be listed at most once.");
508 
509  Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
510  }
511 
526 #ifndef NO_DOC
527  template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
528 #else
529  template<typename... Args>
530 #endif
531  CameraMatrix copyWith(Args &&...args) const
532  {
533  using namespace Zivid::Detail::TypeTraits;
534 
535  using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
536  static_assert(AllArgsAreDescendantNodes::value,
537  "All arguments passed to copyWith(...) must be descendant nodes.");
538 
539  static_assert(AllArgsDecayedAreUnique<Args...>::value,
540  "Found duplicate types among the arguments passed to copyWith(...). "
541  "Types should be listed at most once.");
542 
543  auto copy{ *this };
544  copy.set(std::forward<Args>(args)...);
545  return copy;
546  }
547 
549  const CX &cx() const
550  {
551  return m_cx;
552  }
553 
555  CX &cx()
556  {
557  return m_cx;
558  }
559 
561  CameraMatrix &set(const CX &value)
562  {
563  m_cx = value;
564  return *this;
565  }
566 
568  const CY &cy() const
569  {
570  return m_cy;
571  }
572 
574  CY &cy()
575  {
576  return m_cy;
577  }
578 
580  CameraMatrix &set(const CY &value)
581  {
582  m_cy = value;
583  return *this;
584  }
585 
587  const FX &fx() const
588  {
589  return m_fx;
590  }
591 
593  FX &fx()
594  {
595  return m_fx;
596  }
597 
599  CameraMatrix &set(const FX &value)
600  {
601  m_fx = value;
602  return *this;
603  }
604 
606  const FY &fy() const
607  {
608  return m_fy;
609  }
610 
612  FY &fy()
613  {
614  return m_fy;
615  }
616 
618  CameraMatrix &set(const FY &value)
619  {
620  m_fy = value;
621  return *this;
622  }
623 
624  template<typename T,
625  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CX>::value, int>::type = 0>
627  {
628  return m_cx;
629  }
630 
631  template<typename T,
632  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CY>::value, int>::type = 0>
634  {
635  return m_cy;
636  }
637 
638  template<typename T,
639  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FX>::value, int>::type = 0>
641  {
642  return m_fx;
643  }
644 
645  template<typename T,
646  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FY>::value, int>::type = 0>
648  {
649  return m_fy;
650  }
651 
652  template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
654  {
655  return m_cx;
656  }
657 
658  template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
660  {
661  return m_cy;
662  }
663 
664  template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
666  {
667  return m_fx;
668  }
669 
670  template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
672  {
673  return m_fy;
674  }
675 
677  template<typename F>
678  void forEach(const F &f) const
679  {
680  f(m_cx);
681  f(m_cy);
682  f(m_fx);
683  f(m_fy);
684  }
685 
687  template<typename F>
688  void forEach(const F &f)
689  {
690  f(m_cx);
691  f(m_cy);
692  f(m_fx);
693  f(m_fy);
694  }
695 
697  bool operator==(const CameraMatrix &other) const;
698 
700  bool operator!=(const CameraMatrix &other) const;
701 
703  std::string toString() const;
704 
706  friend std::ostream &operator<<(std::ostream &stream, const CameraMatrix &value)
707  {
708  return stream << value.toString();
709  }
710 
711  private:
712  void setFromString(const std::string &value);
713 
714  void setFromString(const std::string &fullPath, const std::string &value);
715 
716  std::string getString(const std::string &fullPath) const;
717 
718  CX m_cx;
719  CY m_cy;
720  FX m_fx;
721  FY m_fy;
722 
723  friend struct DataModel::Detail::Befriend<CameraMatrix>;
724  };
725 
728  {
729  public:
731  static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
732 
734  static constexpr const char *path{ "Distortion" };
735 
737  static constexpr const char *name{ "Distortion" };
738 
740  static constexpr const char *description{
741  R"description(The radial and tangential distortion parameters)description"
742  };
743 
746  {
747  public:
750 
752  static constexpr const char *path{ "Distortion/K1" };
753 
755  static constexpr const char *name{ "K1" };
756 
758  static constexpr const char *description{ R"description(First radial distortion term)description" };
759 
761  using ValueType = double;
762 
764  static constexpr Range<double> validRange()
765  {
766  return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
767  }
768 
770  K1() = default;
771 
773  explicit constexpr K1(double value)
774  : m_value{ value }
775  {}
776 
778  double value() const;
779 
781  std::string toString() const;
782 
784  bool operator==(const K1 &other) const
785  {
786  return m_value == other.m_value;
787  }
788 
790  bool operator!=(const K1 &other) const
791  {
792  return m_value != other.m_value;
793  }
794 
796  bool operator<(const K1 &other) const
797  {
798  return m_value < other.m_value;
799  }
800 
802  bool operator>(const K1 &other) const
803  {
804  return m_value > other.m_value;
805  }
806 
808  friend std::ostream &operator<<(std::ostream &stream, const K1 &value)
809  {
810  return stream << value.toString();
811  }
812 
813  private:
814  void setFromString(const std::string &value);
815 
816  double m_value{ 0.0 };
817 
818  friend struct DataModel::Detail::Befriend<K1>;
819  };
820 
823  {
824  public:
827 
829  static constexpr const char *path{ "Distortion/K2" };
830 
832  static constexpr const char *name{ "K2" };
833 
835  static constexpr const char *description{ R"description(Second radial distortion term)description" };
836 
838  using ValueType = double;
839 
841  static constexpr Range<double> validRange()
842  {
843  return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
844  }
845 
847  K2() = default;
848 
850  explicit constexpr K2(double value)
851  : m_value{ value }
852  {}
853 
855  double value() const;
856 
858  std::string toString() const;
859 
861  bool operator==(const K2 &other) const
862  {
863  return m_value == other.m_value;
864  }
865 
867  bool operator!=(const K2 &other) const
868  {
869  return m_value != other.m_value;
870  }
871 
873  bool operator<(const K2 &other) const
874  {
875  return m_value < other.m_value;
876  }
877 
879  bool operator>(const K2 &other) const
880  {
881  return m_value > other.m_value;
882  }
883 
885  friend std::ostream &operator<<(std::ostream &stream, const K2 &value)
886  {
887  return stream << value.toString();
888  }
889 
890  private:
891  void setFromString(const std::string &value);
892 
893  double m_value{ 0.0 };
894 
895  friend struct DataModel::Detail::Befriend<K2>;
896  };
897 
900  {
901  public:
904 
906  static constexpr const char *path{ "Distortion/K3" };
907 
909  static constexpr const char *name{ "K3" };
910 
912  static constexpr const char *description{ R"description(Third radial distortion term)description" };
913 
915  using ValueType = double;
916 
918  static constexpr Range<double> validRange()
919  {
920  return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
921  }
922 
924  K3() = default;
925 
927  explicit constexpr K3(double value)
928  : m_value{ value }
929  {}
930 
932  double value() const;
933 
935  std::string toString() const;
936 
938  bool operator==(const K3 &other) const
939  {
940  return m_value == other.m_value;
941  }
942 
944  bool operator!=(const K3 &other) const
945  {
946  return m_value != other.m_value;
947  }
948 
950  bool operator<(const K3 &other) const
951  {
952  return m_value < other.m_value;
953  }
954 
956  bool operator>(const K3 &other) const
957  {
958  return m_value > other.m_value;
959  }
960 
962  friend std::ostream &operator<<(std::ostream &stream, const K3 &value)
963  {
964  return stream << value.toString();
965  }
966 
967  private:
968  void setFromString(const std::string &value);
969 
970  double m_value{ 0.0 };
971 
972  friend struct DataModel::Detail::Befriend<K3>;
973  };
974 
977  {
978  public:
981 
983  static constexpr const char *path{ "Distortion/P1" };
984 
986  static constexpr const char *name{ "P1" };
987 
989  static constexpr const char *description{ R"description(First tangential distortion term)description" };
990 
992  using ValueType = double;
993 
995  static constexpr Range<double> validRange()
996  {
997  return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
998  }
999 
1001  P1() = default;
1002 
1004  explicit constexpr P1(double value)
1005  : m_value{ value }
1006  {}
1007 
1009  double value() const;
1010 
1012  std::string toString() const;
1013 
1015  bool operator==(const P1 &other) const
1016  {
1017  return m_value == other.m_value;
1018  }
1019 
1021  bool operator!=(const P1 &other) const
1022  {
1023  return m_value != other.m_value;
1024  }
1025 
1027  bool operator<(const P1 &other) const
1028  {
1029  return m_value < other.m_value;
1030  }
1031 
1033  bool operator>(const P1 &other) const
1034  {
1035  return m_value > other.m_value;
1036  }
1037 
1039  friend std::ostream &operator<<(std::ostream &stream, const P1 &value)
1040  {
1041  return stream << value.toString();
1042  }
1043 
1044  private:
1045  void setFromString(const std::string &value);
1046 
1047  double m_value{ 0.0 };
1048 
1049  friend struct DataModel::Detail::Befriend<P1>;
1050  };
1051 
1054  {
1055  public:
1058 
1060  static constexpr const char *path{ "Distortion/P2" };
1061 
1063  static constexpr const char *name{ "P2" };
1064 
1066  static constexpr const char *description{
1067  R"description(Second tangential distortion term)description"
1068  };
1069 
1071  using ValueType = double;
1072 
1074  static constexpr Range<double> validRange()
1075  {
1076  return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1077  }
1078 
1080  P2() = default;
1081 
1083  explicit constexpr P2(double value)
1084  : m_value{ value }
1085  {}
1086 
1088  double value() const;
1089 
1091  std::string toString() const;
1092 
1094  bool operator==(const P2 &other) const
1095  {
1096  return m_value == other.m_value;
1097  }
1098 
1100  bool operator!=(const P2 &other) const
1101  {
1102  return m_value != other.m_value;
1103  }
1104 
1106  bool operator<(const P2 &other) const
1107  {
1108  return m_value < other.m_value;
1109  }
1110 
1112  bool operator>(const P2 &other) const
1113  {
1114  return m_value > other.m_value;
1115  }
1116 
1118  friend std::ostream &operator<<(std::ostream &stream, const P2 &value)
1119  {
1120  return stream << value.toString();
1121  }
1122 
1123  private:
1124  void setFromString(const std::string &value);
1125 
1126  double m_value{ 0.0 };
1127 
1128  friend struct DataModel::Detail::Befriend<P2>;
1129  };
1130 
1136 
1139 
1155 #ifndef NO_DOC
1156  template<typename... Args,
1157  typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1158  typename std::enable_if<
1159  Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants,
1160  typename std::decay<Args>::type...>::value,
1161  int>::type = 0>
1162 #else
1163  template<typename... Args>
1164 #endif
1165  explicit Distortion(Args &&...args)
1166  {
1167  using namespace Zivid::Detail::TypeTraits;
1168 
1169  static_assert(AllArgsDecayedAreUnique<Args...>::value,
1170  "Found duplicate types among the arguments passed to Distortion(...). "
1171  "Types should be listed at most once.");
1172 
1173  set(std::forward<Args>(args)...);
1174  }
1175 
1190 #ifndef NO_DOC
1191  template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1192 #else
1193  template<typename... Args>
1194 #endif
1195  void set(Args &&...args)
1196  {
1197  using namespace Zivid::Detail::TypeTraits;
1198 
1199  using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1200  static_assert(AllArgsAreDescendantNodes::value,
1201  "All arguments passed to set(...) must be descendant nodes.");
1202 
1203  static_assert(AllArgsDecayedAreUnique<Args...>::value,
1204  "Found duplicate types among the arguments passed to set(...). "
1205  "Types should be listed at most once.");
1206 
1207  Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1208  }
1209 
1225 #ifndef NO_DOC
1226  template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1227 #else
1228  template<typename... Args>
1229 #endif
1230  Distortion copyWith(Args &&...args) const
1231  {
1232  using namespace Zivid::Detail::TypeTraits;
1233 
1234  using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1235  static_assert(AllArgsAreDescendantNodes::value,
1236  "All arguments passed to copyWith(...) must be descendant nodes.");
1237 
1238  static_assert(AllArgsDecayedAreUnique<Args...>::value,
1239  "Found duplicate types among the arguments passed to copyWith(...). "
1240  "Types should be listed at most once.");
1241 
1242  auto copy{ *this };
1243  copy.set(std::forward<Args>(args)...);
1244  return copy;
1245  }
1246 
1248  const K1 &k1() const
1249  {
1250  return m_k1;
1251  }
1252 
1254  K1 &k1()
1255  {
1256  return m_k1;
1257  }
1258 
1260  Distortion &set(const K1 &value)
1261  {
1262  m_k1 = value;
1263  return *this;
1264  }
1265 
1267  const K2 &k2() const
1268  {
1269  return m_k2;
1270  }
1271 
1273  K2 &k2()
1274  {
1275  return m_k2;
1276  }
1277 
1279  Distortion &set(const K2 &value)
1280  {
1281  m_k2 = value;
1282  return *this;
1283  }
1284 
1286  const K3 &k3() const
1287  {
1288  return m_k3;
1289  }
1290 
1292  K3 &k3()
1293  {
1294  return m_k3;
1295  }
1296 
1298  Distortion &set(const K3 &value)
1299  {
1300  m_k3 = value;
1301  return *this;
1302  }
1303 
1305  const P1 &p1() const
1306  {
1307  return m_p1;
1308  }
1309 
1311  P1 &p1()
1312  {
1313  return m_p1;
1314  }
1315 
1317  Distortion &set(const P1 &value)
1318  {
1319  m_p1 = value;
1320  return *this;
1321  }
1322 
1324  const P2 &p2() const
1325  {
1326  return m_p2;
1327  }
1328 
1330  P2 &p2()
1331  {
1332  return m_p2;
1333  }
1334 
1336  Distortion &set(const P2 &value)
1337  {
1338  m_p2 = value;
1339  return *this;
1340  }
1341 
1342  template<typename T,
1343  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K1>::value, int>::type = 0>
1345  {
1346  return m_k1;
1347  }
1348 
1349  template<typename T,
1350  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K2>::value, int>::type = 0>
1352  {
1353  return m_k2;
1354  }
1355 
1356  template<typename T,
1357  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K3>::value, int>::type = 0>
1359  {
1360  return m_k3;
1361  }
1362 
1363  template<typename T,
1364  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P1>::value, int>::type = 0>
1366  {
1367  return m_p1;
1368  }
1369 
1370  template<typename T,
1371  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P2>::value, int>::type = 0>
1373  {
1374  return m_p2;
1375  }
1376 
1377  template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1379  {
1380  return m_k1;
1381  }
1382 
1383  template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1385  {
1386  return m_k2;
1387  }
1388 
1389  template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
1391  {
1392  return m_k3;
1393  }
1394 
1395  template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
1397  {
1398  return m_p1;
1399  }
1400 
1401  template<size_t i, typename std::enable_if<i == 4, int>::type = 0>
1403  {
1404  return m_p2;
1405  }
1406 
1408  template<typename F>
1409  void forEach(const F &f) const
1410  {
1411  f(m_k1);
1412  f(m_k2);
1413  f(m_k3);
1414  f(m_p1);
1415  f(m_p2);
1416  }
1417 
1419  template<typename F>
1420  void forEach(const F &f)
1421  {
1422  f(m_k1);
1423  f(m_k2);
1424  f(m_k3);
1425  f(m_p1);
1426  f(m_p2);
1427  }
1428 
1430  bool operator==(const Distortion &other) const;
1431 
1433  bool operator!=(const Distortion &other) const;
1434 
1436  std::string toString() const;
1437 
1439  friend std::ostream &operator<<(std::ostream &stream, const Distortion &value)
1440  {
1441  return stream << value.toString();
1442  }
1443 
1444  private:
1445  void setFromString(const std::string &value);
1446 
1447  void setFromString(const std::string &fullPath, const std::string &value);
1448 
1449  std::string getString(const std::string &fullPath) const;
1450 
1451  K1 m_k1;
1452  K2 m_k2;
1453  K3 m_k3;
1454  P1 m_p1;
1455  P2 m_p2;
1456 
1457  friend struct DataModel::Detail::Befriend<Distortion>;
1458  };
1459 
1471 
1474 
1476  explicit CameraIntrinsics(const std::string &fileName);
1477 
1499 #ifndef NO_DOC
1500  template<
1501  typename... Args,
1502  typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1503  typename std::enable_if<
1504  Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
1505  int>::type = 0>
1506 #else
1507  template<typename... Args>
1508 #endif
1509  explicit CameraIntrinsics(Args &&...args)
1510  {
1511  using namespace Zivid::Detail::TypeTraits;
1512 
1513  static_assert(AllArgsDecayedAreUnique<Args...>::value,
1514  "Found duplicate types among the arguments passed to CameraIntrinsics(...). "
1515  "Types should be listed at most once.");
1516 
1517  set(std::forward<Args>(args)...);
1518  }
1519 
1540 #ifndef NO_DOC
1541  template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1542 #else
1543  template<typename... Args>
1544 #endif
1545  void set(Args &&...args)
1546  {
1547  using namespace Zivid::Detail::TypeTraits;
1548 
1549  using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1550  static_assert(AllArgsAreDescendantNodes::value,
1551  "All arguments passed to set(...) must be descendant nodes.");
1552 
1553  static_assert(AllArgsDecayedAreUnique<Args...>::value,
1554  "Found duplicate types among the arguments passed to set(...). "
1555  "Types should be listed at most once.");
1556 
1557  Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1558  }
1559 
1581 #ifndef NO_DOC
1582  template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1583 #else
1584  template<typename... Args>
1585 #endif
1586  CameraIntrinsics copyWith(Args &&...args) const
1587  {
1588  using namespace Zivid::Detail::TypeTraits;
1589 
1590  using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1591  static_assert(AllArgsAreDescendantNodes::value,
1592  "All arguments passed to copyWith(...) must be descendant nodes.");
1593 
1594  static_assert(AllArgsDecayedAreUnique<Args...>::value,
1595  "Found duplicate types among the arguments passed to copyWith(...). "
1596  "Types should be listed at most once.");
1597 
1598  auto copy{ *this };
1599  copy.set(std::forward<Args>(args)...);
1600  return copy;
1601  }
1602 
1605  {
1606  return m_cameraMatrix;
1607  }
1608 
1611  {
1612  return m_cameraMatrix;
1613  }
1614 
1617  {
1618  m_cameraMatrix = value;
1619  return *this;
1620  }
1621 
1624  {
1625  m_cameraMatrix.set(value);
1626  return *this;
1627  }
1628 
1631  {
1632  m_cameraMatrix.set(value);
1633  return *this;
1634  }
1635 
1638  {
1639  m_cameraMatrix.set(value);
1640  return *this;
1641  }
1642 
1645  {
1646  m_cameraMatrix.set(value);
1647  return *this;
1648  }
1649 
1651  const Distortion &distortion() const
1652  {
1653  return m_distortion;
1654  }
1655 
1658  {
1659  return m_distortion;
1660  }
1661 
1664  {
1665  m_distortion = value;
1666  return *this;
1667  }
1668 
1671  {
1672  m_distortion.set(value);
1673  return *this;
1674  }
1675 
1678  {
1679  m_distortion.set(value);
1680  return *this;
1681  }
1682 
1685  {
1686  m_distortion.set(value);
1687  return *this;
1688  }
1689 
1692  {
1693  m_distortion.set(value);
1694  return *this;
1695  }
1696 
1699  {
1700  m_distortion.set(value);
1701  return *this;
1702  }
1703 
1704  template<typename T,
1705  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix>::value, int>::type = 0>
1707  {
1708  return m_cameraMatrix;
1709  }
1710 
1711  template<typename T,
1712  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CX>::value, int>::type = 0>
1714  {
1715  return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::CX>();
1716  }
1717 
1718  template<typename T,
1719  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CY>::value, int>::type = 0>
1721  {
1722  return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::CY>();
1723  }
1724 
1725  template<typename T,
1726  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FX>::value, int>::type = 0>
1728  {
1729  return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::FX>();
1730  }
1731 
1732  template<typename T,
1733  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FY>::value, int>::type = 0>
1735  {
1736  return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::FY>();
1737  }
1738 
1739  template<typename T,
1740  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion>::value, int>::type = 0>
1742  {
1743  return m_distortion;
1744  }
1745 
1746  template<typename T,
1747  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K1>::value, int>::type = 0>
1749  {
1750  return m_distortion.get<CameraIntrinsics::Distortion::K1>();
1751  }
1752 
1753  template<typename T,
1754  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K2>::value, int>::type = 0>
1756  {
1757  return m_distortion.get<CameraIntrinsics::Distortion::K2>();
1758  }
1759 
1760  template<typename T,
1761  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K3>::value, int>::type = 0>
1763  {
1764  return m_distortion.get<CameraIntrinsics::Distortion::K3>();
1765  }
1766 
1767  template<typename T,
1768  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P1>::value, int>::type = 0>
1770  {
1771  return m_distortion.get<CameraIntrinsics::Distortion::P1>();
1772  }
1773 
1774  template<typename T,
1775  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P2>::value, int>::type = 0>
1777  {
1778  return m_distortion.get<CameraIntrinsics::Distortion::P2>();
1779  }
1780 
1781  template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1783  {
1784  return m_cameraMatrix;
1785  }
1786 
1787  template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1789  {
1790  return m_distortion;
1791  }
1792 
1794  template<typename F>
1795  void forEach(const F &f) const
1796  {
1797  f(m_cameraMatrix);
1798  f(m_distortion);
1799  }
1800 
1802  template<typename F>
1803  void forEach(const F &f)
1804  {
1805  f(m_cameraMatrix);
1806  f(m_distortion);
1807  }
1808 
1810  bool operator==(const CameraIntrinsics &other) const;
1811 
1813  bool operator!=(const CameraIntrinsics &other) const;
1814 
1816  std::string toString() const;
1817 
1819  friend std::ostream &operator<<(std::ostream &stream, const CameraIntrinsics &value)
1820  {
1821  return stream << value.toString();
1822  }
1823 
1825  void save(const std::string &fileName) const;
1826 
1828  void load(const std::string &fileName);
1829 
1830  private:
1831  void setFromString(const std::string &value);
1832 
1833  void setFromString(const std::string &fullPath, const std::string &value);
1834 
1835  std::string getString(const std::string &fullPath) const;
1836 
1837  CameraMatrix m_cameraMatrix;
1838  Distortion m_distortion;
1839 
1840  friend struct DataModel::Detail::Befriend<CameraIntrinsics>;
1841  };
1842 
1843 #ifndef NO_DOC
1844  template<>
1845  struct CameraIntrinsics::Version<1>
1846  {
1847  using Type = CameraIntrinsics;
1848  };
1849 #endif
1850 
1851 } // namespace Zivid
1852 
1853 #ifdef _MSC_VER
1854 # pragma warning(pop)
1855 #endif
1856 
1857 #ifndef NO_DOC
1858 # if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
1859 namespace std // NOLINT
1860 {
1861  template<>
1862  struct tuple_size<Zivid::CameraIntrinsics::CameraMatrix> : integral_constant<size_t, 4>
1863  {};
1864 
1865  template<size_t i>
1866  struct tuple_element<i, Zivid::CameraIntrinsics::CameraMatrix>
1867  {
1868  static_assert(i < tuple_size<Zivid::CameraIntrinsics::CameraMatrix>::value, "Index must be less than 4");
1869 
1870  using type // NOLINT
1871  = decltype(declval<Zivid::CameraIntrinsics::CameraMatrix>().get<i>());
1872  };
1873 
1874  template<>
1875  struct tuple_size<Zivid::CameraIntrinsics::Distortion> : integral_constant<size_t, 5>
1876  {};
1877 
1878  template<size_t i>
1879  struct tuple_element<i, Zivid::CameraIntrinsics::Distortion>
1880  {
1881  static_assert(i < tuple_size<Zivid::CameraIntrinsics::Distortion>::value, "Index must be less than 5");
1882 
1883  using type // NOLINT
1884  = decltype(declval<Zivid::CameraIntrinsics::Distortion>().get<i>());
1885  };
1886 
1887  template<>
1888  struct tuple_size<Zivid::CameraIntrinsics> : integral_constant<size_t, 2>
1889  {};
1890 
1891  template<size_t i>
1892  struct tuple_element<i, Zivid::CameraIntrinsics>
1893  {
1894  static_assert(i < tuple_size<Zivid::CameraIntrinsics>::value, "Index must be less than 2");
1895 
1896  using type // NOLINT
1897  = decltype(declval<Zivid::CameraIntrinsics>().get<i>());
1898  };
1899 
1900 } // namespace std
1901 # endif
1902 #endif
#define ZIVID_CORE_EXPORT
Definition: CoreExport.h:57
x coordinate of the principal point
Definition: CameraIntrinsics.h:126
friend std::ostream & operator<<(std::ostream &stream, const CX &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:190
bool operator==(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:166
std::string toString() const
Get the value as string
bool operator<(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:178
constexpr CX(double value)
Constructor
Definition: CameraIntrinsics.h:155
bool operator>(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:184
bool operator!=(const CX &other) const
Comparison operator
Definition: CameraIntrinsics.h:172
double value() const
Get the value
CX()=default
Default constructor
static constexpr Range< double > validRange()
The range of valid values for CX
Definition: CameraIntrinsics.h:146
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:143
y coordinate of the principal point
Definition: CameraIntrinsics.h:205
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:222
bool operator>(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:263
double value() const
Get the value
static constexpr Range< double > validRange()
The range of valid values for CY
Definition: CameraIntrinsics.h:225
CY()=default
Default constructor
bool operator!=(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:251
std::string toString() const
Get the value as string
friend std::ostream & operator<<(std::ostream &stream, const CY &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:269
bool operator==(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:245
bool operator<(const CY &other) const
Comparison operator
Definition: CameraIntrinsics.h:257
constexpr CY(double value)
Constructor
Definition: CameraIntrinsics.h:234
Focal length in x
Definition: CameraIntrinsics.h:284
static constexpr Range< double > validRange()
The range of valid values for FX
Definition: CameraIntrinsics.h:302
double value() const
Get the value
FX()=default
Default constructor
bool operator!=(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:328
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:299
friend std::ostream & operator<<(std::ostream &stream, const FX &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:346
constexpr FX(double value)
Constructor
Definition: CameraIntrinsics.h:311
bool operator==(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:322
bool operator>(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:340
std::string toString() const
Get the value as string
bool operator<(const FX &other) const
Comparison operator
Definition: CameraIntrinsics.h:334
Focal length in y
Definition: CameraIntrinsics.h:361
bool operator>(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:417
bool operator!=(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:405
bool operator==(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:399
FY()=default
Default constructor
double value() const
Get the value
bool operator<(const FY &other) const
Comparison operator
Definition: CameraIntrinsics.h:411
std::string toString() const
Get the value as string
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:376
constexpr FY(double value)
Constructor
Definition: CameraIntrinsics.h:388
friend std::ostream & operator<<(std::ostream &stream, const FY &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:423
static constexpr Range< double > validRange()
The range of valid values for FY
Definition: CameraIntrinsics.h:379
The camera matrix K (=[fx,0,cx;0,fy,cy;0,0,1])
Definition: CameraIntrinsics.h:108
const CX & cx() const
Get CX
Definition: CameraIntrinsics.h:549
void set(Args &&...args)
Set multiple arguments
Definition: CameraIntrinsics.h:497
const FX & fx() const
Get FX
Definition: CameraIntrinsics.h:587
bool operator!=(const CameraMatrix &other) const
Inequality operator
friend std::ostream & operator<<(std::ostream &stream, const CameraMatrix &value)
Operator to send the value as string to a stream
Definition: CameraIntrinsics.h:706
CameraMatrix & set(const CY &value)
Set CY
Definition: CameraIntrinsics.h:580
CameraMatrix & set(const FY &value)
Set FY
Definition: CameraIntrinsics.h:618
bool operator==(const CameraMatrix &other) const
Equality operator
std::string toString() const
Get the value as string
const CameraIntrinsics::CameraMatrix::CX & get() const
Definition: CameraIntrinsics.h:626
FY & fy()
Get FY
Definition: CameraIntrinsics.h:612
CameraMatrix & set(const CX &value)
Set CX
Definition: CameraIntrinsics.h:561
const CameraIntrinsics::CameraMatrix::CY & get() const
Definition: CameraIntrinsics.h:633
const FY & fy() const
Get FY
Definition: CameraIntrinsics.h:606
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:678
CameraMatrix & set(const FX &value)
Set FX
Definition: CameraIntrinsics.h:599
std::tuple< CameraIntrinsics::CameraMatrix::CX, CameraIntrinsics::CameraMatrix::CY, CameraIntrinsics::CameraMatrix::FX, CameraIntrinsics::CameraMatrix::FY > Descendants
Definition: CameraIntrinsics.h:439
CX & cx()
Get CX
Definition: CameraIntrinsics.h:555
CameraMatrix(Args &&...args)
Constructor taking variadic number of arguments
Definition: CameraIntrinsics.h:468
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:531
const CameraIntrinsics::CameraMatrix::FY & get() const
Definition: CameraIntrinsics.h:647
const CameraIntrinsics::CameraMatrix::FX & get() const
Definition: CameraIntrinsics.h:640
const CY & cy() const
Get CY
Definition: CameraIntrinsics.h:568
FX & fx()
Get FX
Definition: CameraIntrinsics.h:593
CY & cy()
Get CY
Definition: CameraIntrinsics.h:574
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter
Definition: CameraIntrinsics.h:688
First radial distortion term
Definition: CameraIntrinsics.h:746
bool operator<(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:796
K1()=default
Default constructor
bool operator!=(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:790
bool operator>(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:802
constexpr K1(double value)
Constructor
Definition: CameraIntrinsics.h:773
static constexpr Range< double > validRange()
The range of valid values for K1
Definition: CameraIntrinsics.h:764
friend std::ostream & operator<<(std::ostream &stream, const K1 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:808
bool operator==(const K1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:784
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:761
Second radial distortion term
Definition: CameraIntrinsics.h:823
static constexpr Range< double > validRange()
The range of valid values for K2
Definition: CameraIntrinsics.h:841
bool operator>(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:879
bool operator!=(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:867
std::string toString() const
Get the value as string
bool operator==(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:861
friend std::ostream & operator<<(std::ostream &stream, const K2 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:885
bool operator<(const K2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:873
K2()=default
Default constructor
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:838
constexpr K2(double value)
Constructor
Definition: CameraIntrinsics.h:850
double value() const
Get the value
Third radial distortion term
Definition: CameraIntrinsics.h:900
friend std::ostream & operator<<(std::ostream &stream, const K3 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:962
bool operator<(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:950
double value() const
Get the value
K3()=default
Default constructor
std::string toString() const
Get the value as string
constexpr K3(double value)
Constructor
Definition: CameraIntrinsics.h:927
static constexpr Range< double > validRange()
The range of valid values for K3
Definition: CameraIntrinsics.h:918
bool operator>(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:956
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:915
bool operator!=(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:944
bool operator==(const K3 &other) const
Comparison operator
Definition: CameraIntrinsics.h:938
First tangential distortion term
Definition: CameraIntrinsics.h:977
friend std::ostream & operator<<(std::ostream &stream, const P1 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:1039
bool operator>(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1033
bool operator==(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1015
std::string toString() const
Get the value as string
bool operator<(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1027
static constexpr Range< double > validRange()
The range of valid values for P1
Definition: CameraIntrinsics.h:995
P1()=default
Default constructor
double value() const
Get the value
constexpr P1(double value)
Constructor
Definition: CameraIntrinsics.h:1004
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:992
bool operator!=(const P1 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1021
Second tangential distortion term
Definition: CameraIntrinsics.h:1054
bool operator==(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1094
bool operator>(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1112
constexpr P2(double value)
Constructor
Definition: CameraIntrinsics.h:1083
P2()=default
Default constructor
double value() const
Get the value
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:1071
friend std::ostream & operator<<(std::ostream &stream, const P2 &value)
Operator to serialize the value to a stream
Definition: CameraIntrinsics.h:1118
std::string toString() const
Get the value as string
bool operator<(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1106
bool operator!=(const P2 &other) const
Comparison operator
Definition: CameraIntrinsics.h:1100
static constexpr Range< double > validRange()
The range of valid values for P2
Definition: CameraIntrinsics.h:1074
The radial and tangential distortion parameters
Definition: CameraIntrinsics.h:728
friend std::ostream & operator<<(std::ostream &stream, const Distortion &value)
Operator to send the value as string to a stream
Definition: CameraIntrinsics.h:1439
const P1 & p1() const
Get P1
Definition: CameraIntrinsics.h:1305
Distortion & set(const P2 &value)
Set P2
Definition: CameraIntrinsics.h:1336
P1 & p1()
Get P1
Definition: CameraIntrinsics.h:1311
const CameraIntrinsics::Distortion::K2 & get() const
Definition: CameraIntrinsics.h:1351
Distortion(Args &&...args)
Constructor taking variadic number of arguments
Definition: CameraIntrinsics.h:1165
Distortion & set(const K2 &value)
Set K2
Definition: CameraIntrinsics.h:1279
const CameraIntrinsics::Distortion::K1 & get() const
Definition: CameraIntrinsics.h:1344
const P2 & p2() const
Get P2
Definition: CameraIntrinsics.h:1324
const CameraIntrinsics::Distortion::P1 & get() const
Definition: CameraIntrinsics.h:1365
void set(Args &&...args)
Set multiple arguments
Definition: CameraIntrinsics.h:1195
const CameraIntrinsics::Distortion::K3 & get() const
Definition: CameraIntrinsics.h:1358
K3 & k3()
Get K3
Definition: CameraIntrinsics.h:1292
K2 & k2()
Get K2
Definition: CameraIntrinsics.h:1273
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:1230
K1 & k1()
Get K1
Definition: CameraIntrinsics.h:1254
Distortion & set(const K3 &value)
Set K3
Definition: CameraIntrinsics.h:1298
std::string toString() const
Get the value as string
Distortion & set(const P1 &value)
Set P1
Definition: CameraIntrinsics.h:1317
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:1420
std::tuple< CameraIntrinsics::Distortion::K1, CameraIntrinsics::Distortion::K2, CameraIntrinsics::Distortion::K3, CameraIntrinsics::Distortion::P1, CameraIntrinsics::Distortion::P2 > Descendants
Definition: CameraIntrinsics.h:1135
const K3 & k3() const
Get K3
Definition: CameraIntrinsics.h:1286
const K1 & k1() const
Get K1
Definition: CameraIntrinsics.h:1248
const K2 & k2() const
Get K2
Definition: CameraIntrinsics.h:1267
bool operator!=(const Distortion &other) const
Inequality operator
P2 & p2()
Get P2
Definition: CameraIntrinsics.h:1330
Distortion & set(const K1 &value)
Set K1
Definition: CameraIntrinsics.h:1260
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:1409
const CameraIntrinsics::Distortion::P2 & get() const
Definition: CameraIntrinsics.h:1372
Information about the intrinsic parameters of the camera (OpenCV model)
Definition: CameraIntrinsics.h:76
CameraMatrix & cameraMatrix()
Get CameraMatrix
Definition: CameraIntrinsics.h:1610
const CameraIntrinsics::CameraMatrix::FY & get() const
Definition: CameraIntrinsics.h:1734
const CameraIntrinsics::CameraMatrix & get() const
Definition: CameraIntrinsics.h:1706
bool operator!=(const CameraIntrinsics &other) const
Inequality operator
const CameraIntrinsics::Distortion::K3 & get() const
Definition: CameraIntrinsics.h:1762
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:1795
CameraIntrinsics(Args &&...args)
Constructor taking variadic number of arguments
Definition: CameraIntrinsics.h:1509
std::string toString() const
Get the value as string
CameraIntrinsics & set(const CameraMatrix::CY &value)
Set CameraMatrix::CY
Definition: CameraIntrinsics.h:1630
CameraIntrinsics & set(const Distortion &value)
Set Distortion
Definition: CameraIntrinsics.h:1663
const CameraIntrinsics::Distortion::K1 & get() const
Definition: CameraIntrinsics.h:1748
void set(Args &&...args)
Set multiple arguments
Definition: CameraIntrinsics.h:1545
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:1586
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter
Definition: CameraIntrinsics.h:1803
CameraIntrinsics()
Default constructor
void load(const std::string &fileName)
Load from the given file
CameraIntrinsics & set(const Distortion::K1 &value)
Set Distortion::K1
Definition: CameraIntrinsics.h:1670
CameraIntrinsics & set(const CameraMatrix &value)
Set CameraMatrix
Definition: CameraIntrinsics.h:1616
const CameraIntrinsics::CameraMatrix::CX & get() const
Definition: CameraIntrinsics.h:1713
const CameraMatrix & cameraMatrix() const
Get CameraMatrix
Definition: CameraIntrinsics.h:1604
const CameraIntrinsics::Distortion::P1 & get() const
Definition: CameraIntrinsics.h:1769
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:1470
const CameraIntrinsics::Distortion::P2 & get() const
Definition: CameraIntrinsics.h:1776
Distortion & distortion()
Get Distortion
Definition: CameraIntrinsics.h:1657
CameraIntrinsics & set(const CameraMatrix::CX &value)
Set CameraMatrix::CX
Definition: CameraIntrinsics.h:1623
CameraIntrinsics(const std::string &fileName)
Construct CameraIntrinsics by loading from file
const CameraIntrinsics::CameraMatrix::FX & get() const
Definition: CameraIntrinsics.h:1727
CameraIntrinsics & set(const Distortion::K3 &value)
Set Distortion::K3
Definition: CameraIntrinsics.h:1684
void save(const std::string &fileName) const
Save to the given file
CameraIntrinsics & set(const Distortion::P1 &value)
Set Distortion::P1
Definition: CameraIntrinsics.h:1691
CameraIntrinsics & set(const CameraMatrix::FX &value)
Set CameraMatrix::FX
Definition: CameraIntrinsics.h:1637
const CameraIntrinsics::Distortion::K2 & get() const
Definition: CameraIntrinsics.h:1755
CameraIntrinsics & set(const Distortion::P2 &value)
Set Distortion::P2
Definition: CameraIntrinsics.h:1698
const CameraIntrinsics::Distortion & get() const
Definition: CameraIntrinsics.h:1741
const CameraIntrinsics::CameraMatrix::CY & get() const
Definition: CameraIntrinsics.h:1720
friend std::ostream & operator<<(std::ostream &stream, const CameraIntrinsics &value)
Operator to send the value as string to a stream
Definition: CameraIntrinsics.h:1819
const Distortion & distortion() const
Get Distortion
Definition: CameraIntrinsics.h:1651
CameraIntrinsics & set(const Distortion::K2 &value)
Set Distortion::K2
Definition: CameraIntrinsics.h:1677
CameraIntrinsics & set(const CameraMatrix::FY &value)
Set CameraMatrix::FY
Definition: CameraIntrinsics.h:1644
Class describing a range of values for a given type T
Definition: Range.h:58
NodeType
Definition: NodeType.h:56
The main Zivid namespace. All Zivid code is found here
Definition: Application.h:55