MRPT  2.0.4
CObservationStereoImages.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <mrpt/img/CImage.h>
12 #include <mrpt/img/TStereoCamera.h>
13 #include <mrpt/obs/CObservation.h>
14 #include <mrpt/poses/CPose2D.h>
15 #include <mrpt/poses/CPose3D.h>
16 #include <mrpt/poses/CPose3DQuat.h>
18 
19 namespace mrpt::obs
20 {
21 /** Observation class for either a pair of left+right or left+disparity images
22  *from a stereo camera.
23  *
24  * To find whether the observation contains a right image and/or a disparity
25  *image, see the fields hasImageDisparity and hasImageRight, respectively.
26  * This figure illustrates the coordinate frames involved in this class:
27  *
28  * <center>
29  * <img src="CObservationStereoImages_figRefSystem.png">
30  * </center>
31  *
32  * \note The images stored in this class can be raw or undistorted images. In
33  *the latter case, the "distortion" params of the corresponding "leftCamera" and
34  *"rightCamera" fields should be all zeros.
35  * \sa CObservation
36  * \ingroup mrpt_obs_grp
37  */
39 {
41  // This must be added for declaration of MEX-related functions
43 
44  public:
45  CObservationStereoImages() = default;
46 
47  /** @name Main observation data members
48  @{ */
49 
50  /** Image from the left camera (this image will be ALWAYS present) \sa
51  * areImagesRectified() */
53 
54  /** Image from the right camera, only contains a valid image if
55  * hasImageRight == true. \sa areImagesRectified() */
57 
58  /** Disparity image, only contains a valid image if hasImageDisparity ==
59  * true.
60  * The relation between the actual disparity and pixels and each value in
61  * this image is... ??????????? */
63 
64  /** Whether imageDisparity actually contains data (Default upon
65  * construction: false) */
66  bool hasImageDisparity{false};
67  /** Whether imageRight actually contains data (Default upon construction:
68  * true) */
69  bool hasImageRight{false};
70 
71  /** Parameters for the left/right cameras: individual intrinsic and
72  * distortion parameters of the cameras.
73  * See the <a href="http://www.mrpt.org/Camera_Parameters" >tutorial</a>
74  * for a discussion of these parameters.
75  * \sa areImagesRectified(), getStereoCameraParams()
76  */
78 
79  /** The pose of the LEFT camera, relative to the robot. */
81 
82  /** The pose of the right camera, relative to the left one:
83  * Note that using the conventional reference coordinates for the left
84  * camera (x points to the right, y down), the "right" camera is situated
85  * at position (BL, 0, 0) with yaw=pitch=roll=0, where BL is the
86  * BASELINE.
87  */
89 
90  /** Populates a TStereoCamera structure with the parameters in \a
91  * leftCamera, \a rightCamera and \a rightCameraPose \sa
92  * areImagesRectified() */
93  void getStereoCameraParams(mrpt::img::TStereoCamera& out_params) const;
94 
95  /** Sets \a leftCamera, \a rightCamera and \a rightCameraPose from a
96  * TStereoCamera structure */
97  void setStereoCameraParams(const mrpt::img::TStereoCamera& in_params);
98 
99  /** This method only checks whether ALL the distortion parameters in \a
100  * leftCamera are set to zero, which is
101  * the convention in MRPT to denote that this pair of stereo images has
102  * been rectified.
103  */
104  bool areImagesRectified() const;
105 
106  /** @} */
107 
108  // See base class docs
109  void getSensorPose(mrpt::poses::CPose3D& out_sensorPose) const override
110  {
111  out_sensorPose = mrpt::poses::CPose3D(cameraPose);
112  }
113  void setSensorPose(const mrpt::poses::CPose3D& newSensorPose) override
114  {
115  cameraPose = mrpt::poses::CPose3DQuat(newSensorPose);
116  }
117  void getDescriptionAsText(std::ostream& o) const override;
118 
119  /** Do an efficient swap of all data members of this object with "o". */
121 
122  void load() const override;
123 
124 }; // End of class def.
125 
126 } // namespace mrpt::obs
127 // Add for declaration of mexplus::from template specialization
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...
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...
DECLARE_MEXPLUS_FROM(mrpt::img::TCamera) namespace std
Definition: TCamera.h:227
Observation class for either a pair of left+right or left+disparity images from a stereo camera...
This namespace contains representation of robot actions and observations.
Parameters for the Brown-Conrady camera lens distortion model.
Definition: TCamera.h:26
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).
Definition: CPose3DQuat.h:45
void setStereoCameraParams(const mrpt::img::TStereoCamera &in_params)
Sets leftCamera, rightCamera and rightCameraPose from a TStereoCamera structure.
void load() const override
Makes sure all images and other fields which may be externally stored are loaded in memory...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
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...
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
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:23
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:148



Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020