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 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 */ 00059 class OBS_IMPEXP CObservationStereoImagesFeatures : public CObservation 00060 { 00061 // This must be added to any CSerializable derived class: 00062 DEFINE_SERIALIZABLE( CObservationStereoImagesFeatures ) 00063 00064 public: 00065 /** Default Constructor. 00066 */ 00067 CObservationStereoImagesFeatures( ); 00068 00069 /** Other constructor providing members initialization. 00070 */ 00071 CObservationStereoImagesFeatures( 00072 const CMatrixDouble33 &iPLeft /*left intrinsic params*/, const CMatrixDouble33 &iPRight /*right intrinsic params*/, 00073 const CArrayDouble<5> &dPLeft /*left distortion params*/, const CArrayDouble<5> &dPRight /*right distortion params*/, 00074 const CPose3DQuat &rCPose /*rightCameraPose*/, const CPose3DQuat &cPORobot /*cameraPoseOnRobot*/ ); 00075 00076 /** Other constructor providing members initialization. 00077 */ 00078 CObservationStereoImagesFeatures( 00079 const TCamera &cLeft /*left camera*/, const TCamera &cRight /*right camera*/, 00080 const CPose3DQuat &rCPose /*rightCameraPose*/, const CPose3DQuat &cPORobot /*cameraPoseOnRobot*/ ); 00081 00082 /** Destructor 00083 */ 00084 ~CObservationStereoImagesFeatures( ); 00085 00086 /** A method for storing the set of observed features in a text file in the format: <br> 00087 * ID ul vl ur vr <br> 00088 * being (ul,vl) and (ur,vr) the "x" and "y" coordinates for the left and right feature, respectively. 00089 */ 00090 void saveFeaturesToTextFile( const std::string &filename ); 00091 00092 // ------------------ 00093 // Class Members 00094 // ------------------ 00095 TCamera cameraLeft, cameraRight; 00096 00097 /** The pose of the right camera, relative to the left one: 00098 * Note that for the Bumblebee stereo camera and using the conventional reference coordinates for the left 00099 * camera ("x" points to the right, "y" down), the "right" camera is situated 00100 * at position (BL, 0, 0) with q = [1 0 0 0], where BL is the BASELINE. 00101 */ 00102 CPose3DQuat rightCameraPose; 00103 00104 /** The pose of the LEFT camera, relative to the robot. 00105 */ 00106 CPose3DQuat cameraPoseOnRobot; 00107 00108 /** Vectors of image feature pairs (with ID). 00109 */ 00110 std::vector<TStereoImageFeatures> theFeatures; 00111 00112 /** A general method to retrieve the sensor pose on the robot in CPose3D form. 00113 * Note that most sensors will return a full (6D) CPose3DQuat, but see the derived classes for more details or special cases. 00114 * \sa setSensorPose 00115 */ 00116 inline void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = CPose3D(cameraPoseOnRobot); } 00117 00118 /** A general method to retrieve the sensor pose on the robot in CPose3DQuat form. 00119 * Note that most sensors will return a full (6D) CPose3DQuat, but see the derived classes for more details or special cases. 00120 * \sa setSensorPose 00121 */ 00122 inline void getSensorPose( CPose3DQuat &out_sensorPose ) const { out_sensorPose = cameraPoseOnRobot; } 00123 00124 /** A general method to change the sensor pose on the robot in a CPose3D form. 00125 * Note that most sensors will use the full (6D) CPose3DQuat, but see the derived classes for more details or special cases. 00126 * \sa getSensorPose 00127 */ 00128 inline void setSensorPose( const CPose3D &newSensorPose ) { cameraPoseOnRobot = CPose3DQuat(newSensorPose); } 00129 00130 /** A general method to change the sensor pose on the robot in a CPose3DQuat form. 00131 * Note that most sensors will use the full (6D) CPose3DQuat, but see the derived classes for more details or special cases. 00132 * \sa getSensorPose 00133 */ 00134 inline void setSensorPose( const CPose3DQuat &newSensorPose ) { cameraPoseOnRobot = newSensorPose; } 00135 }; // End of class def. 00136 00137 } // End of namespace 00138 } // End of namespace 00139 00140 #endif
Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:16:28 UTC 2011 |