00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 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 */ 00063 class OBS_IMPEXP CObservationStereoImages : public CObservation 00064 { 00065 // This must be added to any CSerializable derived class: 00066 DEFINE_SERIALIZABLE( CObservationStereoImages ) 00067 00068 public: 00069 /** Default Constructor */ 00070 CObservationStereoImages( ); 00071 00072 /** Constructor from "IplImage*" images, which could be NULL. 00073 * The fields hasImageDisparity and hasImageRight will be set to true/false depending on them being !=NULL. 00074 * Note that the IplImage's will be COPIED, so it's still the caller's reponsibility to free the original images, 00075 * 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. 00076 * 00077 */ 00078 CObservationStereoImages( void *iplImageLeft, void *iplImageRight, void *iplImageDisparity = NULL, bool ownMemory = false ); 00079 00080 /** Destructor 00081 */ 00082 ~CObservationStereoImages( ); 00083 00084 00085 /** @name Main observation data members 00086 @{ */ 00087 00088 /** Image from the left camera (this image will be ALWAYS present) */ 00089 mrpt::utils::CImage imageLeft; 00090 00091 /** Image from the right camera, only contains a valid image if hasImageRight == true. */ 00092 mrpt::utils::CImage imageRight; 00093 00094 /** Disparity image, only contains a valid image if hasImageDisparity == true. 00095 * The relation between the actual disparity and pixels and each value in this image is... ??????????? */ 00096 mrpt::utils::CImage imageDisparity; 00097 00098 bool hasImageDisparity; //!< Whether imageDisparity actually contains data (Default upon construction: false) 00099 bool hasImageRight; //!< Whether imageRight actually contains data (Default upon construction: true) 00100 00101 /** Parameters for the left/right cameras: individual intrinsic and distortion parameters of the cameras. 00102 * See the <a href="http://www.mrpt.org/Camera_Parameters">tutorial</a> for a discussion of these parameters. 00103 */ 00104 TCamera leftCamera, rightCamera; 00105 00106 CPose3DQuat cameraPose; //!< The pose of the LEFT camera, relative to the robot. 00107 00108 /** The pose of the right camera, relative to the left one: 00109 * Note that using the conventional reference coordinates for the left 00110 * camera (x points to the right, y down), the "right" camera is situated 00111 * at position (BL, 0, 0) with yaw=pitch=roll=0, where BL is the BASELINE. 00112 */ 00113 CPose3DQuat rightCameraPose; 00114 00115 /** @} */ 00116 00117 00118 /** A general method to retrieve the sensor pose on the robot. 00119 * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases. 00120 * \sa setSensorPose 00121 */ 00122 void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = cameraPose; } 00123 00124 00125 /** A general method to change the sensor pose on the robot. 00126 * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases. 00127 * \sa getSensorPose 00128 */ 00129 void setSensorPose( const CPose3D &newSensorPose ) { cameraPose = newSensorPose; } 00130 00131 void swap( CObservationStereoImages &o); //!< Do an efficient swap of all data members of this object with "o". 00132 00133 }; // End of class def. 00134 00135 } // End of namespace 00136 } // End of namespace 00137 00138 #endif
Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:16:28 UTC 2011 |