Scanning barcode from UIImage natively (that is, not using ZBar)
I have been using the built-in barcode scanner features provided by Apple since iOS7, which is great, but I needed to scan some static images I had, so I could catalog some barcodes automatically.
I couldn't find a way to do this natively, so I used an open source package called zBar and it works great for the most part.
However, it often returns false values, and sometimes flat, does not find the barcode. I also created a C ++ library from scratch, but got the same results in my OS X build. This is also an abandoned project.
Apple's sound solution finds the barcode in this static image even if I scan the image from my computer monitor! The same happens with images returning false / incorrect values.
So what's the use of Apple's libraries to scan UIImage?
source to share
try it
CIDetector* detector = [CIDetector detectorOfType:CIDetectorTypeQRCode context:nil options:@{CIDetectorAccuracy:CIDetectorAccuracyHigh}];
if (detector) {
NSArray* featuresR = [detector featuresInImage:scannedImg.CIImage];
NSString* decodeR;
for (CIQRCodeFeature* featureR in featuresR) {
NSLog(@"decode %@ ",featureR.messageString);
decodeR = featureR.messageString;
}
}
source to share