Patent ID: 12260290

DESCRIPTION OF EMBODIMENTS

1. Outlines of Two-Dimensional Code, Generation Device, and Reading Device

(1) A two-dimensional code according to an embodiment includes a plurality of lines arranged in a second direction at an interval, and each line includes a plurality of cells that indicate a plurality of bits and are arranged in series in a first direction orthogonal to the second direction. Each of the plurality of cells is either a first data cell indicating a first value out of two values that the bits indicate, or a second data cell indicating a second value out of the two values that the bits indicate. The first data cell includes a first density region indicating the first value at a first position in the second direction. The second data cell includes a second density region indicating the second value at the first position, and a third density region adjacent to the second density region in the second direction. A difference in density between the first density region and the second density region is greater than a difference in density between the first density region and the third density region.

The difference in density between the first density region and the second density region being greater than the difference in density between the first density region and the third density region is, for example, that the first density region and the third density region are high-density regions while the second density region is a low-density region, or that the first density region and the third density region are low-density regions while the second density region is a high-density region. The first data cells and the second data cells have the aforementioned density regions of different patterns for representing the first value and the second value, respectively, and are arranged in series in the first direction, whereby a line is formed in the first direction. This allows the entire two-dimensional code to have visual regularity, and provide an impression of being well-arranged. In addition, since each of the cells provided in the respective lines arranged in parallel represents the first value or the second value, the values are represented at the positions having regularity. This facilitates acquisition of the values from the two-dimensional code.

(2) Preferably, the third density region is arranged adjacent to opposite sides, in the second direction, of the second density region. This allows the area of the third density region to be sufficiently provided with respect to the second density region. As a result, reduction in density due to the second density region is inhibited in the two-dimensional code as a whole, thereby providing an impression of being well-arranged.

(3) Preferably, the interval is twice or more as large as a width of the lines. This allows the third density regions to be easily arranged.

(4) Preferably, the third density region is formed from an end to the other end, in the first direction, of the second data cell. Thus, a line is formed in the first direction. This allows the entire two-dimensional code to have visual regularity, and provide an impression of being well-arranged.

(5) A generation device according to the embodiment is configured to generate a two-dimensional code. The two-dimensional code includes a plurality of lines arranged in a second direction at an interval, and each line includes a plurality of cells that indicate a plurality of bits and are arranged in series in a first direction orthogonal to the second direction. Each of the plurality of cells is either a first data cell indicating a first value out of two values that the bits indicate, or a second data cell indicating a second value out of the two values that the bits indicate. The first data cell includes a first density region indicating the first value at a first position in the second direction. The second data cell includes a second density region indicating the second value at the first position, and a third density region adjacent to the second density region in the second direction. A difference in density between the first density region and the second density region is greater than a difference in density between the first density region and the third density region.

In the two-dimensional code generated as described above, the first data cells and the second data cells have the density regions of different patterns for representing the first value and the second value, respectively, and are arranged in series in the first direction, whereby a line is formed in the first direction. This allows the entire two-dimensional code to have visual regularity, and provide an impression of being well-arranged. In addition, since each of the cells provided in the respective lines arranged in parallel represents the first value or the second value, the values are represented at the positions having regularity. This facilitates acquisition of the values from the two-dimensional code.

(6) A computer program according to the embodiment is configured to cause a computer to operate as a generation device for generating a two-dimensional code. The computer program causes the computer to generate a two-dimensional code. The two-dimensional code includes a plurality of lines arranged in a second direction at an interval, and each line includes a plurality of cells that indicate a plurality of bits and are arranged in series in a first direction orthogonal to the second direction. Each of the plurality of cells is either a first data cell indicating a first value out of two values that the bits indicate, or a second data cell indicating a second value out of the two values that the bits indicate. The first data cell includes a first density region indicating the first value at a first position in the second direction. The second data cell includes a second density region indicating the second value at the first position, and a third density region adjacent to the second density region in the second direction. A difference in density between the first density region and the second density region is greater than a difference in density between the first density region and the third density region.

In the two-dimensional code generated by the computer according to the computer program, the first data cells and the second data cells have the density regions of different patterns for representing the first value and the second value, respectively, and are arranged in series in the first direction, whereby a line is formed in the first direction. This allows the entire two-dimensional code to have visual regularity, and provide an impression of being well-arranged. In addition, since each of the cells provided in the respective lines arranged in parallel represents the first value or the second value, the values are represented at the positions having regularity. This facilitates acquisition of the values from the two-dimensional code.

(7) A reading device according to the embodiment is a device for reading a two-dimensional code, and includes: an input unit configured to input a captured image of the two-dimensional code; and a processing unit configured to process the captured image. The two-dimensional code includes a plurality of lines arranged in a second direction at an interval, and each line includes a plurality of cells that indicate a plurality of bits and are arranged in series in a first direction orthogonal to the second direction. Each of the plurality of cells is either a first data cell indicating a first value out of two values that the bits indicate, or a second data cell indicating a second value out of the two values that the bits indicate. The first data cell includes a first density region indicating the first value at a first position in the second direction. The second data cell includes a second density region indicating the second value at the first position, and a third density region adjacent to the second density region in the second direction. A difference in density between the first density region and the second density region is greater than a difference in density between the first density region and the third density region. The processing unit performs preprocessing on the captured image, applies reading positions, which are set in advance at the positions of the cells, to the captured image on which the preprocessing has been performed, and converts each of pixel values at the applied reading positions in the captured image into the first value or the second value.

In the two-dimensional code, since each of the cells provided in the respective lines arranged in parallel represents the first value or the second value, the values are represented at the positions having regularity. Thus, the data can be easily read by applying the preset reading positions.

(8) Preferably, the preprocessing includes detecting the size and arrangement of the two-dimensional code, and converting at least one of the detected size and arrangement according to the reading positions. This allows the preset reading positions to be easily applied.

(9) A computer program according to the embodiment is configured to cause a computer to operate as a reading device for reading a two-dimensional code. The two-dimensional code includes a plurality of lines arranged in a second direction at an interval, and each line includes a plurality of cells that indicate a plurality of bits and are arranged in series in a first direction orthogonal to the second direction. Each of the plurality of cells is either a first data cell indicating a first value out of two values that the bits indicate, or a second data cell indicating a second value out of the two values that the bits indicate. The first data cell includes a first density region indicating the first value at a first position in the second direction. The second data cell includes a second density region indicating the second value at the first position, and a third density region adjacent to the second density region in the second direction. A difference in density between the first density region and the second density region is greater than a difference in density between the first density region and the third density region. The computer is caused to execute: performing preprocessing on the captured image of the two-dimensional code; applying reading positions, which are set in advance at the positions of the cells, to the captured image on which the preprocessing has been performed; and converting each of pixel values at the applied reading positions in the captured image into the first value or the second value.

In the two-dimensional code, since each of the cells provided in the respective lines arranged in parallel represents the first value or the second value, the values are represented at the positions having regularity. Thus, the data can be easily read by applying the preset reading positions.

2. Examples of Two-Dimensional Code, Generation Device, and Reading Device

FIG.1is a schematic diagram showing an example of a two-dimensional code100according to the present embodiment. A two-dimensional code100A shown inFIG.1is an enlarged schematic view of the two-dimensional code100.FIG.2is an enlarged view of a portion A inFIG.1. InFIG.1andFIG.2, the horizontal direction and the vertical direction are defined as an X direction and a Y direction, respectively. The rightward direction is the positive direction in the X direction, and the upward direction is the positive direction in the Y direction.

With reference toFIG.1, the two-dimensional code100is, for example, a square having a length and a width of about 12 mm, and includes a plurality of lines L arranged in the X direction at intervals S. Each line L has a length (width) W in the X direction, and a length (height) H in the Y direction. The width W is sufficiently small with respect to the height H, and each line L has a vertically long shape. That is, the Y direction is the longitudinal direction, and the X direction is a direction (width direction) orthogonal to the longitudinal direction.

The two-dimensional code100is generated and outputted by a generation device1described later. The “output” means being displayed so as to be visually recognized by human eyes, for example, being digitally displayed on a display15of the generation device1, being transmitted to another device and digitally displayed on the device, or being printed on paper or the like by a printer16. The two-dimensional code100displayed as described above can be attached to the exterior of an article, and used.

A line L is obtained by arranging, in series in the Y direction, a plurality of cells for indicating a plurality of bits constituting data D. Each of the plurality of cells is either a first data cell101or a second data cell102. Out of the values of 0 and 1 that the bits indicate, the first data cell101indicates 0 (first value) while the second data cell102indicates 1 (second value). The number of the cells arranged in series in the Y direction is, for example, 14. In this case, the line L can represent 14 bits of data.

Each first data cell101includes a first density region103indicating 0 at a first position P in the X direction. The first position P is a position inside the line L, for example, the center, in the X direction, of the line L. The first density region103refers to a region of a pixel value indicating a first density. The first density is higher than the density of a base color of the two-dimensional code100, i.e., the color of the spaces between the lines L. When the color of the spaces between the lines Lis white, the first density is, for example, black, and the pixel value indicating the first density is 0. This makes the first density region103easily visible.

Preferably, the first data cell101includes fourth density regions106that are adjacent to the first density region103in the X direction. Each fourth density region106refers to a region of a pixel value indicating a fourth density. The fourth density is substantially equal to the density of the base color of the two-dimensional code100, i.e., the color of the spaces between the lines L. When the color of the spaces between the lines Lis white, the fourth density is, for example, white, and the pixel value indicating the fourth density is 255. This makes the first density region103more easily visible.

The second data cell102includes a second density region104indicating 1 at the first position P. The second density region104refers to a region of a pixel value indicating a second density, and the second density is lower than the first density. When the first density is black, the second density is, for example, white, and the pixel value indicating the second density is 255. Thus, at the first position P in the line L, 0s and 1s are represented according to the density change.

Preferably, the second data cell102includes third density regions105that are adjacent to the second density region104in the X direction. Each third density region105refers to a region of a pixel value indicating a third density, and the third density is substantially equal to the first density. When the first density is black, the third density is, for example, black, and the pixel value indicating the third density is 0. In other words, a difference between the first density and the second density is greater than a difference between the first density and the third density. This makes the second density region104more easily visible.

Since the plurality of cells are arranged in series in the Y direction, the line L extends in the Y direction and can be visually recognized. The width W of the line L corresponds to the width of the first density region103of the first data cell101.

As shown inFIG.2, the two-dimensional code100is represented by a plurality of segments SG arranged continuously in the X direction. The segments SG are regions into which the code100is divided such that each segment SG has a width d and a height H. The width d is equivalent to, for example, 2 pixels.

For example, the width W of the line L is not smaller than 1.5 times and not larger than 3 times the width d of the segment SG (1.5 d≤W≤3 d). Preferably, the width W of the line L is not smaller than 1.8 times and not larger than 2.5 times the width d of the segment SG (1.8 d≤W≤2.5 d). For example, the width W of the line Lis 2 d (W=2 d).

The interval S between adjacent lines L is not smaller than the width W of the line L (S≥W). Preferably, the interval S between adjacent lines L is not smaller than twice the width W of the line L (S≥2 W). Preferably, the interval S is not larger than 3 times the width W of the line L (S≤3 W). Thus, an adequate amount of information can be embedded in the two-dimensional code100. For example, the interval S between adjacent lines L is 4 times the width d of the segment SG (S=4 d=2 W).

Thus, as shown inFIG.1, the outputted two-dimensional code100looks like a roughly uniform gray rectangle to the human eyes. Therefore, although the presence of the two-dimensional code100is recognized, the code pattern thereof is difficult to see. As a result, when the two-dimensional code100is displayed or attached to the exterior of an article, the two-dimensional code100does not impair the appearance.

In an example described below, the width W of each line L is constant. This allows the two-dimensional code100to have overall uniformity and regularity, and provide an impression of being well-arranged. In another example, the width W of each line L may not necessarily be constant. In this case, the width W itself may be variable according to the data. This allows the data to be read via the width W of the line L.

A width W1of the third density region105is substantially equal to half a width W2of the second density region104(W1≈W2/2). The width W2of the second density region104substantially matches the width of the first density region103, matches the width W of the line L (W2≈W), and is twice the width d of the segment SG (W2=2 d). Therefore, the width W1of the third density region105is substantially half the width W of the line L, and matches the width d of the segment SG (W1≈W/2=d). In addition, a height H1of the third density region105is substantially equal to a height H2of the second density region104(H1≈H2).

Thus, the area of the third density region105is substantially equal to the area of the second density region104, and the density of the two-dimensional code100as a whole becomes substantially uniform. In addition, the black regions are continuous in the Y direction at the opposite ends, in the X direction, of the line L. Therefore, the line is visually recognized to be linear in the Y direction. This provides an impression that the entire two-dimensional code100has regularity.

FIG.3is an enlarged view of a portion B inFIG.1, and shows another specific example of the portion A. Specifically, with reference toFIG.3, each third density region105may exist inside the line L (type A). In the type A shown inFIG.3, the third density region105exists by a distance G1inside the end, in the X direction, of the first density region103. Alternatively, each third density region105may exist at a position away from the outer side of the line L (type B). In the type B shown inFIG.3, a gap of a distance G2is generated between the third density region105and an end, in the X direction, of the first density region103. Alternatively, the third density region105may exist only on one side of the second density region104(type C). In the type C shown inFIG.3, the third density region105is disposed only on the left side of the second density region104, and is not arranged on the right side.

In any of the types A to C, the black regions are continuous in the Y direction at the end in the X direction of the line L. Therefore, the line is visually recognized to be linear in the Y direction. This provides an impression that the entire two-dimensional code100has regularity.

The height H1of the third density region105may be somewhat smaller than the height H2of the second density region104(type D). In the type D shown inFIG.3, a gap of a distance G3is generated between an upper end of the third density region105and a lower end of the second density region104in the Y direction (H1<H2). The distance G3may be a distance that allows the density regions to be visually recognized as being continuous in the Y direction. Preferably, the distance G3is shorter than half the height H2of the second density region104(G3<H2/2). More preferably, the distance G3is shorter than 80% of the height H2of the second density region104(G3<H2×0.8). This allows the black regions to be continuous in the Y direction at the ends, in the X direction, of the line L when the two-dimensional code100is outputted with the size shown inFIG.1, for example. Therefore, the line is visually recognized to be linear in the Y direction. This provides an impression that the entire two-dimensional code100has regularity.

The two-dimensional code100according to the embodiment is generated by the generation device1.FIG.4is a schematic diagram showing a specific example of the configuration of the generation device1according to the embodiment. The generation device1is composed of, for example, a general computer including a processor11and a memory12. The processor11is, for example, a CPU (Central Processing Unit).

The memory12may be a primary storage device or a secondary storage device. The memory12has, stored therein, a program121to be executed by the processor11. The processor11executes the program121stored in the memory12to execute arithmetic processing.

The generation device1is connected to an input device14. The input device14is, for example, a keyboard or the like. Through the input device14, data D to be embedded in the two-dimensional code100is inputted to the generation device1. The data D is transferred to the processor11.

The generation device1is connected to an output device that outputs the generated two-dimensional code100. If output of the two-dimensional code100is digital display, the output device is, for example, the display15. If the two-dimensional code100is transmitted to another device to be digitally displayed on the device, the output device is, for example, a communication device13. Thus, the two-dimensional code100can be digitally displayed on the display15and the other device.

If output of the two-dimensional code100is printing the code100on paper or the like, the output device is, for example, the printer16. Thus, the generated two-dimensional code100can be printed on paper or the like.

The arithmetic processing executed by the processor11includes a generation process111. The generation process111includes generating the two-dimensional code100in which the data D is embedded. In the generation process111, the processor11represents 0 or 1 as a component of the data in each of the cells of the line L.

Specifically, with reference toFIG.5, for example, the two-dimensional code100has 28 lines L, and the processor11represents 14-bit values per line L. All the lines L may be used for data embedding, or at least a part of the lines L may be used for data embedding. For example, with two lines L at the both ends being excluded, 26 lines L may be used.

Each line L includes a plurality of cells R1to R16for indicating a plurality of bits. The cells R1to R16are continuously arranged in the Y direction. In the example shown inFIG.5, in order to represent 14-bit values per line L, each line L includes cells R1to R16. In this example, the top end cell R1and the bottom end cell R16are “Null”, so that the values are represented using the cells R2to R15.

The processor11assigns 0s and 1s as components of the data D to the cells R2to R15of each of the lines L in a prescribed order. For example, from left to right of the plurality of lines L, 0s and Is as components of the data D are assigned to the cells R2to R15in order. The cells R1and R16of each line L, which are “Null”, are treated as 0s, for example.

Assuming that 15th to 28th values (dl) of the data D are 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, these values are respectively assigned to the cells R2to R15of a second line L1from the left as shown inFIG.5.

According to the values assigned to the respective cells, the processor11determines each cell to be either a first data cell101or a second data cell102. Focusing on the line L1, the cells R1, R3, R10to R12, and R14to which 0s are assigned are determined to be first data cells101, and the cells R2, R4to R9, R13, and R15to which Is are assigned are determined to be second data cells102.

Therefore, the cells R2, R4to R9, R13, and R15of the line L1each include the white second density region104, and the black third density regions105adjacent to the second density region104. The cells R1, R3, R10to R12, and R14each include a first density region103. Thus, the line L1is visually recognized to be linear in the Y direction, and represents the values 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1.

The processor11similarly performs the generation process111on all the values of the data D, thereby generating the two-dimensional code100in which the data D is embedded.

The arithmetic processing executed by the processor11includes an output process112. The output process112is a process for outputting the generated two-dimensional code100, and includes, for example, causing the printer16to print the generated two-dimensional code100. As another example, the output process112may include causing the display15to display the generated two-dimensional code100.

The outputted two-dimensional code100is read by a reading device3, and restored to the data.FIG.6is a schematic diagram showing a specific example of the configuration of the reading device3according to the embodiment. The reading device3is composed of, for example, a general computer including a processor31and a memory32. The processor31is, for example, a CPU.

The memory32may be a primary storage device or a secondary storage device. The memory32has, stored therein, a program321to be executed by the processor31. The processor31executes the program321stored in the memory32to execute arithmetic processing.

The reading device3includes an input unit for inputting a captured image of the two-dimensional code100. The input unit is, for example, a camera34. In this case, a captured image of the two-dimensional code100photographed by the camera34is inputted to the reading device3. As another example, the input unit may be a communication device33for receiving an input of a captured image from another device, or may be a reading device for reading captured image data from a storage medium.

The reading device3is connected to an output device for outputting the data restored from the two-dimensional code100. The output device is, for example, a display35. As another example, the output device may be a printer36. Thus, the restored data is outputted.

The arithmetic processing executed by the processor31includes preprocessing311. In addition, the arithmetic processing includes a reading process312. The reading process312includes: applying a preset reading position to the captured image on which the preprocessing311has been performed; and reading information from the applied reading position in the captured image. Thus, the embedded data is restored from the two-dimensional code100.

The arithmetic processing executed by the processor31includes an output process313. The output process313is a process for outputting the restored data, and includes, for example, causing the display35to display the restored data. As another example, the output process313may include causing the printer36to print the restored data.

FIG.7is a flowchart showing an example of a method for reading the two-dimensional code100by the reading device3according to the embodiment.FIG.8toFIG.10illustrate a specific example of the reading method.

With reference toFIG.7, a captured image obtained by photographing the two-dimensional code100is inputted to the reading device3(step S101). The processor31of the reading device3executes the preprocessing311on the captured image (step S103).

Specifically, with reference toFIG.8, in step S101, the two-dimensional code is photographed with the camera34, of the reading device3, directed to the two-dimensional code. At this time, on the display35, a guide204is superimposed on an image34A for photographing. A user confirms, with the image34A for photographing, that the two-dimensional code fits in the guide204, and then photographs the two-dimensional code with the camera34. Thus, a captured image201in which the two-dimensional code exists at the position according to the guide204, can be obtained.

With reference toFIG.9, in step S103, the processor31generates a grayscale image202and a binarized image203from the captured image201. The grayscale image202thus generated enables extraction of edges to be used for tilt detection described later. The binarized image203thus generated allows the embedded data to be read out.

The processor31trims the grayscale image202within a predetermined trimming range to obtain a trimmed image205. The predetermined trimming range204A is a range according to the position of the guide204in the captured image201, and is the same range as the guide204, for example. Thus, the range to be processed can be reduced, thereby reducing the amount of subsequent processing.

The processor31calculates, from the trimmed image205, a tilt of the two-dimensional code in the captured image201. Various methods can be used for calculating the tilt. For example, the processor31applies an edge filter to the trimmed image205to extract edges. The processor31performs Hough transform on the obtained edge image to extract straight lines in the edge image. The processor31calculates the tilts of the extracted straight lines to calculate the tilt of the two-dimensional code in the captured image201.

The processor31detects reference positions from the binarized image203. The reference positions are, for example, four corners. Thus, preset reading positions can be applied to the binarized image203with reference to the reference positions.

Preferably, in detecting the four corners, the processor31tilts the binarized image203by a predetermined angle. The predetermined angle is an angle within a range from 0 degrees to 90 degrees, and is 5 degrees, for example. Thus, when the scanning direction is the horizontal or vertical direction, the sides of the two-dimensional code can be angled with respect to the scanning direction. Therefore, the four corners are easily detected.

Using the coordinates of the four corners extracted through the above preprocessing, the processor31arranges the binarized image203such that the two-dimensional code is disposed at a position and a tilt that allow the preset reading positions to be applicable, and applies the reading positions (step S105). The reading positions define the positions of the cells on the two-dimensional code. Thus, the processor31can obtain the values from the cells at the defined positions. The processor31obtains the data embedded in the two-dimensional code, from all the values obtained from the applied reading positions in the binarized image203(step S107).

The reading positions correspond to the method for generating the two-dimensional code100, and indicate the positions of the plurality of cells of the two-dimensional code100. In the example shown inFIG.10, each preset reading position is represented by a straight line M1and a straight line M2orthogonal to each other, and an intersection of these lines indicates the reading position.

In the case of the reading positions used for reading the two-dimensional code100shown inFIG.5, the intersections of the straight lines M1and the straight lines M2define in advance the positions inside the cells R1to R16of each line L, as the reading positions. In the example shown inFIG.10, a plurality of straight lines M1are arranged in parallel at intervals S. Specifically, 28 straight lines M1are arranged. A plurality of straight lines M2pass through the centers of gravity of the cells R1to R16of each line L. Therefore, the intersections of the straight lines M1and the straight lines M2are the positions inside the respective cells R1to R16of each line L.

In step S107, the processor31reads the pixel values at the positions corresponding to the intersections of the straight lines M1and the straight lines M2in the binarized image203. Focusing on a portion C of the second line L1from the bottom in the binarized image203shown in the upper stage ofFIG.10, and referring to an enlarged view of the portion C shown in the lower stage ofFIG.10, the processor31reads the pixel values at the intersections P1to P5of the straight lines M1and the straight lines M2in the binarized image203.

In this example, the pixel values at the intersections P1to P5are 255 (white), 0 (black), 255, 0, 0. In step S107, the processor31stores the correspondence between pixel values and data values in advance, and converts the pixel values to the corresponding data values. That is, in step S107, for example, the processor31converts, for each reading position, the pixel value of 0 to “0”, and the pixel value of 255 to “1”, and arranges the values in a prescribed reading order, thereby obtaining the data D. The processor31outputs the obtained data (step S109).

In the two-dimensional code100according to the embodiment, the cells in the plurality of lines L arranged in parallel at predetermined intervals in the X direction indicate the values of data. Therefore, it is possible to easily read the data by applying the reading positions that are set in advance according to the positions of the cells as shown inFIG.10.

3. Additional Notes

The present invention is not limited to the above-described embodiment, and various modifications thereof can be made.

REFERENCE SIGNS LIST

1generation device3reading device11processor12memory13communication device14input device15display16printer31processor32memory33communication device34camera34A image35display36printer100two-dimensional code100A two-dimensional code101first data cell102second data cell103first density region104second density region105third density region106fourth density region111generation process112output process121program201captured image202grayscale image203binarized image204guide204A trimming range205trimmed image311preprocessing312reading process313output process321programD dataG1distanceG2distanceG3distanceH heightH1heightH2heightL lineL1lineP first positionP1intersectionP2intersectionP3intersectionP4intersectionP5intersectionR1cellR10cellR11cellR12cellR13cellR14cellR15cellR16cellR2cellR3cellR4cellR5cellR6cellR7cellR8cellR9cellSG segment