Jan 6, 2014 at 10:26 PM
Edited Jan 6, 2014 at 10:27 PM
The main problem with the "ToByteArray": it doesn't work as expected.
The call to
does not only give the raw rgb values. It generates also the whole format header stuff for bmp.
You have to cut away the first bunch of bytes before using it with the barcode reader.
On the other hand, in my small test the following snippet
LuminanceSource ls = new ZXing.BitmapLuminanceSource(image);
is faster than
LuminanceSource ls = new ZXing.RGBLuminanceSource(ToByteArray(image), image.Width, image.Height);
My suggestion is, use the image directly with the barcode reader
var result = reader.Decode(image);
The class GlobalHistogramBinarizer is for all types of code. It only uses a different way to calculate the binary values from the luminance values.