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



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN:exported at Tue Jan 25 21:56:31 UTC 2011