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 CObservationStereoImagesFeatures_H 00029 #define CObservationStereoImagesFeatures_H 00030 00031 #include <mrpt/utils/CSerializable.h> 00032 #include <mrpt/utils/CImage.h> 00033 #include <mrpt/utils/TCamera.h> 00034 #include <mrpt/slam/CObservation.h> 00035 #include <mrpt/poses/CPose3D.h> 00036 #include <mrpt/poses/CPose3DQuat.h> 00037 #include <mrpt/poses/CPose2D.h> 00038 00039 namespace mrpt 00040 { 00041 namespace slam 00042 { 00043 using namespace mrpt::utils; 00044 using namespace mrpt::slam; 00045 00046 struct OBS_IMPEXP TStereoImageFeatures 00047 { 00048 std::pair<TPixelCoordf,TPixelCoordf> pixels; 00049 unsigned int ID; 00050 }; 00051 00052 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CObservationStereoImagesFeatures , CObservation, OBS_IMPEXP ) 00053 /** Declares a class derived from "CObservation" that encapsules a pair of cameras and a set of matched image features extracted from them. 00054 * 00055 <b>NOTE:</b> The image features stored in this class are NOT supposed to be UNDISTORTED, but the TCamera members must provide their distortion params. 00056 A zero-vector of distortion params means a set of UNDISTORTED pixels.<br> 00057 * \sa CObservation 00058 * \ingroup mrpt_obs_grp 00059 */ 00060 class OBS_IMPEXP CObservationStereoImagesFeatures : public CObservation 00061 { 00062 // This must be added to any CSerializable derived class: 00063 DEFINE_SERIALIZABLE( CObservationStereoImagesFeatures ) 00064 00065 public: 00066 /** Default Constructor. 00067 */ 00068 CObservationStereoImagesFeatures( ); 00069 00070 /** Other constructor providing members initialization. 00071 */ 00072 CObservationStereoImagesFeatures( 00073 const CMatrixDouble33 &iPLeft /*left intrinsic params*/, const CMatrixDouble33 &iPRight /*right intrinsic params*/, 00074 const CArrayDouble<5> &dPLeft /*left distortion params*/, const CArrayDouble<5> &dPRight /*right distortion params*/, 00075 const CPose3DQuat &rCPose /*rightCameraPose*/, const CPose3DQuat &cPORobot /*cameraPoseOnRobot*/ ); 00076 00077 /** Other constructor providing members initialization. 00078 */ 00079 CObservationStereoImagesFeatures( 00080 const TCamera &cLeft /*left camera*/, const TCamera &cRight /*right camera*/, 00081 const CPose3DQuat &rCPose /*rightCameraPose*/, const CPose3DQuat &cPORobot /*cameraPoseOnRobot*/ ); 00082 00083 /** Destructor 00084 */ 00085 ~CObservationStereoImagesFeatures( ); 00086 00087 /** A method for storing the set of observed features in a text file in the format: <br> 00088 * ID ul vl ur vr <br> 00089 * being (ul,vl) and (ur,vr) the "x" and "y" coordinates for the left and right feature, respectively. 00090 */ 00091 void saveFeaturesToTextFile( const std::string &filename ); 00092 00093 // ------------------ 00094 // Class Members 00095 // ------------------ 00096 TCamera cameraLeft, cameraRight; 00097 00098 /** The pose of the right camera, relative to the left one: 00099 * Note that for the Bumblebee stereo camera and using the conventional reference coordinates for the left 00100 * camera ("x" points to the right, "y" down), the "right" camera is situated 00101 * at position (BL, 0, 0) with q = [1 0 0 0], where BL is the BASELINE. 00102 */ 00103 CPose3DQuat rightCameraPose; 00104 00105 /** The pose of the LEFT camera, relative to the robot. 00106 */ 00107 CPose3DQuat cameraPoseOnRobot; 00108 00109 /** Vectors of image feature pairs (with ID). 00110 */ 00111 std::vector<TStereoImageFeatures> theFeatures; 00112 00113 /** A general method to retrieve the sensor pose on the robot in CPose3D form. 00114 * Note that most sensors will return a full (6D) CPose3DQuat, but see the derived classes for more details or special cases. 00115 * \sa setSensorPose 00116 */ 00117 inline void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = CPose3D(cameraPoseOnRobot); } 00118 00119 /** A general method to retrieve the sensor pose on the robot in CPose3DQuat form. 00120 * Note that most sensors will return a full (6D) CPose3DQuat, but see the derived classes for more details or special cases. 00121 * \sa setSensorPose 00122 */ 00123 inline void getSensorPose( CPose3DQuat &out_sensorPose ) const { out_sensorPose = cameraPoseOnRobot; } 00124 00125 /** A general method to change the sensor pose on the robot in a CPose3D form. 00126 * Note that most sensors will use the full (6D) CPose3DQuat, but see the derived classes for more details or special cases. 00127 * \sa getSensorPose 00128 */ 00129 inline void setSensorPose( const CPose3D &newSensorPose ) { cameraPoseOnRobot = CPose3DQuat(newSensorPose); } 00130 00131 /** A general method to change the sensor pose on the robot in a CPose3DQuat form. 00132 * Note that most sensors will use the full (6D) CPose3DQuat, but see the derived classes for more details or special cases. 00133 * \sa getSensorPose 00134 */ 00135 inline void setSensorPose( const CPose3DQuat &newSensorPose ) { cameraPoseOnRobot = newSensorPose; } 00136 }; // End of class def. 00137 00138 } // End of namespace 00139 } // End of namespace 00140 00141 #endif
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |