Main MRPT website > C++ reference
MRPT logo
CObservationStereoImagesFeatures.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 CObservationStereoImagesFeatures_H
29 #define CObservationStereoImagesFeatures_H
30 
32 #include <mrpt/utils/CImage.h>
33 #include <mrpt/utils/TCamera.h>
34 #include <mrpt/slam/CObservation.h>
35 #include <mrpt/poses/CPose3D.h>
36 #include <mrpt/poses/CPose3DQuat.h>
37 #include <mrpt/poses/CPose2D.h>
38 
39 namespace mrpt
40 {
41 namespace slam
42 {
43  using namespace mrpt::utils;
44  using namespace mrpt::slam;
45 
47  {
48  std::pair<TPixelCoordf,TPixelCoordf> pixels;
49  unsigned int ID;
50  };
51 
53  /** Declares a class derived from "CObservation" that encapsules a pair of cameras and a set of matched image features extracted from them.
54  *
55  <b>NOTE:</b> The image features stored in this class are NOT supposed to be UNDISTORTED, but the TCamera members must provide their distortion params.
56  A zero-vector of distortion params means a set of UNDISTORTED pixels.<br>
57  * \sa CObservation
58  * \ingroup mrpt_obs_grp
59  */
61  {
62  // This must be added to any CSerializable derived class:
64 
65  public:
66  /** Default Constructor.
67  */
69 
70  /** Other constructor providing members initialization.
71  */
72  CObservationStereoImagesFeatures(
73  const CMatrixDouble33 &iPLeft /*left intrinsic params*/, const CMatrixDouble33 &iPRight /*right intrinsic params*/,
74  const CArrayDouble<5> &dPLeft /*left distortion params*/, const CArrayDouble<5> &dPRight /*right distortion params*/,
75  const CPose3DQuat &rCPose /*rightCameraPose*/, const CPose3DQuat &cPORobot /*cameraPoseOnRobot*/ );
76 
77  /** Other constructor providing members initialization.
78  */
79  CObservationStereoImagesFeatures(
80  const TCamera &cLeft /*left camera*/, const TCamera &cRight /*right camera*/,
81  const CPose3DQuat &rCPose /*rightCameraPose*/, const CPose3DQuat &cPORobot /*cameraPoseOnRobot*/ );
82 
83  /** Destructor
84  */
85  ~CObservationStereoImagesFeatures( );
86 
87  /** A method for storing the set of observed features in a text file in the format: <br>
88  * ID ul vl ur vr <br>
89  * being (ul,vl) and (ur,vr) the "x" and "y" coordinates for the left and right feature, respectively.
90  */
91  void saveFeaturesToTextFile( const std::string &filename );
92 
93  // ------------------
94  // Class Members
95  // ------------------
96  TCamera cameraLeft, cameraRight;
97 
98  /** The pose of the right camera, relative to the left one:
99  * Note that for the Bumblebee stereo camera and using the conventional reference coordinates for the left
100  * camera ("x" points to the right, "y" down), the "right" camera is situated
101  * at position (BL, 0, 0) with q = [1 0 0 0], where BL is the BASELINE.
102  */
103  CPose3DQuat rightCameraPose;
104 
105  /** The pose of the LEFT camera, relative to the robot.
106  */
107  CPose3DQuat cameraPoseOnRobot;
108 
109  /** Vectors of image feature pairs (with ID).
110  */
111  std::vector<TStereoImageFeatures> theFeatures;
112 
113  /** A general method to retrieve the sensor pose on the robot in CPose3D form.
114  * Note that most sensors will return a full (6D) CPose3DQuat, but see the derived classes for more details or special cases.
115  * \sa setSensorPose
116  */
117  inline void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = CPose3D(cameraPoseOnRobot); }
118 
119  /** A general method to retrieve the sensor pose on the robot in CPose3DQuat form.
120  * Note that most sensors will return a full (6D) CPose3DQuat, but see the derived classes for more details or special cases.
121  * \sa setSensorPose
122  */
123  inline void getSensorPose( CPose3DQuat &out_sensorPose ) const { out_sensorPose = cameraPoseOnRobot; }
124 
125  /** A general method to change the sensor pose on the robot in a CPose3D form.
126  * Note that most sensors will use the full (6D) CPose3DQuat, but see the derived classes for more details or special cases.
127  * \sa getSensorPose
128  */
129  inline void setSensorPose( const CPose3D &newSensorPose ) { cameraPoseOnRobot = CPose3DQuat(newSensorPose); }
130 
131  /** A general method to change the sensor pose on the robot in a CPose3DQuat form.
132  * Note that most sensors will use the full (6D) CPose3DQuat, but see the derived classes for more details or special cases.
133  * \sa getSensorPose
134  */
135  inline void setSensorPose( const CPose3DQuat &newSensorPose ) { cameraPoseOnRobot = newSensorPose; }
136  }; // End of class def.
137 
138  } // End of namespace
139 } // End of namespace
140 
141 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013