我找到了这个库https://github.com/TheLevelUp/ZXingObjC这是ZXing到Objective-C的端口,支持多种条码扫描。我需要一个应用程序,所以我尝试让它工作,但当我传递带有多个条形码的图像时,它没有检测到任何内容 这是我正在使用的代码
CGImageRef imageToDecode = self.imgn.image.CGImage; // Given a CGImage in which we are looking for barcodes
ZXLuminanceSource* source = [[[ZXCGImageLuminanceSource alloc] initWithCGImage:imageToDecode] autorelease];
ZXBinaryBitmap* bitmap = [ZXBinaryBitmap binaryBitmapWithBinarizer:[ZXHybridBinarizer binarizerWithSource:source]];
NSError* error = nil;
ZXDecodeHints* hints = [ZXDecodeHints hints];
ZXMultiFormatReader* reader = [ZXMultiFormatReader reader];
ZXGenericMultipleBarcodeReader* multi = [[ZXGenericMultipleBarcodeReader alloc] initWithDelegate:reader];
NSArray * result = [multi decodeMultiple:bitmap hints:hints error:&error];
这将返回一个 nil 数组,并且错误包含“未找到条形码”错误。当我使用 MultiFormatReader 仅使用一个条形码时,这是可以的,但是当我添加一张具有多个相同条形码的图片时,MultiFormatReader 可以很好地识别它,但它不会检测到任何内容 谁能给我一个线索吗?
最佳答案
花了 4 个月的时间才得到审核,但 master 上已经修复了这个问题。
关于ios - ZXing 扫描多个条码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13396995/