I was playing with Example3.java, from java swig for yarp, it deals with getting images from iCub simulator's camera.
Right after I use the grabber:
int w = img.width();
int h = img.height();
System.out.println("Got a " + w + "x" + h + " image");
I would like to have access to the RGB values from each pixel. So, after taking a look at the FindLocation.cpp example, I tried this:
System.out.println("Pixel RGB: "+img.pixel(w-1,h-1));
Pixel RGB: yarp.PixelRgb@1f1fba0
And then this:
System.out.println("Pixel: R: "+img.pixel(w-1,h-1).getR()+" G: "+img.pixel(w-1,h-1).getG()+" B: "+img.pixel(w-1,h-1).getB());
Pixel: R: 0 G: 0 B: 0
Am I doing it wrong?
My intention is not only having access to this information but also saving it as an image file in disk (bmp, png, etc)