Barcodes are used to store simple information through the application of optical phenomena, such as light absorption and reflection.
It was invented in 1952 and today it is widely used to catalog products and store various information. It can be presented in one- dimensional (traditional barcode) and two- dimensional (popularly known as QR-code ) formats.
The simplest reading of one- dimensional barcodes is done like this:
- A red light is directed at the printed region;
- Dark stripes absorb incident light, and white stripes reflect that light;
- A small light sensor (called a photosensor) attached to the reader collects information from the reflected light and then transforms it into a sequence of digits 0 and 1 according to the thickness of each stripe.
The colors and thickness of the stripes define the sequence of digits
Don’t stop now… There’s more after the publicity 😉
|Very Fine – 0||Very Fine – 1|
|Fine – 00||Fine – 11|
|Coarse – 000||Coarse – 111|
|Very Thick – 0000||Very Thick – 1111|
Title: Encoding used in one-dimensional barcodes
The intention of transforming the information about the color and thickness of the stripes into numbers 0 and 1 is to produce a binary code, the language used by computers.
Suppose that the reading of a barcode resulted in the following sequence:
After reading, the computer almost instantly converts this binary code to our decimal system through the following calculation:
1×2 5 + 0x2 4 + 1×2 3 + 0x2 2 + 1×2 1 + 1×2 0 = 1×32 + 0 + 8 + 0 + 2 + 1 = 43
After this process, it is possible to inform a computer database that the number 43, for example, refers to a certain product or information, saving a good amount of time.