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
MRPT_ENUM_TYPE_END
#define MRPT_ENUM_TYPE_END()
Definition: TEnumType.h:74
mrpt::hwdrivers::CImageGrabber_OpenCV::m_bInitialized
bool m_bInitialized
Set to false if we could not initialize the camera.
Definition: CImageGrabber_OpenCV.h:80
mrpt::hwdrivers::CAMERA_CV_VFL
@ CAMERA_CV_VFL
Definition: CImageGrabber_OpenCV.h:27
mrpt::hwdrivers::CAMERA_CV_MIL
@ CAMERA_CV_MIL
Definition: CImageGrabber_OpenCV.h:29
mrpt::hwdrivers
Contains classes for various device interfaces.
Definition: C2DRangeFinderAbstract.h:22
mrpt::hwdrivers::TCameraType
TCameraType
These capture types are like their OpenCV equivalents.
Definition: CImageGrabber_OpenCV.h:23
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
MRPT_FILL_ENUM_MEMBER
MRPT_FILL_ENUM_MEMBER(mrpt::hwdrivers, CAMERA_CV_AUTODETECT)
mrpt::hwdrivers::CAMERA_CV_DC1394
@ CAMERA_CV_DC1394
Definition: CImageGrabber_OpenCV.h:26
MRPT_ENUM_TYPE_BEGIN
#define MRPT_ENUM_TYPE_BEGIN(_ENUM_TYPE_WITH_NS)
Definition: TEnumType.h:58
mrpt::hwdrivers::TCaptureCVOptions::frame_height
int frame_height
Definition: CImageGrabber_OpenCV.h:51
mrpt::hwdrivers::CImageGrabber_OpenCV::CImageGrabber_OpenCV
CImageGrabber_OpenCV(int cameraIndex=-1, TCameraType cameraType=CAMERA_CV_AUTODETECT, const TCaptureCVOptions &options=TCaptureCVOptions())
Constructor for cameras:
Definition: CImageGrabber_OpenCV.cpp:27
mrpt::hwdrivers::TCaptureCVOptions::ieee1394_fps
double ieee1394_fps
(IEEE1394 cameras) Frame rate for the capture (0: Leave the default).
Definition: CImageGrabber_OpenCV.h:55
TEnumType.h
mrpt::hwdrivers::CAMERA_CV_DSHOW
@ CAMERA_CV_DSHOW
Valid only with OpenCV >= 1.1.0.
Definition: CImageGrabber_OpenCV.h:31
mrpt::hwdrivers::TCaptureCVOptions::gain
double gain
(All cameras) Camera gain (0: Leave the default)
Definition: CImageGrabber_OpenCV.h:53
mrpt::hwdrivers::CAMERA_CV_AUTODETECT
@ CAMERA_CV_AUTODETECT
Definition: CImageGrabber_OpenCV.h:25
mrpt::hwdrivers::TCaptureCVOptions::ieee1394_grayscale
bool ieee1394_grayscale
(IEEE1394 cameras) Whether to grab grayscale images (Default=false).
Definition: CImageGrabber_OpenCV.h:57
mrpt::hwdrivers::CImageGrabber_OpenCV
A class for grabing images from a "OpenCV"-compatible camera, or from an AVI video file.
Definition: CImageGrabber_OpenCV.h:75
safe_pointers.h
mrpt::hwdrivers::CImageGrabber_OpenCV::~CImageGrabber_OpenCV
virtual ~CImageGrabber_OpenCV()
Destructor.
Definition: CImageGrabber_OpenCV.cpp:235
mrpt::hwdrivers::CImageGrabber_OpenCV::isOpen
bool isOpen() const
Check whether the camera has been open successfully.
Definition: CImageGrabber_OpenCV.h:109
mrpt::hwdrivers::TCaptureCVOptions
Options used when creating an OpenCV capture object Some options apply to IEEE1394 cameras only.
Definition: CImageGrabber_OpenCV.h:39
mrpt::hwdrivers::TCaptureCVOptions::frame_width
int frame_width
(All cameras) Capture resolution (0: Leave the default)
Definition: CImageGrabber_OpenCV.h:51
CObservationImage.h
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::hwdrivers::CImageGrabber_OpenCV::m_capture
mrpt::void_ptr_noncopy m_capture
Internal use:
Definition: CImageGrabber_OpenCV.h:84
mrpt::hwdrivers::CAMERA_CV_VFW
@ CAMERA_CV_VFW
Definition: CImageGrabber_OpenCV.h:28
mrpt::obs::CObservationImage
Declares a class derived from "CObservation" that encapsules an image from a camera,...
Definition: CObservationImage.h:35
mrpt::hwdrivers::CImageGrabber_OpenCV::getObservation
bool getObservation(mrpt::obs::CObservationImage &out_observation)
Grab an image from the opened camera.
Definition: CImageGrabber_OpenCV.cpp:250
mrpt::hwdrivers::TCaptureCVOptions::TCaptureCVOptions
TCaptureCVOptions()
Definition: CImageGrabber_OpenCV.h:41
mrpt::non_copiable_ptr_basic< void >



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST