Yet Another Robot Platform

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

* Copyright: (C) 2010 RobotCub Consortium
* Author: Paul Fitzpatrick
* CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
#include <stdio.h>
#include <stdlib.h>
#include <yarp/os/all.h>
#include <yarp/sig/all.h>
using namespace yarp::os;
using namespace yarp::sig;
using namespace yarp::dev;
* Read an image from a remote source using the "device" view of
* camera-like sources.
* Remote source could be, for example:
* yarpdev --device test_grabber --name /fakey
int main() {
Property config;
config.put("device","remote_grabber"); // device type
config.put("local","/client"); // name of local port to use
config.put("remote","/fakey"); // name of remote port to connect to
PolyDriver dd(config);
if (!dd.isValid()) {
printf("Failed to create and configure device\n");
return 1;
IFrameGrabberImage *grabberInterface;
if (!dd.view(grabberInterface)) {
printf("Failed to view device through IFrameGrabberImage interface\n");
return 1;
printf("Got a %dx%d image\n", img.width(), img.height());
return 0;