9 #include <yarp/os/Network.h>
10 #include <yarp/os/BufferedPort.h>
11 #include <yarp/sig/Image.h>
12 #include <yarp/os/Time.h>
13 #include <yarp/os/Property.h>
17 using namespace yarp::sig;
18 using namespace yarp::os;
24 BufferedPort<ImageOf<PixelRgb> > imagePort;
25 BufferedPort<ImageOf<PixelRgb> > outPort;
27 imagePort.open(
"/imageProc/image/in");
28 outPort.open(
"/imageProc/image/out");
31 ImageOf<PixelRgb> *image = imagePort.read();
32 ImageOf<PixelRgb> &outImage = outPort.prepare();
41 for (
int x=0;
x<image->width();
x++) {
42 for (
int y=0;
y<image->height();
y++) {
43 PixelRgb& pixel = image->pixel(
x,
y);
46 if (pixel.b>pixel.r*1.2+10 && pixel.b>pixel.g*1.2+10) {
61 if (ct>(image->width()/20)*(image->height()/20)) {
62 printf(
"Best guess at blue target: %g %g\n", xMean, yMean);
int main(int argc, char *argv[])
Copyright (C) 2008 RobotCub Consortium.