Before someone flames me for not checking the other posts, I have done that already. I have a specific question about one of the techniques that exist to convert an image to grayscale.
I have read through the other posts on SO and basically copied technique 3 (ColorMatrix) from the tutorial at this site. It works very, very, quickly.
The problem I'm having is that what I need is a pure BW image. (i.e.: if average(R,B,G) > 200 => white else black). I have implemented it the straightforward way, and it actually takes nearly 10x as long as the grayscale algorithm from the tutorial.
I am no expert with image processing, and was wondering if there is any way to modify the snippet from the tutorial to convert images to pure black and white. If not, any efficient way would do.
EDIT:
Here's the code I'm using for the black and white (no brain approach):
public Bitmap make_bw(Bitmap original) {
Bitmap output = new Bitmap(original.Width, original.Height);
for (int i = 0; i < original.Width; i++) {
for (int j = 0; j < original.Height; j++) {
Color c = original.GetPixel(i, j);
int average = ((c.R + c.B + c.G) / 3);
if (average < 200)
output.SetPixel(i, j, Color.Black);
else
output.SetPixel(i, j, Color.White);
}
}
return output;
}
Read this, same problem: What would be a good TRUE black and white colormatrix?