First of all i would like to thank for any responses.
I am new in projects in Processing and Arduino.
In this project the plan is, to load a image,then to convert it to black-and-white color.
Then i want every pixel of this image to compare it with a constant color (black or white) and in proportion of the comparison make an array of 1 or 0 .
if the pixel[i] == black
array[i]=0
else
array[i]=1 (==white)
here is what i 've done
void setup() {
size(100, 100);
size(100, 100);
PImage b;
b = loadImage("Koala.jpg");
b = loadImage("Koala.jpg");
image (b ,0 ,0);
filter (THRESHOLD, 0.45);
loadPixels();
color bl = color (0,0,0); // i make a constant color
int a = 0;
int z = 1;
int [] ascii= new int[10000];
for (int i = 0; i < 10000; i = i++) {
if (pixels[i] == bl ){ //i dont know if this compare two colors value..
ascii[i]=a;}
else{
ascii[i]=z;
}
println(ascii); // i want to print tha array....
updatePixels();
}
color bl = color (0,0,0); // i make a constant color
int a = 0;
int z = 1;
int [] ascii= new int[10000];
for (int i = 0; i < 10000; i = i++) {
if (pixels[i] == bl ){ //i dont know if this compare two colors value..
ascii[i]=a;}
else{
ascii[i]=z;
}
println(ascii); // i want to print tha array....
updatePixels();
}
the result of println (ascii) is 0
the comparison does not work
thanks again for any help :)
}
1