JP5807602B2 - Information code reader - Google Patents

Information code reader Download PDF

Info

Publication number
JP5807602B2
JP5807602B2 JP2012077224A JP2012077224A JP5807602B2 JP 5807602 B2 JP5807602 B2 JP 5807602B2 JP 2012077224 A JP2012077224 A JP 2012077224A JP 2012077224 A JP2012077224 A JP 2012077224A JP 5807602 B2 JP5807602 B2 JP 5807602B2
Authority
JP
Japan
Prior art keywords
cell
luminance
template
light
dark
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
JP2012077224A
Other languages
Japanese (ja)
Other versions
JP2013206347A (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.)
Denso Wave Inc
Original Assignee
Denso Wave Inc
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 Wave Inc filed Critical Denso Wave Inc
Priority to JP2012077224A priority Critical patent/JP5807602B2/en
Publication of JP2013206347A publication Critical patent/JP2013206347A/en
Application granted granted Critical
Publication of JP5807602B2 publication Critical patent/JP5807602B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Input (AREA)

Description

本発明は、情報コード読取装置に関するものである。   The present invention relates to an information code reader.

情報コードは、一般的に明色セルと暗色セルが配列されてなるものであり、この種の情報コードを読み取る装置では、情報コードを撮像した後、各セル位置を特定した上で各セルが明色セル又は暗色セルのいずれに属するかを二値化処理によって特定している。情報コードの二値化に関する方式としては、追従方式や微分方式などが提供されており、関連技術としては特許文献1のようなものが存在する。   An information code is generally formed by arranging bright cells and dark cells. In an apparatus that reads this type of information code, after the information code is imaged, each cell is identified and the cell is identified. Whether the cell belongs to a light cell or a dark cell is specified by binarization processing. As a method related to binarization of the information code, a follow-up method, a differentiation method, and the like are provided, and a related technology such as Patent Document 1 exists.

特開2001−28045公報JP 2001-28045 A

情報コードの各セルを二値化する場合、一般的には、明色セルと暗色セルを区別するための閾値を設定しておき、撮像されたコード画像の各セルをこの閾値と比較している。そして、比較した結果、閾値よりも輝度が大きい場合には明色セルと判定し、閾値よりも輝度が小さい場合には暗色セルと判定するといった手法を用いている。このような閾値の設定は、上述の追従方式の場合でも微分方式の場合でも必要であり、いずれの方式でも、明暗を正確に区別し得る閾値設定が求められることになる。   When binarizing each cell of the information code, in general, a threshold value for distinguishing light cells from dark cells is set, and each cell of the captured code image is compared with this threshold value. Yes. Then, as a result of the comparison, a technique is used in which a light cell is determined when the luminance is higher than the threshold, and a dark cell is determined when the luminance is lower than the threshold. Such a threshold setting is necessary for both the follow-up method and the differential method described above, and any method requires a threshold setting that can accurately distinguish light and dark.

しかしながら、閾値によって明暗を区別する上記方法は、コントラストが大きく、明色セルと暗色セルの輝度差が大きくなるような撮像環境下では有効であるが、ボケが発生したりコントラストが低下した場合などにおいて誤判定が生じやすいという問題がある。即ち、このような撮像環境下で得られたコード画像では、本来的には明色セルと判定されるべき部分であっても周囲パターンからの輝度の干渉によって輝度が低くなってしまったり、逆に、暗色セルと判定されるべき部分であっても周囲パターンからの輝度の干渉によって輝度が高くなってしまうことがあり、これらの明暗を区別し得る閾値を適切に設定することは極めて困難であった。このため、ボケが発生したりコントラストが低下しやすい撮像環境下では、明暗の誤判定に起因する解読失敗のリスクが大きかった。   However, the above-described method of distinguishing between light and dark according to the threshold is effective in an imaging environment where the contrast is large and the brightness difference between the light cell and the dark cell is large. However, when blur occurs or the contrast decreases. There is a problem that erroneous determination is likely to occur. That is, in a code image obtained under such an imaging environment, even in a portion that should be determined as a light cell originally, the luminance is lowered due to luminance interference from the surrounding pattern, or vice versa. In addition, even in a portion that should be determined as a dark cell, luminance may increase due to luminance interference from surrounding patterns, and it is extremely difficult to appropriately set a threshold value that can distinguish between these light and dark. there were. For this reason, in an imaging environment in which blurring is likely to occur or the contrast is likely to decrease, there is a high risk of decoding failure due to a light / dark determination.

本発明は、上述した課題を解決するためになされたものであり、明色セル及び暗色セルを配列してなる情報コードを読み取り可能な情報コード読取装置において、ボケが存在したりコントラストが低い場合などにおいても高精度に二値化処理を行うことができ、且つ二値化処理に伴う処理時間を効果的に短縮可能な構成を提供することを目的とする。   The present invention has been made in order to solve the above-described problem. In an information code reading apparatus capable of reading an information code formed by arranging bright cells and dark cells, blur is present or the contrast is low. It is an object of the present invention to provide a configuration that can perform binarization processing with high accuracy and can effectively reduce processing time associated with binarization processing.

本発明は、明色セルと暗色セルとを含んだ情報コードを撮像する撮像手段と、
前記撮像手段によって撮像された前記情報コードの画像を記憶する画像記憶手段と、
前記画像記憶手段に記憶される前記情報コードの画像から、各セルの位置を検出するセル位置検出手段と、
前記セル位置検出手段によって検出された各セル位置での輝度を検出可能な輝度検出手段と、
前記輝度検出手段によって検出された輝度が、第1閾値以上となる明色判定セルを検出すると共に、前記第1閾値よりも低い第2閾値以下となる暗色判定セルを検出する明暗セル検出手段と、
前記輝度検出手段によって検出された輝度が、前記第1閾値未満であって且つ前記第2閾値を超える中間輝度セルを検出する中間輝度セル検出手段と、
前記中間輝度セル検出手段によって検出された前記中間輝度セルが前記明色セル又は前記暗色セルのいずれに属するかを、当該中間輝度セルに隣接する複数の隣接セルの明暗パターンに基づいて決定する明暗判定手段と、
前記輝度検出手段によって検出された各セル位置の輝度を輝度レベル毎に分類すると共に輝度レベル毎の頻度を特定し得る度数分布を生成する度数分布生成手段と、を備え、
前記明暗セル検出手段は、前記度数分布生成手段によって生成された前記度数分布において、高輝度側でピークとなる第1ピーク値を前記第1閾値とし、前記第1ピーク値よりも低輝度側でピークとなる第2ピーク値を前記第2閾値とし、前記第1ピーク値以上の輝度のセルを前記明色判定セルとして検出し、前記第2ピーク値以下の輝度のセルを前記暗色判定セルとして検出し、
前記度数分布生成手段によって生成された前記度数分布の種類を、当該度数分布の内容に基づいて予め定められた複数種類の中から選択する選択手段と、
前記明色セルと判定するための複数の明色テンプレートと前記暗色セルと判定するための複数の暗色テンプレートとを含んだテンプレート群を、前記複数種類の各々に対応付けて記憶する判定用テンプレート記憶手段と、
を備え、
前記明暗判定手段は、前記選択手段によって選択された前記度数分布の種類に基づいて前記判定用テンプレート記憶手段に記憶されるいずれかの前記テンプレート群を選択し、前記中間輝度セルに隣接する複数の隣接セルの明暗パターンとその選択された当該テンプレート群に含まれるテンプレートとのパターンマッチングにより、当該テンプレート群を構成する前記複数の明色テンプレート及び前記複数の暗色テンプレートの中から適合するテンプレートを検出し、その検出結果に基づいて前記中間輝度セルが前記明色セル又は前記暗色セルのいずれに属するかを決定することを特徴とする。
The present invention comprises an imaging means for imaging an information code including a light color cell and a dark color cell;
Image storage means for storing an image of the information code imaged by the imaging means;
Cell position detection means for detecting the position of each cell from the image of the information code stored in the image storage means;
Luminance detecting means capable of detecting the luminance at each cell position detected by the cell position detecting means;
Brightness / darkness cell detection means for detecting a lightness determination cell whose brightness detected by the brightness detection means is equal to or higher than a first threshold, and for detecting a darkness determination cell where the brightness is lower than a second threshold lower than the first threshold; ,
Intermediate luminance cell detecting means for detecting intermediate luminance cells whose luminance detected by the luminance detecting means is less than the first threshold and exceeds the second threshold;
Brightness / darkness that determines whether the intermediate luminance cell detected by the intermediate luminance cell detection means belongs to the light cell or the dark cell based on the light / dark pattern of a plurality of adjacent cells adjacent to the intermediate luminance cell. A determination means;
A frequency distribution generating unit that classifies the luminance of each cell position detected by the luminance detecting unit for each luminance level and generates a frequency distribution that can specify the frequency for each luminance level; and
In the frequency distribution generated by the frequency distribution generation unit, the light / dark cell detection unit sets the first peak value that peaks on the high luminance side as the first threshold value, and on the lower luminance side than the first peak value. A second peak value that is a peak is set as the second threshold value, a cell having a luminance equal to or higher than the first peak value is detected as the light color determination cell, and a cell having a luminance equal to or lower than the second peak value is set as the dark color determination cell. Detect
Selecting means for selecting the type of the frequency distribution generated by the frequency distribution generating means from a plurality of types determined in advance based on the content of the frequency distribution;
Determination template storage for storing a template group including a plurality of light color templates for determining the light cell and a plurality of dark color templates for determining the dark cell in association with each of the plurality of types. Means,
With
The brightness determination unit selects any one of the template groups stored in the determination template storage unit based on the type of the frequency distribution selected by the selection unit, and a plurality of adjacent brightness pixels A matching template is detected from among the plurality of light color templates and the plurality of dark color templates constituting the template group by pattern matching between the light and dark pattern of the adjacent cell and the template included in the selected template group. , And determining whether the intermediate luminance cell belongs to the light cell or the dark cell based on the detection result .

請求項1の発明は、第1閾値及び第2閾値に基づいてある程度のセルを明色セル又は暗色セルと確定させてから、確定できない残余のセル(中間輝度セル)の明暗を判定しているため、明暗判定に時間がかかる処理(明暗判定手段による中間輝度セルの明暗判定処理)を極力少なくすることができ、処理時間の短縮化を図ることができる。更に、残余のセル(中間輝度セル)に隣接する隣接セルの明暗をより明らかにしてから、これら隣接セルの明暗パターンに基づいて中間輝度セルの明暗を判定することができるため、ボケが存在したりコントラストが低い場合などにおいても、より正確に二値化することができる。   According to the first aspect of the present invention, after determining a certain number of cells as bright cells or dark cells based on the first threshold value and the second threshold value, the brightness of the remaining cells (intermediate luminance cells) that cannot be determined is determined. For this reason, it is possible to minimize the processing that takes time for the light / dark determination (light / dark determination processing of the intermediate luminance cell by the light / dark determination means), and to shorten the processing time. Furthermore, since the brightness of the adjacent cells adjacent to the remaining cells (intermediate brightness cells) can be clarified and then the brightness of the intermediate brightness cells can be determined based on the brightness / darkness pattern of these adjacent cells. Even when the contrast is low, binarization can be performed more accurately.

さらに、前記輝度検出手段によって検出された各セル位置の輝度を輝度レベル毎に分類すると共に輝度レベル毎の頻度を特定し得る度数分布を生成する度数分布生成手段を備え、前記明暗セル検出手段は、前記度数分布生成手段によって生成された前記度数分布において、高輝度側でピークとなる第1ピーク値を前記第1閾値とし、前記第1ピーク値よりも低輝度側でピークとなる第2ピーク値を前記第2閾値とし、前記第1ピーク値以上の輝度のセルを前記明色判定セルとして検出し、前記第2ピーク値以下の輝度のセルを前記暗色判定セルとして検出する。
度数分布(ヒストグラム)の両端(即ち、第1ピーク値及び第2ピーク値の外側領域の輝度)は、セルの色を反映している可能性が高く、上記構成のようにすれば、ある程度のセルを正確に明暗判定して確定し、絞り込むことができる。
Further , the brightness cell detection unit includes a frequency distribution generation unit that classifies the luminance of each cell position detected by the luminance detection unit for each luminance level and generates a frequency distribution that can specify the frequency for each luminance level, In the frequency distribution generated by the frequency distribution generating means, the first peak value that peaks on the high luminance side is set as the first threshold, and the second peak that peaks on the lower luminance side than the first peak value. The value is set as the second threshold value, a cell having a luminance equal to or higher than the first peak value is detected as the light color determination cell, and a cell having a luminance equal to or lower than the second peak value is detected as the dark color determination cell.
It is highly possible that both ends of the frequency distribution (histogram) (that is, the luminance of the area outside the first peak value and the second peak value) reflect the color of the cell. It is possible to narrow down the cell by accurately determining the brightness and to narrow down the cell.

特に、前記度数分布生成手段によって生成された前記度数分布の種類を、当該度数分布の内容に基づいて予め定められた複数種類の中から選択する選択手段と、前記明色セルと判定するための複数の明色テンプレートと前記暗色セルと判定するための複数の暗色テンプレートとを含んだテンプレート群を、前記複数種類の各々に対応付けて記憶する判定用テンプレート記憶手段と、を備え、前記明暗判定手段は、前記選択手段によって選択された前記度数分布の種類に基づいて前記判定用テンプレート記憶手段に記憶されるいずれかの前記テンプレート群を選択し、前記中間輝度セルに隣接する複数の隣接セルの明暗パターンとその選択された当該テンプレート群に含まれるテンプレートとのパターンマッチングにより、当該テンプレート群を構成する前記複数の明色テンプレート及び前記複数の暗色テンプレートの中から適合するテンプレートを検出し、その検出結果に基づいて前記中間輝度セルが前記明色セル又は前記暗色セルのいずれに属するかを決定する。
このように度数分布(ヒストグラム)の種類毎にテンプレート群を用意しておき、実際に得られた度数分布に対応するテンプレート群を選択するようにすれば、実際の撮像環境により合致したテンプレートに基づいてより正確に明暗判定することができる。
In particular , for selecting the type of the frequency distribution generated by the frequency distribution generation unit from a plurality of types predetermined based on the content of the frequency distribution, and for determining the light cell A determination template storage means for storing a template group including a plurality of light color templates and a plurality of dark color templates for determining the dark color cells in association with each of the plurality of types; The means selects any one of the template groups stored in the determination template storage means based on the type of the frequency distribution selected by the selection means, and a plurality of adjacent cells adjacent to the intermediate luminance cell are selected. The template group is obtained by pattern matching between the light and dark pattern and the template included in the selected template group. A matching template is detected from the plurality of light color templates and the plurality of dark color templates, and whether the intermediate luminance cell belongs to the light color cell or the dark color cell is determined based on the detection result. To do.
As described above, if a template group is prepared for each type of frequency distribution (histogram) and a template group corresponding to the actually obtained frequency distribution is selected, a template that matches the actual imaging environment is selected. Therefore, it is possible to determine the lightness and darkness more accurately.

請求項の発明は、前記セル位置検出手段が、前記画像記憶手段に記憶される前記情報コードの画像から、各セルの所定の代表位置を検出し、前記輝度検出手段が、前記セル位置検出手段によって検出された各セルの前記代表位置での輝度を検出し、更に、前記明暗セル検出手段によって検出された前記明色判定セル及び前記暗色判定セルの中から、周囲に隣接するセルが前記中間輝度セルとなっていないセルを基準セルとして検出する基準セル検出手段と、所定サイズで構成可能な明暗セルパターンを複数種類定めると共に各明暗セルパターンでの輝度値の配列をテンプレート化した複数のテンプレートを記憶した補正用テンプレート記憶手段と、前記補正用テンプレート記憶手段に記憶される複数のテンプレートの中から、前記基準セル検出手段によって検出された前記基準セルと当該基準セルの周囲に隣接するセルのセル配列に対応するテンプレートを選択するテンプレート選択手段と、前記セル位置検出手段によって検出された前記基準セル及び当該基準セルに隣接するセルの各代表位置からそれぞれ一定度合いで位置をずらすと共にずらした各変更位置で輝度状態を検出する処理を、各代表位置を基準として複数方向にずらして行うずらし状態検出手段と、前記ずらし状態検出手段により各代表位置から複数方向にずらして得られる各輝度状態と、前記テンプレート選択手段で選択されたテンプレートとの適合性を判断し、最も適合性の高い輝度状態のときの各代表位置からのずらし度合を補正値として検出する補正値検出手段と、前記補正値検出手段によって検出された補正値に基づいて、前記基準セル以外の各セルの位置を各代表位置から補正する補正手段と、を備えたことを特徴とする。
このようにすることで、基準セル及び周囲の明暗パターン及び当該明暗パターンに対応するテンプレートから基準セルの厳密な座標(テンプレートとの適合性が高い場合の座標)を選ぶことができ、各セル座標の高精度化を測ることができる。
According to a second aspect of the present invention, the cell position detection means detects a predetermined representative position of each cell from the image of the information code stored in the image storage means, and the luminance detection means detects the cell position detection. The brightness at the representative position of each cell detected by the means is detected. Further, among the light color determination cell and the dark color determination cell detected by the light / dark cell detection means, neighboring cells are Reference cell detection means for detecting a cell that is not an intermediate luminance cell as a reference cell, a plurality of types of bright and dark cell patterns that can be configured in a predetermined size, and a plurality of templates of luminance value arrays in each bright and dark cell pattern A correction template storage unit storing a template, and the reference cell among a plurality of templates stored in the correction template storage unit Template selecting means for selecting a template corresponding to a cell arrangement of the reference cell detected by the output means and the cells adjacent to the periphery of the reference cell; the reference cell detected by the cell position detecting means; and the reference cell A shift state detection unit that shifts the position from each representative position of a cell adjacent to each other at a certain degree and detects the luminance state at each shifted change position by shifting in a plurality of directions with each representative position as a reference; and Each brightness state obtained by shifting in a plurality of directions from each representative position by the shift state detection means and the template selected by the template selection means are judged to be compatible, and each representative in the brightness state having the highest suitability Correction value detecting means for detecting the degree of displacement from the position as a correction value, and detected by the correction value detecting means. Based on the correction value, characterized by comprising a correction means for correcting the position of each cell other than the reference cell from the representative positions.
In this way, the exact coordinates of the reference cell (coordinates when the compatibility with the template is high) can be selected from the reference cell and the surrounding light and dark pattern and the template corresponding to the light and dark pattern. High accuracy can be measured.

請求項の発明では、前記撮像手段によって撮像された前記情報コードの画像を複数の画像領域に分割する領域分割手段を備え、前記基準セル検出手段は、前記領域分割手段によって分割された前記画像領域毎に前記基準セルを検出し、前記補正値検出手段は、前記領域分割手段によって分割された前記画像領域毎に前記補正値を求め、前記補正手段は、前記補正値検出手段によって前記画像領域毎に求められた各補正値を各画像領域にそれぞれ反映するように、前記画像領域毎に各セルの位置を各代表位置から補正する処理を行うことを特徴とする。
この構成によれば、より高精度の補正が可能となる。特に、コード画像が歪んだり変形しやすい環境下で有利となる。
According to a third aspect of the present invention, there is provided an area dividing unit that divides the image of the information code imaged by the imaging unit into a plurality of image areas, and the reference cell detecting unit is configured to generate the image divided by the area dividing unit. The reference cell is detected for each area, the correction value detection means obtains the correction value for each image area divided by the area division means, and the correction means detects the image area by the correction value detection means. A process of correcting the position of each cell from each representative position for each image area is performed so that each correction value obtained for each image area is reflected in each image area.
According to this configuration, correction with higher accuracy is possible. This is particularly advantageous in an environment where the code image is easily distorted or deformed.

図1は、本発明の第1実施形態に係る情報コード読取装置を例示するブロック図である。FIG. 1 is a block diagram illustrating an information code reading apparatus according to the first embodiment of the invention. 図2は、図1の情報コード読取装置での読取処理を例示するフローチャートである。FIG. 2 is a flowchart illustrating a reading process in the information code reading apparatus of FIG. 図3は、図2の読取処理で生成されるヒストグラム(度数分布)を模式的に示すグラフである。FIG. 3 is a graph schematically showing a histogram (frequency distribution) generated by the reading process of FIG. 図4は、図2の読取処理で測定されたヒストグラムのパラメータを例示する説明図である。FIG. 4 is an explanatory diagram illustrating the parameters of the histogram measured in the reading process of FIG. 図5は、測定されたヒストグラムとテンプレート群のパラメータの差分の総和を求める点を説明するイメージ図である。FIG. 5 is an image diagram for explaining the point at which the sum of differences between measured histograms and template group parameters is obtained. 図6は、図2の読取処理で用いられるテンプレート群の内容を説明するイメージ図である。FIG. 6 is an image diagram for explaining the contents of the template group used in the reading process of FIG. 図7(A)は、図2の読取処理において、S5の処理までに確定した明暗セルと確定していない中間輝度セルを説明する説明図であり、図7(B)は、領域の分割例について説明する説明図である。FIG. 7A is an explanatory diagram for explaining the bright and dark cells determined by the processing of S5 and the intermediate luminance cell not determined in the reading processing of FIG. 2, and FIG. It is explanatory drawing explaining about. 図8(A)は、仮マッピングで検出された中心位置からずらす様子を説明する説明図であり、図8(B)は、ずらした各測定結果とテンプレートとの差分で得られる評価値によって代表位置(補正された位置)を決定することを説明する説明図である。FIG. 8A is an explanatory diagram for explaining a shift from the center position detected by temporary mapping, and FIG. 8B is represented by an evaluation value obtained by a difference between each shifted measurement result and the template. It is explanatory drawing explaining determining a position (corrected position). 図9(A)は、テンプレートマッチングの対象パターンを説明する説明図であり、図9(B)は、その対象パターンの各セルの測定輝度を説明する説明図である。FIG. 9A is an explanatory diagram for explaining a target pattern for template matching, and FIG. 9B is an explanatory diagram for explaining the measured luminance of each cell of the target pattern. 図10(A)〜図10(D)は、図9(A)の対象パターンの候補となるパターンを説明する説明図である。FIG. 10A to FIG. 10D are explanatory diagrams for explaining patterns that are candidates for the target pattern in FIG. 9A. 図11(A)〜図11(D)は、選択されたテンプレート群に登録されている図10(A)〜図10(D)の各パターンについての輝度値リストを説明する説明図である。FIG. 11A to FIG. 11D are explanatory diagrams for explaining a luminance value list for each pattern of FIG. 10A to FIG. 10D registered in the selected template group. 図12は、最終的に得られたコード内容を説明する説明図である。FIG. 12 is an explanatory diagram for explaining the content of the finally obtained code. 図13は、他の実施形態に関し、補正方法の別例を説明するグラフである。FIG. 13 is a graph illustrating another example of the correction method according to another embodiment.

[第1実施形態]
以下、本発明を具現化した第1実施形態について、図面を参照して説明する。
(全体構成)
まず、図1等を参照して本実施形態に係る情報コード読取装置の全体構成について説明する。図1に示すように、本実施形態に係る情報コード読取装置1は、一次元コード、二次元コード等の情報コードQを読み取るコードリーダとして構成されるものであり、図示しないケースによって外郭が構成され、このケース内に各種電子部品が収容された構成をなしている。
[First embodiment]
Hereinafter, a first embodiment embodying the present invention will be described with reference to the drawings.
(overall structure)
First, the overall configuration of the information code reading apparatus according to the present embodiment will be described with reference to FIG. As shown in FIG. 1, the information code reader 1 according to the present embodiment is configured as a code reader that reads an information code Q such as a one-dimensional code or a two-dimensional code, and an outer case is configured by a case (not shown). In this case, various electronic components are accommodated in the case.

この情報コード読取装置1は、主に、照明光源21、受光センサ23、フィルタ25、結像レンズ27等の光学系と、メモリ35、制御回路40、操作スイッチ42、液晶表示器46等のマイクロコンピュータ(以下「マイコン」という)系と、電源スイッチ41、電池49等の電源系と、から構成されている。なお、これらは、図略のプリント配線板に実装あるいはケース(図示略)内に内装されている。   The information code reader 1 mainly includes an optical system such as an illumination light source 21, a light receiving sensor 23, a filter 25, and an imaging lens 27, and a micro memory such as a memory 35, a control circuit 40, an operation switch 42, and a liquid crystal display 46. It is composed of a computer (hereinafter referred to as “microcomputer”) system and a power supply system such as a power switch 41 and a battery 49. These are mounted on a printed wiring board (not shown) or housed in a case (not shown).

光学系は、照明光源21、受光センサ23、フィルタ25、結像レンズ27等から構成されている。照明光源21は、照明光Lfを発光可能な照明光源として機能するもので、例えば、赤色のLEDとこのLEDの出射側に設けられる拡散レンズ、集光レンズ等とから構成されている。本実施形態では、受光センサ23を挟んだ両側に照明光源21が設けられており、ケースに形成された読取口(図示略)を介して読取対象物Rに向けて照明光Lfを照射可能に構成されている。   The optical system includes an illumination light source 21, a light receiving sensor 23, a filter 25, an imaging lens 27, and the like. The illumination light source 21 functions as an illumination light source capable of emitting illumination light Lf, and includes, for example, a red LED and a diffusion lens, a condensing lens, and the like provided on the emission side of the LED. In the present embodiment, illumination light sources 21 are provided on both sides of the light receiving sensor 23, and the illumination light Lf can be irradiated toward the reading object R through a reading port (not shown) formed in the case. It is configured.

この読取対象物Rとしては、例えば、紙、樹脂材料、金属材料等の様々な対象が考えられ、このような読取対象物Rに情報コードQが印刷、ダイレクトマーキングなどによって形成されている。なお、以下の説明では、情報コードQが図12のような二次元コードD(図12ではデータマトリックスコード)として構成される例を代表例として説明するが、明色セルと暗色セルとを含んだ情報コードであれば、QRコード(登録商標)やマキシコードなどの他の二次元コードに置き換えてもよい。   As this reading object R, for example, various objects such as paper, resin material, metal material, and the like are conceivable, and an information code Q is formed on such reading object R by printing, direct marking, or the like. In the following description, an example in which the information code Q is configured as a two-dimensional code D (data matrix code in FIG. 12) as shown in FIG. 12 will be described as a representative example, but includes a light color cell and a dark color cell. If it is an information code, it may be replaced with another two-dimensional code such as a QR code (registered trademark) or a maxi code.

受光センサ23は、読取対象物Rや情報コードQ(図12のような二次元コードD等)に照射されて反射した反射光Lrを受光可能に構成されるもので、例えば、C−MOSやCCD等の固体撮像素子である受光素子を2次元に配列したエリアセンサが、これに相当する。この受光センサ23は、結像レンズ27を介して入射する入射光を受光面23aで受光可能に図略のプリント配線板に実装されている。なお、受光センサ23は、「撮像手段」の一例に相当する。   The light receiving sensor 23 is configured to be able to receive the reflected light Lr irradiated and reflected on the reading object R and the information code Q (two-dimensional code D as shown in FIG. 12). An area sensor in which light receiving elements, which are solid-state imaging elements such as CCDs, are two-dimensionally arranged corresponds to this. The light receiving sensor 23 is mounted on a printed wiring board (not shown) so that incident light incident through the imaging lens 27 can be received by the light receiving surface 23a. The light receiving sensor 23 corresponds to an example of “imaging means”.

フィルタ25は、反射光Lrの波長相当以下の光の通過を許容し、当該波長相当を超える光の通過を遮断し得る光学的なローパスフィルタで、ケースに形成された読取口(図示略)と結像レンズ27との間に設けられている。これにより、反射光Lrの波長相当を超える不要な光が受光センサ23に入射することを抑制している。また、結像レンズ27は、例えば、鏡筒とこの鏡筒内に収容される複数の集光レンズとによって構成されており、本実施形態では、ケースに形成された読取口(図示略)に入射する反射光Lrを集光し、受光センサ23の受光面23aに情報コードQのコード画像を結像可能に構成されている。   The filter 25 is an optical low-pass filter that allows passage of light that is less than or equal to the wavelength of the reflected light Lr and blocks passage of light that exceeds the wavelength, and a reading port (not shown) formed in the case. It is provided between the imaging lens 27. Thereby, unnecessary light exceeding the wavelength equivalent of the reflected light Lr is prevented from entering the light receiving sensor 23. Further, the imaging lens 27 is constituted by, for example, a lens barrel and a plurality of condensing lenses accommodated in the lens barrel. In the present embodiment, the imaging lens 27 is provided at a reading port (not shown) formed in the case. The incident reflected light Lr is collected, and a code image of the information code Q can be formed on the light receiving surface 23 a of the light receiving sensor 23.

マイコン系は、増幅回路31、A/D変換回路33、メモリ35、アドレス発生回路36、同期信号発生回路38、制御回路40、操作スイッチ42、LED43、ブザー44、液晶表示器46、通信インタフェース48等から構成されている。このマイコン系は、マイコン(情報処理装置)として機能し得る制御回路40及びメモリ35を中心として構成され、前述した光学系によって撮像された情報コードQの画像信号をハードウェア的およびソフトウェア的に信号処理し得るものである。   The microcomputer system includes an amplification circuit 31, an A / D conversion circuit 33, a memory 35, an address generation circuit 36, a synchronization signal generation circuit 38, a control circuit 40, an operation switch 42, an LED 43, a buzzer 44, a liquid crystal display 46, and a communication interface 48. Etc. This microcomputer system is configured around a control circuit 40 and a memory 35 that can function as a microcomputer (information processing apparatus), and the image signal of the information code Q imaged by the optical system described above is signaled in hardware and software. It can be processed.

光学系の受光センサ23から出力される画像信号(アナログ信号)は、増幅回路31に入力されることで所定ゲインで増幅された後、A/D変換回路33に入力され、アナログ信号からディジタル信号に変換される。そして、ディジタル化された画像信号、つまり画像データ(画像情報)は、メモリ35に入力され、当該メモリ35の画像データ蓄積領域に蓄積される。同期信号発生回路38は、受光センサ23およびアドレス発生回路36に対する同期信号を発生可能に構成されており、またアドレス発生回路36は、この同期信号発生回路38から供給される同期信号に基づいて、メモリ35に格納される画像データの格納アドレスを発生可能に構成されている。   An image signal (analog signal) output from the light receiving sensor 23 of the optical system is input to the amplification circuit 31 and amplified by a predetermined gain, and then input to the A / D conversion circuit 33, and the digital signal is converted from the analog signal. Is converted to The digitized image signal, that is, image data (image information) is input to the memory 35 and stored in the image data storage area of the memory 35. The synchronization signal generation circuit 38 is configured to be able to generate a synchronization signal for the light receiving sensor 23 and the address generation circuit 36. The address generation circuit 36 is based on the synchronization signal supplied from the synchronization signal generation circuit 38. A storage address of image data stored in the memory 35 can be generated.

メモリ35は、半導体メモリ装置で、例えばRAM(DRAM、SRAM等)やROM(EPROM、EEPROM等)がこれに相当する。このメモリ35のうちのRAMには、前述した画像データ蓄積領域のほかに、制御回路40が算術演算や論理演算等の各処理時に利用する作業領域や読取条件テーブルも確保可能に構成されている。またROMには、後述する読取処理等を実行可能な所定プログラムやその他、照明光源21、受光センサ23等の各ハードウェアを制御可能なシステムプログラム等が予め格納されている。
なお、メモリ35は、画像記憶手段の一例に相当し、撮像手段によって撮像された情報コードの画像を記憶するように機能する。
The memory 35 is a semiconductor memory device, and corresponds to, for example, a RAM (DRAM, SRAM, etc.) or a ROM (EPROM, EEPROM, etc.). In addition to the above-described image data storage area, the RAM of the memory 35 is configured to be able to secure a work area and a reading condition table that are used by the control circuit 40 in each processing such as arithmetic operation and logical operation. . The ROM stores in advance a predetermined program that can execute a reading process and the like that will be described later, and a system program that can control each piece of hardware such as the illumination light source 21 and the light receiving sensor 23.
Note that the memory 35 corresponds to an example of an image storage unit and functions to store an image of an information code captured by the imaging unit.

制御回路40は、情報コード読取装置1全体を制御可能なマイコンで、CPU、システムバス、入出力インタフェース等からなるものであり、情報処理機能を有している。この制御回路40には、内蔵された入出力インタフェースを介して種々の入出力装置(周辺装置)が接続されており、本実施形態の場合、電源スイッチ41、操作スイッチ42、LED43、ブザー44、液晶表示器46、通信インタフェース48等が接続されている。また、通信インタフェース48には、情報コード読取装置1の上位システムに相当するホストコンピュータHSTなどを接続できるようになっている。   The control circuit 40 is a microcomputer capable of controlling the entire information code reader 1, and includes a CPU, a system bus, an input / output interface, and the like, and has an information processing function. Various input / output devices (peripheral devices) are connected to the control circuit 40 via a built-in input / output interface. In this embodiment, a power switch 41, an operation switch 42, an LED 43, a buzzer 44, A liquid crystal display 46, a communication interface 48, and the like are connected. The communication interface 48 can be connected to a host computer HST corresponding to the host system of the information code reader 1.

電源系は、電源スイッチ41、電池49等により構成されており、制御回路40により管理される電源スイッチ41のオンオフによって、上述した各装置や各回路に、電池49から供給される駆動電圧の導通や遮断が制御されている。なお、電池49は、所定の直流電圧を発生可能な2次電池で、例えば、リチウムイオン電池等がこれに相当する。   The power supply system includes a power switch 41, a battery 49, and the like. When the power switch 41 managed by the control circuit 40 is turned on and off, the conduction of the drive voltage supplied from the battery 49 to each device and each circuit described above is established. Or shut off is controlled. The battery 49 is a secondary battery that can generate a predetermined DC voltage, and corresponds to, for example, a lithium ion battery.

(読取処理)
次に、情報コード読取装置1で行われる読取処理について説明する。
図2に示す読取処理では、まず、処理開始に伴いコード位置検出処理を行う(S1)。このコード位置検出処理では、まず、受光センサ23での受光結果に基づいて二次元コードDを含んだ読取対象物Rの画像データを取得し、メモリ35に記憶する。この画像データは、受光センサ23の各受光素子に対応する画素データの集合として構成される。そして、この画像データから二次元コードDの領域(セルが配列されてなるコード領域)を公知の方法で特定する。
(Reading process)
Next, a reading process performed by the information code reading device 1 will be described.
In the reading process shown in FIG. 2, first, a code position detection process is performed as the process starts (S1). In this code position detection process, first, image data of the reading object R including the two-dimensional code D is acquired based on the light reception result of the light receiving sensor 23 and stored in the memory 35. This image data is configured as a set of pixel data corresponding to each light receiving element of the light receiving sensor 23. Then, a region of the two-dimensional code D (a code region in which cells are arranged) is specified from this image data by a known method.

そして、特定されたコード領域の中で各セルの代表位置を特定する仮マッピング処理を行う(S2)。この仮マッピング処理は、公知の情報コードのデコード方法で各セル位置を特定する処理と同様である、例えば、データマトリックスやQRコード(登録商標)の公知のデコード処理と同様、コード位置(コード領域)を検出し、コード領域内に含まれる特徴パターン(例えば、データマトリックスのアライメントパターンやQRコード(登録商標)の位置検出パターンなど)の座標を確定する。その後、公知の方法でコード領域に含まれるセル数を取得し、コード領域内に含まれる各セルの中心座標を特定した上でそれら中心座標を各セルの代表位置として確定する。このようにして、各セルの代表位置がマッピングされることになる。   Then, provisional mapping processing for specifying the representative position of each cell in the specified code area is performed (S2). This temporary mapping process is the same as the process of specifying each cell position by a known information code decoding method. For example, as in the known decoding process of a data matrix or QR code (registered trademark), the code position (code area ) To determine the coordinates of a feature pattern (for example, an alignment pattern of a data matrix or a position detection pattern of a QR code (registered trademark)) included in the code area. Thereafter, the number of cells included in the code area is obtained by a known method, and after specifying the center coordinates of each cell included in the code area, the center coordinates are determined as the representative position of each cell. In this way, the representative position of each cell is mapped.

そして、S2の仮マッピング処理の後、S2の処理で特定された各セルの中心座標(代表位置)における各輝度をサンプリングし、ヒストグラム(度数分布)を作成する(S3)。このS3で作成されるヒストグラムを模式的にグラフ化した例が図3である。ここで作成されるヒストグラムでは、図3のように暗色(図3では黒)セルの画素を主とする低輝度側の第1の山A1と、明色(図3では白)セルの画素を主とする高輝度側の第2の山A2ができ、ボケ等などの存在により、第1の山A1と第2の山A2の間にもある程度の輝度分布が存在することになる。   Then, after the temporary mapping process of S2, each luminance at the center coordinate (representative position) of each cell specified in the process of S2 is sampled to create a histogram (frequency distribution) (S3). FIG. 3 is an example in which the histogram created in S3 is schematically graphed. In the histogram created here, as shown in FIG. 3, the first peak A1 on the low-luminance side mainly composed of dark (black in FIG. 3) cell pixels and the light (white in FIG. 3) cell pixels. A second peak A2 on the high-luminance side is formed, and due to the presence of blur or the like, a certain luminance distribution is also present between the first peak A1 and the second peak A2.

そして、S3で作成したヒストグラムの形状とマッピング情報を利用して、テンプレート選択を行う(S4)。S4でのテンプレート選択は、例えば、予め作成してメモリ35に記憶してある多数のテンプレート群の中から、S1で取得した今回の画像の条件に近いテンプレート群を選び出すことによって、テンプレートマッチングの回数の削減と、認識性能の向上を図る。   Then, template selection is performed using the histogram shape and mapping information created in S3 (S4). The template selection at S4 is performed by selecting the template group close to the condition of the current image acquired at S1 from among a large number of template groups that are created in advance and stored in the memory 35, for example. Reduction and improvement of recognition performance.

具体的には、まず、図3のようにヒストグラムを分割する閾値Tを設定する。明色セルと暗色セルからなる二次元コードであれば各セルの色は明色(例えば白)と暗色(例えば黒)であるため、一般的な二値化手法を用いることでヒストグラムを分割する閾値Tを引くことができる。この閾値Tは予め定められた輝度であってもよく、低輝度側の第1の山A1のピークと高輝度側の第2の山A2のピークの中間値を閾値Tとしてもよい。或いは、低輝度側からの所定累積度数の輝度を閾値とするようにしてもよい。こうして閾値Tを引くことにより、図3に示す輝度のヒストグラムは、低輝度側の第1の山A1(黒の山)と高輝度側の第2の山A2(白の山)に分割される。   Specifically, first, a threshold value T for dividing the histogram is set as shown in FIG. In the case of a two-dimensional code composed of light cells and dark cells, the color of each cell is light (for example, white) and dark (for example, black), so the histogram is divided by using a general binarization method. The threshold T can be subtracted. The threshold value T may be a predetermined luminance, or an intermediate value between the peak of the first peak A1 on the low luminance side and the peak of the second peak A2 on the high luminance side may be used as the threshold T. Alternatively, the luminance of a predetermined cumulative frequency from the low luminance side may be used as the threshold value. By subtracting the threshold value T in this way, the luminance histogram shown in FIG. 3 is divided into a first mountain A1 (black mountain) on the low luminance side and a second mountain A2 (white mountain) on the high luminance side. .

そして、これら低輝度側の山(黒の山)と高輝度側の山(白の山)のそれぞれのピークを求めることでおよそのコントラストの推定を行う。また、それぞれの山のすその広がり具合を評価することでボケの推定も同時に行う。具体的には例えば、図3のように閾値Tによってヒストグラムを分割した上で、Thr_L(低輝度側の山(黒の山)のピーク位置)、Thr_H(高輝度側の山(白の山)のピーク位置)を求める。また、ここまでにおいて、S2で各セルのマッピング(中心位置検出)が完了しているので、各セルの中心座標は既知であり、公知の方法(例えば、縦方向及び横方向の各セル間距離の平均値をセルサイズとする方法、或いは縦方向又は横方向のいずれかのセル間距離をセルサイズとする方法など)で容易にセルサイズを求めることができる。   Then, the approximate contrast is estimated by obtaining the respective peaks of the low luminance side mountain (black mountain) and the high luminance side mountain (white mountain). In addition, blur estimation is performed simultaneously by evaluating the extent of each mountain. Specifically, for example, after dividing the histogram by the threshold T as shown in FIG. 3, Thr_L (peak position of the low brightness side peak (black peak)), Thr_H (high brightness side peak (white peak)) For the peak position). Since the mapping (center position detection) of each cell has been completed in S2 so far, the center coordinates of each cell are known, and a known method (for example, the distance between cells in the vertical direction and the horizontal direction). The cell size can be easily obtained by a method in which the average value of the cell size is used as the cell size or a method in which the distance between the cells in the vertical direction or the horizontal direction is used as the cell size).

次に、低輝度側の第1の山A1(黒の山)か高輝度側の第2の山A2(白の山)に着目し、半値幅を求めることでヒストグラムのなまり具合を測定する。図3の例では、低輝度側の第1の山A1に着目しており、山A1において頻度がピークY1のときの輝度Thr_Lと、頻度がピークY1の1/2のときの輝度X1との差Waを半値幅としている。また、ピーク間の差Thr_H−Thr_Lも求めている。以上の処理により必要なパラメータを求めることができる。なお、図4は、このような処理によって求められたパラメータの一例を示すものである。   Next, paying attention to the first peak A1 (black peak) on the low luminance side or the second peak A2 (white peak) on the high luminance side, the degree of histogram rounding is measured by obtaining the half width. In the example of FIG. 3, attention is paid to the first peak A1 on the low brightness side, and the brightness Thr_L when the frequency is the peak Y1 and the brightness X1 when the frequency is ½ of the peak Y1 in the peak A1. The difference Wa is a half width. Further, a difference Thr_H−Thr_L between peaks is also obtained. Necessary parameters can be obtained by the above processing. FIG. 4 shows an example of parameters obtained by such processing.

S3の処理の後には、テンプレートを選択する処理を行う(S4)。このS4の処理では、あらかじめ登録されているテンプレート群のうち、図4のパラメータに最も近いテンプレート群を選択すればよい。具体的には、得られた図4の各パラメータと、各テンプレート群で設定されている各パラメータとの差分(例えば、各パラメータの差分の合計値、或いは特定のパラメータの差分値)をとり、最も差分が小さくなるテンプレート群を選択する(図5のイメージ図参照)。   After the process of S3, a process for selecting a template is performed (S4). In the process of S4, a template group closest to the parameters shown in FIG. 4 may be selected from the template groups registered in advance. Specifically, the difference between each parameter of FIG. 4 obtained and each parameter set in each template group (for example, the total value of the difference of each parameter or the difference value of a specific parameter) is taken, A template group with the smallest difference is selected (see the image diagram in FIG. 5).

いずれのテンプレート群も、図6のイメージ図のように、特定の画像状態のテンプレート(例えば、特定の画像状態における3行3列の全セル配列パターンについての、セル配列パターン毎の輝度値リスト)がまとめられており、その特定の画像状態を示すヒストグラムのパラメータが設定されている。具体的には、例えば、それらセル配列パターン毎の輝度値リストについてヒストグラムを求めたときのパラメータがその設定されるパラメータとなるように構成されている。従って、テンプレート群の選択の際には、例えば、テンプレート群毎に、既に得られている図4のようなヒストグラムのパラメータと各テンプレート群のパラメータとの差分の総和を求め、その総和が最も小さくなるテンプレート群を選択することになる。例えば、各テンプレート群が、セルサイズについては2画素刻み、Thr_L、Thr_Hについては10刻み、半値幅については5刻みで登録されているとすれば、セルサイズが4、Thr_Lが30、Thr_Hが80、半値幅が10のテンプレート群との差分は、(|32−30|+|84−80|+|52−50|+|11−10|=9)となり、図4の各パラメータと、各テンプレート群で設定されている各パラメータとの差分をそれぞれ計算したときに、この「9」の値が最も小さくなる場合には、上記のテンプレート群(セルサイズ4、Thr_L30、Thr_H80、半値幅10のテンプレート群)を選択することになる。このようにして、ヒストグラムとマッピングの情報からテンプレートを選択することができる。   Each template group includes a template in a specific image state (for example, a luminance value list for each cell array pattern for a 3 × 3 cell array pattern in the specific image state) as shown in the image diagram of FIG. 6. The parameters of the histogram indicating the specific image state are set. Specifically, for example, the parameter when the histogram is obtained for the brightness value list for each cell arrangement pattern is configured to be the parameter to be set. Accordingly, when selecting a template group, for example, for each template group, the sum of differences between the already obtained histogram parameters as shown in FIG. 4 and the parameters of each template group is obtained, and the sum is the smallest. A template group to be selected is selected. For example, if each template group is registered in increments of 2 pixels for the cell size, 10 increments for Thr_L and Thr_H, and 5 increments for the half width, the cell size is 4, Thr_L is 30, and Thr_H is 80. The difference from the template group with a half width of 10 is (| 32-30 | + | 84-80 | + | 52-50 | + | 11−10 | = 9), and the parameters in FIG. When the difference between each parameter set in the template group is calculated and the value of “9” is the smallest, the above template group (cell size 4, Thr_L30, Thr_H80, half width 10) is calculated. Template group) is selected. In this way, a template can be selected from the histogram and mapping information.

メモリ35は、判定用テンプレート記憶手段の一例に相当し、明色セルと判定するための複数の明色テンプレートと、暗色セルと判定するための複数の暗色テンプレートとを記憶するように機能しており、具体的には、明色セルと判定するための複数の明色テンプレートと暗色セルと判定するための複数の暗色テンプレートとを含んだテンプレート群を、複数種類の各々に対応付けて記憶している。   The memory 35 corresponds to an example of a determination template storage unit, and functions to store a plurality of light color templates for determining light cells and a plurality of dark color templates for determining dark cells. Specifically, a template group including a plurality of light color templates for determining a light color cell and a plurality of dark color templates for determining a dark color cell is stored in association with each of a plurality of types. ing.

S4でテンプレートを選択した後、荒い二値化を行う(S5)。S5の荒い二値化は、テンプレートマッチングに要する処理時間を削減するために行うものである。具体的には例えば、図3のヒストグラムで得た低輝度側の第1の山A1のピーク位置と高輝度側の第2の山A2のピーク位置を閾値として、第2の山A2のピーク以上となる輝度が高いものは明色、第1の山A1のピーク以下となる輝度が低いものは暗色とするように荒い二値化を行う。このように荒い二値化を行うことで、図7(A)のような二値化結果が得られる。このようにすることで、図7(A)の網掛け部分についてのみテンプレートマッチングを行えば良くなる。なお、荒い二値化の閾値は、上記のような設定方法に限られず、例えば、処理時間をなるべく削減するには二値化される範囲が広くなるようにすればよいし、処理時間をある程度かけても良いのであれば二値化される範囲を狭くすればよい。   After selecting a template in S4, rough binarization is performed (S5). The rough binarization of S5 is performed in order to reduce the processing time required for template matching. Specifically, for example, the peak position of the first peak A1 on the low brightness side and the peak position of the second peak A2 on the high brightness side obtained from the histogram of FIG. Rough binarization is performed so that a high luminance is a bright color and a low luminance that is lower than the peak of the first peak A1 is a dark color. By performing rough binarization in this way, a binarization result as shown in FIG. 7A is obtained. By doing so, it is only necessary to perform template matching only for the shaded portion of FIG. The rough binarization threshold is not limited to the setting method as described above. For example, in order to reduce the processing time as much as possible, the binarized range may be widened, and the processing time may be limited to some extent. If it is acceptable, the binarized range should be narrowed.

本実施形態では、制御回路40が度数分布生成手段の一例に相当し、輝度検出手段によって検出された各セル位置の輝度を輝度レベル毎に分類すると共に輝度レベル毎の頻度を特定し得る度数分布を生成するように機能する。   In the present embodiment, the control circuit 40 corresponds to an example of a frequency distribution generation unit, and a frequency distribution that can classify the luminance at each cell position detected by the luminance detection unit for each luminance level and specify the frequency for each luminance level. Function to generate.

また、制御回路40が明暗セル検出手段の一例に相当し、輝度検出手段によって検出された輝度が、第1閾値以上となる明色判定セルを検出すると共に、第1閾値よりも低い第2閾値以下となる暗色判定セルを検出するように機能する。より具体的には、明暗セル検出手段は、度数分布生成手段によって生成された度数分布において、高輝度側でピークとなる第1ピーク値Thr_Hを第1閾値とし、第1ピーク値よりも低輝度側でピークとなる第2ピーク値Thr_Lを第2閾値とし、第1ピーク値以上の輝度のセルを明色判定セルとして検出し、第2ピーク値以下の輝度のセルを暗色判定セルとして検出する。   The control circuit 40 corresponds to an example of a light / dark cell detection unit, detects a light color determination cell whose luminance detected by the luminance detection unit is equal to or higher than the first threshold value, and has a second threshold value lower than the first threshold value. It functions to detect a dark color determination cell which is as follows. More specifically, the light / dark cell detection means uses the first peak value Thr_H that peaks on the high luminance side in the frequency distribution generated by the frequency distribution generation means as the first threshold, and has a lower luminance than the first peak value. The second peak value Thr_L that becomes a peak on the side is set as the second threshold, a cell having a luminance equal to or higher than the first peak value is detected as a light color determination cell, and a cell having a luminance equal to or lower than the second peak value is detected as a dark color determination cell. .

更に、制御回路40が中間輝度セル検出手段の一例に相当し、輝度検出手段によって検出された輝度が、第1閾値未満であって且つ第2閾値を超える中間輝度セルを検出するように機能する。   Further, the control circuit 40 corresponds to an example of an intermediate luminance cell detection unit, and functions to detect an intermediate luminance cell whose luminance detected by the luminance detection unit is less than the first threshold and exceeds the second threshold. .

荒い二値化によって、確定していないセルが絞りこまれたら、再度のマッピング処理を行う(S6)。例えば、ボケなどが生じている画像では、判定しようとするセルの色は、当該セルの色だけでなく周辺セルの色の影響を受けることになり、周辺セルに近づくほどその影響が大きくなる。このため、特に正確なセル中心座標の算出が必要になる。本発明では、荒い二値化やテンプレートマッチングによって色が既知であるセルの中心座標を厳密に求め、それによって他のセルの中心座標を正確に算出する。   If cells that have not been determined are narrowed down due to rough binarization, the mapping process is performed again (S6). For example, in a blurred image, the color of a cell to be determined is affected not only by the color of the cell but also by the color of the peripheral cell, and the influence increases as the distance to the peripheral cell is approached. For this reason, it is necessary to calculate the cell center coordinates particularly accurately. In the present invention, the center coordinates of a cell whose color is known are strictly determined by rough binarization or template matching, thereby accurately calculating the center coordinates of other cells.

荒い二値化によって得られた図7(A)のようなコードのうち、網掛けのセルはテンプレートマッチングによる二値化が必要なセル(明暗が判別されていないセル)である。S6の処理では、この網掛けのセルの中心座標を補正するため、周辺の既知のセルの座標を厳密に求める。例えば、図7(B)のように、コードの内部にR1、R2、R3の3つの小領域を設け、各々の小領域の4角の座標を厳密に求める。各々の小領域の4角は、周囲のパターンと自身の色が分かっているセルになっている(なお、コード外の領域は、例えば明色として判定しておけばよい)。即ち、パターンが分かっているが、厳密な座標がわかっていない状態になっているといえる。従って、S6では、このようなセルを基準セルとして当該基準セルの座標を厳密に求めるため、テンプレートマッチングを行う。なお、このような領域の特定は、図7(B)のようにコード内の一部領域に対して行ってもよく、全領域に対して複数の領域を特定するようにしてもよい。   Among the codes as shown in FIG. 7A obtained by rough binarization, the shaded cells are cells that need to be binarized by template matching (cells whose brightness is not discriminated). In the process of S6, in order to correct the center coordinates of the shaded cells, the coordinates of known peripheral cells are strictly determined. For example, as shown in FIG. 7B, three small areas R1, R2, and R3 are provided inside the code, and the four corner coordinates of each small area are determined strictly. The four corners of each small area are cells in which the surrounding pattern and its own color are known (the area outside the code may be determined as a light color, for example). That is, it can be said that the pattern is known but the exact coordinates are not known. Accordingly, in S6, template matching is performed in order to accurately obtain the coordinates of the reference cell using such a cell as a reference cell. Such an area may be specified for a partial area in the code as shown in FIG. 7B, or a plurality of areas may be specified for all areas.

図8(A)(B)はセルの中心座標を求めるためのテンプレートマッチングを説明する図である。図8(A)は、領域R1の角部に関するものであり、このR1の角部のセルにおいて右図のバツ印のようにS2で得られている中心座標から上下左右斜めに少しずつずらし、その周囲のセルについても、角部のセルでのずらし方向及びずらし度合いと同方向及び同程度にS2で得られている中心座標からずらし、各ずらし方向のときの輝度リスト(角部及びその周囲のセルの輝度リスト)を求める。そして、それら各輝度リストについてテンプレートマッチングを行い、評価値を算出する。具体的には、S4で選択されたテンプレート群において、着目しているパターン(図8(A)右図のようなセルパターンに対応するセルパターン)の輝度値リスト参照し、この輝度値リストと、上述の各輝度リスト(各ずらし方向のときの角部セル及び周囲セルの輝度)との差分の総和(評価値)を求める。座標にずれが少ない場合は評価値が極小になると考えられ、座標にずれがある場合は評価値は増加すると考えられる。図8(A)の場合、サンプリングした9つの輝度リストのうち、評価値が極小になった輝度リストに対応する各位置(当該輝度リストの各輝度を取得したときの角部及び周囲セルでの各位置)を角部セル及び周囲セルの各中心座標とする。なお、図8の例では各セルでのサンプリングを9点としたが、サンプリングする点の間隔、数は、要求される計算時間と座標精度によって任意の値を取ることができる。   FIGS. 8A and 8B are diagrams for explaining template matching for obtaining the center coordinates of a cell. FIG. 8A relates to a corner portion of the region R1, and in the cell at the corner portion of R1, it is slightly shifted up, down, left, and right from the center coordinates obtained in S2 as indicated by a cross in the right figure. The surrounding cells are also shifted from the center coordinates obtained in S2 in the same direction and at the same degree as the shifting direction and the shifting degree in the corner cells, and the brightness list for each shifting direction (the corner and its surroundings). (Brightness list of the cell). Then, template matching is performed for each of the luminance lists, and an evaluation value is calculated. Specifically, in the template group selected in S4, the luminance value list of the pattern of interest (cell pattern corresponding to the cell pattern as shown in the right figure of FIG. 8A) is referred to, and this luminance value list and Then, the sum (evaluation value) of the difference from each of the above luminance lists (the luminance of the corner cell and the surrounding cells in each shifting direction) is obtained. The evaluation value is considered to be minimal when there is little deviation in coordinates, and the evaluation value is considered to increase when there is deviation in coordinates. In the case of FIG. 8A, among the nine luminance lists sampled, each position corresponding to the luminance list whose evaluation value is minimized (in the corner and surrounding cells when each luminance of the luminance list is acquired). Let each position) be the center coordinates of the corner cell and surrounding cells. In the example of FIG. 8, the sampling in each cell is 9 points, but the interval and number of sampling points can take any value depending on the required calculation time and coordinate accuracy.

以上の処理により、色と周囲のパターンが既知であるセルの中心座標を求めることができるので、これを繰り返すことで、R1、R2、R3のそれぞれの小領域の角のセルの中心座標を求め直すことができる。それぞれの小領域は、角のセルの中心座標を元に等分割や射影変換などを行なって新たに各セルの中心座標を求め直すことで、セル中心座標の高精度化を実現することができる。なお、このような中心座標の求め直しは、一部のセルに対してのみ行っても良く、全セルに対して行うようにしてもよい。   With the above processing, the center coordinates of the cell whose color and surrounding pattern are known can be obtained. By repeating this, the center coordinates of the corner cell of each of the small regions R1, R2, and R3 are obtained. You can fix it. For each small area, high accuracy of the cell center coordinates can be realized by newly re-determining the center coordinates of each cell by performing equal division or projective transformation based on the center coordinates of the corner cells. . It should be noted that such recalculation of the center coordinates may be performed only for some cells or all cells.

本実施形態では、制御回路40がセル位置検出手段の一例に相当し、画像記憶手段に記憶される情報コードの画像から、各セルの所定の代表位置(具体的には、S2で検出される中心位置及びS6で検出される補正位置)を検出するように機能する。   In the present embodiment, the control circuit 40 corresponds to an example of a cell position detection unit, and a predetermined representative position (specifically, detected in S2) of each cell from the information code image stored in the image storage unit. It functions to detect the center position and the correction position detected in S6.

また、制御回路40は、少なくともセル位置検出手段によって検出された各セル位置での輝度、具体的には、各セルの代表位置での輝度(即ち、S2で検出された代表位置、及びS6で補正された代表位置の輝度)を検出するように機能する。   Further, the control circuit 40 at least detects the luminance at each cell position detected by the cell position detecting means, specifically, the luminance at the representative position of each cell (that is, the representative position detected at S2 and S6). It functions to detect the brightness of the corrected representative position.

また、S6の処理を行い得る制御回路40が領域分割手段の一例に相当し、撮像手段によって撮像された情報コードの画像を複数の画像領域に分割するように機能する。   Further, the control circuit 40 capable of performing the process of S6 corresponds to an example of an area dividing unit, and functions to divide an information code image captured by the imaging unit into a plurality of image areas.

更にS6の処理を行い得る制御回路40が基準セル検出手段の一例に相当し、明暗セル検出手段によって検出された明色判定セル及び暗色判定セルの中から、周囲に隣接するセルが中間輝度セルとなっていないセルを基準セルとして検出するように機能し、具体的には、領域分割手段によって分割された画像領域毎に基準セルを検出するように機能する。   Further, the control circuit 40 capable of performing the process of S6 corresponds to an example of the reference cell detection means, and among the light color determination cells and dark color determination cells detected by the light / dark cell detection means, neighboring cells are intermediate luminance cells. It functions to detect a cell that is not a reference cell, and specifically functions to detect a reference cell for each image region divided by the region dividing means.

更に、S6の処理を実行し得る制御回路40は、ずらし状態検出手段の一例に相当し、セル位置検出手段によって検出された基準セル及び当該基準セルに隣接するセルの各代表位置からそれぞれ一定度合いで位置をずらすと共にずらした各変更位置で輝度状態を検出する処理を、各代表位置を基準として複数方向にずらして行うように機能する。   Further, the control circuit 40 capable of executing the process of S6 corresponds to an example of a shift state detecting unit, and is a certain degree from each representative position of the reference cell detected by the cell position detecting unit and the cell adjacent to the reference cell. The function of shifting the position and detecting the luminance state at each shifted change position is performed so as to be shifted in a plurality of directions with each representative position as a reference.

また、メモリ35は、補正用テンプレート記憶手段の一例に相当し、所定サイズで構成可能な明暗セルパターンを複数種類定めると共に各明暗セルパターンでの輝度値の配列をテンプレート化した複数のテンプレートを記憶する。   The memory 35 corresponds to an example of a correction template storage unit, and defines a plurality of types of bright and dark cell patterns that can be configured in a predetermined size, and stores a plurality of templates that are templates of luminance value arrays in the respective light and dark cell patterns. To do.

また、S6の処理を実行し得る制御回路40は、テンプレート選択手段の一例に相当し、補正用テンプレート記憶手段に記憶される複数のテンプレートの中から、基準セル検出手段によって検出された基準セルと当該基準セルの周囲に隣接するセルのセル配列に対応するテンプレートを選択するように機能する。
更に、制御回路40は、補正値検出手段の一例に相当し、ずらし状態検出手段により各代表位置から複数方向にずらして得られる各輝度状態と、テンプレート選択手段で選択されたテンプレートとの適合性を判断し、最も適合性の高い輝度状態のときの各代表位置からのずらし度合を補正値として検出するように機能しており、具体的には、領域分割手段によって分割された画像領域毎に補正値を求めている。
また、制御回路40は、補正手段の一例に相当し、補正値検出手段によって検出された補正値に基づいて、基準セル以外の各セルの位置を各代表位置から補正するように機能し、具体的には、補正値検出手段によって画像領域毎に求められた各補正値を各画像領域にそれぞれ反映するように、画像領域毎に各セルの位置を各代表位置から補正する処理を行っている。
The control circuit 40 capable of executing the process of S6 corresponds to an example of a template selection unit, and the reference cell detected by the reference cell detection unit from the plurality of templates stored in the correction template storage unit. It functions to select a template corresponding to the cell array of cells adjacent to the periphery of the reference cell.
Furthermore, the control circuit 40 corresponds to an example of a correction value detection unit, and the compatibility between each luminance state obtained by shifting in a plurality of directions from each representative position by the shift state detection unit and the template selected by the template selection unit. And the function of detecting the degree of shift from each representative position in the most suitable luminance state as a correction value, specifically, for each image region divided by the region dividing means The correction value is obtained.
The control circuit 40 corresponds to an example of a correction unit, and functions to correct the position of each cell other than the reference cell from each representative position based on the correction value detected by the correction value detection unit. Specifically, a process of correcting the position of each cell from each representative position for each image area is performed so that each correction value obtained for each image area by the correction value detection unit is reflected in each image area. .

S6の処理の後には、S4で選択されているテンプレート群とのテンプレートマッチングにより、未定セル(中間輝度セル)の明暗の判定を行う。テンプレートとのマッチングは、一般的な手法を用いることができる。例えば、コサイン類似度や、二乗誤差などを評価値に用いることになる。テンプレートの窓やサンプル点の数は、要求される精度や処理時間によって任意の値を取ることができる。   After the process of S6, the brightness of the undetermined cell (intermediate luminance cell) is determined by template matching with the template group selected in S4. A general method can be used for matching with the template. For example, cosine similarity or square error is used as the evaluation value. The number of template windows and the number of sample points can take any value depending on the required accuracy and processing time.

テンプレートマッチングの具体例としては、例えば図9〜図11のようにすればよい。図9(A)では、3行3列のセルパターンにおいて、網掛けのセルが未定(S5で明暗が判定されていない中間輝度セル)となっており、具体的な輝度値(各セルの代表位置(S6で再マッピングされた代表位置)での測定輝度値)は、図9(B)のようになっている。この場合、想定されるセルパターンは、図10(A)〜図10(D)の4種類であり、S4で選択されているテンプレート群でのこれらパターンの輝度値リストは、図11(A)〜(D)となっているとする。この場合、図9(B)の測定輝度値と、図11(A)〜(D)の各輝度値リストとの差分の総和を求め、その総和が最も小さいパターンを選択する。なお、この場合、図11(B)のリストとの差分の総和が最も小さいため、図10(B)のパターンが選択されることになり、未定の中心位置は明色、その下の位置は暗色と判別されることになる。   Specific examples of template matching may be as shown in FIGS. In FIG. 9A, in the cell pattern of 3 rows and 3 columns, the shaded cells are undetermined (intermediate luminance cells whose brightness is not determined in S5), and specific luminance values (representative of each cell). FIG. 9B shows the position (measured luminance value at the representative position remapped in S6). In this case, there are four types of cell patterns assumed in FIGS. 10A to 10D, and the luminance value list of these patterns in the template group selected in S4 is shown in FIG. Suppose that it is (D). In this case, the sum of the differences between the measured brightness values in FIG. 9B and the brightness value lists in FIGS. 11A to 11D is obtained, and the pattern having the smallest sum is selected. In this case, since the sum of the differences from the list of FIG. 11B is the smallest, the pattern of FIG. 10B is selected, the undetermined center position is light color, and the position below it is It is determined that the color is dark.

このようにして例えば左上の3行3列の部分から右下の3行3列の部分まで同様にパターンマッチングを行うことで、未定の各セルの明暗を判別することができ、例えば図12のような結果を得ることができる。   In this way, for example, by performing pattern matching in the same manner from the upper left 3 × 3 portion to the lower right 3 × 3 portion, it is possible to determine the light and darkness of each undetermined cell. Such a result can be obtained.

本実施形態では、S4の処理を行い得る制御回路40が選択手段の一例に相当し、度数分布生成手段によって生成された度数分布の種類を、当該度数分布の内容に基づいて予め定められた複数種類の中から選択する。   In the present embodiment, the control circuit 40 that can perform the process of S4 corresponds to an example of a selection unit, and a plurality of types of frequency distributions generated by the frequency distribution generation unit are determined in advance based on the contents of the frequency distribution. Select from the types.

また、S7の処理を行い得る制御回路40が明暗判定手段の一例に相当し、中間輝度セル検出手段によって検出された中間輝度セルが明色セル又は暗色セルのいずれに属するかを、当該中間輝度セルに隣接する複数の隣接セルの明暗パターンに基づいて決定する。より具体的には、選択手段によって選択された度数分布の種類に基づいて判定用テンプレート記憶手段に記憶されるいずれかのテンプレート群を選択し、中間輝度セルに隣接する複数の隣接セルの明暗パターンとその選択された当該テンプレート群に含まれるテンプレートとのパターンマッチングにより、当該テンプレート群を構成する複数の明色テンプレート及び複数の暗色テンプレートの中から適合するテンプレートを検出し、その検出結果に基づいて中間輝度セルが明色セル又は暗色セルのいずれに属するかを決定する。   Further, the control circuit 40 capable of performing the process of S7 corresponds to an example of light / dark determination means, and whether the intermediate brightness cell detected by the intermediate brightness cell detection means belongs to the bright brightness cell or the dark color cell. It determines based on the light-dark pattern of several adjacent cells adjacent to a cell. More specifically, one of the template groups stored in the determination template storage unit is selected based on the type of frequency distribution selected by the selection unit, and the light-dark pattern of a plurality of adjacent cells adjacent to the intermediate luminance cell A matching template is detected from among a plurality of light color templates and a plurality of dark color templates constituting the template group by pattern matching between the template and the template included in the selected template group, and based on the detection result It is determined whether the intermediate luminance cell belongs to a light cell or a dark cell.

そして、S7で最終的に確定した各セルの明暗パターンに基づいて公知の方法でデコードを行う(S8)。なお、制御回路40デコード手段の一例に相当し、明暗セル検出手段による明色判定セル及び暗色判定セルの検出結果、及び明暗判定手段による中間輝度セルの明暗判定結果に基づいてデコードを行うように機能する。   Then, decoding is performed by a known method based on the light / dark pattern of each cell finally determined in S7 (S8). The control circuit 40 corresponds to an example of a decoding unit, and decoding is performed based on the detection result of the light color determination cell and the dark color determination cell by the light / dark cell detection unit and the light / dark determination result of the intermediate luminance cell by the light / dark determination unit. Function.

(第1実施形態の主な効果)
本実施形態では、第1閾値及び第2閾値に基づいてある程度のセルを明色セル又は暗色セルと確定させてから、確定できない残余のセル(中間輝度セル)の明暗を判定しているため、明暗判定に時間がかかる処理(明暗判定手段による中間輝度セルの明暗判定処理)を極力少なくすることができ、処理時間の短縮化を図ることができる。更に、残余のセル(中間輝度セル)に隣接する隣接セルの明暗をより明らかにしてから、これら隣接セルの明暗パターンに基づいて中間輝度セルの明暗を判定することができるため、ボケが存在したりコントラストが低い場合などにおいても、より正確に二値化することができる。
(Main effects of the first embodiment)
In this embodiment, since a certain amount of cells are determined as light cells or dark cells based on the first threshold value and the second threshold value, the brightness of the remaining cells (intermediate luminance cells) that cannot be determined is determined. Processing that takes time for light / dark determination (light / dark determination processing of the intermediate luminance cell by the light / dark determination means) can be reduced as much as possible, and the processing time can be shortened. Furthermore, since the brightness of the adjacent cells adjacent to the remaining cells (intermediate brightness cells) can be clarified and then the brightness of the intermediate brightness cells can be determined based on the brightness / darkness pattern of these adjacent cells. Even when the contrast is low, binarization can be performed more accurately.

また、輝度検出手段によって検出された各セル位置の輝度を輝度レベル毎に分類すると共に輝度レベル毎の頻度を特定し得る度数分布を生成する度数分布生成手段を備え、明暗セル検出手段は、度数分布生成手段によって生成された度数分布において、高輝度側でピークとなる第1ピーク値を第1閾値とし、第1ピーク値よりも低輝度側でピークとなる第2ピーク値を第2閾値とし、第1ピーク値以上の輝度のセルを明色判定セルとして検出し、第2ピーク値以下の輝度のセルを暗色判定セルとして検出する。
度数分布(ヒストグラム)の両端(即ち、第1ピーク値及び第2ピーク値の外側領域の輝度)は、セルの色を反映している可能性が高く、上記構成のようにすれば、ある程度のセルを正確に明暗判定して確定し、絞り込むことができる。
In addition, the brightness detection unit includes a frequency distribution generation unit that classifies the luminance of each cell position detected by the luminance detection unit for each luminance level and generates a frequency distribution that can specify the frequency for each luminance level. In the frequency distribution generated by the distribution generation means, the first peak value that peaks on the high luminance side is the first threshold value, and the second peak value that peaks on the lower luminance side than the first peak value is the second threshold value. A cell having a luminance equal to or higher than the first peak value is detected as a light color determination cell, and a cell having a luminance equal to or lower than the second peak value is detected as a dark color determination cell.
It is highly possible that both ends of the frequency distribution (histogram) (that is, the luminance of the area outside the first peak value and the second peak value) reflect the color of the cell. It is possible to narrow down the cell by accurately determining the brightness and to narrow down the cell.

また、明色セルと判定するための複数の明色テンプレートと、暗色セルと判定するための複数の暗色テンプレートとを記憶した判定用テンプレート記憶手段を備え、明暗判定手段は、中間輝度セルに隣接する複数の隣接セルの明暗パターンと判定用テンプレート記憶手段に記憶されるテンプレートとのパターンマッチングにより、複数の明色テンプレート及び複数の暗色テンプレートの中から適合するテンプレートを検出し、その検出結果に基づいて中間輝度セルが明色セル又は暗色セルのいずれに属するかを決定する。
この構成によれば、明暗が判定し難い中間輝度セルが存在しても、同様の環境のテンプレートに基づいてより精度高く明暗判定することができる。
Also, a determination template storage unit that stores a plurality of light color templates for determining a light cell and a plurality of dark color templates for determining a dark cell is provided, and the light / dark determination unit is adjacent to the intermediate luminance cell. A matching template is detected from a plurality of light color templates and a plurality of dark color templates by pattern matching between the light and dark patterns of a plurality of adjacent cells and a template stored in the determination template storage means, and based on the detection result Thus, it is determined whether the intermediate luminance cell belongs to a light cell or a dark cell.
According to this configuration, even if there is an intermediate luminance cell for which it is difficult to determine the brightness, it is possible to determine the brightness with higher accuracy based on the template in the same environment.

また、度数分布生成手段によって生成された度数分布の種類を、当該度数分布の内容に基づいて予め定められた複数種類の中から選択する選択手段と、明色セルと判定するための複数の明色テンプレートと暗色セルと判定するための複数の暗色テンプレートとを含んだテンプレート群を、複数種類の各々に対応付けて記憶する判定用テンプレート記憶手段と、を備え、明暗判定手段は、選択手段によって選択された度数分布の種類に基づいて判定用テンプレート記憶手段に記憶されるいずれかのテンプレート群を選択し、中間輝度セルに隣接する複数の隣接セルの明暗パターンとその選択された当該テンプレート群に含まれるテンプレートとのパターンマッチングにより、当該テンプレート群を構成する複数の明色テンプレート及び複数の暗色テンプレートの中から適合するテンプレートを検出し、その検出結果に基づいて中間輝度セルが明色セル又は暗色セルのいずれに属するかを決定する。
このように度数分布(ヒストグラム)の種類毎にテンプレート群を用意しておき、実際に得られた度数分布に対応するテンプレート群を選択するようにすれば、実際の撮像環境により合致したテンプレートに基づいてより正確に明暗判定することができる。
The frequency distribution generated by the frequency distribution generation means is selected from a plurality of types determined in advance based on the content of the frequency distribution, and a plurality of bright colors for determining a light cell. A template storage unit for determination that stores a template group including a plurality of dark color templates for determining a color template and a dark color cell in association with each of a plurality of types, and the light / dark determination unit includes: Based on the selected frequency distribution type, one of the template groups stored in the determination template storage means is selected, and the light and dark patterns of a plurality of adjacent cells adjacent to the intermediate luminance cell and the selected template group are selected. A plurality of bright templates and a plurality of dark templates constituting the template group are obtained by pattern matching with the included templates. Detecting a matching template from the template, the intermediate brightness cell to determine whether belongs to the bright cells or dark cells on the basis of the detection result.
As described above, if a template group is prepared for each type of frequency distribution (histogram) and a template group corresponding to the actually obtained frequency distribution is selected, a template that matches the actual imaging environment is selected. Therefore, it is possible to determine the lightness and darkness more accurately.

また、セル位置検出手段が、画像記憶手段に記憶される情報コードの画像から、各セルの所定の代表位置を検出し、輝度検出手段が、セル位置検出手段によって検出された各セルの代表位置での輝度を検出し、更に、明暗セル検出手段によって検出された明色判定セル及び暗色判定セルの中から、周囲に隣接するセルが中間輝度セルとなっていないセルを基準セルとして検出する基準セル検出手段と、所定サイズで構成可能な明暗セルパターンを複数種類定めると共に各明暗セルパターンでの輝度値の配列をテンプレート化した複数のテンプレートを記憶した補正用テンプレート記憶手段と、補正用テンプレート記憶手段に記憶される複数のテンプレートの中から、基準セル検出手段によって検出された基準セルと当該基準セルの周囲に隣接するセルのセル配列に対応するテンプレートを選択するテンプレート選択手段と、セル位置検出手段によって検出された基準セル及び当該基準セルに隣接するセルの各代表位置からそれぞれ一定度合いで位置をずらすと共にずらした各変更位置で輝度状態を検出する処理を、各代表位置を基準として複数方向にずらして行うずらし状態検出手段と、ずらし状態検出手段により各代表位置から複数方向にずらして得られる各輝度状態と、テンプレート選択手段で選択されたテンプレートとの適合性を判断し、最も適合性の高い輝度状態のときの各代表位置からのずらし度合を補正値として検出する補正値検出手段と、補正値検出手段によって検出された補正値に基づいて、基準セル以外の各セルの位置を各代表位置から補正する補正手段と、を備えたことを特徴とする。
このようにすることで、基準セル及び周囲の明暗パターン及び当該明暗パターンに対応するテンプレートから基準セルの厳密な座標(テンプレートとの適合性が高い場合の座標)を選ぶことができ、各セル座標の高精度化を測ることができる。
The cell position detecting means detects a predetermined representative position of each cell from the information code image stored in the image storage means, and the luminance detecting means detects the representative position of each cell detected by the cell position detecting means. In addition, a reference for detecting, as a reference cell, a cell in which a neighboring cell is not an intermediate luminance cell from among the light color determination cell and the dark color determination cell detected by the light / dark cell detection means. A cell detection unit; a correction template storage unit that stores a plurality of templates in which a plurality of types of light and dark cell patterns that can be configured in a predetermined size are defined, and a luminance value array in each light and dark cell pattern is templated; and a correction template storage The reference cell detected by the reference cell detection means from among a plurality of templates stored in the means and adjacent to the reference cell The template selection means for selecting a template corresponding to the cell arrangement of the cell to be detected, and the reference cell detected by the cell position detection means and the representative positions of the cells adjacent to the reference cell are shifted and shifted by a certain degree. A process for detecting the brightness state at each changed position is performed by shifting the process in a plurality of directions with respect to each representative position, and each brightness state obtained by shifting the process from the representative position in a plurality of directions by the shift state detection unit. A correction value detecting means for determining suitability with the template selected by the template selecting means and detecting a shift degree from each representative position in the luminance state with the highest suitability as a correction value; and a correction value detecting means Correction means for correcting the position of each cell other than the reference cell from each representative position based on the correction value detected by And said that there were pictures.
In this way, the exact coordinates of the reference cell (coordinates when the compatibility with the template is high) can be selected from the reference cell and the surrounding light and dark pattern and the template corresponding to the light and dark pattern. High accuracy can be measured.

また、撮像手段によって撮像された情報コードの画像を複数の画像領域に分割する領域分割手段を備え、基準セル検出手段は、領域分割手段によって分割された画像領域毎に基準セルを検出し、補正値検出手段は、領域分割手段によって分割された画像領域毎に補正値を求め、補正手段は、補正値検出手段によって画像領域毎に求められた各補正値を各画像領域にそれぞれ反映するように、画像領域毎に各セルの位置を各代表位置から補正する処理を行うことを特徴とする。
この構成によれば、より高精度の補正が可能となる。特に、コード画像が歪んだり変形しやすい環境下で有利となる。
Further, the image processing apparatus includes an area dividing unit that divides the information code image captured by the imaging unit into a plurality of image areas, and the reference cell detection unit detects and corrects the reference cell for each image area divided by the area dividing unit. The value detecting means obtains a correction value for each image area divided by the area dividing means, and the correcting means reflects each correction value obtained for each image area by the correction value detecting means to each image area. In addition, a process of correcting the position of each cell from each representative position for each image region is performed.
According to this configuration, correction with higher accuracy is possible. This is particularly advantageous in an environment where the code image is easily distorted or deformed.

[他の実施形態]
本発明は上記記述及び図面によって説明した実施形態に限定されるものではなく、例えば次のような実施形態も本発明の技術的範囲に含まれる。
[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.

また、テンプレートマッチングを行うサンプリング間隔以上の精度で中心座標を求めたい場合には、各々の点の評価値を補間することによって行う。図13は、説明を簡易にするために、1次元にした場合の評価値の補間の考え方の一例である。これは、0.5画素間隔でテンプレートマッチングを行い、評価値を算出した上で、評価値が極小になる点をまず求め、次に評価値が極小になる点から左側の点と、評価値が極小になる点から右側の点について近似直線を求め、その交点を真の中心座標とみなす補間方法である。図13の例では、-0.3付近が交点となるので、左に0.3画素ほどずらした点を中心座標とすればよい。   Further, when it is desired to obtain the center coordinates with an accuracy equal to or higher than the sampling interval for performing template matching, it is performed by interpolating the evaluation value of each point. FIG. 13 is an example of the idea of interpolation of evaluation values in the case of one dimension for the sake of simplicity. This is because template matching is performed at intervals of 0.5 pixels and an evaluation value is calculated. Then, a point where the evaluation value is minimized is first obtained, and then a point on the left side from the point where the evaluation value is minimized and the evaluation value This is an interpolation method in which an approximate straight line is obtained for a point on the right side from a point where is minimal, and the intersection is regarded as a true center coordinate. In the example of FIG. 13, since the vicinity of −0.3 is an intersection, a point shifted to the left by about 0.3 pixels may be set as the center coordinate.

上記実施形態では、代表位置(例えば各セルの中心位置)から補正した位置を各セル位置としたが、S2で取得した各セルの中心位置を補正せずにそのまま代表位置としてもよい。つまり、S6の処理を省略し、S2でのマッピング結果に基づいてS7の処理を行うようにしてもよい。   In the above embodiment, the position corrected from the representative position (for example, the center position of each cell) is set as each cell position. However, the center position of each cell acquired in S2 may be used as it is without being corrected. That is, the process of S6 may be omitted and the process of S7 may be performed based on the mapping result in S2.

1…情報コード読取装置
23…撮像手段
35…メモリ(画像記憶手段、判定用テンプレート記憶手段、補正用テンプレート記憶手段)
40…制御回路(セル位置検出手段、輝度検出手段、明暗セル検出手段、中間輝度セル検出手段、明暗判定手段、度数分布生成手段、選択手段、基準セル検出手段、テンプレート選択手段、ずらし状態検出手段、補正値検出手段、補正手段、領域分割手段)
DESCRIPTION OF SYMBOLS 1 ... Information code reader 23 ... Imaging means 35 ... Memory (Image storage means, determination template storage means, correction template storage means)
40... Control circuit (cell position detection means, luminance detection means, light / dark cell detection means, intermediate luminance cell detection means, light / darkness determination means, frequency distribution generation means, selection means, reference cell detection means, template selection means, shift state detection means Correction value detection means, correction means, area dividing means)

Claims (3)

明色セルと暗色セルとを含んだ情報コードを撮像する撮像手段と、
前記撮像手段によって撮像された前記情報コードの画像を記憶する画像記憶手段と、
前記画像記憶手段に記憶される前記情報コードの画像から、各セルの位置を検出するセル位置検出手段と、
前記セル位置検出手段によって検出された各セル位置での輝度を検出可能な輝度検出手段と、
前記輝度検出手段によって検出された輝度が、第1閾値以上となる明色判定セルを検出すると共に、前記第1閾値よりも低い第2閾値以下となる暗色判定セルを検出する明暗セル検出手段と、
前記輝度検出手段によって検出された輝度が、前記第1閾値未満であって且つ前記第2閾値を超える中間輝度セルを検出する中間輝度セル検出手段と、
前記中間輝度セル検出手段によって検出された前記中間輝度セルが前記明色セル又は前記暗色セルのいずれに属するかを、当該中間輝度セルに隣接する複数の隣接セルの明暗パターンに基づいて決定する明暗判定手段と、
前記輝度検出手段によって検出された各セル位置の輝度を輝度レベル毎に分類すると共に輝度レベル毎の頻度を特定し得る度数分布を生成する度数分布生成手段と、を備え、
前記明暗セル検出手段は、前記度数分布生成手段によって生成された前記度数分布において、高輝度側でピークとなる第1ピーク値を前記第1閾値とし、前記第1ピーク値よりも低輝度側でピークとなる第2ピーク値を前記第2閾値とし、前記第1ピーク値以上の輝度のセルを前記明色判定セルとして検出し、前記第2ピーク値以下の輝度のセルを前記暗色判定セルとして検出し、
前記度数分布生成手段によって生成された前記度数分布の種類を、当該度数分布の内容に基づいて予め定められた複数種類の中から選択する選択手段と、
前記明色セルと判定するための複数の明色テンプレートと前記暗色セルと判定するための複数の暗色テンプレートとを含んだテンプレート群を、前記複数種類の各々に対応付けて記憶する判定用テンプレート記憶手段と、
を備え、
前記明暗判定手段は、前記選択手段によって選択された前記度数分布の種類に基づいて前記判定用テンプレート記憶手段に記憶されるいずれかの前記テンプレート群を選択し、前記中間輝度セルに隣接する複数の隣接セルの明暗パターンとその選択された当該テンプレート群に含まれるテンプレートとのパターンマッチングにより、当該テンプレート群を構成する前記複数の明色テンプレート及び前記複数の暗色テンプレートの中から適合するテンプレートを検出し、その検出結果に基づいて前記中間輝度セルが前記明色セル又は前記暗色セルのいずれに属するかを決定することを特徴とする情報コード読取装置。
An imaging means for imaging an information code including a light cell and a dark cell;
Image storage means for storing an image of the information code imaged by the imaging means;
Cell position detection means for detecting the position of each cell from the image of the information code stored in the image storage means;
Luminance detecting means capable of detecting the luminance at each cell position detected by the cell position detecting means;
Brightness / darkness cell detection means for detecting a lightness determination cell whose brightness detected by the brightness detection means is equal to or higher than a first threshold, and for detecting a darkness determination cell where the brightness is lower than a second threshold lower than the first threshold; ,
Intermediate luminance cell detecting means for detecting intermediate luminance cells whose luminance detected by the luminance detecting means is less than the first threshold and exceeds the second threshold;
Brightness / darkness that determines whether the intermediate luminance cell detected by the intermediate luminance cell detection means belongs to the light cell or the dark cell based on the light / dark pattern of a plurality of adjacent cells adjacent to the intermediate luminance cell. A determination means;
A frequency distribution generating unit that classifies the luminance of each cell position detected by the luminance detecting unit for each luminance level and generates a frequency distribution that can specify the frequency for each luminance level; and
In the frequency distribution generated by the frequency distribution generation unit, the light / dark cell detection unit sets the first peak value that peaks on the high luminance side as the first threshold value, and on the lower luminance side than the first peak value. A second peak value that is a peak is set as the second threshold value, a cell having a luminance equal to or higher than the first peak value is detected as the light color determination cell, and a cell having a luminance equal to or lower than the second peak value is set as the dark color determination cell. Detect
Selecting means for selecting the type of the frequency distribution generated by the frequency distribution generating means from a plurality of types determined in advance based on the content of the frequency distribution;
Determination template storage for storing a template group including a plurality of light color templates for determining the light cell and a plurality of dark color templates for determining the dark cell in association with each of the plurality of types. Means,
With
The brightness determination unit selects any one of the template groups stored in the determination template storage unit based on the type of the frequency distribution selected by the selection unit, and a plurality of adjacent brightness pixels A matching template is detected from among the plurality of light color templates and the plurality of dark color templates constituting the template group by pattern matching between the light and dark pattern of the adjacent cell and the template included in the selected template group. An information code reading device for determining whether the intermediate luminance cell belongs to the light cell or the dark cell based on the detection result .
前記セル位置検出手段は、前記画像記憶手段に記憶される前記情報コードの画像から、各セルの所定の代表位置を検出し、
前記輝度検出手段は、前記セル位置検出手段によって検出された各セルの前記代表位置での輝度を検出し、
更に、前記明暗セル検出手段によって検出された前記明色判定セル及び前記暗色判定セルの中から、周囲に隣接するセルが前記中間輝度セルとなっていないセルを基準セルとして検出する基準セル検出手段と、
所定サイズで構成可能な明暗セルパターンを複数種類定めると共に各明暗セルパターンでの輝度値の配列をテンプレート化した複数のテンプレートを記憶した補正用テンプレート記憶手段と、
前記補正用テンプレート記憶手段に記憶される複数のテンプレートの中から、前記基準セル検出手段によって検出された前記基準セルと当該基準セルの周囲に隣接するセルのセル配列に対応するテンプレートを選択するテンプレート選択手段と、
前記セル位置検出手段によって検出された前記基準セル及び当該基準セルに隣接するセルの各代表位置からそれぞれ一定度合いで位置をずらすと共にずらした各変更位置で輝度状態を検出する処理を、各代表位置を基準として複数方向にずらして行うずらし状態検出手段と、
前記ずらし状態検出手段により各代表位置から複数方向にずらして得られる各輝度状態と、前記テンプレート選択手段で選択されたテンプレートとの適合性を判断し、最も適合性の高い輝度状態のときの各代表位置からのずらし度合を補正値として検出する補正値検出手段と、
前記補正値検出手段によって検出された補正値に基づいて、前記基準セル以外の各セルの位置を各代表位置から補正する補正手段と、
を備えたことを特徴とする請求項1に記載の情報コード読取装置。
The cell position detection means detects a predetermined representative position of each cell from the image of the information code stored in the image storage means,
The luminance detection means detects the luminance at the representative position of each cell detected by the cell position detection means,
Further, reference cell detection means for detecting, as a reference cell, a cell in which a neighboring cell is not the intermediate luminance cell among the light color determination cell and the dark color determination cell detected by the light / dark cell detection means When,
A correction template storage means for storing a plurality of templates in which a plurality of types of light and dark cell patterns that can be configured in a predetermined size are defined and an array of luminance values in each light and dark cell pattern is templated;
A template for selecting a template corresponding to a cell arrangement of the reference cell detected by the reference cell detection means and a cell adjacent to the periphery of the reference cell from a plurality of templates stored in the correction template storage means A selection means;
The process of detecting the luminance state at each changed position shifted from the representative position of each of the reference cell detected by the cell position detecting means and the cell adjacent to the reference cell at a certain degree. Shifting state detecting means for shifting in a plurality of directions with reference to
The brightness state obtained by shifting in a plurality of directions from each representative position by the shift state detection means and the suitability between the template selected by the template selection means are determined, and each brightness state in the highest suitability brightness state is determined. Correction value detection means for detecting the degree of shift from the representative position as a correction value;
Correction means for correcting the position of each cell other than the reference cell from each representative position based on the correction value detected by the correction value detection means;
Information code reader according to claim 1, characterized in that with a.
前記撮像手段によって撮像された前記情報コードの画像を複数の画像領域に分割する領域分割手段を備え、
前記基準セル検出手段は、前記領域分割手段によって分割された前記画像領域毎に前記基準セルを検出し、
前記補正値検出手段は、前記領域分割手段によって分割された前記画像領域毎に前記補正値を求め、
前記補正手段は、前記補正値検出手段によって前記画像領域毎に求められた各補正値を各画像領域にそれぞれ反映するように、前記画像領域毎に各セルの位置を各代表位置から補正する処理を行うことを特徴とする請求項に記載の情報コード読取装置。
An area dividing means for dividing the image of the information code imaged by the imaging means into a plurality of image areas;
The reference cell detection means detects the reference cell for each of the image areas divided by the area dividing means,
The correction value detecting means obtains the correction value for each of the image areas divided by the area dividing means,
The correction means corrects the position of each cell from each representative position for each image area so that each correction value obtained for each image area by the correction value detection means is reflected in each image area. information code reader according to claim 2, wherein the performing.
JP2012077224A 2012-03-29 2012-03-29 Information code reader Active JP5807602B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012077224A JP5807602B2 (en) 2012-03-29 2012-03-29 Information code reader

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012077224A JP5807602B2 (en) 2012-03-29 2012-03-29 Information code reader

Publications (2)

Publication Number Publication Date
JP2013206347A JP2013206347A (en) 2013-10-07
JP5807602B2 true JP5807602B2 (en) 2015-11-10

Family

ID=49525317

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012077224A Active JP5807602B2 (en) 2012-03-29 2012-03-29 Information code reader

Country Status (1)

Country Link
JP (1) JP5807602B2 (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11127348A (en) * 1997-10-20 1999-05-11 Ricoh Co Ltd Image reader
JP3458737B2 (en) * 1998-11-27 2003-10-20 株式会社デンソー Reading method of two-dimensional code and recording medium
WO2004093433A1 (en) * 2003-04-15 2004-10-28 Fujitsu Limited Code recognizing method and device
US7213761B2 (en) * 2005-03-23 2007-05-08 Microscan Systems Incorporated Apparatus and process for two-stage decoding of high-density optical symbols
JP5356702B2 (en) * 2008-03-14 2013-12-04 豊 木内 Two-dimensional code restoration program and restoration server

Also Published As

Publication number Publication date
JP2013206347A (en) 2013-10-07

Similar Documents

Publication Publication Date Title
US10203402B2 (en) Method of error correction for 3D imaging device
CN109751973B (en) Three-dimensional measuring device, three-dimensional measuring method, and storage medium
US20080069398A1 (en) Code image processing method
US10109045B2 (en) Defect inspection apparatus for inspecting sheet-like inspection object, computer-implemented method for inspecting sheet-like inspection object, and defect inspection system for inspecting sheet-like inspection object
US11182918B2 (en) Distance measurement device based on phase difference
US9070033B2 (en) Stack barcode reader and stack barcode reading method
CN110035281B (en) Dead pixel detection method and device and electronic equipment
CN109191516B (en) Rotation correction method and device of structured light module and readable storage medium
US9239230B2 (en) Computing device and method for measuring widths of measured parts
JP5187383B2 (en) Two-dimensional code division display method, two-dimensional code reading method, and two-dimensional code reading apparatus
KR100741733B1 (en) Method for determining center point of lens and image pickup apparatus having function of correcting center point of lens
JP5720623B2 (en) Two-dimensional code reader
JP5807602B2 (en) Information code reader
JP5187382B2 (en) Two-dimensional code division display method, two-dimensional code reading method, and two-dimensional code reading apparatus
JP2010286995A (en) Image processing system for vehicle
JP2015201828A (en) Color correction device and color correction method
JP2021052238A (en) Deposit detection device and deposit detection method
JP6030890B2 (en) Image processing unit, image processing method, and stand type scanner
JP5381944B2 (en) Optical information reader
CN116563388B (en) Calibration data acquisition method and device, electronic equipment and storage medium
JP5282559B2 (en) Information code reader
CN112733567B (en) Method and device for identifying two-dimension code of motor vehicle and computer readable storage medium
JP2009294769A (en) Optical information reader
JP4102742B2 (en) Optical information reader and image data analysis method
WO2019116397A1 (en) System and method for enhancing the quality of a qr code image for better readability

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20140910

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20150609

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20150616

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20150722

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20150824

R150 Certificate of patent or registration of utility model

Ref document number: 5807602

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250