Blur-readable two-dimensional barcode based on blur-invariant shape and geometric features

In recent years, the application of two-dimensional (2D) barcode is more and more extensive and has been used as landmarks for robots to detect and peruse the information. However, it is hard to obtain a sharp 2D barcode image because of the moving robot, and the common solution is to deblur the blurry image before decoding the barcode. Image deblurring is an ill-posed problem, where ringing artifacts are commonly presented in the deblurred image, which causes the increase of decoding time and the limited improvement of decoding accuracy. In this article, a novel approach is proposed using blur-invariant shape and geometric features to make a blur-readable (BR) 2D barcode, which can be directly decoded even when seriously blurred. The finder patterns of BR code consist of two concentric rings and five disjoint disks, whose centroids form two triangles. The outer edges of the concentric rings can be regarded as blur-invariant shapes, which enable BR code to be quickly located even in a blurred image. The inner angles of the triangle are of blur-invariant geometric features, which can be used to store the format information of BR code. When suffering from severe defocus blur, the BR code can not only reduce the decoding time by skipping the deblurring process but also improve the decoding accuracy. With the defocus blur described by circular disk point-spread function, simulation results verify the performance of blur-invariant shape and the performance of BR code under blurred image situation.


Introduction
Mobile robots are widely used in indoor environments 1 and two-dimensional (2D) barcodes are popular for robots to detect and peruse the information. 2 Barcodes are used as a target of pursuing robot, 3 and as landmarks for distance measurement 4 or navigation. 5 As a timely, accurate, reliable, and economical data medium, 6 2D barcodes are widely used in many automation scenes in both industry and our ordinary life. 7 Commonly used 2D barcodes include QR codes, 8 Data Matrix, 9 and MaxiCode. 10 Using 2D barcodes for robot navigation has the advantages of low cost, simple installation, and easy modification to change the guide route when necessary. 11 However, the recognition rate of the 2D barcode falls when the distance between the reader and the barcode increases. 11 In addition, with the speed of the robot rising, the 2D barcode may decode failure. 12 The main reasons for the above problems are the motion blur and defocus blur of the image captured by the camera on a moving robot. In general, the speed of camera shutter is much faster than that of a robot, so the motion blur can be simplified to be the linear uniform motion degradation. 13 Defocus blur is usually described by circular disk point-spread function (PSF). 14 In practical applications, blurring is one of the common degradations in captured 2D barcode images and the identification and verification of the blurry 2D barcode images still remain a challenge. 15,16 Many methods have been proposed to deblur 2D barcode images. [16][17][18] However, image deblurring is an ill-posed problem, [19][20][21] and these deblurring methods suffer from expensive time cost due to complicated preprocessing and edge detection algorithms. 6 In addition, ringing artifacts are commonly presented in the deblurred image, [19][20][21] which limits the improvement of decoding accuracy, or even reduces the decoding accuracy. In recent years, machine learning and deep learning are used in blurry 2D barcode images, 6,7 but these methods rely on the quality and large quantity of the image samples, which might not be applicable to the practical scenarios. 16 The 2D barcode images are very different from natural images, and they are usually composed of finder patterns and data regions. Finder patterns enable their positions to be quickly located and data regions encode data. Before the encoded data can be extracted and decoded correctly, extra information is needed, such as the orientation and size of the barcode, encoding parameters, version number, and so on, which is usually called format information, and can be stored in data regions, finder patterns, or both. The decoding process of the 2D barcode can be roughly divided into three steps: (1) detection and positioning; (2) extracting format information; and (3) extracting and decoding data. To successfully decode a 2D barcode from a blurry image, we generally do not need to restore all the details of the blurred image, because the data stored in the data regions are fault tolerant. The reason for decoding failure is often due to the destruction of the features of the finder patterns, which make the first step of the decoding process to unsuccessfully detect and locate the 2D barcode. As a result, finding a blur-invariant feature is the key to solve the above problems. The proposed finder patterns can improve the decoding performance of the 2D barcode without deblurring when the captured barcode image is blurred.
Blur invariant is based on the idea of direct analysis of the degraded blurry images. 14,22,23 A large number of related articles using this concept have been published. 24 In this article, we try to find out the shape and geometric features that are invariant to blur and used them to make up a blur-readable (BR) 2D barcode that can be decoded without deblurring. It is focused on the application scenario of low-speed robot and defocus blur is a main factor reducing the quality of captured images. Therefore, the remaining part of this article mainly deals with the recognition of the 2D barcode under defocus blur. Compared with the traditional approaches of deblurring the blurred 2D barcode image before decoding, the method proposed in this article has the following advantages: 1. Quicker locating: The finder patterns of BR code are composed of blur-invariant shapes, which enable the BR code to be quickly located in a severely blurred image. On the contrary, the finder patterns of the ordinary 2D barcode cannot be located in a severely blurred image. 2. Higher decoding accuracy: The format information of BR code is stored with blur-invariant geometric features, which can be retrieved correctly in a severely blurred image. With the correct format information, the data can be extracted more accurately from the BR code in a severely blurred image.
Simulations show that the accuracy of decoding BR code in a severely blurred image is higher than that of QR code, even when the blurred QR code image is deblurred before decoding. 3. Simpler decoding process: No deblurring is needed for decoding a BR code in a severely blurred image, whereas the QR code must be deblurred before decoding in a severely blurred image.

Blur-invariant shape and geometric features
Blur-invariant shape is the contour of a region in a binary image that can be directly restored to its original shape after being blurred. Let f : R 2 ! R be the sharp binary image, where f ðx; yÞ is the pixel intensity at location ðx; yÞ 2 R 2 .
Assuming that the blurring process is a linear shiftinvariant system, the blurred image gðx; yÞ is a real value function where hðx; yÞ is the PSF and ðx; yÞ 2 R 2 is the location of the pixel intensity. To restore f ðx; yÞ from gðx; yÞ, the simplest way is to binarize gðx; yÞ directly with threshold T, which can be defined as follows 25 mingðx; yÞ < T < maxgðx; yÞ The restored image is If the contours of f ðx; yÞ and f 0 ðx; yÞ have the same shape, then the contour of f ðx; yÞ is said to be invariant to the PSF hðx; yÞ, that is, the contour of f ðx; yÞ is a blurinvariant shape, or simply say that f ðx; yÞ is blurinvariant.
The 2D barcode symbols are usually constructed as rectangle or circle forms. 8-10 Therefore, we examine the possible blur-invariant shape of rectangular and circular regions. The defocus blur can be described by the circular disk model, 14 whose PSF is where R is the blur radius. Set f r ðx; yÞ and f c ðx; yÞ be sharp images of rectangular and circular regions, respectively, that is where M and N are the height and width of the rectangle f r ðx; yÞ, respectively, and R 0 is the radius of f c ðx; yÞ. Their blurred images are Suppose that the blur radius satisfies the integral results are shown in Figures 1 and 2, respectively, where point O 1 ðx; yÞ is the center of PSF hðx À u; y À vÞ.
In Figure 1, f r ðx; yÞ is the rectangle EFGH, and the whole coordinate plane is divided into three regions by rectangles ABCD and IJKL: region 1, region 2, and region 3. It is obvious that g r ðx; yÞ ¼ 0 when O 1 in region 3 and g r ðx; yÞ ¼ 1 when O 1 in region 1. To get the contour of the restored image f 0 r ðx; yÞ defined in equation (3) from g r ðx; yÞ, we only need to find out the trajectory of O 1 when the area of the intersection of circle O 1 and the rectangle EFGH is T Â pR 2 . It is clear that the edge of f 0 r ðx; yÞ and f r ðx; yÞ is parallel, when O 1 is within region 2 except the four shaded areas. When O 1 is within the four shaded areas, its trajectory is a curve, as shown in the dotted line in Figure 1. Similarly, we can get the contour of the restored image f 0 c ðx; yÞ defined in equation (3) from g c ðx; yÞ, as shown in the dotted line in Figure 2, which is also a circle.
Therefore, f c ðx; yÞ is blur invariant, whereas f r ðx; yÞ is not. What is more, equation (9) shows that the maximum allowable blur radius is no more than half of the radius of f c ðx; yÞ, that is, a larger radius makes f c ðx; yÞ be invariant to more severe blur.
According to the theory of blur invariants, 22 if the PSF hðx; yÞ is centrally symmetric, that is hðx; yÞ ¼ hðÀx; ÀyÞ the centroid coordinates of images, that is  x are blur invariants, where m ðf Þ pq is defined as x p y q f ðx; yÞdxdy (13) It is obvious that the PSF defined in equation (4) satisfies equation (11). Therefore, the centroid coordinates of I k ðx; yÞ, that is, ðx ðI k Þ t ; y ðI k Þ t Þ; k ¼ 1; 2 Á Á Á ; K, are blur invariants, and the shape formed by these centroid points is also invariant to blur. Any geometric feature of this shape can be regarded as a blur-invariant geometric feature.
However, to ensure that I k ðx; yÞ; k ¼ 1; 2 Á Á Á ; K are still disjoint after blurred, equation (10) needs to be rewritten as where U k is the support of I q ðx; yÞ and R is the blur radius.

Structure of BR code
The structure of the BR code is shown in Figure 3, including finder patterns and two data regions. The finder patterns consist of two parts: two concentric rings for locating the code and five disks for storing format information. When the data fill the data regions, the outer edges of the two concentric rings can be regarded as blur-invariant shapes, so they can be detected even under severe blur. The five disjoint disks A, B, C, D and O form two isosceles triangles (DAOD and DBOC). The angle ffAOD is fixed at 15 and used as a reference for decoding. The angle ffCOB is a blur-invariant geometric feature and varies with the symbol version of BR code, which implies the structure and capacity of the BR code, as presented in Table 1.
The two data regions are subdivided into circular data bands, which can be defined as concentric rings in the data regions, and are evenly divided into annulus to store data bits. A dark annulus presents one and a light annulus presents zero. The total number of the dark and light annulus is the raw data capacity of the BR code symbol. The parameters for each symbol version are presented in Table 1.

Simulation results
Three simulation cases are presented in this section. The first case is to verify the correctness of blur-invariant shape with rectangular and circular regions. The second case compares the performance of BR code decoding without deblurring and QR code decoding with deblurring. The third case tests the relationship between decoding performance and number of data bands for BR code under defocus blur condition.
In the first simulation case, rectangular and circular regions of size 800 Â 800 pixels, defined in equations (5) and (6), respectively, are generated with M ¼ 200; N ¼ 250; R 0 ¼ 200. To measure the variety of shapes, we use compactness and irregularity, 26 as defined in equations (15) and (16), respectively where Aðf Þ and Pðf Þ are the area and perimeter of region f ðx; yÞ, respectively where ð x; yÞ and ðx i ; y i Þ are the coordinates of the center of mass and points on the contour, respectively. The compactness and irregularity of rectangular and circular regions are given in Table 2.
The rectangular and circular regions are blurred with PSFs of different blur radius and then restored to a binary image, as defined in equations (1) and (3), respectively. In the simulation, it is easy to find out that 0 < T < 1, therefore, three values of T: 0.2, 0.5, and 0.8 are used. The compactness and irregularity of the restored regions are shown in Figures 4 and 5, respectively. It is clear that both the compactness and irregularity of the restored circular region are almost unchanged, which are approximately equal to those before blurred. For the restored rectangular region, its compactness increases and irregularity decreases, indicating that with the blur radius increasing, the restored rectangular region becomes more and more like a circular region.
In the second simulation case, we compared the decoding performance of BR code and QR code. The deblurring algorithm used here is based on Kullback-Leibler divergence (KLD), 17 which is one of the best nonlearning-based deblurring algorithms for QR code that can be found at present. The size of both QR and BR codes is 550 Â 550 pixels, as shown in Figures 6 and 7, respectively. They have a similar raw data capacity, 208 bits for QR code and 188 bits for BR code. The white edge in Figure 6 is a quiet zone 8 to ensure that it can be correctly decoded. Because the BR code only takes up a circular area with a diameter of 550, the data capacity per pixel for QR and BR codes is 6:9 Â 10 À4 and 7:9 Â 10 À4 bits/pixel, respectively, meaning that the data capacity per pixel of BR codes is higher than that of QR codes.
The steps of the simulation process are as follows: Firstly, 30 samples of BR codes and QR codes with different contents are generated, respectively. Secondly, these 60 samples are blurred with defocus PSFs of different radius. Then, the 30 samples of blurred QR codes are deblurred using KLD. Thirdly, the blurred BR codes and the deblurred QR codes are decoded. The mean bit error rates (BERs) of the 30 samples for blurred BR codes and deblurred QR codes are shown in Figure 8, and the corresponding standard deviations are given in Table 3.
Since the maximum error correction level of most 2D barcodes is 30%, we believe that a barcode is impossible to    be decoded successfully when BER is greater than 30%. It is clear that the blurred QR codes deblurred with KLD are able to be decoded when blurred radius is no greater than 19 (with the standard deviation less than 20%). The blurred BR codes are able to be decoded directly without deblurring when blurred radius is no greater than 23 (with the standard deviation less than 3%), which is 21% higher than that of QR codes. What is more, the BER of BR codes is less than that of QR codes when blurred radius is no greater than 24, which proves that blur-invariant shape and geometric features can improve the performance of 2D barcode with respect to defocus blur. In short, although the blurred QR code images are preprocessed by a deblurring algorithm, the BR code has better decoding performance than the QR code in the defocus blur situation.
In the third simulation case, we choose four different symbol versions, that is, 4, 6, 8, and 10, and for every version, 10 samples of BR codes with different data are generated. The BR codes are then blurred with defocus kernels of different radius. The decoding results for the blurred BR codes are shown in Figure 9. As in the last simulation, we choose BER less than 30% as the criterion of decoding success. The BR codes of versions 4 and 6 can be decoded successfully with a blur radius not greater than 24. The BR codes of version 8 can only be decoded successfully with a blur radius not greater than 14. The BR codes of version 10 can only be decoded successfully with a blur radius not greater than 9. Therefore, with the symbol version increasing, the data capacity and the number of data bands increase, and the decoding performance under severe blur decreases.

Conclusion
In this article, to solve the problems of recognition rate decline and decoding failure for 2D barcode under defocus blur, the blur-invariant shape and geometric features are derived, and a BR code based on these features is presented. Formed by two blur-invariant concentric rings, the finder patterns enable BR code to be quickly located in blurred images. The format information of BR code is stored with blur-invariant geometric features, which can be retrieved correctly in a severely blurred image.  Therefore, the BR can be directly decoded without deblurring even when seriously blurred. Simulation results verify the performance of blur-invariant shape and BR code under defocus blur. Compared with the QR code, the mean of maximum blur radii under which the BR codes can be successfully decoded is increased by 21% with lower standard deviation and BERs. It should be noted that only defocus blur is considered here. Its decoding performance under other types of blur, such as Gaussian and motion blur, can be further explored in the future.

Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.

Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work was supported by Science and Technology Planning Project of Guangdong Province (grant 2017B090908006).