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



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019