please format code with </> button * homework policy * asking questions
i used macOS and processing 3 ver(3.5.4)
before i have video library issue so fix that
link
but i have one more issue
void draw() {
//image(cam, 0, 0);
cam.loadPixels();
prevFrame.loadPixels();
for(int x=0; x<cam.width; x++) {
for(int y=0; y<cam.height; y++) {
int loc = x + y*cam.width;
float r = red(cam.pixels[loc]);
float g = green(cam.pixels[loc]);
float b = blue(cam.pixels[loc]);
float tr = red(prevFrame.pixels[loc]);
float tg = green(prevFrame.pixels[loc]);
float tb = blue(prevFrame.pixels[loc]);
float d =dist(r, g, b, tr, tg, tb);
if(d > 100) {
pixels[loc] = color(255);
} else {
pixels[loc] = color(0); //error here
}
}
}
updatePixels();
}
i make that code
pixels[loc] = color(255); <âthis range is ok
} else {
pixels[loc] = color(0); <---- but this range is error about âNullPointerExceptionâ
}
how can fix this error � help me please
maybe i think my macOS donât use âpixels[loc]â two times
ps. sorry my english ability is not goodâŚ
thanks