在ZBAR SDK示例中,条形码的解码也错误 [英] Wrong decoding of barcodes also in ZBAR SDK example

查看:972
本文介绍了在ZBAR SDK示例中,条形码的解码也错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ZBarSDK和iPhone项目。

I am using the ZBarSDK with a project for iPhone.

我使用ZBar作为嵌入式阅读器。基本上在Interface Builder中连接UIView。将类更改为 ZBarReaderView 并实现委托方法 - (void)readerView:(ZBarReaderView *)视图didReadSymbols:(ZBarSymbolSet *)syms fromImage :( UIImage *)img

I am using ZBar as an embeded reader. Basically hooking up a UIView in Interface Builder. Changing the class to ZBarReaderView and implementing the delegate method -(void)readerView: (ZBarReaderView*) view didReadSymbols: (ZBarSymbolSet*) syms fromImage: (UIImage*) img.

大部分时间都可以正常工作。然而,条形码显然无法正确扫描。第一个块被解释错误。我得到 5008914 ... ,下次我得到 7001814 ... 然后我得到了正确的 4001954 ...

This works fine most of the time. There are however barcodes that apparently do not scan correctly. The first block gets interpreted wrong. I get something like 5008914... the next time I get 7001814... and then I get the correct 4001954...

我回到SDK中的EmbedReader示例,看看我是否可以找到可能需要进行的任何调整,发现它也产生了同样的错误。如果我查看示例ReaderSample,则不会发生错误,但是这会使用 ZBarReaderViewController 的实例。

I went back to the "EmbedReader" example from the SDK and looked to see if I could find any tweaks that might need to be made and discovered that it too produced the same error. If I look at the example "ReaderSample" the error does not occur, however this useses an instance of ZBarReaderViewController.

然后我尝试更改 ZBAR_CFG_X_DENSITY ZBAR_CFG_Y_DENSITY 在我的 viewWillAppear 方法中都是3,但是没有影响。

I then tried to change the ZBAR_CFG_X_DENSITY and ZBAR_CFG_Y_DENSITY both to 3 in my viewWillAppear method, but that had no influence.

扫描机制有什么区别 ZBarReaderViewController ZBarReaderView ?我能做些什么来压制错误的结果?

What is the difference between the scan mechanism of ZBarReaderViewController and ZBarReaderView? What can I do to supress wrong results?

谢谢

这里有一些相关的代码片段。

Here some relevant code snippets.

在.h

@interface ScanVC:UIViewController<ZBarReaderViewDelegate>
{
    IBOutlet ZBarReaderView *readerView;
    ...
}
...
@property (nonatomic, retain) IBOutlet ZBarReaderView *readerView;
...

在.m

@synthesize readerView;
...
-(void) viewDidAppear: (BOOL) animated
{
    [[readerView scanner] setSymbology:0 config:ZBAR_CFG_X_DENSITY to: 3];
    [[readerView scanner] setSymbology:0 config:ZBAR_CFG_Y_DENSITY to: 3];
    [[readerView scanner] setSymbology:ZBAR_I25 config:ZBAR_CFG_ENABLE to:0];
    [readerView start];
}
...
- (void) readerView: (ZBarReaderView*) view didReadSymbols: (ZBarSymbolSet*) syms fromImage: (UIImage*) img
{
    for(ZBarSymbol *sym in syms) {
    ...
    }
    ...
}
...
-(void)viewDidLoad
{
    [readerView setDelegate: self];
}


推荐答案

我注意到你是禁用Interleaved 2 of 5代码。你知道你要扫描哪种类型,或者你实际上除了I25之外还要扫描所有内容吗?如果是这样,您可能想要尝试仅启用一种符号类型 - 例如,仅代码39:

I noticed that you're disabling Interleaved 2 of 5 codes. Do you know which type you will be scanning, or will you in fact be scanning everything but I25? If so, you might want to try enabling only one symbol type—for instance, only Code 39:

[[readerView scanner] setSymbology:0 config:ZBAR_CFG_ENABLE to:0];
[[readerView scanner] setSymbology:ZBAR_CODE39 config:ZBAR_CFG_ENABLE to:1];

我发现这样做可以让我得到更准确的结果(也更快)。

I find that doing so gets me more accurate results (much more quickly as well).

这篇关于在ZBAR SDK示例中,条形码的解码也错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆