Main MRPT website > C++ reference for MRPT 1.5.6
obs/CObservationStereoImagesFeatures.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 CObservationStereoImagesFeatures_H
10 #define CObservationStereoImagesFeatures_H
11 
13 #include <mrpt/utils/CImage.h>
14 #include <mrpt/utils/TCamera.h>
15 #include <mrpt/obs/CObservation.h>
16 #include <mrpt/poses/CPose3D.h>
17 #include <mrpt/poses/CPose3DQuat.h>
18 #include <mrpt/poses/CPose2D.h>
19 
20 namespace mrpt
21 {
22 namespace obs
23 {
25  {
26  std::pair<mrpt::utils::TPixelCoordf,mrpt::utils::TPixelCoordf> pixels;
27  unsigned int ID;
28  };
29 
31  /** Declares a class derived from "CObservation" that encapsules a pair of cameras and a set of matched image features extracted from them.
32  *
33  <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.
34  A zero-vector of distortion params means a set of UNDISTORTED pixels.<br>
35  * \sa CObservation
36  * \ingroup mrpt_obs_grp
37  */
39  {
40  // This must be added to any CSerializable derived class:
42 
43  public:
44  /** Default Constructor.
45  */
47 
48  /** Other constructor providing members initialization.
49  */
50  CObservationStereoImagesFeatures(
51  const mrpt::math::CMatrixDouble33 &iPLeft /*left intrinsic params*/, const mrpt::math::CMatrixDouble33 &iPRight /*right intrinsic params*/,
52  const mrpt::math::CArrayDouble<5> &dPLeft /*left distortion params*/, const mrpt::math::CArrayDouble<5> &dPRight /*right distortion params*/,
53  const mrpt::poses::CPose3DQuat &rCPose /*rightCameraPose*/, const mrpt::poses::CPose3DQuat &cPORobot /*cameraPoseOnRobot*/ );
54 
55  /** Other constructor providing members initialization.
56  */
57  CObservationStereoImagesFeatures(
58  const mrpt::utils::TCamera &cLeft /*left camera*/, const mrpt::utils::TCamera &cRight /*right camera*/,
59  const mrpt::poses::CPose3DQuat &rCPose /*rightCameraPose*/, const mrpt::poses::CPose3DQuat &cPORobot /*cameraPoseOnRobot*/ );
60 
61  /** Destructor
62  */
63  ~CObservationStereoImagesFeatures( );
64 
65  /** A method for storing the set of observed features in a text file in the format: <br>
66  * ID ul vl ur vr <br>
67  * being (ul,vl) and (ur,vr) the "x" and "y" coordinates for the left and right feature, respectively.
68  */
69  void saveFeaturesToTextFile( const std::string &filename );
70 
71  // ------------------
72  // Class Members
73  // ------------------
74  mrpt::utils::TCamera cameraLeft, cameraRight;
75 
76  /** The pose of the right camera, relative to the left one:
77  * Note that for the Bumblebee stereo camera and using the conventional reference coordinates for the left
78  * camera ("x" points to the right, "y" down), the "right" camera is situated
79  * at position (BL, 0, 0) with q = [1 0 0 0], where BL is the BASELINE.
80  */
81  mrpt::poses::CPose3DQuat rightCameraPose;
82 
83  /** The pose of the LEFT camera, relative to the robot.
84  */
85  mrpt::poses::CPose3DQuat cameraPoseOnRobot;
86 
87  /** Vectors of image feature pairs (with ID).
88  */
89  std::vector<TStereoImageFeatures> theFeatures;
90 
91  // See base class docs
92  void getSensorPose( mrpt::poses::CPose3D &out_sensorPose ) const MRPT_OVERRIDE { out_sensorPose = mrpt::poses::CPose3D(cameraPoseOnRobot); }
93  // See base class docs
94  void getSensorPose( mrpt::poses::CPose3DQuat &out_sensorPose ) const { out_sensorPose = cameraPoseOnRobot; }
95  // See base class docs
96  void getDescriptionAsText(std::ostream &o) const MRPT_OVERRIDE;
97 
98  /** A general method to change the sensor pose on the robot in a mrpt::poses::CPose3D form.
99  * Note that most sensors will use the full (6D) CPose3DQuat, but see the derived classes for more details or special cases.
100  * \sa getSensorPose
101  */
102  inline void setSensorPose( const mrpt::poses::CPose3D &newSensorPose ) MRPT_OVERRIDE { cameraPoseOnRobot = mrpt::poses::CPose3DQuat(newSensorPose); }
103 
104  /** A general method to change the sensor pose on the robot in a CPose3DQuat form.
105  * Note that most sensors will use the full (6D) CPose3DQuat, but see the derived classes for more details or special cases.
106  * \sa getSensorPose
107  */
108  inline void setSensorPose( const mrpt::poses::CPose3DQuat &newSensorPose ) { cameraPoseOnRobot = newSensorPose; }
109  }; // End of class def.
110  DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE( CObservationStereoImagesFeatures , CObservation, OBS_IMPEXP )
111 
112  } // End of namespace
113 } // End of namespace
114 
115 #endif
Declares a class derived from "CObservation" that encapsules a pair of cameras and a set of matched i...
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
void getSensorPose(mrpt::poses::CPose3DQuat &out_sensorPose) const
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
void setSensorPose(const mrpt::poses::CPose3D &newSensorPose) MRPT_OVERRIDE
A general method to change the sensor pose on the robot in a mrpt::poses::CPose3D form...
CMatrixFixedNumeric< double, 3, 3 > CMatrixDouble33
Definition: eigen_frwds.h:48
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
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:72
Declares a class that represents any robot's observation.
void setSensorPose(const mrpt::poses::CPose3DQuat &newSensorPose)
A general method to change the sensor pose on the robot in a CPose3DQuat form.
std::pair< mrpt::utils::TPixelCoordf, mrpt::utils::TPixelCoordf > pixels
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)



Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018