Hey I would like to draw a histogram of the three RGB components. Can someone please help me?
This is the code that I started to write:
This is the code that I started to write:
- size(640, 360);
PImage img = loadImage("sun.jpg");
image(img, 0, 0);
double[]r = new double[256];
double[]g = new double[256];
double[]b = new double[256];
for(int i=0; i<256;i++){
r[i]=0;
g[i]=0;
b[i]=0;
}
for(int i=0; i<img.width; i++){
for(int j=1; j<img.height; j++){
color c = img.get(i,j);
r[int(red(c))]++;
g[int(green(c))]++;
b[int(blue(c))]++;
}
}
1