Main MRPT website > C++ reference for MRPT 1.5.6
obs/CObservationStereoImages.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 CObservationStereoImages_H
10 #define CObservationStereoImages_H
11 
13 #include <mrpt/utils/CImage.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 {
24  DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CObservationStereoImages , CObservation,OBS_IMPEXP )
25 
26  /** Observation class for either a pair of left+right or left+disparity images from a stereo camera.
27  *
28  * To find whether the observation contains a right image and/or a disparity image, see the
29  * fields hasImageDisparity and hasImageRight, respectively.
30  *
31  * This figure illustrates the coordinate frames involved in this class:
32  *
33  * <center>
34  * <img src="CObservationStereoImages_figRefSystem.png">
35  * </center>
36  *
37  * \note The images stored in this class can be raw or undistorted images. In the latter case, the "distortion" params of the corresponding "leftCamera" and "rightCamera" fields should be all zeros.
38  * \sa CObservation
39  * \ingroup mrpt_obs_grp
40  */
42  {
43  // This must be added to any CSerializable derived class:
45  // This must be added for declaration of MEX-related functions
47 
48  public:
49  /** Default Constructor */
51 
52  /** Constructor from "IplImage*" images, which could be NULL.
53  * The fields hasImageDisparity and hasImageRight will be set to true/false depending on them being !=NULL.
54  * Note that the IplImage's will be COPIED, so it's still the caller's reponsibility to free the original images,
55  * unless ownMemory is set to true: in that case the IplImage pointers are copied and those IplImage's will be automatically freed by this object.
56  *
57  */
58  CObservationStereoImages( void *iplImageLeft, void *iplImageRight, void *iplImageDisparity = NULL, bool ownMemory = false );
59 
60  /** Destructor
61  */
63 
64 
65  /** @name Main observation data members
66  @{ */
67 
68  /** Image from the left camera (this image will be ALWAYS present) \sa areImagesRectified() */
70 
71  /** Image from the right camera, only contains a valid image if hasImageRight == true. \sa areImagesRectified() */
73 
74  /** Disparity image, only contains a valid image if hasImageDisparity == true.
75  * The relation between the actual disparity and pixels and each value in this image is... ??????????? */
77 
78  bool hasImageDisparity; //!< Whether imageDisparity actually contains data (Default upon construction: false)
79  bool hasImageRight; //!< Whether imageRight actually contains data (Default upon construction: true)
80 
81  /** Parameters for the left/right cameras: individual intrinsic and distortion parameters of the cameras.
82  * See the <a href="http://www.mrpt.org/Camera_Parameters" >tutorial</a> for a discussion of these parameters.
83  * \sa areImagesRectified(), getStereoCameraParams()
84  */
86 
87  mrpt::poses::CPose3DQuat cameraPose; //!< The pose of the LEFT camera, relative to the robot.
88 
89  /** The pose of the right camera, relative to the left one:
90  * Note that using the conventional reference coordinates for the left
91  * camera (x points to the right, y down), the "right" camera is situated
92  * at position (BL, 0, 0) with yaw=pitch=roll=0, where BL is the BASELINE.
93  */
95 
96  /** Populates a TStereoCamera structure with the parameters in \a leftCamera, \a rightCamera and \a rightCameraPose \sa areImagesRectified() */
97  void getStereoCameraParams(mrpt::utils::TStereoCamera &out_params) const;
98 
99  /** Sets \a leftCamera, \a rightCamera and \a rightCameraPose from a TStereoCamera structure */
100  void setStereoCameraParams(const mrpt::utils::TStereoCamera &in_params);
101 
102  /** This method only checks whether ALL the distortion parameters in \a leftCamera are set to zero, which is
103  * the convention in MRPT to denote that this pair of stereo images has been rectified.
104  */
105  bool areImagesRectified() const;
106 
107  /** @} */
108 
109 
110  // See base class docs
111  void getSensorPose( mrpt::poses::CPose3D &out_sensorPose ) const MRPT_OVERRIDE { out_sensorPose = mrpt::poses::CPose3D(cameraPose); }
112  void setSensorPose( const mrpt::poses::CPose3D &newSensorPose ) MRPT_OVERRIDE { cameraPose = mrpt::poses::CPose3DQuat(newSensorPose); }
113  void getDescriptionAsText(std::ostream &o) const MRPT_OVERRIDE;
114 
115  void swap( CObservationStereoImages &o); //!< Do an efficient swap of all data members of this object with "o".
116 
117  }; // End of class def.
118  DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE( CObservationStereoImages , CObservation,OBS_IMPEXP )
119 
120  } // End of namespace
121 } // End of namespace
122 
123 // Add for declaration of mexplus::from template specialization
125 
126 #endif
bool hasImageRight
Whether imageRight actually contains data (Default upon construction: true)
void setSensorPose(const mrpt::poses::CPose3D &newSensorPose) MRPT_OVERRIDE
A general method to change the sensor pose on the robot.
mrpt::utils::CImage imageLeft
Image from the left camera (this image will be ALWAYS present)
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:101
#define DECLARE_MEXPLUS_FROM(complete_type)
This must be inserted if a custom conversion method for MEX API is implemented in the class...
bool hasImageDisparity
Whether imageDisparity actually contains data (Default upon construction: false)
Structure to hold the parameters of a pinhole stereo camera model.
Definition: TStereoCamera.h:25
mrpt::poses::CPose3DQuat cameraPose
The pose of the LEFT camera, relative to the robot.
#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...
#define DECLARE_MEX_CONVERSION
This must be inserted if a custom conversion method for MEX API is implemented in the class...
Observation class for either a pair of left+right or left+disparity images from a stereo camera...
void getSensorPose(mrpt::poses::CPose3D &out_sensorPose) const MRPT_OVERRIDE
A general method to retrieve the sensor pose on the robot.
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
mrpt::utils::CImage imageRight
Image from the right camera, only contains a valid image if hasImageRight == true.
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...
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&#39;s observation.
mrpt::poses::CPose3DQuat rightCameraPose
The pose of the right camera, relative to the left one: Note that using the conventional reference co...
mrpt::utils::CImage imageDisparity
Disparity image, only contains a valid image if hasImageDisparity == true.
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
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.6 Git: 4c65e8431 Tue Apr 24 08:18:17 2018 +0200 at lun oct 28 01:35:26 CET 2019