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-2018, 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/img/CImage.h>
14 #include <mrpt/img/TStereoCamera.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 fields hasImageDisparity and hasImageRight, respectively.
29  * This figure illustrates the coordinate frames involved in this class:
30  *
31  * <center>
32  * <img src="CObservationStereoImages_figRefSystem.png">
33  * </center>
34  *
35  * \note The images stored in this class can be raw or undistorted images. In
36  *the latter case, the "distortion" params of the corresponding "leftCamera" and
37  *"rightCamera" fields should be all zeros.
38  * \sa CObservation
39  * \ingroup mrpt_obs_grp
40  */
42 {
44  // This must be added for declaration of MEX-related functions
46 
47  public:
48  CObservationStereoImages() = default;
49 
50  /** Constructor from "IplImage*" images, which could be NULL.
51  * The fields hasImageDisparity and hasImageRight will be set to
52  * true/false depending on them being !=nullptr.
53  * Note that the IplImage's will be COPIED, so it's still the caller's
54  * reponsibility to free the original images,
55  * unless ownMemory is set to true: in that case the IplImage pointers are
56  * copied and those IplImage's will be automatically freed by this object.
57  *
58  */
60  void* iplImageLeft, void* iplImageRight,
61  void* iplImageDisparity = nullptr, bool ownMemory = false);
62 
63  /** @name Main observation data members
64  @{ */
65 
66  /** Image from the left camera (this image will be ALWAYS present) \sa
67  * areImagesRectified() */
69 
70  /** Image from the right camera, only contains a valid image if
71  * hasImageRight == true. \sa areImagesRectified() */
73 
74  /** Disparity image, only contains a valid image if hasImageDisparity ==
75  * true.
76  * The relation between the actual disparity and pixels and each value in
77  * this image is... ??????????? */
79 
80  /** Whether imageDisparity actually contains data (Default upon
81  * construction: false) */
82  bool hasImageDisparity{false};
83  /** Whether imageRight actually contains data (Default upon construction:
84  * true) */
85  bool hasImageRight{false};
86 
87  /** Parameters for the left/right cameras: individual intrinsic and
88  * distortion parameters of the cameras.
89  * See the <a href="http://www.mrpt.org/Camera_Parameters" >tutorial</a>
90  * for a discussion of these parameters.
91  * \sa areImagesRectified(), getStereoCameraParams()
92  */
94 
95  /** The pose of the LEFT camera, relative to the robot. */
97 
98  /** The pose of the right camera, relative to the left one:
99  * Note that 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 yaw=pitch=roll=0, where BL is the
102  * BASELINE.
103  */
105 
106  /** Populates a TStereoCamera structure with the parameters in \a
107  * leftCamera, \a rightCamera and \a rightCameraPose \sa
108  * areImagesRectified() */
109  void getStereoCameraParams(mrpt::img::TStereoCamera& out_params) const;
110 
111  /** Sets \a leftCamera, \a rightCamera and \a rightCameraPose from a
112  * TStereoCamera structure */
113  void setStereoCameraParams(const mrpt::img::TStereoCamera& in_params);
114 
115  /** This method only checks whether ALL the distortion parameters in \a
116  * leftCamera are set to zero, which is
117  * the convention in MRPT to denote that this pair of stereo images has
118  * been rectified.
119  */
120  bool areImagesRectified() const;
121 
122  /** @} */
123 
124  // See base class docs
125  void getSensorPose(mrpt::poses::CPose3D& out_sensorPose) const override
126  {
127  out_sensorPose = mrpt::poses::CPose3D(cameraPose);
128  }
129  void setSensorPose(const mrpt::poses::CPose3D& newSensorPose) override
130  {
131  cameraPose = mrpt::poses::CPose3DQuat(newSensorPose);
132  }
133  void getDescriptionAsText(std::ostream& o) const override;
134 
135  /** Do an efficient swap of all data members of this object with "o". */
137 
138 }; // End of class def.
139 
140 } // namespace obs
141 } // namespace mrpt
142 
143 // Add for declaration of mexplus::from template specialization
145 
146 #endif
bool hasImageRight
Whether imageRight actually contains data (Default upon construction: true)
mrpt::img::CImage imageDisparity
Disparity image, only contains a valid image if hasImageDisparity == true.
mrpt::img::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...
#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.
void getStereoCameraParams(mrpt::img::TStereoCamera &out_params) const
Populates a TStereoCamera structure with the parameters in leftCamera, rightCamera and rightCameraPos...
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...
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...
Structure to hold the parameters of a pinhole camera model.
Definition: TCamera.h:29
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 setStereoCameraParams(const mrpt::img::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:43
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::img::TCamera leftCamera
Parameters for the left/right cameras: individual intrinsic and distortion parameters of the cameras...
Structure to hold the parameters of a pinhole stereo camera model.
Definition: TStereoCamera.h:25
mrpt::img::CImage imageRight
Image from the right camera, only contains a valid image if hasImageRight == true.
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:130



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019