Main MRPT website > C++ reference
MRPT logo
CStereoGrabber_Bumblebee.h
Go to the documentation of this file.
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 CStereoGrabber_Bumblebee_H
00029 #define CStereoGrabber_Bumblebee_H
00030 
00031 #include <mrpt/slam/CObservationStereoImages.h>
00032 #include <mrpt/hwdrivers/link_pragmas.h>
00033 
00034 #ifndef MRPT_OS_WINDOWS
00035         #include <mrpt/hwdrivers/CImageGrabber_dc1394.h>
00036 #endif
00037 
00038 #include <mrpt/config.h>
00039 
00040 namespace mrpt
00041 {
00042         namespace hwdrivers
00043         {
00044                 /** Options used when creating a bumblebee camera capture object
00045                   * \ingroup mrpt_hwdrivers_grp
00046                   */
00047                 struct HWDRIVERS_IMPEXP TCaptureOptions_bumblebee
00048                 {
00049                         TCaptureOptions_bumblebee();
00050 
00051                         int     frame_width, frame_height;      //!< Capture resolution (Default: 640x480)
00052                         bool color;                                             //!< Indicates if the Bumblebee camera must capture color images (Default: false -> grayscale)
00053                         bool getRectified;                              //!< Indicates if the Bumblebee camera must capture rectified images (Default: true -> rectified)
00054                         double framerate;                               //!< Bumblebee camera frame rate (Default: 15 fps)
00055                 };
00056 
00057                 /** A class for grabing stereo images from a "Bumblebee" or "Bumblebee2" camera
00058                   * NOTE:
00059                   *             - Windows:
00060                   *                     - This class is only available when compiling MRPT with "MRPT_HAS_BUMBLEBEE".
00061                   *                     - You will need the "include" and "lib" directories of the vendor's proprietary software to be included in VC++ includes path.
00062                   *             - Linux:
00063                   *                     - This class is only available when compiling MRPT with "MRPT_HAS_LIBDC1394_2".
00064                   *                     - Capture will be made in color, full resolution and "raw" (not rectified) only.
00065                   *
00066                   * Once connected to a camera, you can call "getStereoObservation" to retrieve the stereo images.
00067                   *
00068                   * \sa You'll probably want to use instead the most generic camera grabber in MRPT: mrpt::hwdrivers::CCameraSensor
00069                   * \ingroup mrpt_hwdrivers_grp
00070                   */
00071                 class HWDRIVERS_IMPEXP  CStereoGrabber_Bumblebee : public mrpt::utils::CUncopiable
00072                 {
00073                 protected:
00074 #ifdef MRPT_OS_WINDOWS
00075                         void                    *m_triclops;                                    //!< The Triclops context (TriclopsContext)
00076                         void                    *m_flycapture;                                  //!< The Flycapture context (FlyCaptureContext).
00077                         vector_byte             m_imgBuff;                                              //!< A buffer to store an image
00078 #else
00079                         mrpt::hwdrivers::CImageGrabber_dc1394   *m_firewire_capture;  //!< The actual capture object used in Linux / Mac.
00080 #endif
00081 
00082                         bool                    m_bInitialized;                                 //!< If this has been correctly initiated
00083                         unsigned int    m_resolutionX, m_resolutionY;   //!< The desired resolution
00084 
00085                         float                   m_baseline;                                             //!< Camera baseline
00086                         float                   m_focalLength;                                  //!< Camera focal length
00087                         float                   m_centerCol, m_centerRow;               //!< Camera center coordinates
00088 
00089 
00090                 private:
00091 
00092 #ifdef MRPT_OS_WINDOWS
00093                         void scaleImage( void*  image, unsigned char    ucMinOut,  unsigned char        ucMaxOut );
00094                         void convertTriclopsImageTo8BitsIplImage( void *src, void* dst );
00095 
00096                         /** Splits a TriclopsImage (grayscale) into two separate IplImages (from the left and right cameras) (for internal use only)
00097                           * triclopsImage [input]. The Triclops image to split
00098                           * dstL [output]. The Left CImage.
00099                           * dstR [output]. The Right CImage.
00100                         */
00101                         static void convertTriclopsImagesToIplImages( 
00102                                 void* triclopsImage, 
00103                                 void* dstL, 
00104                                 void* dstR );
00105 
00106 #endif
00107                         /** Splits a Flycapture image into two separate IplImages (from the left and right cameras) (for internal use only)
00108                           * triclopsImage [input]. The FlyCapture image to split
00109                           * dstL [output]. The Left CImage.
00110                           * dstR [output]. The Right CImage.
00111                         */
00112                         static void convertFlyCaptureImagesToIplImages( void* flycapImage, void* dstL, void* dstR );
00113 
00114                 public:
00115 
00116                         TCaptureOptions_bumblebee       m_options;                      //!< Bumblebee camera frame rate (Default: 15 fps)
00117 
00118                         /** Constructor: */
00119                         CStereoGrabber_Bumblebee( int cameraIndex = 0, const TCaptureOptions_bumblebee &options = TCaptureOptions_bumblebee() );
00120 
00121                         /** Destructor */
00122                         virtual ~CStereoGrabber_Bumblebee(void);
00123 
00124                         /** Grab stereo images, and return the pair of rectified images.
00125                          * \param out_observation The object to be filled with sensed data.
00126                          *
00127                          *  NOTICE: (1) That the member "CObservationStereoImages::refCameraPose" must be
00128                          *                set on the return of this method, since we don't know here the robot physical structure.
00129                          *          (2) The images are already rectified.
00130                          *
00131                          * \return false on any error, true if all go fine.
00132                         */
00133                         bool  getStereoObservation( mrpt::slam::CObservationStereoImages &out_observation );
00134 
00135 
00136                 };      // End of class
00137 
00138         } // End of NS
00139 } // End of NS
00140 
00141 
00142 #endif



Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011