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::hwdrivers
19 {
20 /** These capture types are like their OpenCV equivalents. */
22 {
28  /** Valid only with OpenCV >= 1.1.0 */
30 };
31 
32 /** Options used when creating an OpenCV capture object
33  * Some options apply to IEEE1394 cameras only.
34  * \sa CImageGrabber_OpenCV
35  * \ingroup mrpt_hwdrivers_grp
36  */
38 {
40  : frame_width(0),
41  frame_height(0),
42  gain(0),
43  ieee1394_fps(0),
44  ieee1394_grayscale(false)
45  {
46  }
47 
48  /** (All cameras) Capture resolution (0: Leave the default) */
50  /** (All cameras) Camera gain (0: Leave the default) */
51  double gain;
52  /** (IEEE1394 cameras) Frame rate for the capture (0: Leave the default). */
53  double ieee1394_fps;
54  /** (IEEE1394 cameras) Whether to grab grayscale images (Default=false). */
56 };
57 
58 /** A class for grabing images from a "OpenCV"-compatible camera, or from an AVI
59  * video file.
60  * See the constructor for the options when opening the camera.
61  *
62  * Unless input from AVI files is required, it is recommended to use the more
63  * generic class
64  * mrpt::hwdrivers::CCameraSensor.
65  *
66  * \note This class is only available when compiling MRPT with the flag
67  * "MRPT_HAS_OPENCV" defined.
68  * \note Some code is based on the class CaptureCamera from the Orocos project.
69  * \sa mrpt::hwdrivers::CCameraSensor, CImageGrabber_dc1394
70  * \sa The most generic camera grabber in MRPT: mrpt::hwdrivers::CCameraSensor
71  * \ingroup mrpt_hwdrivers_grp
72  */
74 {
75  protected:
76  /** Set to false if we could not initialize the camera.
77  */
79 
80  /** Internal use:
81  */
83 
84  public:
85  /** Constructor for cameras:
86  * \param cameraIndex Set the camera index, or -1 if it does not matter and
87  * you select AUTODETECT as cameraType.
88  * \param cameraType Can be any value of TCameraType, or
89  * CAMERA_CV_AUTODETECT if there is only one camera.
90  * \param options Capture options, defined in
91  * mrpt::hwdrivers::TCaptureCVOptions. If not provided, all the default
92  * options will be used.
93  */
95  int cameraIndex = -1, TCameraType cameraType = CAMERA_CV_AUTODETECT,
96  const TCaptureCVOptions& options = TCaptureCVOptions());
97 
98  /** Constructor for AVI files:
99  */
100  CImageGrabber_OpenCV(const std::string& AVI_fileName);
101 
102  /** Destructor
103  */
104  virtual ~CImageGrabber_OpenCV();
105 
106  /** Check whether the camera has been open successfully. */
107  bool isOpen() const { return m_bInitialized; }
108  /** Grab an image from the opened camera.
109  * \param out_observation The object to be filled with sensed data.
110  *
111  * \return false on any error, true if all go fine.
112  */
113  bool getObservation(mrpt::obs::CObservationImage& out_observation);
114 
115 }; // End of class
116 
117 }
126 
127 #endif
128 
129 
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:78
double ieee1394_fps
(IEEE1394 cameras) Frame rate for the capture (0: Leave the default).
GLsizei const GLchar ** string
Definition: glext.h:4101
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:62
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020