Вы находитесь на странице: 1из 11

QR Barcode Detection

Machine Vision
Components in QR code readers

QR Code
Image
Photo Conversion

Raw Data
1010111
0110011
1100011
QR Detector 0010101

This is what we QR Decoder


are focusing on

http://www.yahoo.com
QR Properties (Basic)

Version Information
Position Patterns
- Determines the
correct orientation

Position Patterns may be


Data bit
detected horizontally or
vertically by the unique
B-W-B-B-B-W-B ratio

Alignment Pattern
- Used for perspective
transformations
corrections
QR 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
Triangle Point Ordering
Remember Pythagoras' theorem?

B +
Points „A‟ and „C‟ may
+
be in the wrong order
C
so we can use the
cross product to
determine the angle
between point B and
The points at either the line segment AC
end of the hypotenuse +
are points „A‟ and „C‟ A
Perspective Corrections
Simply maps points on a known square to points on the distorted, rotated or
skewed square
Perspective Correction Algorithm
for (long i = 0; i < dimension; ++i) // y-axis direction
{
for (long j = 0; j < 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));
}
}
Perspective Corrections
and rotation corrections for free (with no use of expensive trigonometry functions)

size = “bit size” x dimension

+ +
size = “bit size” x dimension

2
1

Only
version > 1
has the
alignment
4 pattern
+
+
3

This is why locating 4


points is so important
Results
• < 1000 Source Lines of Code (SLOC)
• Almost no floating-point code
– Working to make it none
• Very quick
Results
Future Work
• Image filtering and cleaning
– Histogram analysis
– Colour to greyscale to monochrome
• QR decoding
– Extracting the contents (Message, URI etc…)
• Reed–Solomon error correction
– Level L
– Level M
– Level Q
– Level H

Вам также может понравиться