简体   繁体   English

iOS条形码高效扫描仪

[英]iOS Barcode Efficient Scanner

I am working on an iOS application and I am interested to embed some already developed and tested barcode scanner into it. 我正在开发iOS应用程序,并且有兴趣将一些已经开发和测试的条形码扫描仪嵌入其中。 I tried zxing but this never extract the numbers out of it. 我尝试过zxing,但是从来没有从中提取数字。 My goal is to scan this image and get 24 characters out of it. 我的目标是扫描该图像并从中获取24个字符。

If there is not a already developed thing, I would like to build one myself. 如果还没有开发的东西,我想自己建一个。 How should I start in order to create it from scratch for 1D barcodes initially? 首先应如何从头开始为一维条形码创建它?

在此处输入图片说明

Using zxing I am using this piece of code now. 使用zxing我现在正在使用这段代码。

- (IBAction)scanPressed:(id)sender {

    ZXingWidgetController *widController = [[ZXingWidgetController alloc] initWithDelegate:self showCancel:YES OneDMode:YES];

    zxing::oned::Code128Reader *code128Reader = new zxing::oned::Code128Reader();
    MultiFormatOneDReader *mfReader = [[MultiFormatOneDReader alloc] initWithReader:code128Reader];
    NSSet *readers = [[NSSet alloc ] initWithObjects:mfReader,nil];
    [mfReader release];

    widController.readers = readers;
    [readers release];

    NSBundle *mainBundle = [NSBundle mainBundle];
    widController.soundToPlay =
    [NSURL fileURLWithPath:[mainBundle pathForResource:@"beep-beep" ofType:@"aiff"] isDirectory:NO];
    [self presentModalViewController:widController animated:YES];
    [widController release];
}

I tried ZXing SDK first but it didn't work. 我首先尝试了ZXing SDK,但没有成功。 I then tried ZBar SDK which worked just amazingly great. 然后,我尝试了ZBar SDK,它的运行非常出色。

If in future someone would need the same thing I am going to post the link which helped me make it work. 如果将来有人需要同样的东西,我将发布链接,这有助于我使其正常工作。

http://zbar.sourceforge.net/iphone/sdkdoc/tutorial.html http://zbar.sourceforge.net/iphone/sdkdoc/tutorial.html

If this is a "Code 128" barcode, pay attention of the variant of the code. 如果这是“ Code 128”条形码,请注意该代码的变体。

For example if using zxing you successfully scanned the code but the decoded values do not match the numbers under the barcode, that's probably because zxing decoded the barcode bytes successfully but didn't render the result using the expected alphabet. 例如,如果使用zxing成功扫描了代码,但解码的值与条形码下的数字不匹配,那可能是因为zxing成功解码了条形码字节,但未使用预期的字母呈现结果。

Code 128 exists in three variants: 代码128存在三种变体:

  • Code 128 A which uses the alphabet "!#$%&'()*+.-/0123456789:;<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ 代码128 A使用字母"!#$%&'()*+.-/0123456789:;<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_
  • Code 128 A which uses the wider alphabet "!#$%&'()*+.-/0123456789:;<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`` abcdefghijklmnopqrstuvwxyz{|}~ 代码128 A使用更宽的字母"!#$%&'()*+.-/0123456789:;<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`` abcdefghijklmnopqrstuvwxyz{|}~
  • Code 128 C which encodes numbers 0-9 代码128 C,对数字0-9进行编码

Maybe zxing returns the 128-A or 128-B interpretation of the barcode and not the 128-C variant? 也许zxing返回条形码的128-A或128-B解释,而不是128-C变体? In such cases it would mean that the scanning works correctly but you may force the barcode format so it can interpret it right. 在这种情况下,这意味着扫描可以正常工作,但是您可以强制使用条形码格式,以便可以正确解释。

Maybe I'm wrong about this the zxing code bases for iphone only allows for QR codes. 也许我对此有误,iphone的zxing代码库仅允许QR码。 From the website site http://code.google.com/p/zxing/ 从网站http://code.google.com/p/zxing/

There are also additional modules which are contributed and/or intermittently maintained: 还有一些其他模块可以提供和/或间歇维护:

 zxing.appspot.com: The source behind our web-based barcode generator csharp: Partial C# port cpp: Partial C++ port **iphone: iPhone client + port to Objective C / C++ (QR code only)** jruby: Ruby wrapper actionscript: partial port to Actionscript 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM