brightness() values into a new array
in
Programming Questions
•
2 years ago
Hi everybody
This is probably a simple problem but I can't seem to find a solution. Working with the Shiffman example to get the brightness of an images pixels, I want to make a new array out of these brightness values in order to get the min() and max() brightness values
At the moment I have
- PImage img;
- void setup(){
- img=loadImage("example.jpg");
- }
- void draw(){
- img.loadPixels();
- for (int x = 0; x < img.width; x++ ) {
- for (int y = 0; y < img.height; y++ ) {
- int loc = x + y*img.width;
- float[] brightArray=new float[loc];
- for (int i=0;i<brightArray.length;i++) {
- brightArray[i]=brightness(img.pixels[loc]);
- }
- float maxBright=max(brightArray);
- float minBright=min(brightArray);
- float range=maxBright-minBright;
- }
- }
- }
Any ideas on how to fix this? Thanks very much.
1