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-2018, 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 
17 
18 namespace mrpt
19 {
20 namespace hwdrivers
21 {
22 /** These capture types are like their OpenCV equivalents. */
24 {
30  /** Valid only with OpenCV >= 1.1.0 */
32 };
33 
34 /** Options used when creating an OpenCV capture object
35  * Some options apply to IEEE1394 cameras only.
36  * \sa CImageGrabber_OpenCV
37  * \ingroup mrpt_hwdrivers_grp
38  */
40 {
42  : frame_width(0),
43  frame_height(0),
44  gain(0),
45  ieee1394_fps(0),
46  ieee1394_grayscale(false)
47  {
48  }
49 
50  /** (All cameras) Capture resolution (0: Leave the default) */
52  /** (All cameras) Camera gain (0: Leave the default) */
53  double gain;
54  /** (IEEE1394 cameras) Frame rate for the capture (0: Leave the default). */
55  double ieee1394_fps;
56  /** (IEEE1394 cameras) Whether to grab grayscale images (Default=false). */
58 };
59 
60 /** A class for grabing images from a "OpenCV"-compatible camera, or from an AVI
61  * video file.
62  * See the constructor for the options when opening the camera.
63  *
64  * Unless input from AVI files is required, it is recommended to use the more
65  * generic class
66  * mrpt::hwdrivers::CCameraSensor.
67  *
68  * \note This class is only available when compiling MRPT with the flag
69  * "MRPT_HAS_OPENCV" defined.
70  * \note Some code is based on the class CaptureCamera from the Orocos project.
71  * \sa mrpt::hwdrivers::CCameraSensor, CImageGrabber_dc1394
72  * \sa The most generic camera grabber in MRPT: mrpt::hwdrivers::CCameraSensor
73  * \ingroup mrpt_hwdrivers_grp
74  */
76 {
77  protected:
78  /** Set to false if we could not initialize the camera.
79  */
81 
82  /** Internal use:
83  */
85 
86  public:
87  /** Constructor for cameras:
88  * \param cameraIndex Set the camera index, or -1 if it does not matter and
89  * you select AUTODETECT as cameraType.
90  * \param cameraType Can be any value of TCameraType, or
91  * CAMERA_CV_AUTODETECT if there is only one camera.
92  * \param options Capture options, defined in
93  * mrpt::hwdrivers::TCaptureCVOptions. If not provided, all the default
94  * options will be used.
95  */
97  int cameraIndex = -1, TCameraType cameraType = CAMERA_CV_AUTODETECT,
98  const TCaptureCVOptions& options = TCaptureCVOptions());
99 
100  /** Constructor for AVI files:
101  */
102  CImageGrabber_OpenCV(const std::string& AVI_fileName);
103 
104  /** Destructor
105  */
106  virtual ~CImageGrabber_OpenCV();
107 
108  /** Check whether the camera has been open successfully. */
109  bool isOpen() const { return m_bInitialized; }
110  /** Grab an image from the opened camera.
111  * \param out_observation The object to be filled with sensed data.
112  *
113  * \return false on any error, true if all go fine.
114  */
115  bool getObservation(mrpt::obs::CObservationImage& out_observation);
116 
117 }; // End of class
118 
119 } // End of NS
120 } // End of NS
129 
130 #endif
Declares a class derived from "CObservation" that encapsules an image from a camera, whose relative pose to robot is also stored.
mrpt::void_ptr_noncopy m_capture
Internal use:
TCameraType
These capture types are like their OpenCV equivalents.
Contains classes for various device interfaces.
CImageGrabber_OpenCV(int cameraIndex=-1, TCameraType cameraType=CAMERA_CV_AUTODETECT, const TCaptureCVOptions &options=TCaptureCVOptions())
Constructor for cameras:
bool ieee1394_grayscale
(IEEE1394 cameras) Whether to grab grayscale images (Default=false).
int frame_width
(All cameras) Capture resolution (0: Leave the default)
#define MRPT_ENUM_TYPE_END()
Definition: TEnumType.h:74
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.
MRPT_FILL_ENUM_MEMBER(mrpt::hwdrivers, CAMERA_CV_AUTODETECT)
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...
#define MRPT_ENUM_TYPE_BEGIN(_ENUM_TYPE_WITH_NS)
Definition: TEnumType.h:58
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: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019