¿Lectura multiformato ZXing en C #?

Using ZXing with a webcam feed to try and read a variety of Barcodes/QR codes. Only one problem, it's refusing to read them. It will read one barcode I have lying around, I think a type 128, but when I try to get it to read anything else, nothing happens.

This is the code I'm now using to set the hints for reading the various types:

reader = new MultiFormatReader();

hints = new Hashtable();
fmts = new ArrayList();
fmts.Add(BarcodeFormat.DATAMATRIX);
fmts.Add(BarcodeFormat.QR_CODE);
fmts.Add(BarcodeFormat.PDF417);
fmts.Add(BarcodeFormat.UPC_E);
fmts.Add(BarcodeFormat.UPC_A);
fmts.Add(BarcodeFormat.CODE_128);
fmts.Add(BarcodeFormat.CODE_39);
fmts.Add(BarcodeFormat.ITF);
fmts.Add(BarcodeFormat.EAN_8);
fmts.Add(BarcodeFormat.EAN_13);
hints.Add(DecodeHintType.TRY_HARDER, true);
hints.Add(DecodeHintType.POSSIBLE_FORMATS, fmts);

reader.Hints = hints;

(Based off: http://osdir.com/ml/zxing/2010-02/msg00043.html)

And the actual decode code looks like this...

RGBLuminanceSource lumi = new RGBLuminanceSource((Bitmap)image, width, height);
Result result = reader.decode(new BinaryBitmap(new HybridBinarizer(lumi)), hints);
readData = result.Text;

Am I doing something silly? Has anyone else had success with ZXing under C#?

Toda ayuda fue muy apreciada.

Saludos.

P.S. Using ZXing 1.7 under VS2008 on Win7 32b.

preguntado el 01 de febrero de 12 a las 03:02

1 Respuestas

try with GlobalHistogramBinarizer, the HybridBinarizer does not seem to work..

QRCodeReader reader = new QRCodeReader();
       Bitmap bmp = new Bitmap(@"2.bmp");


        LuminanceSource s = new RGBLuminanceSource(bmp, bmp.Width, bmp.Height);
        BinaryBitmap bb = new BinaryBitmap(new GlobalHistogramBinarizer(s));
        Hashtable hints = new Hashtable();

        Result result = reader.decode(bb);


        MessageBox.Show(result.Text); 

Respondido 15 Feb 12, 11:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.