Main MRPT website > C++ reference for MRPT 1.4.0
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-2016, 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>
14
17
18
19namespace mrpt
20{
21 namespace hwdrivers
22 {
23 /** These capture types are like their OpenCV equivalents. */
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 {
43 gain(0),
44 ieee1394_fps(0),
46 {}
47
48 int frame_width,frame_height; //!< (All cameras) Capture resolution (0: Leave the default)
49 double gain; //!< (All cameras) Camera gain (0: Leave the default)
50 double ieee1394_fps; //!< (IEEE1394 cameras) Frame rate for the capture (0: Leave the default).
51 bool ieee1394_grayscale; //!< (IEEE1394 cameras) Whether to grab grayscale images (Default=false).
52 };
53
54 /** A class for grabing images from a "OpenCV"-compatible camera, or from an AVI video file.
55 * See the constructor for the options when opening the camera.
56 *
57 * Unless input from AVI files is required, it is recommended to use the more generic class
58 * mrpt::hwdrivers::CCameraSensor.
59 *
60 * \note This class is only available when compiling MRPT with the flag "MRPT_HAS_OPENCV" defined.
61 * \note Some code is based on the class CaptureCamera from the Orocos project.
62 * \sa mrpt::hwdrivers::CCameraSensor, CImageGrabber_dc1394
63 * \sa The most generic camera grabber in MRPT: mrpt::hwdrivers::CCameraSensor
64 * \ingroup mrpt_hwdrivers_grp
65 */
67 {
68 protected:
69 /** Set to false if we could not initialize the camera.
70 */
72
73 /** Internal use:
74 */
76
77 public:
78 /** Constructor for cameras:
79 * \param cameraIndex Set the camera index, or -1 if it does not matter and you select AUTODETECT as cameraType.
80 * \param cameraType Can be any value of TCameraType, or CAMERA_CV_AUTODETECT if there is only one camera.
81 * \param options Capture options, defined in mrpt::hwdrivers::TCaptureCVOptions. If not provided, all the default options will be used.
82 */
84 int cameraIndex = -1,
85 TCameraType cameraType = CAMERA_CV_AUTODETECT,
86 const TCaptureCVOptions &options = TCaptureCVOptions()
87 );
88
89 /** Constructor for AVI files:
90 */
91 CImageGrabber_OpenCV( const std::string &AVI_fileName );
92
93 /** Destructor
94 */
96
97 /** Check whether the camera has been open successfully. */
98 bool isOpen() const
99 {
100 return m_bInitialized;
101 }
102
103 /** Grab an image from the opened camera.
104 * \param out_observation The object to be filled with sensed data.
105 *
106 * \return false on any error, true if all go fine.
107 */
109
110
111 }; // End of class
112
113 } // End of NS
114} // End of NS
115
116
117#endif
A class for grabing images from a "OpenCV"-compatible camera, or from an AVI video file.
bool m_bInitialized
Set to false if we could not initialize the camera.
bool getObservation(mrpt::obs::CObservationImage &out_observation)
Grab an image from the opened camera.
CImageGrabber_OpenCV(int cameraIndex=-1, TCameraType cameraType=CAMERA_CV_AUTODETECT, const TCaptureCVOptions &options=TCaptureCVOptions())
Constructor for cameras:
virtual ~CImageGrabber_OpenCV()
Destructor.
CImageGrabber_OpenCV(const std::string &AVI_fileName)
Constructor for AVI files:
mrpt::utils::void_ptr_noncopy m_capture
Internal use:
bool isOpen() const
Check whether the camera has been open successfully.
Declares a class derived from "CObservation" that encapsules an image from a camera,...
#define HWDRIVERS_IMPEXP
TCameraType
These capture types are like their OpenCV equivalents.
@ CAMERA_CV_DSHOW
Valid only with OpenCV >= 1.1.0.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Options used when creating an OpenCV capture object Some options apply to IEEE1394 cameras only.
int frame_height
(All cameras) Capture resolution (0: Leave the default)
bool ieee1394_grayscale
(IEEE1394 cameras) Whether to grab grayscale images (Default=false).
double ieee1394_fps
(IEEE1394 cameras) Frame rate for the capture (0: Leave the default).
double gain
(All cameras) Camera gain (0: Leave the default)



Page generated by Doxygen 1.9.8 for MRPT 1.4.0 SVN: at Wed Dec 6 15:06:50 UTC 2023