[quote=154896:@Jason King]Here is an implementation using CoreImage. From what I was reading, it will only function on a physical device and my tests indicate the same since a CIDetector cannot be created in the simulator. If someone can test it and let me know if it works since I don’t yet have an iOS license that would be great. https://www.dropbox.com/s/nnpb8gphiq2c7bk/QRReader.zip?dl=0
Yeah I agree, I expected it to use the iSight camera but it doesn’t. Maybe an oversight by Apple, or maybe there is something which prevents it from working. We will probably never know.
I just combined the camera project and QR Reader from Jason King into one project I called QRCamera. It allows to take a picture of a QR code, then read the content of it.
Hi, The QRCode Reader works great, but I see from docs you can only use TypeQRCode or TypeRectangle. Would reading Code3of9 be completely different or even possible?
Yes, reading Code 3of9 would be completely different and is currently not possible with declares. It would require the use of several AVFoundation classes which cannot be used in Xojo because Xojo uses a cooperative threading model and the callbacks from AVFoundation are invoked on unmanaged threads which leads to exceptions in Xojo. You would have to implement reading Code3of9 in code yourself Maybe using TypeRectangle will allow you to identify the barcode and you could then extract the image to process?
If you use the camera to get the picture of the barcode, then you can analyse it by fetching the black or white pixels from left to right. The start character will provide the synchronization data (the width or an elementary bar in pixels), then you can analyze the whole picture.
I would suggest starting with an impeccable representation such as what you can find at images.google.com, and when your deciphering code is done, test with camera pictures. Since the camera pictures can be blurry or lack contrast, you will probably need to check the coherence of the extracted data.
I have never done it that way, but I designed bar code fonts, and code 39 is one of the simplest ones.
Thanks very much Michel. I was doing some investigation on it after Jason’s reply - I knew it must be manageable since it’s possible to print 3 of 9 from a font. Your suggestions and links will help a lot.
@Chris O’Brien the new version of iOSKit (v1.2) has the classes necessary for reading Code 3 of 9 codes. There is a demo view which shows you how to use them. The values of metadataObjectTypes which can be used are all strings and you just have to specify the proper key(s) to read the barcodes:
"org.gs1.UPC-E",
"org.iso.Code39",
"org.iso.Code39Mod43",
"org.gs1.EAN-13",
"org.gs1.EAN-8",
"com.intermec.Code93",
"org.iso.Code128",
"org.iso.PDF417",
"org.iso.QRCode",
"org.iso.Aztec"
If you have any questions please ask.
Thanks for sharing.
I was trying to modify your code to make the final code more like a single class you can drop in a view, to make it accessible from within whatever view it was dragged in.
The PresentInView method wants to have the view set passed though. Something I can’t really figure out yet.
Any ideas?
Hi Edwin, that class has been updated in iOSKit. Please download the latest version there which also includes an example view of how to pass the view to the camera object.
Thanks Jason! I am trying to figure out how to drag the components in my project. I guess just slapping everything in a folder will be a neat solution?
By the way: Is there a change that CoreLocation will be added? (to use GPS etc)