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
mrpt::obs::CObservationStereoImages::setStereoCameraParams
void setStereoCameraParams(const mrpt::img::TStereoCamera &in_params)
Sets leftCamera, rightCamera and rightCameraPose from a TStereoCamera structure.
Definition: CObservationStereoImages.cpp:184
mrpt::obs::CObservationStereoImages::getSensorPose
void getSensorPose(mrpt::poses::CPose3D &out_sensorPose) const override
A general method to retrieve the sensor pose on the robot.
Definition: CObservationStereoImages.h:109
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:152
mrpt::obs::CObservationStereoImages::rightCamera
mrpt::img::TCamera rightCamera
Definition: CObservationStereoImages.h:77
TStereoCamera.h
mrpt::obs::CObservationStereoImages::load
void load() const override
Makes sure all images and other fields which may be externally stored are loaded in memory.
Definition: CObservationStereoImages.cpp:281
mrpt::obs::CObservationStereoImages::areImagesRectified
bool areImagesRectified() const
This method only checks whether ALL the distortion parameters in leftCamera are set to zero,...
Definition: CObservationStereoImages.cpp:197
mrpt::obs::CObservationStereoImages::getDescriptionAsText
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
Definition: CObservationStereoImages.cpp:223
mrpt::poses::CPose3DQuat
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,...
Definition: CPose3DQuat.h:45
CPose2D.h
mrpt::obs::CObservationStereoImages::imageRight
mrpt::img::CImage imageRight
Image from the right camera, only contains a valid image if hasImageRight == true.
Definition: CObservationStereoImages.h:56
mrpt::obs
This namespace contains representation of robot actions and observations.
Definition: CParticleFilter.h:17
mrpt::obs::CObservationStereoImages::setSensorPose
void setSensorPose(const mrpt::poses::CPose3D &newSensorPose) override
A general method to change the sensor pose on the robot.
Definition: CObservationStereoImages.h:113
mrpt::obs::CObservationStereoImages::leftCamera
mrpt::img::TCamera leftCamera
Parameters for the left/right cameras: individual intrinsic and distortion parameters of the cameras.
Definition: CObservationStereoImages.h:77
mrpt::obs::CObservationStereoImages::imageLeft
mrpt::img::CImage imageLeft
Image from the left camera (this image will be ALWAYS present)
Definition: CObservationStereoImages.h:52
mrpt::img::TStereoCamera
Structure to hold the parameters of a pinhole stereo camera model.
Definition: TStereoCamera.h:23
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
CPose3DQuat.h
DECLARE_MEXPLUS_FROM
DECLARE_MEXPLUS_FROM(mrpt::img::TCamera) namespace std
Definition: TCamera.h:227
mrpt::obs::CObservationStereoImages::swap
void swap(CObservationStereoImages &o)
Do an efficient swap of all data members of this object with "o".
Definition: CObservationStereoImages.cpp:205
mrpt::obs::CObservationStereoImages::CObservationStereoImages
CObservationStereoImages()=default
mrpt::img::TCamera
Parameters for the Brown-Conrady camera lens distortion model.
Definition: TCamera.h:26
mrpt::obs::CObservationStereoImages::getStereoCameraParams
void getStereoCameraParams(mrpt::img::TStereoCamera &out_params) const
Populates a TStereoCamera structure with the parameters in leftCamera, rightCamera and rightCameraPos...
Definition: CObservationStereoImages.cpp:174
mrpt::obs::CObservationStereoImages::imageDisparity
mrpt::img::CImage imageDisparity
Disparity image, only contains a valid image if hasImageDisparity == true.
Definition: CObservationStereoImages.h:62
mrpt::img::CImage
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:148
CPose3D.h
CObservation.h
mrpt::obs::CObservationStereoImages::cameraPose
mrpt::poses::CPose3DQuat cameraPose
The pose of the LEFT camera, relative to the robot.
Definition: CObservationStereoImages.h:80
mrpt::obs::CObservation
Declares a class that represents any robot's observation.
Definition: CObservation.h:43
CImage.h
mrpt::obs::CObservationStereoImages::hasImageRight
bool hasImageRight
Whether imageRight actually contains data (Default upon construction: true)
Definition: CObservationStereoImages.h:69
CSerializable.h
mrpt::obs::CObservationStereoImages::hasImageDisparity
bool hasImageDisparity
Whether imageDisparity actually contains data (Default upon construction: false)
Definition: CObservationStereoImages.h:66
mrpt::obs::CObservationStereoImages::rightCameraPose
mrpt::poses::CPose3DQuat rightCameraPose
The pose of the right camera, relative to the left one: Note that using the conventional reference co...
Definition: CObservationStereoImages.h:88
DECLARE_MEX_CONVERSION
#define DECLARE_MEX_CONVERSION
This must be inserted if a custom conversion method for MEX API is implemented in the class.
Definition: CSerializable.h:185
mrpt::obs::CObservationStereoImages
Observation class for either a pair of left+right or left+disparity images from a stereo camera.
Definition: CObservationStereoImages.h:38



Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Sat Jun 27 14:00:59 UTC 2020