At first I'd like to say that ZXing really is an amazing open source library with a lot of interesting features! I've already dived deeply into the code and have a question:
Is it possible to convert a BinaryBitmap object into a black and white Bitmap?
I'd like to visualize the result after the HybridBinarizer has been applied to an input image to see what's going on.
I tried the following code (as a method of BinaryBitmap class):
public Bitmap ToBitmap()
Bitmap resultBitmap = new Bitmap(Width, Height, PixelFormat.Format24bppRgb);
for (int y = 0; y < Height; y++)
for (int x = 0; x < Width; x++)
resultBitmap.SetPixel(x, y, Color.FromArgb(0,0,0));
resultBitmap.SetPixel(x, y, Color.FromArgb(255,255,255));
I know it's inefficient to use SetPixel and stuff, but that's not the point. I tried several different approaches and the results I get are very strange.
I tried a PDF417 sample code from Wikipedia:
And the result looks like there is some offset between the Bits in the BitMatrix.
What am I doing wrong?
Thanks in advance!