compare measurement of "x color" pixels compared to background
in
Core Library Questions
•
10 months ago
just as the title says. I need advice of what fuctions to consider and what to incorporate.
I have a drawing (black)thats drawing onto a white background. I just want to compare that if the white backgrounds pixels are not 100% white, do something.
Maybe someone has a different helpful tip as oppose to the way I am thinking.
- loadPixels();
- // Loop through every pixel column
- for (int x = 0; x < width; x++) {
- // Loop through every pixel row
- for (int y = 0; y < height; y++) {
- // Use the formula to find the 1D location
- int loc = x + y * width;
- if (x % 2 == 0) { // If we are an even column
- pixels[loc] = color(255);
- } else { // If we are an odd column
- pixels[loc] = color(0);
- }
- }
- }
- updatePixels()
I was thinking of this, but just unclear on how to just get a general average of all
1