I need a 2D binary representation of the following PNG image:
Can anyone provide a method or a source to convert PNG image above to a 2D array where 1 = lan
Here's the relevant part if you want to access individual pixels as a 2D array
var w = canvas.width * 4;
var r,g,b;
for (var i=0; i= 164 && r <= 255) &&
(g >= 191 && g <= 229) &&
(b >= 220 && b <= 255)) {
// blue = water
imdata[j*w+i] = 0;
imdata[j*w+i+1] = 0;
imdata[j*w+i+2] = 150;
} else {
// green = land
imdata[j*w+i] = 0;
imdata[j*w+i+1] = 120;
imdata[j*w+i+2] = 0;
}
}
}