Method for generating an image integrated with a two-dimensional code
The method automatically integrates QR codes into images by minimizing dot visibility through strategic placement at image boundaries, addressing the aesthetic impairment and inefficiency of existing methods.
Patent Information
- Application Number
- JP2021142324
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2021-09-01
- Publication Date
- 2025-06-30
- Estimated Expiration
- 2041-09-01
AI Technical Summary
Existing methods for integrating QR codes into images often impair the design aesthetics due to conspicuous dots, and require manual placement of inspection points, making it inefficient for different images or locations.
A method for generating an image integrated with a QR code that automatically calculates luminance, binarizes the image, sets inspection points near the boundary, and arranges the QR code to minimize dots, thereby reducing noise and maintaining design aesthetics.
The method effectively minimizes the visibility of QR code dots by strategically placing them at image boundaries, resulting in an image where the QR code is less conspicuous, regardless of image changes or locations.
Smart Images

Figure 0007699770000003 
Figure 0007699770000004 
Figure 0007699770000005
Abstract
Description
Technical Field
[0001] The present invention relates to a method for generating an image integrated with a two-dimensional code such as a QR code (registered trademark). In particular, the present invention relates to a method for generating an image integrated with a two-dimensional code, in which the two-dimensional code is arranged without noise so as to contribute to the design of the image without impairing the aesthetics due to the adhesion of dots (stains) or the like.
Background Art
[0002] In recent years, with the popularization of smartphones, it has become possible to easily use the Internet using these terminals even when out and about. Along with this, in advertisements at stations, squares, etc., QR codes (registered trademarks) are widely used in consideration of being read by these terminals. The QR code is one of the two-dimensional codes developed by Denso Wave Incorporated in 1994. The QR code has information in both the vertical and horizontal directions and can read a large amount of information at high speed. There are QR codes from version 1 (or model 1) to version 40 (or model 40). Version 1 was the first one created, and even with error correction level L, it can handle only up to 41 digits of numbers. Version 2 is an improvement of version 1, and version 2 can handle 77 digits of numbers and 47 alphanumeric characters with error correction level L.
[0003] FIG. 1 schematically shows the content of version 2 (or model 2) of the QR code, in the case of error correction level M. The smallest black or white square cell that constitutes the symbol of the QR code is a module, and one module corresponds to one bit of data.
[0004] QR codes are also resistant to inclination and distortion during photography, and the information stored is encoded with Reed-Solomon (RS) codes, so information can be read without problems even if there is some dirt or damage. However, since QR codes are composed of a geometric pattern of black and white modules, when used in advertisements, promotions, etc. where design is required, there is a problem that the overall design is impaired.
Prior Art Documents
Patent Documents
[0005]
Patent Document 1
Patent Document 2
Summary of the Invention
Problems to be Solved by the Invention
[0006] Therefore, there is a need for a QR code that integrates a QR code and an image so that the design is not impaired in advertisements and the like. Conventionally, a QR code integrated with a logo mark has been disclosed. This QR code dots the modules, stores the result of binarizing the image corresponding to the filler code words, and when reading the image with a barcode reader, the modules where the reading results of the QR code and the image match are left as images, minimizing the modules to be added to the image and making them less conspicuous. Also, for the Reed-Solomon (RS) code used in the QR code, non-systematic encoding is performed, the location of the inspection points is placed in a less conspicuous place in the image, and when dots are added, they are made as inconspicuous as possible.
[0007] A check point is the redundancy of an error correction code. In a configuration method called a systematic code, when there is a code of length n bytes, information is put into the first k consecutive bytes (k < n) in sequence. That is, any k-byte information created is stored as it is and can be read. The remaining (n - k) bytes become the check point and are bytes uniquely determined by calculation from the k bytes. Also, a non-systematic code is a special configuration method of an RS code, where information can be put into any k bytes anywhere, and the remaining (n - k) bytes are calculated by a special method to obtain their values, thereby constituting an RS code as a whole. Its configuration method is also disclosed in general textbooks on coding theory, such as McWilliams-Sloane.
[0008] Since it is impossible to determine how the QR code modules corresponding to the check points will be, whether each module will be black (a black dot will be placed) or white (a white dot will be placed), any dot placed will not stand out. So, it means putting them at the boundary points of the image, so-called edges.
[0009] However, in the conventionally disclosed QR code, since the non-systematic coding is done by manually determining the location of the check points, when placing QR codes in different images or different locations of the same image, it is necessary to manually search again for the arrangement of the check points that makes the QR code least conspicuous.
[0010] The present invention has been made in view of such circumstances, and an object of the present invention is to provide an image integrated with a two-dimensional code capable of automatically selecting the location of the check points such that the dots of the two-dimensional code such as a QR code (registered trademark) are inconspicuous for any image.
Means for Solving the Problem
[0011] The present invention relates to a method for generating an image integrated with a two-dimensional code (QR code (registered trademark)). The above object of the present invention is achieved by calculating the luminance of the image, binarizing it into black and white, setting inspection points near the binarized boundary, arranging the two-dimensional code near the boundary, and arranging it at the minimum position while measuring the dots of the module to generate the image.
Effect of the Invention
[0012] Since the QR code is arranged at the black-and-white boundary of the image and the dots are automatically minimized by dot measurement, an image in which the dots of the QR code are less conspicuous can be obtained. When the color of the image changes, especially when converting to a black-and-white binarized image as a QR code, dots are given as inspection points of the RS code with respect to the position of the module of the QR code where the color changes from black to white or from white to black. Therefore, an image in which the dots of the QR code are less conspicuous can be obtained.
Brief Description of the Drawings
[0013]
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Embodiments for Carrying Out the Invention
[0014] When superimposing a QR code on an image, the image part overlapping with the module is conveniently not recognized as the corresponding module of the assumed QR code, that is, when binarized, it is determined to be black or white. However, the degree of freedom in determining whether it is black or white is not large (it cannot be freely selected and is restricted by the information to be stored and its RS encoding), and inevitably, the binarized image of the module (position) corresponding to the original image may be different from the binarized image of the module in the QR code. In this case, it will become noise, and the solution to the problem of how to reduce such noise is the present invention. The first is unstructured encoding. Moreover, not only that, but also due to the degree of freedom of which module of the QR code corresponds to which position of the original image and unstructured encoding, there is a degree of freedom in which symbol of the RS code is used as an information point, that is, which is used as a module. Using this degree of freedom, exploration is carried out to create a PAQR (Post Aesthetic QR) code with as little noise as possible.
[0015] In the present invention, a place where inspection points are difficult to notice is set as the boundary part between white and black when the image is binarized pixel by pixel, and a symbol including the bits placed on the boundary is set as a candidate for inspection points. A plurality of types (for example, 10 types) of combinations of inspection points with fewer dots are recorded, QR codes are created respectively, and finally, the one that is subjectively considered to have the least prominent QR code is selected. Here, a symbol is what is handled in the RS code, and in the case of a QR code, it is a block of 8 bits. One symbol of the RS code becomes 8 adjacent modules of the QR code.
[0016] First, unstructured encoding will be described.
[0017] By non-systematically encoding the RS code used for QR codes, the degree of freedom in the position of the padding code words can be increased. Non-systematic encoding is one of the encoding methods. For a normal RS code, if the code length is "n" and the number of information points is "k", the first k symbols are information points and the last (n - k) symbols are check points. This encoding method is called systematic encoding. On the other hand, in non-systematic encoding, the information points are arranged at arbitrary k positions, and the check points are arranged at the remaining (n - k) positions. By using this non-systematic encoding, the degree of freedom of nCk can be given to code generation.
[0018] To create a non-systematically encoded RS code, the relational expression HC t = 0 is used. For the RS code of QR codes, a shortened RS code using the finite field of GF(2 8 ) is used. When the code length is "n" and the number of information points is "k", the first half (255 - n) rows of the parity check matrix H are shortened, and the last n rows are utilized. When the primitive polynomial x 8 + x 4 + x 3 + x 2 + 1 = 0 has roots α, the parity check matrix H is as shown in Equation 1 below.
[0019]
Equation
[0020] (a) Arbitrarily select k symbols from symbol n as information points. Let these positions be l1, l2, ···, l k .
[0021] (b) Among the parity check matrix H, diagonalize the columns corresponding to the symbols other than the selected (n - k) symbols (the symbols to be check points) by row and column transformation. Let this matrix be H'.
[0022] (c)α n +α n Using the relationship of = 0, the value of the inspection point is derived by the following Equation 2. Here, a i,j is the element at the i-th row and j-th column of the parity check matrix H.
[0023]
Equation
[0024] Next, a conventional method for creating a QR code will be described with reference to the flowchart of FIG. 2.
[0025] First, the modules of the QR code are made small and dot-shaped so as not to be conspicuous (step S1). A general QR code reader uses ZXing, which is an open-source library. In this reader, since only the central part of the module is observed for black-and-white determination, the QR code can be read by placing the dot at the center of the module. Next, the image is binarized (step S2). Since the places that match the color of the dots of the QR code can still be read as they are, dots are not placed. Here, the dummy codeword is made to correspond to the result of binarizing the image so that it can be read as it is. Since arbitrary bits cannot be put in the inspection point, dots tend to remain in the image. Therefore, the inspection point is manually placed at a place where it is not conspicuous even when dots remain due to non-structured encoding (step S3). A plurality of QR codes are created while changing the position of the inspection point (step S4), and finally, the QR code with the least conspicuous dots is subjectively selected from among them (step S5).
[0026] In such a conventional creation method, since the positions of the inspection points are determined manually, QR codes cannot be created with various combinations of inspection points, so the created QR code is not necessarily the QR code with the least prominent dots. Also, every time the image is changed, it is necessary to manually search for the location of the inspection points. FIG. 3 is a QR code showing an example thereof.
[0027] Therefore, in the present invention, a method is proposed for automatically selecting inspection points so that the number of dots added is small and not prominent, and outputting a candidate QR code. That is, the present invention not only proposes a method for automatically determining the positions of the inspection points, but also a method for minimizing the number of dots to be printed. When it is necessary to print dots anyway, the dots are printed in unobtrusive places, that is, at the edges of the image.
[0028] FIG. 4 shows a configuration example of the present invention. A CPU (including an MPU or an MCU) 1 that performs overall control is connected to a ROM 2 that stores programs, constants, etc. and a RAM 3 that temporarily stores arithmetic data, etc. Also, connected to the CPU 1 are an image creation unit 10 that creates an image, a pixel measurement unit 11 that measures the RGB of the pixels of the image, a luminance value calculation unit 12 that calculates a luminance value y from the measured RGB data, an inspection point setting unit 13 that sets inspection points, a QR code creation unit 20 that creates and assigns a QR code, a dot measurement unit 21 that measures the number and amount of dots, a determination unit 22, and an arrangement unit 23, which are interconnected.
[0029] In such a configuration, an operation example will be described with reference to the flowchart shown in FIG. 5.
[0030] In the present invention, a QR code is arranged for an image so as to be integrated with the QR code in which dots are least noticeable. First, inspection points are automatically arranged at locations where they are not noticeable even if dots remain as described above. Modules of the QR code are configured so that the QR code can be recognized. That is, dots are placed. The location of the arrangement, which is the positional relationship between the QR code and the image, is automatically searched for, but it is assumed that the version of the QR code, the error correction level, the size, and the location to be arranged are determined before the search.
[0031] First, an image is created by an image creation unit 10 (step S10). Since the QR code reader processes the image by binarizing it into black and white, it is necessary to consider the image as one binarized into white and black. The binarization is performed for each pixel for the location where the QR code is to be arranged. That is, a pixel measurement unit 11 acquires RGB components for each pixel (step S20), and a luminance value calculation unit 12 calculates a luminance value y from the RGB values (step S21). Since the QR code determines its modules by binarization, the pixel here means the pixel of the image superimposed on the QR code. When the RGB components of the pixel for which the luminance value y is obtained are (r, g, b), the luminance value y is obtained by the following formula (3). (Formula 3) y = 0.299r + 0.587g + 0.114b The luminance value y is obtained by the above formula (3), and the threshold value y t is set to "110", and a determination unit 22 processes pixels with a threshold value y t of "110" or less as "1" (black) and pixels larger than the threshold value y t of "110" as "0" (white) (step S22).
[0032] By placing the bit of the inspection point near the light-dark boundary of the determination image of the bit placed at the light-dark boundary, it is considered that the dots become less conspicuous. Therefore, the inspection point setting unit 13 sets the inspection point at the black-and-white boundary (step S23). Then, the QR code creation unit 20 creates a QR code (step S24), and the placement unit 23 places the QR code at the inspection point (step S25). Then, the bits placed near the light-dark boundary of the image are examined. The target bits are the dummy code of the QR code and the inspection point, and the dot measurement unit 21 makes a determination within the range of the center of the target module (step S26). This range is set such that the side length is about half of the side length of the module, and is determined in consideration of the size of the dots to be added to the image. As an example, when the size of the QR code module is 20×20 pixels square and the size of the dots is 4×4 pixels square, the determination unit 22 makes a dot determination within the range of 8×8 pixels square at the center of the module. The bits placed near the boundary are the bits in which white and black pixels are mixed within this range when the image is binarized.
[0033] When referring to a bit, it means "0" or "1" that constitutes a symbol corresponding to the RS code, and a dot means a black or white dot placed in the module of the QR code. This is the color when binarized, and in the case of a color image, the dots are formed in a color that is not conspicuous against the background while considering the color when binarized.
[0034] RS symbols perform encoding and decoding in symbol units (8 bits each). Therefore, when using symbols with a large number of bits at the boundary as inspection points, the dots are less prominent. Thus, among the padding code words and symbols corresponding to inspection points, symbols that contain even 1 bit at the boundary are considered candidates for inspection points. However, symbols that have only the 1st and 8th bits as boundaries among those with only 1 bit at the boundary are exceptions. This is because when dots are placed on the opposite side of these bits on the QR code, the dots are placed far from the boundary and are thus more prominent. If the number of candidates for inspection points is insufficient for the required number of inspection points, symbols with only 1 bit at the boundary that were exceptions are also added to the candidates for inspection points.
[0035] Select inspection points from the candidates for inspection points in various combinations (step S27) and perform unstructured encoding. At this time, for the part corresponding to the padding code word, the average value of the luminance value y of the corresponding image is taken with respect to the range of dots, and the threshold value y t If it is "110" or less, it is set to "1", and the threshold value y t If it is greater than "110", it is set to "0". Then, at the location of the padding code word and the inspection points, count how many dots are to be added. The dots are added according to the following patterns A and B.
[0036] Pattern A: When white and black pixels are mixed in the range where the dot is placed, a dot is added regardless of the bit value. This is because when white and black are mixed in the range of the dot, if read as it is, it can be read as either, so a dot is added to prevent a reading error.
[0037] Pattern B: When the range where the dot is placed is all black or white, and the result of binarization does not correspond to the corresponding bit, a dot is added. In this way, while changing the selection method of inspection points, count the dots to be given, and record the combination of 10 inspection points in RAM3 starting from those with the fewest dots. This is because generally, the fewer the dots are given, the less conspicuous the dots are. Then, create and arrange QR codes for each combination of inspection points, and finally select the one that is subjectively considered to have the least conspicuous dots.
[0038] Place the QR code in the same image and location as the QR code created by the existing method, and check whether a QR code of the same level can be created. The version of the QR code is "4", the error correction level is L, the module is 20 pixels square, and the dot is 4 pixels square.
[0039] Figures 6(A) to (C) and Figure 7 are all image examples of the present invention, and in all of them, the dots are less conspicuous.
[0040] In the above description, the QR code (registered trademark) is taken as an example for explanation, but it can be similarly applied to other two-dimensional codes.
Explanation of Signs
[0041] 1 CPU 2 ROM 3 RAM 10 Image Creation Unit 11 Pixel Measurement Unit 12 Luminance Value Calculation Unit 13 Inspection Point Setting Unit 20 QR Code Creation Unit 21 Dot Measurement Unit 22 Judgment Unit 23 Arrangement Unit
Claims
1. A method for generating an image integrated with a two-dimensional code, which calculates the luminance of the image, binarizes it into black and white, sets inspection points near the binarized boundary, arranges the two-dimensional code near the boundary, and arranges it at the minimum position while measuring the dots of the module to generate the image. A method for generating an image integrated with a two-dimensional code, characterized by the above.
2. The method for generating an image integrated with a two-dimensional code according to claim 1, wherein when white and black pixels are mixed in the range where the dots are placed, the dots are given regardless of the bit value.
3. The method for generating an image integrated with a two-dimensional code according to claim 1, wherein when the range where the dots are placed is all black or white, and when the corresponding bit does not correspond to the binarized result, the dots are given.
4. The method for generating an image integrated with a QR code according to any one of claims 1 to 3, wherein the two-dimensional code is a QR code (registered trademark).
Citation Information
Patent Citations
Two-dimensional code with logo
JP2008015642A
Two dimensional code creation system and two dimensional code printing medium
JP2009042826A
Two-dimensional code generating device, two-dimensional code generating program, and two-dimensional code generating method
JP2014209338A
Information recording medium, transfer plate, manufacturing apparatus, and reading method
JP2020080065A
Composite code pattern, generating device, reading device, method, and program
JP2020161172A