Main MRPT website > C++ reference for MRPT 1.9.9
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 /** Observation class for either a pair of left+right or left+disparity images
25  *from a stereo camera.
26  *
27  * To find whether the observation contains a right image and/or a disparity
28  *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
38  *the latter case, the "distortion" params of the corresponding "leftCamera" and
39  *"rightCamera" fields should be all zeros.
40  * \sa CObservation
41  * \ingroup mrpt_obs_grp
42  */
44 {
46  // This must be added for declaration of MEX-related functions
48 
49  public:
50  /** Default Constructor */
52 
53  /** Constructor from "IplImage*" images, which could be NULL.
54  * The fields hasImageDisparity and hasImageRight will be set to
55  * true/false depending on them being !=nullptr.
56  * Note that the IplImage's will be COPIED, so it's still the caller's
57  * reponsibility to free the original images,
58  * unless ownMemory is set to true: in that case the IplImage pointers are
59  * copied and those IplImage's will be automatically freed by this object.
60  *
61  */
63  void* iplImageLeft, void* iplImageRight,
64  void* iplImageDisparity = nullptr, bool ownMemory = false);
65 
66  /** Destructor
67  */
69 
70  /** @name Main observation data members
71  @{ */
72 
73  /** Image from the left camera (this image will be ALWAYS present) \sa
74  * areImagesRectified() */
76 
77  /** Image from the right camera, only contains a valid image if
78  * hasImageRight == true. \sa areImagesRectified() */
80 
81  /** Disparity image, only contains a valid image if hasImageDisparity ==
82  * true.
83  * The relation between the actual disparity and pixels and each value in
84  * this image is... ??????????? */
86 
87  /** Whether imageDisparity actually contains data (Default upon
88  * construction: false) */
90  /** Whether imageRight actually contains data (Default upon construction:
91  * true) */
93 
94  /** Parameters for the left/right cameras: individual intrinsic and
95  * distortion parameters of the cameras.
96  * See the <a href="http://www.mrpt.org/Camera_Parameters" >tutorial</a>
97  * for a discussion of these parameters.
98  * \sa areImagesRectified(), getStereoCameraParams()
99  */
101 
102  /** The pose of the LEFT camera, relative to the robot. */
104 
105  /** The pose of the right camera, relative to the left one:
106  * Note that using the conventional reference coordinates for the left
107  * camera (x points to the right, y down), the "right" camera is situated
108  * at position (BL, 0, 0) with yaw=pitch=roll=0, where BL is the
109  * BASELINE.
110  */
112 
113  /** Populates a TStereoCamera structure with the parameters in \a
114  * leftCamera, \a rightCamera and \a rightCameraPose \sa
115  * areImagesRectified() */
116  void getStereoCameraParams(mrpt::utils::TStereoCamera& out_params) const;
117 
118  /** Sets \a leftCamera, \a rightCamera and \a rightCameraPose from a
119  * TStereoCamera structure */
120  void setStereoCameraParams(const mrpt::utils::TStereoCamera& in_params);
121 
122  /** This method only checks whether ALL the distortion parameters in \a
123  * leftCamera are set to zero, which is
124  * the convention in MRPT to denote that this pair of stereo images has
125  * been rectified.
126  */
127  bool areImagesRectified() const;
128 
129  /** @} */
130 
131  // See base class docs
132  void getSensorPose(mrpt::poses::CPose3D& out_sensorPose) const override
133  {
134  out_sensorPose = mrpt::poses::CPose3D(cameraPose);
135  }
136  void setSensorPose(const mrpt::poses::CPose3D& newSensorPose) override
137  {
138  cameraPose = mrpt::poses::CPose3DQuat(newSensorPose);
139  }
140  void getDescriptionAsText(std::ostream& o) const override;
141 
142  /** Do an efficient swap of all data members of this object with "o". */
144 
145 }; // End of class def.
146 
147 } // End of namespace
148 } // End of namespace
149 
150 // Add for declaration of mexplus::from template specialization
152 
153 #endif
bool hasImageRight
Whether imageRight actually contains data (Default upon construction: true)
mrpt::utils::CImage imageLeft
Image from the left camera (this image will be ALWAYS present)
bool areImagesRectified() const
This method only checks whether ALL the distortion parameters in leftCamera are set to zero...
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:118
#define DECLARE_MEXPLUS_FROM(complete_type)
This must be inserted if a custom conversion method for MEX API is implemented in the class...
void setSensorPose(const mrpt::poses::CPose3D &newSensorPose) override
A general method to change the sensor pose on the robot.
bool hasImageDisparity
Whether imageDisparity actually contains data (Default upon construction: false)
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
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.
void getSensorPose(mrpt::poses::CPose3D &out_sensorPose) const override
A general method to retrieve the sensor pose on the robot.
#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...
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).
Definition: CPose3DQuat.h:48
void getStereoCameraParams(mrpt::utils::TStereoCamera &out_params) const
Populates a TStereoCamera structure with the parameters in leftCamera, rightCamera and rightCameraPos...
mrpt::utils::TCamera leftCamera
Parameters for the left/right cameras: individual intrinsic and distortion parameters of the cameras...
mrpt::utils::CImage imageRight
Image from the right camera, only contains a valid image if hasImageRight == true.
void setStereoCameraParams(const mrpt::utils::TStereoCamera &in_params)
Sets leftCamera, rightCamera and rightCameraPose from a TStereoCamera structure.
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:88
Declares a class that represents any robot&#39;s observation.
Definition: CObservation.h:41
void swap(CObservationStereoImages &o)
Do an efficient swap of all data members of this object with "o".
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.
Structure to hold the parameters of a pinhole camera model.
Definition: TCamera.h:32



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019