C#下的ZXing多格式读取?
使用ZXing和网络摄像头,尝试读取各种条形码/二维码。只有一个问题,就是拒绝阅读。它将读取一个条形码,我认为是128型,但当我试图让它读取任何其他东西时,什么都没有发生 这是我现在用来设置阅读各种类型的提示的代码:C#下的ZXing多格式读取?,c#,winforms,barcode,zxing,C#,Winforms,Barcode,Zxing,使用ZXing和网络摄像头,尝试读取各种条形码/二维码。只有一个问题,就是拒绝阅读。它将读取一个条形码,我认为是128型,但当我试图让它读取任何其他东西时,什么都没有发生 这是我现在用来设置阅读各种类型的提示的代码: reader = new MultiFormatReader(); hints = new Hashtable(); fmts = new ArrayList(); fmts.Add(BarcodeFormat.DATAMATRIX); fmts.Add(BarcodeForma
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;
(根据:)
实际的解码代码如下所示
RGBLuminanceSource lumi = new RGBLuminanceSource((Bitmap)image, width, height);
Result result = reader.decode(new BinaryBitmap(new HybridBinarizer(lumi)), hints);
readData = result.Text;
我在做傻事吗?还有谁在C#的领导下成功地与中兴合作过吗
非常感谢大家的帮助
干杯
另外,在Win7 32b上使用VS2008下的ZXing 1.7。尝试使用GlobalHistogramBinarizer,杂交二进制程序似乎不起作用
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);