I am currently using ZBar for scanning and while it does work very well, I would like to implement something similar to what shopsavvy is doing, which is in their barcode scanner they force the camera to focus every second, which translates into almost instant scanning of the barcode.
Can anyone please point me in the right direction for this?, I am aware that shopsavvy has their own SDK, but the type of barcodes I am interested in, is not supported on their SDK.
Use the following to force an auto focus:
NSArray *devices = [AVCaptureDevice devices];
NSError *error;
for (AVCaptureDevice *device in devices) {
if ([device position] == AVCaptureDevicePositionBack) {
[device lockForConfiguration:&error];
if ([device isFocusModeSupported:AVCaptureFocusModeAutoFocus]) {
device.focusMode = AVCaptureFocusModeAutoFocus;
}
[device unlockForConfiguration];
}
}
You can shove this in a method and schedule it with an NSTimer
.
Based off IPhone iOS 4.3 camera focus square - removeable programatically?