Zivid C++ API  1.8.1+6967bc1b-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-2020 (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 Support <support@zivid.com>
42  * Info: http://www.zivid.com
43  ******************************************************************************/
44 
45 #pragma once
46 
47 #include <chrono>
48 #include <ctime>
49 #include <iomanip>
50 #include <memory>
51 #include <sstream>
52 #include <string>
53 #include <tuple>
54 #include <utility>
55 #include <vector>
56 
57 #include "Zivid/APIExport.h"
58 #include "Zivid/Range.h"
59 
60 #ifdef _MSC_VER
61 # pragma warning(push)
62 # pragma warning(disable : 4251) // "X needs to have dll-interface to be used by clients of class Y."
63 #endif
64 
65 namespace Zivid
66 {
68  class ZIVID_API_EXPORT CameraIntrinsics
69  {
70  public:
71  static constexpr size_t version{ 1 };
72 
73 #ifndef NO_DOC
74  template<size_t>
75  struct Version;
76 
77  using LatestVersion = Zivid::CameraIntrinsics;
78 #endif
79 
81  ~CameraIntrinsics();
82 
84  CameraIntrinsics(const CameraIntrinsics &other);
85 
87  CameraIntrinsics &operator=(const CameraIntrinsics &other);
88 
90  CameraIntrinsics(CameraIntrinsics &&other) noexcept;
91 
93  CameraIntrinsics &operator=(CameraIntrinsics &&other) noexcept;
94 
96  CameraIntrinsics() = default;
97 
99  static constexpr bool isContainer{ true };
100 
102  static constexpr const char *path{ "" };
103 
105  static constexpr const char *name{ "CameraIntrinsics" };
106 
108  static constexpr const char *description{
109  R"description(Information about the intrinsic parameters of the camera (OpenCV model))description"
110  };
111 
113  void set(const std::string &fullPath, const std::string &value);
114 
116  std::string getString(const std::string &fullPath) const;
117 
119  class ZIVID_API_EXPORT CameraMatrix
120  {
121  public:
123  CameraMatrix() = default;
124 
126  static constexpr bool isContainer{ true };
127 
129  static constexpr const char *path{ "CameraMatrix" };
130 
132  static constexpr const char *name{ "CameraMatrix" };
133 
135  static constexpr const char *description{
136  R"description(The camera matrix K (=[fx,0,cx;0,fy,cy;0,0,1]))description"
137  };
138 
140  void set(const std::string &fullPath, const std::string &value);
141 
143  std::string getString(const std::string &fullPath) const;
144 
146  class ZIVID_API_EXPORT CX
147  {
148  public:
150  using ValueType = double;
151 
153  static constexpr bool isContainer{ false };
154 
156  static constexpr const char *path{ "CameraMatrix/CX" };
157 
159  static constexpr const char *name{ "CX" };
160 
162  static constexpr const char *description{
163  R"description(x coordinate of the principal point)description"
164  };
165 
167  CX() = default;
168 
170  explicit constexpr CX(ValueType value) noexcept(std::is_nothrow_copy_constructible<ValueType>::value)
171  : m_value{ value }
172  {}
173 
175  const ValueType &value() const
176  {
177  return m_value;
178  }
179 
181  Range<ValueType> range() const
182  {
183  return { std::numeric_limits<ValueType>::lowest(), std::numeric_limits<ValueType>::max() };
184  }
185 
187  void setFromString(const std::string &value)
188  {
189  m_value = std::stod(value);
190  }
191 
193  std::string toString() const
194  {
195  return std::to_string(m_value);
196  }
197 
199  bool operator==(const CX &other) const
200  {
201  return m_value == other.m_value;
202  }
203 
205  bool operator!=(const CX &other) const
206  {
207  return m_value != other.m_value;
208  }
209 
211  bool operator<(const CX &other) const
212  {
213  return m_value < other.m_value;
214  }
215 
217  bool operator>(const CX &other) const
218  {
219  return m_value > other.m_value;
220  }
221 
223  friend std::ostream &operator<<(std::ostream &stream, const CX &value)
224  {
225  return stream << value.toString();
226  }
227 
229  friend std::istream &operator>>(std::istream &stream, CX &value)
230  {
231  value.setFromString(
232  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
233  return stream;
234  }
235 
236  private:
237  ValueType m_value{ 0.0 };
238  };
239 
242  {
243  public:
245  using ValueType = double;
246 
248  static constexpr bool isContainer{ false };
249 
251  static constexpr const char *path{ "CameraMatrix/CY" };
252 
254  static constexpr const char *name{ "CY" };
255 
257  static constexpr const char *description{
258  R"description(y coordinate of the principal point)description"
259  };
260 
262  CY() = default;
263 
265  explicit constexpr CY(ValueType value) noexcept(std::is_nothrow_copy_constructible<ValueType>::value)
266  : m_value{ value }
267  {}
268 
270  const ValueType &value() const
271  {
272  return m_value;
273  }
274 
276  Range<ValueType> range() const
277  {
278  return { std::numeric_limits<ValueType>::lowest(), std::numeric_limits<ValueType>::max() };
279  }
280 
282  void setFromString(const std::string &value)
283  {
284  m_value = std::stod(value);
285  }
286 
288  std::string toString() const
289  {
290  return std::to_string(m_value);
291  }
292 
294  bool operator==(const CY &other) const
295  {
296  return m_value == other.m_value;
297  }
298 
300  bool operator!=(const CY &other) const
301  {
302  return m_value != other.m_value;
303  }
304 
306  bool operator<(const CY &other) const
307  {
308  return m_value < other.m_value;
309  }
310 
312  bool operator>(const CY &other) const
313  {
314  return m_value > other.m_value;
315  }
316 
318  friend std::ostream &operator<<(std::ostream &stream, const CY &value)
319  {
320  return stream << value.toString();
321  }
322 
324  friend std::istream &operator>>(std::istream &stream, CY &value)
325  {
326  value.setFromString(
327  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
328  return stream;
329  }
330 
331  private:
332  ValueType m_value{ 0.0 };
333  };
334 
337  {
338  public:
340  using ValueType = double;
341 
343  static constexpr bool isContainer{ false };
344 
346  static constexpr const char *path{ "CameraMatrix/FX" };
347 
349  static constexpr const char *name{ "FX" };
350 
352  static constexpr const char *description{ R"description(Focal length in x)description" };
353 
355  FX() = default;
356 
358  explicit constexpr FX(ValueType value) noexcept(std::is_nothrow_copy_constructible<ValueType>::value)
359  : m_value{ value }
360  {}
361 
363  const ValueType &value() const
364  {
365  return m_value;
366  }
367 
369  Range<ValueType> range() const
370  {
371  return { std::numeric_limits<ValueType>::lowest(), std::numeric_limits<ValueType>::max() };
372  }
373 
375  void setFromString(const std::string &value)
376  {
377  m_value = std::stod(value);
378  }
379 
381  std::string toString() const
382  {
383  return std::to_string(m_value);
384  }
385 
387  bool operator==(const FX &other) const
388  {
389  return m_value == other.m_value;
390  }
391 
393  bool operator!=(const FX &other) const
394  {
395  return m_value != other.m_value;
396  }
397 
399  bool operator<(const FX &other) const
400  {
401  return m_value < other.m_value;
402  }
403 
405  bool operator>(const FX &other) const
406  {
407  return m_value > other.m_value;
408  }
409 
411  friend std::ostream &operator<<(std::ostream &stream, const FX &value)
412  {
413  return stream << value.toString();
414  }
415 
417  friend std::istream &operator>>(std::istream &stream, FX &value)
418  {
420  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
421  return stream;
422  }
423 
424  private:
425  ValueType m_value{ 0.0 };
426  };
427 
429  class ZIVID_API_EXPORT FY
430  {
431  public:
433  using ValueType = double;
434 
436  static constexpr bool isContainer{ false };
437 
439  static constexpr const char *path{ "CameraMatrix/FY" };
440 
442  static constexpr const char *name{ "FY" };
443 
445  static constexpr const char *description{ R"description(Focal length in y)description" };
446 
448  FY() = default;
449 
451  explicit constexpr FY(ValueType value) noexcept(std::is_nothrow_copy_constructible<ValueType>::value)
452  : m_value{ value }
453  {}
454 
456  const ValueType &value() const
457  {
458  return m_value;
459  }
460 
462  Range<ValueType> range() const
463  {
464  return { std::numeric_limits<ValueType>::lowest(), std::numeric_limits<ValueType>::max() };
465  }
466 
468  void setFromString(const std::string &value)
469  {
470  m_value = std::stod(value);
471  }
472 
474  std::string toString() const
475  {
476  return std::to_string(m_value);
477  }
478 
480  bool operator==(const FY &other) const
481  {
482  return m_value == other.m_value;
483  }
484 
486  bool operator!=(const FY &other) const
487  {
488  return m_value != other.m_value;
489  }
490 
492  bool operator<(const FY &other) const
493  {
494  return m_value < other.m_value;
495  }
496 
498  bool operator>(const FY &other) const
499  {
500  return m_value > other.m_value;
501  }
502 
504  friend std::ostream &operator<<(std::ostream &stream, const FY &value)
505  {
506  return stream << value.toString();
507  }
508 
510  friend std::istream &operator>>(std::istream &stream, FY &value)
511  {
513  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
514  return stream;
515  }
516 
517  private:
518  ValueType m_value{ 0.0 };
519  };
520 
521  template<typename T,
522  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CX>::value, int>::type = 0>
523  const CameraIntrinsics::CameraMatrix::CX &get() const
524  {
525  return m_cx;
526  }
527 
528  template<typename T,
529  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CY>::value, int>::type = 0>
531  {
532  return m_cy;
533  }
534 
535  template<typename T,
536  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FX>::value, int>::type = 0>
537  const CameraIntrinsics::CameraMatrix::FX &get() const
538  {
539  return m_fx;
540  }
541 
542  template<typename T,
543  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FY>::value, int>::type = 0>
544  const CameraIntrinsics::CameraMatrix::FY &get() const
545  {
546  return m_fy;
547  }
548 
549  template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
550  const CameraIntrinsics::CameraMatrix::CX &get() const
551  {
552  return m_cx;
553  }
554 
555  template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
556  const CameraIntrinsics::CameraMatrix::CY &get() const
557  {
558  return m_cy;
559  }
560 
561  template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
562  const CameraIntrinsics::CameraMatrix::FX &get() const
563  {
564  return m_fx;
565  }
566 
567  template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
568  const CameraIntrinsics::CameraMatrix::FY &get() const
569  {
570  return m_fy;
571  }
572 
574  explicit CameraMatrix(const CX &cx, const CY &cy, const FX &fx, const FY &fy);
575 
576  private:
577  CX m_cx{};
578 
579  public:
581  CameraMatrix &set(const CX &value)
582  {
583  if(value.value() < value.range().min() || value.value() > value.range().max())
584  {
585  throw std::out_of_range("CX{ " + std::to_string(value.value()) + " } is not in range ["
586  + std::to_string(value.range().min()) + ", "
587  + std::to_string(value.range().max()) + "]");
588  }
589 
590  m_cx = value;
591  return *this;
592  }
594  const CX &cx() const
595  {
596  return m_cx;
597  }
598 
599  private:
600  CY m_cy{};
601 
602  public:
604  CameraMatrix &set(const CY &value)
605  {
606  if(value.value() < value.range().min() || value.value() > value.range().max())
607  {
608  throw std::out_of_range("CY{ " + std::to_string(value.value()) + " } is not in range ["
609  + std::to_string(value.range().min()) + ", "
610  + std::to_string(value.range().max()) + "]");
611  }
612 
613  m_cy = value;
614  return *this;
615  }
617  const CY &cy() const
618  {
619  return m_cy;
620  }
621 
622  private:
623  FX m_fx{};
624 
625  public:
627  CameraMatrix &set(const FX &value)
628  {
629  if(value.value() < value.range().min() || value.value() > value.range().max())
630  {
631  throw std::out_of_range("FX{ " + std::to_string(value.value()) + " } is not in range ["
632  + std::to_string(value.range().min()) + ", "
633  + std::to_string(value.range().max()) + "]");
634  }
635 
636  m_fx = value;
637  return *this;
638  }
640  const FX &fx() const
641  {
642  return m_fx;
643  }
644 
645  private:
646  FY m_fy{};
647 
648  public:
650  CameraMatrix &set(const FY &value)
651  {
652  if(value.value() < value.range().min() || value.value() > value.range().max())
653  {
654  throw std::out_of_range("FY{ " + std::to_string(value.value()) + " } is not in range ["
655  + std::to_string(value.range().min()) + ", "
656  + std::to_string(value.range().max()) + "]");
657  }
658 
659  m_fy = value;
660  return *this;
661  }
663  const FY &fy() const
664  {
665  return m_fy;
666  }
667 
669  template<typename F>
670  void forEach(const F &f) const
671  {
672  f(m_cx);
673  f(m_cy);
674  f(m_fx);
675  f(m_fy);
676  }
677 
679  template<typename F>
680  void forEach(const F &f)
681  {
682  f(m_cx);
683  f(m_cy);
684  f(m_fx);
685  f(m_fy);
686  }
687 
689  template<typename F>
690  void traverseValues(const F &f) const
691  {
692  f(m_cx);
693  f(m_cy);
694  f(m_fx);
695  f(m_fy);
696  }
697 
699  template<typename F>
700  void traverseValues(const F &f)
701  {
702  f(m_cx);
703  f(m_cy);
704  f(m_fx);
705  f(m_fy);
706  }
707 
709  std::string toString() const;
710 
712  friend std::ostream &operator<<(std::ostream &stream, const CameraMatrix &value)
713  {
714  return stream << value.toString();
715  }
716 
718  void setFromString(const std::string &value);
719 
721  friend std::istream &operator>>(std::istream &stream, CameraMatrix &value)
722  {
723  value.setFromString(
724  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
725  return stream;
726  }
727 
729  bool operator==(const CameraMatrix &other) const;
730 
732  bool operator!=(const CameraMatrix &other) const;
733  };
734 
737  {
738  public:
740  Distortion() = default;
741 
743  static constexpr bool isContainer{ true };
744 
746  static constexpr const char *path{ "Distortion" };
747 
749  static constexpr const char *name{ "Distortion" };
750 
752  static constexpr const char *description{
753  R"description(The radial and tangential distortion parameters)description"
754  };
755 
757  void set(const std::string &fullPath, const std::string &value);
758 
760  std::string getString(const std::string &fullPath) const;
761 
763  class ZIVID_API_EXPORT K1
764  {
765  public:
767  using ValueType = double;
768 
770  static constexpr bool isContainer{ false };
771 
773  static constexpr const char *path{ "Distortion/K1" };
774 
776  static constexpr const char *name{ "K1" };
777 
779  static constexpr const char *description{ R"description(First radial distortion term)description" };
780 
782  K1() = default;
783 
785  explicit constexpr K1(ValueType value) noexcept(std::is_nothrow_copy_constructible<ValueType>::value)
786  : m_value{ value }
787  {}
788 
790  const ValueType &value() const
791  {
792  return m_value;
793  }
794 
796  Range<ValueType> range() const
797  {
798  return { std::numeric_limits<ValueType>::lowest(), std::numeric_limits<ValueType>::max() };
799  }
800 
802  void setFromString(const std::string &value)
803  {
804  m_value = std::stod(value);
805  }
806 
808  std::string toString() const
809  {
810  return std::to_string(m_value);
811  }
812 
814  bool operator==(const K1 &other) const
815  {
816  return m_value == other.m_value;
817  }
818 
820  bool operator!=(const K1 &other) const
821  {
822  return m_value != other.m_value;
823  }
824 
826  bool operator<(const K1 &other) const
827  {
828  return m_value < other.m_value;
829  }
830 
832  bool operator>(const K1 &other) const
833  {
834  return m_value > other.m_value;
835  }
836 
838  friend std::ostream &operator<<(std::ostream &stream, const K1 &value)
839  {
840  return stream << value.toString();
841  }
842 
844  friend std::istream &operator>>(std::istream &stream, K1 &value)
845  {
847  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
848  return stream;
849  }
850 
851  private:
852  ValueType m_value{ 0.0 };
853  };
854 
856  class ZIVID_API_EXPORT K2
857  {
858  public:
860  using ValueType = double;
861 
863  static constexpr bool isContainer{ false };
864 
866  static constexpr const char *path{ "Distortion/K2" };
867 
869  static constexpr const char *name{ "K2" };
870 
872  static constexpr const char *description{ R"description(Second radial distortion term)description" };
873 
875  K2() = default;
876 
878  explicit constexpr K2(ValueType value) noexcept(std::is_nothrow_copy_constructible<ValueType>::value)
879  : m_value{ value }
880  {}
881 
883  const ValueType &value() const
884  {
885  return m_value;
886  }
887 
889  Range<ValueType> range() const
890  {
891  return { std::numeric_limits<ValueType>::lowest(), std::numeric_limits<ValueType>::max() };
892  }
893 
895  void setFromString(const std::string &value)
896  {
897  m_value = std::stod(value);
898  }
899 
901  std::string toString() const
902  {
903  return std::to_string(m_value);
904  }
905 
907  bool operator==(const K2 &other) const
908  {
909  return m_value == other.m_value;
910  }
911 
913  bool operator!=(const K2 &other) const
914  {
915  return m_value != other.m_value;
916  }
917 
919  bool operator<(const K2 &other) const
920  {
921  return m_value < other.m_value;
922  }
923 
925  bool operator>(const K2 &other) const
926  {
927  return m_value > other.m_value;
928  }
929 
931  friend std::ostream &operator<<(std::ostream &stream, const K2 &value)
932  {
933  return stream << value.toString();
934  }
935 
937  friend std::istream &operator>>(std::istream &stream, K2 &value)
938  {
940  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
941  return stream;
942  }
943 
944  private:
945  ValueType m_value{ 0.0 };
946  };
947 
949  class ZIVID_API_EXPORT K3
950  {
951  public:
953  using ValueType = double;
954 
956  static constexpr bool isContainer{ false };
957 
959  static constexpr const char *path{ "Distortion/K3" };
960 
962  static constexpr const char *name{ "K3" };
963 
965  static constexpr const char *description{ R"description(Third radial distortion term)description" };
966 
968  K3() = default;
969 
971  explicit constexpr K3(ValueType value) noexcept(std::is_nothrow_copy_constructible<ValueType>::value)
972  : m_value{ value }
973  {}
974 
976  const ValueType &value() const
977  {
978  return m_value;
979  }
980 
982  Range<ValueType> range() const
983  {
984  return { std::numeric_limits<ValueType>::lowest(), std::numeric_limits<ValueType>::max() };
985  }
986 
988  void setFromString(const std::string &value)
989  {
990  m_value = std::stod(value);
991  }
992 
994  std::string toString() const
995  {
996  return std::to_string(m_value);
997  }
998 
1000  bool operator==(const K3 &other) const
1001  {
1002  return m_value == other.m_value;
1003  }
1006  bool operator!=(const K3 &other) const
1007  {
1008  return m_value != other.m_value;
1009  }
1012  bool operator<(const K3 &other) const
1013  {
1014  return m_value < other.m_value;
1015  }
1018  bool operator>(const K3 &other) const
1019  {
1020  return m_value > other.m_value;
1021  }
1022 
1024  friend std::ostream &operator<<(std::ostream &stream, const K3 &value)
1025  {
1026  return stream << value.toString();
1027  }
1030  friend std::istream &operator>>(std::istream &stream, K3 &value)
1031  {
1033  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1034  return stream;
1035  }
1036 
1037  private:
1038  ValueType m_value{ 0.0 };
1039  };
1040 
1042  class ZIVID_API_EXPORT P1
1043  {
1044  public:
1046  using ValueType = double;
1047 
1049  static constexpr bool isContainer{ false };
1052  static constexpr const char *path{ "Distortion/P1" };
1053 
1055  static constexpr const char *name{ "P1" };
1056 
1058  static constexpr const char *description{ R"description(First tangential distortion term)description" };
1059 
1061  P1() = default;
1062 
1064  explicit constexpr P1(ValueType value) noexcept(std::is_nothrow_copy_constructible<ValueType>::value)
1065  : m_value{ value }
1066  {}
1069  const ValueType &value() const
1070  {
1071  return m_value;
1072  }
1075  Range<ValueType> range() const
1076  {
1077  return { std::numeric_limits<ValueType>::lowest(), std::numeric_limits<ValueType>::max() };
1078  }
1081  void setFromString(const std::string &value)
1082  {
1083  m_value = std::stod(value);
1084  }
1087  std::string toString() const
1088  {
1089  return std::to_string(m_value);
1090  }
1093  bool operator==(const P1 &other) const
1094  {
1095  return m_value == other.m_value;
1096  }
1099  bool operator!=(const P1 &other) const
1100  {
1101  return m_value != other.m_value;
1102  }
1105  bool operator<(const P1 &other) const
1106  {
1107  return m_value < other.m_value;
1108  }
1111  bool operator>(const P1 &other) const
1112  {
1113  return m_value > other.m_value;
1114  }
1115 
1117  friend std::ostream &operator<<(std::ostream &stream, const P1 &value)
1118  {
1119  return stream << value.toString();
1120  }
1123  friend std::istream &operator>>(std::istream &stream, P1 &value)
1124  {
1126  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1127  return stream;
1128  }
1129 
1130  private:
1131  ValueType m_value{ 0.0 };
1132  };
1133 
1135  class ZIVID_API_EXPORT P2
1136  {
1137  public:
1139  using ValueType = double;
1140 
1142  static constexpr bool isContainer{ false };
1145  static constexpr const char *path{ "Distortion/P2" };
1146 
1148  static constexpr const char *name{ "P2" };
1149 
1151  static constexpr const char *description{
1152  R"description(Second tangential distortion term)description"
1153  };
1156  P2() = default;
1157 
1159  explicit constexpr P2(ValueType value) noexcept(std::is_nothrow_copy_constructible<ValueType>::value)
1160  : m_value{ value }
1161  {}
1162 
1164  const ValueType &value() const
1165  {
1166  return m_value;
1167  }
1168 
1170  Range<ValueType> range() const
1171  {
1172  return { std::numeric_limits<ValueType>::lowest(), std::numeric_limits<ValueType>::max() };
1173  }
1174 
1176  void setFromString(const std::string &value)
1177  {
1178  m_value = std::stod(value);
1179  }
1180 
1182  std::string toString() const
1183  {
1184  return std::to_string(m_value);
1185  }
1186 
1188  bool operator==(const P2 &other) const
1189  {
1190  return m_value == other.m_value;
1191  }
1192 
1194  bool operator!=(const P2 &other) const
1195  {
1196  return m_value != other.m_value;
1197  }
1198 
1200  bool operator<(const P2 &other) const
1201  {
1202  return m_value < other.m_value;
1203  }
1204 
1206  bool operator>(const P2 &other) const
1207  {
1208  return m_value > other.m_value;
1209  }
1210 
1212  friend std::ostream &operator<<(std::ostream &stream, const P2 &value)
1213  {
1214  return stream << value.toString();
1215  }
1216 
1218  friend std::istream &operator>>(std::istream &stream, P2 &value)
1219  {
1220  value.setFromString(
1221  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1222  return stream;
1223  }
1225  private:
1226  ValueType m_value{ 0.0 };
1227  };
1228 
1229  template<typename T,
1230  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K1>::value, int>::type = 0>
1231  const CameraIntrinsics::Distortion::K1 &get() const
1232  {
1233  return m_k1;
1234  }
1235 
1236  template<typename T,
1237  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K2>::value, int>::type = 0>
1239  {
1240  return m_k2;
1241  }
1242 
1243  template<typename T,
1244  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K3>::value, int>::type = 0>
1245  const CameraIntrinsics::Distortion::K3 &get() const
1246  {
1247  return m_k3;
1248  }
1250  template<typename T,
1251  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P1>::value, int>::type = 0>
1252  const CameraIntrinsics::Distortion::P1 &get() const
1253  {
1254  return m_p1;
1255  }
1256 
1257  template<typename T,
1258  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P2>::value, int>::type = 0>
1259  const CameraIntrinsics::Distortion::P2 &get() const
1260  {
1261  return m_p2;
1262  }
1263 
1264  template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1265  const CameraIntrinsics::Distortion::K1 &get() const
1266  {
1267  return m_k1;
1268  }
1269 
1270  template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1271  const CameraIntrinsics::Distortion::K2 &get() const
1272  {
1273  return m_k2;
1274  }
1275 
1276  template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
1277  const CameraIntrinsics::Distortion::K3 &get() const
1278  {
1279  return m_k3;
1280  }
1281 
1282  template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
1283  const CameraIntrinsics::Distortion::P1 &get() const
1284  {
1285  return m_p1;
1286  }
1287 
1288  template<size_t i, typename std::enable_if<i == 4, int>::type = 0>
1289  const CameraIntrinsics::Distortion::P2 &get() const
1290  {
1291  return m_p2;
1292  }
1293 
1295  explicit Distortion(const K1 &k1, const K2 &k2, const K3 &k3, const P1 &p1, const P2 &p2);
1296 
1297  private:
1298  K1 m_k1{};
1299 
1300  public:
1302  Distortion &set(const K1 &value)
1303  {
1304  if(value.value() < value.range().min() || value.value() > value.range().max())
1305  {
1306  throw std::out_of_range("K1{ " + std::to_string(value.value()) + " } is not in range ["
1307  + std::to_string(value.range().min()) + ", "
1308  + std::to_string(value.range().max()) + "]");
1309  }
1311  m_k1 = value;
1312  return *this;
1313  }
1315  const K1 &k1() const
1316  {
1317  return m_k1;
1318  }
1319 
1320  private:
1321  K2 m_k2{};
1322 
1323  public:
1325  Distortion &set(const K2 &value)
1326  {
1327  if(value.value() < value.range().min() || value.value() > value.range().max())
1328  {
1329  throw std::out_of_range("K2{ " + std::to_string(value.value()) + " } is not in range ["
1330  + std::to_string(value.range().min()) + ", "
1331  + std::to_string(value.range().max()) + "]");
1332  }
1333 
1334  m_k2 = value;
1335  return *this;
1336  }
1338  const K2 &k2() const
1339  {
1340  return m_k2;
1341  }
1342 
1343  private:
1344  K3 m_k3{};
1345 
1346  public:
1348  Distortion &set(const K3 &value)
1349  {
1350  if(value.value() < value.range().min() || value.value() > value.range().max())
1351  {
1352  throw std::out_of_range("K3{ " + std::to_string(value.value()) + " } is not in range ["
1353  + std::to_string(value.range().min()) + ", "
1354  + std::to_string(value.range().max()) + "]");
1355  }
1357  m_k3 = value;
1358  return *this;
1359  }
1361  const K3 &k3() const
1362  {
1363  return m_k3;
1364  }
1365 
1366  private:
1367  P1 m_p1{};
1369  public:
1371  Distortion &set(const P1 &value)
1372  {
1373  if(value.value() < value.range().min() || value.value() > value.range().max())
1374  {
1375  throw std::out_of_range("P1{ " + std::to_string(value.value()) + " } is not in range ["
1376  + std::to_string(value.range().min()) + ", "
1377  + std::to_string(value.range().max()) + "]");
1378  }
1379 
1380  m_p1 = value;
1381  return *this;
1382  }
1384  const P1 &p1() const
1385  {
1386  return m_p1;
1387  }
1388 
1389  private:
1390  P2 m_p2{};
1391 
1392  public:
1394  Distortion &set(const P2 &value)
1395  {
1396  if(value.value() < value.range().min() || value.value() > value.range().max())
1397  {
1398  throw std::out_of_range("P2{ " + std::to_string(value.value()) + " } is not in range ["
1399  + std::to_string(value.range().min()) + ", "
1400  + std::to_string(value.range().max()) + "]");
1401  }
1402 
1403  m_p2 = value;
1404  return *this;
1405  }
1407  const P2 &p2() const
1408  {
1409  return m_p2;
1410  }
1411 
1413  template<typename F>
1414  void forEach(const F &f) const
1415  {
1416  f(m_k1);
1417  f(m_k2);
1418  f(m_k3);
1419  f(m_p1);
1420  f(m_p2);
1421  }
1422 
1424  template<typename F>
1425  void forEach(const F &f)
1426  {
1427  f(m_k1);
1428  f(m_k2);
1429  f(m_k3);
1430  f(m_p1);
1431  f(m_p2);
1432  }
1433 
1435  template<typename F>
1436  void traverseValues(const F &f) const
1437  {
1438  f(m_k1);
1439  f(m_k2);
1440  f(m_k3);
1441  f(m_p1);
1442  f(m_p2);
1443  }
1444 
1446  template<typename F>
1447  void traverseValues(const F &f)
1448  {
1449  f(m_k1);
1450  f(m_k2);
1451  f(m_k3);
1452  f(m_p1);
1453  f(m_p2);
1454  }
1455 
1457  std::string toString() const;
1458 
1460  friend std::ostream &operator<<(std::ostream &stream, const Distortion &value)
1461  {
1462  return stream << value.toString();
1463  }
1464 
1466  void setFromString(const std::string &value);
1467 
1469  friend std::istream &operator>>(std::istream &stream, Distortion &value)
1470  {
1471  value.setFromString(
1472  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1473  return stream;
1474  }
1475 
1477  bool operator==(const Distortion &other) const;
1478 
1480  bool operator!=(const Distortion &other) const;
1481  };
1482 
1483  template<typename T,
1484  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix>::value, int>::type = 0>
1485  const CameraIntrinsics::CameraMatrix &get() const
1486  {
1487  return m_cameraMatrix;
1488  }
1489 
1490  template<typename T,
1491  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CX>::value, int>::type = 0>
1492  const CameraIntrinsics::CameraMatrix::CX &get() const
1493  {
1494  return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::CX>();
1495  }
1496 
1497  template<typename T,
1498  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::CY>::value, int>::type = 0>
1499  const CameraIntrinsics::CameraMatrix::CY &get() const
1500  {
1501  return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::CY>();
1502  }
1503 
1504  template<typename T,
1505  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FX>::value, int>::type = 0>
1506  const CameraIntrinsics::CameraMatrix::FX &get() const
1507  {
1508  return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::FX>();
1509  }
1510 
1511  template<typename T,
1512  typename std::enable_if<std::is_same<T, CameraIntrinsics::CameraMatrix::FY>::value, int>::type = 0>
1513  const CameraIntrinsics::CameraMatrix::FY &get() const
1514  {
1515  return m_cameraMatrix.get<CameraIntrinsics::CameraMatrix::FY>();
1516  }
1517 
1518  template<typename T,
1519  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion>::value, int>::type = 0>
1520  const CameraIntrinsics::Distortion &get() const
1521  {
1522  return m_distortion;
1523  }
1524 
1525  template<typename T,
1526  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K1>::value, int>::type = 0>
1527  const CameraIntrinsics::Distortion::K1 &get() const
1528  {
1529  return m_distortion.get<CameraIntrinsics::Distortion::K1>();
1530  }
1531 
1532  template<typename T,
1533  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K2>::value, int>::type = 0>
1534  const CameraIntrinsics::Distortion::K2 &get() const
1535  {
1536  return m_distortion.get<CameraIntrinsics::Distortion::K2>();
1537  }
1538 
1539  template<typename T,
1540  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::K3>::value, int>::type = 0>
1541  const CameraIntrinsics::Distortion::K3 &get() const
1542  {
1543  return m_distortion.get<CameraIntrinsics::Distortion::K3>();
1544  }
1545 
1546  template<typename T,
1547  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P1>::value, int>::type = 0>
1549  {
1550  return m_distortion.get<CameraIntrinsics::Distortion::P1>();
1551  }
1552 
1553  template<typename T,
1554  typename std::enable_if<std::is_same<T, CameraIntrinsics::Distortion::P2>::value, int>::type = 0>
1555  const CameraIntrinsics::Distortion::P2 &get() const
1556  {
1557  return m_distortion.get<CameraIntrinsics::Distortion::P2>();
1558  }
1559 
1560  template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1561  const CameraIntrinsics::CameraMatrix &get() const
1562  {
1563  return m_cameraMatrix;
1564  }
1565 
1566  template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1567  const CameraIntrinsics::Distortion &get() const
1568  {
1569  return m_distortion;
1570  }
1573  explicit CameraIntrinsics(const CameraMatrix &cameraMatrix, const Distortion &distortion);
1574 
1575  private:
1576  CameraMatrix m_cameraMatrix{};
1577 
1578  public:
1580  CameraIntrinsics &set(const CameraMatrix &value)
1581  {
1582  m_cameraMatrix = value;
1583  return *this;
1584  }
1586  const CameraMatrix &cameraMatrix() const
1587  {
1588  return m_cameraMatrix;
1589  }
1590 
1593  {
1594  m_cameraMatrix.set(value);
1595  return *this;
1596  }
1597 
1600  {
1601  m_cameraMatrix.set(value);
1602  return *this;
1603  }
1604 
1607  {
1608  m_cameraMatrix.set(value);
1609  return *this;
1610  }
1611 
1614  {
1615  m_cameraMatrix.set(value);
1616  return *this;
1617  }
1618 
1619  private:
1620  Distortion m_distortion{};
1621 
1622  public:
1624  CameraIntrinsics &set(const Distortion &value)
1625  {
1626  m_distortion = value;
1627  return *this;
1628  }
1630  const Distortion &distortion() const
1631  {
1632  return m_distortion;
1633  }
1636  CameraIntrinsics &set(const Distortion::K1 &value)
1637  {
1638  m_distortion.set(value);
1639  return *this;
1640  }
1641 
1643  CameraIntrinsics &set(const Distortion::K2 &value)
1644  {
1645  m_distortion.set(value);
1646  return *this;
1647  }
1648 
1650  CameraIntrinsics &set(const Distortion::K3 &value)
1651  {
1652  m_distortion.set(value);
1653  return *this;
1654  }
1655 
1657  CameraIntrinsics &set(const Distortion::P1 &value)
1658  {
1659  m_distortion.set(value);
1660  return *this;
1661  }
1662 
1664  CameraIntrinsics &set(const Distortion::P2 &value)
1665  {
1666  m_distortion.set(value);
1667  return *this;
1668  }
1669 
1671  template<typename F>
1672  void forEach(const F &f) const
1673  {
1674  f(m_cameraMatrix);
1675  f(m_distortion);
1676  }
1677 
1679  template<typename F>
1680  void forEach(const F &f)
1681  {
1682  f(m_cameraMatrix);
1683  f(m_distortion);
1684  }
1687  template<typename F>
1688  void traverseValues(const F &f) const
1689  {
1690  m_cameraMatrix.traverseValues(f);
1691  m_distortion.traverseValues(f);
1692  }
1693 
1695  template<typename F>
1696  void traverseValues(const F &f)
1697  {
1698  m_cameraMatrix.traverseValues(f);
1699  m_distortion.traverseValues(f);
1700  }
1701 
1703  std::string toString() const;
1704 
1706  friend std::ostream &operator<<(std::ostream &stream, const CameraIntrinsics &value)
1707  {
1708  return stream << value.toString();
1709  }
1710 
1712  void setFromString(const std::string &value);
1713 
1715  friend std::istream &operator>>(std::istream &stream, CameraIntrinsics &value)
1716  {
1717  value.setFromString(
1718  std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1719  return stream;
1720  }
1721 
1723  bool operator==(const CameraIntrinsics &other) const;
1724 
1726  bool operator!=(const CameraIntrinsics &other) const;
1727 
1729  explicit CameraIntrinsics(const std::string &fileName);
1730 
1732  void save(const std::string &fileName) const;
1733 
1735  void load(const std::string &fileName);
1736  };
1737 
1738 #ifndef NO_DOC
1739  template<>
1740  struct CameraIntrinsics::Version<1>
1741  {
1742  using Type = CameraIntrinsics;
1743  };
1744 #endif
1745 
1746 } // namespace Zivid
1747 
1748 #ifdef _MSC_VER
1749 # pragma warning(pop)
1750 #endif
1752 #ifndef NO_DOC
1753 # if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
1754 namespace std // NOLINT
1755 {
1756  template<>
1757  struct tuple_size<Zivid::CameraIntrinsics::CameraMatrix> : integral_constant<size_t, 4>
1758  {};
1760  template<size_t i>
1761  struct tuple_element<i, Zivid::CameraIntrinsics::CameraMatrix>
1762  {
1763  using type // NOLINT
1764  = decltype(declval<Zivid::CameraIntrinsics::CameraMatrix>().get<i>());
1765  };
1766 
1767  template<>
1768  struct tuple_size<Zivid::CameraIntrinsics::Distortion> : integral_constant<size_t, 5>
1769  {};
1770 
1771  template<size_t i>
1772  struct tuple_element<i, Zivid::CameraIntrinsics::Distortion>
1773  {
1774  using type // NOLINT
1775  = decltype(declval<Zivid::CameraIntrinsics::Distortion>().get<i>());
1776  };
1777 
1778  template<>
1779  struct tuple_size<Zivid::CameraIntrinsics> : integral_constant<size_t, 2>
1780  {};
1781 
1782  template<size_t i>
1783  struct tuple_element<i, Zivid::CameraIntrinsics>
1784  {
1785  using type // NOLINT
1786  = decltype(declval<Zivid::CameraIntrinsics>().get<i>());
1787  };
1788 
1789 } // namespace std
1790 # endif
1791 #endif
Zivid::toString
ZIVID_API_EXPORT std::string toString(const std::exception &exception)
Get string representation of the exception
Zivid::CameraIntrinsics::Distortion::K2::toString
std::string toString() const
Get the value as string
Definition: CameraIntrinsics.h:980
Zivid::CameraIntrinsics::CameraMatrix::FY
Focal length in y
Definition: CameraIntrinsics.h:508
Zivid::CameraIntrinsics::Distortion::P2::range
Range< ValueType > range() const
The range of valid values
Definition: CameraIntrinsics.h:1249
Zivid::CameraIntrinsics::Distortion::K1::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: CameraIntrinsics.h:881
Zivid::CameraIntrinsics::Distortion::P1::ValueType
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:1125
Zivid::CameraIntrinsics::CameraMatrix::CX::ValueType
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:229
Zivid::CameraIntrinsics::Distortion::P2::ValueType
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:1218
Zivid::CameraIntrinsics::CameraMatrix::CX::range
Range< ValueType > range() const
The range of valid values
Definition: CameraIntrinsics.h:260
Zivid::CameraIntrinsics::Distortion
The radial and tangential distortion parameters
Definition: CameraIntrinsics.h:815
Zivid::CameraIntrinsics::Distortion::K1::ValueType
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:846
Zivid::CameraIntrinsics::Distortion::K3
Third radial distortion term
Definition: CameraIntrinsics.h:1028
Zivid::CameraIntrinsics::Distortion::K2::ValueType
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:939
Zivid::CameraIntrinsics::Distortion::K1
First radial distortion term
Definition: CameraIntrinsics.h:842
Zivid::CameraIntrinsics::set
void set(const std::string &fullPath, const std::string &value)
Set a value from string by specifying the path
Zivid::CameraIntrinsics::Distortion::K3::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: CameraIntrinsics.h:1067
Zivid::CameraIntrinsics::Distortion::setFromString
void setFromString(const std::string &value)
Set from the given string
Zivid::CameraIntrinsics::CameraMatrix::CX
x coordinate of the principal point
Definition: CameraIntrinsics.h:225
Zivid::CameraIntrinsics::Distortion::P1
First tangential distortion term
Definition: CameraIntrinsics.h:1121
Zivid::CameraIntrinsics::Distortion::toString
std::string toString() const
Get the value as string
Zivid::CameraIntrinsics::setFromString
void setFromString(const std::string &value)
Set from the given string
Zivid::CameraIntrinsics::CameraMatrix::FY::value
const ValueType & value() const
Get the value
Definition: CameraIntrinsics.h:535
Zivid::CameraIntrinsics::Distortion::K2
Second radial distortion term
Definition: CameraIntrinsics.h:935
Zivid::CameraIntrinsics::CameraMatrix::FX::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: CameraIntrinsics.h:454
Zivid::CameraIntrinsics::CameraMatrix::CY::value
const ValueType & value() const
Get the value
Definition: CameraIntrinsics.h:349
Zivid::CameraIntrinsics::CameraMatrix::FY::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: CameraIntrinsics.h:547
Zivid::CameraIntrinsics::Distortion::K3::toString
std::string toString() const
Get the value as string
Definition: CameraIntrinsics.h:1073
Zivid::CameraIntrinsics::CameraMatrix::CY
y coordinate of the principal point
Definition: CameraIntrinsics.h:320
Zivid::CameraIntrinsics::CameraMatrix::CY::ValueType
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:324
Zivid::CameraIntrinsics::Distortion::P1::value
const ValueType & value() const
Get the value
Definition: CameraIntrinsics.h:1148
Zivid::CameraIntrinsics::CameraMatrix::CX::value
const ValueType & value() const
Get the value
Definition: CameraIntrinsics.h:254
Zivid::CameraIntrinsics::Distortion::P2
Second tangential distortion term
Definition: CameraIntrinsics.h:1214
Zivid::CameraIntrinsics::Distortion::P1::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: CameraIntrinsics.h:1160
Zivid::CameraIntrinsics::CameraMatrix::FX::ValueType
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:419
Zivid::CameraIntrinsics::CameraMatrix::FX::toString
std::string toString() const
Get the value as string
Definition: CameraIntrinsics.h:460
Zivid::CameraIntrinsics::CameraMatrix
The camera matrix K (=[fx,0,cx;0,fy,cy;0,0,1])
Definition: CameraIntrinsics.h:198
Range.h
Zivid::CameraIntrinsics::CameraMatrix::FY::ValueType
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:512
Zivid::CameraIntrinsics
Information about the intrinsic parameters of the camera (OpenCV model)
Definition: CameraIntrinsics.h:107
Zivid::CameraIntrinsics::Distortion::P1::range
Range< ValueType > range() const
The range of valid values
Definition: CameraIntrinsics.h:1154
Zivid::CameraIntrinsics::Distortion::K1::range
Range< ValueType > range() const
The range of valid values
Definition: CameraIntrinsics.h:875
APIExport.h
Zivid::CameraIntrinsics::Distortion::P1::toString
std::string toString() const
Get the value as string
Definition: CameraIntrinsics.h:1166
Zivid::CameraIntrinsics::Distortion::P2::value
const ValueType & value() const
Get the value
Definition: CameraIntrinsics.h:1243
Zivid::CameraIntrinsics::CameraMatrix::toString
std::string toString() const
Get the value as string
Zivid::CameraIntrinsics::CameraMatrix::CY::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: CameraIntrinsics.h:361
Zivid::CameraIntrinsics::toString
std::string toString() const
Get the value as string
Zivid::CameraIntrinsics::CameraMatrix::CY::range
Range< ValueType > range() const
The range of valid values
Definition: CameraIntrinsics.h:355
Zivid::CameraIntrinsics::CameraIntrinsics
CameraIntrinsics()=default
Default constructor
Zivid::CameraIntrinsics::Distortion::P2::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: CameraIntrinsics.h:1255
Zivid::CameraIntrinsics::CameraMatrix::FX
Focal length in x
Definition: CameraIntrinsics.h:415
Zivid::CameraIntrinsics::Distortion::K2::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: CameraIntrinsics.h:974
Zivid
The main Zivid namespace. All Zivid code is found here
Definition: Application.h:52
Zivid::CameraIntrinsics::Distortion::K1::value
const ValueType & value() const
Get the value
Definition: CameraIntrinsics.h:869
Zivid::CameraIntrinsics::CameraMatrix::FY::toString
std::string toString() const
Get the value as string
Definition: CameraIntrinsics.h:553
ZIVID_API_EXPORT
#define ZIVID_API_EXPORT
Definition: APIExport.h:56
Zivid::CameraIntrinsics::CameraMatrix::CX::setFromString
void setFromString(const std::string &value)
Set the value from string
Definition: CameraIntrinsics.h:266
Zivid::CameraIntrinsics::CameraMatrix::FY::range
Range< ValueType > range() const
The range of valid values
Definition: CameraIntrinsics.h:541
Zivid::CameraIntrinsics::CameraMatrix::setFromString
void setFromString(const std::string &value)
Set from the given string
Zivid::operator<<
ZIVID_API_EXPORT std::ostream & operator<<(std::ostream &stream, const Camera &camera)
Serialize the value to a stream
Zivid::CameraIntrinsics::Distortion::K3::ValueType
double ValueType
The type of the underlying value
Definition: CameraIntrinsics.h:1032
Zivid::Range
Class describing a range of values for a given type T The range boudaries for both minimum and maximu...
Definition: Range.h:95