Maths and Computing:

menu
Home
Mathematics
Binary
Computing
Coding
Books

Mask Anaysis of Version 1 QR Code

Mask Anaysis of Version 1 QR Code: Data Entry

Mask Pattern 0


(row + col) % 2 == 0



=>

Penalty Points 1: 181

Penalty Points 2: 111

Penalty Points 3: 80

Penalty Points 4: 0

Total: 372


Penalty Calculation 1: Runs of same colour pixels



Each run of 5 or more pixels of the same colour has a penalty of 3 points plus 1 for each additional pixel

12 runs of white horizontal blocks

 

9 additional blocks

Penalty: 12 × 3 + 9 = 45


8 runs of black horizontal blocks

 

16 additional blocks

Penalty: 8 × 3 + 16 = 40




13 runs of white vertical blocks

 

20 additional blocks

Penalty: 13 × 3 + 20 = 59


8 runs of black vertical blocks

 

13 additional blocks

Penalty: 8 × 3 + 13 = 37


Total penalty points: 181

Penalty Calculation 2: Blocks of the same colour



Each 2 by 2 block of the same colour has a penalty of 3 points>

16 white 2 by 2 blocks

 

Penalty: 16 × 3 = 48


21 black 2 by 2 blocks

 

Penalty: 21 × 3 = 63


Total penalty points: 37 × 3 = 111

Penalty Calculation 3: Runs matching 10111010000




Each run matching the following has a penalty of 40 points



0 horizontal matching runs

2 vertical matching runs


Total penalty points: 80

Penalty Calculation 4



Penalty calculated from the percentage of black pixels. 10 penality points for each multiple of 5% from 50%

215 white pixels

226 black pixels


Percentage black pixels: (226 × 100) ÷ (21 × 21) = 51%

(51 − 50) ÷ 5) = 0

penalty = 0 * 10 = 0

Total penalty points: 0

Mask Pattern 1


row % 2 == 0



=>

Penalty Points 1: 197

Penalty Points 2: 144

Penalty Points 3: 160

Penalty Points 4: 0

Total: 501


Penalty Calculation 1: Runs of same colour pixels



Each run of 5 or more pixels of the same colour has a penalty of 3 points plus 1 for each additional pixel

11 runs of white horizontal blocks

 

11 additional blocks

Penalty: 11 × 3 + 11 = 44


9 runs of black horizontal blocks

 

28 additional blocks

Penalty: 9 × 3 + 28 = 55




11 runs of white vertical blocks

 

13 additional blocks

Penalty: 11 × 3 + 13 = 46


10 runs of black vertical blocks

 

22 additional blocks

Penalty: 10 × 3 + 22 = 52


Total penalty points: 197

Penalty Calculation 2: Blocks of the same colour



Each 2 by 2 block of the same colour has a penalty of 3 points>

14 white 2 by 2 blocks

 

Penalty: 14 × 3 = 42


34 black 2 by 2 blocks

 

Penalty: 34 × 3 = 102


Total penalty points: 48 × 3 = 144

Penalty Calculation 3: Runs matching 10111010000




Each run matching the following has a penalty of 40 points



3 horizontal matching runs

1 vertical matching runs


Total penalty points: 160

Penalty Calculation 4



Penalty calculated from the percentage of black pixels. 10 penality points for each multiple of 5% from 50%

203 white pixels

238 black pixels


Percentage black pixels: (238 × 100) ÷ (21 × 21) = 53%

(53 − 50) ÷ 5) = 0

penalty = 0 * 10 = 0

Total penalty points: 0

Mask Pattern 2


col % 3 == 0



=>

Penalty Points 1: 185

Penalty Points 2: 108

Penalty Points 3: 80

Penalty Points 4: 0

Total: 373


Penalty Calculation 1: Runs of same colour pixels



Each run of 5 or more pixels of the same colour has a penalty of 3 points plus 1 for each additional pixel

10 runs of white horizontal blocks

 

13 additional blocks

Penalty: 10 × 3 + 13 = 43


10 runs of black horizontal blocks

 

22 additional blocks

Penalty: 10 × 3 + 22 = 52




11 runs of white vertical blocks

 

9 additional blocks

Penalty: 11 × 3 + 9 = 42


12 runs of black vertical blocks

 

12 additional blocks

Penalty: 12 × 3 + 12 = 48


Total penalty points: 185

Penalty Calculation 2: Blocks of the same colour



Each 2 by 2 block of the same colour has a penalty of 3 points>

9 white 2 by 2 blocks

 

Penalty: 9 × 3 = 27


27 black 2 by 2 blocks

 

Penalty: 27 × 3 = 81


Total penalty points: 36 × 3 = 108

Penalty Calculation 3: Runs matching 10111010000




Each run matching the following has a penalty of 40 points



1 horizontal matching runs

1 vertical matching runs


Total penalty points: 80

Penalty Calculation 4



Penalty calculated from the percentage of black pixels. 10 penality points for each multiple of 5% from 50%

205 white pixels

236 black pixels


Percentage black pixels: (236 × 100) ÷ (21 × 21) = 53%

(53 − 50) ÷ 5) = 0

penalty = 0 * 10 = 0

Total penalty points: 0

Mask Pattern 3


(row + col) % 3 == 0



=>

Penalty Points 1: 174

Penalty Points 2: 123

Penalty Points 3: 0

Penalty Points 4: 0

Total: 297


Penalty Calculation 1: Runs of same colour pixels



Each run of 5 or more pixels of the same colour has a penalty of 3 points plus 1 for each additional pixel

11 runs of white horizontal blocks

 

12 additional blocks

Penalty: 11 × 3 + 12 = 45


9 runs of black horizontal blocks

 

22 additional blocks

Penalty: 9 × 3 + 22 = 49




9 runs of white vertical blocks

 

10 additional blocks

Penalty: 9 × 3 + 10 = 37


10 runs of black vertical blocks

 

13 additional blocks

Penalty: 10 × 3 + 13 = 43


Total penalty points: 174

Penalty Calculation 2: Blocks of the same colour



Each 2 by 2 block of the same colour has a penalty of 3 points>

11 white 2 by 2 blocks

 

Penalty: 11 × 3 = 33


30 black 2 by 2 blocks

 

Penalty: 30 × 3 = 90


Total penalty points: 41 × 3 = 123

Penalty Calculation 3: Runs matching 10111010000




Each run matching the following has a penalty of 40 points



0 horizontal matching runs

0 vertical matching runs


Total penalty points: 0

Penalty Calculation 4



Penalty calculated from the percentage of black pixels. 10 penality points for each multiple of 5% from 50%

207 white pixels

234 black pixels


Percentage black pixels: (234 × 100) ÷ (21 × 21) = 53%

(53 − 50) ÷ 5) = 0

penalty = 0 * 10 = 0

Total penalty points: 0

Mask Pattern 4


floor(row/2) + floor(col/3)) % 2 == 0



=>

Penalty Points 1: 198

Penalty Points 2: 135

Penalty Points 3: 160

Penalty Points 4: 0

Total: 493


Penalty Calculation 1: Runs of same colour pixels



Each run of 5 or more pixels of the same colour has a penalty of 3 points plus 1 for each additional pixel

16 runs of white horizontal blocks

 

14 additional blocks

Penalty: 16 × 3 + 14 = 62


8 runs of black horizontal blocks

 

13 additional blocks

Penalty: 8 × 3 + 13 = 37




11 runs of white vertical blocks

 

22 additional blocks

Penalty: 11 × 3 + 22 = 55


9 runs of black vertical blocks

 

17 additional blocks

Penalty: 9 × 3 + 17 = 44


Total penalty points: 198

Penalty Calculation 2: Blocks of the same colour



Each 2 by 2 block of the same colour has a penalty of 3 points>

22 white 2 by 2 blocks

 

Penalty: 22 × 3 = 66


23 black 2 by 2 blocks

 

Penalty: 23 × 3 = 69


Total penalty points: 45 × 3 = 135

Penalty Calculation 3: Runs matching 10111010000




Each run matching the following has a penalty of 40 points



2 horizontal matching runs

2 vertical matching runs


Total penalty points: 160

Penalty Calculation 4



Penalty calculated from the percentage of black pixels. 10 penality points for each multiple of 5% from 50%

215 white pixels

226 black pixels


Percentage black pixels: (226 × 100) ÷ (21 × 21) = 51%

(51 − 50) ÷ 5) = 0

penalty = 0 * 10 = 0

Total penalty points: 0

Mask Pattern 5


(row * col) % 2 + (row * col) % 3 == 0



=>

Penalty Points 1: 180

Penalty Points 2: 159

Penalty Points 3: 80

Penalty Points 4: 0

Total: 419


Penalty Calculation 1: Runs of same colour pixels



Each run of 5 or more pixels of the same colour has a penalty of 3 points plus 1 for each additional pixel

9 runs of white horizontal blocks

 

19 additional blocks

Penalty: 9 × 3 + 19 = 46


7 runs of black horizontal blocks

 

19 additional blocks

Penalty: 7 × 3 + 19 = 40




11 runs of white vertical blocks

 

15 additional blocks

Penalty: 11 × 3 + 15 = 48


11 runs of black vertical blocks

 

13 additional blocks

Penalty: 11 × 3 + 13 = 46


Total penalty points: 180

Penalty Calculation 2: Blocks of the same colour



Each 2 by 2 block of the same colour has a penalty of 3 points>

25 white 2 by 2 blocks

 

Penalty: 25 × 3 = 75


28 black 2 by 2 blocks

 

Penalty: 28 × 3 = 84


Total penalty points: 53 × 3 = 159

Penalty Calculation 3: Runs matching 10111010000




Each run matching the following has a penalty of 40 points



0 horizontal matching runs

2 vertical matching runs


Total penalty points: 80

Penalty Calculation 4



Penalty calculated from the percentage of black pixels. 10 penality points for each multiple of 5% from 50%

215 white pixels

226 black pixels


Percentage black pixels: (226 × 100) ÷ (21 × 21) = 51%

(51 − 50) ÷ 5) = 0

penalty = 0 * 10 = 0

Total penalty points: 0

Mask Pattern 6


((row * col) % 2 + (row * col) % 3) % 2 == 0



=>

Penalty Points 1: 191

Penalty Points 2: 156

Penalty Points 3: 80

Penalty Points 4: 0

Total: 427


Penalty Calculation 1: Runs of same colour pixels



Each run of 5 or more pixels of the same colour has a penalty of 3 points plus 1 for each additional pixel

12 runs of white horizontal blocks

 

15 additional blocks

Penalty: 12 × 3 + 15 = 51


10 runs of black horizontal blocks

 

23 additional blocks

Penalty: 10 × 3 + 23 = 53




11 runs of white vertical blocks

 

12 additional blocks

Penalty: 11 × 3 + 12 = 45


10 runs of black vertical blocks

 

12 additional blocks

Penalty: 10 × 3 + 12 = 42


Total penalty points: 191

Penalty Calculation 2: Blocks of the same colour



Each 2 by 2 block of the same colour has a penalty of 3 points>

22 white 2 by 2 blocks

 

Penalty: 22 × 3 = 66


30 black 2 by 2 blocks

 

Penalty: 30 × 3 = 90


Total penalty points: 52 × 3 = 156

Penalty Calculation 3: Runs matching 10111010000




Each run matching the following has a penalty of 40 points



1 horizontal matching runs

1 vertical matching runs


Total penalty points: 80

Penalty Calculation 4



Penalty calculated from the percentage of black pixels. 10 penality points for each multiple of 5% from 50%

211 white pixels

230 black pixels


Percentage black pixels: (230 × 100) ÷ (21 × 21) = 52%

(52 − 50) ÷ 5) = 0

penalty = 0 * 10 = 0

Total penalty points: 0

Mask Pattern 7


((row * col) % 3 + row + col) % 2 == 0



=>

Penalty Points 1: 168

Penalty Points 2: 90

Penalty Points 3: 120

Penalty Points 4: 0

Total: 378


Penalty Calculation 1: Runs of same colour pixels



Each run of 5 or more pixels of the same colour has a penalty of 3 points plus 1 for each additional pixel

12 runs of white horizontal blocks

 

11 additional blocks

Penalty: 12 × 3 + 11 = 47


9 runs of black horizontal blocks

 

14 additional blocks

Penalty: 9 × 3 + 14 = 41




11 runs of white vertical blocks

 

14 additional blocks

Penalty: 11 × 3 + 14 = 47


7 runs of black vertical blocks

 

12 additional blocks

Penalty: 7 × 3 + 12 = 33


Total penalty points: 168

Penalty Calculation 2: Blocks of the same colour



Each 2 by 2 block of the same colour has a penalty of 3 points>

12 white 2 by 2 blocks

 

Penalty: 12 × 3 = 36


18 black 2 by 2 blocks

 

Penalty: 18 × 3 = 54


Total penalty points: 30 × 3 = 90

Penalty Calculation 3: Runs matching 10111010000




Each run matching the following has a penalty of 40 points



0 horizontal matching runs

3 vertical matching runs


Total penalty points: 120

Penalty Calculation 4



Penalty calculated from the percentage of black pixels. 10 penality points for each multiple of 5% from 50%

217 white pixels

224 black pixels


Percentage black pixels: (224 × 100) ÷ (21 × 21) = 50%

(50 − 50) ÷ 5) = 0

penalty = 0 * 10 = 0

Total penalty points: 0

Mask Analysis Tool

The tool creates a version 1 QR code using a optimal mask with the minimum penalty code. The calculations showing the penalty calculation for each mask can be viewed.

Text:

Encoding:

Error Level:


3 is the best mask


Contents Copyright 2025 Andy Abraham
Please email comments to info@mathsandcomputing.co.uk