How can I leverage ZXing's QR code finder logic if the pattern I'm looking for isn't a QR code?

76 views
Skip to first unread message

Wasabi Fan

unread,
Jan 17, 2017, 10:13:25 PM1/17/17
to zxing
I'm currently looking into the potential of leveraging ZXing's QR code detection logic for identifying the pose of a sheet of paper with QR code-like markings on it. My thinking is that I can use these finder markers so that I don't have to "re-invent the wheel" when identifying the sheet.

Currently, I'm placing three finder markers in the same orientation and relationship as they would be in a normal QR code. By forcing my way into the private ZXing interfaces (why they're private I can't say), I was able to get a test app written which properly identifies the three markers. The important bit of my code is here: https://gist.github.com/WasabiFan/6c51442c860fe7033910fba482265adc .

This works well, however only using three markers doesn't tell me the orientation of the target deterministically. "Skewing" transformations aren't represented by the three aligned icons. To get this motion, I need a fourth marker point which is offset from the others; after all, normal QR codes have alignment patterns which break from the square configuration of the other markers. This is the part that I am unsure of: what is the best way to implement this part? What combination of the finder marker, alignment pattern, and combined "Detector" logic might work for my case?

The main reason that I hesitate is that I don't have any reference for the intent of these classes. While the Detector class may work, is it expected to function given that the content between the markers isn't a valid binary grid of QR code data?

Thanks!

Lachezar Dobrev

unread,
Jan 18, 2017, 5:33:51 AM1/18/17
to Wasabi Fan, zxing
You might want to check the c.g.z.qrcode.detector package[1], and
probably get a really close look at the Detector[2] in that package
which performs detection of the finder patterns, alignment correctors,
and performs perspective correction.

[1] https://github.com/zxing/zxing/tree/master/core/src/main/java/com/google/zxing/qrcode/detector
[2] https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/qrcode/detector/Detector.java
> --
> You received this message because you are subscribed to the Google Groups "zxing" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to zxing+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Wasabi Fan

unread,
Jan 19, 2017, 1:27:06 AM1/19/17
to zxing, wasa...@outlook.com
I'm currently using the FinderPatternFinder class from that package and it's working well. However, it looks like the Detector at least has logic that depends on the contents of the tag: for example, it attempts to deduce a QR code version based on the dimensions of the code. The AlignmentPatternFinder might work, though; what does it expect as input? e.g., does it expect a perspective-transformed image, and what is the "module size"? What would I have to strip out of the Detector to make it do what I would need (not rely on a particular location of the alignment patterns, and not assume particular dimensions)?

In general, I think my problems could be solved if there's an easy way to do one of the following:
- Modify the FinderPatternFinder to add additional pattern markers
- Modify the Detector to not rely on the contents of the QR code
- Figure out how to call the AlignmentPatternFinder manually

Any guidance would be appreciated. I will probably have to dive in and just try things out, but it would be nice to get some suggestions!
Reply all
Reply to author
Forward
0 new messages