Main MRPT website > C++ reference
MRPT logo
CStereoGrabber_Bumblebee.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 #ifndef CStereoGrabber_Bumblebee_H
29 #define CStereoGrabber_Bumblebee_H
30 
33 
34 #ifndef MRPT_OS_WINDOWS
36 #endif
37 
38 #include <mrpt/config.h>
39 
40 namespace mrpt
41 {
42  namespace hwdrivers
43  {
44  /** Options used when creating a bumblebee camera capture object
45  * \ingroup mrpt_hwdrivers_grp
46  */
48  {
50 
51  int frame_width, frame_height; //!< Capture resolution (Default: 640x480)
52  bool color; //!< Indicates if the Bumblebee camera must capture color images (Default: false -> grayscale)
53  bool getRectified; //!< Indicates if the Bumblebee camera must capture rectified images (Default: true -> rectified)
54  double framerate; //!< Bumblebee camera frame rate (Default: 15 fps)
55  };
56 
57  /** A class for grabing stereo images from a "Bumblebee" or "Bumblebee2" camera
58  * NOTE:
59  * - Windows:
60  * - This class is only available when compiling MRPT with "MRPT_HAS_BUMBLEBEE".
61  * - You will need the "include" and "lib" directories of the vendor's proprietary software to be included in VC++ includes path.
62  * - Linux:
63  * - This class is only available when compiling MRPT with "MRPT_HAS_LIBDC1394_2".
64  * - Capture will be made in color, full resolution and "raw" (not rectified) only.
65  *
66  * Once connected to a camera, you can call "getStereoObservation" to retrieve the stereo images.
67  *
68  * \sa You'll probably want to use instead the most generic camera grabber in MRPT: mrpt::hwdrivers::CCameraSensor
69  * \ingroup mrpt_hwdrivers_grp
70  */
72  {
73  protected:
74 #ifdef MRPT_OS_WINDOWS
75  void *m_triclops; //!< The Triclops context (TriclopsContext)
76  void *m_flycapture; //!< The Flycapture context (FlyCaptureContext).
77  vector_byte m_imgBuff; //!< A buffer to store an image
78 #else
79  mrpt::hwdrivers::CImageGrabber_dc1394 *m_firewire_capture; //!< The actual capture object used in Linux / Mac.
80 #endif
81 
82  bool m_bInitialized; //!< If this has been correctly initiated
83  unsigned int m_resolutionX, m_resolutionY; //!< The desired resolution
84 
85  float m_baseline; //!< Camera baseline
86  float m_focalLength; //!< Camera focal length
87  float m_centerCol, m_centerRow; //!< Camera center coordinates
88 
89 
90  private:
91 
92 #ifdef MRPT_OS_WINDOWS
93  void scaleImage( void* image, unsigned char ucMinOut, unsigned char ucMaxOut );
94  void convertTriclopsImageTo8BitsIplImage( void *src, void* dst );
95 
96  /** Splits a TriclopsImage (grayscale) into two separate IplImages (from the left and right cameras) (for internal use only)
97  * triclopsImage [input]. The Triclops image to split
98  * dstL [output]. The Left CImage.
99  * dstR [output]. The Right CImage.
100  */
101  static void convertTriclopsImagesToIplImages(
102  void* triclopsImage,
103  void* dstL,
104  void* dstR );
105 
106 #endif
107  /** Splits a Flycapture image into two separate IplImages (from the left and right cameras) (for internal use only)
108  * triclopsImage [input]. The FlyCapture image to split
109  * dstL [output]. The Left CImage.
110  * dstR [output]. The Right CImage.
111  */
112  static void convertFlyCaptureImagesToIplImages( void* flycapImage, void* dstL, void* dstR );
113 
114  public:
115 
116  TCaptureOptions_bumblebee m_options; //!< Bumblebee camera frame rate (Default: 15 fps)
117 
118  /** Constructor: */
119  CStereoGrabber_Bumblebee( int cameraIndex = 0, const TCaptureOptions_bumblebee &options = TCaptureOptions_bumblebee() );
120 
121  /** Destructor */
122  virtual ~CStereoGrabber_Bumblebee(void);
123 
124  /** Grab stereo images, and return the pair of rectified images.
125  * \param out_observation The object to be filled with sensed data.
126  *
127  * NOTICE: (1) That the member "CObservationStereoImages::refCameraPose" must be
128  * set on the return of this method, since we don't know here the robot physical structure.
129  * (2) The images are already rectified.
130  *
131  * \return false on any error, true if all go fine.
132  */
133  bool getStereoObservation( mrpt::slam::CObservationStereoImages &out_observation );
134 
135 
136  }; // End of class
137 
138  } // End of NS
139 } // End of NS
140 
141 
142 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013