0

I am trying to detect and decode barcodes from a library of images. In most cases pyzbar simply works (see code here).

However, in some cases, my iPhone can decode the QR code but zbar fails. As I am on a mac, I can make use of the same Vision framework that the iPhone uses and there are even python wrappers to the macOS ObjC frameworks.

I tried using Quartz.CGImageSourceCreateWithURL but that returns a None no matter what I pass it.

def read_image(path):
    imageSrc = Quartz.CGImageSourceCreateWithURL(path, None)
    image = Quartz.CGImageSourceCreateImageAtIndex(imageSrc, 0, None)
    return imageSrc, image

print(read_image(path))

Out: (None, None)

I have tried relative and absolute paths, I've tried internet URLs. Nothing.

Can someone help me get started with this?

Shahar
  • 886
  • 1
  • 10
  • 22
  • I've never used the vision library just the google mlkit a bit. I don't have time to do a deep dive into the issue till at earliest next weekend (two labs to mark one to run tomorrow and a whole slew of other stuff on top of it.) Personally I'd make some simple test programs in Objective C and see if the approach you're taking works there and if not if using Objective C directly provides you more info for debugging, at the least you aught to be able to step inside the api and see what's happening in assembly code. – David Oldford Dec 04 '20 at 01:17
  • sorry forgot about this one, did you ever get this working? – David Oldford Jan 27 '21 at 03:22

0 Answers0