QR Code Demystify

QR Code Demystify



I decided to do a QR code just for the fun and learning how QR code algorithm works. QR Code usage is widespread in many countries (China and South Asia) . You can use it for almost anything such as doing a financial transaction, purchasing your fruits (or anything) , URL or sending a message. The scope of usage is up to our imagination.

This is my QR Code generator project over the weekend

https://bit.ly/2A6mlri

No alt text provided for this image



QR code (abbreviated from Quick Response code) is a two dimensional barcode or matrix barcode implemented by Masahiro Hara and his team (under Denso Wave) in 1994. In practice, QR codes often contain data for identifier or tracker that points to a website or application. A QR code uses four standardized encoding modes (numeric, alphanumeric, byte/binary and kanji and kanji) to store data efficiently; extensions may also be used.


QR Code Pictorial Information

No alt text provided for this image

The picture above shows the version 7. The algorithm is made up of two different stages.

The first stage is where the matrix gets transformed in limited shape to real or tridiagonal / Hessenberg form. This subsequent stage prepares the actual iterations of Hessenberg / Tridiagonal matrix. You can see from the above image that this resulted in alignment and cells.


Implementation

In most algorithm implementation , they go through this 4 general process

  1. Data Analysis - the QR standard has 4 modes of encoding text - numeric , alphanumeric , byte and Kanji. Each mode encodes the text as a string of bits. but each mode uses a different method for converting the text into bits and each encoding method is optimized to encode the data with shortest possible string of bits. The first step is the analyse which mode it is most optimal
  2. Data Encoding - After selecting the encoding mode, the next step is to encode the text into a string of bits that is split up into data codewords that are each 8 bits long
  3. Error Correction Coding - This process will use the string of data bits to generate error correction codewords using Reed-Solomon error correction. This is to ensure that the scanner can determine if the data is correct by comparing the data codewords and error correction codewords.
  4. Structure Final Message - The data and error correction codewords are arranged in proper order in blocks and those blocks must adhere to QR code specification
  5. Module Placement in Matrix - This step will place the order of step 4 into the QR code matrix in a specific way. The algorithm will place the patterns that are common in all QR codes such as the boxes in the three corners as dictate in the matrix specification.
  6. Data Masking - Some patterns in QR code matrix make it difficult to read the code, so the algorithm will determine which mask patterns result in the least undesirable traits by altering the QR code according to a particular pattern. The final matrix will be the one with the lowest penalty score
  7. Format and Version Information - This is optional but version information is added to QR code . The format pixels contain information such as versioning and mask pattern.


Amount of Data Capacity in QR code (Numeric / Alphanumeric / Binary)

No alt text provided for this image



Limitations

  1. The limitation for QR code is that the first stage create a fill-in sparse matrices which resulted in massive memory usage.
  2. It is for short string such as 2900 - 7000 characters depending on the mode. You cannot use it to send long message either.


Advantages

A two dimension (or 2D) barcode have several distinct advantages

  1. More information
  2. Fewer errors in barcode - no duplication of information to guard against a code being misprinted or damaged. It make built-in error checking systems faster.
  3. Easier to read - no special equipment needed. It can be read by in built camera such as mobile phones.
  4. It can be transmitted easily via sms
  5. More secure than traditional barcode. QR Code can be encrypted


Features of QR code

  • Capable of reading Chinese and Japanese encordings as fast as English characters
  • Able to read in any direction as they are 2D matrix
  • High data encoding capacity


If you want to implement it from scratch, you will first have to understand ISO/IEC 18004:2000(E) for encoding and decoding.


If you do not want to implement on your own, there are hundred of QR Code libraries. A search in node will comes out to more than 10 QR Code libraries. Similarly in other language , there should be QR Code libraries.

A quick search yield more than 30 QR code libraries

No alt text provided for this image


Hence you are spoilt for choices for QR Code libraries. Otherwise just do like what I do - for the fun and learning behind the algorithm.


References

Yarden : QR Code Algorithm (2014). https://blog.visualead.com/qr-code-algorithm/

Keng T. Tan, Hiroko Kato, Douglas Chai. Barcodes for Mobile Devices by Cambridge University Press (2010). A good, basic introduction to 2D barcodes.

QR-Code Tutorial by Tonkey . https://www.thonky.com/qr-code-tutorial/introduction

Taylor : QR Code Limitation . https://qrcode.meetheed.com/technical.html

Deso Wave . https://www.denso-wave.com/

Simon Hayes

Connecting business and technology

4 年

In a new world which is requires social distancing, this l has a role to play in reducing close person to person contact, alongside other technologies. Good job!

really interesting, thanks for sharing. We also use QR code for our solution to connect bars and restaurants menu and some specific table number through QR code :)

can u share that github to me. thanks ivan

回复

要查看或添加评论,请登录

Ivan T.的更多文章

  • Short hiatus (1 month) from social media and its impact

    Short hiatus (1 month) from social media and its impact

    I am a huge fan of LinkedIn, Instagram, TikTok, YouTube, Reddit, a few e-commerce sites and other popular platforms. I…

    15 条评论
  • Solution Focused - Not Knowing Position

    Solution Focused - Not Knowing Position

    Solution Focused Brief Therapy (SFBT) is a form of therapy that has gained popularity in recent decades. It is a brief…

    9 条评论
  • Text Counselling

    Text Counselling

    Why is counselling important for our mental health Counselling is important for mental wellness because it provides a…

    13 条评论
  • Loneliness

    Loneliness

    We feel lonely from time to time. The feelings of loneliness are personal, and everyone's experience will differ.

    9 条评论
  • Struggling over popular festive season (Lunar New Year)

    Struggling over popular festive season (Lunar New Year)

    Lunar New Year is this week. It is meant to be a time of joy with celebrations, red envelopes, gifts and qualify family…

    9 条评论
  • Passing data in React between Parent and Child in Functional Components

    Passing data in React between Parent and Child in Functional Components

    For beginners who started out in ReactJS, passing data between components may be confusing. I struggle this when I…

    6 条评论
  • Getting your React project ready for?Heroku

    Getting your React project ready for?Heroku

    If you are new to React JS and want to deploy to Heroku, these are few steps to ensure that you can deploy…

    3 条评论
  • Console Tricks

    Console Tricks

    Console is is a favourite feature for many web developers. If you have been using it, you know there are lots of tricks.

    12 条评论
  • Why And How We Should Learn To Say?No

    Why And How We Should Learn To Say?No

    Are you a people pleaser ? Do you find it difficult to say "No" or reject an invitation, task or someone's request ?…

    9 条评论
  • HTTP Status Code

    HTTP Status Code

    When we visit a (web) site, it usually send some request to the server. There will be a returned code to indicate the…

    24 条评论

社区洞察

其他会员也浏览了