Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
dreamafter
dreamafter'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
nullPointerException for imageArray
[3 Replies]
20-Nov-2011 10:12 AM
Forum:
Programming Questions
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.
«Prev
Next »
Moderate user : dreamafter
Forum