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 
19 namespace mrpt
20 {
21  namespace hwdrivers
22  {
23  /** These capture types are like their OpenCV equivalents. */
25  {
31  CAMERA_CV_DSHOW //!< 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  {
43  gain(0),
44  ieee1394_fps(0),
45  ieee1394_grayscale(false)
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  */
95  virtual ~CImageGrabber_OpenCV( );
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  */
108  bool getObservation( mrpt::obs::CObservationImage &out_observation);
109 
110 
111  }; // End of class
112 
113  } // End of NS
114 } // End of NS
115 
116 
117 #endif
mrpt::hwdrivers::CImageGrabber_OpenCV::m_bInitialized
bool m_bInitialized
Set to false if we could not initialize the camera.
Definition: CImageGrabber_OpenCV.h:71
mrpt::hwdrivers::CAMERA_CV_VFL
@ CAMERA_CV_VFL
Definition: CImageGrabber_OpenCV.h:28
mrpt::hwdrivers::CAMERA_CV_MIL
@ CAMERA_CV_MIL
Definition: CImageGrabber_OpenCV.h:30
mrpt::hwdrivers::CImageGrabber_OpenCV::m_capture
mrpt::utils::void_ptr_noncopy m_capture
Internal use:
Definition: CImageGrabber_OpenCV.h:75
CObservationImage.h
mrpt::hwdrivers::TCameraType
TCameraType
These capture types are like their OpenCV equivalents.
Definition: CImageGrabber_OpenCV.h:24
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CParticleFilter.h:16
mrpt::hwdrivers::CAMERA_CV_DC1394
@ CAMERA_CV_DC1394
Definition: CImageGrabber_OpenCV.h:27
mrpt::hwdrivers::TCaptureCVOptions::frame_height
int frame_height
(All cameras) Capture resolution (0: Leave the default)
Definition: CImageGrabber_OpenCV.h:48
mrpt::hwdrivers::TCaptureCVOptions::ieee1394_fps
double ieee1394_fps
(IEEE1394 cameras) Frame rate for the capture (0: Leave the default).
Definition: CImageGrabber_OpenCV.h:50
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:49
mrpt::hwdrivers::CAMERA_CV_AUTODETECT
@ CAMERA_CV_AUTODETECT
Definition: CImageGrabber_OpenCV.h:26
mrpt::hwdrivers::TCaptureCVOptions::ieee1394_grayscale
bool ieee1394_grayscale
(IEEE1394 cameras) Whether to grab grayscale images (Default=false).
Definition: CImageGrabber_OpenCV.h:51
mrpt::hwdrivers::CImageGrabber_OpenCV
A class for grabing images from a "OpenCV"-compatible camera, or from an AVI video file.
Definition: CImageGrabber_OpenCV.h:66
safe_pointers.h
mrpt::hwdrivers::CImageGrabber_OpenCV::isOpen
bool isOpen() const
Check whether the camera has been open successfully.
Definition: CImageGrabber_OpenCV.h:98
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
Definition: CImageGrabber_OpenCV.h:48
mrpt::hwdrivers::CAMERA_CV_VFW
@ CAMERA_CV_VFW
Definition: CImageGrabber_OpenCV.h:29
mrpt::utils::non_copiable_ptr_basic< void >
HWDRIVERS_IMPEXP
#define HWDRIVERS_IMPEXP
Definition: hwdrivers_impexp.h:82
mrpt::obs::CObservationImage
Declares a class derived from "CObservation" that encapsules an image from a camera,...
Definition: obs/CObservationImage.h:35
mrpt::hwdrivers::TCaptureCVOptions::TCaptureCVOptions
TCaptureCVOptions()
Definition: CImageGrabber_OpenCV.h:41



Page generated by Doxygen 1.8.17 for MRPT 1.4.0 SVN: at Sat Jan 18 22:37:07 UTC 2020