Speed up detection of QRCode by known ImagePosition

89 views
Skip to first unread message

Peravene

unread,
Aug 5, 2015, 8:40:31 AM8/5/15
to zxing
Hello,

I am using zxing-cpp/zxing-core to find and decode a QRCode in an image. In my case the position of the QRCode is known. So i am able to provide only the image part which contains the qrcode (just cropping is done). The seen QRCode itself is seen from different viewing angle. (it has perspective distortion) When I call the zxing-decode-function with the cropped image it will decode the QRCode sucessfully. But if I preprocess a perspective transformation to the croppped image the detection fails.
I would say that having the information where the qrcode lies in the image should speed up the detection. But currenttly its not working as I want. Do you know where I can pass this information correctly?

With regards
Peravene

Bas Vijfwinkel

unread,
Aug 6, 2015, 8:21:49 AM8/6/15
to zxing
There are some requirements regarding the space around the qr code.
Cropping the image perfectly does indeed have a negative impact on the detection rate.

The exact details are in Detector.cpp :
Ref<DetectorResult> Detector::detect(DecodeHints const& hints)
You could try to figure out what the sweet spots are.
Another simple trick is just to make a series of images with the same barcode and increase the whitespace around the barcode gradually.

Besides adding an appropriate whitespace, playing with the size of the image can also speed up the detection rate. High res images tend to take much more time to process than just a 800x600 image .
Bottomline is that if you can see the barcode clearly, Zxing will also probably be able to detect it. Adding more pixels only slows down the detection rate.

The method 'detect' returns the position of the 3 corner markers of the QRcode.
If you can exactly pinpoint those yourself then you could skip the whole detection stuff, but if the error margin is too high then again you might get poor recognition rates...

Sean Owen

unread,
Aug 7, 2015, 4:26:06 AM8/7/15
to zxing
That's fine -- if you're operating in Java then you just crop the BufferedImage first, or pass the crop bounds to the BufferedImageLuminanceSource constructor.
I don't know what you mean about preprocessing the perspective transform -- you're just trying to do that work yourself ? that's fine, and no reason that should hurt unless the process was wrong or distorted the image
Reply all
Reply to author
Forward
0 new messages