Main MRPT website > C++ reference for MRPT 1.5.7
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  {
19 
20  /** Structure to hold the parameters of a pinhole stereo camera model.
21  * The parameters obtained for one camera resolution can be used for any other resolution by means of the method TStereoCamera::scaleToResolution()
22  *
23  * \sa mrpt::vision, the application stereo-calib-gui for calibrating a stereo camera
24  */
26  {
28  public:
29  TCamera leftCamera, rightCamera; //!< Intrinsic and distortion parameters of the left and right cameras
30  mrpt::poses::CPose3DQuat rightCameraPose; //!< Pose of the right camera with respect to the coordinate origin of the left camera
31 
32  // Default constructor:
33  TStereoCamera();
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 the prefix.
58  */
59  void saveToConfigFile( const std::string &section, mrpt::utils::CConfigFileBase &cfg ) const;
60 
61  /** Load all the params from a config source, in the same format that used in saveToConfigFile().
62  * Notice that 3 different sections are read, of which "section" is only the prefix.
63  * \exception std::exception on missing fields
64  */
65  void loadFromConfigFile(const std::string &section, const mrpt::utils::CConfigFileBase &cfg );
66  /** overload This signature is consistent with the rest of MRPT APIs */
67  inline void loadFromConfigFile(const mrpt::utils::CConfigFileBase &cfg,const std::string &section) { loadFromConfigFile(section,cfg); }
68 
69  /** Dumps all the parameters as a multi-line string, with the same format than \a saveToConfigFile. \sa saveToConfigFile */
70  std::string dumpAsText() const;
71 
72  /** Rescale all the parameters for a new camera resolution (it raises an exception if the aspect ratio is modified, which is not permitted).
73  */
74  void scaleToResolution(unsigned int new_ncols, unsigned int new_nrows)
75  {
76  leftCamera.scaleToResolution(new_ncols,new_nrows);
77  rightCamera.scaleToResolution(new_ncols,new_nrows);
78  }
79 
80  }; // end class TStereoCamera
82 
83  } // End of namespace
84 } // end of namespace
85 #endif
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:39
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:165
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:67
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:74
TCamera rightCamera
Intrinsic and distortion parameters of the left and right cameras.
Definition: TStereoCamera.h:29
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(class_name, base_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).
Definition: CPose3DQuat.h:41
GLsizei const GLchar ** string
Definition: glext.h:3919
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...
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE(class_name, base_name)
mrpt::poses::CPose3DQuat rightCameraPose
Pose of the right camera with respect to the coordinate origin of the left camera.
Definition: TStereoCamera.h:30
Structure to hold the parameters of a pinhole camera model.
Definition: TCamera.h:31



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019