How to correct geometrically distorted QR Codes
The method corrects geometrically distorted QR codes by oversampling and recursive tracking, enabling accurate reading and interpretation of distorted QR codes.
Patent Information
- Application Number
- JP2021573867
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2019-06-14
- Filing Date
- 2020-06-02
- Publication Date
- 2024-09-09
- Estimated Expiration
- 2040-06-02
AI Technical Summary
Existing methods struggle to correct QR codes distorted by convex or curved surfaces or multiple types of distortions, making them difficult or impossible to read.
A method involving oversampling, intensity filtering, and recursive tracking to determine the center and color of each module in a geometrically distorted QR code, using an oversampling matrix and recursive processing to correct the distortion.
Enables the reading and interpretation of distorted QR codes by accurately determining the position and color of each module, effectively correcting the geometric distortions and restoring the QR code's information content.
Smart Images

Figure 0007546826000016 
Figure 0007546826000011 
Figure 0007546826000005
Abstract
Description
[Technical field]
[0001] The present invention provides a geometrically distorted image quick response code, QR code, for reading and interpreting the code. (Registered Trademark) This invention relates to a method for correcting the above problem.
[0002] The invention also relates to a camera system and a computer program product for causing an apparatus to carry out the method. [Background technology]
[0003] background In many circumstances and situations, quick response codes, QR codes (Registered Trademark) There are situations where the QR code is unintentionally distorted, i.e., warped or twisted. It may, for example, be placed on a concave or convex surface, or there may be humps or pits under the code, which can cause the QR code to (Registered Trademark) This distorts the pattern of the QR code. (Registered Trademark) may be difficult or even impossible to read.
[0004] Nowadays, when the surface distortion angle is known or the surface distortion angle is QR code (Registered Trademark) can be determined from the captured image of an imaged QR code that is disposed on a convex or curved surface or substrate for reading. (Registered Trademark) However, there are methods that can correct this. (Registered Trademark) may have more than one distortion and / or types of distortion different from those caused by a convex or curved surface.
[0005] Thus, the QR code imaged has distortions caused by the convex or curved substrate. (Registered Trademark) , or a QR code with random or more than one type of distortion (Registered Trademark) There is a need for a method that can correct for. Summary of the Invention
[0006] An improved method and technical equipment for implementing the method have now been invented. Various aspects of the invention include a method, a device and a computer readable medium with a computer program stored therein, characterized by what is stated in the independent claims. Various embodiments of the invention are disclosed in the dependent claims.
[0007] According to a first aspect of the invention, a geometrically distorted QR code comprising a modular structure is generated by computer means. (Registered Trademark) (40), the method comprising: (Registered Trademark) (40) and QR code (Registered Trademark) Providing the position coordinates of the three exterior corners of (40), and dividing each module (41) into an average of F × F sample elements (42) to form an oversampling matrix, the QR code is (Registered Trademark) oversampling modules of (40), where F is an integer greater than 1; determining an intensity of each sample element (42) in the oversampling matrix; calculating an average intensity of the oversampling matrix; subtracting the average intensity from the intensity of each sample element (42) in the oversampling matrix; filtering the intensity values to determine an average value of each sample element (42); and determining a position of the sample element (42) corresponding to a center of each module (41); determining a color of each module (41) based on the intensity of the sample element (42) corresponding to the center of each module (41) by using iterations; forming a queue Q including a data structure of modules (41), the data structure including a position of the center of the module (41), the color of the module (41), and a QR code. (Registered Trademark)forming a first data structure in the queue Q, the data structure including information about the location of the module in the queue Q (40); for a module (x,y) whose center location and color are unknown, creating a first list of x,y coordinates of the module (x,y) (45) and its eight neighboring modules; calculating a sample element corresponding to an estimated center coordinate (Ex,Ey) (46) of the module (x,y) (45) based on the neighboring modules whose centers are known; defining a number of offset sample element candidates OC, the offset sample element candidates OC being (dx,dy), where dx and dy belong to a set {-1,0,+1}; for the module whose center is unknown, providing a set of color combination hypotheses; and for each offset sample element candidate and for each color combination hypotheses, The method includes the steps of: providing a second list including intensities of the offset sample element candidates OC by reading the intensity of each offset sample element candidate OC from the oversampling matrix at coordinate (E+OC×F) for a matching hypothesis, where E is the estimated center coordinate (Ex,Ey) (46); providing a third list of nine color hypotheses (CH) corresponding to the intensities of the sample elements in the second list, correlating the second list and the third list and storing the correlation result for determining a sample element corresponding to the offset sample element candidate having the highest correlation value of the center of the module (x,y) (45); and determining the color of the module (x,y) (45) by choosing from the oversampling matrix the intensity value of the offset sample element candidate having the highest correlation value.
[0009] According to one example, the method further includes updating a data structure for module (x, y) with the determined center and color information of module (x, y) and adding the coordinates of module (x, y) in the LNXY list to a queue Q.
[0010] According to one example, oversampling may be performed by using a QR code to form an oversampling matrix. (Registered Trademark)This is implemented by dividing each module of into F × F sample elements.
[0011] According to one example, the method comprises: (Registered Trademark) The method further includes oversampling a margin around the
[0012] According to one example, oversampling of the margin is performed by dividing each module of the margin into F×F sample elements for a portion of the oversampling matrix.
[0013] According to one example, the method comprises: (Registered Trademark) The method further includes reading the color information from a data structure of a module for defining information content of the color information.
[0014] According to one example, F is an integer greater than or equal to four.
[0015] According to one example, the margin M is a QR code (Registered Trademark) Determine the number of modules to be processed on the
[0016] According to one example, the color combination hypotheses include all possible color combinations of modules with unknown centers.
[0017] According to one example, when correlating the LSC list and the LCH list, the elements in the lists are multiplied and added.
[0018] According to a second aspect of the present invention, there is provided a computer program product embodied in a non-transitory computer readable medium, the computer program product comprising computer instructions, the computer instructions, when executed by at least one processor of a system or device, generating a geometrically distorted QR code comprising a modular structure. (Registered Trademark) wherein the correction method corresponds to the first aspect of the present invention.
[0020] According to one example, the method further includes updating a data structure for module (x,y) with the determined center and color information of module (x,y) and adding the coordinates of module (x,y) in the first list to a queue Q. According to one example, oversampling may be performed by using a QR code to form an oversampling matrix. (Registered Trademark) This is implemented by dividing each module of into F × F sample elements. According to one example, the method comprises: (Registered Trademark) The method further includes oversampling a margin around the According to one example, oversampling of the margin is performed by dividing each module of the margin into F×F sample elements for a portion of the oversampling matrix. According to one example, the method comprises: (Registered Trademark) The method further includes reading the color information from a data structure of a module for defining information content of the color information. According to one example, F is an integer greater than or equal to four. According to one example, the margin M is a QR code (Registered Trademark) Determine the number of modules to be processed on the According to one example, the color combination hypotheses include all possible color combinations of modules with unknown centers. According to one example, when correlating the second and third lists, the elements in the lists are multiplied and added. According to a third aspect of the invention, a geometrically distorted QR code comprising a modular structure is provided. (Registered Trademark) There is provided a device comprising means for performing the correction method of, wherein the correction method corresponds to the first aspect of the present invention. According to one example, the method further includes updating a data structure for module (x,y) with the determined center and color information of module (x,y) and adding the coordinates of module (x,y) in the first list to a queue Q.
[0021] According to one example, oversampling may be performed by using a QR code to form an oversampling matrix. (Registered Trademark) This is implemented by dividing each module of into F × F sample elements.
[0022] According to one example, the method comprises: (Registered Trademark) The method further includes oversampling a margin around the
[0023] According to one example, oversampling of the margin is performed by dividing each module of the margin into F×F sample elements for a portion of the oversampling matrix.
[0024] According to one example, the method comprises: (Registered Trademark) The method further includes reading the color information from a data structure of a module for defining information content of the color information.
[0025] According to one example, F is an integer greater than or equal to four.
[0026] According to one example, the margin M is a QR code (Registered Trademark) Determine the number of modules to be processed on the
[0038] According to one example, the color combination hypotheses include all possible color combinations of modules with unknown centers.
[0039] According to one example, Second List and Third When correlating lists, the elements in the lists are multiplied and added.
[0040] According to one example, the device may generate a geometrically distorted QR code. (Registered Trademark) The image sensor is provided for capturing an image of the image.
[0041] According to one example, the device may generate a geometrically distorted QR code. (Registered Trademark) The image data is received by the image processing device.
[0042] According to one example, the device may be a mobile phone, a mobile computer, a tablet computer, or a QR code. (Registered Trademark) It is a scanner. [Brief description of the drawings]
[0043] Various exemplary embodiments will be described in more detail below with reference to the accompanying drawings.
[0044] [Figure 1] As an example, a device suitable for use to correct a distorted QR code is shown. [Figure 2a] As an example, an image of a geometrically distorted QR code is shown. [Figure 2b] As an example, a geometrically distorted QR Code module is shown in FIG. 2a. [Figure 3a] 1 shows a module of a QR Code that is not geometrically distorted. [Figure 3b-f] As an example, a geometrically distorted module of a QR Code is shown. [Figure 4a] As an example, a geometrically distorted image of a QR code is shown with modules placed on the QR code image. [Figure 4b] As an example, one module of the oversampling matrix and sample elements of the module are shown after oversampling the module shown in FIG. 4a. [Figure 4c] As an example, we show the average intensity of sample elements of the module shown in FIG. 4b after subtraction of the mean intensity. [Figure 4d] As an example, two filter positions on an oversampling matrix are shown to determine the local maxima and minima occurring within each module of a QR Code positioned to be corrected for reading. [Figure 4e]As an example, a data structure is shown for a module (x,y) under test and its neighboring modules containing information about whether their color and center position is known, i.e., module A, or unknown, i.e., module B. [Figure 4f] As an example, an estimated center (Ex,Ey) of a module (x,y) is shown with offset sample element candidates around the estimated center (Ex,Ey) and corresponding locations in adjacent modules. [Diagram 5] As an example, the method steps for correcting a geometrically distorted QR code are given. [Figure 6] As an example, the recursive steps are shown below. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0045] Detailed Description The present invention relates to a method according to an exemplary embodiment of the present invention, in which image data of a geometrically distorted Quick Response (QR) code is arranged to be corrected. The image data is arranged to be corrected for a distorted, i.e., deformed, QR code. (Registered Trademark) Therefore, the device can read the QR code. (Registered Trademark) It may not be possible to read and interpret the QR code in the image. (Registered Trademark) is a QR code (Registered Trademark) The information in the code must be corrected, i.e. undistorted, to make it readable. (Registered Trademark) The term QR Code refers to a code that has the form of a matrix barcode or a two-dimensional bar type. (Registered Trademark) is composed of black squares, i.e. modules arranged in a square grid, i.e. a grid of modules on a white background, and the QR code (Registered Trademark) is read by an imaging device and the QR code (Registered Trademark)The information may be processed by a data processing device so that it can be interpreted. The term "imaging device" in this context includes any image sensor suitable for capturing images and / or videos, i.e. image data, e.g., black and white or color cameras, normal or smart cameras, or any suitable camera. In addition, the term "image" not only includes still images, but also dynamic images, e.g., frames of a video.
[0046] In this method, image data of a geometrically distorted Quick Response (QR) code is provided. The image data may be received, for example, from an imaging device, another device, the device's memory, the internet, or a cloud service, or the image data may be captured by the device's own imaging device. The QR code is then (Registered Trademark) Module, and QR code (Registered Trademark) The margin area around the QR code (Registered Trademark) The QR code, including the frame area around it (Registered Trademark) The area is oversampled to create an oversampling matrix. The width of the margin is, for example, (Registered Trademark)The mean, i.e., average intensity, of this oversampling matrix is then determined and subtracted from the intensities of the sample elements of the oversampling matrix, so that the darker and black sample elements have negative values and the sample elements corresponding to the white or lighter sample elements have positive values. These subtracted sample values are then linearly filtered to determine information indicative of the local maxima and minima occurring within the sample element positions of each module. After this, the positions of the modules and their center points are tracked using at least the linearly filtered sample values, the positions of the module's maximum and minimum sample values, and / or the known or previously determined color and center point position information of adjacent modules, and then the color of the module's center point is read from the oversampling matrix to determine the color of the module. The determined, i.e., calculated by tracking, information, i.e., module position information and module color information, are then linearly filtered to determine the undistorted QR code. (Registered Trademark) The QR code is corrected so that it can be read from (Registered Trademark) can be read from
[0047] The method can be used to, for example, generate a geometrically distorted QR code. (Registered Trademark) The method may be performed by a device suitable for processing image data to correct the image data, or a system comprising the device. The term "processing" in this context may refer to any type of processing, and / or analysis, and / or calculation, and / or decision operation. Processing may refer to, for example, signal processing of the image data by one or more digital signal processing algorithms. The device may include means for processing the image data, for example, the device may include processing circuits and electronics for digital signal processing of the image data, computer program code in a memory, and a QR code configured to be interpreted by the device upon execution of the computer program code. (Registered Trademark)The device may include a processor for performing signal processing of the image data of the corrected QR code. The data processing device may be an integrated part of the device or may be a separate device. In addition, the device may include imaging means, e.g., at least one imaging device, or means for receiving image data from other devices, databases or the Internet, cloud, etc. Furthermore, the device may include a processor for performing signal processing of the image data of the corrected QR code. (Registered Trademark) The method may take actions determined by the user, which may include, for example, measures related to websites visited or applications performed.
[0048] Method according to an exemplary embodiment of the present invention, i.e. Distorted QR Code (Registered Trademark) The device performing the image data correction step may be, for example, any portable electronic device, such as a smart device, a mobile phone, a smart camera, a mobile computer, a mobile collaboration device, a mobile Internet device, a smartphone, a tablet computer, a tablet personal computer (PC), a personal digital assistant, a handheld game console, a QR code (Registered Trademark) The device may be a scanner, a portable media player, a digital video camera (DVC or digital camcorder), a pager, a cellular electronic device, a non-cellular electronic device, or a personal navigation device (PND). However, the device may not be a mobile device and may be a distorted QR code according to an exemplary embodiment. (Registered Trademark) It is also possible that the method can be implemented in, for example, a cloud service.
[0049] FIG. 1 illustrates a device 10 according to an exemplary embodiment. In this embodiment, the device 10 comprises or otherwise communicates with a processor 12, a memory 14, a communication interface 16, a user interface 18, and an image capture module such as a camera 11. The processor 12 may be embodied in several different ways. The processor 12 may be embodied as one or more of a variety of hardware processing means, such as, for example, a coprocessor, a microprocessor, a controller, a digital signal processor (DSP), a processing element with or without an associated DSP, etc. The processor 12 may include one or more processing cores configured to perform independently. The processor 12 may be configured to execute instructions stored in the memory 14 or otherwise accessible to the processor 12. It is also possible that the processor 12 may be the processor of a particular device configured to employ an embodiment of the present invention, by further configuration of the processor with instructions to perform the algorithms and / or operations described herein.
[0050] Image capture module 11 is an optional part of device 10. Image capture module 11 may be, for example, a camera, a video camera, or a QR code reader. (Registered Trademark) The image capture module 11 may be any other image capture means suitable for capturing image data of the image. The image capture module 11 is in communication with the processor 12. Thus, the image capture module 11 may include all hardware, e.g., lenses or other optical components, an image sensor, an image signal processor, and software necessary to create a digital image file, i.e., image data from the captured image. In one embodiment, the image capture module 11 may further comprise a processing means, such as a co-processor, for processing the image data.
[0051] Memory 14 may include, for example, one or more volatile and / or non-volatile memories, i.e., memory 14 may be an electronic storage device, e.g., a computer-readable storage medium including a gate configured to store data that may be retrieved by processor 12. Memory 14 may be configured to store information, data, image data, content, applications, instructions, etc. to enable device 10 to perform various functions in accordance with exemplary embodiments of the present invention. Additionally or alternatively, memory 14 may be configured to store instructions for execution by processor 12.
[0052] Communications module 16 may be any means, such as devices or circuitry embodied in either hardware, or a combination of hardware and software, configured to receive and / or transmit data from and / or to a network, and / or any other device or module or camera in communication with apparatus 10. Communications module 16 may include, for example, at least one antenna and supporting hardware and / or software to enable communication with a wireless communications network, or hardware / software to enable communication via cable, digital subscriber line (DSL), universal serial bus (USB), etc.
[0053] A user interface 18 of device 10 may also be an optional part of device 10 and may be in communication with processor 12 to provide output to a user and receive user input. User interface 18 may include, for example, a display, a keyboard, a mouse, a touch screen, a touch area, soft keys, a microphone, a speaker, or other input / output mechanisms (not shown). Processor 12 may include user interface circuitry configured to control at least some functions of user interface 18.
[0054] Figure 2a shows an example of a geometrically distorted QR code. (Registered Trademark) 21. The method of the present invention is (Registered Trademark) The image data of 21 can be used to process the image data so that it is at least less distorted and readable by the device. Image 20 is a still image. The QR code in this example (Registered Trademark) 21 is curved in the middle but has straight sides. QR Code (Registered Trademark) A margin area 22 around 21 is also shown.
[0055] FIG. 2b shows an example of the geometrically distorted QR code of FIG. 2a. (Registered Trademark) 21 modules 23 are shown. From Fig. 2b it can be seen how the modules 23 are located relative to each other and how the size of some modules 23 differs from the size of others. In this example the width 24 of the margin area 22 is as wide as two modules, but it could also be larger, for example as wide as three or four modules. Some geometrically distorted QR codes (Registered Trademark) In the QR code, at least one side is not straight, so a margin area may be required. (Registered Trademark) When the image is corrected, the margin area is also processed, so the QR code with distorted margin areas (Registered Trademark) However, geometrically distorted QR codes are processed. (Registered Trademark) If the border does not include at least one non-straight side, no margin is required. The margin area 22 is indicated in this example by a dashed square.
[0056] Figure 3a shows a QR code that is not geometrically distorted. (Registered Trademark) 3b-3f show, by way of example, geometrically distorted QR codes that are distorted in different ways and that can be corrected by the method of the present invention. (Registered Trademark) The marginal areas are not shown in these figures 3a to 3f. Figure 3b shows a geometrically distorted QR code. (Registered Trademark) 31 modules 32 are shown. There are many sizes of modules 32 and there are different levels of modules 32 both vertically and horizontally. (Registered Trademark)31 have uneven edges, and this unevenness creates a geometrically distorted QR code. (Registered Trademark) This is why a margin area is needed when the geometrically distorted QR code is corrected. (Registered Trademark) This QR code shows module 32 of 33. (Registered Trademark) The modules 32 are approximately the same size but are at different horizontal levels. (Registered Trademark) The vertical sides of 33 are also very uneven. Figures 3d-3f show the geometrically distorted QR code. (Registered Trademark) Shown are modules 32 at 34, 35 and 36. There are again many sizes of modules 32 and there are different levels of modules 32 both vertically and / or horizontally.
[0057] Here, in the following, for example, a geometrically distorted QR code (Registered Trademark) A method is described in which a QR code is arranged to be used to correct the information in the QR code so that the information is readable. Figures 4a to 4f show, by way of example, the features considered in connection with the method. Figure 4a shows, by way of example, a QR code. (Registered Trademark) Geometrically distorted QR code with modules arranged on top (Registered Trademark)4b shows, by way of example, one module of the oversampling matrix and its sample elements after oversampling the module shown in FIG. 4a. FIG. 4c shows, by way of example, the average intensity of the samples shown in FIG. 4b after subtraction of the average intensity. FIG. 4d shows, by way of example, two filter positions on the module of FIG. 4c, the filters being arranged to determine the local maxima and minima occurring within the module of the original image. FIG. 4e shows, by way of example, a module (x,y) and its neighboring modules containing information about whether their color and center position are known or not, in which the data structure is under test, i.e. arranged to be determined by the method, where module (A) has a known color and center position and module (B) has an unknown color and center position. FIG. 4f shows, by way of example, the estimated center (Ex,Ey) of module (x,y) with offset sample element candidates around the estimated center (Ex,Ey) and the corresponding location in the neighboring module.
[0058] Distorted QR Code (Registered Trademark) 40 image data, and a QR code including a finder pattern 44. (Registered Trademark) The position coordinates of those three exterior corners of 40 are input for the method.
[0059] QR Code (Registered Trademark) It is assumed that the module count of 40 is known and that there are N modules 41 in both the X and Y directions, so that there are a total of N×N modules. The number of modules may vary, for example, by the number of modules in one QR code. (Registered Trademark) In general, the number of modules 41 can be between 21 and 177. However, if the number of modules 41 is not known, it can be calculated by using several known methods, as well as the information that the width and height of the finder pattern are always 8 modules.
[0060] The first step of the method is the oversampling step, (Registered Trademark) Module 41 and QR code of the area (Registered Trademark)The margin area M around the QR code is oversampled. (Registered Trademark) The module of area and margin area M is divided into sample elements, so that F × F sample elements are generated for the QR code. (Registered Trademark) It is meant that within each module of area and margin area M, F is an oversampling factor, which may be selected for the method or may be predefined.
[0061] First, a corner of the central finder pattern 44 is selected or pre-set as the origin O, shown in FIG. 4a. (Step 1.1)
[0062] The X and Y axes of the coordinate system are selected as directions from the origin O to each of the other two corners containing the finder pattern 44. These X and Y axes are also shown in Figure 4a. (Step 1.2)
[0063] The oversampling factor F is an integer equal to or greater than 4, for example F=8, as in the example of Fig. 4a-4f, but as already mentioned F is at least 4 or greater than 4. F is predefined for the method. After this, a margin M can be selected or predefined. The margin M is the number of modules by which the correction method overruns the expected boundaries set by the X and Y axes, i.e. ... (Registered Trademark) a method for correcting a predicted QR code, (Registered Trademark) Determine the number of surrounding modules of 40. M is the quiet zone, i.e., the QR code (Registered Trademark) The margin M is shown in Figure 4a. (Step 1.3)
[0064] Memory is then allocated, i.e., for the matrix of size ((N+2×M)×F)×((N+2×M)×F), i.e., the oversampling matrix (step 1.4).
[0065] Next, a QR code including the area of margin M (Registered Trademark) 40 areas are sampled. Sampling means that an intensity is determined for each sample element of the oversampling matrix. Sampling starts from the image coordinates corresponding to the module coordinate (-M,-M) (shown in image 4a) and ends at the image coordinates corresponding to the module coordinate (N+M,N+M) (also shown in image 4a). There are F samples, i.e. sample elements, taken from the image per module 41 in both the x and y directions, such that there are on average at least F×F sample elements in each module. The direction along which the sampling point moves in the image is determined by the directions of the X and Y axes. This procedure fills the sample elements of the oversampling matrix with their intensity values as the sampling procedure traverses all (N+2M)×(N+2M) modules and generates ((N+2×M)×F)×((N+2×M)×F) sample elements. One module 41 of the oversampling matrix is shown in Fig. 4b, in which the sample elements 42 are also shown, in this example F=8, so the number of sample elements 42 in each module 41 is 8x8=64, which is shown in module 41. There are 28 modules on the X-axis and 28 modules on the Y-axis, the margin is two modules, N=28 and M=2, so the number of sample elements of the oversampling matrix is ((28+2x2)x8)x(28+2x2)x8)=256x256. From here, the rest of the data processing method can be carried out, for example, by converting the QR code. (Registered Trademark) The oversampling matrix, which contains the necessary information related to the location of the module in the QR code (step 1.5), is used as N=28. (Registered Trademark) Note that these are just examples of the number of modules in and are only used here to clarify the idea of the second step.
[0066] The second step of the correction method is the intensity step, which involves average intensity determination and intensity normalization. First, the average intensity is determined, i.e., calculated over the entire oversampling matrix. This can be done in several ways, e.g., for QR codes. (Registered Trademark) This can be done by using finder patterns 44 at three corners of 40, or by using the arithmetic mean of the sampling matrix. (Step 2.1)
[0067] The average intensity is then subtracted from the intensity of each sample element in the oversampling matrix, so that the sample elements corresponding to the dark and black modules become negative and the sample elements corresponding to the white and light modules become positive. For example, the intensity determination of the sample elements of the oversampling matrix may first give an intensity value of 0 to 255 for the sample elements. After subtraction of the average intensity, the range is -128 to 127, so that, for example, a sample element that initially has an intensity value of 0 corresponding to black has an intensity value of -128 after subtraction, and a sample element that initially has an intensity value of 100 corresponding to dark has an intensity value of -28 after subtraction. The intensity range is not limited to 0 to 255 in this example, but may be freely selected. An example of a module 41 containing the subtracted intensity values of the sample elements is shown in FIG. 4c. However, it should be noted that these intensity values in FIG. 4c are, again, merely examples of possible subtracted intensity values of the sample elements and are arranged simply to give an idea of this second step. (Step 2.2)
[0068] The third step of the method concerns the filtering of the intensity values in the oversampling matrix. First, the kernel size K of the linear 2D filter can be selected or it can be predefined. An example of a suitable filter is a uniform 5x5 box filter 43, such that each filter coefficient is 1 / 25. The filter may have a different size or shape. It is also possible to use, for example, a Gaussian filter instead of the box filter, or any other filter suitable to be used for this filtering of the intensity values. (Step 3.1)
[0069] The oversampling matrix and its intensity values are then filtered with this filter 42. As a result, the filter calculates the average value of each sample element when a box filter is used and a weighted average value of each sample element when several other filters are used, which are the intermediate sample elements in the filter 43. The average is calculated for each sample value 42 of the oversampling matrix. If there are not enough sample elements around the sample element placed to filter, those values remaining in the filter 43 are used to calculate the average value. Two examples of one central sample element are indicated by Ma1 and Ma2 inside the filter 43 in Fig. 4d. (Step 3.2)
[0070] As a result of this filtering operation, local maxima or minima are determined, i.e. the lowest or highest average value within each module 41. The local maxima or minima, or at least the areas near the local maxima or minima, are determined based on the original QR code that was not geometrically distorted. (Registered Trademark) of modules in that were not geometrically distorted, and which correspond to the centers of the modules, which are also the output of the method (step 3.3).
[0071] The fourth step of the method is to (Registered Trademark) The tracking can be done, for example, by using recursion. First, when recursion is used to track the center location of the module, the recursion starts by inserting the module coordinates of three known corners into a queue represented by Q. The known coordinates relate to the corners where the finder patterns 44 are located and whose coordinates correspond to the exterior corners of these patterns 44. The exterior corners are the corners of the QR code 40. (Registered Trademark)The corners of pattern 44 are the exterior corners of pattern 40. The coordinates are (0,0), (0,N-1) and (N-1,0), where N is the number of modules per direction, as explained in the first step. The module coordinates are different from the coordinates of the sample elements of the oversampling matrix. In addition to the module coordinates, information about the location of the center of the module in terms of the oversampling matrix coordinates and the color of the module is attached, i.e. stored in a data structure inserted in queue Q. The location of the center of the module is most likely a local maximum or minimum of the intensity calculated in the third step, or a sample element next to the local maximum or minimum. By default, both the location and the color of the center module are initially marked as "unknown". (step 4.1)
[0072] Queue Q now contains the data structure of the modules inserted into it in step 4.1. Then, for these modules, or for modules added to Q in a later stage of the fourth step whose center location and color have not yet been determined, i.e., their center location and color are unknown, the following steps 4.3-4.16 are performed for those modules in queue Q, one module at a time. Steps 4.3-4.16 form a recursive loop. (Step 4.2)
[0073] The first data structure of Q (containing module coordinates, center positions, and colors) is retrieved from queue Q for processing (step 4.3).
[0074] However, if the location and color of the center coordinates of the module in the data structure in queue Q are already known, e.g., they were determined in a previous round in which steps 4.3 to 4.16 were performed, then the next data structure in queue Q is retrieved for processing, i.e., the recursion continues back to step 4.3 (step 4.4).
[0075] If the center and color of a module in the data structure are not known, i.e., unknown, the recursion proceeds. A list of coordinates is created consisting of the x and y (x,y) coordinates of the module and the coordinates of its eight neighboring modules. The list thus contains the following coordinate pairs: (x-1,y-1), (x,y-1), (x+1,y-1), (x-1,y), (x,y)(x+1,y), (x-1,y+1), (x,y+1), and (x+1,y+1). This list may be denoted as LNXY, and the module whose data structure is currently under test may be referred to as, for example, module (x,y) 45 (shown in FIG. 4e). (Step 4.5)
[0076] The neighbor coordinates in the list can be separated, i.e., divided into two sets, set A containing neighboring modules with known center positions and colors of the modules, and set B containing neighboring modules with unknown center positions and colors of the modules. The number of neighbors in sets A and B are denoted by NA and NB, respectively. NA+NB=9. Module (x,y) 45 itself belongs to set B. The modules in sets A and B are shown in FIG. 4e (step 4.6).
[0077] Then, the sample element corresponding to the initial estimate of the center, i.e. the center estimate (Ex,Ey) 46 of the module (x,y) 45, is calculated using, i.e. based on, the information of the neighboring centers in the set A. For example, it can be assumed that the set A is composed of the modules (x-1,y) and (x+1,y). If the center of the module (x-1,y) is a sample element in the oversampled coordinates (Sx,Sy), it can be predicted that the center of the module (x,y) 45 is a sample element in the oversampled coordinates (Sx+F,Sy). Similarly, if the center of the module (x+1,y) is a sample element in the oversampled coordinates (Rx,Ry), we predict that the center of the module (x,y) 45 is a sample element in the oversampled coordinates (Rx-F,Ry). The final estimate is furthermore the average of the component estimates. In this example, the center estimate sample element is (Ex,Ey)=(Sx+F+Rx-F,Sy+Ry) / 2=((Sx+Rx) / 2,(Sy+Ry) / 2). (Step 4.7)
[0078] However, if set A is empty, i.e., there are no neighbors whose module center coordinates and color are known, then the estimate of the center of module (x,y) 45 may be set to be ((M+x+1 / 2)×F, (M+y+1 / 2)×F). However, if coordinate (x,y) is one of the three initial coordinates pushed into queue Q, i.e., QR code (Registered Trademark) Set A can be empty if and only if it is one of the exterior corners of the 40 finder patterns 44. (Step 4.8)
[0079] After estimating the sample element corresponding to the center estimate (Ex,Ey) 46 of the module (x,y) 45 in step 4.8, a list of nine offset sample element candidates x is formed, i.e., offset sample element candidates x are defined. The list includes the center estimate (Ex,Ey) 46 and eight offset sample element candidates x around (Ex,Ey) 46. The offset sample element candidates around (Ex,Ey) 46 form an offset sample element matrix 47 within the module (x,y) 45 and its neighboring modules. The actual center of the module (x,y) 45 may not be at (Ex,Ey) 46 determined in the estimation (step 4.7 or 4.8). Therefore, to determine whether the center is actually at a sample element of the center estimate (Ex,Ey) 46 or at an offset sample element next to the sample element of the center estimate (Ex,Ey) 46, eight sample elements around (Ex,Ey) 46 are also tested in addition to the sample element of the center estimate (Ex,Ey) 46. The offset sample element candidates are (dx,dy), where dx and dy belong to the set {-1,0,+1}. One of the offset sample elements in this list will be used to adjust the center of the module (x,y) 45, i.e., it becomes the actual, i.e., determined center of the module (x,y) 45. When the offset sample element candidates of the module (x,y) 45 are tested to determine whether the center of the module (x,y) 45 is actually at that position, the offset sample elements in the neighboring modules at the corresponding positions in the offset sample element matrix 47 are used in addition to the offset sample element candidates of the module (x,y). For example, if a top right offset sample element candidate of module (x,y) 45 is under test, then a top right offset sample element candidate in the offset sample element matrix 47 of the adjacent module is used. The top right offset sample element candidate is circled in Figure 4f.In general, in other examples of the correction method, instead of the nine offset sample element candidates, it is possible to use, for example, five offset sample element candidates, where the center sample element is again the sample element of the center estimate (Ex,Ey) 46 (estimated in step 4.7 or 4.8), and the other four offset sample elements are possible positions for the center of the module (x,y) 45 in addition to (Ex,Ey) 46 (step 4.9).
[0080] After this, the modules of set B, i.e. the set of all possible color combinations for the modules whose centers are still unknown, are arranged so as to be provided. There are 2^NB possible color combinations. Among the color combinations, -1 means black and +1 means white. For example, if there are four modules in B, the number of color combinations is 2^4=16. The possible color combinations, i.e. color combination hypotheses (CH), can be, for example, (-1,-1,-1,+1,+1,+1,+1,+1,+1) or (-1,-1,-1,+1,+1,-1,+1,+1,+1,+1). From these exemplary combinations, it turns out that in this example the first five colors are the same, i.e. they are the colors of the modules, the colors having been previously determined or at least known. The other last four are color possibilities, where the deviation of the exemplary combinations relates to the color of the sixth module. The first CH suggests that the sixth module is white (+1), and the second CH suggests that it is black (-1). (Step 4.10)
[0081] The following steps 4.11 to 4.16 are performed for each of the nine offset sample element candidates (OC) of the module (x,y) 45 (the estimated sample element (Ex,Ey) 46 and its surrounding eight offset sample elements), as well as for each color combination hypothesis (CH), i.e., steps 4.11 to 4.16 are performed 9×2^NB times, or in this example, 9×16 times.
[0082] The list indicated by the LSC, consisting of nine intensities of sample elements of offset sample element candidates (one for each module in set A and set B), is provided by reading the intensities from the oversampling matrix at the samples, i.e., coordinates (E+OC×F), where E=(Ex,Ey) 46 is the initial estimate defined in step 4.7. In other words, the offset sample element candidates of module (x,y) 45 are tested to determine whether the center of module (x,y) 45 is actually at that position, as explained in step 4.9. The offset sample elements in the neighboring modules at the corresponding positions in the offset sample element matrix 47 are used in addition to the offset sample element candidates of module (x,y), so that in the LSC list of each offset sample element candidate, nine intensities are determined, i.e., the intensity of the offset sample element candidate itself and the intensity of the offset sample element in the neighboring module at the corresponding position in the offset sample element matrix 47. And this is done for each offset sample element candidate of module (x,y) 45 (step 4.11).
[0083] After this, a list of nine color hypotheses (CH) corresponding to the intensities of the sample elements in the LSC list is provided. This list is denoted by List of Color Hypotheses (LCH), and for neighboring modules in set A, the known colors to the LCH are copied from the data structure corresponding to the modules of set A, and for neighboring modules in set B, hypotheses CH to the LCH are generated as illustrated in step 4.10 (step 4.12).
[0084] The LSC list and the LCH list are then correlated and the correlation result is stored. Correlation means that the elements in the lists are multiplied and added. The higher the correlation value, the more likely it is that the color combination hypothesis is correct and that the offset sample element candidate corresponds to the center of the module. For example, if the CH combination (-1,-1,-1,+1,-1,+1,+1,+1,+1) (when multiplied by the intensity of the fifth sample element candidate and after adding the multiplication result) provides the highest correlation value for the fifth offset sample element candidate corresponding to the sample element of (Ex,Ey) 46, then it is highly likely that the center of module (x,y) 45 is at (Ex,Ey) 46. The filtering step, the third step, above ensures that the correlation value increases towards the center of the module if the color hypothesis is correct, and this feature is the core of the module tracking procedure. (Step 4.13)
[0085] Therefore, the sample element corresponding to the offset sample element candidate with the highest correlation value may be selected for the center of the module (x,y) 45, as discussed in step 4.13. (step 4.14)
[0086] The sample element candidate selected in step 4.14 may then be stored in the data structure of module (x,y) 45 as the center of module (x,y) 45. The color of this sample element is obtained from the oversampling matrix provided in the third step. This color represents the color of module (x,y) 45 and is stored in the data structure of module (x,y) 45. (Step 4.15)
[0087] Add the module coordinates from the LNXY list to a queue Q (see step 4.5). This ensures that the recursion will traverse each module in the code (step 4.16).
[0088] After this, QR code (Registered Trademark) The correction method proceeds to the fifth step, which involves reading the information of the module. The result of the recursion is the QR code (Registered Trademark)The data structure stores the color of each module, and the QR code. (Registered Trademark) The color information is now the position of the module within the corrected QR code. (Registered Trademark) This can be used to read the information content of the corrected QR code, which substantially corresponds to the original QR code before it was geometrically distorted. (Registered Trademark) It may not be necessary to read the information content of the, but it may be stored for later use.
[0089] FIG. 5 shows, as an example, a geometrically distorted QR code with a modular structure. (Registered Trademark) The steps of a method 50 for correcting the QR code are shown in FIG. 5. In step 51, the QR code is oversampled by dividing each module into F×F sample elements to form an oversampling matrix. (Registered Trademark) 6. In step 52, for each sample element in the oversampling matrix, an intensity is determined. In step 53, the average intensity of the oversampling matrix is calculated. In step 54, the average intensity is subtracted from the intensity of each sample element in the oversampling matrix. In step 55, the intensity values are filtered to determine the average value of each sample element. In step 56, the sample element corresponding to the center of each module is tracked, and by using recursion, the color of each module is determined based on the intensity of the sample element corresponding to the center of each module. Step 56 of the method includes a recursion step as shown in FIG. 6.
[0090] Figure 6 shows, by way of example, the steps of a recursive method 60. In step 61, a queue Q is formed that contains a data structure of modules. The data structure includes the location of the center of the module, the color of the module, and the QR code. (Registered Trademark)In step 62, a LNXY list of x,y coordinates of module (x,y) and its eight neighbors is created for the data structure of module (x,y) which is the first data structure in queue Q and whose center position and color are unknown. In step 63, a sample element corresponding to a center estimate (Ex,Ey) of module (x,y) is calculated based on neighboring modules whose centers are known. In step 64, a predetermined number of offset sample element candidates OC are defined. The offset sample element candidates OC include the center estimate (Ex,Ey) and the sample elements around the center estimate (Ex,Ey). In step 65, a set of color combination hypotheses is provided for modules whose centers are unknown. After step 65, for each offset sample element candidate and for each color combination hypothesis, the following steps 66-69 are performed. In step 66, an LSC list containing the intensities of the offset sample element candidates OC is provided by reading the intensities of each offset sample element candidate from the oversampling matrix at coordinates (E+OC×F), where E is the center estimate (Ex,Ey). In step 67, an LCH list of nine color hypotheses (CH) corresponding to the intensities of the sample elements in the LSC list is provided. In step 68, the LSC list and the LCH list are correlated, and the correlation results are stored to determine the sample element corresponding to the offset sample element candidate with the highest correlation value for the center of the module (x,y). In step 69, the color of the module (x,y) is determined by choosing the intensity value of the offset sample element candidate with the highest correlation value from the oversampling matrix.
[0091] QR Code (Registered Trademark) In addition to using the color information of the data structure to read the information content of the QR code, (Registered Trademark) Using both the color of each module in the 40 and the position information of each module, the QR code is created so that the surface is no longer geometrically distorted. (Registered Trademark) It is possible to reshape, i.e. reconstruct, the surface on which the QR code is printed. (Registered Trademark)Then, for example, the original QR code (Registered Trademark) or to generate a duplicate of the corrected QR code. (Registered Trademark) Or it may be used in any other manner in which a corrected surface may be required.
[0092] It should be noted that in some exemplary embodiments, the order of method steps may be changed, the same method steps may be performed simultaneously, and / or some of the method steps need not be performed.
[0093] Various exemplary embodiments of the present invention may be implemented with the aid of computer program code residing in a memory and causing an associated device to perform the present invention. For example, a device may comprise circuitry and electronics for processing, receiving and transmitting image data, computer program code in a memory, and a processor that, upon execution of the computer program code, causes the device to perform features of the exemplary embodiments.
[0094] It is obvious that the invention is not limited solely to the above examples but it can be modified within the scope of the appended claims. The present application provides the following aspects of the invention. (Aspect 1) A geometrically distorted QR code including a modular structure is generated by computer means. (Registered Trademark) A method for correcting (40), comprising the steps of: said QR code by dividing each module (41) into F×F sample elements (42) to form an oversampling matrix; (Registered Trademark) Oversampling the modules of (40); determining an intensity of each sample element (42) in the oversampling matrix; calculating the average intensity of said oversampling matrix; subtracting the average intensity from the intensity of each sample element (42) in the oversampling matrix; filtering the intensity values to determine an average value for each sample element (42); and the method comprising tracking a sample element (42) corresponding to a center of each module (41) and determining the color of each module (41) based on the intensity of the sample element (42) corresponding to said center of each module (41) by using recursion. (Aspect 2) The recursion is forming a queue Q including a data structure of the modules (41), the data structure including the location of the center of the module (41), the color of the module (41), and the QR code (Registered Trademark) said forming including information regarding the location of the module (40) within the (40); for a first data structure in said queue Q, a data structure for a module (x,y) whose center position and color are unknown, creating an LNXY list of the x,y coordinates of said module (x,y) (45) and its eight neighbors; calculating a sample element corresponding to a center estimate (Ex,Ey) (46) of said module (x,y) (45) based on neighboring modules whose centers are known; defining a number of offset sample element candidates OC, the offset sample element candidates OC including the central estimate (Ex,Ey) (46) and sample elements surrounding the central estimate (Ex,Ey) (46); Providing a set of color combination hypotheses for modules with unknown centers; and For each offset sample element candidate, and for each color combination hypothesis, providing an LSC list including intensities of the offset sample element candidates OC by reading the intensities of each of the offset sample element candidates from the oversampling matrix at coordinates (E+OC×F), where E is the center estimate (Ex,Ey) (46); providing an LCH list of nine color hypotheses (CHs) corresponding to the intensities of sample elements in an LSC list, correlating the LSC list and the LCH list, and storing the correlation results for determining a sample element corresponding to the offset sample element candidate having the highest correlation value of the center of the module (x,y) (45); 2. The method of claim 1, comprising: determining the color of the module (x,y) (45) by choosing an intensity value of the offset sample element candidate from the oversampling matrix having a highest correlation value. (Aspect 3) The method further comprising: updating the data structure of the module (x,y) (45) with the determined center and color information of the module (x,y) (45); and 3. The method of embodiment 2, further comprising adding the module (x,y) (45) coordinates in the LNXY list to a queue Q. (Aspect 4) The method further comprises: (Registered Trademark) 4. The method of any one of aspects 1-3, further comprising oversampling a margin M around (40). (Aspect 5) 5. The method of claim 4, wherein the oversampling of the margin M is performed by dividing each module of the margin M into F×F sample elements for a portion of the oversampling matrix. (Aspect 6) The method further comprising: The QR code (Registered Trademark) 6. The method according to any one of the preceding aspects, further comprising reading color information from a data structure of a module for defining an information content of (40) (41). (Aspect 7) The method according to any one of aspects 3 to 6, wherein F is an integer of 4 or greater. (Aspect 8) Margin M is the QR code (Registered Trademark) The method according to any one of aspects 4 to 7, further comprising determining the number of modules to be processed in accordance with (40). (Aspect 9) 4. The method of claim 2 or 3, wherein the color combination hypotheses include all possible color combinations of said modules having unknown centers. (Aspect 10) 4. The method of claim 2 or 3, wherein when correlating an LSC list and an LCH list, the elements in the lists are multiplied and added. (Aspect 11) A computer program product embodied in a non-transitory computer-readable medium (14), the computer program product comprising computer instructions, the computer instructions being configured to perform the method of any one of aspects 1 to 10 when executed by at least one processor (12) of a system or device. (Aspect 12) A geometrically distorted QR code comprising means for carrying out the method according to any one of the first to tenth aspects. (Registered Trademark) A device (10) for correcting (40). (Aspect 13) The device (10) displays the geometrically distorted QR code. (Registered Trademark) an image sensor (11) for capturing an image of (40), or said geometrically distorted QR code; (Registered Trademark) 13. The device (10) of embodiment 12, comprising means (16) for receiving image data of (40). (Aspect 14) The device (10) is a mobile phone, a mobile computer, a tablet computer or a QR code. (Registered Trademark) 14. The device (10) according to embodiment 12 or 13, which is a scanner.
Claims
1. A method for correcting and interpreting, by computer means, an image of a geometrically distorted QR code (40) containing a modular structure, said method comprising: providing as input a geometrically distorted QR code (40) and the position coordinates of the three exterior corners of said QR code (40); oversampling the modules of the QR code (40) by dividing each module (41) into an average of F×F sample elements (42) to form an oversampling matrix, where F is an integer greater than 1; determining an intensity of each sample element (42) in the oversampled matrix, the sample elements (42) of the oversampled matrix having oversampled coordinates; The method further comprising: calculating the average intensity of said oversampling matrix; subtracting the average intensity from the intensity of each sample element (42) in the oversampling matrix; filtering the intensity values to determine an average value for each sample element (42); determining the position of a sample element (42) corresponding to the center of each module (41) and determining the color of each module (41) based on the intensity of the sample element (42) corresponding to said center of each module (41) by using recursion as follows: forming a queue Q including a data structure of the modules (41), the data structure including information regarding the location of the center of the modules (41), the color of the modules (41), and the location of the modules (41) within the QR code (40); For a data structure for a module (x, y), which is a first data structure in the queue Q whose center position and color are unknown, creating a first list of the module (x, y) (45) and its eight neighboring modules; Calculating a sample element (42) corresponding to estimated oversampled coordinates (Ex,Ey) (46) of the center of said module (x,y) (45) based on neighboring modules whose centers are known; defining a number of offset sample element candidates OC, the offset sample element candidates OC being (dx, dy), where dx and dy belong to the set {−1, 0, +1}; and Providing a set of color combination hypotheses for a module whose center is unknown; and For each offset sample element candidate, and for each color combination hypothesis, providing a second list containing the intensities of the offset sample element candidates OC by reading the intensities of each of the offset sample element candidates from the oversampling matrix around E and corresponding positions of adjacent modules, where E is the estimated oversampled coordinates (Ex,Ey) (46) of the center of the module (x,y) (45); providing a third list of nine color hypotheses (CH) corresponding to the intensities of the sample elements (42) in the second list, correlating the second and third lists and storing the correlation results for determining the sample element (42) corresponding to the offset sample element candidate having the highest correlation value of the center of the module (x, y) (45); determining the color of the module (x,y) (45) by choosing the intensity value of the offset sample element candidate having the highest correlation value from the oversampling matrix.
2. The method further comprising: updating the data structure of the module (x, y) (45) with the determined center and color information of the module (x, y) (45); and 2. The method of claim 1, further comprising adding the (x,y) (45) coordinates of modules in the first list to a queue Q.
3. The method of claim 1 or 2, further comprising oversampling a margin M around the QR code (40).
4. 4. The method of claim 3, wherein the oversampling of the margin M is performed by dividing each module of the margin M into FxF sample elements (42) for a portion of the oversampling matrix.
5. The method further comprising: The method according to any one of claims 1 to 4, further comprising reading color information from a data structure of a module (41) for defining the information content of the QR code (40).
6. The method according to any one of claims 2 to 5, wherein F is an integer of 4 or greater.
7. The method according to any one of claims 3 to 6, wherein a margin M determines the number of processed modules on the QR code (40).
8. 3. The method of claim 1, wherein when correlating the second list and the third list, the sample elements (42) in the second list and the third list are multiplied and added.
9. A computer program embodied on a non-transitory computer readable medium (14), the computer program comprising computer instructions configured to perform the method of any one of claims 1 to 8 when the computer instructions are executed by at least one processor (12) of a system or device.
10. A device (10) for correcting a geometrically distorted QR code (40), comprising means for implementing the method according to any one of claims 1 to 8.
11. The device (10) according to claim 10, wherein the device (10) comprises an image sensor (11) for capturing an image of the geometrically distorted QR code (40) or means (16) for receiving image data of the geometrically distorted QR code (40).
12. The device (10) according to claim 10 or 11, wherein the device (10) is a mobile phone, a mobile computer, a tablet computer or a QR code scanner.
Citation Information
Patent Citations
Decoding barcodes
US20160104022A1
