Class CImageGrabber_OpenCV

Class Documentation

class CImageGrabber_OpenCV

A class for grabbing images from a “OpenCV”-compatible camera, or from an AVI video file. See the constructor for the options when opening the camera.

Unless input from AVI files is required, it is recommended to use the more generic class mrpt::hwdrivers::CCameraSensor.

See also

The most generic camera grabber in MRPT: mrpt::hwdrivers::CCameraSensor

Note

This class is only available when compiling MRPT with the flag “MRPT_HAS_OPENCV” defined.

Note

Some code is based on the class CaptureCamera from the Orocos project.

Public Functions

CImageGrabber_OpenCV(int cameraIndex = -1, TCameraType cameraType = CAMERA_CV_AUTODETECT, const TCaptureCVOptions &options = TCaptureCVOptions())

Constructor for cameras:

Parameters:
  • cameraIndex – Set the camera index, or -1 if it does not matter and you select AUTODETECT as cameraType.

  • cameraType – Can be any value of TCameraType, or CAMERA_CV_AUTODETECT if there is only one camera.

  • options – Capture options, defined in mrpt::hwdrivers::TCaptureCVOptions. If not provided, all the default options will be used.

CImageGrabber_OpenCV(const std::string &AVI_fileName)

Constructor for AVI files:

virtual ~CImageGrabber_OpenCV()

Destructor

inline bool isOpen() const

Check whether the camera has been open successfully.

bool getObservation(mrpt::obs::CObservationImage &out_observation)

Grab an image from the opened camera.

Parameters:

out_observation – The object to be filled with sensed data.

Returns:

false on any error, true if all go fine.

Protected Attributes

bool m_bInitialized

Set to false if we could not initialize the camera.

mrpt::pimpl<Impl> m_capture