Main MRPT website
>
C++ reference
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
mrpt
utils
TStereoCamera.h
Go to the documentation of this file.
1
/* +---------------------------------------------------------------------------+
2
| The Mobile Robot Programming Toolkit (MRPT) C++ library |
3
| |
4
| http://www.mrpt.org/ |
5
| |
6
| Copyright (C) 2005-2012 University of Malaga |
7
| |
8
| This software was written by the Machine Perception and Intelligent |
9
| Robotics Lab, University of Malaga (Spain). |
10
| Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11
| |
12
| This file is part of the MRPT project. |
13
| |
14
| MRPT is free software: you can redistribute it and/or modify |
15
| it under the terms of the GNU General Public License as published by |
16
| the Free Software Foundation, either version 3 of the License, or |
17
| (at your option) any later version. |
18
| |
19
| MRPT is distributed in the hope that it will be useful, |
20
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
21
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22
| GNU General Public License for more details. |
23
| |
24
| You should have received a copy of the GNU General Public License |
25
| along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26
| |
27
+---------------------------------------------------------------------------+ */
28
#ifndef TStereoCamera_H
29
#define TStereoCamera_H
30
31
#include <
mrpt/utils/TCamera.h
>
32
33
namespace
mrpt
34
{
35
namespace
utils
36
{
37
using namespace
mrpt::math;
38
using namespace
mrpt::poses;
39
40
DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE
(
TStereoCamera
,
mrpt::utils::CSerializable
)
41
42
/** Structure to hold the parameters of a pinhole stereo camera model.
43
* The parameters obtained for one camera resolution can be used for any other resolution by means of the method TStereoCamera::scaleToResolution()
44
*
45
* \sa mrpt::vision, the application stereo-calib-gui for calibrating a stereo camera
46
*/
47
class
BASE_IMPEXP
TStereoCamera
: public mrpt::utils::
CSerializable
48
{
49
DEFINE_SERIALIZABLE
(
TStereoCamera
)
50
public:
51
TCamera
leftCamera, rightCamera;
//!< Intrinsic and distortion parameters of the left and right cameras
52
CPose3DQuat
rightCameraPose;
//!< Pose of the right camera with respect to the coordinate origin of the left camera
53
54
// Default constructor:
55
TStereoCamera
();
56
57
/** Save all params to a plain text config file in this format:
58
* \code
59
* [<SECTION>_LEFT]
60
* resolution = [NCOLS NROWS]
61
* cx = CX
62
* cy = CY
63
* fx = FX
64
* fy = FY
65
* dist = [K1 K2 T1 T2 K3]
66
*
67
* [<SECTION>_RIGHT]
68
* resolution = [NCOLS NROWS]
69
* cx = CX
70
* cy = CY
71
* fx = FX
72
* fy = FY
73
* dist = [K1 K2 T1 T2 K3]
74
*
75
* [<SECTION>_LEFT2RIGHT_POSE]
76
* pose_quaternion = [x y z qr qx qy qz]
77
*
78
* \endcode
79
* Notice that 3 different sections are read, of which "section" is only the prefix.
80
*/
81
void
saveToConfigFile( const std::
string
§ion, mrpt::utils::
CConfigFileBase
&cfg ) const;
82
83
/** Load all the params from a config source, in the same format that used in saveToConfigFile().
84
* Notice that 3 different sections are read, of which "section" is only the prefix.
85
* \exception std::exception on missing fields
86
*/
87
void
loadFromConfigFile(const std::
string
§ion, const mrpt::utils::
CConfigFileBase
&cfg );
88
89
/** Dumps all the parameters as a multi-line string, with the same format than \a saveToConfigFile. \sa saveToConfigFile */
90
std::
string
dumpAsText() const;
91
92
/** Rescale all the parameters for a new camera resolution (it raises an exception if the aspect ratio is modified, which is not permitted).
93
*/
94
void
scaleToResolution(
unsigned
int
new_ncols,
unsigned
int
new_nrows)
95
{
96
leftCamera.
scaleToResolution
(new_ncols,new_nrows);
97
rightCamera.
scaleToResolution
(new_ncols,new_nrows);
98
}
99
100
};
// end class TStereoCamera
101
102
}
// End of namespace
103
}
// end of namespace
104
#endif
Page generated by
Doxygen 1.8.3
for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013