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-2018, 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 #pragma once
10 
11 #include <mrpt/img/TCamera.h>
13 
14 namespace mrpt
15 {
16 namespace img
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  /** Save all params to a plain text config file in this format:
36  * \code
37  * [<SECTION>_LEFT]
38  * resolution = [NCOLS NROWS]
39  * cx = CX
40  * cy = CY
41  * fx = FX
42  * fy = FY
43  * dist = [K1 K2 T1 T2 K3]
44  *
45  * [<SECTION>_RIGHT]
46  * resolution = [NCOLS NROWS]
47  * cx = CX
48  * cy = CY
49  * fx = FX
50  * fy = FY
51  * dist = [K1 K2 T1 T2 K3]
52  *
53  * [<SECTION>_LEFT2RIGHT_POSE]
54  * pose_quaternion = [x y z qr qx qy qz]
55  *
56  * \endcode
57  * Notice that 3 different sections are read, of which "section" is only
58  * the prefix.
59  */
60  void saveToConfigFile(
61  const std::string& section, mrpt::config::CConfigFileBase& cfg) const;
62 
63  /** Load all the params from a config source, in the same format that used
64  * in saveToConfigFile().
65  * Notice that 3 different sections are read, of which "section" is only
66  * the prefix.
67  * \exception std::exception on missing fields
68  */
69  void loadFromConfigFile(
70  const std::string& section, const mrpt::config::CConfigFileBase& cfg);
71  /** overload This signature is consistent with the rest of MRPT APIs */
72  inline void loadFromConfigFile(
73  const mrpt::config::CConfigFileBase& cfg, const std::string& section)
74  {
75  loadFromConfigFile(section, cfg);
76  }
77 
78  /** Dumps all the parameters as a multi-line string, with the same format
79  * than \a saveToConfigFile. \sa saveToConfigFile */
80  std::string dumpAsText() const;
81 
82  /** Rescale all the parameters for a new camera resolution (it raises an
83  * exception if the aspect ratio is modified, which is not permitted).
84  */
85  void scaleToResolution(unsigned int new_ncols, unsigned int new_nrows)
86  {
87  leftCamera.scaleToResolution(new_ncols, new_nrows);
88  rightCamera.scaleToResolution(new_ncols, new_nrows);
89  }
90 
91 }; // end class TStereoCamera
92 } // namespace img
93 } // namespace mrpt
mrpt::img::TCamera::scaleToResolution
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:173
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
TCamera.h
lightweight_geom_data.h
mrpt::img::TStereoCamera::rightCamera
TCamera rightCamera
Definition: TStereoCamera.h:30
mrpt::img::TStereoCamera::loadFromConfigFile
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().
Definition: TStereoCamera.cpp:45
mrpt::img::TStereoCamera
Structure to hold the parameters of a pinhole stereo camera model.
Definition: TStereoCamera.h:25
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
mrpt::img::TStereoCamera::rightCameraPose
mrpt::math::TPose3DQuat rightCameraPose
Pose of the right camera with respect to the coordinate origin of the left camera.
Definition: TStereoCamera.h:33
mrpt::serialization::CSerializable
The virtual base class which provides a unified interface for all persistent objects in MRPT.
Definition: CSerializable.h:32
mrpt::img::TCamera
Structure to hold the parameters of a pinhole camera model.
Definition: TCamera.h:29
mrpt::img::TStereoCamera::loadFromConfigFile
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:72
mrpt::math::TPose3DQuat
Lightweight 3D pose (three spatial coordinates, plus a quaternion ).
Definition: lightweight_geom_data.h:765
img
GLint GLvoid * img
Definition: glext.h:3763
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:102
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::img::TStereoCamera::scaleToResolution
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:85
mrpt::img::TStereoCamera::leftCamera
TCamera leftCamera
Intrinsic and distortion parameters of the left and right cameras.
Definition: TStereoCamera.h:30
mrpt::img::TStereoCamera::dumpAsText
std::string dumpAsText() const
Dumps all the parameters as a multi-line string, with the same format than saveToConfigFile.
Definition: TStereoCamera.cpp:98
mrpt::img::TStereoCamera::saveToConfigFile
void saveToConfigFile(const std::string &section, mrpt::config::CConfigFileBase &cfg) const
Save all params to a plain text config file in this format:
Definition: TStereoCamera.cpp:24



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST