ZXing扫描多个条码

时间:2012-11-15 11:51:54

标签: ios zxing barcode-scanner

我发现这个库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可以很好地识别它 谁能给我一个线索?

1 个答案:

答案 0 :(得分:1)

需要4个月的时间才能获得审核,但对此已经有了解决方法。

+ info:https://github.com/TheLevelUp/ZXingObjC/pull/235

相关问题