Recognize the color pixel with getPixels()

I was trying to find out what colors pass the particle. But the bottom right ind the image the particle passes through the white circle but in the log indicates a black color (00) instead of white (FF). Why???

Part of the code I’m using

// testApp::setup()
imagePixels = image.getPixels();

// testApp::update()
int readPos = (particle.pos.x * particle.pos.y) * 3;
unsigned char acc = imagePixels[readPos];

printf(“pos.x pos.y acc: %f %f %02X\n”, particle.pos.x, particle.pos.y, acc);

thanks for the help.

![]( de pantalla 2010-05-19 a las 00.18.48.png)

Try something like this:

unsigned char *pixels=image.getPixels();
int index = mouseY*image.width*3 + mouseX*3;
int red = pixels[index];
int green = pixels[index+1];
int blue = pixels[index+2];
printf(">>>>%i >>>%i >>>%i\n",red,green,blue);

Extracted from here:…-ver-pixels


Thank you very much, the result is super ugly
I need more practice. slowly :slight_smile:

Thanks again.