Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
xrookies
xrookies's Profile
1
Posts
1
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
Plz get Error :: NullPointExcetion
[3 Replies]
01-Nov-2012 07:39 AM
Forum:
Programming Questions
first of all, Im not good at English. sorry guys.
Question. I wanna find a picture that almost same from sample.
My idea is get sample picture's R.G.B value and add each R,G,B.
then compare each addition value, if addition value is same 0 or most closed by 0,
print out my screen
I made this source, but I can't see good result. cuz ERROR
I need help!!
Thank you.
Ps. Image file names are "img0" to "img10".
========================================================
int i;
PImage sample;
PImage k;
PImage[] img = new PImage[i];
float[] value1;
float value2;
void setup() {
sample = loadImage("sample.jpg");
size(800,600);
sample.loadPixels();
for(i=0; i < img.length; i++) {
for (int n =0; n < sample.width; n++) {
for (int j = 0; j < sample.height; j++) {
{
int r = int(red(get(n,j)));
int g = int(green(get(n,j)));
int b = int(blue(get(n,j)));
for(int n1=0; n1 < img[i].width; n1++){
for(int j1=0; j1 <img[i].height; j1++){
img[i] = loadImage("img" + i + ".jpg");
int r1 = int(red(get(n1,j1)));
int g1 = int(green(get(n1,j1)));
int b1 = int(blue(get(n1,j1)));
value1[i] = (r+g+b) - (r1+g1+b1);
if (value1[i] <= value1[i+1]){
k = loadImage("img" + i + ".jpg");
}
else{
k = loadImage("img" + i + ".jpg");
}
}
}
}
}
noLoop();
}
}
}
void draw(){
image(sample, 0,0);
image(k, 400,0);
}
«Prev
Next »
Moderate user : xrookies
Forum