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



Page generated by Doxygen 1.9.8 for MRPT 1.4.0 SVN: at Wed Dec 6 15:06:50 UTC 2023