Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
mademoisellecindy
mademoisellecindy's Profile
1
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Histogram
[2 Replies]
19-Jan-2013 09:47 AM
Forum:
General Discussion
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
:
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))]++;
}
}
«Prev
Next »
Moderate user : mademoisellecindy
Forum