Designing a QR code Encoder

QR codes are everywhere, and becoming more popular as a paper - encoded textual transmission medium.  They require little knowledge of use.  In order to satisfy a little curiosity I intend to make an encoder.

Day 1 - First find the Specs.


http://raidenii.net/files/datasheets/misc/qr_code.pdf

On first reading I am going to ignore sections 7.1a 3 and 4. i am going to focus on numbers, and alphanumeric text only.  The reason for this is i dont for see using kanji, or binary.  This is more a test to check my own skills.

Point to note - 7.1b -  1 is dark, 0 is light.

The size of a QR code is between 21x 21 (ver 1) to 177 x 177 (ver 40), increasing in units of 4 units per side.

There are 4 levels of error correction:
L - 7%
M - 15%
Q - 25%
H - 30%
Percentages refer to recoverability of symbol codewords. - (presumably L means low, and H high)

Image - Reference ISO / IEC 18004 


Set up a repository

The code repository for this project will be at; https://github.com/grimley517/QREncoder

Step 1 - the base layer

The base layer of the QR code will be a square matrix with a side of 21+4(v-1) where v is the version number. This can be modelled using a two dimensional list.  I will use 1 for dark areas, 0 for white areas, and x for areas yet to be determined.

First substep - creating an object

First test - to check that we can make the object.
This test was solved by the following;

All this does is to create an object and set its text representation to the message to be held within the code.

At this stage I'm a little concerned that defining the size may be a poor idea, the size should be a function of the message.

Comments

Popular Posts