Title: QR Barcode Detection
1QR Barcode Detection
2Components in QR code readers
QR Code
Image Conversion
Photo
1010111011001111000110010101
Raw Data
QR Detector
QR Decoder
This is what we are focusing on
http//www.yahoo.com
3QR Properties (Basic)
Version Information
Position Patterns - Determines the correct
orientation
Position Patterns may be detected horizontally or
vertically by the unique B-W-B-B-B-W-B ratio
Data bit
Alignment Pattern - Used for perspective
transformations corrections
4QR Detection Algorithm
Proceeds by horizontally column scanning the raw
image pixels (or vertically row scanning) to
locate the 3 position patterns identified by the
1-1-3-1-1 ratio
After a potential position pattern is located, it
is then cross-checked in the other direction
for the same ratio and position pattern size Also
determines the center of the position pattern
5Triangle Point Ordering
Remember Pythagoras' theorem?
B
Points A and C may be in the wrong order so
we can use the cross product to determine the
angle between point B and the line segment AC
C
The points at either end of the hypotenuse are
points A and C
A
6Perspective Corrections
Simply maps points on a known square to points on
the distorted, rotated or skewed square
7Perspective Correction Algorithm
- for (long i 0 i lt dimension i) // y-axis
direction -
- for (long j 0 j lt dimension j) // x-axis
direction -
- // The QR code is read as if it were an
un-rotated and un-skewed image - POINT pt
- pt.x (j module_size)
half_module_size - pt.y (i module_size)
half_module_size - POINT p transform.TransformPoint(pt) //
Does the perspective correcting -
- qr_store.set(pt, image.IS_BLACK(p))
-
8Perspective Corrections
and rotation corrections for free (with no use of
expensive trigonometry functions)
size bit size x dimension
2
1
Only version gt 1 has the alignment pattern
size bit size x dimension
4
3
This is why locating 4 points is so important
9Results
- lt 1000 Source Lines of Code (SLOC)
- Almost no floating-point code
- Working to make it none
- Very quick
10Results
11Future Work
- Image filtering and cleaning
- Histogram analysis
- Colour to greyscale to monochrome
- QR decoding
- Extracting the contents (Message, URI etc)
- ReedSolomon error correction
- Level L
- Level M
- Level Q
- Level H