Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to decode QRCode image to value

I'm looking for code which help me to convert QRCode from image. there is very easy way with AVFoundation to scan QR Code with help of camera. But if I want to get encoded qr string from UIImage is there any way to do so?

like image 372
Parth Patel p1nt0z Avatar asked Nov 30 '22 18:11

Parth Patel p1nt0z


2 Answers

Native solution:
As far as I know you can scan QR from video since iOS 7. (See other answers)
But scanning from image appeared only in iOS 8.

See CIQRCodeFeature

and this shinobicontrols tutorial

third party libs:
For example ZBar

like image 128
DanSkeel Avatar answered Dec 04 '22 14:12

DanSkeel


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;
  }
}
like image 40
Peter Lapisu Avatar answered Dec 04 '22 13:12

Peter Lapisu