00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://www.mrpt.org/ | 00005 | | 00006 | Copyright (C) 2005-2011 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 #ifndef CObservationStereoImages_H 00029 #define CObservationStereoImages_H 00030 00031 #include <mrpt/utils/CSerializable.h> 00032 #include <mrpt/utils/CImage.h> 00033 #include <mrpt/slam/CObservation.h> 00034 #include <mrpt/poses/CPose3D.h> 00035 #include <mrpt/poses/CPose3DQuat.h> 00036 #include <mrpt/poses/CPose2D.h> 00037 //#include <mrpt/slam/CLandmark.h> 00038 //#include <mrpt/slam/CLandmarksMap.h> 00039 //#include <mrpt/vision/CCamModel.h> 00040 00041 namespace mrpt 00042 { 00043 namespace slam 00044 { 00045 using namespace mrpt::utils; 00046 00047 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CObservationStereoImages , CObservation,OBS_IMPEXP ) 00048 00049 /** Observation class for either a pair of left+right or left+disparity images from a stereo camera. 00050 * 00051 * To find whether the observation contains a right image and/or a disparity image, see the 00052 * fields hasImageDisparity and hasImageRight, respectively. 00053 * 00054 * This figure illustrates the coordinate frames involved in this class: 00055 * 00056 * <center> 00057 * <img src="CObservationStereoImages_figRefSystem.png"> 00058 * </center> 00059 * 00060 * \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. 00061 * \sa CObservation 00062 * \ingroup mrpt_obs_grp 00063 */ 00064 class OBS_IMPEXP CObservationStereoImages : public CObservation 00065 { 00066 // This must be added to any CSerializable derived class: 00067 DEFINE_SERIALIZABLE( CObservationStereoImages ) 00068 00069 public: 00070 /** Default Constructor */ 00071 CObservationStereoImages( ); 00072 00073 /** Constructor from "IplImage*" images, which could be NULL. 00074 * The fields hasImageDisparity and hasImageRight will be set to true/false depending on them being !=NULL. 00075 * Note that the IplImage's will be COPIED, so it's still the caller's reponsibility to free the original images, 00076 * 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. 00077 * 00078 */ 00079 CObservationStereoImages( void *iplImageLeft, void *iplImageRight, void *iplImageDisparity = NULL, bool ownMemory = false ); 00080 00081 /** Destructor 00082 */ 00083 ~CObservationStereoImages( ); 00084 00085 00086 /** @name Main observation data members 00087 @{ */ 00088 00089 /** Image from the left camera (this image will be ALWAYS present) */ 00090 mrpt::utils::CImage imageLeft; 00091 00092 /** Image from the right camera, only contains a valid image if hasImageRight == true. */ 00093 mrpt::utils::CImage imageRight; 00094 00095 /** Disparity image, only contains a valid image if hasImageDisparity == true. 00096 * The relation between the actual disparity and pixels and each value in this image is... ??????????? */ 00097 mrpt::utils::CImage imageDisparity; 00098 00099 bool hasImageDisparity; //!< Whether imageDisparity actually contains data (Default upon construction: false) 00100 bool hasImageRight; //!< Whether imageRight actually contains data (Default upon construction: true) 00101 00102 /** Parameters for the left/right cameras: individual intrinsic and distortion parameters of the cameras. 00103 * See the <a href="http://www.mrpt.org/Camera_Parameters" >tutorial</a> for a discussion of these parameters. 00104 */ 00105 TCamera leftCamera, rightCamera; 00106 00107 CPose3DQuat cameraPose; //!< The pose of the LEFT camera, relative to the robot. 00108 00109 /** The pose of the right camera, relative to the left one: 00110 * Note that using the conventional reference coordinates for the left 00111 * camera (x points to the right, y down), the "right" camera is situated 00112 * at position (BL, 0, 0) with yaw=pitch=roll=0, where BL is the BASELINE. 00113 */ 00114 CPose3DQuat rightCameraPose; 00115 00116 /** @} */ 00117 00118 00119 /** A general method to retrieve the sensor pose on the robot. 00120 * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases. 00121 * \sa setSensorPose 00122 */ 00123 void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = cameraPose; } 00124 00125 00126 /** A general method to change the sensor pose on the robot. 00127 * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases. 00128 * \sa getSensorPose 00129 */ 00130 void setSensorPose( const CPose3D &newSensorPose ) { cameraPose = CPose3DQuat(newSensorPose); } 00131 00132 void swap( CObservationStereoImages &o); //!< Do an efficient swap of all data members of this object with "o". 00133 00134 }; // End of class def. 00135 00136 } // End of namespace 00137 } // End of namespace 00138 00139 #endif
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |