JP2013238943A - Two-dimensional code reader - Google Patents

Two-dimensional code reader Download PDF

Info

Publication number
JP2013238943A
JP2013238943A JP2012110162A JP2012110162A JP2013238943A JP 2013238943 A JP2013238943 A JP 2013238943A JP 2012110162 A JP2012110162 A JP 2012110162A JP 2012110162 A JP2012110162 A JP 2012110162A JP 2013238943 A JP2013238943 A JP 2013238943A
Authority
JP
Japan
Prior art keywords
pattern
image
code
replacement
dimensional code
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.)
Granted
Application number
JP2012110162A
Other languages
Japanese (ja)
Other versions
JP5720623B2 (en
Inventor
Takashi Murozaki
隆 室崎
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.)
Denso Corp
Original Assignee
Denso Corp
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
Application filed by Denso Corp filed Critical Denso Corp
Priority to JP2012110162A priority Critical patent/JP5720623B2/en
Publication of JP2013238943A publication Critical patent/JP2013238943A/en
Application granted granted Critical
Publication of JP5720623B2 publication Critical patent/JP5720623B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

PROBLEM TO BE SOLVED: To provide a two-dimensional code reader capable of successfully reading a two-dimensional code by replacing the two-dimensional code with a feature pattern with appropriate size even under environment that the feature pattern is hard to be exactly detected.SOLUTION: A two-dimensional code reader 1 has: an extraction unit which extracts a feature pattern 11 from a code image obtained by picking up a two-dimensional code 10; a detection unit which detects image size of the two-dimensional code 10; a generation unit which generates a replacement pattern 21 in the regulated shape with size corresponding to size of the feature pattern 11 in the code image on the basis of a detection result by the detection unit; a replacement unit which generates a replacement image obtained by replacing an area of the feature pattern 11 with the replacement pattern 21 generated by the generation unit; and a decryption unit 5 which attempts decryption of the code image on the basis of an extraction result of the feature pattern 11 by the extraction unit, and attempts decryption of the replacement image generated by the replacement unit when the decryption is impossible.

Description

本発明は、二次元コード読取装置に関するものである。   The present invention relates to a two-dimensional code reader.

例えば、QRコード(登録商標)などの二次元コードは、コード領域内の特定の位置に規定形状の特徴パターン(ファインダパターン)が配置される構造となっている。この種の二次元コードを読み取る読取装置では、二次元コードを撮像した後、得られた撮像画像を解析して特徴パターンを抽出し、その抽出結果に基づいてコード領域の正確な位置や姿勢を把握している。   For example, a two-dimensional code such as a QR code (registered trademark) has a structure in which a feature pattern (finder pattern) having a specified shape is arranged at a specific position in a code area. In a reading device that reads this type of two-dimensional code, after imaging the two-dimensional code, the captured image is analyzed to extract a feature pattern, and the exact position and orientation of the code area are determined based on the extraction result. I know.

特開2007−299098公報JP 2007-299098 A

二次元コードの使用環境は様々であり、場合によっては、コード領域内にキズや汚れなどが生じることもあり得る。QRコード(登録商標)等には誤り訂正機能があるため、データ領域の一部にキズや汚れが生じても誤り訂正可能な範囲内であればデータを復元できる可能性があるが、キズや汚れ等によって特徴パターンが損傷してしまい、特徴パターンの形状が規定形状から大きく異なってしまうと、二次元コードの撮像画像から特徴パターンを抽出することができなくなってしまい、デコードの初期段階で解読失敗となってしまうことになる。   The use environment of the two-dimensional code is various, and in some cases, scratches, dirt, and the like may occur in the code area. Since QR Code (registered trademark) and the like have an error correction function, there is a possibility that data can be restored if it is within the error correction range even if a part of the data area is flawed or dirty. If the feature pattern is damaged due to dirt, etc., and the shape of the feature pattern is significantly different from the prescribed shape, the feature pattern cannot be extracted from the captured image of the two-dimensional code, and is decoded at the initial stage of decoding. It will be a failure.

このような問題を解消しようとする技術としては特許文献1のようなものがある。特許文献1の技術では、QRコード(登録商標)を撮像して得た画像データの傾きを正対に修正した後、その画像データにファインダパターンを付加し、ファインダパターンを付加した後の画像データをデコードしている。しかしながら、この技術は、単に画像データ内の3角にファインダパターンを付加しているだけであるため、コードサイズが変動し得る場合には適切なサイズのファインダパターンが用いられない虞がある。   As a technique for solving such a problem, there is a technique as described in Patent Document 1. In the technique of Patent Document 1, after correcting the inclination of image data obtained by imaging a QR code (registered trademark) to be a confrontation, a finder pattern is added to the image data, and the image data after the finder pattern is added Decoding. However, since this technique simply adds finder patterns to the three corners of the image data, there is a possibility that an appropriately sized finder pattern may not be used when the code size can vary.

本発明は、上述した課題を解決するためになされたものであり、規定形状の特徴パターンがコード領域内の所定位置に配置された二次元コードを読取可能に構成され、且つ、特徴パターンを正確に検出しにくい環境下でも適切なサイズの特徴パターンに置き換えて良好に読み取りを行い得る二次元コード読取装置を提供することを目的とする。   The present invention has been made to solve the above-described problems, and is configured to be able to read a two-dimensional code in which a feature pattern of a prescribed shape is arranged at a predetermined position in a code area, and the feature pattern can be accurately It is an object of the present invention to provide a two-dimensional code reader capable of performing good reading by replacing with a feature pattern of an appropriate size even in an environment that is difficult to detect.

上記目的を達成するため、本発明は、
規定形状の特徴パターン(11)がコード領域内の所定位置に配置された二次元コード(10)を撮像する撮像部(3)と、
前記撮像部(3)が前記二次元コード(10)を撮像して得られたコード画像から前記特徴パターン(11)を抽出する抽出部(5)と、
前記撮像部(3)で生成された前記コード画像に基づいて、前記二次元コード(10)の画像サイズを検出する検出部(5)と、
前記検出部(5)による検出結果に基づき、前記コード画像内での前記特徴パターン(11)のサイズに対応するサイズで前記規定形状の置換パターン(21)を生成する生成部(5)と、
前記コード画像において前記特徴パターン(11)の領域と前記生成部(5)で生成された前記置換パターン(21)とを置換し、置換画像を生成する置換部(5)と、
前記抽出部(5)による前記特徴パターン(11)の抽出結果に基づいて前記コード画像の解読を試み、解読不能の場合に前記置換部(5)で生成された前記置換画像の解読を試みる解読部(5)と、
を有することを特徴とする。
In order to achieve the above object, the present invention provides:
An imaging unit (3) for imaging a two-dimensional code (10) in which a feature pattern (11) of a prescribed shape is arranged at a predetermined position in the code area;
An extraction unit (5) for extracting the feature pattern (11) from a code image obtained by imaging the two-dimensional code (10) by the imaging unit (3);
A detection unit (5) for detecting an image size of the two-dimensional code (10) based on the code image generated by the imaging unit (3);
A generating unit (5) for generating a replacement pattern (21) of the prescribed shape with a size corresponding to the size of the feature pattern (11) in the code image based on a detection result by the detecting unit (5);
A replacement unit (5) for replacing the region of the feature pattern (11) in the code image with the replacement pattern (21) generated by the generation unit (5), and generating a replacement image;
A decoding that attempts to decode the code image based on the extraction result of the feature pattern (11) by the extraction unit (5) and attempts to decode the replacement image generated by the replacement unit (5) when the extraction is impossible. Part (5),
It is characterized by having.

請求項1の発明では、撮像部によって生成されたコード画像が解読不能の場合に、規定形状(本来の特徴パターンの形状)で構成された置換パターンを生成し、この置換パターンをコード画像内の特徴パターンの領域と置換した上で解読を行うことができる。従って、例えば特徴パターンの領域にキズや汚れなどが生じてしまい特徴パターンの領域が正確に認識できない場合であっても、その領域を規定形状の置換パターンに置き換えた上で解読を試みることができ、これにより解読が成功する確率を高めることができる。更に、置換パターンを生成する際には、二次元コードの画像サイズを検出した上で、コード画像内での特徴パターンのサイズに対応するサイズで規定形状の置換パターンを生成することができるため、二次元コードの画像サイズが変動し得る環境下であっても置換パターンを適切なサイズ(即ち、実際に撮像された二次元コードに合わせたサイズ)で生成し、置き換えることができる。   According to the first aspect of the present invention, when the code image generated by the imaging unit is undecipherable, a replacement pattern composed of a prescribed shape (original feature pattern shape) is generated, and this replacement pattern is stored in the code image. Decoding can be performed after replacing the region with the feature pattern. Therefore, for example, even if the feature pattern area is scratched or soiled, and the feature pattern area cannot be accurately recognized, it is possible to attempt decoding after replacing the area with the replacement pattern of the specified shape. This can increase the probability of successful decoding. Furthermore, when generating a replacement pattern, it is possible to generate a replacement pattern of a prescribed shape with a size corresponding to the size of the feature pattern in the code image after detecting the image size of the two-dimensional code. Even in an environment where the image size of the two-dimensional code can vary, the replacement pattern can be generated and replaced with an appropriate size (ie, a size that matches the actually captured two-dimensional code).

図1は、本発明の第1実施形態に係る二次元コード読取装置と読取対象となる二次元コードとを例示する概略図である。FIG. 1 is a schematic view illustrating a two-dimensional code reading device and a two-dimensional code to be read according to the first embodiment of the present invention. 図2は、図1の二次元コード読取装置の電気的構成を概略的に示すブロック図である。FIG. 2 is a block diagram schematically showing an electrical configuration of the two-dimensional code reader of FIG. 図3は、図1の二次元コード読取装置での読取処理の流れを例示するフローチャートである。FIG. 3 is a flowchart illustrating the flow of the reading process in the two-dimensional code reading apparatus of FIG. 図4は、図3の読取処理における修正処理の流れを例示するフローチャートである。FIG. 4 is a flowchart illustrating the flow of the correction process in the reading process of FIG. 図5(A)は、読取対象となる二次元コードの正常な撮像画像を示す説明図であり、図5(B)は、特徴パターンが欠損した二次元コードの画像を示す説明図であり、図5(C)は、図5(B)の画像の一部(特徴パターンの領域)を置換パターンに置き換えた置換画像を示す説明図である。FIG. 5A is an explanatory diagram showing a normal captured image of a two-dimensional code to be read, and FIG. 5B is an explanatory diagram showing an image of a two-dimensional code with a missing feature pattern, FIG. 5C is an explanatory diagram showing a replacement image obtained by replacing a part (feature pattern region) of the image of FIG. 5B with a replacement pattern. 図6(A)は、撮像部で撮像された画像(二次元コード付近の撮像画像)を例示する説明図であり、図6(B)は、二次元コードの位置を特定するために用いるパターンモデルを例示する説明図である。FIG. 6A is an explanatory diagram illustrating an image (captured image near the two-dimensional code) captured by the imaging unit, and FIG. 6B is a pattern used to specify the position of the two-dimensional code. It is explanatory drawing which illustrates a model. 図7は、二次元コードの中心位置及び特徴パターンの中心位置等を説明する説明図である。FIG. 7 is an explanatory diagram for explaining the center position of the two-dimensional code, the center position of the feature pattern, and the like. 図8は、マージンパターンのサイズ、置換パターンのサイズ、特徴パターンの中心位置座標を決めるためのデータの関係を示す説明図である。FIG. 8 is an explanatory diagram showing the relationship of data for determining the size of the margin pattern, the size of the replacement pattern, and the center position coordinates of the feature pattern.

[第1実施形態]
以下、本発明を具現化した第1実施形態について、図面を参照して説明する。
まず、図1、図2等を参照して二次元コード読取装置1の全体構成を説明する。
本実施形態では、例えば物品15が自動車用部品であり、図1等に示す二次元コード読取装置1は、自動車用部品の製造過程において物品15が所定位置に自動的に配されたときに当該物品15に付された二次元コード10を読み取るように構成されている。この二次元コード読取装置1は、主として、撮像部3と、読取部5とを備えており、物品15が所定位置に配置されたときに撮像部3によって物品15の所定領域(二次元コード10の付近)を撮像し、得られた撮像画像を読取部5によって解析し、二次元コード10を解読するように構成されている。
[First embodiment]
Hereinafter, a first embodiment embodying the present invention will be described with reference to the drawings.
First, the overall configuration of the two-dimensional code reader 1 will be described with reference to FIGS.
In the present embodiment, for example, the article 15 is an automobile part, and the two-dimensional code reader 1 shown in FIG. 1 or the like is concerned when the article 15 is automatically placed at a predetermined position in the manufacturing process of the automobile part. The two-dimensional code 10 attached to the article 15 is read. The two-dimensional code reader 1 mainly includes an imaging unit 3 and a reading unit 5, and when the article 15 is placed at a predetermined position, the imaging unit 3 performs a predetermined region (two-dimensional code 10). 2), the obtained captured image is analyzed by the reading unit 5, and the two-dimensional code 10 is decoded.

撮像部3は、例えば、CMOSイメージセンサあるいはCCDイメージセンサ等の固体撮像素子、制御回路、通信回路などを備えた汎用カメラとして構成されており、二次元コード10等を撮像し、この二次元コード10のコード画像を含んだ画像データを生成するように機能している。この撮像部3は、物品15が撮像エリア内に存在する所定のタイミングで当該物品15を撮像し、物品15を撮像したときにはその撮像画像のデータを読取部5に送信するようになっている。   The imaging unit 3 is configured as a general-purpose camera including, for example, a solid-state imaging device such as a CMOS image sensor or a CCD image sensor, a control circuit, a communication circuit, and the like. It functions to generate image data including 10 code images. The imaging unit 3 captures the article 15 at a predetermined timing when the article 15 exists in the imaging area, and transmits data of the captured image to the reading unit 5 when the article 15 is imaged.

読取部5は、例えば図2のような情報処理装置として構成されており、CPU等からなる制御部31、液晶モニタ等として構成される表示部32、ROM、RAM、HDD等からなる記憶部33、操作ボタン、マウス、キーボード等として構成される操作部34、通信インターフェースとして構成される通信部35などを備えており、上述の撮像部3で生成された画像データが入力されるようになっている。   The reading unit 5 is configured as an information processing apparatus as shown in FIG. 2, for example, and includes a control unit 31 composed of a CPU and the like, a display unit 32 composed of a liquid crystal monitor and the like, a storage unit 33 composed of ROM, RAM, HDD, and the like. , An operation unit 34 configured as an operation button, a mouse, a keyboard, and the like, a communication unit 35 configured as a communication interface, and the like, and image data generated by the imaging unit 3 described above is input. Yes.

次に、二次元コード読取装置1によって読み取られる二次元コード10について説明する。
図1の下部に示すように、二次元コード10は公知のQRコード(登録商標)として構成されており、複数のセルCがマトリックス状に配列されている。この二次元コード10は、外形が正方形状に構成されたセルC(明色セル又は暗色セル)が集合してマトリックス状に配置されたセル集合体として構成されており、二次元コード10を構成するコード領域Ca(セルCが配置される領域)は、外形が矩形状の矩形領域とされている。なお、図1では、一部のセルのみについて符号Cを付しており、他のセルの符号は省略している。
Next, the two-dimensional code 10 read by the two-dimensional code reader 1 will be described.
As shown in the lower part of FIG. 1, the two-dimensional code 10 is configured as a known QR code (registered trademark), and a plurality of cells C are arranged in a matrix. The two-dimensional code 10 is configured as a cell aggregate in which cells C (light color cells or dark color cells) whose outer shape is formed in a square shape are aggregated and arranged in a matrix shape. The code area Ca (area in which the cell C is arranged) is a rectangular area whose outer shape is rectangular. In FIG. 1, only some of the cells are denoted by reference symbol C, and the other cells are omitted.

この二次元コード10は、予め定められた規定形状の特徴パターン11がコード領域内の所定位置に配置された構成をなしている。特徴パターン11は、公知のファインダパターン(以下、切り出しシンボル、位置検出パターンとも言う)として構成され、二次元コード10のセル配列領域(矩形領域)において4つ設けられた角部のうち、規定の3つの角部に配置されるものである。図1の例では、3つの特徴パターン11(ファインダパターン11a、11b、11c)が同一形状をなし、いずれも外形が矩形状に構成されており、各特徴パターン特定の外縁を構成する2辺によってコード領域Caにおける各角部の角位置が定められている。これら特徴パターン11は、コード領域Ca(矩形領域)における各セルCの位置の特定するための要素として機能するものであり、具体的には、二次元コード読取装置1で得られる画像データにおいて規定の角部の位置を特定するために用いられると共に、その画像データにおいて二次元コード10の向きを特定するために用いられる。   The two-dimensional code 10 has a configuration in which a feature pattern 11 having a predetermined defined shape is arranged at a predetermined position in a code area. The feature pattern 11 is configured as a known finder pattern (hereinafter also referred to as a cut-out symbol or a position detection pattern), and has a prescribed pattern among four corners provided in the cell array region (rectangular region) of the two-dimensional code 10. It is arranged at three corners. In the example of FIG. 1, the three feature patterns 11 (finder patterns 11a, 11b, and 11c) have the same shape, and all of them have a rectangular outer shape. The angular position of each corner in the code area Ca is determined. These feature patterns 11 function as elements for specifying the position of each cell C in the code area Ca (rectangular area), and are specifically defined in the image data obtained by the two-dimensional code reader 1. Is used for specifying the position of the corner of the two-dimensional code 10 and for specifying the orientation of the two-dimensional code 10 in the image data.

特徴パターン11は、中心部に第1の色のセル(黒色等の暗色セル14a)が3行3列で配置された形状(大きな正方形形状)をなし、その第1の色のセル(暗色セル14a)の周りを第2の色のセル(白色等の明色セル14b)が矩形状に囲んでいる。更に、その環状のセル群(明色セル14bのセル群)の周りを第1の色のセル(黒色等の暗色セル14c)が囲んだ構成をなしている。暗色セル14cによって構成される環状のセル群は、外形が正方形状に構成されている。また、暗色セル14cの環状セル群の2辺(コード外周側ではない2辺)に沿って第2の色のセル(白色等の明色セル13)がL字状に連続するように構成されており、これら暗色セル14a、明色セル14b、暗色セル14c、明色セル13によって特徴パターン11(切出しシンボル)が全体として矩形状として構成されている。なお、図1では、3つの特徴パターン11の内、1つのファインダパターン11a(切出しシンボル)に着目して符号を付しており、ファインダパターン11aの領域の境界付近を符号ARで概念的に示している。   The feature pattern 11 has a shape (large square shape) in which cells of the first color (dark cells 14a such as black) are arranged in 3 rows and 3 columns in the center, and the first color cell (dark cell). A second color cell (light cell 14b such as white) is surrounded by a rectangle around 14a). Further, the first cell (the dark cell 14c such as black) surrounds the annular cell group (the cell group of the light cell 14b). The annular cell group constituted by the dark cells 14c has a square outer shape. In addition, the second color cells (light cells 13 such as white) are continuously formed in an L shape along two sides (two sides not on the outer periphery side of the cord) of the annular cell group of the dark cell 14c. The dark color cell 14a, the light color cell 14b, the dark color cell 14c, and the light color cell 13 constitute a feature pattern 11 (cutout symbol) as a whole in a rectangular shape. In FIG. 1, a reference is given to one finder pattern 11a (cutout symbol) among the three feature patterns 11, and the vicinity of the boundary of the finder pattern 11a is conceptually indicated by a symbol AR. ing.

二次元コード10において、特徴パターン11以外の領域には、例えば規格化された公知の要素(タイミングパターン、形式情報、型番情報など)が配置されており、更に、データが記録されるデータ領域や、誤り訂正符号が記録される誤り訂正領域などが設けられている。   In the two-dimensional code 10, in a region other than the feature pattern 11, for example, standardized known elements (timing pattern, format information, model number information, etc.) are arranged, and further, a data region in which data is recorded, An error correction area in which an error correction code is recorded is provided.

また、二次元コード10は、コード領域Caに隣接して当該コード領域Caを囲むように環状のマージン領域12が設けられている。マージン領域12は、特徴パターン11におけるコード領域Ca境界付近の大部分を占めるセル色(図1の例では暗色セル14cのセル色であり、黒色等の暗色)とは異なるセル色(図1の例では白色等の明色)で環状且つ矩形状に構成され、例えば外周縁の形状及び内周縁の形状が略矩形状となっており、左右の幅W1、W2がセル幅の4倍以上(4セル分以上)で構成され、上下の幅H1、H2もセル幅の4倍以上(4セル分以上)で構成されている。なお、マージン領域12の内周縁の形状は、コード領域Ca(セル配列領域)の境界形状と一致することになる。   Further, the two-dimensional code 10 is provided with an annular margin area 12 adjacent to the code area Ca so as to surround the code area Ca. The margin area 12 has a cell color (in FIG. 1, the dark color such as black, which is the cell color of the dark cell 14c in the example of FIG. 1) that occupies most of the vicinity of the code area Ca boundary in the feature pattern 11 (see FIG. 1). In the example, it is configured in an annular and rectangular shape with a bright color such as white). For example, the outer peripheral edge shape and the inner peripheral edge shape are substantially rectangular, and the left and right widths W1 and W2 are four times or more the cell width ( The upper and lower widths H1 and H2 are also four times or more the cell width (four cells or more). The shape of the inner peripheral edge of the margin area 12 matches the boundary shape of the code area Ca (cell array area).

次に、二次元コード読取装置1での読取処理について説明する。
図3に示す読取処理は、撮像部3及び読取部5で実行される処理であり、例えば、物品15が撮像部3の撮像エリアに配置されたタイミングで開始され、まず、撮像部3にて物品15の二次元コード10付近を撮像し、その画像データ(二次元コード10のコード画像10’を含む画像データ(図6(A)参照))を読取部5に入力する(S1)。そして、S1の処理で得られた画像データに対して所定の前処理を行う(S2)。なお、図3の例では、S2の前処理として公知のエッジ強調処理を行っているが、公知の他の画像処理を行うようにしてもよい。
Next, a reading process in the two-dimensional code reading device 1 will be described.
The reading process shown in FIG. 3 is a process executed by the imaging unit 3 and the reading unit 5. For example, the reading process is started at the timing when the article 15 is arranged in the imaging area of the imaging unit 3. The vicinity of the two-dimensional code 10 of the article 15 is imaged, and the image data (image data including the code image 10 ′ of the two-dimensional code 10 (see FIG. 6A)) is input to the reading unit 5 (S1). Then, predetermined preprocessing is performed on the image data obtained in the processing of S1 (S2). In the example of FIG. 3, a known edge enhancement process is performed as the pre-process of S2, but other known image processes may be performed.

S2の処理の後には、S1、S2で得られた画像データに基づき、当該画像データに含まれるコード画像の解読を行う(S3)。このS3の解読処理は、QRコード(登録商標)の分野で一般的に用いられる公知の解読方法で行えばよい。具体的には、例えば特許第2867904号公報などに記載された方法により、図6(A)のようなコード画像10’から各特徴パターン11(切り出しシンボル)の領域11’を抽出すると共に撮像画像内での二次元コード10の配置(即ち、コード画像10’におけるコード領域Ca’の配置)を決定し、決定されたコード領域Ca’の配置に基づいて、各セル位置を具体的に特定すると共に各セルの明暗を判別するように解読すればよい。そして、S3でコード画像の解読が成功した場合には、S4にてYesに進み、その解読結果を表示部や外部装置などに出力する(S12)。
なお、本実施形態では読取部5が「抽出部」の一例に相当し、撮像部3が二次元コード10を撮像して得られたコード画像10’から特徴パターン11を抽出するように機能する。
After the process in S2, the code image included in the image data is decoded based on the image data obtained in S1 and S2 (S3). The decoding process of S3 may be performed by a known decoding method generally used in the field of QR code (registered trademark). Specifically, for example, a region 11 ′ of each feature pattern 11 (cutout symbol) is extracted from the code image 10 ′ as shown in FIG. 6A by a method described in, for example, Japanese Patent No. 2867904 and a captured image. The arrangement of the two-dimensional code 10 (ie, the arrangement of the code area Ca ′ in the code image 10 ′) is determined, and each cell position is specifically specified based on the determined arrangement of the code area Ca ′. At the same time, it may be decoded so as to distinguish the brightness of each cell. If the decoding of the code image is successful in S3, the process proceeds to Yes in S4, and the decoding result is output to a display unit or an external device (S12).
In the present embodiment, the reading unit 5 corresponds to an example of an “extraction unit”, and the imaging unit 3 functions to extract the feature pattern 11 from the code image 10 ′ obtained by imaging the two-dimensional code 10. .

一方、S3でコード画像の解読が失敗した場合には、S4にてNoに進み、S1で得られた画像に対してS2とは異なる条件で前処理を行う。なお、図3の例では、S5の前処理として、例えば、エッジ強調処理に加え、輝度を増減する輝度補正処理を行っているが、公知の他の画像処理を行ってもよい。   On the other hand, if the decoding of the code image fails in S3, the process proceeds to No in S4, and preprocessing is performed on the image obtained in S1 under conditions different from those in S2. In the example of FIG. 3, as the pre-processing of S5, for example, the luminance correction processing for increasing / decreasing the luminance is performed in addition to the edge enhancement processing, but other known image processing may be performed.

S5の処理の後には、S5で得られた画像データに基づき、当該画像データに含まれるコード画像の解読を行う(S6)。このS6の解読処理もS3と同様であり、QRコード(登録商標)の分野で一般的に用いられる公知の解読方法で解読を行う。そして、S6でコード画像の解読が成功した場合には、S7にてYesに進み、その解読結果を表示部や外部装置などに出力する(S12)。なお、S1で得られたコード画像10’が図5(A)のような正常な画像(コード領域内に欠損などが生じていない画像)の場合にはS3又はS6で解読が成功する可能性が高くなる。   After the process of S5, the code image included in the image data is decoded based on the image data obtained in S5 (S6). The decoding process of S6 is the same as that of S3, and the decoding is performed by a known decoding method generally used in the field of QR code (registered trademark). If the code image is successfully decoded in S6, the process proceeds to Yes in S7, and the decoding result is output to a display unit, an external device, or the like (S12). Note that if the code image 10 ′ obtained in S1 is a normal image as shown in FIG. 5A (an image in which no defect is generated in the code area), the possibility of successful decoding in S3 or S6 Becomes higher.

一方、S6でコード画像の解読が失敗した場合には、S7にてNoに進み、S1で得られた画像に対して特徴パターン(切り出しシンボル)を修正する処理を行う(S8)。例えば、図5(B)のように、特徴パターン11の部分に傷や汚れなどの汚損部A1,A2が存在し、S1で得られたコード画像10’において特徴パターン11の画像領域11’が規定形状と大きく異なるような場合、S3、S6において特徴パターンを認識できずに解読失敗となる可能性が高い。このような場合、例えば図4のような流れでS8の修正処理を行う。   On the other hand, when the decoding of the code image fails in S6, the process proceeds to No in S7, and a process of correcting the feature pattern (cutout symbol) is performed on the image obtained in S1 (S8). For example, as shown in FIG. 5B, there are fouling portions A1 and A2 such as scratches and dirt in the feature pattern 11, and the image area 11 ′ of the feature pattern 11 is present in the code image 10 ′ obtained in S1. If it is significantly different from the prescribed shape, there is a high possibility that the feature pattern cannot be recognized in S3 and S6 and decoding fails. In such a case, for example, the correction process of S8 is performed in the flow as shown in FIG.

このS8の修正処理では、図4に示すようにまずS1で取得した画像データの円弧展開を行う。本実施形態では、図1のように円筒状の物品15の表面に二次元コード10が付された構成となっており、このように円筒面に沿って配される二次元コード10をS1で撮像しているため、S20では、二次元コード10を平坦にするように展開する。即ち、円筒面に沿うように構成される二次元コード10を平坦に延ばすように公知の画像処理方式にて画像展開する。なお、S20の処理は省略してもよい。   In the correction process of S8, as shown in FIG. 4, first, arc development of the image data acquired in S1 is performed. In the present embodiment, the two-dimensional code 10 is attached to the surface of the cylindrical article 15 as shown in FIG. 1, and the two-dimensional code 10 arranged along the cylindrical surface in this way is represented by S1. Since the image is taken, in S20, the two-dimensional code 10 is developed to be flat. That is, the image is developed by a known image processing method so that the two-dimensional code 10 configured along the cylindrical surface is extended flat. Note that the process of S20 may be omitted.

そして、S1の処理で得られた画像に対してサーチ領域(画像を解析すべき領域)を特定する(S21)。本実施形態では、二次元コード10が所定位置に付された各物品15が例えば図示しない搬送装置によって順次撮像エリア内に搬送されるようになっており、送り込まれる各物品15は、撮像エリア内の所定位置付近に二次元コードが配されるように所定の姿勢及び配置で位置決めされるようになっている。そして、このように各物品15が搬送される毎に撮像部3によって撮像が行われるようになっており、各撮像処理で得られる撮像画像(即ち、図3の解読処理の対象となる各撮像画像)は、画像領域内の特定位置付近に二次元コード10のコード画像10’が配されることになる。従って、画像領域内の特定位置付近をコード画像10’が配されるべき領域(サーチ領域)として予め定めておけばよく、S21の処理では、このような設定に従い、S1で得られた撮像画像においてサーチ領域を特定する。   Then, a search area (area where the image is to be analyzed) is specified for the image obtained in the process of S1 (S21). In the present embodiment, each article 15 with the two-dimensional code 10 attached to a predetermined position is sequentially transported into the imaging area by, for example, a transport device (not shown). The two-dimensional code is positioned in a predetermined posture and arrangement so that the two-dimensional code is arranged near the predetermined position. Thus, every time the article 15 is conveyed, the imaging unit 3 captures an image, and a captured image obtained by each imaging process (that is, each imaging target of the decoding process in FIG. 3). In the image), a code image 10 ′ of the two-dimensional code 10 is arranged near a specific position in the image area. Therefore, the vicinity of a specific position in the image area may be determined in advance as an area (search area) in which the code image 10 ′ is to be arranged. In the process of S21, the captured image obtained in S1 according to such settings. The search area is specified at.

S21の処理の後には、パターンマッチングに用いるパターンモデル(QRモデル)を取得する処理を行う(S22)。本実施形態では、例えば図6(B)に示すような所定形状のパターンPaがテンプレートとして定められており、このようなパターンPaを生成するための画像データが例えば記憶部33に予め記憶されている。このパターンPaは、物品15において二次元コード10の周囲に形成されるマージン領域12の正規形状(予定された形状)となっており、マージン領域12が本来予定されている形状で正常に撮像された場合にはマージン領域12の画像12’とパターンPaの画像がほぼ相似形になる。なお、図6の例では、パターンPaの矩形状の内周縁を符号Pa1で示し、矩形状の外周縁を符号Pa2で示している。また、パターンPaの中心(即ち、内周縁の中心)を符号P0で示している。S22の処理では、このようなパターンPaの画像データを記憶部33から取得する。   After the process of S21, a process of acquiring a pattern model (QR model) used for pattern matching is performed (S22). In the present embodiment, for example, a pattern Pa having a predetermined shape as shown in FIG. 6B is defined as a template, and image data for generating such a pattern Pa is stored in advance in the storage unit 33, for example. Yes. This pattern Pa is a regular shape (scheduled shape) of the margin region 12 formed around the two-dimensional code 10 in the article 15, and the margin region 12 is normally imaged in the originally planned shape. In this case, the image 12 ′ in the margin area 12 and the image of the pattern Pa are almost similar. In the example of FIG. 6, the rectangular inner periphery of the pattern Pa is denoted by reference symbol Pa1, and the rectangular outer periphery is denoted by reference symbol Pa2. Further, the center of the pattern Pa (that is, the center of the inner peripheral edge) is indicated by a symbol P0. In the process of S22, image data of such a pattern Pa is acquired from the storage unit 33.

S22の処理の後には、S1の処理で生成された撮像画像においてパターンPaに適合する領域を検出し、その検出結果に基づいてコード領域Caの重心(QR重心)を検出する(S23)。上述したように、S22の処理で取得されるパターンPaは、物品15において二次元コード10の周囲に形成されるマージン領域12の正規形状となっており、S23の処理では、このようなパターンPaの画像を用いてS1で得られた撮像画像と公知のパターンマッチングを行い、例えば図6(A)のような撮像画像の中で図6(B)のようなパターンPaの画像に適合する位置又は最も適合性の高い位置を検出する。そして、パターンPaが適合した位置でのパターンPaの中心位置(パターンPaの内周縁の中心)に相当する位置をコード領域の中心位置(重心位置)とする。   After the process of S22, an area that matches the pattern Pa is detected in the captured image generated by the process of S1, and the center of gravity (QR center of gravity) of the code area Ca is detected based on the detection result (S23). As described above, the pattern Pa acquired in the process of S22 is a normal shape of the margin region 12 formed around the two-dimensional code 10 in the article 15, and in the process of S23, such a pattern Pa. For example, a position that matches the image of the pattern Pa as shown in FIG. 6B in the captured image as shown in FIG. Alternatively, the position with the highest suitability is detected. Then, a position corresponding to the center position of the pattern Pa (the center of the inner peripheral edge of the pattern Pa) at the position where the pattern Pa is matched is set as the center position (center of gravity position) of the code area.

より具体的には、図6(B)のようなパターンPaの画像データを複数サイズ用意し(即ち、パターンPaと相似の複数の画像データを用意し)、各サイズのパターンPaをテンプレートとしてS1で得られた撮像画像に対しパターンマッチング(例えば公知のテンプレートマッチング)を行う。この場合、複数サイズのパターンPaの画像(即ち、複数のテンプレート)の内、マージン領域の画像12’のサイズに最も近いサイズの画像が最も適合性が高くなる。そして、その適合性が最も高いサイズのパターンPaの画像をコード画像10’に対してパターンマッチングしたときの当該撮像画像内でのパターンPaの適合位置(パターンマッチングでの適合性が最も高い位置)を検出し、その適合位置におけるパターンPaの中心位置を求める。図7の例では、撮像画像の一部(図5(B)のような場合のコード画像10’付近)を示しており、適合性が最も高いサイズのパターンPaの画像と撮像画像(S1で得られた画像)とをパターンマッチングしたときの撮像画像内でのパターンPaの適合位置を符号Pa’で示し、そのときの内周縁の位置をPa1’で示している。このような場合、パターンPaの適合位置Pa’の中心位置(具体的には、適合位置における内周縁Pa1’の中心位置P0)をコード画像10’におけるコード領域Ca’(セルが配列される領域:図6も参照)の中心位置(重心位置)とする。   More specifically, a plurality of sizes of image data of a pattern Pa as shown in FIG. 6B are prepared (that is, a plurality of image data similar to the pattern Pa is prepared), and the pattern Pa of each size is used as a template S1. Pattern matching (for example, well-known template matching) is performed on the captured image obtained in (1). In this case, the image having the size closest to the size of the image 12 'in the margin area among the images of the pattern Pa having a plurality of sizes (that is, a plurality of templates) has the highest compatibility. Then, when the image of the pattern Pa having the highest suitability is pattern-matched with the code image 10 ′, the fit position of the pattern Pa in the captured image (the position with the highest suitability in pattern matching). And the center position of the pattern Pa at the matching position is obtained. In the example of FIG. 7, a part of the captured image (near the code image 10 ′ in the case of FIG. 5B) is shown. The image of the pattern Pa having the highest compatibility and the captured image (in S <b> 1). The matching position of the pattern Pa in the captured image when pattern matching is performed with the obtained image) is denoted by reference symbol Pa ′, and the position of the inner peripheral edge at that time is denoted by Pa1 ′. In such a case, the center position of the matching position Pa ′ of the pattern Pa (specifically, the center position P0 of the inner peripheral edge Pa1 ′ at the matching position) is the code area Ca ′ (area in which the cells are arranged) in the code image 10 ′. : Also refer to FIG. 6).

S24にてコード領域Ca’の中心位置P0(重心位置)が算出された後には、コード画像10’における各特徴パターン(切り出しシンボル)の領域11’の中心位置(重心位置)を決定する。図1のようなQRコードでは、矩形状に構成されるコード領域Caの四隅の内の3つの角部に規定形状の特徴パターン11が配置されるように定められており、本実施形態では、撮像画像においてファインダパターン11aの画像11a’が左上、ファインダパターン11bの画像11b’が左下、ファインダパターン11cの画像11c’が右下となるように撮像時の物品15の姿勢が定められている。従って、コード領域Ca’における特徴パターンの中心の候補位置は、コード領域Ca’の中心位置P0からX軸方向、Y軸方向にそれぞれ一定値W,Hだけ離れた左上位置P1、左下位置P2、右下位置P3となる。   After the center position P0 (center of gravity position) of the code area Ca 'is calculated in S24, the center position (center of gravity position) of the area 11' of each feature pattern (cutout symbol) in the code image 10 'is determined. In the QR code as shown in FIG. 1, it is determined that feature patterns 11 having a prescribed shape are arranged at three corners of the four corners of a rectangular code area Ca. In the present embodiment, In the captured image, the posture of the article 15 at the time of imaging is determined so that the image 11a ′ of the finder pattern 11a is upper left, the image 11b ′ of the finder pattern 11b is lower left, and the image 11c ′ of the finder pattern 11c is lower right. Therefore, the candidate positions of the center of the feature pattern in the code area Ca ′ are the upper left position P1, the lower left position P2, which are separated from the center position P0 of the code area Ca ′ by the constant values W and H in the X axis direction and the Y axis direction, respectively. It becomes the lower right position P3.

S24では、このような3位置P1〜P3の座標を算出し、各特徴パターン(切り出しシンボル)の画像11’の中心位置(重心位置)を求めている。具体的には、S23の処理にてコード領域Ca’の中心位置P0が定まり、S23で最も適合性が高かったパターンPaのサイズによってコード領域Ca’のサイズ(パターンPaの内周縁Pa1’のサイズ)が特定されると、コード領域Ca’の中心位置P0から各特徴パターンの中心位置の候補となる3つの位置P1〜P4までのX軸方向の距離W及びY軸方向の距離Hを特定できる。図7の例では、中心位置P0の座標を(Xg,Yg)とし、コード領域Ca’の行方向(複数行複数列でセルが並ぶコード領域Ca’の横の並び方向)をX軸方向とし、列方向(複数行複数列でセルが並ぶコード領域Ca’の縦の並び方向)をY軸方向としており、P1の座標は、(Xg−W,Yg+H)となり、P2は、(Xg−W,Yg−H)となり、P3は、(Xg+W,Yg−H)となる。   In S24, the coordinates of these three positions P1 to P3 are calculated, and the center position (center of gravity position) of the image 11 'of each feature pattern (cutout symbol) is obtained. Specifically, the center position P0 of the code area Ca ′ is determined in the process of S23, and the size of the code area Ca ′ (the size of the inner periphery Pa1 ′ of the pattern Pa is determined by the size of the pattern Pa having the highest suitability in S23. ) Is specified, the distance W in the X-axis direction and the distance H in the Y-axis direction from the center position P0 of the code area Ca ′ to the three positions P1 to P4 that are candidates for the center position of each feature pattern can be specified. . In the example of FIG. 7, the coordinates of the center position P0 are (Xg, Yg), and the row direction of the code area Ca ′ (the horizontal arrangement direction of the code area Ca ′ in which cells are arranged in a plurality of rows and multiple columns) is the X-axis direction. , The column direction (vertical arrangement direction of the code area Ca ′ in which cells are arranged in a plurality of rows and a plurality of columns) is the Y-axis direction, the coordinates of P1 are (Xg−W, Yg + H), and P2 is (Xg−W). , Yg−H), and P3 becomes (Xg + W, Yg−H).

S24の処理の後には、特徴パターン(切り出しシンボル)の画像と置換するためのパターン20(置換用の特徴パターン(切り出しシンボル))を生成し、このパターン20をコード画像内における所定部分に上書きする(S25)。具体的には、図5の右側に示すようなパターン20(置換パターン21及びマージンパターン22)を描画するためのデータが予め記憶部33に記憶されている 図5(B)のように、パターン20は、特徴パターン11の規定形状と同一形状で構成される置換パターン21と、置換パターン21における所定の2辺(暗色セル24cによって大部分が構成される2辺)に隣接して配置されるL字状のマージンパターン22とを有しており、例えば矩形状の画像領域として構成されている。   After the process of S24, a pattern 20 (replacement feature pattern (cutout symbol)) for replacement with a feature pattern (cutout symbol) image is generated, and this pattern 20 is overwritten on a predetermined portion in the code image. (S25). Specifically, data for drawing the pattern 20 (replacement pattern 21 and margin pattern 22) as shown on the right side of FIG. 5 is stored in the storage unit 33 in advance as shown in FIG. 20 is arranged adjacent to a replacement pattern 21 configured in the same shape as the prescribed shape of the feature pattern 11 and predetermined two sides (two sides configured mostly by the dark cell 24c) in the replacement pattern 21. An L-shaped margin pattern 22 is formed, for example, as a rectangular image region.

置換パターン21は、黒色等の暗色セル24aが3行3列で配列されて正方形状に構成される中心部と、白色等の明色セル24bが中心部を囲むように環状且つ矩形状に配列されてなる第1環状部と、黒色等の暗色セル24cが第1環状部を囲むように環状且つ矩形状に配列されてなる第2環状部と、白色等の明色セル23が第2環状部の2辺(マージンパターン22側ではない2辺)に沿うように当該第2環状部に隣接してL字状に設けられるL字状部とによって構成されている。マージンパターン22は、セル幅よりも大きい幅(例えばセル幅の4倍以上の幅)でL字状に構成されている。   The replacement pattern 21 is arranged in a circular and rectangular shape so that dark cells 24a such as black are arranged in 3 rows and 3 columns and formed in a square shape, and light cells 24b such as white surround the center portion. A first annular portion, a second annular portion in which dark cells 24c, such as black, are arranged annularly and rectangularly so as to surround the first annular portion, and a light cell 23, such as white, are second annular It is comprised by the L-shaped part provided in L shape adjacent to the said 2nd cyclic | annular part so that two sides (two sides which are not the margin pattern 22 side) of a part may be followed. The margin pattern 22 is configured in an L shape with a width larger than the cell width (for example, a width of four times or more the cell width).

S25では、このようなパターン20を形成するための描画データを読み出すと共に、このパターン20をコード領域Ca’のサイズに合わせたサイズに変更する。本実施形態では、パターン20を相似形で変形可能とされており、コード画像10’に含まれる特徴パターンの画像11’のサイズと置換パターン21のサイズが合うようにパターン20のサイズが決められるようになっている。   In S25, drawing data for forming such a pattern 20 is read out, and the pattern 20 is changed to a size matching the size of the code area Ca '. In the present embodiment, the pattern 20 can be deformed in a similar shape, and the size of the pattern 20 is determined so that the size of the feature pattern image 11 ′ included in the code image 10 ′ matches the size of the replacement pattern 21. It is like that.

具体的には、図8のように、マージンパターンPaの各サイズに対応付けて置換用のパターン20のサイズ及び上述のW,Hの値が決められており、S23で最も適合性が高いマージンパターンが決まると(即ち、最も適合性が高いパターンPaのサイズが決まると)、そのマージンパターンのサイズに合わせるべくパターン20の大きさが決まり、W,Hの値も決まるようになっている。この構成では、S23で適合性の高いマージンパターンのサイズが大きければ、パターン20の使用サイズが大きくなるように調整され、且つマージンパターンのサイズに合わせてW,Hの値も大きくなる。一方、適合性の高いマージンパターンのサイズが小さければパターン20の使用サイズが小さくなるように調整され、且つマージンパターンのサイズに合わせてW,Hの値も小さくなる。   Specifically, as shown in FIG. 8, the size of the replacement pattern 20 and the above-described W and H values are determined in association with each size of the margin pattern Pa, and the margin having the highest suitability in S23. When the pattern is determined (that is, when the size of the pattern Pa having the highest compatibility is determined), the size of the pattern 20 is determined to match the size of the margin pattern, and the values of W and H are also determined. In this configuration, if the size of the highly adaptable margin pattern is large in S23, the use size of the pattern 20 is adjusted to be large, and the values of W and H are also increased in accordance with the size of the margin pattern. On the other hand, if the size of the highly suitable margin pattern is small, the use size of the pattern 20 is adjusted to be small, and the values of W and H are also small in accordance with the size of the margin pattern.

このようにパターン20の使用サイズが決まった後には、コード画像10’における位置P1,P2,P3付近の画像と、サイズが調整されたパターン20の画像とを置換するようにコード画像10’を加工する。具体的には、パターン20における中央部(暗色セル24aによって正方形状に構成される部分)の中心位置が位置P1,P2,P3となるようにコード画像10’の3位置に対してパターン20の画像を上書きする。なお、各位置においてパターン20を上書きする際には、マージンパターン22がマージン領域側になるように上書きする。図5の例では、図5(B)の画像に対してパターン20を上書きし、図5(C)のような画像を得ており、この例では、左上の位置P1付近でパターン20を上書きする際には、角部の上側及び左側にマージンパターン22が配されるように上書きしている。また、左下の位置P2付近でパターン20を上書きする際には、角部の左側及び下側にマージンパターン22が配されるように上書きしている。更に、右下の位置P3付近でパターン20を上書きする際には、角部の下側及び右側にマージンパターン22が配されるように上書きしている。   After the use size of the pattern 20 is determined in this way, the code image 10 ′ is replaced so as to replace the image near the positions P1, P2, and P3 in the code image 10 ′ with the image of the pattern 20 whose size has been adjusted. Process. Specifically, the pattern 20 has three positions relative to the code image 10 ′ so that the center position of the central portion of the pattern 20 (the portion formed in a square shape by the dark cells 24a) is the positions P1, P2, and P3. Overwrite the image. When the pattern 20 is overwritten at each position, the pattern is overwritten so that the margin pattern 22 is on the margin area side. In the example of FIG. 5, the pattern 20 is overwritten on the image of FIG. 5B to obtain an image as shown in FIG. 5C. In this example, the pattern 20 is overwritten near the upper left position P1. In doing so, the margin pattern 22 is overwritten on the upper and left sides of the corner. Further, when the pattern 20 is overwritten in the vicinity of the lower left position P2, the overwriting is performed so that the margin pattern 22 is arranged on the left side and the lower side of the corner. Furthermore, when the pattern 20 is overwritten near the lower right position P3, the pattern is overwritten so that the margin pattern 22 is arranged on the lower side and the right side of the corner.

このようにしてS8の修正処理が行われた後には、図3のS9のように修正画像(S25で生成された図5(C)のような置換画像)にてコード画像10’の解読を行う。このS9の解読処理もS3と同様であり、QRコード(登録商標)の分野で一般的に用いられる公知の解読方法で解読を行う。そして、S9でコード画像の解読が成功した場合には、S10にてYesに進み、その解読結果を表示部や外部装置などに出力する(S12)。一方、S9で解読に失敗した場合には、S10にてNoに進み、エラーを報知する処理を行う。   After the correction process of S8 is performed in this way, the code image 10 ′ is decoded with the corrected image (the replacement image shown in FIG. 5C generated in S25) as shown in S9 of FIG. Do. The decoding process of S9 is the same as S3, and the decoding is performed by a known decoding method generally used in the field of QR code (registered trademark). If the code image is successfully decoded in S9, the process proceeds to Yes in S10, and the decoding result is output to a display unit, an external device, or the like (S12). On the other hand, if the decryption fails in S9, the process proceeds to No in S10 and performs a process of notifying an error.

本実施形態では、読取部5が検出部の一例に相当し、撮像部3で生成されたコード画像10’に基づいて、二次元コード10の画像サイズを検出するように機能する。具体的には、上述のパターンマッチングによってコード画像10’とパターンPaの複数サイズとの適合性を調べることで、コード画像10’がどのサイズに最も適合するかを判断し、適合性の高いパターンPaのサイズをコード画像10’のサイズ(画像内でのコード画像10’の大きさを特定しうる情報)としている。   In the present embodiment, the reading unit 5 corresponds to an example of a detection unit, and functions to detect the image size of the two-dimensional code 10 based on the code image 10 ′ generated by the imaging unit 3. Specifically, by checking the suitability between the code image 10 ′ and a plurality of sizes of the pattern Pa by the pattern matching described above, it is determined which size the code image 10 ′ fits most, and the pattern having high suitability The size of Pa is the size of the code image 10 ′ (information that can specify the size of the code image 10 ′ in the image).

また、本実施形態では、読取部5が生成部の一例に相当し、検出部による検出結果に基づき、コード画像10’内での特徴パターンのサイズに対応するサイズで規定形状の置換パターン21を生成しており、より具体的には、コード画像10’内での特徴パターンのサイズに合わせたサイズで規定形状の置換パターン21を生成すると共に当該置換パターン21に隣接するようにマージン領域12に対応する色のマージンパターン22を生成するように機能する。   Further, in the present embodiment, the reading unit 5 corresponds to an example of a generation unit, and based on the detection result by the detection unit, the replacement pattern 21 having a prescribed shape with a size corresponding to the size of the feature pattern in the code image 10 ′ is generated. More specifically, the replacement pattern 21 having a prescribed shape is generated with a size matching the size of the feature pattern in the code image 10 ′, and the margin area 12 is adjacent to the replacement pattern 21. It functions to generate a margin pattern 22 of the corresponding color.

また、本実施形態では、読取部5が置換部の一例に相当し、コード画像10’において特徴パターンの領域11’と生成部で生成された置換パターン21とを置換するように置換画像を生成しており、より具体的には、コード画像10’において特徴パターンの領域11’と置換パターン21とを置換すると共にマージン領域12の一部とマージンパターン22とを置換するように置換画像を生成している。   In the present embodiment, the reading unit 5 corresponds to an example of a replacement unit, and a replacement image is generated so as to replace the feature pattern region 11 ′ and the replacement pattern 21 generated by the generation unit in the code image 10 ′. More specifically, a replacement image is generated so that the feature pattern region 11 ′ and the replacement pattern 21 are replaced in the code image 10 ′, and a part of the margin region 12 and the margin pattern 22 are replaced. doing.

また、本実施形態では、読取部5が解読部の一例に相当し、コード画像10’での特徴パターンの抽出結果に基づいて当該コード画像10’の解読を試みるように機能し、解読不能の場合には、置換部で生成された置換画像の解読を試みるように機能している。   In the present embodiment, the reading unit 5 corresponds to an example of a decoding unit, functions to try to decode the code image 10 ′ based on the extraction result of the feature pattern in the code image 10 ′, and cannot be decoded. In such a case, it functions to try to decode the replacement image generated by the replacement unit.

以上のような本実施形態の構成によれば、撮像部3によって生成されたコード画像10’が解読不能の場合に、規定形状(本来の特徴パターンの形状)で構成された置換パターン21を生成し、この置換パターン21をコード画像10’内の特徴パターンの領域11’と置換した上で解読を行うことができる。従って、例えば特徴パターンの領域11’にキズや汚れなどが生じてしまい、特徴パターンの領域11’が正確に認識できない場合であっても、その領域を規定形状の置換パターン21に置き換えた上で解読を試みることができ、これにより解読が成功する確率を高めることができる。更に、置換パターン21を生成する際には、二次元コード10の画像サイズを検出した上で、コード画像10’内での特徴パターン11のサイズに対応するサイズで規定形状の置換パターン21を生成することができるため、二次元コード10の画像サイズが変動し得る環境下であっても置換パターン21を適切なサイズ(即ち、実際に撮像された二次元コード10に合わせたサイズ)で生成し、置き換えることができる。   According to the configuration of the present embodiment as described above, when the code image 10 ′ generated by the imaging unit 3 cannot be decoded, the replacement pattern 21 configured with a specified shape (original feature pattern shape) is generated. Then, the replacement pattern 21 can be decoded after replacing the feature pattern region 11 'in the code image 10'. Therefore, for example, even when the feature pattern region 11 ′ is scratched or soiled and the feature pattern region 11 ′ cannot be accurately recognized, the region is replaced with the replacement pattern 21 having the prescribed shape. Decryption can be attempted, thereby increasing the probability of successful decryption. Further, when the replacement pattern 21 is generated, the image size of the two-dimensional code 10 is detected, and then the replacement pattern 21 having a prescribed shape is generated with a size corresponding to the size of the feature pattern 11 in the code image 10 ′. Therefore, even in an environment in which the image size of the two-dimensional code 10 can fluctuate, the replacement pattern 21 is generated with an appropriate size (that is, a size matching the actually captured two-dimensional code 10). Can be replaced.

また、本実施形態において、生成部は、コード画像10’内での特徴パターン11のサイズに対応するサイズで規定形状の置換パターン21を生成すると共に当該置換パターン21に隣接するようにマージン領域12に対応する色のマージンパターン22を生成している。そして、置換部は、コード画像10’において特徴パターンの領域11’と置換パターン21とを置換すると共にマージン領域12の一部とマージンパターン22とを置換するように置換画像を生成している。このようにすると、例えばマージン領域12において特徴パターン11に隣接する部分に汚れなどが存在し、その結果解読不能になるような場合(例えばマージン領域の汚れなどに起因して特徴パターン11が認識できないような場合)であってもマージン領域を良好に復元することができ、解読成功の確率を高めることができる。   Further, in the present embodiment, the generation unit generates a replacement pattern 21 having a prescribed shape with a size corresponding to the size of the feature pattern 11 in the code image 10 ′ and the margin area 12 so as to be adjacent to the replacement pattern 21. The margin pattern 22 of the color corresponding to is generated. Then, the replacement unit generates a replacement image so as to replace the feature pattern region 11 ′ and the replacement pattern 21 in the code image 10 ′ and replace a part of the margin region 12 and the margin pattern 22. In this case, for example, in the margin area 12 where dirt or the like is adjacent to the feature pattern 11, and as a result it becomes impossible to decode (for example, the feature pattern 11 cannot be recognized due to the dirt or the like in the margin area). In such a case, the margin area can be restored well, and the probability of successful decoding can be increased.

[他の実施形態]
本発明は上記記述及び図面によって説明した実施形態に限定されるものではなく、例えば次のような実施形態も本発明の技術的範囲に含まれる。
[Other Embodiments]
The present invention is not limited to the embodiments described with reference to the above description and drawings. For example, the following embodiments are also included in the technical scope of the present invention.

上記実施形態では、二次元コードとしてQRコード(登録商標)を例示したが、所定位置に特徴パターンが設けられ、この特徴パターンに基づいて各セルを認識する方式の二次元コードであれば他の二次元コードを読取対象としてもよい。例えば、データマトリックスコードなどを読取対象としてもよく、この場合、L字状のアライメントパターンを「特徴パターン」として第1実施形態と同様の方法で読取処理を行えばよい。   In the above-described embodiment, the QR code (registered trademark) is exemplified as the two-dimensional code. However, a feature pattern is provided at a predetermined position, and any other two-dimensional code that recognizes each cell based on the feature pattern may be used. A two-dimensional code may be read. For example, a data matrix code or the like may be set as a reading target. In this case, the reading process may be performed in the same manner as in the first embodiment using an L-shaped alignment pattern as a “feature pattern”.

二次元コードのサイズを検出する方法として、パターンマッチングによってマージン領域のサイズを検出する方法を例示したが、これに限られない。例えば、S3又はS6にて、1つでも特徴パターンが検出されたときには、その特徴パターンの領域を抽出し、その領域のサイズを「二次元コードのサイズを特定しうる値」としてもよい。或いは、撮像画像内において公知の画像処理方法でコード領域Ca’の外形を特定し、この外形サイズを「二次元コードのサイズを特定しうる値」としてもよい。   As a method of detecting the size of the two-dimensional code, a method of detecting the size of the margin area by pattern matching has been illustrated, but the method is not limited thereto. For example, when at least one feature pattern is detected in S3 or S6, the region of the feature pattern may be extracted, and the size of the region may be set to “a value that can specify the size of the two-dimensional code”. Alternatively, the outer shape of the code area Ca ′ may be specified by a known image processing method in the captured image, and the outer size may be set to “a value that can specify the size of the two-dimensional code”.

上記実施形態では、撮像対象物として物品15を例示したが、二次元コードが付された物品の例はこれに限られるものではなく、広告媒体、書籍、PDF(Portable Document Format)などの文書ファイル等、様々な媒体を対象とすることができる。   In the above embodiment, the article 15 is exemplified as the imaging object, but the example of the article to which the two-dimensional code is attached is not limited to this, and a document file such as an advertising medium, a book, or a PDF (Portable Document Format). For example, various media can be targeted.

1…二次元コード読取装置
3…撮像部
5…読取部(抽出部、検出部、生成部、置換部、解読部)
10…二次元コード
11…特徴パターン
21…置換パターン
DESCRIPTION OF SYMBOLS 1 ... Two-dimensional code reader 3 ... Imaging part 5 ... Reading part (Extraction part, a detection part, a production | generation part, a substitution part, a decoding part)
10 ... Two-dimensional code 11 ... Feature pattern 21 ... Replacement pattern

Claims (2)

規定形状の特徴パターン(11)がコード領域内の所定位置に配置された二次元コード(10)を撮像する撮像部(3)と、
前記撮像部(3)が前記二次元コード(10)を撮像して得られたコード画像から前記特徴パターン(11)を抽出する抽出部(5)と、
前記撮像部(3)で生成された前記コード画像に基づいて、前記二次元コード(10)の画像サイズを検出する検出部(5)と、
前記検出部(5)による検出結果に基づき、前記コード画像内での前記特徴パターン(11)のサイズに対応するサイズで前記規定形状の置換パターン(21)を生成する生成部(5)と、
前記コード画像において前記特徴パターン(11)の領域と前記生成部(5)で生成された前記置換パターン(21)とを置換し、置換画像を生成する置換部(5)と、
前記抽出部(5)による前記特徴パターン(11)の抽出結果に基づいて前記コード画像の解読を試み、解読不能の場合に前記置換部(5)で生成された前記置換画像の解読を試みる解読部(5)と、
を有することを特徴とする二次元コード読取装置(1)。
An imaging unit (3) for imaging a two-dimensional code (10) in which a feature pattern (11) of a prescribed shape is arranged at a predetermined position in the code area;
An extraction unit (5) for extracting the feature pattern (11) from a code image obtained by imaging the two-dimensional code (10) by the imaging unit (3);
A detection unit (5) for detecting an image size of the two-dimensional code (10) based on the code image generated by the imaging unit (3);
A generating unit (5) for generating a replacement pattern (21) of the prescribed shape with a size corresponding to the size of the feature pattern (11) in the code image based on a detection result by the detecting unit (5);
A replacement unit (5) for replacing the region of the feature pattern (11) in the code image with the replacement pattern (21) generated by the generation unit (5), and generating a replacement image;
A decoding that attempts to decode the code image based on the extraction result of the feature pattern (11) by the extraction unit (5) and attempts to decode the replacement image generated by the replacement unit (5) when the extraction is impossible. Part (5),
The two-dimensional code reader (1) characterized by having.
前記二次元コード(10)は、前記特徴パターン(11)の外部に隣接してマージン領域(12)が設けられるものであり、
前記生成部(5)は、前記コード画像内での前記特徴パターン(11)のサイズに対応するサイズで前記規定形状の前記置換パターン(21)を生成すると共に当該置換パターン(21)に隣接するように前記マージン領域(12)に対応する色のマージンパターン(22)を生成し、
前記置換部(5)は、前記コード画像において前記特徴パターン(11)の領域と前記置換パターン(21)とを置換すると共に前記マージン領域(12)の一部と前記マージンパターン(22)とを置換するように前記置換画像を生成することを特徴とする請求項1に記載の二次元コード読取装置(1)。
The two-dimensional code (10) is provided with a margin region (12) adjacent to the outside of the feature pattern (11),
The generation unit (5) generates the replacement pattern (21) having the prescribed shape with a size corresponding to the size of the feature pattern (11) in the code image and is adjacent to the replacement pattern (21). And generating a margin pattern (22) of a color corresponding to the margin area (12),
The replacement unit (5) replaces the region of the feature pattern (11) and the replacement pattern (21) in the code image, and replaces a part of the margin region (12) and the margin pattern (22). The two-dimensional code reading device (1) according to claim 1, wherein the replacement image is generated so as to be replaced.
JP2012110162A 2012-05-14 2012-05-14 Two-dimensional code reader Expired - Fee Related JP5720623B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012110162A JP5720623B2 (en) 2012-05-14 2012-05-14 Two-dimensional code reader

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012110162A JP5720623B2 (en) 2012-05-14 2012-05-14 Two-dimensional code reader

Publications (2)

Publication Number Publication Date
JP2013238943A true JP2013238943A (en) 2013-11-28
JP5720623B2 JP5720623B2 (en) 2015-05-20

Family

ID=49763928

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012110162A Expired - Fee Related JP5720623B2 (en) 2012-05-14 2012-05-14 Two-dimensional code reader

Country Status (1)

Country Link
JP (1) JP5720623B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015174192A1 (en) * 2014-05-14 2015-11-19 共同印刷株式会社 Two-dimensional code, two-dimensional-code analysis system, and two-dimensional-code generation system
CN109145675A (en) * 2018-06-28 2019-01-04 中国地质大学(武汉) A kind of nested type two dimensional code attack double check method and system
CN110427792A (en) * 2019-06-24 2019-11-08 广西中烟工业有限责任公司 A kind of recognition matching process blocking two dimensional code and its application

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106127276B (en) * 2016-06-27 2018-12-21 福建联迪商用设备有限公司 A kind of method and system for quantifying to be stained QRCode

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007299098A (en) * 2006-04-28 2007-11-15 Shachihata Inc Qr code reader
JP2012194831A (en) * 2011-03-17 2012-10-11 Nec Corp Code reader, code reading method and code reading program

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007299098A (en) * 2006-04-28 2007-11-15 Shachihata Inc Qr code reader
JP2012194831A (en) * 2011-03-17 2012-10-11 Nec Corp Code reader, code reading method and code reading program

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015174192A1 (en) * 2014-05-14 2015-11-19 共同印刷株式会社 Two-dimensional code, two-dimensional-code analysis system, and two-dimensional-code generation system
US9734443B2 (en) 2014-05-14 2017-08-15 Kyodo Printing Co., Ltd. Two-dimensional code, two-dimensional-code analysis system, and two-dimensional-code generation system
KR101770540B1 (en) 2014-05-14 2017-08-22 교도 인사쯔 가부시키가이샤 Two-dimensional code, two-dimensional-code analysis system, and two-dimensional-code generation system
CN109145675A (en) * 2018-06-28 2019-01-04 中国地质大学(武汉) A kind of nested type two dimensional code attack double check method and system
CN109145675B (en) * 2018-06-28 2020-08-25 中国地质大学(武汉) Nested two-dimensional code attack double detection method and system
CN110427792A (en) * 2019-06-24 2019-11-08 广西中烟工业有限责任公司 A kind of recognition matching process blocking two dimensional code and its application
CN110427792B (en) * 2019-06-24 2022-05-24 广西中烟工业有限责任公司 Reading matching method of shielding two-dimensional code and application thereof

Also Published As

Publication number Publication date
JP5720623B2 (en) 2015-05-20

Similar Documents

Publication Publication Date Title
TWI528293B (en) QR code
US8640957B2 (en) Method and apparatus for locating bar codes including QR codes
TW201432576A (en) Two-dimensional code, system for creation of two-dimensional code, and analysis program
JP6045752B2 (en) Two-dimensional code, two-dimensional code analysis system, and two-dimensional code creation system
JP4694613B2 (en) Document orientation determination apparatus, document orientation determination method, program, and recording medium therefor
JP6860355B2 (en) Improved matrix symbol error correction method
US20170046606A1 (en) Two-dimensional code, and two-dimensional-code analysis system
US20160379031A1 (en) High capacity 2d color barcode design and processing method for camera based applications
US9946947B2 (en) System and method for finding saddle point-like structures in an image and determining information from the same
JP5720623B2 (en) Two-dimensional code reader
US20150254869A1 (en) Image processing apparatus, image processing method, and storage medium
JP5673257B2 (en) Code reading apparatus, code reading method and code reading program
JP2018101164A (en) Two-dimensional code, two-dimensional code record carrier, two-dimensional code reading method, two-dimensional code reading program and two-dimensional code reading device
JP4335229B2 (en) QR code recognition device, QR code recognition device control method, QR code recognition device control program, and computer-readable recording medium recording the same
JP2017161969A (en) Character recognition device, method, and program
JP2015049753A (en) Device, method, and program for displaying two-dimensional code, and device, method, and program for reading two-dimensional code
JP4874706B2 (en) QR code reader
TW201921283A (en) Two-dimensional code and two-dimensional code reading device
JP5967000B2 (en) Information code reading system, information code reading device, information code
JP2019012424A (en) Image processing device and computer program
JP4890112B2 (en) Image processing apparatus and image processing method
JP2015114680A (en) Two-dimensional code reading method and recording medium of two-dimensional code
JP5522104B2 (en) Information code reader
US8452104B2 (en) Image determination apparatus, computer readable medium storing program, and method
WO2022211064A1 (en) Information reading device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20140718

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20141222

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20150120

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20150204

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: 20150224

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20150309

R151 Written notification of patent or utility model registration

Ref document number: 5720623

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees