Re: iOS: Scanning QR codes from an image

450 views
Skip to first unread message

Steven Parkes

unread,
Aug 24, 2012, 1:46:50 AM8/24/12
to Martin Jansen, zx...@googlegroups.com
On Aug 23, 2012, at 10:17 PM, Martin Jansen <martin...@gmail.com> wrote:

> My attempt to just pass the whole UIImage to ZXing for decoding failed with no codes being found at all.

In general, this should work fine, though any particular image may not decode for various reasons. If you can't get this to work for a clean, large, well focused image, than there may be something wrong in the process of running ZXing against your UIImage.

Timo

unread,
Aug 25, 2012, 12:25:52 AM8/25/12
to zx...@googlegroups.com
> My attempt to just pass the whole UIImage to ZXing for decoding failed with no codes being found at all.

Hi Martin - I'm not working on iOS (yet) but I did just get the zxing lib to parse an image with two QR codes using QRCodeMultiReader in Java successfully. 

There is an entire folder of test images in the src. It may be worth trying one of those known good test images with your code to see if a works at all. You might also check out QRCodeMultiReader because it seems to be focused on finding QR codes, nothing else. 

-Tim

Martin Jansen

unread,
Aug 31, 2012, 3:36:41 AM8/31/12
to zx...@googlegroups.com, Martin Jansen
Sorry for getting back to you with so much delay. Actually the code for decoding the image is quite simple:

Decoder* decoder = [[Decoder alloc] init];
decoder.delegate = self;
decoder.readers = self.readers;
[decoder decodeImage:image];

The "image" variable is of type UIImage* and comes straight from the device camera. I suspect the problem is mostly related to the fact that the QR code is only a very small part of the image and that ZXing has a hard time finding it in there.

- Martin

Steven Parkes

unread,
Aug 31, 2012, 11:03:19 AM8/31/12
to Martin Jansen, zx...@googlegroups.com
On Aug 31, 2012, at 12:36 AM, Martin Jansen <martin...@gmail.com> wrote:

> I suspect the problem is mostly related to the fact that the QR code is only a very small part of the image and that ZXing has a hard time finding it in there.

Seems likely. ZXing certainly can't decode every image. You could post the image somewhere and we could double check but it might not be worth the effort ...
Reply all
Reply to author
Forward
0 new messages