JP6952846B2 - Two-dimensional code - Google Patents

Two-dimensional code Download PDF

Info

Publication number
JP6952846B2
JP6952846B2 JP2020130817A JP2020130817A JP6952846B2 JP 6952846 B2 JP6952846 B2 JP 6952846B2 JP 2020130817 A JP2020130817 A JP 2020130817A JP 2020130817 A JP2020130817 A JP 2020130817A JP 6952846 B2 JP6952846 B2 JP 6952846B2
Authority
JP
Japan
Prior art keywords
position detection
detection pattern
dimensional code
pattern
patterns
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2020130817A
Other languages
Japanese (ja)
Other versions
JP2020173874A (en
Inventor
豊 細金
豊 細金
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kyodo Printing Co Ltd
Original Assignee
Kyodo Printing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from JP2015237671A external-priority patent/JP6785546B2/en
Application filed by Kyodo Printing Co Ltd filed Critical Kyodo Printing Co Ltd
Priority to JP2020130817A priority Critical patent/JP6952846B2/en
Publication of JP2020173874A publication Critical patent/JP2020173874A/en
Application granted granted Critical
Publication of JP6952846B2 publication Critical patent/JP6952846B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、二次元コード、二次元コードの解析方法、二次元コードの解析装置及び二次元コードを解析するプログラムに関する。 The present invention relates to a two-dimensional code, a method for analyzing a two-dimensional code, a device for analyzing a two-dimensional code, and a program for analyzing a two-dimensional code.

二次元コードは、一次元コードと比較して、狭い面積に多くの情報を持つことができ、物品管理や、携帯電話を用いたウェブ誘導など、様々な用途で広く活用されている。二次元コードは色々な角度で撮影されるため、二次元コードの画像は、画面における大きさ又は向きが一定ではなく、画像の歪み及び画像のぼけ等が発生し得る。また、二次元コード自体が汚れている場合には、一部の画像が判別できない事態も発生し得る。 Compared with the one-dimensional code, the two-dimensional code can have a lot of information in a small area, and is widely used for various purposes such as article management and web guidance using a mobile phone. Since the two-dimensional code is photographed at various angles, the size or orientation of the two-dimensional code image is not constant on the screen, and image distortion and image blurring may occur. Further, when the two-dimensional code itself is dirty, a situation may occur in which some images cannot be discriminated.

マトリックス型の二次元コードは、一般に略正方形の形状であり、撮影された二次元コードの画像を元の形状に座標変換した上で、各セルの画素値に基づいて解析(デコード)処理が行われる。二次元コードは、撮影された画像内の位置を検出するため、所定形状の位置検出パターンを有する。解析時には、撮影した二次元コードの画像から位置検出パターンを検出し、位置検出パターンの位置関係に基づいて二次元コードの画像の座標変換を行って、画像の歪み又は画像のぼけ等の影響が補正されて、元の二次元コードの画像が作成される。二次元コードが有するメッセージの取り出しは、座標変換された後の画像に基づいて行われる。このように、位置検出パターンの検出は、解析の基礎となる処理であり、認識精度や、解析時間への影響が大きいので、位置検出パターンの検出処理は、解析処理の重要な要素である。 The matrix type two-dimensional code generally has a substantially square shape, and after the photographed two-dimensional code image is coordinate-converted to the original shape, analysis (decoding) processing is performed based on the pixel value of each cell. It is said. The two-dimensional code has a position detection pattern having a predetermined shape in order to detect a position in the captured image. At the time of analysis, the position detection pattern is detected from the captured two-dimensional code image, and the coordinate conversion of the two-dimensional code image is performed based on the positional relationship of the position detection pattern. It is corrected and an image of the original 2D code is created. The extraction of the message contained in the two-dimensional code is performed based on the image after the coordinate conversion. As described above, the detection of the position detection pattern is a process that is the basis of the analysis and has a large influence on the recognition accuracy and the analysis time. Therefore, the detection process of the position detection pattern is an important element of the analysis process.

また、一度に複数の二次元コードを同時に認識させるというニーズがある。例えば、棚に二次元コードを貼ったダンボールが同じ向きに複数配置されており、これらダンボールの棚卸をする場合、二次元コードをダンボールに近づけて一つ一つ認識させるよりも、遠くから一括して複数の二次元コードの認識ができると、作業効率が向上する。複数の物品の一括認識は、例えばRFID等を利用して行うことが知られているが、RFIDはメディア側にアンテナ等が必要なので、メディアが高コストになる。このような一括認識に対して、二次元コードを使用できれば、二次元コードは、例えば紙に印字するだけで使えるので、低コストになる。 In addition, there is a need to recognize a plurality of two-dimensional codes at the same time. For example, multiple cardboard boxes with two-dimensional codes attached to the shelves are arranged in the same direction, and when stocking these cardboard boxes, the two-dimensional codes are collectively recognized from a distance rather than being brought close to the cardboard boxes and recognized one by one. If multiple two-dimensional codes can be recognized, work efficiency will be improved. It is known that batch recognition of a plurality of articles is performed using, for example, RFID, but since RFID requires an antenna or the like on the media side, the cost of the media becomes high. If a two-dimensional code can be used for such batch recognition, the two-dimensional code can be used simply by printing it on paper, for example, resulting in low cost.

二次元コードの形状は、上述したように、一般にほぼ正方形の形状のものが使用されているが、二次元コードを物品の狭い部分に印刷する場合、又は、本の背表紙の様な幅の狭い部分に貼付する場合には、細長い形状の二次元コードを使用することが望まれる。 As described above, the shape of the two-dimensional code is generally almost square, but when the two-dimensional code is printed on a narrow part of an article, or as wide as the spine of a book. When affixing to a narrow part, it is desirable to use a two-dimensional code with an elongated shape.

特開2013−30184号公報Japanese Unexamined Patent Publication No. 2013-30184

例えば、特許文献1には、細長い形状の二次元コードが提案されている。 For example, Patent Document 1 proposes a two-dimensional code having an elongated shape.

しかし、特許文献1に記載されている細長い形状の二次元コードは、1個の位置検出パターンしか備えていない。 However, the elongated two-dimensional code described in Patent Document 1 has only one position detection pattern.

位置検出パターンを1個のみ備える二次元コードでは、撮影された二次元コードの画像において、位置検出パターンを画像に写り込むノイズ情報と明確に切り分ける必要がある。特に、汚れ又は画像のブレのために、唯一の位置検出パターンが識別できない場合には、二次元コードの解析が行えないおそれが生じる。 In a two-dimensional code having only one position detection pattern, it is necessary to clearly separate the position detection pattern from the noise information reflected in the image in the captured image of the two-dimensional code. In particular, if the only position detection pattern cannot be identified due to dirt or image blurring, there is a risk that the two-dimensional code cannot be analyzed.

例えば、上述した複数の二次元コードが1つの画像に撮影される棚卸しの例では、全ての二次元コードに撮影のフォーカスを合わせることは困難であり、ぼけが生じやすい。一般にぼけ・ブレが生じた二次元コードの画像の補正は困難なので、ソフトウェアでの改善には限界があり、オートフォーカス機能、シャッタースピードを上げる等のハードウェアの改善を用いてぼけ・ブレを解決する必要があり、そのためにコストが増加するという問題がある。最近では、携帯電話に設けられたカメラで二次元コードを認識するというニーズがあるが、撮影時のカメラの傾き、ブレ、フォーカスが不十分であるために生じるぼけ等、二次元コードの解析においては問題の生じやすい撮影環境にあり、コスト・サイズの関係からも、携帯電話のカメラ等の改善は困難な場合が多い。 For example, in the above-mentioned inventory example in which a plurality of two-dimensional codes are photographed in one image, it is difficult to focus the photography on all the two-dimensional codes, and blurring is likely to occur. Generally, it is difficult to correct the image of a two-dimensional code that has blur / blur, so there is a limit to the improvement with software, and the blur / blur is solved by improving the hardware such as the autofocus function and increasing the shutter speed. There is a problem that it is necessary to do so, which increases the cost. Recently, there is a need to recognize a two-dimensional code with a camera installed in a mobile phone, but in the analysis of a two-dimensional code such as tilting of the camera at the time of shooting, blurring, and blurring caused by insufficient focus. Is in a problem-prone shooting environment, and it is often difficult to improve mobile phone cameras, etc. due to cost and size.

なお、一般的な二次元コードは誤り訂正機能を有するが、これは二次元コードが有するメッセージの誤りを訂正する機能であり、位置検出パターンを訂正する機能ではないので、位置検出パターンに汚れ・欠けが発生すると、二次元コードの認識が困難となる。 A general two-dimensional code has an error correction function, but this is a function for correcting a message error of the two-dimensional code, not a function for correcting a position detection pattern, so that the position detection pattern is dirty. When a chip occurs, it becomes difficult to recognize the two-dimensional code.

本明細書では、上述した課題を解決し得る二次元コードを提供することを課題とする。 An object of the present specification is to provide a two-dimensional code that can solve the above-mentioned problems.

また、本明細書では、上述した課題を解決し得る二次元コードの解析方法を提供することを課題とする。 Another object of the present specification is to provide a method for analyzing a two-dimensional code that can solve the above-mentioned problems.

また、本明細書では、上述した課題を解決し得る二次元コードの解析装置を提供することを課題とする。 Another object of the present specification is to provide a two-dimensional code analysis device capable of solving the above-mentioned problems.

更に、本明細書では、上述した課題を解決し得る二次元コードを解析するプログラムを提供することを課題とする。 Further, it is an object of the present specification to provide a program for analyzing a two-dimensional code that can solve the above-mentioned problems.

本明細書に開示する二次元コードによれば、二次元のマトリックス状のパターンとして配置され、二進コードで表されるデータを表す複数のセルと、単独で画像から検出可能な2個以上の異なる位置検出パターンと、を備え、各上記位置検出パターンの外形は四角形であり、一の上記位置検出パターンの対向する一対の辺を、辺の延びる方向に延長した一対の延長線の内部に、全ての他の上記位置検出パターンそれぞれが、少なくとも一部が重なるように配置されている。 According to the two-dimensional code disclosed herein, a plurality of cells arranged as a two-dimensional matrix-like pattern and representing data represented by the binary code, and two or more cells that can be independently detected from an image. Each of the above position detection patterns is provided with different position detection patterns, and the outer shape of each of the above position detection patterns is a quadrangle. Each of all the other position detection patterns is arranged so that at least a part of them overlap.

また、本明細書に開示する他の二次元コードによれば、二次元のマトリックス状のパターンとして配置され、二進コードで表されるデータを表す複数のセルと、単独で画像から検出可能な2個以上の異なる位置検出パターンと、を備え、一の上記位置検出パターンの輪郭上の対向する一対の点を、所定の方向に平行に延長した一対の延長線の内部に、全ての他の上記位置検出パターンそれぞれが、少なくとも一部が重なるように配置されており、全てのセルは、一対の上記延長線の内部に配置されている。 Further, according to other two-dimensional codes disclosed in the present specification, they are arranged as a two-dimensional matrix-like pattern, and can be detected independently from an image with a plurality of cells representing data represented by the binary code. With two or more different position detection patterns, all the other inside a pair of extension lines extending parallel to a predetermined direction from a pair of opposing points on the contour of one of the above position detection patterns. Each of the position detection patterns is arranged so as to overlap at least a part thereof, and all the cells are arranged inside the pair of the extension lines.

また、本明細書に開示する二次元コードの解析方法によれば、上述した二次元コードの解析方法であって、撮影された二次元コードの画像に基づいて、少なくとも3個の上記位置検出パターンが識別された場合には、識別された少なくとも3個の上記位置検出パターンの内から少なくとも1個の上記位置検出パターンを選択して、選択された上記位置検出パターンから合計4点の座標を取得し、取得された4点の座標に基づいて、二次元コードの画像の座標変換を行い、撮影された二次元コードの画像に基づいて、2個の上記位置検出パターンが識別された場合には、識別された2個の上記位置検出パターンの内から少なくとも1個の上記位置検出パターンを選択して、選択された上記位置検出パターンから合計4点の座標を取得し、取得された4点の座標に基づいて、二次元コードの画像の座標変換を行い、撮影された二次元コードの画像に基づいて、1個の上記位置検出パターンが識別された場合には、識別された1個の上記位置検出パターンから4点の座標を取得して、取得された4点の座標に基づいて、二次元コードの画像の座標変換を行う。 Further, according to the two-dimensional code analysis method disclosed in the present specification, at least three of the above-mentioned position detection patterns are based on the captured two-dimensional code image in the above-mentioned two-dimensional code analysis method. When is identified, at least one of the identified position detection patterns is selected from the identified position detection patterns, and the coordinates of a total of four points are acquired from the selected position detection patterns. Then, the coordinates of the image of the two-dimensional code are converted based on the acquired coordinates of the four points, and when the two above-mentioned position detection patterns are identified based on the captured image of the two-dimensional code. , At least one of the two identified position detection patterns is selected, and the coordinates of a total of four points are acquired from the selected position detection pattern, and the acquired four points are obtained. When the coordinates of the image of the two-dimensional code are converted based on the coordinates and one of the above position detection patterns is identified based on the captured image of the two-dimensional code, the identified one of the above The coordinates of four points are acquired from the position detection pattern, and the coordinates of the image of the two-dimensional code are converted based on the acquired coordinates of the four points.

また、本明細書に開示する二次元コードの解析装置によれば、上述した二次元コードの解析装置であって、撮影された二次元コードの画像に基づいて、少なくとも3個の上記位置検出パターンが識別された場合には、識別された少なくとも3個の上記位置検出パターンの内から少なくとも1個の上記位置検出パターンを選択して、選択された上記位置検出パターンから合計4点の座標を取得し、取得された4点の座標に基づいて、二次元コードの画像の座標変換を行い、撮影された二次元コードの画像に基づいて、2個の上記位置検出パターンが識別された場合には、識別された2個の上記位置検出パターンの内から少なくとも1個の上記位置検出パターンを選択して、選択された上記位置検出パターンから合計4点の座標を取得し、取得された4点の座標に基づいて、二次元コードの画像の座標変換を行い、撮影された二次元コードの画像に基づいて、1個の上記位置検出パターンが識別された場合には、識別された1個の上記位置検出パターンから4点の座標を取得して、取得された4点の座標に基づいて、二次元コードの画像の座標変換を行う。 Further, according to the two-dimensional code analysis device disclosed in the present specification, the above-mentioned two-dimensional code analysis device is the above-mentioned two-dimensional code analysis device, and at least three of the above-mentioned position detection patterns are based on the captured image of the two-dimensional code. When is identified, at least one of the identified position detection patterns is selected from the identified position detection patterns, and the coordinates of a total of four points are acquired from the selected position detection patterns. Then, the coordinates of the image of the two-dimensional code are converted based on the acquired coordinates of the four points, and when the two above-mentioned position detection patterns are identified based on the captured image of the two-dimensional code. , At least one of the two identified position detection patterns is selected, and the coordinates of a total of four points are acquired from the selected position detection pattern, and the acquired four points are obtained. When the coordinates of the image of the two-dimensional code are converted based on the coordinates and one of the above position detection patterns is identified based on the captured image of the two-dimensional code, the identified one of the above The coordinates of four points are acquired from the position detection pattern, and the coordinates of the image of the two-dimensional code are converted based on the acquired coordinates of the four points.

更に、本明細書に開示する二次元コードを解析するプログラムによれば、上述した二次元コードの解析をコンピュータに実行させるプログラムであって、撮影された二次元コードの画像に基づいて、少なくとも3個の上記位置検出パターンが識別された場合には、識別された少なくとも3個の上記位置検出パターンの内から少なくとも1個の上記位置検出パターンを選択して、選択された上記位置検出パターンから合計4点の座標を取得し、取得された4点の座標に基づいて、二次元コードの画像の座標変換を行い、撮影された二次元コードの画像に基づいて、2個の上記位置検出パターンが識別された場合には、識別された2個の上記位置検出パターンの内から少なくとも1個の上記位置検出パターンを選択して、選択された上記位置検出パターンから合計4点の座標を取得し、取得された4点の座標に基づいて、二次元コードの画像の座標変換を行い、撮影された二次元コードの画像に基づいて、1個の上記位置検出パターンが識別された場合には、検出された1個の上記位置検出パターンから4点の座標を取得して、取得された4点の座標に基づいて、二次元コードの画像の座標変換を行うことを、コンピュータに実行させる。 Further, according to the program for analyzing the two-dimensional code disclosed in the present specification, the program causes the computer to execute the above-mentioned analysis of the two-dimensional code, and is at least three based on the captured image of the two-dimensional code. When the above-mentioned position detection patterns are identified, at least one of the above-mentioned position detection patterns identified is selected from the above-mentioned position detection patterns, and the total is totaled from the selected above-mentioned position detection patterns. The coordinates of the four points are acquired, the coordinates of the image of the two-dimensional code are converted based on the acquired coordinates of the four points, and the two above-mentioned position detection patterns are generated based on the captured image of the two-dimensional code. When identified, at least one of the two identified position detection patterns is selected, and the coordinates of a total of four points are acquired from the selected position detection pattern. The coordinates of the image of the two-dimensional code are converted based on the acquired coordinates of the four points, and when one of the above position detection patterns is identified based on the captured image of the two-dimensional code, it is detected. The coordinates of four points are acquired from the one said position detection pattern, and the computer is made to execute the coordinate conversion of the image of the two-dimensional code based on the acquired coordinates of the four points.

上述した本明細書に開示する二次元コードによれば、物品等の狭い部分に配置可能であり、複数の二次元コードを同時に撮影する場合、又は、ぼけ・ブレが発生し易い環境での撮影等、様々な撮影条件で撮影された場合にも、二次元コードの正確な認識を短時間で行うことできる。 According to the two-dimensional code disclosed in the present specification described above, the two-dimensional code can be arranged in a narrow part such as an article, and when a plurality of two-dimensional codes are photographed at the same time, or in an environment where blurring / blurring is likely to occur. Even when shooting under various shooting conditions such as, it is possible to accurately recognize the two-dimensional code in a short time.

また、上述した本明細書に開示する他の二次元コードによれば、物品等の狭い部分に配置可能であり、複数の二次元コードを同時に撮影する場合、又は、ぼけ・ブレが発生し易い環境での撮影等、様々な撮影条件で撮影された場合にも、二次元コードの正確な認識を短時間で行うことできる。 Further, according to the other two-dimensional code disclosed in the present specification described above, the two-dimensional code can be arranged in a narrow part such as an article, and when a plurality of two-dimensional codes are photographed at the same time, or blurring / blurring is likely to occur. Accurate recognition of the two-dimensional code can be performed in a short time even when shooting under various shooting conditions such as shooting in an environment.

また、上述した本明細書に開示する二次元コードの解析方法によれば、上述した二次元コードを解析することができる。 Further, according to the above-described two-dimensional code analysis method disclosed in the present specification, the above-mentioned two-dimensional code can be analyzed.

また、上述した本明細書に開示する二次元コードの解析装置によれば、上述した二次元コードを解析することができる。 Further, according to the above-mentioned two-dimensional code analysis device disclosed in the present specification, the above-mentioned two-dimensional code can be analyzed.

更に、上述した本明細書に開示する二次元コードを解析するプログラムによれば、上述した二次元コードを解析することができる。 Further, according to the above-mentioned program for analyzing the two-dimensional code disclosed in the present specification, the above-mentioned two-dimensional code can be analyzed.

本明細書に開示する第1実施形態の二次元コードを示す図である。It is a figure which shows the 2D code of 1st Embodiment disclosed in this specification. 二次元コードのデータ部を説明する図である。It is a figure explaining the data part of a two-dimensional code. (A)〜(D)は、一対の延長線と他の二次元コードとの関係の例を説明する図である。(A) to (D) are diagrams for explaining an example of the relationship between a pair of extension lines and another two-dimensional code. (A)〜(L)は、位置検出パターンの様々な形態を示す図である。(A) to (L) are diagrams showing various forms of position detection patterns. (A)及び(B)は、位置検出パターンの他の形態を示す図である。(A) and (B) are diagrams showing other forms of the position detection pattern. (A)〜(E)は、位置検出パターンの更に他の形態を示す図である。(A) to (E) are diagrams showing still another form of the position detection pattern. (A)〜(F)は、位置検出パターンの更にまた他の形態を示す図である。(A) to (F) are diagrams showing still another form of the position detection pattern. 本明細書に開示する第1実施形態の二次元コードの変形例1を示す図である。It is a figure which shows the modification 1 of the 2D code of 1st Embodiment disclosed in this specification. 本明細書に開示する第1実施形態の二次元コードの変形例2を示す図である。It is a figure which shows the modification 2 of the 2D code of 1st Embodiment disclosed in this specification. 本明細書に開示する第1実施形態の二次元コードが印刷されたカードを示す図である。It is a figure which shows the card which printed the 2D code of 1st Embodiment disclosed in this specification. 本明細書に開示する第1実施形態の二次元コードの変形例2が貼付された本を示す図である。It is a figure which shows the book to which the modification 2 of the 2D code of 1st Embodiment disclosed in this specification is attached. (A)は、本明細書に開示する第2実施形態の二次元コードを示す図であり、(B)は、第2実施形態の二次元コードの変形例を示す図である。(A) is a diagram showing a two-dimensional code of the second embodiment disclosed in the present specification, and (B) is a diagram showing a modified example of the two-dimensional code of the second embodiment. 本明細書に開示する二次元コードの作成方法を説明するフローチャートである。It is a flowchart explaining the method of creating a 2D code disclosed in this specification. 本明細書に開示する二次元コードの解析装置を説明する図である。It is a figure explaining the 2D code analysis apparatus disclosed in this specification. 本明細書に開示する二次元コードの解析方法を説明するフローチャート(その1)である。It is a flowchart (the 1) explaining the analysis method of the two-dimensional code disclosed in this specification. 本明細書に開示する二次元コードの解析方法を説明するフローチャート(その2)である。It is a flowchart (the 2) explaining the analysis method of the two-dimensional code disclosed in this specification. 本明細書に開示する二次元コードの解析方法を説明するフローチャート(その3)である。It is a flowchart (the 3) explaining the analysis method of the two-dimensional code disclosed in this specification. 位置検出パターン候補の形状チェックを説明する図である。It is a figure explaining the shape check of the position detection pattern candidate. 位置検出補正パターンの形状チェックを説明する図である。It is a figure explaining the shape check of the position detection correction pattern. 本明細書に開示する二次元コードの解析方法を説明するフローチャート(その4)である。It is a flowchart (the 4) explaining the analysis method of the two-dimensional code disclosed in this specification. 検出された3個の位置検出パターン候補から合計4点の座標を取得することを説明する図である。It is a figure explaining that the coordinates of a total of 4 points are acquired from 3 detected position detection pattern candidates. (A)〜(C)は、検出された2個の位置検出パターン候補から合計4点の座標を取得することを説明する図である。FIGS. (A) to (C) are diagrams for explaining that the coordinates of a total of four points are acquired from the two detected position detection pattern candidates. (A)〜(C)は、検出された1個の位置検出パターン候補から合計4点の座標を取得することを説明する図である。FIGS. (A) to (C) are diagrams for explaining that the coordinates of a total of four points are acquired from one detected position detection pattern candidate.

以下、本明細書で開示する二次元コードの好ましい第1実施形態を、図を参照して説明する。但し、本発明の技術範囲はそれらの実施形態に限定されず、特許請求の範囲に記載された発明とその均等物に及ぶものである。 Hereinafter, a preferred first embodiment of the two-dimensional code disclosed in the present specification will be described with reference to the drawings. However, the technical scope of the present invention is not limited to those embodiments, but extends to the inventions described in the claims and their equivalents.

図1は、本明細書に開示する第1実施形態の二次元コードを示す図である。 FIG. 1 is a diagram showing a two-dimensional code of the first embodiment disclosed in the present specification.

本実施形態の二次元コード10は、図1に示すように、所定の方向に延びる形状を備えており、図1に示す例では、横長の形状を備える。 As shown in FIG. 1, the two-dimensional code 10 of the present embodiment has a shape extending in a predetermined direction, and in the example shown in FIG. 1, it has a horizontally long shape.

二次元コード10は、二次元コードが撮影された画像において二次元コードの位置を検出するために使用される複数の位置検出パターン12A、12B、12Cと、メッセージ等の情報を有するデータ部11を備える。 The two-dimensional code 10 includes a plurality of position detection patterns 12A, 12B, 12C used for detecting the position of the two-dimensional code in the image in which the two-dimensional code is taken, and a data unit 11 having information such as a message. Be prepared.

二次元コード10は、単独で画像から検出可能な2個以上の異なる位置検出パターンを備える。本実施形態では、二次元コード10は、3つ異なる位置検出パターン12A、12B、12Cを備える。なお、二次元コード10は、4個以上の位置検出パターンを備えていてもよい。 The two-dimensional code 10 includes two or more different position detection patterns that can be detected independently from an image. In the present embodiment, the two-dimensional code 10 includes three different position detection patterns 12A, 12B, and 12C. The two-dimensional code 10 may include four or more position detection patterns.

具体的には、二次元コード10は、長手方向の左端に配置される第1位置検出パターン12Aと、長手方向の中央部に配置される第2位置検出パターン12Bと、長手方向の右端に配置される第3位置検出パターン12Cを備える。 Specifically, the two-dimensional code 10 is arranged at the first position detection pattern 12A arranged at the left end in the longitudinal direction, the second position detection pattern 12B arranged at the central portion in the longitudinal direction, and the right end in the longitudinal direction. The third position detection pattern 12C is provided.

第1位置検出パターン12Aと第2位置検出パターン12Bとの間には、データ部11が配置される。また、第2位置検出パターン12Bと第3位置検出パターン12Cとの間にも、データ部11が配置される。データ部11は、一対の延長線Lの内部から外部へ亘って配置されているが、データ部11を構成するセルが、一対の延長線Lの外部に配置される領域は、一対の延長線Lの幅の50%以内、特に20%以内、更に10%以内であることが、二次元コード10の幅を狭くする観点から好ましい。 A data unit 11 is arranged between the first position detection pattern 12A and the second position detection pattern 12B. Further, the data unit 11 is also arranged between the second position detection pattern 12B and the third position detection pattern 12C. The data unit 11 is arranged from the inside to the outside of the pair of extension lines L, but the area where the cells constituting the data unit 11 are arranged outside the pair of extension lines L is a pair of extension lines. It is preferably within 50%, particularly within 20%, and further within 10% of the width of L from the viewpoint of narrowing the width of the two-dimensional code 10.

各位置検出パターン12A、12B、12Cの外形は四角形であり、一の位置検出パターン12Aの対向する一対の辺を、仮想的に辺の延びる方向に延長した一対の延長線Lの内部に、全ての他の2つの位置検出パターン12B、12Cそれぞれが、少なくとも一部が重なるように配置されている。 The outer shape of each position detection pattern 12A, 12B, 12C is a quadrangle, and the pair of opposite sides of one position detection pattern 12A are all inside the pair of extension lines L that are virtually extended in the extending direction of the sides. The other two position detection patterns 12B and 12C are arranged so that at least a part of them overlap.

図1に示す二次元コードの例では、第2位置検出パターン12Bは、その対向する一対の辺が、一対の延長線Lと重なるように配置されており、第2位置検出パターン12Bの全体が、一対の延長線Lの内部に重なるように配置されている。 In the example of the two-dimensional code shown in FIG. 1, the second position detection pattern 12B is arranged so that the pair of opposite sides overlap with the pair of extension lines L, and the entire second position detection pattern 12B is arranged. , Are arranged so as to overlap the inside of the pair of extension lines L.

また、第3位置検出パターン12Cも、その対向する一対の辺が、一対の延長線Lと重なるように配置されており、第3位置検出パターン12Cの全体が、一対の延長線Lの内部に重なるように配置されている。 Further, the third position detection pattern 12C is also arranged so that the pair of opposite sides overlap with the pair of extension lines L, and the entire third position detection pattern 12C is inside the pair of extension lines L. They are arranged so that they overlap.

上述した説明では、一対の延長線として、第1位置検出パターン12Aの対向する一対の辺を、仮想的に辺の延びる方向に延長した線を用いて、他の位置検出パターン12B、12Cとの関係を説明したが、一の位置検出パターンの対向する一対の辺を、仮想的に辺の延びる方向に延長した一対の延長線Lの内部に、全ての他の位置検出パターンそれぞれが、少なくとも一部が重なるように配置されていればよい。一対の延長線は、第2位置検出パターン12B又は第3位置検出パターン12Cの対向する一対の辺を延長した線であってもよい。 In the above description, as a pair of extension lines, a line in which the pair of opposite sides of the first position detection pattern 12A are virtually extended in the extending direction of the sides is used with the other position detection patterns 12B and 12C. Although the relationship has been described, all the other position detection patterns are at least one inside the pair of extension lines L in which the pair of opposite sides of one position detection pattern are virtually extended in the extending direction of the sides. It suffices if the parts are arranged so as to overlap each other. The pair of extension lines may be lines in which a pair of opposite sides of the second position detection pattern 12B or the third position detection pattern 12C are extended.

各位置検出パターン12A、12B、12Cは、上述したように、二次元コード10が撮影された画像において二次元コード10の位置を検出して、解析するために使用される。具体的には、まず、撮影された画像から位置検出パターン12A、12B、12Cが識別される。次に、識別された位置検出パターン12A、12B、12Cに基づいて4つの座標が取得される。次に、取得された4つの座標に基づいて、二次元空間の射影変換の係数が求まり、射影変換により二次元コードの画像の座標変換が行われて、画像の歪み又は画像のぼけ等の影響が補正される。次に、補正された二次元コードの画像のデータ部11のセルに基づいて、メッセージ等の情報が取り出される。この処理の詳細については、後述する。 As described above, the position detection patterns 12A, 12B, and 12C are used for detecting and analyzing the position of the two-dimensional code 10 in the image in which the two-dimensional code 10 is captured. Specifically, first, the position detection patterns 12A, 12B, and 12C are identified from the captured image. Next, four coordinates are acquired based on the identified position detection patterns 12A, 12B, 12C. Next, based on the four acquired coordinates, the coefficient of the projective transformation in the two-dimensional space is obtained, and the coordinate transformation of the image of the two-dimensional code is performed by the projective transformation, and the influence of image distortion or image blurring is performed. Is corrected. Next, information such as a message is taken out based on the cell of the data unit 11 of the image of the corrected two-dimensional code. The details of this process will be described later.

データ部11は、図2に示すように、二次元のマトリックス状のパターンとして配置され、メッセージ等の情報が二進コードで表されたデータを表す複数のセル13を有する。セル13は、明又は暗の明るさの違いによって、二進情報を表す。 As shown in FIG. 2, the data unit 11 is arranged as a two-dimensional matrix-like pattern, and has a plurality of cells 13 representing data in which information such as a message is represented by a binary code. Cell 13 represents binary information depending on the difference in brightness between light and dark.

図2に示すように、データ部11は、複数の同じ大きさのブロック14に分割されており、隣接するブロック14間に、明又は暗の分離スペース15を有する。一のブロック14は、複数のセル13により形成される。 As shown in FIG. 2, the data unit 11 is divided into a plurality of blocks 14 having the same size, and has a light or dark separation space 15 between adjacent blocks 14. One block 14 is formed by a plurality of cells 13.

図2に示す例では、ブロック14は、3×3のセルにより形成されており、隣接するブロック14間には、1セル分の明の分離スペース15が配置される。分離スペース15は、各ブロック14を分離するように格子状に配置される。これにより、各ブロック14におけるセルの明暗の判定精度が向上する。なお、ブロックを形成するセルの数又は形状は、図2に示す例には制限されない。また、分離スペースの形状も、図2に示す例には制限されない。 In the example shown in FIG. 2, the block 14 is formed by 3 × 3 cells, and a bright separation space 15 for one cell is arranged between adjacent blocks 14. The separation spaces 15 are arranged in a grid pattern so as to separate each block 14. As a result, the accuracy of determining the brightness of the cell in each block 14 is improved. The number or shape of cells forming the block is not limited to the example shown in FIG. Further, the shape of the separation space is not limited to the example shown in FIG.

データ部11が有する実データは、メッセージの数に対応した複数のセグメントと、終端フラグだけが入ったセグメントと、実データの余った領域に配置される埋め草を有する。複数のセグメントは、メッセージと、メッセージを修飾するヘッダー(メッセージ種類(メッセージのエンコード)・メッセージサイズ等)を有するセグメントが、メッセージの数だけ並べられたものである。データ部11は、実データが、1ブロック当たりのデータ容量に従い、ブロック単位に分割される。 The actual data included in the data unit 11 has a plurality of segments corresponding to the number of messages, a segment containing only the termination flag, and a filling grass arranged in the remaining area of the actual data. A plurality of segments are segments in which a message and a header having a header (message type (message encoding), message size, etc.) that qualifies the message are arranged as many as the number of messages. In the data unit 11, the actual data is divided into blocks according to the data capacity per block.

また、データ部11は、デコードする際のデータ部11自身の誤りを訂正するための誤り訂正符号を有する。誤り訂正符号も、ブロック単位に分割される。 Further, the data unit 11 has an error correction code for correcting an error of the data unit 11 itself at the time of decoding. The error correction code is also divided into blocks.

例えば、誤り訂正符号にリードソロモン符号を使った場合、誤り訂正はワード単位で行われるため、1ワードを1ブロックとすることが好ましい。1ワードが複数のブロックにまたがる場合、1つのブロックに汚れが発生した場合でも、そのブロックが関係する全てのワードが誤り訂正の対象となり、訂正の効率が悪くなる。訂正原因となる汚れや、スポットライトによる色とびは、1箇所に集中することが多いが、ブロックにすることにより同時に訂正対象となるデータを1箇所にまとめる効果があるので、効率的な訂正を可能にし、コードを認識させる可能性を高める。 For example, when a Reed-Solomon code is used as the error correction code, error correction is performed in word units, so it is preferable that one word is one block. When one word spans a plurality of blocks, even if one block becomes dirty, all the words related to the block are subject to error correction, and the efficiency of correction becomes poor. Dirt that causes correction and color skipping due to spotlights are often concentrated in one place, but making blocks has the effect of consolidating the data to be corrected in one place at the same time, so efficient correction can be performed. Enable and increase the chances of your code being recognized.

また、データ部11は、位置検出パターン12A、12B、12Cに対して、所定の位置に配置される位置補正パターン16A、16Bを備える。位置補正パターン16Aは、第1位置検出パターン12A及び第2位置検出パターン12Bそれぞれに対して、所定の位置に配置されている。位置補正パターン16Bは、第2位置検出パターン12B及び第3位置検出パターン12Cそれぞれに対して、所定の位置に配置されている。なお、位置補正パターンは、何れか一方の位置検出パターンに対してか、又は複数の位置検出パターン対して位置が関連づけられていればよい。 Further, the data unit 11 includes position correction patterns 16A and 16B arranged at predetermined positions with respect to the position detection patterns 12A, 12B and 12C. The position correction pattern 16A is arranged at a predetermined position with respect to each of the first position detection pattern 12A and the second position detection pattern 12B. The position correction pattern 16B is arranged at a predetermined position with respect to the second position detection pattern 12B and the third position detection pattern 12C, respectively. The position correction pattern may be related to any one of the position detection patterns or to a plurality of position detection patterns.

位置補正パターン16A、16Bの第1の役割は、二次元コードを撮影した画像から検出された位置検出パターン候補に対して所定の位置に配置される位置補正パターンが識別されることにより、検出された位置検出パターン候補が位置検出パターンであることが識別されることである。例えば、二次元コードを撮影した画像から1個の位置検出パターン候補しか検出されない場合、位置検出パターンが単純な形状であるほど、撮影画像のノイズである可能性が高まるが、位置検出パターン候補に対応する位置補正パターンが識別されることにより、検出された位置検出パターン候補が、位置検出パターンであることが識別されるので、識別された1個の位置検出パターンに基づいて4つの座標を取得することができる。この処理の詳細については、後述する。 The first role of the position correction patterns 16A and 16B is detected by identifying the position correction pattern arranged at a predetermined position with respect to the position detection pattern candidate detected from the image obtained by capturing the two-dimensional code. It is that the position detection pattern candidate is identified as the position detection pattern. For example, when only one position detection pattern candidate is detected from an image obtained by capturing a two-dimensional code, the simpler the shape of the position detection pattern, the higher the possibility of noise in the captured image. By identifying the corresponding position correction pattern, it is identified that the detected position detection pattern candidate is the position detection pattern. Therefore, four coordinates are acquired based on one identified position detection pattern. can do. The details of this process will be described later.

また、位置補正パターン16A、16Bの第2の役割は、データ部11のセルの座標の誤差を補正することである。二次元コードを撮影した画像から位置検出パターンの位置を取得する時のズレによりデータ部11のセルの座標に誤差が生じる場合がある。そこで、位置補正パターン16A、16Bと対応づけられている位置検出パターンとの位置関係に基づいて、データ部11のセルの座標の誤差が補正される。なお、位置補正パターンを形成するセルの数又は形状は、図1に示す例には制限されない。 Further, the second role of the position correction patterns 16A and 16B is to correct the error of the coordinate of the cell of the data unit 11. An error may occur in the coordinates of the cell of the data unit 11 due to the deviation when acquiring the position of the position detection pattern from the image obtained by capturing the two-dimensional code. Therefore, the error of the coordinate of the cell of the data unit 11 is corrected based on the positional relationship between the position correction patterns 16A and 16B and the position detection pattern associated with the position correction patterns 16A and 16B. The number or shape of cells forming the position correction pattern is not limited to the example shown in FIG.

また、データ部11は、バージョン情報ブロック、フォーマット情報ブロック、絵柄埋め込み情報ブロック等を有していてもよい。 Further, the data unit 11 may have a version information block, a format information block, a picture embedding information block, and the like.

バージョン情報ブロックは、二次元コード10のサイズに関する情報を有する。二次元コード10を解析する時には、バージョン情報ブロックが有する情報に基づいて、データ部11の領域を識別することができる。例えば、二次元コードの縦方向のサイズに関する情報を有する縦バージョン情報ブロックと、二次元コードの横方向のサイズに関する情報を有する横バージョン情報ブロックを用いることができる。バージョン情報ブロックを用いることにより、データ部11のサイズを可変にして、二次元コード10に含める情報量を制御することができる。 The version information block has information about the size of the two-dimensional code 10. When analyzing the two-dimensional code 10, the area of the data unit 11 can be identified based on the information contained in the version information block. For example, a vertical version information block having information on the vertical size of the two-dimensional code and a horizontal version information block having information on the horizontal size of the two-dimensional code can be used. By using the version information block, the size of the data unit 11 can be made variable to control the amount of information included in the two-dimensional code 10.

フォーマット情報ブロックは、一つのブロック14が有するデータ量を情報として有する。フォーマット情報ブロックを用いることにより、例えば、一つのブロック14が有するデータ量を、6、7、9ビット/ブロックというように選択可能にすることができる。 The format information block has the amount of data that one block 14 has as information. By using the format information block, for example, the amount of data contained in one block 14 can be selected as 6, 7, 9 bits / block.

絵柄埋め込み情報ブロックは、二次元コード10が絵柄を有する時に、絵柄等が配置されて、セルが配置されない領域を規定するために用いられる。絵柄埋め込み情報ブロックは、例えば、絵柄等を埋め込む領域(セルが配置されない領域)のサイズ及びブロック位置に関する情報を有することができる。なお、セルが配置されない領域には、絵柄だけでなく、空白又は他の一次元コード若しくは二次元コードを配置することもできる。 The picture embedding information block is used to define an area in which a picture or the like is arranged and cells are not arranged when the two-dimensional code 10 has a picture. The picture embedding information block can have, for example, information on the size and block position of an area (area in which cells are not arranged) in which a picture or the like is embedded. In the area where the cells are not arranged, not only the pattern but also a blank or another one-dimensional code or two-dimensional code can be arranged.

位置検出パターンが、単独で画像から検出可能であるとは、二次元コードを撮影した画像に基づいて、画像を解析することにより各位置検出パターンを検出可能であることを意味する。 The fact that the position detection pattern can be detected independently from the image means that each position detection pattern can be detected by analyzing the image based on the image obtained by taking the two-dimensional code.

また、位置検出パターンが異なることには、例えば、外形、大きさ、二次元コード上での配置方向、位置検出パターンを形成する線幅の比率が異なることが含まれる。また、線幅の比率が異なるとは、例えば位置検出パターンの中心を通るように走査した際に、明暗の比率が異なることを含む。 Further, the difference in the position detection pattern includes, for example, a difference in the outer shape, the size, the arrangement direction on the two-dimensional code, and the ratio of the line width forming the position detection pattern. Further, the difference in the line width ratio includes, for example, that the light-dark ratio is different when scanning so as to pass through the center of the position detection pattern.

また、位置検出パターンが異なることには、外形が同じでも、内部の形状が異なることが含まれる。更に、位置検出パターンが異なることには、少なくとも2個の位置検出パターンは、回転させても形状が一致しないか、又は回転させても外形が一致しないか、又は、回転させて外形が一致しても位置検出パターンを形成する線の線幅の比率が異なることが含まれる。 Further, the difference in the position detection pattern includes that the internal shape is different even if the outer shape is the same. Furthermore, the fact that the position detection patterns are different means that at least two position detection patterns do not match in shape even when rotated, or the outer shapes do not match when rotated, or the outer shapes match when rotated. However, the ratio of the line widths of the lines forming the position detection pattern is different.

二次元コード10が少なくとも2個以上の位置検出パターンを備える理由を、以下に説明する。二次元コード10の解析では、画像の歪み又は画像のぼけ等の影響を精度良く補正して、歪み又はぼけの影響の少ない二次元コードの画像を得ることが好ましい。この観点から、少なくとも4点の座標を位置検出パターンに基づいて取得し、取得された4点の座標に基づいて、二次元空間の射影変換の係数が求まり、射影変換により二次元コードの画像の座標変換を行うことが好ましい。射影変換を行うための4点の座標は、データ取得の計算対象となるデータ部11に近いことが望まれる。1つの位置検出パターンから4点の座標を取得した場合、この位置検出パターンから離れたデータ部11における座標の計算精度が悪化するため、データ部11の全体を広くカバーできる4点を取得することが望ましい。また、読取装置のレンズの歪みや、二次元コードを印字する面の歪みなどが原因で撮影されたコードに歪みが発生した場合、その歪みは一様ではない。そのため、同じ位置検出パターンから取得した4点の座標から二次元空間の射影変換の係数を取得するよりも、異なる位置検出パターンにまたがる複数の点に基づいて射影変換の係数を求める方が、歪みによる影響を軽減できる効果が期待できる。 The reason why the two-dimensional code 10 includes at least two or more position detection patterns will be described below. In the analysis of the two-dimensional code 10, it is preferable to accurately correct the influence of image distortion or image blur to obtain an image of the two-dimensional code that is less affected by distortion or blur. From this point of view, the coordinates of at least 4 points are acquired based on the position detection pattern, and the coefficients of the projective transformation in the 2D space are obtained based on the acquired coordinates of the 4 points. It is preferable to perform coordinate conversion. It is desirable that the coordinates of the four points for performing the projective transformation are close to the data unit 11 to be calculated for data acquisition. When the coordinates of 4 points are acquired from one position detection pattern, the calculation accuracy of the coordinates in the data unit 11 away from this position detection pattern deteriorates. Therefore, it is necessary to acquire 4 points that can cover the entire data unit 11 widely. Is desirable. Further, when the code captured is distorted due to the distortion of the lens of the reader or the distortion of the surface on which the two-dimensional code is printed, the distortion is not uniform. Therefore, it is more distorted to obtain the projective transformation coefficient based on a plurality of points spanning different position detection patterns than to acquire the projective transformation coefficient in two-dimensional space from the coordinates of four points acquired from the same position detection pattern. You can expect the effect of reducing the influence of.

次に、二次元コード10が異なる位置検出パターンを備える理由を、以下に説明する。1画像に複数の二次元コードが撮影された場合、各二次元コードの複数の位置検出パターンが異なる場合には、位置検出パターンの検討すべき組合せ数を大幅に減少することが可能であり、正規の組合せであるかを判定する処理量を低減することができる。この処理量が低減することを、以下に説明する。 Next, the reason why the two-dimensional code 10 has different position detection patterns will be described below. When a plurality of two-dimensional codes are captured in one image and the plurality of position detection patterns of each two-dimensional code are different, the number of combinations of position detection patterns to be examined can be significantly reduced. It is possible to reduce the amount of processing for determining whether the combination is a regular combination. It will be described below that this processing amount is reduced.

撮影された1つの画像に複数の二次元コードが写し込まれた場合について、二次元コードが異なる複数の位置検出パターンを備える場合と、二次元コードが同じ複数の位置検出パターンを備える場合とについて、位置検出パターンの正規の組合せであることを判定する処理量を以下に比較する。 Regarding the case where a plurality of two-dimensional codes are imprinted on one captured image, the case where the two-dimensional codes include a plurality of different position detection patterns and the case where the two-dimensional codes include a plurality of the same position detection patterns. , The processing amount for determining that the combination of the position detection patterns is a regular combination is compared below.

例えば、1つの画像に6個の二次元コードが撮影されており、各二次元コードは3個の同じ位置検出パターンを備えているとする。この場合、画像には、同じ位置検出パターンが18個(6個×3)写し込まれる。18個の位置検出パターンを検出し、それらの内の3個の組合せ全てについて同一の二次元コードのものであるか調べる場合、組合せは18=816通りとなる。もし、1個の二次元コードに4個の同じ位置検出パターンがある場合には、画面の位置検出パターンの個数は24個になり、その組合せは、24=10624通りとなる。このように、位置検出パターンの組合せ数が膨大となりその処理時間が増加する。 For example, it is assumed that six two-dimensional codes are photographed in one image, and each two-dimensional code has three same position detection patterns. In this case, 18 (6 × 3) same position detection patterns are imprinted on the image. Detecting the 18 position detection pattern, when examined by either of the same two-dimensional code for three combinations of all of them, the combination becomes ways 18 C 3 = 816. If the the single two-dimensional code has four identical position detection pattern, the number of the position detection pattern of the screen becomes 24, the combination is a street 24 C 4 = 10624. In this way, the number of combinations of position detection patterns becomes enormous, and the processing time increases.

一方、図1に示す二次元コードのように3個の位置検出パターンが異なる場合、3個の異なる位置検出パターンの組み合わせ数は、××=216通りとなり、4個の異なる位置検出パターンでは、×××=1296通りとなり、上述した場合と比べて位置検出パターンの組合せ数が大幅に減る。従って、同じ二次元コードに含まれる位置検出パターンの正規の組合せを判定する処理量を大きく低減できる。 On the other hand, when the three position detection patterns are different as in the two-dimensional code shown in FIG. 1, the number of combinations of the three different position detection patterns is 6 C 1 × 6 C 1 × 6 C 1 = 216. With four different position detection patterns, there are 6 C 1 x 6 C 1 x 6 C 1 x 6 C 1 = 1296, and the number of combinations of position detection patterns is significantly reduced as compared with the above case. Therefore, the amount of processing for determining a regular combination of position detection patterns included in the same two-dimensional code can be greatly reduced.

また、位置検出パターンが異なる場合には、1個の位置検出パターンを検出した場合に他の位置検出パターンの方向・位置の予測が容易になるので、位置検出パターンを探索する処理量を低減することができる。二次元コードが位置補正パターンを備える場合には、他の位置検出パターンを探索する時に、位置補正パターンを用いてもよい。 Further, when the position detection patterns are different, the direction and position of the other position detection patterns can be easily predicted when one position detection pattern is detected, so that the amount of processing for searching the position detection pattern is reduced. be able to. When the two-dimensional code includes a position correction pattern, the position correction pattern may be used when searching for another position detection pattern.

3つの位置検出パターン12A、12B、12Cは、ブロック14よりも大きな面積を有することが好ましい。これにより、位置検出パターンと同じパターンが、二次元コード中に出現することはなくなり、位置検出パターンの検出が容易になる。 The three position detection patterns 12A, 12B, and 12C preferably have a larger area than the block 14. As a result, the same pattern as the position detection pattern does not appear in the two-dimensional code, and the position detection pattern can be easily detected.

また、位置検出パターン12A、12B、12Cは、識別スペースを設けた枠形状であることが好ましい。この識別スペースは、二次元コードを構成する最小セルの2倍以上のスペースであることが好ましい。 Further, the position detection patterns 12A, 12B, and 12C preferably have a frame shape provided with an identification space. This identification space is preferably a space that is at least twice as large as the smallest cell that constitutes the two-dimensional code.

二次元コード10では、第1位置検出パターン12Aは、一重の正方形枠を有する。第2位置検出パターン12Bは、一重の正方形枠と、正方形枠内に配置された正方形を有する。第3位置検出パターン12Cは、一重の長方形枠を有する。各位置検出パターン12A、12B、12Cは、最小セルの2倍以上のスペースである明の識別スペースを有している。 In the two-dimensional code 10, the first position detection pattern 12A has a single square frame. The second position detection pattern 12B has a single square frame and squares arranged in the square frame. The third position detection pattern 12C has a single rectangular frame. Each position detection pattern 12A, 12B, 12C has a bright identification space which is at least twice the space of the minimum cell.

位置検出パターン12A、12B、12Cが内部に識別スペースを有することにより、位置検出パターンとその他の写り込みを容易に区別することができるので、ぼけ・ブレの影響を抑制して識別性が向上する。この場合、識別スペースは、2セル以上であることが好ましい。その理由は、最小セルが1ビットを表す二次元コードでは、1セルを上回るぼけ・ブレが発生する場合には、位置検出パターンの検出ができても、データの取得ができなくなるためである。1セルを上回るぼけ・ブレがある場合はコードを認識できず、識別スペースが2セルあれば、1セル分のあらゆる方向のぼけ・ブレに対応できる。これは、1画面で複数の二次元コードを撮影する場合に、1つ1つの二次元コードが小さくなるので、ぼけ・ブレの影響が大きくなり、二次元コードの画像が不鮮明になることに対しても有効である。 Since the position detection patterns 12A, 12B, and 12C have an identification space inside, the position detection pattern and other reflections can be easily distinguished, so that the influence of blurring / blurring is suppressed and the identification is improved. .. In this case, the identification space is preferably two or more cells. The reason is that in a two-dimensional code in which the smallest cell represents one bit, if blurring / blurring exceeding one cell occurs, even if the position detection pattern can be detected, data cannot be acquired. If there is more than one cell of blur / blur, the code cannot be recognized, and if there are two identification spaces, it is possible to deal with blur / blur of one cell in all directions. This is because when shooting multiple 2D codes on one screen, each 2D code becomes smaller, so the effect of blurring and blurring becomes larger, and the image of the 2D code becomes unclear. Is also effective.

各位置検出パターン12A、12B、12Cの周囲には、1セル分の明パターンが配置されている。これにより、二次元コード10と隣接して、他の図形が配置された場合にも、二次元コード10が撮影された画像から、各位置検出パターン12A、12B、12Cを検出し易くなされている。 A bright pattern for one cell is arranged around each position detection pattern 12A, 12B, 12C. As a result, even when another figure is arranged adjacent to the two-dimensional code 10, each position detection pattern 12A, 12B, 12C can be easily detected from the image taken by the two-dimensional code 10. ..

なお、二次元コード10の各位置検出パターン12A、12B、12C及びデータ部11を形成する明暗を反転してもよい。例えば、図1の第1位置検出パターン12Aの明暗を反転した場合には、黒い正方形の背景の中に、明の正方形枠が配置されることになる。 The light and darkness forming the position detection patterns 12A, 12B, 12C and the data unit 11 of the two-dimensional code 10 may be reversed. For example, when the light and darkness of the first position detection pattern 12A in FIG. 1 is reversed, a bright square frame is arranged in the background of the black square.

次に、図3を参照しながら、一対の延長線と他の二次元コードとの関係の例を説明する。以下に説明する図3(A)〜図3(D)は、第1位置検出パターン12Aの対向する一対の辺を、仮想的に辺の延びる方向に延長した一対の延長線Lの内部に他の位置検出パターン12B、12Cの少なくとも一部が重なっている場合の例を示す。 Next, an example of the relationship between the pair of extension lines and the other two-dimensional code will be described with reference to FIG. 3 (A) to 3 (D) described below show that the pair of opposite sides of the first position detection pattern 12A are inside the pair of extension lines L that are virtually extended in the extending direction of the sides. An example is shown in the case where at least a part of the position detection patterns 12B and 12C of is overlapped.

図3(A)に示す例では、第1位置検出パターン12Aの対向する一対の辺を、仮想的に辺の延びる方向に延長した一対の延長線Lの内の一方と、第2位置検出パターン12Bの輪郭の少なくとも一部が重なっている。具体的には、第2位置検出パターン12Bの外形を形成する正方形の一辺が、延長線Lと重なっている。第2位置検出パターン12Bは、外形を形成する正方形の一辺を除いた部分は、一対の延長線Lの内部には重なっていない。このように、一対の延長線Lの内部に第2位置検出パターン12Bの少なくとも一部が重なることには、第2位置検出パターン12Bの輪郭の少なくとも一部が重なっていることが含まれる。 In the example shown in FIG. 3A, the pair of opposite sides of the first position detection pattern 12A is one of a pair of extension lines L that are virtually extended in the extending direction of the sides, and the second position detection pattern. At least part of the contour of 12B overlaps. Specifically, one side of the square forming the outer shape of the second position detection pattern 12B overlaps with the extension line L. In the second position detection pattern 12B, the portion of the second position detection pattern 12B except for one side of the square forming the outer shape does not overlap inside the pair of extension lines L. As described above, the fact that at least a part of the second position detection pattern 12B overlaps inside the pair of extension lines L includes that at least a part of the contour of the second position detection pattern 12B overlaps.

図3(B)に示す例では、図1と同様に、第2位置検出パターン12Bは、その対向する一対の辺が、一対の延長線Lと重なるように配置されており、第2位置検出パターン12Bの全体が、一対の延長線Lの内部に重なるように配置されている。第3位置検出パターン12C(図1とは異なる形状を有する)は、その対向する一対の辺の内の一方が、一対の延長線Lの内の一方と重なるように配置されており、第3位置検出パターン12Cの全体が、一対の延長線Lの内部に重なるように配置されている。 In the example shown in FIG. 3B, similarly to FIG. 1, the second position detection pattern 12B is arranged so that the pair of opposite sides overlap with the pair of extension lines L, and the second position detection The entire pattern 12B is arranged so as to overlap the inside of the pair of extension lines L. The third position detection pattern 12C (having a shape different from that in FIG. 1) is arranged so that one of the pair of opposite sides overlaps with one of the pair of extension lines L, and the third position is detected. The entire position detection pattern 12C is arranged so as to overlap the inside of the pair of extension lines L.

図3(C)に示す例では、第2位置検出パターン12Bは、第2位置検出パターン12Bの一部(約半分の領域)が、一対の延長線Lの内部に重なるように配置されている。 In the example shown in FIG. 3C, in the second position detection pattern 12B, a part (about half of the area) of the second position detection pattern 12B is arranged so as to overlap the inside of the pair of extension lines L. ..

図3(D)に示す例では、第2位置検出パターン12Bは、第2位置検出パターン12Bの輪郭が、一対の延長線Lの内部に含まれるように配置されている。 In the example shown in FIG. 3D, the second position detection pattern 12B is arranged so that the contour of the second position detection pattern 12B is included inside the pair of extension lines L.

上述した図3(A)〜図3(D)に示すように、一の位置検出パターン12Aの対向する一対の辺を、仮想的に辺の延びる方向に延長した一対の延長線Lの内部に、他の位置検出パターン12B、12Cそれぞれが、少なくとも一部が重なるように配置されているので、一の位置検出パターン12Aに基づいて、他の位置検出パターン12B、12Cを検索する処理時間が短くなるようになされている。特に、図3(D)に示すように、第2位置検出パターン12Bの輪郭が、一対の延長線Lの内部に配置されている場合には、他の例よりも検索領域が少なくなるので、検索する処理時間を一層短くできる。詳しい説明は後述する。 As shown in FIGS. 3 (A) to 3 (D) described above, a pair of opposite sides of one position detection pattern 12A are placed inside a pair of extension lines L that are virtually extended in a direction in which the sides extend. Since the other position detection patterns 12B and 12C are arranged so that at least a part of them overlap each other, the processing time for searching the other position detection patterns 12B and 12C based on one position detection pattern 12A is short. It is made to be. In particular, as shown in FIG. 3D, when the contour of the second position detection pattern 12B is arranged inside the pair of extension lines L, the search area becomes smaller than in other examples. The processing time for searching can be further shortened. A detailed explanation will be described later.

上述した図1及び図3(A)〜図3(D)の例では、一の位置検出パターン12Aの対向する一対の辺を、仮想的に辺の延びる方向に延長した一対の延長線Lと、他の位置検出パターン12B、12Cとの関係を説明したが、本明細書では、各位置検出パターンの外形が四角形であれば、一の位置検出パターンの対向する一対の辺を、仮想的に辺の延びる方向に延長した一対の延長線の内部に、全ての他の位置検出パターンそれぞれが、少なくとも一部が重なるように配置されていればよい。 In the examples of FIGS. 1 and 3 (A) to 3 (D) described above, a pair of opposite sides of one position detection pattern 12A are virtually extended in a direction in which the sides extend, and a pair of extension lines L. , The relationship with the other position detection patterns 12B and 12C has been described. However, in the present specification, if the outer shape of each position detection pattern is a quadrangle, the pair of opposite sides of one position detection pattern can be virtually set. It suffices that all the other position detection patterns are arranged so that at least a part of them overlaps inside the pair of extension lines extending in the extending direction of the sides.

また、本発明では、各位置検出パターンの外形が四角形以外の形状を有していてもよい。この場合、一の位置検出パターンの輪郭上の対向する一対の点を、仮想的に所定の方向に平行に延長した一対の延長線の内部に、全ての他の位置検出パターンそれぞれが、少なくとも一部が重なるように配置されており、全てのセルは、一対の延長線の内部に配置される。 Further, in the present invention, the outer shape of each position detection pattern may have a shape other than a quadrangle. In this case, each of the other position detection patterns has at least one inside a pair of extension lines in which a pair of opposing points on the contour of one position detection pattern are virtually extended in parallel in a predetermined direction. The portions are arranged so as to overlap, and all cells are arranged inside a pair of extension lines.

次に、位置検出パターンの様々な形態を、図面を参照しながら、以下に説明する。 Next, various forms of the position detection pattern will be described below with reference to the drawings.

図4(A)〜図4(L)は、外形が四角形の位置検出パターンの様々な形態を示す図である。 4 (A) to 4 (L) are views showing various forms of a position detection pattern having a rectangular outer shape.

図4(A)及び図4(B)では、位置検出パターンは、一重の正方形枠を有する。図4(A)に示す位置検出パターンは、図4(B)に示す位置検出パターンよりも大きい。また、位置検出パターンを形成する線の線幅の比率も異なる。 In FIGS. 4 (A) and 4 (B), the position detection pattern has a single square frame. The position detection pattern shown in FIG. 4 (A) is larger than the position detection pattern shown in FIG. 4 (B). In addition, the ratio of the line widths of the lines forming the position detection pattern is also different.

図4(C)及び図4(D)では、位置検出パターンは、縦長の一重の長方形枠を有する。図4(C)に示す位置検出パターンは、図4(D)に示す位置検出パターンよりも幅が広い。また、位置検出パターンを形成する線の線幅の比率も異なる。 In FIGS. 4C and 4D, the position detection pattern has a vertically long single rectangular frame. The position detection pattern shown in FIG. 4C is wider than the position detection pattern shown in FIG. 4D. In addition, the ratio of the line widths of the lines forming the position detection pattern is also different.

図4(E)〜図4(G)では、位置検出パターンは、横長の一重の長方形枠を有する。図4(E)に示す位置検出パターンは、図4(F)に示す位置検出パターンよりも大きい。図4(G)に示す位置検出パターンは、図4(E)に示す位置検出パターンよりも高さが高いが、幅は狭い。また、位置検出パターンを形成する線の線幅の比率も異なる。 In FIGS. 4 (E) to 4 (G), the position detection pattern has a horizontally long single rectangular frame. The position detection pattern shown in FIG. 4 (E) is larger than the position detection pattern shown in FIG. 4 (F). The position detection pattern shown in FIG. 4 (G) is higher in height than the position detection pattern shown in FIG. 4 (E), but is narrower in width. In addition, the ratio of the line widths of the lines forming the position detection pattern is also different.

図4(H)及び図4(I)では、位置検出パターンは、一重の正方形枠と、この正方形枠内に配置された正方形を有する。図4(H)に示す位置検出パターンは、図4(I)に示す位置検出パターンよりも大きい。また、位置検出パターンを形成する線の線幅の比率も異なる。 In FIGS. 4H and 4I, the position detection pattern has a single square frame and squares arranged within the square frame. The position detection pattern shown in FIG. 4 (H) is larger than the position detection pattern shown in FIG. 4 (I). In addition, the ratio of the line widths of the lines forming the position detection pattern is also different.

図4(J)〜図4(L)では、位置検出パターンは、暗パターンにより形成される。図4(J)に示す位置検出パターンは、正方形である。図4(K)に示す位置検出パターンは、縦長の長方形である。図4(L)に示す位置検出パターンは、横長の長方形である。 In FIGS. 4 (J) to 4 (L), the position detection pattern is formed by a dark pattern. The position detection pattern shown in FIG. 4 (J) is a square. The position detection pattern shown in FIG. 4 (K) is a vertically long rectangle. The position detection pattern shown in FIG. 4 (L) is a horizontally long rectangle.

図5(A)及び図5(B)は、外形が正方形の位置検出パターンの他の形態を示す図である。 5 (A) and 5 (B) are diagrams showing other forms of the position detection pattern having a square outer shape.

図5(A)に示す位置検出パターンは、二重の正方形枠を有する。図5(B)に示す位置検出パターンは、三重の正方形枠を有する。図5(A)に示す位置検出パターンは、二重の縦長又は横長の長方形枠で構成しても良い。また、図5(B)に示す位置検出パターンは、三重の縦長又は横長の長方形枠で構成しても良い。さらに、図5(A)、図5(B)に示す位置検出パターンは、位置検出パターンの内側の正方形のパターンのみを縦長又は横長の長方形枠で構成してもよく、また4重以上の枠を有してもよい。 The position detection pattern shown in FIG. 5A has a double square frame. The position detection pattern shown in FIG. 5B has a triple square frame. The position detection pattern shown in FIG. 5A may be composed of a double vertically long or horizontally long rectangular frame. Further, the position detection pattern shown in FIG. 5B may be composed of a triple vertically long or horizontally long rectangular frame. Further, in the position detection pattern shown in FIGS. 5A and 5B, only the square pattern inside the position detection pattern may be composed of a vertically or horizontally long rectangular frame, or a frame having four or more layers. May have.

図6(A)〜図6(E)は、外形が正方形の位置検出パターンの更に他の形態を示す図である。 6 (A) to 6 (E) are views showing still another form of the position detection pattern having a square outer shape.

図6(A)に示す位置検出パターンは、一重の正方形枠と、この正方形枠内に配置された縦長の長方形の明パターン及び暗パターンを有する。 The position detection pattern shown in FIG. 6A has a single square frame and a vertically long rectangular light pattern and dark pattern arranged in the square frame.

図6(B)に示す位置検出パターンは、一重の正方形枠と、この正方形枠内に配置された三角形の明パターン及び暗パターンを有する。 The position detection pattern shown in FIG. 6B has a single square frame and a light pattern and a dark pattern of triangles arranged in the square frame.

図6(C)に示す位置検出パターンは、一重の正方形枠と、この正方形枠内に配置されており、交互に縦方向に並べられた横長の明パターン及び暗パターンを有する。 The position detection pattern shown in FIG. 6C has a single square frame and horizontally long bright patterns and dark patterns arranged in the square frame alternately in the vertical direction.

図6(D)に示す位置検出パターンは、一重の正方形枠と、この正方形枠内に配置されており、交互に横方向に並べられた縦長の明パターン及び暗パターンを有する。 The position detection pattern shown in FIG. 6D has a single square frame and vertically long bright patterns and dark patterns arranged in the square frame alternately in the horizontal direction.

図6(E)に示す位置検出パターンは、一重の正方形枠と、この正方形枠内に配置された4つの正方形の明パターンと、各正方形の明パターンを分離する暗パターンを有する。図6に示す位置検出パターンは、縦長又は横長の長方形としても良い。また、位置検出パターンを形成する線幅の比率を適宜変更してもよい。 The position detection pattern shown in FIG. 6E has a single square frame, four square bright patterns arranged in the square frame, and a dark pattern that separates the bright patterns of each square. The position detection pattern shown in FIG. 6 may be a vertically long or horizontally long rectangle. Further, the ratio of the line widths forming the position detection pattern may be appropriately changed.

図7(A)〜図7(E)は、外形が四角形以外の形状を有する位置検出パターンの形態を示す図である。 7 (A) to 7 (E) are views showing the form of a position detection pattern having a shape other than a quadrangle in outer shape.

図7(A)に示す位置検出パターンは、一重の円形又は楕円形の枠を有する。4つの位置検出パターンは、異なっている。 The position detection pattern shown in FIG. 7A has a single circular or oval frame. The four position detection patterns are different.

図7(B)に示す位置検出パターンは、一重の円形又は楕円形の枠と、枠内に配置された円形又は楕円形を有する。4つの位置検出パターンは、異なっている。 The position detection pattern shown in FIG. 7B has a single circular or elliptical frame and a circular or elliptical frame arranged within the frame. The four position detection patterns are different.

図7(C)に示す位置検出パターンは、第1の長方形及び第2の長方形を有し、第1の長方形と第2の長方形とは互いに重心の位置で直交するように交差している。4つの位置検出パターンは、異なっている。 The position detection pattern shown in FIG. 7C has a first rectangle and a second rectangle, and the first rectangle and the second rectangle intersect each other so as to be orthogonal to each other at the position of the center of gravity. The four position detection patterns are different.

図7(D)に示す位置検出パターンは、第1の長方形及び第2の長方形を有し、第1の長方形の端部から第2の長方形が垂直に延びている。4つの位置検出パターンは、異なっている。 The position detection pattern shown in FIG. 7D has a first rectangle and a second rectangle, and the second rectangle extends vertically from the end of the first rectangle. The four position detection patterns are different.

図7(E)に示す位置検出パターンは、一重の直角三角形の枠を有する。4つの位置検出パターンは、異なっている。また、例えば1つの二次元コードを構成する3つの位置検出パターンとして、図4(A)と図5(A)と図6(A)に記載のものを用いる等、図4、図5、図6、図7に示す位置検出パターンをそれぞれ組み合わせても良い。 The position detection pattern shown in FIG. 7 (E) has a single right-angled triangular frame. The four position detection patterns are different. Further, for example, as the three position detection patterns constituting one two-dimensional code, those shown in FIGS. 4 (A), 5 (A), and 6 (A) are used, and the like. The position detection patterns shown in 6 and 7 may be combined.

次に、上述した第1実施形態の二次元コードの変形例1及び変形例2を、図面を参照しながら、以下に説明する。 Next, the modification 1 and modification 2 of the two-dimensional code of the first embodiment described above will be described below with reference to the drawings.

図8は、本明細書に開示する第1実施形態の二次元コードの変形例1を示す図である。 FIG. 8 is a diagram showing a modification 1 of the two-dimensional code of the first embodiment disclosed in the present specification.

変形例1の二次元コード10は、四角形の第1位置検出パターン12Aの輪郭上の対向する一対の点Pを、仮想的に所定の方向に平行に延長した一対の延長線Lの内部に、全ての他の位置検出パターン12B、12Cそれぞれが、少なくとも一部が重なるように配置されており、全てのセルは、一対の延長線Lの内部に配置される。 The two-dimensional code 10 of the modification 1 is formed by extending a pair of opposing points P on the contour of the rectangular first position detection pattern 12A virtually in parallel in a predetermined direction inside a pair of extension lines L. All the other position detection patterns 12B and 12C are arranged so as to overlap at least a part thereof, and all the cells are arranged inside the pair of extension lines L.

輪郭上の対向する一対の点P、四角形の第1位置検出パターン12Aの輪郭上の点であれば、辺上の点であってもよいし、頂点であってもよい。 As long as the pair of points P facing each other on the contour and the points on the contour of the first position detection pattern 12A of the quadrangle are points on the contour, they may be points on the sides or vertices.

二次元コード10のセルが、一対の延長線Lの内部に配置されることは、一のセルの輪郭が、一対の延長線Lの一方と重なるように配置されることを含む。 Arranging the cells of the two-dimensional code 10 inside the pair of extension lines L includes arranging the contour of one cell so as to overlap one of the pair of extension lines L.

データ部11を形成する全てのセルは、一対の延長線Lの内部に配置されるので、二次元コード10の大きさを小さくするように成されている。 Since all the cells forming the data unit 11 are arranged inside the pair of extension lines L, the size of the two-dimensional code 10 is reduced.

変形例1の二次元コード10では、位置検出パターン12A、12B、12Cの四角形の外形を有しているが、位置検出パターン12A、12B、12Cは、四角形以外の外形を有していてもよい。例えば、位置検出パターンは、図7(A)〜図7(E)に示すような外形を有していてもよい。 The two-dimensional code 10 of the first modification has the outer shape of the quadrangle of the position detection patterns 12A, 12B, 12C, but the position detection patterns 12A, 12B, 12C may have the outer shape other than the quadrangle. .. For example, the position detection pattern may have an outer shape as shown in FIGS. 7 (A) to 7 (E).

また、変形例1の二次元コード10は、位置補正パターンを有していない。データ部11に位置補正パターンを配置しないことにより、より多くの情報をデータ部11にセルとして配置することができる。 Further, the two-dimensional code 10 of the modification 1 does not have a position correction pattern. By not arranging the position correction pattern in the data unit 11, more information can be arranged as cells in the data unit 11.

図9は、本明細書に開示する第1実施形態の二次元コードの変形例2を示す図である。 FIG. 9 is a diagram showing a modification 2 of the two-dimensional code of the first embodiment disclosed in the present specification.

変形例2の二次元コード10は、縦長の形状を有する。変形例2の二次元コード10では、第1位置検出パターン12Aの縦方向に延びる対向する一対の辺を、仮想的に辺の延びる方向に延長した一対の延長線Lの内部に、全ての他の2つの位置検出パターン12B、12Cそれぞれが、少なくとも一部が重なるように配置されている。 The two-dimensional code 10 of the second modification has a vertically long shape. In the two-dimensional code 10 of the second modification, the pair of opposing sides extending in the vertical direction of the first position detection pattern 12A are placed inside the pair of extension lines L that are virtually extended in the extending direction of the sides. Each of the two position detection patterns 12B and 12C is arranged so that at least a part thereof overlaps with each other.

次に、上述した二次元コードが物品に配置された例を、図面を参照しながら、以下に説明する。 Next, an example in which the above-mentioned two-dimensional code is arranged on the article will be described below with reference to the drawings.

図10は、本明細書に開示する第1実施形態の二次元コードが印刷されたカードを示す図である。 FIG. 10 is a diagram showing a card on which the two-dimensional code of the first embodiment disclosed in the present specification is printed.

カード20は、例えば、ゲーム機によって読み取り可能な情報を有するカード状の媒体である。カード20には、カード20を特徴づける絵柄21が配置される。また、カード20には、絵柄21と、カード20の端縁との間の横長の領域に、二次元コード10が印刷されている。二次元コード10のデータ部には、例えば、カード20を識別する識別情報が記録されている。カード20は、例えば、ゲーム機によって、二次元コード10が有するカード20の識別情報が読み取られて、カード20の情報がゲームの進行に組み込まれる。 The card 20 is, for example, a card-like medium having information that can be read by a game machine. On the card 20, a pattern 21 that characterizes the card 20 is arranged. Further, on the card 20, a two-dimensional code 10 is printed in a horizontally long area between the pattern 21 and the edge of the card 20. In the data section of the two-dimensional code 10, for example, identification information for identifying the card 20 is recorded. For the card 20, for example, the identification information of the card 20 possessed by the two-dimensional code 10 is read by the game machine, and the information of the card 20 is incorporated into the progress of the game.

図11は、本明細書に開示する第1実施形態の二次元コードの変形例2が貼付された本を示す図である。 FIG. 11 is a diagram showing a book to which a modification 2 of the two-dimensional code of the first embodiment disclosed in the present specification is attached.

本30の背表紙31には、二次元コード10が貼付されている。二次元コード10のデータ部には、例えば、本を管理する管理番号及び本のタイトルが情報として記録されている。多数の本を管理する図書館等では、本30の背表紙31に貼付された二次元コード10を用いて、本30の管理を行うことができる。 A two-dimensional code 10 is attached to the spine 31 of the book 30. In the data section of the two-dimensional code 10, for example, a control number for managing the book and a title of the book are recorded as information. In a library or the like that manages a large number of books, the book 30 can be managed by using the two-dimensional code 10 attached to the spine 31 of the book 30.

上述した本実施形態の二次元コードによれば、物品等の狭い部分に配置可能であり、複数の二次元コードを同時に撮影する場合、又は、ぼけ・ブレが発生し易い環境での撮影等、様々な撮影条件で撮影された場合にも、二次元コードの正確な認識が短時間で行うことできる。 According to the two-dimensional code of the present embodiment described above, it can be arranged in a narrow part such as an article, and when shooting a plurality of two-dimensional codes at the same time, or shooting in an environment where blurring and blurring are likely to occur, etc. Accurate recognition of the two-dimensional code can be performed in a short time even when shooting under various shooting conditions.

次に、上述した二次元コードの第2実施形態を、図12(A)及び図12(B)を参照しながら以下に説明する。第2実施形態について特に説明しない点については、上述の第1実施形態に関して詳述した説明が適宜適用される。また、同一の構成要素には同一の符号を付してある。 Next, a second embodiment of the above-mentioned two-dimensional code will be described below with reference to FIGS. 12 (A) and 12 (B). The detailed description of the first embodiment described above is appropriately applied to the points not particularly described with respect to the second embodiment. Further, the same components are designated by the same reference numerals.

図12(A)は、本明細書に開示する第2実施形態の二次元コードを示す図である。 FIG. 12A is a diagram showing a two-dimensional code of the second embodiment disclosed in the present specification.

本実施形態の二次元コード10は、基本パターン部10Aと、基本パターン部10Aの外側に配置される周辺部10Bを備える。基本パターン部10Aは、3つの異なる位置検出パターン12A、12B、12Cと、データ部11を備える。基本パターン部10Aの構成は、上述した第1実施形態の二次元コードと同様である。 The two-dimensional code 10 of the present embodiment includes a basic pattern portion 10A and a peripheral portion 10B arranged outside the basic pattern portion 10A. The basic pattern unit 10A includes three different position detection patterns 12A, 12B, 12C, and a data unit 11. The configuration of the basic pattern portion 10A is the same as the two-dimensional code of the first embodiment described above.

周辺部10Bには、データ部11が配置される。周辺部10Bは、基本パターン部10Aの長手方向の両端の外側に配置される。 A data unit 11 is arranged in the peripheral unit 10B. The peripheral portion 10B is arranged outside both ends of the basic pattern portion 10A in the longitudinal direction.

基本パターン部10Aは、二次元コード領域内の基本パターン部10Aの位置を示す基本パターン部移動情報を含む。基本パターン部移動情報は、基本パターン部10Aの二次元コード内での位置を示す基本パターン部位置情報、又は、基本パターン部の所定位置からの移動量を示す基本パターン部移動量情報を有する。二次元コード10を解析する時には、基本パターン部移動情報に基づいて、二次元コード10における基本パターン部10Aの領域及び周辺部10Bの領域が識別される。 The basic pattern unit 10A includes basic pattern unit movement information indicating the position of the basic pattern unit 10A in the two-dimensional code area. The basic pattern unit movement information includes basic pattern unit position information indicating the position of the basic pattern unit 10A in the two-dimensional code, or basic pattern unit movement amount information indicating the amount of movement of the basic pattern unit from a predetermined position. When the two-dimensional code 10 is analyzed, the region of the basic pattern portion 10A and the region of the peripheral portion 10B in the two-dimensional code 10 are identified based on the movement information of the basic pattern portion.

また、基本パターン部10Aは、二次元コード10のサイズを示すバージョン情報を有しており、バージョン情報を用いて、複数個の位置検出パターン間の距離を固定した状態で二次元コードのサイズを可変に設計することが可能になされている。 Further, the basic pattern unit 10A has version information indicating the size of the two-dimensional code 10, and the version information is used to determine the size of the two-dimensional code in a state where the distances between the plurality of position detection patterns are fixed. It is possible to design it variably.

上述した本実施形態の二次元コードによれば、位置検出パターンの配置の自由度が高く、二次元コードを配置する場合に、読み取り困難な領域に位置検出パターンが位置する場合には、そのような読み取り困難な領域を避けて位置検出パターンを配置できる。これにより、二次元コードの読み取りの認識精度を上げることができる。また、データ部11に配置されるデータ量に応じて周辺部10Bの大きさを可変に設計可能である。更に、上述した第1実施形態と同様の効果が奏される。 According to the two-dimensional code of the present embodiment described above, the degree of freedom in arranging the position detection pattern is high, and when the two-dimensional code is arranged, if the position detection pattern is located in a difficult-to-read area, it is such a case. The position detection pattern can be arranged while avoiding areas that are difficult to read. As a result, the recognition accuracy of reading the two-dimensional code can be improved. Further, the size of the peripheral portion 10B can be variably designed according to the amount of data arranged in the data unit 11. Further, the same effect as that of the first embodiment described above is obtained.

図12(B)は、第2実施形態の二次元コードの変形例を示す図である。 FIG. 12B is a diagram showing a modified example of the two-dimensional code of the second embodiment.

本変型例の二次元コード10では、周辺部10Bは、基本パターン部10Aの上下左右の周囲に配置される。データ部11に配置されるデータ量が多い場合には、基本パターン部10Aの長手方向の両端の外側と、基本パターン部10Aの長手方向の側縁の外側にもデータ部11を配置してもよい。 In the two-dimensional code 10 of this modified example, the peripheral portion 10B is arranged around the basic pattern portion 10A on the top, bottom, left, and right. When the amount of data arranged in the data unit 11 is large, the data unit 11 may be arranged outside both ends of the basic pattern unit 10A in the longitudinal direction and outside the side edges in the longitudinal direction of the basic pattern unit 10A. good.

次に、上述した本明細書に開示する二次元コードを作成する作成方法(エンコード方法)について、図13を参照しながら、以下に説明する。 Next, a method of creating the two-dimensional code disclosed in the present specification (encoding method) described above will be described below with reference to FIG.

図13は、本明細書に開示する二次元コードの作成方法を説明するフローチャートである。 FIG. 13 is a flowchart illustrating a method of creating a two-dimensional code disclosed in the present specification.

図13に示す処理は、例えば、コンピュータが、記憶媒体等を含む記憶装置に記憶された所定のプログラムを実行することにより実現され得る。 The process shown in FIG. 13 can be realized, for example, by the computer executing a predetermined program stored in a storage device including a storage medium or the like.

まず、ステップS10において、エンコードのメイン処理を開始する。 First, in step S10, the main processing of encoding is started.

次に、ステップS12において、二次元コードに記録するメッセージが、コンピュータに入力される。 Next, in step S12, a message to be recorded in the two-dimensional code is input to the computer.

次に、ステップS14において、コンピュータは、コード画像における位置検出パターンの配置位置を決定する。コンピュータは、単独で画像から検出可能な2個以上の異なる位置検出パターンであって、各位置検出パターンの外形は四角形である位置検出パターンを、一の位置検出パターンの対向する一対の辺を、仮想的に辺の延びる方向に延長した一対の延長線の内部に、全ての他の位置検出パターンそれぞれが、少なくとも一部が重なるようにコード画像に配置する。又は、コンピュータは、単独で画像から検出可能な2個以上の異なる位置検出パターンを、一の位置検出パターンの対向する一対の辺を、仮想的に辺の延びる方向に延長した一対の延長線の内部に、全ての他の位置検出パターンそれぞれが、少なくとも一部が重なるようにコード画像配置してもよい。この場合には、後述するステップS24では、全てのセルは、一対の延長線の内部に配置される。 Next, in step S14, the computer determines the placement position of the position detection pattern in the code image. A computer has two or more different position detection patterns that can be independently detected from an image, and a position detection pattern in which the outer shape of each position detection pattern is a quadrangle, and a pair of opposite sides of one position detection pattern are used. Inside the pair of extension lines that are virtually extended in the extending direction of the sides, all the other position detection patterns are arranged in the code image so that at least a part of them overlap. Alternatively, the computer has two or more different position detection patterns that can be detected independently from the image, and a pair of extension lines that virtually extend a pair of opposite sides of one position detection pattern in a direction in which the sides extend. Inside, the code image may be arranged so that at least a part of each of the other position detection patterns overlaps. In this case, in step S24, which will be described later, all the cells are arranged inside the pair of extension lines.

次に、ステップS16において、コンピュータは、コード画像における位置補正パターンの配置位置を決定する。位置補正パターンは、位置検出パターンに対して所定の位置に配置される。なお、二次元コードに位置補正パターンを配置しない場合には、このステップは省略される。 Next, in step S16, the computer determines the placement position of the position correction pattern in the code image. The position correction pattern is arranged at a predetermined position with respect to the position detection pattern. If the position correction pattern is not arranged in the two-dimensional code, this step is omitted.

次に、ステップS18において、コンピュータは、各メッセージにヘッダーを付与してセグメントを生成し、複数のセグメントを有する実データを作成する。 Next, in step S18, the computer adds a header to each message to generate segments, and creates actual data having a plurality of segments.

次に、ステップS20において、コンピュータは、実データに対して、誤り訂正符号を作成する。例えば、誤り訂正符号にリードソロモン符号を使用して、誤り訂正をワード単位で行なってもよい。 Next, in step S20, the computer creates an error correction code for the actual data. For example, the Reed-Solomon code may be used as the error correction code, and the error correction may be performed word by word.

次に、ステップS22において、コンピュータは、実データ及び誤り訂正符号を二進コードに変換して、明暗のセル情報を作成する。 Next, in step S22, the computer converts the actual data and the error correction code into a binary code to create light and dark cell information.

次に、ステップS24において、コンピュータは、位置検出パターン、位置補正パターン及びデータ部を形成する各セルを、コード画像に配置する。 Next, in step S24, the computer arranges the position detection pattern, the position correction pattern, and each cell forming the data unit in the code image.

次に、ステップS26において、コンピュータは、コード画像をデータとして出力して、二次元コードが得られる。 Next, in step S26, the computer outputs the code image as data to obtain a two-dimensional code.

二次元コードが印刷される場合には、二次元コードを印刷する媒体はどのようなものでもよく、例えば、紙、樹脂板、筐体表面等が挙げられる。印刷装置は、これらの媒体に二次元コードを印刷可能なものであればよく、例えば簡易プリンタ、精密プリンタ、印刷装置等が挙げられる。印刷装置は、モノクロ印刷だけでなく、カラー印刷可能なものでもよい。また、作成した二次元コードは、印刷せずに、通信回線を介してユーザーに二次元コードのデータとして送信されてもよい。 When the two-dimensional code is printed, any medium may be used for printing the two-dimensional code, and examples thereof include paper, a resin plate, and a housing surface. The printing apparatus may be any as long as it can print a two-dimensional code on these media, and examples thereof include a simple printer, a precision printer, and a printing apparatus. The printing apparatus may be capable of color printing as well as monochrome printing. Further, the created two-dimensional code may be transmitted to the user as two-dimensional code data via a communication line without printing.

次に、上述した本明細書に開示する二次元コードを解析する解析装置(デコード装置)について、図14を参照しながら、以下に説明する。 Next, an analysis device (decoding device) for analyzing the two-dimensional code disclosed in the present specification described above will be described below with reference to FIG.

解析装置40は、読み取り部41と、コンピュータ(二次元コード解析処理部)45と、ディスプレイ46と、通信インターフェース47を有する。読み取り部41は、レンズ42と、イメージセンサ43と、アナログ・デジタル変換器(AD)44を有し、撮影した二次元コードのデジタル画像データをコンピュータ45に出力する。コンピュータ45は、記憶媒体等を含む記憶装置に記憶された所定のプログラムを実行することにより、二次元コードの解析を実行する演算部を有する。図14に示す解析装置40は、例えば、携帯端末を用いて構成され得る。コンピュータ45は、二次元コードを解析したデータを、通信インターフェース47を用いて、ネットワーク(図示せず)を介して、他のサーバ又は端末等(図示せず)へ送信してもよい。 The analysis device 40 includes a reading unit 41, a computer (two-dimensional code analysis processing unit) 45, a display 46, and a communication interface 47. The reading unit 41 has a lens 42, an image sensor 43, and an analog-to-digital converter (AD) 44, and outputs digital image data of a captured two-dimensional code to the computer 45. The computer 45 has a calculation unit that executes an analysis of a two-dimensional code by executing a predetermined program stored in a storage device including a storage medium or the like. The analysis device 40 shown in FIG. 14 can be configured by using, for example, a mobile terminal. The computer 45 may transmit the data obtained by analyzing the two-dimensional code to another server, a terminal, or the like (not shown) via a network (not shown) using the communication interface 47.

次に、上述した解析装置40が、図1に示す二次元コードを解析する解析方法を、図面を参照しながら、以下に説明する。図15〜図17は、本明細書に開示する二次元コードの解析方法を説明するフローチャートである。 Next, an analysis method in which the above-mentioned analysis device 40 analyzes the two-dimensional code shown in FIG. 1 will be described below with reference to the drawings. 15 to 17 are flowcharts illustrating a method of analyzing the two-dimensional code disclosed in the present specification.

まず、ステップS30において、解析のメイン処理を開始する。 First, in step S30, the main process of analysis is started.

次に、ステップS32において、コンピュータ45は、読み取り部41により撮影された二次元コードの画像を入力する。 Next, in step S32, the computer 45 inputs an image of the two-dimensional code taken by the reading unit 41.

次に、ステップS34では、コンピュータ45は、入力された撮影画像の二値画像を作成する。二値化の方法は、入力された撮影画像がRGB画像等のカラー画像であれば、一旦グレースケール画像に変換し、画像内の最大輝度値と最小輝度値の平均を閾値とし、閾値以上であれば明、閾値未満であれば暗とする。カラー画像からグレースケールに変換するには、例えば、各画素のRGBの値を用いて、輝度(brightness)=0.299R+0.587G+0.114Bの変換式にしたがって変換した輝度をグレースケールとして扱う。カラー画像へのグレースケール画像への変換方法、更に二値化画像への変換方法は、様々な方法が提案されており、上記変換方法には限られない。 Next, in step S34, the computer 45 creates a binary image of the input captured image. In the binarization method, if the input captured image is a color image such as an RGB image, it is once converted to a grayscale image, the average of the maximum and minimum luminance values in the image is set as the threshold value, and the value is equal to or higher than the threshold value. If it is, it is bright, and if it is less than the threshold, it is dark. In order to convert a color image to grayscale, for example, using the RGB values of each pixel, the brightness converted according to the conversion formula of brightness (brightness) = 0.299R + 0.587G + 0.114B is treated as grayscale. Various methods have been proposed for converting a color image to a grayscale image and further converting to a binarized image, and the conversion method is not limited to the above conversion method.

次に、ステップS36において、コンピュータ45は、位置検出パターン候補を検出する。具体的には、画像の左上の点を始点とし、画面をX方向に走査し、右端にたどり着いたら、数ピクセル下の左端からX方向に走査する。言い換えれば、数ピクセル分間引くことになる。これを画像全体に対して繰り返す。間引くピクセル数は、(最大間引き量)=(全ての位置検出パターンの辺の長さの中で最小となるセルサイズ)×(撮影時のセルあたりのピクセル数)である。位置検出パターンの辺の長さの中で最小となるセルサイズとは、コードの回転も考慮し、位置検出パターンの回転で起こり得るY方向の最小セルサイズである。撮影時のセルあたりのピクセル数は、1セル当たり1ピクセルを下回ると、理想的な撮影画像でもセルの明と暗を判別することが困難になる。実際の撮影画像でのセルのずれ又は回転を考慮すると、少なくとも1セル当たり3ピクセル以上あるのが望ましい。 Next, in step S36, the computer 45 detects the position detection pattern candidate. Specifically, the screen is scanned in the X direction starting from the upper left point of the image, and when the right end is reached, the screen is scanned in the X direction from the left end several pixels below. In other words, it will be subtracted for a few pixels. This is repeated for the entire image. The number of pixels to be thinned out is (maximum thinning amount) = (cell size that is the smallest among the side lengths of all position detection patterns) × (number of pixels per cell at the time of shooting). The minimum cell size in the side lengths of the position detection pattern is the minimum cell size in the Y direction that can occur in the rotation of the position detection pattern in consideration of the rotation of the cord. If the number of pixels per cell at the time of shooting is less than 1 pixel per cell, it becomes difficult to distinguish between the light and dark of the cell even in an ideal shot image. Considering the displacement or rotation of cells in the actual captured image, it is desirable that there are at least 3 pixels per cell.

そして、コンピュータ45は、検出された位置検出パターン候補を検査する。具体的には、走査中に明から暗の境界を見つけた場合、暗部分の周囲を走査する。その際に、最小・最大のX座標、Y座標をそれぞれ求める。これにより、暗の固まりの外接する長方形が取得できる。これの左上座標を(x1,y1)、右下座標を(x2,y2)と表す。 Then, the computer 45 inspects the detected position detection pattern candidate. Specifically, when a light-dark boundary is found during scanning, the area around the dark portion is scanned. At that time, the minimum and maximum X and Y coordinates are obtained, respectively. As a result, the circumscribed rectangle of the dark mass can be obtained. The upper left coordinate of this is expressed as (x1, y1), and the lower right coordinate is expressed as (x2, y2).

図18は、位置検出パターン候補の形状チェックを説明する図である。 FIG. 18 is a diagram for explaining the shape check of the position detection pattern candidate.

まず、コンピュータ45は、位置検出パターン候補の形状をチェックする。図1に示す二次元コードの各位置検出パターンは、いずれも枠、すなわち穴形状を有する。そこで、まず穴の有無を確認する。始点を外接長方形の左側中点(x1,(y1+y2)/2)とし、終点を(x2,(y1+y2)/2)として、x軸方向の走査を行う。ここで、次の(1)または(2)の条件にあてはまることを確認する。 First, the computer 45 checks the shape of the position detection pattern candidate. Each position detection pattern of the two-dimensional code shown in FIG. 1 has a frame, that is, a hole shape. Therefore, first check for the presence of holes. Scanning is performed in the x-axis direction with the start point as the left midpoint (x1, (y1 + y2) / 2) of the circumscribed rectangle and the end point as (x2, (y1 + y2) / 2). Here, it is confirmed that the following conditions (1) or (2) are satisfied.

(1)暗明暗となる並びが存在することを確認する。1つ目の暗の左端(lx1)から2つ目の暗の右端(rx1)までの中心となる画素が明であることを確認する。
(2)暗明暗明暗というパターンを探す。1つ目の暗の左端(lx2)から3つ目の暗の右端(rx2)までの中心となる画素が暗であることを確認する。
(1) Confirm that there is a line of darkness and darkness. Confirm that the central pixel from the left end (lx1) of the first darkness to the right end (rx1) of the second darkness is bright.
(2) Look for the pattern of darkness, darkness, and darkness. Confirm that the central pixel from the left end (lx2) of the first darkness to the right end (rx2) of the third darkness is dark.

(1)の場合はさらに、図18(A)に示すように、中心座標((lx1+rx1)/2,(y1+y2)/2)から上下を走査し、上側が明暗明(終点:((lx1+rx1)/2),y1−1))となっており、下側が明暗明(終点:((lx1+rx1)/2),y2+1))となっており、上側走査の暗と明の境界のy座標ty1と下側走査の暗と明の境界のy座標by1の中点が、明の中心座標とほぼ一致することを確認する。 In the case of (1), as shown in FIG. 18 (A), the upper and lower sides are scanned from the center coordinates ((lx1 + rx1) / 2, (y1 + y2) / 2), and the upper side is bright and dark (end point: ((lx1 + rx1)). / 2), y1-1)), and the lower side is bright and dark (end point: (((lx1 + rx1) / 2), y2 + 1)), and the y coordinate ty1 of the boundary between dark and bright in the upper scan It is confirmed that the midpoint of the y-coordinate by1 at the boundary between dark and light in the lower scan substantially coincides with the center coordinate of light.

(2)の場合もさらに、図18(B)に示すように、中心座標((lx2+rx2)/2,(y1+y2)/2)から上下方向それぞれを走査し、上側が暗明暗明となっており(終点:((lx2+rx2)/2),y1−1))、下側が暗明暗明となっており(終点:((lx2+rx2)/2),y2+1))、上側走査の2つめの暗と明の境界のy座標ty2と下側走査の2つめの暗と明の境界のy座標by2の中点が暗の中心座標とほぼ一致することを確認する。 In the case of (2), as shown in FIG. 18B, each scan is performed in the vertical direction from the center coordinates ((lx2 + rx2) / 2, (y1 + y2) / 2), and the upper side is dark and dark. (End point: (((lx2 + rx2) / 2), y1-1)), the lower side is dark and dark (end point: ((lx2 + rx2) / 2), y2 + 1)), and the second darkness and lightness of the upper scan It is confirmed that the midpoint of the y-coordinate ty2 of the boundary of the above and the y-coordinate by2 of the second dark and light boundary of the lower scan substantially coincides with the center coordinate of the darkness.

以上の処理により、枠内に暗部を有する第2位置検出パターン(正方形枠内に正方形)と、枠のみの第1位置検出パターン及び第3位置検出パターン(正方形枠または長方形枠:ロ型)と、に区別できる。(1)又は(2)に当てはまらないものは、位置検出パターンではない。 By the above processing, the second position detection pattern having a dark part in the frame (square in the square frame), the first position detection pattern having only the frame and the third position detection pattern (square frame or rectangular frame: B type) Can be distinguished into. Those that do not apply to (1) or (2) are not position detection patterns.

次に、コンピュータ45は、各位置検出パターン候補の頂点を探索する。外接する長方形の左上の座標(x1,y1)からX軸方向に(x2,y1)まで走査する。一番初めに接触した暗点の座標をvertex1:(vx1,vy1)とする。次に右上の座標(x2,y1)からY軸方向に(x2,y2)まで走査する。一番初めに接触した暗点の座標をvertex2:(vx2,vy2)とする。右下の座標(x2,y2)からX軸の反対方向に(x1,y2)まで走査する。一番初めに接触した暗点の座標をvertex3:(vx3,vy3)とする。次に左下の座標(x1,y2)からY軸の反対方向に(x1,y1)まで走査する。一番初めに接触した暗点の座標をvertex4:(vx4,vy4)とする。vertex1〜4は長方形(正方形を含む)となるはずである。そうでない場合は、位置検出パターンではない。図18(B)の表記は省略する。 Next, the computer 45 searches for the vertices of each position detection pattern candidate. Scan from the upper left coordinates (x1, y1) of the circumscribed rectangle to (x2, y1) in the X-axis direction. Let the coordinates of the first contacted dark spot be vertex1: (vx1, by1). Next, scanning is performed from the upper right coordinate (x2, y1) to (x2, y2) in the Y-axis direction. Let the coordinates of the first contacted dark spot be vertex2: (vx2, by2). Scan from the lower right coordinates (x2, y2) to (x1, y2) in the opposite direction of the X axis. Let the coordinates of the first contacted dark spot be vertex3: (vx3, by3). Next, scanning is performed from the lower left coordinates (x1, y2) to (x1, y1) in the direction opposite to the Y axis. Let the coordinates of the first contacted dark spot be vertex4: (vx4, by4). vertex1-4 should be rectangular (including squares). If not, it is not a position detection pattern. The notation of FIG. 18B is omitted.

次に、コンピュータ45は、長方形の長辺と短辺の辺の比を計算する。((vx1−vx2)×(vx1−vx2)+(vy1−vy2)×(vy1−vy2))1/2で1辺の長さが、((vx2−vx3)×(vx2−vx3)+(vy2−vy3)×(vy2−vy3))1/2でもう1辺の長さが、求められる。そして、求めた2辺を比較して、長い方が長辺、短い方が短辺となる。 Next, the computer 45 calculates the ratio of the long side to the short side of the rectangle. ((Vx1-vx2) x (vx1-vx2) + (vy1-vy2) x (vy1-vy2)) 1/2 and the length of one side is ((vx2-vx3) x (vx2-vx3) + ( By 2-vy3) × (vy2-vy3)) 1/2 , the length of the other side is obtained. Then, the two obtained sides are compared, and the longer side is the long side and the shorter side is the short side.

辺の比率が、(長辺):(短辺)=1:1でかつ形状が(2)であれば第2位置検出パターン候補であり、辺の比率が、(長辺):(短辺)=1:1でかつ(1)であれば第1位置検出パターン候補であり、(長辺):(短辺)=9:5で形状が(2)であれば第3位置検出パターン候補となる。このようにして、3種類の位置検出パターン候補の区別が可能となる。 If the ratio of the sides is (long side): (short side) = 1: 1 and the shape is (2), it is a candidate for the second position detection pattern, and the ratio of the sides is (long side) :( short side). ) = 1: 1 and (1) is the first position detection pattern candidate, and (long side): (short side) = 9: 5 and the shape is (2) is the third position detection pattern candidate. It becomes. In this way, it is possible to distinguish between the three types of position detection pattern candidates.

次に、コンピュータ45は、位置検出パターン候補の面積を求める。ここでの面積は、外側の長方形枠の面積で、内側のスペースの面積も含む。第2位置検出パターンの場合は、枠の中の正方形も含む。位置検出パターンの面積は、外側の長方形の面積から4隅を含む4つの直角三角形の面積を減じることにより求める。面積=(x2−x1)×(y2−y1)−(vx1−vx4)×(vy4−vy1)/2−(vx2−vx1)×(vy2−vy1)/2−(vx2−vx3)×(vy3−vy2)/2−(vx3−vx4)×(vy3−vy4)/2で求まる。 Next, the computer 45 obtains the area of the position detection pattern candidate. The area here is the area of the outer rectangular frame and includes the area of the inner space. In the case of the second position detection pattern, the square in the frame is also included. The area of the position detection pattern is obtained by subtracting the area of four right triangles including the four corners from the area of the outer rectangle. Area = (x2-x1) x (y2-y1)-(vx1-vx4) x (vy4-vy1) / 2- (vx2-vx1) x (vy2-vy1) / 2- (vx2-vx3) x (vy3) It can be obtained by −vy2) / 2- (vx3-vx4) × (vy3-vy4) / 2.

次に、コンピュータ45は、位置検出パターン候補の回転角度を求める。第1位置検出パターン及び第2位置検出パターンは、正方形であり90度以上の傾きを検知できないので、90度まで求める。角度は時計回りとする。
θ=arctan((vy2−vy1)/(vx2−vx1))
θが回転角度となる。
Next, the computer 45 obtains the rotation angle of the position detection pattern candidate. Since the first position detection pattern and the second position detection pattern are square and cannot detect an inclination of 90 degrees or more, they are obtained up to 90 degrees. The angle is clockwise.
θ = arctan ((vy2-vy1) / (vx2-vx1))
θ is the rotation angle.

長方形である第3位置検出パターン候補の回転角度は、0から180度まで求める。第3位置検出パターンは、2点間の座標の距離を求める関数length(x1,y1,x2,y2)=((x2−x1) + (y2−y1)1/2を定義し、0〜45度まではlength(vx1,vy1,vx2,vy2)>length(vx4,vy4,vx1,vy1)かつ(x2−x1)>(y2−y1)であり、θ=arctan((vy2−vy1)/(vx2−vx1))で求まる。45〜90度まではlength(vx1,vy1,vx2,vy2)>length(vx4,vy4,vx1,vy1)および(x2−x1)<(y2−y1)であり、θ=arctan((vy2−vy1)/(vx2−vx1))で求まる。90〜135度まではlength(vx1,vy1,vx2,vy2)<length(vx4,vy4,vx1,vy1)および(x2−x1)<(y2−y1)であり、θ=arctan((vy2−vy1)/(vx2−vx1))+90度で求まる。135〜180度まではlength(vx1,vy1,vx2,vy2)<length(vx4,vy4,vx1,vy1)および(x2−x1)>(y2−y1)であり、θ=arctan((vy2−vy1)/(vx2−vx1))+90度で求まる。 The rotation angle of the rectangular third position detection pattern candidate is obtained from 0 to 180 degrees. The third position detection pattern defines a function lens (x1, y1, x2, y2) = ((x2-x1) 2 + (y2-y1) 2 ) 1/2 for finding the distance between two points. From 0 to 45 degrees, Length (vx1, vy1, vx2, vy2)> Length (vx4, vy4, vx1, vy1) and (x2-x1)> (y2-y1), and θ = arctan ((vy2-vy1). ) / (Vx2-vx1)). From 45 to 90 degrees, right (vx1, vy1, vx2, vy2)> right (vx4, vy4, vx1, vy1) and (x2-x1) <(y2-y1), and θ = arctan ((vy2-by1). ) / (Vx2-vx1)). From 90 to 135 degrees, Length (vx1, vy1, vx2, vy2) <length (vx4, vy4, vx1, vy1) and (x2-x1) <(y2-y1), and θ = arctan ((vy2-by1). ) / (Vx2-vx1)) +90 degrees. From 135 to 180 degrees is Length (vx1, vy1, vx2, vy2) <length (vx4, vy4, vx1, vy1) and (x2-x1)> (y2-y1), and θ = arctan ((vy2-by1). ) / (Vx2-vx1)) +90 degrees.

次に、コンピュータ45は、位置検出パターン候補の中心座標を検出する。中心座標は外接長方形の中心((x1+x2)/2、(y1+y2)/2)とする。
以上で、位置検出パターン候補の検査が終了する。
Next, the computer 45 detects the center coordinates of the position detection pattern candidate. The center coordinates are the center of the circumscribed rectangle ((x1 + x2) / 2, (y1 + y2) / 2).
This completes the inspection of the position detection pattern candidates.

次に、ステップS38において、コンピュータ45は、3種の位置検出パターン候補の組合せを作成する。まず、コンピュータ45は、第1位置検出パターン候補を選択する。第1位置検出パターンの面積をSとすると、面積がSであり且つ回転角度(0度から90度)が同じである位置検出パターン候補を、第2位置検出パターン候補として探す。第2位置検出パターン候補が見つかると、次に、面積がS*5/9であり且つ回転角度(0度から180度)が同じである位置検出パターン候補を、第3位置検出パターン候補として探す。 Next, in step S38, the computer 45 creates a combination of three types of position detection pattern candidates. First, the computer 45 selects the first position detection pattern candidate. Assuming that the area of the first position detection pattern is S, the position detection pattern candidates having the same area and the same rotation angle (0 to 90 degrees) are searched for as the second position detection pattern candidates. When the second position detection pattern candidate is found, next, the position detection pattern candidate having an area of S * 5/9 and the same rotation angle (0 to 180 degrees) is searched for as a third position detection pattern candidate. ..

撮影された1画像に複数の二次元コードが写し込まれている場合、位置検出パターン候補のあらゆる組合せを考えると、莫大な組合せ数になってしまう。本発明のように位置検出パターンを全て異ならせることにより、この組合せ数を大きく低減し、更に事前に得られた形状・面積・回転などの特徴を用いることで、簡単な比較演算で、更なる組合せ数の絞込みが可能となっている。また、本明細書に開示する二次元コードによれば、位置検出パターンの配置の特徴により、以下に説明するように組み合わせ数の絞り込みが可能となる。このことを具体的に説明する。 When a plurality of two-dimensional codes are imprinted on one captured image, the number of combinations becomes enormous when considering all combinations of position detection pattern candidates. By making all the position detection patterns different as in the present invention, the number of combinations can be greatly reduced, and by using features such as shape, area, and rotation obtained in advance, a simple comparison operation can be performed. It is possible to narrow down the number of combinations. Further, according to the two-dimensional code disclosed in the present specification, the number of combinations can be narrowed down as described below due to the characteristics of the arrangement of the position detection patterns. This will be specifically described.

一の位置検出パターンの対向する一対の辺または、一の位置検出パターンの輪郭上の対向する一対の点を、辺の延びる方向又は所定の方向に延長した一対の延長線の内部に、全ての他の位置検出パターンそれぞれが、少なくとも一部が重なるように配置されているため、この条件から外れる位置に存在する位置検出パターンは一の二次元コードを構成する位置検出パターンの候補から外れるので、組み合わせ数の絞り込みが可能となっている。例えば、図1では、位置検出パターンの対向する一対の辺を延びる方向に延長した一対の延長線に、全ての他の位置検出パターンそれぞれが、重なるように配置されている。具体的には、図21の位置検出パターン12Aの辺A4―A1と、辺A2―A3を延長した延長線が、位置検出パターン12Bの辺B4―B1と、辺B2―B3と重なり、また位置検出パターン12Cの辺C4―C1と、辺C2−C3と重なる。辺A4―A1は、1次方程式Y=a1X+b1−(1)で表される。辺A2―A3は、辺A4−A1と平行であり、1次方程式Y=a1X+b1’−(2)により表される。 All of the pair of opposing sides of one position detection pattern or the pair of opposing points on the contour of one position detection pattern inside the pair of extension lines extending in the extending direction of the sides or in a predetermined direction. Since each of the other position detection patterns is arranged so that at least a part of them overlaps with each other, the position detection pattern existing at a position outside this condition is excluded from the candidate position detection patterns constituting one two-dimensional code. It is possible to narrow down the number of combinations. For example, in FIG. 1, all the other position detection patterns are arranged so as to overlap each other on a pair of extension lines extending in a direction extending the pair of opposite sides of the position detection pattern. Specifically, the extension lines extending the sides A4-A1 and the sides A2-A3 of the position detection pattern 12A in FIG. 21 overlap the sides B4-B1 and the sides B2-B3 of the position detection pattern 12B, and the positions The sides C4-C1 of the detection pattern 12C and the sides C2-C3 overlap. The sides A4-A1 are represented by the linear equation Y = a1X + b1- (1). The sides A2-A3 are parallel to the sides A4-A1 and are represented by the linear equation Y = a1X + b1'-(2).

位置検出パターン12Aの重心を通る上記1次方程式の法線は、Y=−(1/a1)X+b1’’−(3)で表され、位置検出パターン12Bの重心を通る上記1次方程式の法線は、Y=−(1/a1)X+b2−(4)で表され、位置検出パターン12Cの重心を通る上記1次方程式の法線は、Y=−(1/a1)X+b3−(5)で表せる。位置検出パターン12Aの重心と、式(1)と式(3)の交点座標との距離を、L1として、位置検出パターン12Bの重心と、式(1)と式(4)の交点座標との距離を、L2として、位置検出パターン12Cの重心と、式(1)と式(5)の交点座標との距離を、L3とする。L1、L2、L3の比率を、L1を基準として、L1:L2:L3=1:R2:R3と表した時、図1ではR2=1、R3=1となる。 The normal of the linear equation passing through the center of gravity of the position detection pattern 12A is represented by Y =-(1 / a1) X + b1''- (3), and the normal of the linear equation passing through the center of gravity of the position detection pattern 12B. The line is represented by Y =-(1 / a1) X + b2- (4), and the normal of the above linear equation passing through the center of gravity of the position detection pattern 12C is Y =-(1 / a1) X + b3- (5). Can be represented by. Let L1 be the distance between the center of gravity of the position detection pattern 12A and the coordinates of the intersection of equations (1) and (3), and the coordinates of the center of gravity of the position detection pattern 12B and the coordinates of the intersection of equations (1) and (4). Let L2 be the distance, and let L3 be the distance between the center of gravity of the position detection pattern 12C and the coordinates of the intersection of equations (1) and (5). When the ratio of L1, L2, and L3 is expressed as L1: L2: L3 = 1: R2: R3 with reference to L1, in FIG. 1, R2 = 1 and R3 = 1.

位置検出パターンの組み合わせが正しければ、R2=1=L2/L1、R3=1=L3/L1となる。また、位置検出パターン12Aの重心と、式(2)と式(3)との交点座標の距離を、L4として、位置検出パターン12Bの重心と、式(2)と式(4)の交点座標との距離を、L5として、位置検出パターン12Cの重心と、式(2)と式(5)の交点座標との距離を、L6とする。L4、L5、L6の比率を、L4を基準として、L4:L5:L6=1:R5:R6と表した時、図1ではR2=1、R3=1となる。位置検出パターンの組み合わせが正しければ、R5=1=L5/L4、R6=1=L6/L4となる。上記関係が成り立たない場合は、位置検出パターンの組み合わせとして正しくない。この方法により、位置検出パターンの組み合わせが正しいか否かを検証することができる。また、図3(A)の場合でも、R2、R3、R5、R6の値が変わるだけで、同様の方法により、位置検出パターンの組み合わせが正しいか否かを判定できる。位置検出パターンの輪郭上の対向する一対の点を、所定の方向に平行に延長した一対の延長線の内部に、全ての他の位置検出パターンそれぞれが、少なくとも一部が重なるように配置した場合でも、また図7に示すような位置検出パターンが四角形でない場合でも、形状に関わらず、組み合わせが正しいか否かの判定が可能である。辺の延びる方向に延長した一対の延長線上の辺A4−A1と、辺A2−A3のかわりに、位置検出パターンの輪郭上の対向する一対の点を、所定の方向に平行に延長した一対の延長線を用いることで、同様に位置検出パターンの組み合わせが正しいか否かを判定できる。さらに、一の位置検出パターンの対向する一対の辺または、一の位置検出パターンの輪郭上の対向する一対の点を、辺の延びる方向又は所定の方向に延長した一対の延長線の内部に、全ての他の位置検出パターンそれぞれが、少なくとも一部が重なるように配置されているため、この条件から外れる位置に存在する位置検出パターンが一の二次元コードを構成する位置検出パターンの候補から外れることで、組み合わせ数の絞り込みが可能となっている。 If the combination of the position detection patterns is correct, R2 = 1 = L2 / L1 and R3 = 1 = L3 / L1. Further, the distance between the center of gravity of the position detection pattern 12A and the coordinates of the intersection of the equations (2) and (3) is L4, and the coordinates of the center of gravity of the position detection pattern 12B and the coordinates of the intersections of the equations (2) and (4). Let L5 be, and let L6 be the distance between the center of gravity of the position detection pattern 12C and the coordinates of the intersection of equations (2) and (5). When the ratio of L4, L5, and L6 is expressed as L4: L5: L6 = 1: R5: R6 with reference to L4, R2 = 1 and R3 = 1 in FIG. If the combination of the position detection patterns is correct, R5 = 1 = L5 / L4 and R6 = 1 = L6 / L4. If the above relationship does not hold, the combination of position detection patterns is incorrect. By this method, it is possible to verify whether or not the combination of position detection patterns is correct. Further, even in the case of FIG. 3A, it can be determined whether or not the combination of the position detection patterns is correct by the same method only by changing the values of R2, R3, R5, and R6. When a pair of opposing points on the contour of the position detection pattern are arranged inside a pair of extension lines extending in parallel in a predetermined direction so that at least a part of each of the other position detection patterns overlaps. However, even when the position detection pattern as shown in FIG. 7 is not a quadrangle, it is possible to determine whether or not the combination is correct regardless of the shape. A pair of sides A4-A1 on a pair of extension lines extending in the extending direction of the sides and a pair of opposing points on the contour of the position detection pattern instead of the sides A2-A3 extending in parallel in a predetermined direction. By using the extension line, it can be similarly determined whether or not the combination of the position detection patterns is correct. Further, a pair of opposing sides of the one position detection pattern or a pair of opposing points on the contour of the one position detection pattern are placed inside a pair of extension lines extending in the extending direction of the sides or in a predetermined direction. Since each of the other position detection patterns is arranged so that at least a part of them overlaps with each other, the position detection pattern existing at a position outside this condition is excluded from the candidate position detection patterns constituting one two-dimensional code. This makes it possible to narrow down the number of combinations.

ステップS38では、コンピュータ45は、検討されていない3種の位置検出パターン候補の組合せが残っているかを判定し、残っていればステップS40に進み、残っていなければステップS50に進む。 In step S38, the computer 45 determines whether or not a combination of three types of position detection pattern candidates that have not been examined remains, and if so, proceeds to step S40, and if not, proceeds to step S50.

ステップS40では、コンピュータ45は、組合せた3種の位置検出パターン候補が、同一の二次元コードの位置検出パターンであるとして、データ部から情報の取り出しを行う。この処理については、図20を参照して後述する。 In step S40, the computer 45 extracts information from the data unit, assuming that the three types of position detection pattern candidates combined are the same two-dimensional code position detection pattern. This process will be described later with reference to FIG.

ステップS42では、コンピュータ45は、情報の取り出しに成功したかの結果に応じて、成功した場合にはステップS44に進み、失敗した場合には失敗した位置検出パターンの組合せを、位置検出パターン候補の組み合わせ対象から除外する処理を行った後、ステップS38に戻る。 In step S42, the computer 45 proceeds to step S44 if it succeeds, and if it fails, the computer 45 sets the combination of the failed position detection patterns as the position detection pattern candidate. After performing the process of excluding from the combination target, the process returns to step S38.

ステップS44では、コンピュータ45は、データの取り出しに成功した二次元パターンに使われた3個の位置検出パターン候補を、同一の二次元コードの識別された3個の位置検出パターンの組み合わせてとして記録する。 In step S44, the computer 45 records the three position detection pattern candidates used for the two-dimensional pattern that succeeded in extracting the data as a combination of the three identified position detection patterns of the same two-dimensional code. do.

次に、ステップS46において、コンピュータ45は、データの取り出しに成功した二次元パターンに使われた3個の位置検出パターン候補を、位置検出パターン候補の組み合わせ対象から除外して、ステップS38に戻る。なお、データの取り出しに成功した二次元パターンの所定の範囲に、使用していない位置検出パターン候補がある場合には、その位置検出パターン候補を、位置検出パターン候補の組み合わせ対象から除外しても良い。 Next, in step S46, the computer 45 excludes the three position detection pattern candidates used for the two-dimensional pattern that succeeded in extracting the data from the combination target of the position detection pattern candidates, and returns to step S38. If there are unused position detection pattern candidates within a predetermined range of the two-dimensional pattern for which data has been successfully retrieved, the position detection pattern candidates may be excluded from the combination target of the position detection pattern candidates. good.

上述したステップS38からS46を繰り返すことにより、3種の位置検出パターン候補の組合せが、同一の二次元コードに含まれているかが確認される。ここで、検討されていない3種の位置検出パターン候補の組み合わせが残っていない場合には、ステップS50に進む。 By repeating steps S38 to S46 described above, it is confirmed whether or not the combination of the three types of position detection pattern candidates is included in the same two-dimensional code. Here, if there is no combination of three types of position detection pattern candidates that have not been examined, the process proceeds to step S50.

ステップS50では、コンピュータ45は、検討されていない2種の位置検出パターン候補の組合せが残っているかを判定し、残っていればステップS52に進み、残っていなければステップS60に進む。 In step S50, the computer 45 determines whether or not a combination of two types of position detection pattern candidates that have not been examined remains, and if so, proceeds to step S52, and if not, proceeds to step S60.

ステップS52では、組合せた2種の位置検出パターン候補が、同一の二次元コードの位置検出パターンであるとして、データ部から情報の取り出しを行う。この処理については、図20を参照して後述する。 In step S52, information is extracted from the data unit, assuming that the two types of combined position detection pattern candidates are the same two-dimensional code position detection patterns. This process will be described later with reference to FIG.

ステップS54では、コンピュータ45は、情報の取り出しに成功したかの結果に応じて、成功した場合にはステップS56に進み、失敗した場合には失敗した位置検出パターンの組合せを、位置検出パターン候補の組み合わせ対象から除外する処理を行った後、ステップS50に戻る。 In step S54, the computer 45 proceeds to step S56 if it succeeds, and if it fails, the computer 45 sets the combination of the failed position detection patterns as the position detection pattern candidate. After performing the process of excluding from the combination target, the process returns to step S50.

ステップS56では、コンピュータ45は、データの取り出しに成功した二次元パターンに使われた2個の位置検出パターン候補を、同一の二次元コードの識別された2個の位置検出パターンの組み合わせてとして記録する。 In step S56, the computer 45 records the two position detection pattern candidates used for the two-dimensional pattern that succeeded in extracting the data as a combination of the two identified position detection patterns of the same two-dimensional code. do.

次に、ステップS58において、コンピュータ45は、データの取り出しに成功した二次元パターンに使われた2個の位置検出パターン候補を、位置検出パターン候補の組み合わせ対象から除外して、ステップS50に戻る。なお、データの取り出しに成功した二次元パターンの所定の範囲に、使用していない位置検出パターン候補がある場合には、その位置検出パターン候補を、位置検出パターン候補の組み合わせ対象から除外する。 Next, in step S58, the computer 45 excludes the two position detection pattern candidates used for the two-dimensional pattern that succeeded in extracting the data from the combination target of the position detection pattern candidates, and returns to step S50. If there is an unused position detection pattern candidate in a predetermined range of the two-dimensional pattern for which data has been successfully retrieved, the position detection pattern candidate is excluded from the combination target of the position detection pattern candidate.

上述したステップS50からステップS58を繰り返すことにより、2種の位置検出パターン候補の組合せが、同一の二次元コードに含まれているかが確認される。ここで、検討されていない2種の位置検出パターン候補の組み合わせが残っていない場合には、ステップS60に進む。 By repeating steps S50 to S58 described above, it is confirmed whether or not the combination of the two types of position detection pattern candidates is included in the same two-dimensional code. Here, if there is no combination of two types of position detection pattern candidates that have not been examined, the process proceeds to step S60.

ステップS60では、コンピュータ45は、検討されていない1種の位置検出パターン候補が残っているかを判定し、残っていればステップS62に進み、残っていなければステップS72に進む。ステップS72では、解析メインの処理を終了する。 In step S60, the computer 45 determines whether or not one type of position detection pattern candidate that has not been examined remains, and if it remains, the process proceeds to step S62, and if not, the process proceeds to step S72. In step S72, the analysis main process is terminated.

ステップS62では、コンピュータ45は、検出された1種の位置検出パターン候補が、位置検出パターンである場合に、該位置検出パターンに対して所定の位置に配置されている位置補正パターンが識別されるかを判定する。この位置補正パターンが識別された場合には、ステップ64に進む。コンピュータ45は、位置検出パターン候補に対して所定の位置に配置されている位置補正パターンを識別できたので、この位置検出パターン候補が、位置検出パターンであることを識別する。一方、位置補正パターンが識別されない場合には、検出された1種の位置検出パターン候補を、検討していない1種の位置検出パターン候補の対象から除外する処理を行った後、ステップS50に戻る。 In step S62, when the detected position detection pattern candidate is a position detection pattern, the computer 45 identifies the position correction pattern arranged at a predetermined position with respect to the position detection pattern. Is determined. If this position correction pattern is identified, the process proceeds to step 64. Since the computer 45 can identify the position correction pattern arranged at a predetermined position with respect to the position detection pattern candidate, the computer 45 identifies that the position detection pattern candidate is the position detection pattern. On the other hand, when the position correction pattern is not identified, the process of excluding one detected position detection pattern candidate from the target of one unexamined position detection pattern candidate is performed, and then the process returns to step S50. ..

ここで位置補正パターンを検出する処理について、図19を参照しながら、以下に説明する。二次元コードに位置補正パターンが存在する場合、位置補正パターンを検出する。位置補正パターンを検出する場合、図18に示す位置検出パターンと同様、画像の左上の点を始点とし、画面をX方向に走査し、右端にたどり着いたら、数ピクセル下の左端からX方向に走査する。言い換えれば、数ピクセル分間引くことになる。これを画像全体に対して繰り返す。間引くピクセル数は、(最大間引き量)=(位置補正パターンの辺の長さの中で最小となるセルサイズ)×(撮影時のセルあたりのピクセル数)である。全ての位置補正パターンの辺の長さの中で最小となるセルサイズは、コードの回転も考慮し、位置補正パターンの回転で起こり得るY方向の最小セルサイズである。撮影時のセルあたりのピクセル数は、1セル当たり1ピクセルを下回ると、理想的な撮影画像でもセルの明と暗を判別することが困難になる。実際の撮影画像でのセルのずれ又は回転を考慮すると、少なくとも1セル当たり3ピクセル以上であることが望ましい。この処理は、間引くピクセルサイズを除き、位置検出パターンの検出のための走査とほぼ同じ処理になるため、同時に行ってもよい。その場合、間引くピクセルサイズを、少ない方に合わせる。そして、コンピュータ45は、検出された位置補正パターンを検査する。 Here, the process of detecting the position correction pattern will be described below with reference to FIG. If a position correction pattern exists in the two-dimensional code, the position correction pattern is detected. When detecting the position correction pattern, as in the position detection pattern shown in FIG. 18, the screen is scanned in the X direction starting from the upper left point of the image, and when the right end is reached, the position is scanned in the X direction from the left end several pixels below. do. In other words, it will be subtracted for a few pixels. This is repeated for the entire image. The number of pixels to be thinned out is (maximum thinning amount) = (minimum cell size in the side length of the position correction pattern) × (number of pixels per cell at the time of shooting). The minimum cell size among the side lengths of all the position correction patterns is the minimum cell size in the Y direction that can occur in the rotation of the position correction pattern in consideration of the rotation of the cord. If the number of pixels per cell at the time of shooting is less than 1 pixel per cell, it becomes difficult to distinguish between the light and dark of the cell even in an ideal shot image. Considering the displacement or rotation of cells in the actual captured image, it is desirable that the number of pixels is at least 3 pixels per cell. Since this process is almost the same as the scanning for detecting the position detection pattern except for the pixel size to be thinned out, it may be performed at the same time. In that case, adjust the pixel size to be thinned out to the smaller one. Then, the computer 45 inspects the detected position correction pattern.

具体的には、走査中に明から暗の境界を見つけた場合、暗部分の周囲を走査する。その際に、最小・最大のX座標、Y座標をそれぞれ求める。これにより、暗の固まりの外接する長方形が取得できる。これの左上座標を(x1’,y1’)、右下座標を(x2’,y2’)と表す。図19は、位置補正パターンの形状チェックを説明する図である。まず、コンピュータ45は、位置補正パターンの形状をチェックする。 Specifically, when a light-dark boundary is found during scanning, the area around the dark portion is scanned. At that time, the minimum and maximum X and Y coordinates are obtained, respectively. As a result, the circumscribed rectangle of the dark mass can be obtained. The upper left coordinates are represented as (x1', y1'), and the lower right coordinates are represented as (x2', y2'). FIG. 19 is a diagram illustrating a shape check of the position correction pattern. First, the computer 45 checks the shape of the position correction pattern.

(x2’-x1’)と、(y2’−y1’)の値がほぼ同じ値となる。図1に示す二次元コードの各位置補正パターン16A、16Bは、3×3の暗セルである。そこで、まず明の穴がないことを確認する。始点を外接長方形の左側中点(x1’,(y1’+y2’)/2)とし、終点を(x2’,(y1’+y2’)/2)として、x軸方向の走査を行う。ここで、暗の左端(lx1’)から暗の右端(rx1’)まで、全て暗であることを確認する。さらに、図19に示すように、中心座標((lx1’+rx1’)/2,(y1’+y2’)/2)から上下を走査し、こちらもy軸方向に、暗の上端と暗の下端まで、全て暗であることを確認する。 The values of (x2'-x1') and (y2'-y1') are almost the same. The position correction patterns 16A and 16B of the two-dimensional code shown in FIG. 1 are 3 × 3 dark cells. Therefore, first make sure that there are no bright holes. Scanning in the x-axis direction is performed with the start point as the left midpoint (x1', (y1' + y2') / 2) of the circumscribed rectangle and the end point as (x2', (y1' + y2') / 2). Here, it is confirmed that everything from the left end of darkness (lx1') to the right end of darkness (rx1') is dark. Further, as shown in FIG. 19, scanning up and down from the center coordinates ((lx1'+ rx1') / 2, (y1'+ y2') / 2), also in the y-axis direction, the upper end of darkness and the lower end of darkness are scanned. Make sure everything is dark.

次に、コンピュータ45は、各位置補正パターンの頂点を探索する。外接する長方形の左上の座標(x1’,y1’)からX軸方向に(x2’,y1’)まで走査する。一番初めに接触した暗点の座標をvertex1:(vx1’,vy1’)とする。次に右上の座標(x2’,y1’)からY軸方向に(x2’,y2’)まで走査する。一番初めに接触した暗点の座標をvertex2:(vx2’,vy2’)とする。右下の座標(x2’,y2’)からX軸の反対方向に(x1’,y2’)まで走査する。一番初めに接触した暗点の座標をvertex3:(vx3’,vy3’)とする。次に、左下の座標(x1’,y2’)からY軸の反対方向に(x1’,y1’)まで走査する。一番初めに接触した暗点の座標をvertex4:(vx4’,vy4’)とする。vertex1〜4は正方形となるはずである。そうでない場合は、位置補正パターンではないと判定する。 Next, the computer 45 searches for the vertices of each position correction pattern. Scan from the upper left coordinates (x1', y1') of the circumscribed rectangle to (x2', y1') in the X-axis direction. Let the coordinates of the first contacted dark spot be vertex1: (vx1', vy1'). Next, scanning is performed from the upper right coordinates (x2', y1') to (x2', y2') in the Y-axis direction. Let the coordinates of the first contacted dark spot be vertex2 :( vx2', vy2'). Scan from the lower right coordinates (x2', y2') to (x1', y2') in the opposite direction of the X-axis. Let the coordinates of the first contacted dark spot be vertex3 :( vx3', vy3'). Next, scanning is performed from the lower left coordinates (x1', y2') to (x1', y1') in the direction opposite to the Y axis. Let the coordinates of the first contacted dark spot be vertex4 :( vx4', vy4'). vertex1-4 should be square. If not, it is determined that the pattern is not a position correction pattern.

次に、コンピュータ45は、位置補正パターンの面積を求める。位置補正パターンの面積は、外接する正方形の面積から4隅を含む4つの直角三角形の面積を減じることにより求める。面積=(x2’−x1’)×(y2’−y1’)−(vx1’−vx4’)×(vy4’−vy1’)/2−(vx2’−vx1’)×(vy2’−vy1’)/2−(vx2’−vx3’)×(vy3’−vy2’)/2−(vx3’−vx4’)×(vy3’−vy4’)/2で求まる。 Next, the computer 45 obtains the area of the position correction pattern. The area of the position correction pattern is obtained by subtracting the area of four right triangles including the four corners from the area of the circumscribed square. Area = (x2'-x1') x (y2'-y1')-(vx1'-vx4') x (vy4'-vy1') / 2- (vx2'-vx1') x (vy2'-vy1' ) / 2- (Vx2'-vx3') x (vy3'-vy2') / 2- (vx3'-vx4') x (vy3'-vy4') / 2.

次に、コンピュータ45は、位置補正パターン候補の回転角度を求める。位置補正パターンは、正方形であり90度以上の傾きを検知できないので、90度までの角度を求める。角度は時計回りとする。θ=arctan((vy2’−vy1’)/(vx2’−vx1’))θが回転角度となる。これら検査は簡単なものであり、これと似た形状(黒の正方形)は多くあるため、多数のノイズを拾うことになる。位置補正パターンは、位置検出パターンにより画像内での二次元コードの位置がおおまかに判明した後に、セルの座標補正や、位置検出パターン候補の作成を行うため用いるものであり、検出された位置補正パターンを単独で正しいかどうかを判定する必要はなく、識別された位置検出パターン、又は位置検出パターン候補との位置関係に基づいて、正しい位置補正パターンか否かを判定できればよい。また一方で、位置補正パターンが見つからなくても、位置検出パターン候補を取得することは可能であり、位置補正パターンは、位置検出パターンと異なり必須ではない。 Next, the computer 45 obtains the rotation angle of the position correction pattern candidate. Since the position correction pattern is a square and cannot detect an inclination of 90 degrees or more, an angle up to 90 degrees is obtained. The angle is clockwise. θ = arctan ((vy2'-vy1') / (vx2'-vx1')) θ is the rotation angle. These tests are simple, and there are many similar shapes (black squares) that will pick up a lot of noise. The position correction pattern is used to correct the coordinates of a cell and create a position detection pattern candidate after the position of the two-dimensional code in the image is roughly determined by the position detection pattern, and the detected position correction is performed. It is not necessary to determine whether or not the pattern is correct by itself, and it is sufficient if it is possible to determine whether or not the pattern is the correct position correction pattern based on the identified position detection pattern or the positional relationship with the position detection pattern candidate. On the other hand, even if the position correction pattern is not found, it is possible to acquire the position detection pattern candidate, and the position correction pattern is not essential unlike the position detection pattern.

ステップS64では、コンピュータ45は、検出された1種の位置検出パターン候補が、二次元コードの位置検出パターンであるとして、データ部から情報の取り出しを行う。この処理については、図20を参照して後述する。 In step S64, the computer 45 extracts information from the data unit, assuming that the detected position detection pattern candidate is the position detection pattern of the two-dimensional code. This process will be described later with reference to FIG.

ステップS66では、コンピュータ45は、情報の取り出しに成功したかの結果に応じて、成功した場合にはステップS68に進み、失敗した場合には失敗した位置検出パターン候補を、位置検出パターン候補の対象から除外する処理を行った後、ステップS60に戻る。 In step S66, the computer 45 proceeds to step S68 if it succeeds, and if it fails, the computer 45 targets the failed position detection pattern candidate as the target of the position detection pattern candidate. After performing the process of excluding from, the process returns to step S60.

ステップS68では、コンピュータ45は、データの取り出しに成功した二次元パターンに使われた1個の位置検出パターン候補を、二次元コードの識別された位置検出パターンとして記録する。 In step S68, the computer 45 records one position detection pattern candidate used for the two-dimensional pattern that succeeded in extracting the data as the identified position detection pattern of the two-dimensional code.

次に、ステップS70において、コンピュータ45は、データの取り出しに成功した二次元パターンに使われた1個の位置検出パターン候補を、位置検出パターン候補の対象から除外して、ステップS60に戻る。なお、データの取り出しに成功した二次元パターンの所定の範囲に、使用していない位置検出パターン候補がある場合には、その位置検出パターン候補を、位置検出パターン候補の対象から除外する。 Next, in step S70, the computer 45 excludes one position detection pattern candidate used for the two-dimensional pattern that succeeded in extracting data from the target of the position detection pattern candidate, and returns to step S60. If there is an unused position detection pattern candidate in a predetermined range of the two-dimensional pattern for which data has been successfully retrieved, the position detection pattern candidate is excluded from the target of the position detection pattern candidate.

上述したステップS60からステップS70を繰り返すことにより、1種の位置検出パターン候補が、二次元コードの位置検出パターンであるかが確認される。ここで、除外されていない1種の位置検出パターン候補が残っていない場合には、ステップS72に進む。ステップS72では、解析メインの処理を終了する。処理時間短縮のため、ステップS50で、検討していない2種の位置検出パターン候補の組み合わせがない場合は、ステップS72で解析メインの処理を終了しても良い。 By repeating steps S60 to S70 described above, it is confirmed whether or not one type of position detection pattern candidate is the position detection pattern of the two-dimensional code. Here, if one type of position detection pattern candidate that has not been excluded does not remain, the process proceeds to step S72. In step S72, the analysis main process is terminated. In order to shorten the processing time, if there is no combination of two types of position detection pattern candidates that have not been examined in step S50, the analysis main processing may be terminated in step S72.

次に、上述したステップS40、S52及びS64における情報の取り出し処理を、図20〜図23を参照して、以下に説明する。 Next, the information retrieval process in steps S40, S52, and S64 described above will be described below with reference to FIGS. 20 to 23.

まず、ステップS80において、コンピュータ45は、情報取り出し処理を開始する。 First, in step S80, the computer 45 starts the information retrieval process.

次に、ステップS82において、コンピュータ45は、一又は複数の位置検出パターンから合計4点の座標を取得する。まず、ステップS40の場合の処理について、以下に説明する。 Next, in step S82, the computer 45 acquires the coordinates of a total of four points from one or a plurality of position detection patterns. First, the process in the case of step S40 will be described below.

ステップS40の場合には、コンピュータ45は、検出された3個の位置検出パターン候補の内から2個の位置検出パターン候補を選択して、選択された一の位置検出パターン候補から少なくとも1点の座標を取得するように、選択された少なくとも2個の位置検出パターン候補から合計4点の座標を取得する。この際、位置検出パターンは外側の2つを選択し、各位置検出パターンから4隅の2点を選択して、選択された4点を結んだ外形が長方形状となることが望ましい。後述するステップS96において、取り出されたメッセージから正しく情報が得られたならば、検出された位置検出パターン候補は、識別された位置検出パターンということになる。なお、コンピュータ45は、識別された少なくとも3個の位置検出パターンの内から少なくとも1個の記位置検出パターンを選択して、選択された位置検出パターンから合計4点の座標を取得してもよい。 In the case of step S40, the computer 45 selects two position detection pattern candidates from the three detected position detection pattern candidates, and at least one point from the selected one position detection pattern candidate. The coordinates of a total of four points are acquired from at least two selected position detection pattern candidates so as to acquire the coordinates. At this time, it is desirable that two outer positions are selected for the position detection pattern, two points at the four corners are selected from each position detection pattern, and the outer shape connecting the four selected points is rectangular. If the information is correctly obtained from the extracted message in step S96 described later, the detected position detection pattern candidate is the identified position detection pattern. The computer 45 may select at least one notation position detection pattern from the at least three identified position detection patterns and acquire the coordinates of a total of four points from the selected position detection pattern. ..

図21は、検出された3個の位置検出パターン候補から合計4点の座標を取得することを説明する図である。 FIG. 21 is a diagram illustrating that coordinates of a total of four points are acquired from the three detected position detection pattern candidates.

図21に示すように、撮影された二次元コードの画像に基づいて、3つの位置検出パターン候補が検出されているとする。コンピュータ45は、4点の座標を、複数の位置検出パターンの輪郭を形成する点から取得することが好ましい。図21に示す例では、位置検出パターン12A、12B、12Cの外形は四角形であり、コンピュータ45は、4点の座標を、位置検出パターン12A、12B、12Cの輪郭を形成する四角形の頂点から取得する。4点の座標は、二次元コードの射影変換を行うパラメータとして取得して使用されるので、同一直線上に配置されない4点を取得することが好ましい。この考え方は、後述するS52及びS64の処理にも適用される。 As shown in FIG. 21, it is assumed that three position detection pattern candidates are detected based on the captured image of the two-dimensional code. The computer 45 preferably acquires the coordinates of the four points from the points forming the contours of the plurality of position detection patterns. In the example shown in FIG. 21, the outer shape of the position detection patterns 12A, 12B, 12C is a quadrangle, and the computer 45 acquires the coordinates of the four points from the vertices of the quadrangle forming the contour of the position detection patterns 12A, 12B, 12C. do. Since the coordinates of the four points are acquired and used as parameters for performing the projective transformation of the two-dimensional code, it is preferable to acquire the four points that are not arranged on the same straight line. This idea also applies to the processes of S52 and S64 described later.

第1位置検出パターン12Aは、左上の位置から反時計回りに、4つの頂点A1、頂点A2、頂点A3、頂点A4を有する。第2位置検出パターン12Bは、左上の位置から反時計回りに、4つの頂点B1、頂点B2、頂点B3、頂点B4を有する。第3位置検出パターン12Cは、左上の位置から反時計回りに、4つの頂点C1、頂点C2、頂点C3、頂点C4を有する。 The first position detection pattern 12A has four vertices A1, vertices A2, vertices A3, and vertices A4 in a counterclockwise direction from the upper left position. The second position detection pattern 12B has four vertices B1, vertices B2, vertices B3, and vertices B4 in a counterclockwise direction from the upper left position. The third position detection pattern 12C has four vertices C1, vertices C2, vertices C3, and vertices C4 in a counterclockwise direction from the upper left position.

コンピュータ45は、3つの異なる位置検出パターン候補の内、距離が最も離れている第1位置検出パターン12A及び第3位置検出パターン12Cを選択する。そして、コンピュータ45は、第1位置検出パターン12Aから2つの頂点A1及び頂点A2の座標を取得し、第3位置検出パターン12Cから2つの頂点C3及び頂点C4の座標を取得する。このように、最も距離が離れている2つの位置検出パターンを選択し、更に、最も距離が離れている4つの頂点が取得される理由は、データ取得の計算対象となるデータ部11から近いことが望まれるためである。1つの位置検出パターンから4点の座標を取得した場合、遠くのデータ部11における座標の計算精度が悪化するため、データ部11の全体を広くカバーできる4点を取得することが望ましい。また、読取装置のレンズの歪みや、二次元コードを印字する面の歪みなどが原因で撮影されたコードに歪みが発生した場合、その歪みは一様でない。そのため、同じ位置検出パターンから取得した4点の座標から二次元空間の射影変換の係数を取得するよりも、異なる位置検出パターンにまたがる複数の点を元に係数を計算したほうが、歪みによる影響を軽減できる効果が期待できる。 The computer 45 selects the first position detection pattern 12A and the third position detection pattern 12C, which are the farthest from the three different position detection pattern candidates. Then, the computer 45 acquires the coordinates of the two vertices A1 and A2 from the first position detection pattern 12A, and acquires the coordinates of the two vertices C3 and C4 from the third position detection pattern 12C. In this way, the reason why the two position detection patterns that are farthest apart are selected and the four vertices that are farthest apart are acquired is that they are close to the data unit 11 that is the calculation target of data acquisition. Is desired. When the coordinates of four points are acquired from one position detection pattern, the calculation accuracy of the coordinates in the distant data unit 11 deteriorates. Therefore, it is desirable to acquire four points that can cover the entire data unit 11 widely. Further, when the code captured is distorted due to the distortion of the lens of the reader or the distortion of the surface on which the two-dimensional code is printed, the distortion is not uniform. Therefore, it is better to calculate the coefficient based on multiple points that span different position detection patterns than to obtain the coefficient of projective transformation in two-dimensional space from the coordinates of four points acquired from the same position detection pattern. The effect that can be reduced can be expected.

そして、コンピュータ45は、取得した4つの頂点の組み合わせが、以下の(a)(b)の条件を満たすことが望ましい。これらの条件が満たされない場合は、ステップS100に進んでも良い。ステップS100では情報の取り出しに失敗して、処理を終了する。 Then, it is desirable that the computer 45 satisfies the following conditions (a) and (b) for the combination of the acquired four vertices. If these conditions are not satisfied, the process may proceed to step S100. In step S100, the retrieval of information fails, and the process ends.

(a)4つの頂点を結んで形成される4角形の4つの頂点の角度が直角になり、向かい合う辺の長さが1:1となる。
(b)4つの頂点を結んで形成される4角形がデータ部から所定の距離以上離れている。
(A) The angles of the four vertices of the quadrangle formed by connecting the four vertices are at right angles, and the lengths of the opposite sides are 1: 1.
(B) The quadrangle formed by connecting the four vertices is separated from the data unit by a predetermined distance or more.

以上が、ステップS40の場合の処理の説明である。 The above is the description of the process in the case of step S40.

次に、ステップS52の場合の処理について、以下に説明する。 Next, the process in the case of step S52 will be described below.

ステップS52の場合には、コンピュータ45は、検出された2個の記位置検出パターン候補に基づいて、一の位置検出パターン候補から少なくとも1点の座標を取得するように、検出された2個の位置検出パターン候補から合計4点の座標を取得する。後述するステップS96において、取り出されたメッセージから正しく情報が得られたならば、検出された位置検出パターン候補は、識別された位置検出パターンということになる。なお、コンピュータ45は、識別された2個の位置検出パターンの内から少なくとも1個の位置検出パターンを選択して、選択された位置検出パターンから合計4点の座標を取得してもよい。 In the case of step S52, the computer 45 is detected so as to acquire the coordinates of at least one point from one position detection pattern candidate based on the two detected position detection pattern candidates. The coordinates of a total of 4 points are acquired from the position detection pattern candidates. If the information is correctly obtained from the extracted message in step S96 described later, the detected position detection pattern candidate is the identified position detection pattern. The computer 45 may select at least one position detection pattern from the two identified position detection patterns and acquire the coordinates of a total of four points from the selected position detection patterns.

図22(A)〜図22(C)は、検出された2個の位置検出パターン候補から合計4点の座標を取得することを説明する図である。 22 (A) to 22 (C) are diagrams for explaining that the coordinates of a total of four points are acquired from the two detected position detection pattern candidates.

図22(A)〜図22(C)に示すように、撮影された二次元コードの画像に基づいて、3つの内の2つ位置検出パターン候補が検出されているとする。二次元コードの汚れ又は撮影時のぼけ・ブレ等のために、3つの内の1つ位置検出パターンは検出されていない。 As shown in FIGS. 22 (A) to 22 (C), it is assumed that two of the three position detection pattern candidates are detected based on the captured two-dimensional code image. One of the three position detection patterns has not been detected due to dirt on the two-dimensional code or blurring / blurring during shooting.

図22(A)に示す例では、第1位置検出パターン12A及び第3位置検出パターン12Cが検出されており、第2位置検出パターン12Bは検出されていない。コンピュータ45は、第1位置検出パターン12Aから2つの頂点A1及び頂点A2の座標を取得し、第3位置検出パターン12Cから2つの頂点C3及び頂点C4の座標を取得する。最も距離が離れている4つの頂点が取得される理由は、射影変換を行うための4点の座標は、データ取得の計算対象となるデータ部11から近いことが望まれるからである。1つの位置検出パターンから4点の座標を取得した場合、遠くのデータ部11における座標の計算精度が悪化するため、データ部11を広くカバーできる4点を取得することが望ましい。また、読取装置のレンズの歪みや、二次元コードを印字する面の歪みなどが原因で撮影されたコードに歪みが発生した場合、その歪みは一様でない。そのため、同じ位置検出パターンから取得した4点の座標から二次元空間の射影変換の係数を取得するよりも、異なる位置検出パターンにまたがる複数の点を元に係数を計算したほうが、歪みによる影響を軽減できる効果が期待できる。この考え方は、図22(B)及び図22(C)の処理に対しても適用される。 In the example shown in FIG. 22 (A), the first position detection pattern 12A and the third position detection pattern 12C are detected, but the second position detection pattern 12B is not detected. The computer 45 acquires the coordinates of the two vertices A1 and A2 from the first position detection pattern 12A, and acquires the coordinates of the two vertices C3 and C4 from the third position detection pattern 12C. The reason why the four vertices most distant from each other are acquired is that it is desirable that the coordinates of the four points for performing the projective transformation are close to the data unit 11 to be calculated for data acquisition. When the coordinates of four points are acquired from one position detection pattern, the calculation accuracy of the coordinates in the distant data unit 11 deteriorates. Therefore, it is desirable to acquire four points that can cover the data unit 11 widely. Further, when the code captured is distorted due to the distortion of the lens of the reader or the distortion of the surface on which the two-dimensional code is printed, the distortion is not uniform. Therefore, it is better to calculate the coefficient based on multiple points that span different position detection patterns than to obtain the coefficient of projective transformation in two-dimensional space from the coordinates of four points acquired from the same position detection pattern. The effect that can be reduced can be expected. This idea also applies to the processes of FIGS. 22 (B) and 22 (C).

図22(B)に示す例では、第2位置検出パターン12B及び第3位置検出パターン12Cが検出されており、第1位置検出パターン12Aは検出されていない。コンピュータ45は、第2位置検出パターン12Bから2つの頂点B1及び頂点B2の座標を取得し、第3位置検出パターン12Cから2つの頂点C3及び頂点C4の座標を取得する。 In the example shown in FIG. 22B, the second position detection pattern 12B and the third position detection pattern 12C are detected, but the first position detection pattern 12A is not detected. The computer 45 acquires the coordinates of the two vertices B1 and B2 from the second position detection pattern 12B, and acquires the coordinates of the two vertices C3 and C4 from the third position detection pattern 12C.

図22(C)に示す例では、第1位置検出パターン12A及び第2位置検出パターン12Bが検出されており、第3位置検出パターン12Cは検出されていない。コンピュータ45は、第1位置検出パターン12Aから2つの頂点A1及び頂点A2の座標を取得し、第2位置検出パターン12Bから2つの頂点B3及び頂点B4の座標を取得する。 In the example shown in FIG. 22C, the first position detection pattern 12A and the second position detection pattern 12B are detected, but the third position detection pattern 12C is not detected. The computer 45 acquires the coordinates of the two vertices A1 and A2 from the first position detection pattern 12A, and acquires the coordinates of the two vertices B3 and B4 from the second position detection pattern 12B.

そして、コンピュータ45は、取得した4つの頂点の組み合わせが、以下の(a)(b)の条件を満たすことが望ましい。これらの条件が満たされない場合は、ステップS100に進んでも良い。ステップS100では情報の取り出しに失敗して、処理を終了する。 Then, it is desirable that the computer 45 satisfies the following conditions (a) and (b) for the combination of the acquired four vertices. If these conditions are not satisfied, the process may proceed to step S100. In step S100, the retrieval of information fails, and the process ends.

(a)4つの頂点を結んで形成される4角形の4つの頂点の角度が直角になり、向かい合う辺の長さが1:1となる。
(b)4つの頂点を結んで形成される4角形がデータ部から所定の距離以上離れている。
(A) The angles of the four vertices of the quadrangle formed by connecting the four vertices are at right angles, and the lengths of the opposite sides are 1: 1.
(B) The quadrangle formed by connecting the four vertices is separated from the data unit by a predetermined distance or more.

以上が、ステップS52の場合の処理の説明である。 The above is the description of the process in the case of step S52.

次に、ステップS64の場合の処理について、以下に説明する。 Next, the process in the case of step S64 will be described below.

ステップS64の場合には、コンピュータ45は、識別された位置検出パターンから、4点の座標を取得する。 In the case of step S64, the computer 45 acquires the coordinates of four points from the identified position detection pattern.

図23(A)〜図23(C)は、検出された1個の位置検出パターン候補から合計4点の座標を取得することを説明する図である。 23 (A) to 23 (C) are diagrams for explaining that the coordinates of a total of four points are acquired from one detected position detection pattern candidate.

図23(A)〜図23(C)に示すように、撮影された二次元コードの画像に基づいて、3つの内の1つ位置検出パターンが識別されているとする。二次元コードの汚れ又は撮影時のぼけ・ブレ等のために、3つの内の2つ位置検出パターンは検出されていない。位置検出パターン候補が正しいとすると、位置補正パターンが所定の位置から見つかるはずである。位置検出パターン12Aの頂点A1と頂点A2の中点をM1、頂点A2と頂点A3の中点をM2、頂点A3と頂点A4の中点をM3、頂点A4と頂点A1の中点をM4とする。位置検出パターンの重心座標から、4点M1、M2、M3、M4を通る直線を引く。その直線上、且つ重心座標から所定の距離(例えば14.5セル)に、位置補正パターンが存在するはずである。さらに位置検出パターンと、位置補正パターンの面積を比較し、例えば位置検出パターンの面積:位置補正パターンの面積=64:9(8×8セル:3×3セル)でなければ、位置検出パターンの候補から除外する。さらに位置検出パターンと、位置補正パターンの回転角度を比較し、同じでなければ、位置検出パターンの候補から除外する。以上の判定より、位置検出パターン候補と、位置補正パターンから、正しい位置検出パターンを取得できる。 As shown in FIGS. 23 (A) to 23 (C), it is assumed that one of the three position detection patterns is identified based on the captured two-dimensional code image. Two of the three position detection patterns have not been detected due to dirt on the two-dimensional code or blurring / blurring during shooting. If the position detection pattern candidate is correct, the position correction pattern should be found at a predetermined position. The midpoint of the apex A1 and the apex A2 of the position detection pattern 12A is M1, the midpoint of the apex A2 and the apex A3 is M2, the midpoint of the apex A3 and the apex A4 is M3, and the midpoint of the apex A4 and the apex A1 is M4. .. From the coordinates of the center of gravity of the position detection pattern, a straight line passing through the four points M1, M2, M3, and M4 is drawn. The position correction pattern should exist on the straight line and at a predetermined distance (for example, 14.5 cells) from the coordinates of the center of gravity. Further, the area of the position detection pattern and the area of the position correction pattern are compared. For example, if the area of the position detection pattern: the area of the position correction pattern = 64: 9 (8 × 8 cells: 3 × 3 cells), the position detection pattern Exclude from candidates. Furthermore, the rotation angles of the position detection pattern and the position correction pattern are compared, and if they are not the same, they are excluded from the candidates for the position detection pattern. From the above determination, the correct position detection pattern can be obtained from the position detection pattern candidate and the position correction pattern.

図23(A)に示す例では、位置補正パターン16Aを識別することにより、第1位置検出パターン12Aが識別されており、第2位置検出パターン12B及び第3位置検出パターン12Cは検出されていない。コンピュータ45は、第1位置検出パターン12Aから4つの頂点A1、頂点A2、頂点A3及び頂点A4の座標を取得する。四角形の位置検出パターンの4つの頂点が取得される理由は、位置検出パターン上の局所的に汚れている点を取得することを回避するためである。図23(A)に示す例では、4つの頂点が1つの位置検出パターンから取得されるため、4つの頂点から大きく離れたコード端部に位置するデータ部が発生しているので、第1位置検出パターン12A、第3位置検出パターン12Cから4点を取得した場合に比べ、精度は下がるがデータの検出は可能である。この考え方は、図23(B)及び図23(C)の処理に対しても適用される。 In the example shown in FIG. 23 (A), the first position detection pattern 12A is identified by identifying the position correction pattern 16A, and the second position detection pattern 12B and the third position detection pattern 12C are not detected. .. The computer 45 acquires the coordinates of the four vertices A1, the vertices A2, the vertices A3, and the vertices A4 from the first position detection pattern 12A. The reason why the four vertices of the quadrangular position detection pattern are acquired is to avoid acquiring locally soiled points on the position detection pattern. In the example shown in FIG. 23 (A), since the four vertices are acquired from one position detection pattern, a data unit located at the end of the code far away from the four vertices is generated, so that the first position Compared with the case where four points are acquired from the detection pattern 12A and the third position detection pattern 12C, the accuracy is lower, but the data can be detected. This idea also applies to the processes of FIGS. 23 (B) and 23 (C).

図23(B)に示す例では、位置補正パターン16A又は16Bを識別することにより、第2位置検出パターン12Bが識別されており、第1位置検出パターン12A及び第3位置検出パターン12Cは検出されていない。コンピュータ45は、第2位置検出パターン12Bから4つの頂点B1、頂点B2、頂点B3及び頂点B4の座標を取得する。 In the example shown in FIG. 23B, the second position detection pattern 12B is identified by identifying the position correction pattern 16A or 16B, and the first position detection pattern 12A and the third position detection pattern 12C are detected. Not. The computer 45 acquires the coordinates of the four vertices B1, the vertices B2, the vertices B3, and the vertices B4 from the second position detection pattern 12B.

図23(C)に示す例では、位置補正パターン16Bを識別することにより、第3位置検出パターン12Cが識別されており、第1位置検出パターン12A及び第2位置検出パターン12Bは検出されていない。コンピュータ45は、第3位置検出パターン12Cから4つの頂点C1、頂点C2、頂点C3及び頂点AC2の座標を取得する。 In the example shown in FIG. 23C, the third position detection pattern 12C is identified by identifying the position correction pattern 16B, and the first position detection pattern 12A and the second position detection pattern 12B are not detected. .. The computer 45 acquires the coordinates of the four vertices C1, the vertices C2, the vertices C3, and the vertices AC2 from the third position detection pattern 12C.

そして、コンピュータ45は、取得した4つの頂点の組み合わせが、以下の(a)(b)の条件を満たすことが望ましい。これらの条件が満たされない場合は、ステップS100に進んでも良い。ステップS100では情報の取り出しに失敗して、処理を終了する。 Then, it is desirable that the computer 45 satisfies the following conditions (a) and (b) for the combination of the acquired four vertices. If these conditions are not satisfied, the process may proceed to step S100. In step S100, the retrieval of information fails, and the process ends.

(a)4つの頂点を結んで形成される4角形の4つの頂点の角度が直角になり、向かい合う辺の長さが1:1となる。
(b)4つの頂点を結んで形成される4角形がデータ部から所定の距離以上離れている。
(A) The angles of the four vertices of the quadrangle formed by connecting the four vertices are at right angles, and the lengths of the opposite sides are 1: 1.
(B) The quadrangle formed by connecting the four vertices is separated from the data unit by a predetermined distance or more.

以上が、ステップS64の場合の処理の説明である。 The above is the description of the process in the case of step S64.

コンピュータ45は、ステップS82の処理を終了すると、ステップS84に進む。 When the computer 45 finishes the process of step S82, the computer 45 proceeds to step S84.

次に、ステップS84において、コンピュータ45は、取得された4点の座標に基づいて、二次元空間の射影変換の係数が求まり、射影変換により二次元コードの画像の座標変換を行って、歪み又はぼけが補正された二次元コードの元の形状の画像を生成する。 Next, in step S84, the computer 45 obtains the coefficient of the projective conversion in the two-dimensional space based on the acquired coordinates of the four points, performs the coordinate conversion of the image of the two-dimensional code by the projective conversion, and distorts or causes it. Generates an image of the original shape of the blurred 2D code.

次に、ステップS86において、コンピュータ45は、元の形状に座標変換された二次元コードの画像における各セルの座標及び画素値を求める。 Next, in step S86, the computer 45 obtains the coordinates and pixel values of each cell in the image of the two-dimensional code whose coordinates have been converted to the original shape.

次に、ステップS88において、コンピュータ45は、各セルの画素値に基づいて、メッセージ、誤り訂正符号等を含むバイナリ形式の実データを取り出す。 Next, in step S88, the computer 45 extracts real data in binary format including a message, an error correction code, and the like based on the pixel values of each cell.

次に、ステップS90において、コンピュータ45は、誤り訂正符号を用いて、データ部と誤り訂正符号に関して、誤りの数と位置を検出する。誤り数がゼロであれば、ステップS96に進む。誤り数がゼロでなければ、ステップS92に進む。 Next, in step S90, the computer 45 uses the error correction code to detect the number and position of errors with respect to the data unit and the error correction code. If the number of errors is zero, the process proceeds to step S96. If the number of errors is not zero, the process proceeds to step S92.

ステップS92では、コンピュータ45は、誤り訂正可能であるか否かを判定し、訂正可能であればステップS94に進み、訂正ができなければステップS100に進む。ステップS100では、情報の取り出しが失敗して、処理を終了する。 In step S92, the computer 45 determines whether or not the error can be corrected, and if the error can be corrected, the process proceeds to step S94, and if the error cannot be corrected, the process proceeds to step S100. In step S100, the retrieval of information fails, and the process ends.

ステップS94では、コンピュータ45は、誤り訂正符号を用いて、実データの誤り訂正を行う。 In step S94, the computer 45 corrects the error of the actual data by using the error correction code.

次に、ステップS96において、コンピュータ45は、実データに基づいてメッセージを復元して記憶する。 Next, in step S96, the computer 45 restores and stores the message based on the actual data.

次に、ステップS98において、コンピュータ45は、情報の取り出しに成功したので、情報の取り出しを終了して、ステップS40、S52又はS64の次の処理に進む。 Next, in step S98, since the computer 45 succeeded in extracting the information, the extraction of the information is finished, and the process proceeds to the next process of steps S40, S52, or S64.

図22及び図23の例で示したように、位置検出パターンの個数は、二次元コードが汚れている場合には検出できないものが発生することを考慮すると、個数の多い方が好ましい。しかし、個数が多いと、位置検出パターンが占有する二次元コード内の領域の面積の比率が増加するので、データ効率が低下すると共に、位置検出パターンを検出するための処理量も増加する。従って、位置検出パターンの個数は、二次元コードの使用形態等に応じて適宜決定することが好ましい。 As shown in the examples of FIGS. 22 and 23, the number of position detection patterns is preferably large in consideration of the fact that some of the position detection patterns cannot be detected when the two-dimensional code is dirty. However, if the number is large, the ratio of the area of the area in the two-dimensional code occupied by the position detection pattern increases, so that the data efficiency decreases and the processing amount for detecting the position detection pattern also increases. Therefore, it is preferable that the number of position detection patterns is appropriately determined according to the usage pattern of the two-dimensional code and the like.

本発明では、上述した二次元コード、二次元コードの解析方法、二次元コードの解析装置及び二次元コードを解析するプログラムは、本発明の趣旨を逸脱しない限り適宜変更が可能である。また、一の実施形態が有する構成要件は、他の実施形態にも適宜適用することができる。 In the present invention, the above-mentioned two-dimensional code, two-dimensional code analysis method, two-dimensional code analysis device, and program for analyzing the two-dimensional code can be appropriately changed as long as the gist of the present invention is not deviated. Further, the constituent requirements of one embodiment can be appropriately applied to other embodiments.

10 二次元コード
10A 基本パターン部
10B 周辺部
11 データ部
12A 第1位置検出パターン
12B 第2位置検出パターン
12C 第3位置検出パターン
13 セル
14 ブロック
15 分離スペース
16A、16B 位置補正パターン
L 延長線
20 カード
21 絵柄
30 本
31 背表紙
40 解析装置
41 読み取り部
42 レンズ
43 イメージセンサ
44 アナログ・デジタル変換部(AD)
45 コンピュータ
46 ディスプレイ
47 通信インターフェース
10 2D code 10A Basic pattern part 10B Peripheral part 11 Data part 12A 1st position detection pattern 12B 2nd position detection pattern 12C 3rd position detection pattern 13 cells 14 blocks 15 Separation space 16A, 16B Position correction pattern L Extension line 20 cards 21 Patterns 30 31 Back cover 40 Analyzer 41 Reading unit 42 Lens 43 Image sensor 44 Analog-to-digital converter (AD)
45 Computer 46 Display 47 Communication interface

Claims (10)

二次元のマトリックス状のパターンとして配置され、二進コードで表されるデータを表す複数のセルと、
単独で画像から検出可能な3個以上の形状の異なる位置検出パターンであって、二次元コードの解析時に当該3個以上の形状の異なる位置検出パターンの位置関係に基づいて二次元コードの画像の座標変換を行うための位置検出パターンと、
を備え、
各前記位置検出パターンの外形は四角形であり、一の前記位置検出パターンの対向する一対の辺を、辺の延びる方向に延長した一対の延長線の内部に、全ての他の前記位置検出パターンそれぞれが、少なくとも一部が重なるように配置されている、マトリックス型の二次元コード。
Multiple cells arranged as a two-dimensional matrix pattern and representing data represented by a binary code,
Alone a position detection pattern of three or more shapes detectable different from the image, the two-dimensional code image based on the positional relationship of the three or more position detecting patterns having different shapes when parsing the two-dimensional code A position detection pattern for performing coordinate conversion and
With
The outer shape of each of the position detection patterns is a quadrangle, and each of the other position detection patterns has a pair of opposite sides of the position detection pattern inside a pair of extension lines extending in the extending direction of the sides. However, a matrix-type two-dimensional code that is arranged so that at least a part of it overlaps.
他の前記位置検出パターンの輪郭の少なくとも一部が、一対の前記延長線の一方と重なっている請求項1に記載のマトリックス型の二次元コード。 The matrix-type two-dimensional code according to claim 1, wherein at least a part of the contour of the other position detection pattern overlaps with one of the pair of extension lines. 他の前記位置検出パターンの輪郭は、一対の前記延長線の内部に配置されている請求項1に記載のマトリックス型の二次元コード。 The matrix-type two-dimensional code according to claim 1, wherein the contour of the other position detection pattern is arranged inside the pair of extension lines. 他の前記位置検出パターンの対向する一対の辺は、一対の前記延長線上に配置されている請求項1に記載のマトリックス型の二次元コード。 The matrix-type two-dimensional code according to claim 1, wherein the pair of opposite sides of the other position detection pattern are arranged on the pair of extension lines. 少なくとも1つの前記位置検出パターンは、一重の正方形枠と、前記正方形枠内に配置された正方形を有する請求項1〜4の何れか一項に記載のマトリックス型の二次元コード。 The matrix-type two-dimensional code according to any one of claims 1 to 4, wherein the at least one position detection pattern has a single square frame and squares arranged in the square frame. 少なくとも1つの前記位置検出パターンは、一重の正方形枠又は長方形枠を有する請求項1〜5の何れか一項に記載のマトリックス型の二次元コード。 The matrix-type two-dimensional code according to any one of claims 1 to 5, wherein the at least one position detection pattern has a single square frame or a rectangular frame. 前記位置検出パターンに対して所定の位置に配置される位置補正パターンであって、二次元コードの解析時に当該位置補正パターンに対して前記所定の位置に配置されるパターンが前記位置検出パターンとして識別されるか、又は、二次元コードの解析時に前記位置検出パターンとの位置関係に基づいて、前記セルの座標の誤差が補正される位置補正パターンを備える請求項1〜6の何れか一項に記載のマトリックス型の二次元コード。 A position correction pattern arranged at a predetermined position with respect to the position detection pattern, and a pattern arranged at the predetermined position with respect to the position correction pattern during analysis of a two-dimensional code is identified as the position detection pattern. In any one of claims 1 to 6, the position correction pattern is provided in which the error of the coordinate of the cell is corrected based on the positional relationship with the position detection pattern at the time of analyzing the two-dimensional code. The matrix type two-dimensional code described. 前記位置補正パターンは、隣接する2つの形状の異なる前記位置検出パターンの間の中心に配置される請求項7に記載のマトリックス型の二次元コード。 The position correction pattern, the matrix type two-dimensional code of claim 7 which is arranged in the center between the two different that prior Symbol position detection pattern shape adjacent. 第1の前記位置検出パターンと、第2の前記位置検出パターンと、第3の前記位置検出パターンと、第1の前記位置補正パターンと、第2の前記位置補正パターンを備え、
第1の前記位置補正パターンは、隣接する第1の前記位置検出パターンと第2の前記位置検出パターンとの間の中心に配置され、
第2の前記位置補正パターンは、隣接する第2の前記位置検出パターンと第3の前記位置検出パターンとの間の中心に配置される請求項7又は8に記載のマトリックス型の二次元コード。
The first position detection pattern, the second position detection pattern, the third position detection pattern, the first position correction pattern, and the second position correction pattern are provided.
The first position correction pattern is arranged at the center between the adjacent first position detection pattern and the second position detection pattern.
The matrix-type two-dimensional code according to claim 7 or 8, wherein the second position correction pattern is arranged at the center between the adjacent second position detection pattern and the third position detection pattern.
一の前記位置検出パターン及び全ての他の前記位置検出パターンは、一対の前記延長線の伸びる方向に等しい間隔を空けて配置される請求項1〜8の何れか一項に記載のマトリックス型の二次元コード。The matrix type according to any one of claims 1 to 8, wherein the position detection pattern and all the other position detection patterns are arranged at equal intervals in the extending direction of the pair of extension lines. Two-dimensional code.
JP2020130817A 2015-12-04 2020-07-31 Two-dimensional code Active JP6952846B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2020130817A JP6952846B2 (en) 2015-12-04 2020-07-31 Two-dimensional code

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2015237671A JP6785546B2 (en) 2015-12-04 2015-12-04 Two-dimensional code analysis method, two-dimensional code analysis device, and two-dimensional code analysis program
JP2020130817A JP6952846B2 (en) 2015-12-04 2020-07-31 Two-dimensional code

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2015237671A Division JP6785546B2 (en) 2015-12-04 2015-12-04 Two-dimensional code analysis method, two-dimensional code analysis device, and two-dimensional code analysis program

Publications (2)

Publication Number Publication Date
JP2020173874A JP2020173874A (en) 2020-10-22
JP6952846B2 true JP6952846B2 (en) 2021-10-27

Family

ID=72831595

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2020130817A Active JP6952846B2 (en) 2015-12-04 2020-07-31 Two-dimensional code

Country Status (1)

Country Link
JP (1) JP6952846B2 (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6802450B2 (en) * 2002-08-07 2004-10-12 Shenzhen Syscan Technology Co. Ltd Guiding a scanning device to decode 2D symbols
JP5018686B2 (en) * 2008-03-28 2012-09-05 株式会社デンソーウェーブ Information code, information code generation method, and information code display method
JP5120155B2 (en) * 2008-09-02 2013-01-16 株式会社デンソーウェーブ Information code
WO2014077186A1 (en) * 2012-11-13 2014-05-22 共同印刷株式会社 Two-dimensional code, system for creation of two-dimensional code, and analysis program
JP6253330B2 (en) * 2013-10-01 2017-12-27 共同印刷株式会社 Identification code reading system and method

Also Published As

Publication number Publication date
JP2020173874A (en) 2020-10-22

Similar Documents

Publication Publication Date Title
JP5908113B2 (en) 2D code
JP4801551B2 (en) Image area detection method, program, and apparatus
JP5848464B2 (en) Two-dimensional code, two-dimensional code creation system and analysis program
JP5791826B2 (en) 2D code
JP6091708B2 (en) 2D code, 2D code analysis system
KR101770540B1 (en) Two-dimensional code, two-dimensional-code analysis system, and two-dimensional-code generation system
JP6785546B2 (en) Two-dimensional code analysis method, two-dimensional code analysis device, and two-dimensional code analysis program
JP4794847B2 (en) Two-dimensional code and information processing method
JP2008159055A (en) Bar code decoding method and device
JP6952846B2 (en) Two-dimensional code
JP5487424B2 (en) Information embedding method and reading method in binary image

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20200731

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200731

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20210531

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210608

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210805

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20210831

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210928

R150 Certificate of patent or registration of utility model

Ref document number: 6952846

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150