nullPointerException for imageArray
in
Programming Questions
•
1 years ago
I'm trying to create a program that sort of processes fingerprint images to identify them. So far I have the following code:
int pressCounter;
int waitOut;
PImage originalFingerprint;
byte[][] imageArray; // The binary fingerprint image as an array
byte[][] maskArray; // The binary mask as an array
void setup() {
size(900, 600);
background(255);
originalFingerprint = loadImage("print1.png");
for (int col=1; col<originalFingerprint.width-1; col++) {
for (int row=1; row<originalFingerprint.height-1; row++) {
maskArray[col][row] = 0;
if (brightness(originalFingerprint.get(col, row)) < 127)
imageArray[col][row] = 1;
else
imageArray[col][row] = 0;
}
}
}
void draw() {
waitOut--;
if (waitOut<0) {
waitOut=0;
}
if (mousePressed&&waitOut==0) {
pressCounter++;
waitOut=30;
}
}
The pressCounter is for later when after each click it changes images (I have six to scroll through).
Every time I run the code I get a nullPointerException in the " maskArray[col][row] = 0; " line. I'm not sure what's causing this or how to fix it.
1