Yet Another Robot Platform

How to grab cropped images from a remote source using the yarp::dev::IFrameGrabberImage interface.

See also
* SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
* SPDX-License-Identifier: BSD-3-Clause
#include <yarp/sig/Image.h>
int main(int argc, char* argv[])
p.put("device", "fakeFrameGrabber");
p.put("mode", "grid");
yarp::dev::IFrameGrabberImage *grabber = nullptr;
const yarp::sig::VectorOf<std::pair< int, int>> vertices {{50,50}, {149, 149}};
while (true) {
auto& crop = out.prepare();
grabber->getImageCrop(YARP_CROP_RECT, vertices, crop);
return 0;
bool view(T *&x)
Get an interface to the device driver.
Definition: DeviceDriver.h:88
virtual bool getImageCrop(cropType_id_t cropType, yarp::sig::VectorOf< std::pair< int, int >> vertices, ImageType &image)
Get a crop of the image from the frame grabber.
A container for a device driver.
Definition: PolyDriver.h:23
bool open(const std::string &txt)
Construct and configure a device by its common name.
Definition: PolyDriver.cpp:140
A mini-server for performing network communication in the background.
Definition: BufferedPort.h:60
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
T & prepare()
Access the object which will be transmitted by the next call to yarp::os::BufferedPort::write.
Utilities for manipulating the YARP network, including initialization and shutdown.
Definition: Network.h:780
A class for storing options and configuration information.
Definition: Property.h:33
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
Definition: Property.cpp:1015
Definition: Vector.h:117
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_UNUSED(var)
Definition: api.h:162
int main(int argc, char *argv[])
Definition: yarpros.cpp:265