YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
OpenCVGrabber.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-FileCopyrightText: 2006 Eric Mislivec
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7
8#ifndef YARP_OPENCV_GRABBER_DEVICE_OPENCVGRABBER_H
9#define YARP_OPENCV_GRABBER_DEVICE_OPENCVGRABBER_H
10
11#include <yarp/os/Property.h>
14#include <yarp/os/Stamp.h>
17
18#include <opencv2/videoio.hpp>
19
33{
34public:
35
37 m_saidSize(false),
38 m_saidResize(false),
39 fromFile(false),
40 m_cap()
41 {}
42 virtual ~OpenCVGrabber() { ; }
43
44
45 bool open(yarp::os::Searchable & config) override;
46 bool close() override;
48
49 inline int height() const override { return m_height; }
50 inline int width() const override { return m_width; }
51
56 inline yarp::os::Stamp getLastInputStamp() override { return m_laststamp; }
57
58protected:
59
60 bool m_saidSize = false;
61 bool m_saidResize = false;
62
64 bool fromFile = false;
65
67 cv::VideoCapture m_cap;
68
71
73};
74
75#endif // YARP_OPENCV_GRABBER_DEVICE_OPENCVGRABBER_H
This class is the parameters parser for class OpenCVGrabber.
opencv_grabber: An image frame grabber device using OpenCV to capture images from cameras and AVI fil...
yarp::os::Stamp getLastInputStamp() override
Implements the IPreciselyTimed interface.
int height() const override
Return the height of each frame.
virtual ~OpenCVGrabber()
bool fromFile
Whether reading from file or camera.
int width() const override
Return the width of each frame.
yarp::os::Property m_config
Saved copy of the device configuration.
bool getImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
Read an image from the grabber.
bool close() override
Close a grabber.
cv::VideoCapture m_cap
OpenCV image capture object.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
yarp::os::Stamp m_laststamp
Interface implemented by all device drivers.
A class for storing options and configuration information.
Definition Property.h:33
A base class for nested structures that can be searched.
Definition Searchable.h:31
An abstraction for a time stamp and/or sequence number.
Definition Stamp.h:21
Typed image class.
Definition Image.h:605