swiftimagedecodingaztec-barcode

Aztec code detecting from image not working in swift


I have a problem with detecting Aztec code on images. Firstly I tried with QR code and it works without problems, I'm converting an UIImage to CIImage and then detecting features. With QR code it detects everything normal, but with Aztec code, it doesn't work at all, in apple documentation, it says that it should read all 2D Barcodes.

Here is my code:

func detectData(ciImage: CIImage) -> String {
       let detector: CIDetector=CIDetector(ofType: CIDetectorTypeQRCode, context: nil, options: [CIDetectorAccuracy: CIDetectorAccuracyHigh])!

       var qrCodeLink=""

       let features=detector.features(in: ciImage)

       for feature in features as! [CIQRCodeFeature] {
           qrCodeLink += feature.messageString!
       }

       if qrCodeLink=="" {
           return "nothing"
       } else {
          return "message: \(qrCodeLink)"
       }
   }

Solution

  • I would say, it's not possible to detect an aztec code using the built in software framework. In the linked docs it says "A QR code is a two-dimensional barcode using the ISO/IEC 18004:2006 standard.", however wikipedia states "The aztec code is also published as ISO/IEC 24778:2008 standard". So I would guess it just isn't supported (yet).