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
mrpt::obs::CObservationStereoImages::setStereoCameraParams
void setStereoCameraParams(const mrpt::img::TStereoCamera &in_params)
Sets leftCamera, rightCamera and rightCameraPose from a TStereoCamera structure.
Definition: CObservationStereoImages.cpp:204
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:125
mrpt::obs::CObservationStereoImages::rightCamera
mrpt::img::TCamera rightCamera
Definition: CObservationStereoImages.h:93
TStereoCamera.h
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:217
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:243
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
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:48
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:72
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:129
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:93
mrpt::obs::CObservationStereoImages::imageLeft
mrpt::img::CImage imageLeft
Image from the left camera (this image will be ALWAYS present)
Definition: CObservationStereoImages.h:68
mrpt::img::TStereoCamera
Structure to hold the parameters of a pinhole stereo camera model.
Definition: TStereoCamera.h:25
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
CPose3DQuat.h
mrpt::obs::CObservationStereoImages::swap
void swap(CObservationStereoImages &o)
Do an efficient swap of all data members of this object with "o".
Definition: CObservationStereoImages.cpp:225
mrpt::obs::CObservationStereoImages::CObservationStereoImages
CObservationStereoImages()=default
mrpt::img::TCamera
Structure to hold the parameters of a pinhole camera model.
Definition: TCamera.h:29
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:194
mrpt::obs::CObservationStereoImages::imageDisparity
mrpt::img::CImage imageDisparity
Disparity image, only contains a valid image if hasImageDisparity == true.
Definition: CObservationStereoImages.h:78
DECLARE_MEXPLUS_FROM
#define DECLARE_MEXPLUS_FROM(complete_type)
This must be inserted if a custom conversion method for MEX API is implemented in the class.
Definition: CSerializable.h:140
mrpt::img::CImage
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:130
CPose3D.h
CObservation.h
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:102
mrpt::obs::CObservationStereoImages::cameraPose
mrpt::poses::CPose3DQuat cameraPose
The pose of the LEFT camera, relative to the robot.
Definition: CObservationStereoImages.h:96
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:85
CSerializable.h
mrpt::obs::CObservationStereoImages::hasImageDisparity
bool hasImageDisparity
Whether imageDisparity actually contains data (Default upon construction: false)
Definition: CObservationStereoImages.h:82
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:104
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:131
mrpt::obs::CObservationStereoImages
Observation class for either a pair of left+right or left+disparity images from a stereo camera.
Definition: CObservationStereoImages.h:41



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST