Main MRPT website > C++ reference for MRPT 1.9.9
CImageGrabber_OpenCV.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #ifndef CImageGrabber_OpenCV_H
10 #define CImageGrabber_OpenCV_H
11 
12 #include <mrpt/config.h>
13 
16 
17 namespace mrpt
18 {
19 namespace hwdrivers
20 {
21 /** These capture types are like their OpenCV equivalents. */
23 {
29  /** Valid only with OpenCV >= 1.1.0 */
31 };
32 
33 /** Options used when creating an OpenCV capture object
34  * Some options apply to IEEE1394 cameras only.
35  * \sa CImageGrabber_OpenCV
36  * \ingroup mrpt_hwdrivers_grp
37  */
39 {
41  : frame_width(0),
42  frame_height(0),
43  gain(0),
44  ieee1394_fps(0),
45  ieee1394_grayscale(false)
46  {
47  }
48 
49  /** (All cameras) Capture resolution (0: Leave the default) */
51  /** (All cameras) Camera gain (0: Leave the default) */
52  double gain;
53  /** (IEEE1394 cameras) Frame rate for the capture (0: Leave the default). */
54  double ieee1394_fps;
55  /** (IEEE1394 cameras) Whether to grab grayscale images (Default=false). */
57 };
58 
59 /** A class for grabing images from a "OpenCV"-compatible camera, or from an AVI
60  * video file.
61  * See the constructor for the options when opening the camera.
62  *
63  * Unless input from AVI files is required, it is recommended to use the more
64  * generic class
65  * mrpt::hwdrivers::CCameraSensor.
66  *
67  * \note This class is only available when compiling MRPT with the flag
68  * "MRPT_HAS_OPENCV" defined.
69  * \note Some code is based on the class CaptureCamera from the Orocos project.
70  * \sa mrpt::hwdrivers::CCameraSensor, CImageGrabber_dc1394
71  * \sa The most generic camera grabber in MRPT: mrpt::hwdrivers::CCameraSensor
72  * \ingroup mrpt_hwdrivers_grp
73  */
75 {
76  protected:
77  /** Set to false if we could not initialize the camera.
78  */
80 
81  /** Internal use:
82  */
84 
85  public:
86  /** Constructor for cameras:
87  * \param cameraIndex Set the camera index, or -1 if it does not matter and
88  * you select AUTODETECT as cameraType.
89  * \param cameraType Can be any value of TCameraType, or
90  * CAMERA_CV_AUTODETECT if there is only one camera.
91  * \param options Capture options, defined in
92  * mrpt::hwdrivers::TCaptureCVOptions. If not provided, all the default
93  * options will be used.
94  */
96  int cameraIndex = -1, TCameraType cameraType = CAMERA_CV_AUTODETECT,
97  const TCaptureCVOptions& options = TCaptureCVOptions());
98 
99  /** Constructor for AVI files:
100  */
101  CImageGrabber_OpenCV(const std::string& AVI_fileName);
102 
103  /** Destructor
104  */
105  virtual ~CImageGrabber_OpenCV();
106 
107  /** Check whether the camera has been open successfully. */
108  bool isOpen() const { return m_bInitialized; }
109  /** Grab an image from the opened camera.
110  * \param out_observation The object to be filled with sensed data.
111  *
112  * \return false on any error, true if all go fine.
113  */
114  bool getObservation(mrpt::obs::CObservationImage& out_observation);
115 
116 }; // End of class
117 
118 } // End of NS
119 } // End of NS
120 
121 #endif
Declares a class derived from "CObservation" that encapsules an image from a camera, whose relative pose to robot is also stored.
TCameraType
These capture types are like their OpenCV equivalents.
CImageGrabber_OpenCV(int cameraIndex=-1, TCameraType cameraType=CAMERA_CV_AUTODETECT, const TCaptureCVOptions &options=TCaptureCVOptions())
Constructor for cameras:
mrpt::utils::void_ptr_noncopy m_capture
Internal use:
bool ieee1394_grayscale
(IEEE1394 cameras) Whether to grab grayscale images (Default=false).
int frame_width
(All cameras) Capture resolution (0: Leave the default)
double ieee1394_fps
(IEEE1394 cameras) Frame rate for the capture (0: Leave the default).
GLsizei const GLchar ** string
Definition: glext.h:4101
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class for grabing images from a "OpenCV"-compatible camera, or from an AVI video file...
Valid only with OpenCV >= 1.1.0.
double gain
(All cameras) Camera gain (0: Leave the default)
bool getObservation(mrpt::obs::CObservationImage &out_observation)
Grab an image from the opened camera.
Options used when creating an OpenCV capture object Some options apply to IEEE1394 cameras only...
bool isOpen() const
Check whether the camera has been open successfully.
bool m_bInitialized
Set to false if we could not initialize the camera.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019