Free SDK for barcode scanning (code 39) on iOS

I want to scan the VIN barcode, which is in code format 39, using the iphone / ipad camera. I tried zxing and zbar, but they do not work well. Most of the time they cannot recognize the barcode. Can someone show me the best way to do this? or I can do something to increase the result, because I only need to scan code 39 (for VIN car).

+6
source share
1 answer

use Zbar for this. To get enough resolution for scanning, you will need to scan the barcode in landscape mode. Here are my settings (tested and 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

Edit / Note: the iOS infrastructure now includes a barcode scanner with iOS 7. I used this implementation to improve and easier than using Zbar.

+7
source

Source: https://habr.com/ru/post/919729/


All Articles