Threshold Code

void threshold(){

for(int x=1; x < height-1; x++){
for(int y=1; y < width-1; y++){
if (get(x,y) < grey){
set(x,y,black);
}
else{
set(x,y,white);
}
}
}

 

Seed Code

void seed() {
 
boolean again;
again = true;
 
while (again){
again = false;
iseed = -1;
jseed = -1;
 
for (int j = 0;j < height; j++){
for (int i = 0;i < width; i++){
// check for a black pixel
if (get(i, j) == black){
iseed = i;
jseed = j;
again = true;
mark8(iseed, jseed, value);
}
if (iseed >= 0) break;
}
}
 
value = color((red(value))+1, (blue(value))+1, (green(value))+1);
count++;
}
}