MRPT  2.0.1
TStereoCamera.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <mrpt/img/TCamera.h>
12 #include <mrpt/math/TPose3DQuat.h>
13 
14 namespace mrpt::img
15 {
16 /** Structure to hold the parameters of a pinhole stereo camera model.
17  * The parameters obtained for one camera resolution can be used for any other
18  * resolution by means of the method TStereoCamera::scaleToResolution()
19  *
20  * \sa mrpt::vision, the application stereo-calib-gui for calibrating a stereo
21  * camera
22  */
24 {
26  public:
27  /** Intrinsic and distortion parameters of the left and right cameras */
29  /** Pose of the right camera with respect to the coordinate origin of the
30  * left camera */
32 
33  /** Save all params to a plain text config file in this format:
34  * \code
35  * [<SECTION>_LEFT]
36  * resolution = [NCOLS NROWS]
37  * cx = CX
38  * cy = CY
39  * fx = FX
40  * fy = FY
41  * dist = [K1 K2 T1 T2 K3]
42  *
43  * [<SECTION>_RIGHT]
44  * resolution = [NCOLS NROWS]
45  * cx = CX
46  * cy = CY
47  * fx = FX
48  * fy = FY
49  * dist = [K1 K2 T1 T2 K3]
50  *
51  * [<SECTION>_LEFT2RIGHT_POSE]
52  * pose_quaternion = [x y z qr qx qy qz]
53  *
54  * \endcode
55  * Notice that 3 different sections are read, of which "section" is only
56  * the prefix.
57  */
58  void saveToConfigFile(
59  const std::string& section, mrpt::config::CConfigFileBase& cfg) const;
60 
61  /** Load all the params from a config source, in the same format that used
62  * in saveToConfigFile().
63  * Notice that 3 different sections are read, of which "section" is only
64  * the prefix.
65  * \exception std::exception on missing fields
66  */
67  void loadFromConfigFile(
68  const std::string& section, const mrpt::config::CConfigFileBase& cfg);
69  /** overload This signature is consistent with the rest of MRPT APIs */
70  inline void loadFromConfigFile(
71  const mrpt::config::CConfigFileBase& cfg, const std::string& section)
72  {
73  loadFromConfigFile(section, cfg);
74  }
75 
76  /** Dumps all the parameters as a multi-line string, with the same format
77  * than \a saveToConfigFile. \sa saveToConfigFile */
78  std::string dumpAsText() const;
79 
80  /** Rescale all the parameters for a new camera resolution (it raises an
81  * exception if the aspect ratio is modified, which is not permitted).
82  */
83  void scaleToResolution(unsigned int new_ncols, unsigned int new_nrows)
84  {
85  leftCamera.scaleToResolution(new_ncols, new_nrows);
86  rightCamera.scaleToResolution(new_ncols, new_nrows);
87  }
88 
89 }; // end class TStereoCamera
90 } // namespace mrpt::img
void loadFromConfigFile(const mrpt::config::CConfigFileBase &cfg, const std::string &section)
overload This signature is consistent with the rest of MRPT APIs
Definition: TStereoCamera.h:70
void scaleToResolution(unsigned int new_ncols, unsigned int new_nrows)
Rescale all the parameters for a new camera resolution (it raises an exception if the aspect ratio is...
Definition: TCamera.cpp:203
void scaleToResolution(unsigned int new_ncols, unsigned int new_nrows)
Rescale all the parameters for a new camera resolution (it raises an exception if the aspect ratio is...
Definition: TStereoCamera.h:83
This class allows loading and storing values and vectors of different types from a configuration text...
std::string dumpAsText() const
Dumps all the parameters as a multi-line string, with the same format than saveToConfigFile.
Parameters for the Brown-Conrady camera lens distortion model.
Definition: TCamera.h:26
void loadFromConfigFile(const std::string &section, const mrpt::config::CConfigFileBase &cfg)
Load all the params from a config source, in the same format that used in saveToConfigFile().
void saveToConfigFile(const std::string &section, mrpt::config::CConfigFileBase &cfg) const
Save all params to a plain text config file in this format:
Lightweight 3D pose (three spatial coordinates, plus a quaternion ).
Definition: TPose3DQuat.h:19
TCamera leftCamera
Intrinsic and distortion parameters of the left and right cameras.
Definition: TStereoCamera.h:28
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:30
mrpt::math::TPose3DQuat rightCameraPose
Pose of the right camera with respect to the coordinate origin of the left camera.
Definition: TStereoCamera.h:31
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Structure to hold the parameters of a pinhole stereo camera model.
Definition: TStereoCamera.h:23



Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020