Main MRPT website > C++ reference for MRPT 1.5.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-2017, 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
Declares a class derived from "CObservation" that encapsules an image from a camera, whose relative pose to robot is also stored.
TCameraType
These capture types are like their OpenCV equivalents.
OBSERVATION_T::Ptr getObservation(mrpt::obs::CSensoryFramePtr &observations, mrpt::obs::CObservationPtr &observation, bool priority_to_sf=true)
Given an mrpt::obs::CSensoryFrame and a mrpt::obs::CObservation pointer if a OBSERVATION_T type obser...
Definition: obs_utils.h:32
mrpt::utils::void_ptr_noncopy m_capture
Internal use:
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).
GLsizei const GLchar ** string
Definition: glext.h:3919
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
int frame_height
(All cameras) Capture resolution (0: Leave the default)
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)
Options used when creating an OpenCV capture object Some options apply to IEEE1394 cameras only...
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.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020