Apple Vision - Barcode Detection Doesn't Work for Barcodes with Different Colours

ARKit – Detect similar objects but with different colours

ML-algorithm of ARKit detects a pre-scanned objects (in .arobject container) in black-and-white scheme, not in RGB colour scheme. If you scan two absolutely similar volumetric objects but with a different colour scheme, there's no any guarantee ARKit will recognise each of them successfully.

Sample Image

Firebase Barcode Scanner for IOS

Your logic for a successful scan is a little off: you need to print the features after your guard

func scanBarcode(userImage: UIImage){
print("SCAN")
let format = VisionBarcodeFormat.all
let barcodeOptions = VisionBarcodeDetectorOptions(formats: format)
var vision = Vision.vision()
let barcodeDetector = vision.barcodeDetector(options: barcodeOptions)
let visionImage = VisionImage(image: userImage)
barcodeDetector.detect(in: visionImage) { features, error in
guard error == nil, let features = features, !features.isEmpty else {
print("unsuccessful scan, either there is an error, or features is empty")
return
}
print("successful scan")
print(features)
// ...
}
}


Related Topics



Leave a reply



Submit