QRCode in actual scene is not well supported in zxing .

72 views
Skip to first unread message

Su Qiyang

unread,
Oct 9, 2015, 6:33:13 AM10/9/15
to zxing
hi, everyone:
It seems the perspective transform does not work once the alignmentPattern can not be well estimated. Actually , the perspective transform need 4 points .

Attached is two samples ,A1.png is a qrcode which version = 0 , and A2.png is a qrcode version=5.
both of them is hard to be detected.

zxing's algorithm is like this :
step0: search 3 finderPatterns .
step1: assume that the 3finderPattern and the AlignmentPattern are 4 corners of a parallelogram , then estimate a (X,Y) of the AlignmenPattern .
step2: use (X,Y) as thef startPoint of the alignmentPatternFinder.
step3. for each scale , search a alignmentpattern ,once got a result , stop the finder.

In actual scene, the image from camera always with angulation (like A2.png,A3.png) or even without a alignmentPattern (version =0 , like A1.png).
So ,
to step1&step2 , for some case , 3finderPattern and 1AlignmentPattern is not a parallelogram (maybe a trapezoid).for A2.png and A3.png , the algorithm estimates a bad startPoint .
to step3 : once we got a bad startPoint , we maybe detect a wrong AlignmentPattern before the right one , then we stop (since step3, we just got one shoot --- the first result ).
for example ,A2.png ,i used a zxing android app to see the four patterns the app draw on the frame , there are two wrong alignmentPatterns always been detected , because the bad result from step2.

so i think there maybe something to do to improve the detector in step1 or step3. for example ,i accept more result in step3, the detector performs better with about 20% more time cost.

i am working on the QRCode reader for actual scene, who gots good ideas?

A2.png
A1.png
A3.png

Sean Owen

unread,
Oct 9, 2015, 9:58:39 AM10/9/15
to zxing
I'm not sure I understand. The heuristic works well, as you can observe, even with significant perspective distortion. Not every image decodes; these images have other issues I believe (warping, not all black pixels are dark). The heuristic also won't work in all cases of course. But, what are you proposing? 

Su Qiyang

unread,
Oct 9, 2015, 10:17:58 PM10/9/15
to zxing
On Friday, October 9, 2015 at 9:58:39 PM UTC+8, Sean Owen wrote:
> I'm not sure I understand. The heuristic works well, as you can observe, even with significant perspective distortion. Not every image decodes; these images have other issues I believe (warping, not all black pixels are dark). The heuristic also won't work in all cases of course. But, what are you proposing? 

sorry for the poor presentation .and I'm very happy you can reply my question . my proposing is ,i wonder is there a good ways to decode the qrcodes above easily.
like A2.png , it is a qrcode print on paper ,the paper is a bit warped , zxing will easily detect a wrong "alignmentpattern" before the right one ,so we never get the right one(see the attached file). this is because a bad estimated start cell (estimate according t 3finder patterns ).
and for qrcode without a alignmentpattern ,the scanner works not good with in slight perspectinve distortion.

A2-.png

Sean Owen

unread,
Oct 10, 2015, 7:54:38 AM10/10/15
to zxing
Yes, the trick is detecting the alignment pattern, without knowing ahead of time where it is. And doing it quickly. Remember that it's bad to spend a long time looking as well, since in the camera phone use case (which is the primary use case) you have another image coming up in milliseconds. That is, I don't think there is in general a problem to solve here when scanning real QR codes, and I do not agree there is a problem in detecting alignment patterns. I'm open to suggestions but what are you suggesting? open a PR if you have something specific.
Reply all
Reply to author
Forward
0 new messages