Eli5: How do QR codes work? How does little black lines in a square hold data?

251 views

Eli5: How do QR codes work? How does little black lines in a square hold data?

In: 0

6 Answers

Anonymous 0 Comments

The outer three squares of a QR code is used to locate the existence of a code through a digital camera. Once the corners have been identified, it can use the expected size information to de-skew it. This takes the original photo’s QR code and stretches it into a square – so it looks like you are reading the QR code face-on. The corners are used to indicate how big each square is, what subtype of QR code it is, how it should read, and how much data there is to read.

Computer Vision is responsible for determining whether each square is on, or off. It does this by isolating each square and then iterating over each of the pixels on the image for that square. Using the average colour of all pixels in the square, we can determine if a square is black or white.

What we end up with in the end is a sequence of binary bits. Rather than just being binary string of the URL that is to be opened, it actually a sequence of patterns that fit the purpose of the QR code type. For a website, you have shortcuts for “https://”, “.com”, etc.

There are many kinds of QR codes. The basic QR code opens a website; modern QR codes are capable of opening applications, initiating phone calls, sending SMS, or simply just storing serial numbers on a washing machine. You can also customise some QR codes to show images like logos, or use different colours.

You are viewing 1 out of 6 answers, click here to view all answers.