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 CStereoGrabber_Bumblebee_H 00029 #define CStereoGrabber_Bumblebee_H 00030 00031 00032 #include <mrpt/slam/CObservationVisualLandmarks.h> 00033 #include <mrpt/slam/CObservationStereoImages.h> 00034 #include <mrpt/vision/utils.h> 00035 00036 #include <mrpt/config.h> 00037 00038 namespace mrpt 00039 { 00040 namespace vision 00041 { 00042 /** Options used when creating a bumblebee camera capture object 00043 */ 00044 struct MRPTDLLIMPEXP TCaptureOptions_bumblebee 00045 { 00046 TCaptureOptions_bumblebee(); 00047 00048 int frame_width, frame_height; //!< Capture resolution (Default: 640x480) 00049 bool color; //!< Indicates if the Bumblebee camera must capture color images (Default: false -> grayscale) 00050 bool getRectified; //!< Indicates if the Bumblebee camera must capture rectified images (Default: true -> rectified) 00051 int framerate; //!< Bumblebee camera frame rate (Default: 15 fps) 00052 }; 00053 00054 /** A class for grabing stereo images from a "Bumblebee" camera 00055 * NOTE: 00056 * - This class is only available when compiling MRPT with "#define MRPT_HAS_BUMBLEBEE 1" in the "config.h". 00057 * - You will need the "include" and "lib" directories of the vendor's proprietary software to be included in VC++ includes path. 00058 * 00059 * \sa The most generic camera grabber in MRPT: mrpt::hwdrivers::CCameraSensor 00060 */ 00061 class MRPTDLLIMPEXP CStereoGrabber_Bumblebee 00062 { 00063 protected: 00064 void *m_triclops; //!< The Triclops context (TriclopsContext) 00065 void *m_flycapture; //!< The Flycapture context (FlyCaptureContext). 00066 vector_byte m_imgBuff; //!< A buffer to store an image 00067 00068 bool m_bInitialized; //!< If this has been correctly initiated 00069 unsigned int m_resolutionX, m_resolutionY; //!< The desired resolution 00070 00071 float m_baseline; //!< Camera baseline 00072 float m_focalLength; //!< Camera focal length 00073 float m_centerCol, m_centerRow; //!< Camera center coordinates 00074 00075 private: 00076 //CImage m_auxLeftImg, m_auxRightImg; //!< A pair of auxiliary CImages 00077 00078 void scaleImage( void* image, unsigned char ucMinOut, unsigned char ucMaxOut ); 00079 void convertTriclopsImageTo8BitsIplImage( void *src, void* dst ); 00080 00081 /** Splits a TriclopsImage (grayscale) into two separate IplImages (from the left and right cameras) (for internal use only) 00082 * triclopsImage [input]. The Triclops image to split 00083 * dstL [output]. The Left CImage. 00084 * dstR [output]. The Right CImage. 00085 */ 00086 static void convertTriclopsImagesToIplImages( void *triclopsImage, CImage &dstL, CImage &dstR ); 00087 00088 public: 00089 00090 TCaptureOptions_bumblebee m_options; //!< Bumblebee camera frame rate (Default: 15 fps) 00091 00092 /** Constructor: 00093 */ 00094 CStereoGrabber_Bumblebee( int cameraIndex = 0, const TCaptureOptions_bumblebee &options = TCaptureOptions_bumblebee() ); 00095 00096 // Copy constructors (no copies allowed) 00097 CStereoGrabber_Bumblebee( const CStereoGrabber_Bumblebee& ) : 00098 m_bInitialized(false), 00099 //m_pRectImageLeft(NULL),m_pRectImageRight(NULL), 00100 //m_pDispImage(NULL), 00101 m_resolutionX(0), m_resolutionY(0) 00102 { 00103 THROW_EXCEPTION("This class cannot be copied."); 00104 } 00105 00106 CStereoGrabber_Bumblebee & operator =( const CStereoGrabber_Bumblebee& ) { THROW_EXCEPTION("This class cannot be copied."); } 00107 00108 /** Destructor 00109 */ 00110 virtual ~CStereoGrabber_Bumblebee(void); 00111 00112 /** Grab stereo images, process them, and return the computed data. 00113 * \param out_observation The object to be filled with sensed data. Landmarks type is "vlColor" 00114 * 00115 * NOTICE: That the member "CObservationVisualLandmarks::refCameraPose" must be 00116 * set on the return of this method, since we don't know here the robot physical structure. 00117 * 00118 * \return false on any error, true if all go fine. 00119 */ 00120 bool getObservation( mrpt::slam::CObservationVisualLandmarks &out_observation); 00121 00122 // ******************************** FAMD **************************************************** 00123 /** Grab stereo images, process them, and return the computed data. 00124 * \param ROI Region of interest where the data will be computed 00125 * \param out_observation The object to be filled with sensed data. Landmarks type is "vlColor" 00126 * 00127 * NOTICE: That the member "CObservationVisualLandmarks::refCameraPose" must be 00128 * set on the return of this method, since we don't know here the robot physical structure. 00129 * 00130 * \return false on any error, true if all go fine. 00131 */ 00132 bool getObservation( 00133 TROI ROI, 00134 mrpt::slam::CObservationVisualLandmarks &out_observation); 00135 // ****************************** END FAMD *************************************************** 00136 00137 /** Grab stereo images, and return the pair of rectified images. 00138 * \param out_observation The object to be filled with sensed data. 00139 * 00140 * NOTICE: (1) That the member "CObservationStereoImages::refCameraPose" must be 00141 * set on the return of this method, since we don't know here the robot physical structure. 00142 * (2) The images are already rectified. 00143 * 00144 * \return false on any error, true if all go fine. 00145 */ 00146 bool getStereoObservation( mrpt::slam::CObservationStereoImages &out_observation ); 00147 00148 00149 /** This is a merge method for "getImagesPairObservation" and "getObservation", which gets both kind of observations. 00150 */ 00151 bool getBothObservation( 00152 mrpt::slam::CObservationVisualLandmarks &out_observation, 00153 mrpt::slam::CObservationStereoImages &out_observationStereo ); 00154 00155 // ******************************** FAMD **************************************************** 00156 /** This is a merge method for "getImagesPairObservation" and "getObservation", which gets both kind of observations. 00157 * The ROI defines the Region of Interest for the Observation 00158 */ 00159 bool getBothObservation( 00160 TROI ROI, 00161 mrpt::slam::CObservationVisualLandmarks &out_observation, 00162 mrpt::slam::CObservationStereoImages &out_observationStereo ); 00163 00164 /** This is a fast merge method for "getImagesPairObservation" and "getObservation", which gets both kind of observations. 00165 * The ROI defines the Region of Interest for the Observation 00166 */ 00167 bool getBothObservation( 00168 vector_float &vX, 00169 vector_float &vY, 00170 vector_float &vZ, 00171 mrpt::slam::CObservationStereoImages &out_observationStereo ); 00172 // ****************************** END FAMD *************************************************** 00173 00174 00175 }; // End of class 00176 00177 } // End of NS 00178 } // End of NS 00179 00180 00181 #endif
Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 23:02:22 EDT 2009 |