Minimization of bit stream length of QR codes
- Vol. 27, Issue 8, Pages: 2356-2367(2022)
Published: 16 August 2022 ,
Accepted: 02 July 2021
DOI: 10.11834/jig.210092
移动端阅览
浏览全部资源
扫码关注微信
Published: 16 August 2022 ,
Accepted: 02 July 2021
移动端阅览
Tailing Yuan, Kun Xu. Minimization of bit stream length of QR codes. [J]. Journal of Image and Graphics 27(8):2356-2367(2022)
目的
2
快速响应矩阵码(quick response code,QR code)简称二维码,是一种由深色和浅色模块组成的正方形符号。给定输入数据,不同编码算法可能输出不同的位流。位流长度决定了二维码的版本,进而决定了二维码每条边上的模块数量。减小二维码的版本能够在不减小模块大小的前提下节省面积,或者在不改变面积的前提下增大模块大小。为了减小二维码面积、提高二维码识读率,本文提出了位流长度最小化算法。
方法
2
首先,根据二维码位流可以分段切换编码模式的特点,归纳了6种编码状态;然后,根据二维码位流编码标准推导了状态转移关系,从而将位流长度最小化问题转换成动态规划问题;最后,通过求解动态规划问题,计算出最短位流。针对统一资源定位符(uniform resource locator,URL)类型数据,利用其部分字段对大小写不敏感、部分字段可以转义的性质,提出了统一资源定位符的最短位流计算算法,进一步缩短位流。
结果
2
本文构建了一个测试集,包含603个编码了非URL数据的二维码,以及1 679个编码了URL数据的二维码。实验结果表明,本文算法与二维码标准相比,对于非URL测试集,位流长度减小的二维码占比9.1%,版本减小的二维码占比1.2%;对于URL测试集,位流长度减小的二维码占比98.4%,版本减小的二维码占比31.7%。
结论
2
二维码位流长度最小化算法输出的位流长度最短,输出的二维码版本最小,能在兼容标准二维码解码器且不影响纠错能力的前提下提升二维码的数据容量。同时,本文算法运行速度快,易于使用,没有需要调节的参数。
Objective
2
Quick response code (QR code) is a kind of widely used 2D barcode nowadays. A QR code is a square symbol consisting of dark and light modules. There is a great need to accommodate more data in the target area or encode the same input data in a smaller area. The input data is first encoded into a bit stream. Different encoding algorithms may output different bit streams via assigned input data. The length of bit stream determines the version of a QR code
and the version determines the amount of modules per side. A QR code with a smaller version takes a smaller area without the size of modules changing
or has a larger module size without changing the area. The bit stream consists of one or multiple segments
and the encoding mode of each segment is chosen from three modes separately
i.e.
numeric mode
alphanumeric mode and byte mode. The numeric mode can only encode digits
and every 3 digits are encoded into 10 bits. The alphanumeric mode can encode digits
upper case letters
and 9 kinds of punctuations
and every 2 characters are encoded into 11 bits. The byte mode can encode any kind of binary data
but each byte is encoded into 8 bits. Compared to using a single mode to encode the overall input data
different modes interchange may result in a shorter bit stream. But different modes switching leads to redundancy on bit stream length.
Method
2
The key to minimizing the version of QR code is to minimize the length of bit stream. The minimization should balance the redundancy of data encoding and the mode switching efficiency. The QR code specification gives "optimization of bit stream length" in annex. However
the illustration has proposed that the optimization method may not output the minimum bit stream. The demonstration has mentioned algorithms as below. The first algorithm is called "minimization algorithm"
which converts the minimization of bit stream length to a dynamic programming problem. The algorithm can output the bit stream with minimum length by resolving the dynamic programming problem. Time cost is bounded in a linear function to the length of input data. The second algorithm is called "URL minimization algorithm"
which is optimized for cases that the input data is a uniform resource locator (URL) further. The customized optimization for URL makes use of two properties: 1) the scheme field and the host field of a URL are case-insensitive
and 2) the scheme-specific part of a URL can be escaped. The properties have been guaranteed via request for comments (RFC) 1 738 and RFC 1 035. A lower case letter can only be encoded in byte mode. By converting a lower case letter in a case-insensitive field to an upper case letter
the letter can be encoded in either byte mode or alphanumeric mode. The property provides more options in dynamic programming. In addition
each character in the scheme-specific part of a URL may be converted to an escape sequence. The escape sequence contains 3 alphanumeric mode characters. Hence
it can be encoded in alphanumeric mode or a combination of alphanumeric mode and numeric mode. This kind of conversion also provides more choices in dynamic programming. The URL minimization algorithm takes advantage of such two kinds of conversions to calculate the bit stream of a URL with minimum length.
Result
2
A QR code data set (also called a test set) is constructed to verify the efficiency of the proposed algorithms. The test set is collected from 6 web image search engines
i.e.
Baidu
Sogou
360
Bing
and Yahoo. QR codes with different bit streams or different error correction levels are regarded as different QR codes. The test set contains 2 282 distinct QR codes
where 603 QR codes encode non-URL data and the other 1 679 QR codes encode URL data. Four algorithms are compared on the test set
i.e.
1) the optimization method given in the QR code specification
2) encoding input data in a single segment
3) the minimization algorithm
and 4) the URL minimization algorithm. The bit stream lengths of initial QR codes are offered for comparison as well. The demonstrations show that for the non-URL test set
average bit stream length reduces 0.4% (compared to the optimization in the QR code specification)
QR codes with reduced bit stream lengths account for 9.1%
and QR codes with reduced versions account for 1.2%; for the URL test set
average bit stream length reduces 13.9%
QR codes with reduced bit stream lengths account for 98.4%
and QR codes with reduced versions account for 31.7%. An ablation study on the two components of URL minimization has been implemented
i.e.
1) utilizing case-insensitive fields and 2) converting characters to escaping sequences. The calculating results have shown that each component has an effect and combining both components achieves the best performance
i.e.
the minimum bit stream length and the minimum version. In the context of URL test set
average bit stream length reduces only 0.5% using the minimization algorithm
while the value reduces 9.1% using the URL minimization algorithm; QR codes with reduced bit stream lengths account for 10.4% using the minimization algorithm
but the value is 98.4% for the URL minimization algorithm; QR codes with reduced versions account for 1.3% using the minimization algorithm
while the value is 31.7% for the URL minimization algorithm. The average time cost to encode a message is 2.45 microsecond.
Conclusion
2
The proposed algorithms minimize the length of bit stream. Data capacity of QR codes has been increased without changing QR code format or revising the error correction capability. The URL minimization algorithm is qualified under the huge amounts of QR codes based on URL encoded data. The proposed algorithms are friendly-used
i.e.
there are no hyper-parameters to be tuned
and users input data and error correction level only. The illustrated algorithms have been verified in a realistic running speed
and it is proved that the time costs of both algorithms are bounded in a linear function to the length of input data.
二维码快速响应矩阵码二维码编码动态规划统一资源定位符(URL)
2D codequick response code (QR code)QR code encodingdynamic programminguniform resource locators (URL)
Abas A, Yusof Y and Ahmad F K. 2017. Expanding the data capacity of QR codes using multiple compression algorithms and base64 encode/decode. Journal of Telecommunication, Electronic and Computer Engineering, 9(2-2): 41-47
Abdolahi M, Jiang H and Kaminska B. 2019. Structural colour QR codes for multichannel information storage with enhanced optical security and life expectancy. Nanotechnology, 30(40): #405301[DOI: 10.1088/1361-6528/ab2d3b]
Barron I, Yeh H J, Dinesh K and Sharma G. 2020. Dual modulated QR codes for proximal privacy and security. IEEE Transactions on Image Processing, 30: 657-669[DOI: 10.1109/TIP.2020.3037524]
Blasinski H, Bulan O and Sharma G. 2013. Per-colorant-channel color barcodes for mobile applications: an interference cancellation framework. IEEE Transactions on Image Processing, 22(4): 1498-1511[DOI: 10.1109/TIP.2012.2233483]
Chen C S, Huang W J, Zhou B J, Liu C C and Mow W H. 2016. PiCode: a new picture-embedding 2D barcode. IEEE Transactions on Image Processing, 25(8): 3444-3458[DOI: 10.1109/TIP.2016.2573592]
Chen C S, Zhou B J and Mow W H. 2018. RA code: a robust and aesthetic code for resolution-constrained applications. IEEE Transactions on Circuits and Systems for Video Technology, 28(11): 3300-3312[DOI: 10.1109/TCSVT.2017.2741472]
Chen Y Z, Deng Y, Shi S L and Jiang W Y. 2015. Generation and recognition method of colorized QR codes based on Gzip compression algorithm. Application of Electronic Technique, 41(12): 116-119, 128
陈元枝, 邓艳, 史绍亮, 姜文英. 2015. 基于Gzip压缩算法的彩色QR码生成与识别方法. 电子技术应用, 41(12): 116-119, 128[DOI: 10.16157/j.issn.0258-7998.2015.12.031]
Chou G J and Wang R Z. 2020. The nested QR code. IEEE Signal Processing Letters, 27: 1230-1234[DOI: 10.1109/LSP.2020.3006375]
Galiyawala H J and Pandya K H. 2014. To increase data capacity of QR code using multiplexing with color coding: an example of embedding speech signal in QR code//Proceedings of 2014 Annual IEEE India Conference. Pune, India: IEEE: 1-6[DOI: 10.1109/INDICON.2014.7030441http://dx.doi.org/10.1109/INDICON.2014.7030441]
Jia D, You F, Zhang Q L and Zeng Z G. 2017. Color QR code recognition based on$$ k$$-means algorithm. Packaging Journal, 9(5): 62-68
贾丹, 尤飞, 张庆立, 曾志高. 2017. 基于$$ k$$-means算法的彩色QR码识别. 包装学报, 9(5): 62-68[DOI: 10.3969/j.issn.1674-7100.2017.05.010]
Liu Y and Liu M Y. 2005. Research on data encoding of two-dimensional QR code barcode. Transactions of Beijing Institute of Technology, 25(4): 352-355
刘悦, 刘明业. 2005. QR code二维条码数据编码的研究. 北京理工大学学报, 25(4):352-355[DOI: 10.3969/j.issn.1001-0645.2005.04.017]
Melgar M E V, Zaghetto A, Macchiavello B and Nascimento A C A. 2012. CQR codes: colored quick-response codes//Proceedings of 2012 IEEE Second International Conference on Consumer Electronics. Berlin, Germany: IEEE: 321-325[DOI: 10.1109/ICCE-Berlin.2012.6336526http://dx.doi.org/10.1109/ICCE-Berlin.2012.6336526]
Meruga J M, Fountain C, Kellar J, Crawford G, Baride A, May P S, Cross W and Hoover R. 2015. Multi-layered covert QR codes for increased capacity and security. International Journal of Computers and Applications, 37(1): 17-27[DOI: 10.1080/1206212X.2015.1061254]
The State Bureau of Quality and Technical Supervision. 2000. GB/T 18284-2000 QR code. Beijing: Standards Press of China: 1-67
国家质量技术监督局. 2000. GB/T 18284-2000快速响应矩阵码. 北京: 中国标准出版社: 1-67
Tkachenko I, Puech W, Destruel C, Strauss O, Gaudin J M and Guichard C. 2016. Two-level QR code for private message sharing and document authentication. IEEE Transactions on Information Forensics and Security, 11(3): 571-583[DOI: 10.1109/TIFS.2015.2506546]
Tkachenko I, Puech W, Strauss O, Destruel C, Gaudin J M and Guichard C. 2015. Rich QR code for multimedia management applications//Proceedings of the 18th International Conference on Image Analysis and Processing. Genoa, Italy: Springer: 383-393[DOI: 10.1007/978-3-319-23234-8_36http://dx.doi.org/10.1007/978-3-319-23234-8_36]
Victor N. 2012. Enhancing the data capacity of QR codes by compressing thedata before generation. International Journal of Computer Applications, 60(2): 17-21[DOI: 10.5120/9663-1104]
Villán R, Voloshynovskiy S, Koval O and Pun T. 2006. Multilevel 2-D bar codes: toward high-capacity storage modules for multimedia security and management. IEEE Transactions on Information Forensics and Security, 1(4): 405-420[DOI: 10.1109/TIFS.2006.885022]
Yang K, Yuan H D and Guo Y B. 2017. Research on lower redundancy of two-dimension barcode encoding in Chinese characters. Computer Science, 44(11A): 565-569
杨康, 袁海东, 郭渊博. 2017. 低冗余二维码汉字编码研究. 计算机科学, 44(11A): 565-569[DOI: 10.11896/j.issn.1002-137X.2017.11A.120]
Yang Z B, Xu H L, Deng J Y, Loy C C and Lau W C. 2018. Robust and fast decoding of high-capacity color QR codes for mobile applications. IEEE Transactions on Image Processing, 27(12): 6093-6108[DOI: 10.1109/TIP.2018.2855419]
Yuan T L, Wang Y L, Xu K, Martin R R and Hu S M. 2019. Two-layer QR codes. IEEE Transactions on Image Processing, 28(9): 4413-4428[DOI: 10.1109/TIP.2019.2908490]
Zheng Z X. 2020. A generation method of anti-counterfeit QR code based on ciphertext compression. Information and Communications, (6): 156-157
郑志学. 2020. 一种基于密文压缩的防伪二维码生成方法. 信息通信, (6): 156-157[DOI: 10.3969/j.issn.1673-1131.2020.06.064]
Zou M, Zhang R L, Wu T S and Wang X. 2015. An improved Huffman coding to increase information capacity in QR code. Industrial Control Computer, 28(9): 111-112, 114
邹敏, 张瑞林, 吴桐树, 王啸. 2015. 一种改进的Huffman编码技术增加QR码的信息容量. 工业控制计算机, 28(9): 111-112, 114[DOI: 10.3969/j.issn.1001-182X.2015.09.049]
相关文章
相关作者
相关机构