iOS中用于扫描条形码(代码39格式)的免费SDK [英] Free SDK for scanning barcode (code 39 format) in iOS

查看:535
本文介绍了iOS中用于扫描条形码(代码39格式)的免费SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用iphone / ipad的相机扫描Code 39格式的VIN条形码。我试过zxing和zbar,但它们效果不好。大多数时候他们无法识别条形码。任何人都可以告诉我一个更好的方法吗?或者我可以做些什么来增加结果,因为我只需要扫描Code 39(对于VIN汽车)。

I want to scan a VIN barcode, which in Code 39 format, using the camera of iphone/ipad. I tried zxing and zbar, but they don't work well. Most of time they can not recognize the barcode. Can anyone show me a better way to do that? or is there anything I can do to increase the result, because I only need scanning Code 39 (for VIN car).

推荐答案

使用Zbar来实现这一目标。
为了获得足够的扫描分辨率,您需要以横向模式扫描条形码。以下是我的设置(测试和工作)

use Zbar to accomplish this. In order to get enough resolution to scan, you will want to scan the barcode in landscape mode. Here are my settings (tested & working)

// ADD: present a barcode reader that scans from the camera feed
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
reader.supportedOrientationsMask = ZBarOrientationMaskAll;

ZBarImageScanner *scanner = reader.scanner;

//disable other codes to improve performance
[scanner setSymbology: 0
               config: ZBAR_CFG_ENABLE
                   to: 0];
[scanner setSymbology:ZBAR_CODE39 config:ZBAR_CFG_ENABLE to:1];
//only scan vertically, in the middle of the screen (also improves performance)
[reader setScanCrop:CGRectMake(0, 0.4, 1, 0.2)];
[reader setShowsZBarControls:NO];
[reader setShowsHelpOnFail:NO];
//VERY IMPORTANT: reset zoom. by default, the screen is partially zoomed in and will cause a loss of precision
reader.readerView.zoom = 1.0;
reader.readerView.allowsPinchZoom=NO;
reader.readerView.showsFPS=YES;
reader.readerView.tracksSymbols=YES;
//scan landscape only (this also improves performance)
[scanner setSymbology:ZBAR_CODE39 config:ZBAR_CFG_X_DENSITY to:0];
[scanner setSymbology:ZBAR_CODE39 config:ZBAR_CFG_Y_DENSITY to:1];

这应该可以做到!祝你好运!

That should pretty much do it! Good luck!

编辑/注意:从iOS 7开始,iOS框架现在包含一个条形码扫描器。我使用了此实现比使用Zbar获得更好更容易的结果。

Edit/Note:the iOS framework now includes a barcode scanner as of iOS 7. I used this implementation to get better and easier results than using Zbar.

这篇关于iOS中用于扫描条形码(代码39格式)的免费SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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