gpt4 book ai didi

ios - 用于在 iOS 中扫描条码(代码 39 格式)的免费 SDK

转载 作者:可可西里 更新时间:2023-11-01 03:49:49 24 4
gpt4 key购买 nike

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

最佳答案

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

// 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];

这应该差不多了!祝你好运!

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

关于ios - 用于在 iOS 中扫描条码(代码 39 格式)的免费 SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11340418/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com