00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2009 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/CPose2D.h> 00036 #include <mrpt/slam/CLandmark.h> 00037 #include <mrpt/slam/CLandmarksMap.h> 00038 00039 namespace mrpt 00040 { 00041 namespace slam 00042 { 00043 using namespace mrpt::utils; 00044 00045 // class CLandmarksMap; 00046 00047 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CObservationStereoImages , CObservation ) 00048 00049 /** Declares a class derived from "CObservation" that encapsule a pair of images taken by a stereo camera. 00050 The next figure illustrate the coordinates reference systems involved in this class:<br> 00051 <center> 00052 <img src="CObservationStereoImages_figRefSystem.png"> 00053 </center> 00054 * 00055 <br> 00056 <b>NOTE:</b> The images stored in this class are supposed to be UNDISTORTED images already.<br> 00057 * \sa CObservation 00058 */ 00059 class MRPTDLLIMPEXP CObservationStereoImages : public CObservation 00060 { 00061 // This must be added to any CSerializable derived class: 00062 DEFINE_SERIALIZABLE( CObservationStereoImages ) 00063 00064 /** If buildAuxiliarMap is called before, this will contain the landmarks-map representation of the observation, for the robot located at the origin. 00065 */ 00066 class CAuxMapWrapper 00067 { 00068 CLandmarksMap *auxMap; 00069 public: 00070 CAuxMapWrapper() : auxMap(NULL) { } 00071 CAuxMapWrapper(const CAuxMapWrapper &o) : auxMap(NULL) { } 00072 CAuxMapWrapper & operator =(const CAuxMapWrapper &o) { clear(); return *this; } 00073 00074 ~CAuxMapWrapper() { clear(); } 00075 00076 CLandmarksMap * get() { return auxMap; } 00077 const CLandmarksMap * get() const { return auxMap; } 00078 00079 void set(CLandmarksMap *m); 00080 00081 void clear(); 00082 }; 00083 00084 mutable CAuxMapWrapper m_auxMap; 00085 00086 00087 public: 00088 /** Default Constructor. 00089 * 00090 */ 00091 CObservationStereoImages( ); 00092 00093 /** Constructor. 00094 * \param iplImageLeft An OpenCV "IplImage*" object with the image to be loaded in the member "imageLeft", or NULL (default) for an empty image. 00095 * \param iplImageRight An OpenCV "IplImage*" object with the image to be loaded in the member "imageRight", or NULL (default) for an empty image. 00096 * 00097 */ 00098 CObservationStereoImages( void *iplImageLeft, void *iplImageRight ); 00099 00100 /** Destructor 00101 */ 00102 ~CObservationStereoImages( ); 00103 00104 /** The pose of the LEFT camera, relative to the robot. 00105 */ 00106 CPose3D cameraPose; 00107 00108 /** The A matrix, see also: 00109 * \sa vision::vision::buildIntrinsicParamsMatrix 00110 */ 00111 CMatrix intrinsicParams; 00112 CMatrix distortionParams; 00113 00114 /** The pair of RECTIFIED images. 00115 */ 00116 CImage imageLeft, imageRight; 00117 00118 /** The pose of the right camera, relative to the left one: 00119 * Note that using the conventional reference coordinates for the left 00120 * camera (x points to the right, y down), the "right" camera is situated 00121 * at position (BL, 0, 0) with yaw=pitch=roll=0, where BL is the BASELINE. 00122 */ 00123 CPose3D rightCameraPose; 00124 00125 /** The focal length of the camera, in meters (can be used among 'intrinsicParams' to determine the pixel size). 00126 * (Added in version 3 of object's streaming) 00127 */ 00128 double focalLength_meters; 00129 00130 /** Implements the virtual method in charge of finding the likelihood between this 00131 * and another observation, probably only of the same derived class. The operator 00132 * may be asymmetric. 00133 * 00134 * \param anotherObs The other observation to compute likelihood with. 00135 * \param anotherObsPose If known, the belief about the robot pose when the other observation was taken can be supplied here, or NULL if it is unknown. 00136 * 00137 * \return Returns a likelihood measurement, in the range [0,1]. 00138 * \exception std::exception On any error, as another observation being of an invalid class. 00139 */ 00140 float likelihoodWith( const CObservation *anotherObs, const CPosePDF *anotherObsPose = NULL ) const; 00141 00142 /** This method build the map in "m_auxMap", only the first time this is called. 00143 */ 00144 const CLandmarksMap * buildAuxiliaryMap( CLandmark::TLandmarkID fID, const CLandmarksMap::TInsertionOptions *insOpts = NULL) const; 00145 00146 /** A general method to retrieve the sensor pose on the robot. 00147 * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases. 00148 * \sa setSensorPose 00149 */ 00150 void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = cameraPose; } 00151 00152 00153 /** A general method to change the sensor pose on the robot. 00154 * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases. 00155 * \sa getSensorPose 00156 */ 00157 void setSensorPose( const CPose3D &newSensorPose ) { cameraPose = newSensorPose; } 00158 00159 //void getRectifiedImages( 00160 00161 00162 }; // End of class def. 00163 00164 00165 } // End of namespace 00166 } // End of namespace 00167 00168 #endif
Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 23:02:22 EDT 2009 |