29#include <opencv2/core/mat.hpp>
30#include <opencv2/imgproc.hpp>
44using yarp::sig::PixelRgb;
68 if (!
m_cap.isOpened()) {
77 if (!
m_cap.isOpened()) {
94 m_cap.set(cv::VideoCaptureProperties::CAP_PROP_FRAME_WIDTH,
m_width);
97 m_width =
m_cap.get(cv::VideoCaptureProperties::CAP_PROP_FRAME_WIDTH);
101 m_cap.set(cv::VideoCaptureProperties::CAP_PROP_FRAME_HEIGHT,
m_height);
104 m_height =
m_cap.get(cv::VideoCaptureProperties::CAP_PROP_FRAME_HEIGHT);
148 if (!
m_cap.isOpened()) {
179 cv::cvtColor(
bgr, frame, cv::COLOR_BGR2RGB);
183 cv::transpose(frame, transposed);
184 image.resize(transposed.cols, transposed.rows);
186 transposed.copyTo(frame);
190 cv::flip(frame, frame, -1);
192 cv::flip(frame, frame, 0);
194 cv::flip(frame, frame, 1);
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
bool fromFile
Whether reading from file or camera.
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 factory for creating driver objects of a particular type.
Global factory for devices.
A container for a device driver.
A mini-server for performing network communication in the background.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
T * read(bool shouldWait=true) override
Read an available object from the port.
A class for storing options and configuration information.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
A base class for nested structures that can be searched.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
void update()
Set the timestamp to the current time, and increment the sequence number (wrapping to 0 if the sequen...
A single value (typically within a Bottle).
#define yCInfo(component,...)
#define yCError(component,...)
#define yCTrace(component,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.