JP5267323B2 - Two-dimensional code reader - Google Patents

Two-dimensional code reader Download PDF

Info

Publication number
JP5267323B2
JP5267323B2 JP2009121672A JP2009121672A JP5267323B2 JP 5267323 B2 JP5267323 B2 JP 5267323B2 JP 2009121672 A JP2009121672 A JP 2009121672A JP 2009121672 A JP2009121672 A JP 2009121672A JP 5267323 B2 JP5267323 B2 JP 5267323B2
Authority
JP
Japan
Prior art keywords
color
cell
image
reference pattern
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.)
Expired - Fee Related
Application number
JP2009121672A
Other languages
Japanese (ja)
Other versions
JP2010271812A (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 JP2009121672A priority Critical patent/JP5267323B2/en
Publication of JP2010271812A publication Critical patent/JP2010271812A/en
Application granted granted Critical
Publication of JP5267323B2 publication Critical patent/JP5267323B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To properly perform the color decision of each cell with high accuracy, in a two-dimensional code configured as a color code. <P>SOLUTION: A two-dimensional code reading apparatus includes: an imaging means for imaging a two-dimensional code including a color reference pattern; and a color decision means for determining the display color of each cell image based on color information to be obtained from each cell image and color information to be obtained from the image of the color reference pattern. The two-dimensional code reading apparatus further includes a setting means for setting the "contribution degree" of each color reference pattern used for determining the display color of each cell image for each cell image. The color decision means generates cell-by-cell reference data for use in the color decision of each cell image based on the color information to be obtained from each image of the plurality of color reference patterns and the "contribution degree" to be set for each cell image, and determines the display color of each cell image based on the color information to be obtained from each cell image and the cell-by-cell reference data corresponding to each cell image. <P>COPYRIGHT: (C)2011,JPO&amp;INPIT

Description

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

従来より提供されている二次元コードは、白色セル及び黒色セルをマトリックス状に配置した構成が一般的であるが、このような二次元コードは記録する情報量を増大させにくいという事情があった。そこで、現在では、セル表示をカラー表現するカラー二次元コードが各種提案され、記録する情報の高密度化を実現している。なお、このようなカラー二次元コードに関する技術としては例えば特許文献1のようなものがある。   Conventionally provided two-dimensional codes generally have a configuration in which white cells and black cells are arranged in a matrix, but such two-dimensional codes have a situation that it is difficult to increase the amount of information to be recorded. . Therefore, various color two-dimensional codes for expressing the cell display in color have been proposed at present, and the recording information has been densified. As a technique relating to such a color two-dimensional code, for example, there is a technique as described in Patent Document 1.

特許第3923796号公報Japanese Patent No. 3923696

上記のようなカラー二次元コードでは、セルに表示される各色を正確に判定することが求められる。しかしながら、各色の読み取り結果は印刷環境や読み取り環境によってばらつきやすく、何ら措置を講じないとばらつきに起因する誤判定を招いてしまう。このような誤判定を防ぐためには、特定領域に色判定の基準となるべき色参照パターンを配置しておき、その色参照パターンの参照結果を基準として各色の判定をすることが望ましい。   In the color two-dimensional code as described above, it is required to accurately determine each color displayed in the cell. However, the reading result of each color is likely to vary depending on the printing environment and the reading environment, and if no measures are taken, an erroneous determination due to the variation is caused. In order to prevent such an erroneous determination, it is desirable to arrange a color reference pattern to be a color determination standard in a specific area and determine each color based on the reference result of the color reference pattern.

より適切な色判定をするためには、上記色参照パターンをカラー二次元コード内に複数設けることが望ましいが、各セルの色判定において色参照パターンをどのように参照すべきかが問題となる。例えば、全セルの色判定を一律の基準値(例えば全部の色参照パターンに基づいて生成された平均値等)に基づいて行うようにすると、各セルの状態や各色参照パターンの状態を考慮した適切な色判定を行いにくく、その結果、色判定の精度低下を招く虞がある。   In order to perform more appropriate color determination, it is desirable to provide a plurality of the color reference patterns in the color two-dimensional code. However, how to refer to the color reference pattern in the color determination of each cell is a problem. For example, if the color determination of all cells is performed based on a uniform standard value (for example, an average value generated based on all color reference patterns), the state of each cell and the state of each color reference pattern are taken into consideration. It is difficult to perform appropriate color determination, and as a result, the accuracy of color determination may be reduced.

本発明は、上述した課題を解決するためになされたものであり、各セルの色判定を精度高く適切に行い得る二次元コード読取装置及び二次元コード読取方法を提供することを目的とする。   The present invention has been made to solve the above-described problems, and an object of the present invention is to provide a two-dimensional code reading apparatus and a two-dimensional code reading method capable of accurately and appropriately performing color determination of each cell.

請求項1の発明は、複数のセルが矩形領域内に二次元的に配置されると共に、各々のセルの色彩又は濃度又は輝度により符号化された情報がカラー表現され、且つ前記矩形領域内に各セルに使用するセル表示色の基準となる色参照パターンが複数設けられた二次元コードを読取可能な二次元コード読取装置であって、前記二次元コードを撮像する撮像手段と、前記撮像手段によって撮像された前記二次元コードのコード画像において、各セル画像の表示色を、前記各セル画像から得られる色情報と前記色参照パターンの画像から得られる色情報とに基づいてそれぞれ判別する色判別手段と、前記各セル画像の前記表示色を判別する際の前記各色参照パターンの各々の寄与度合を、前記各セル画像毎に設定する設定手段と、を備え、前記設定手段は、前記各セル画像毎の設定において、着目する前記セル画像から複数の前記色参照パターンそれぞれまでの距離を算出し、前記各色参照パターン毎に、着目する前記セル画像からの前記距離に応じた重み付けをして前記寄与度合をそれぞれ設定する構成であり、前記色判別手段は、複数のセルの画像からなる前記色参照パターンにおいて、複数の前記色参照パターンの前記画像からそれぞれ得られる色情報と、前記各セル画像毎に設定される前記寄与度合とに基づいて、前記各セル画像の色判別に用いるセル別基準データを生成し、前記各セル画像の前記表示色を、前記各セル画像から得られる色情報と前記各セル画像に対応する前記セル別基準データとに基づいて判別することを特徴としている。
According to the first aspect of the present invention, a plurality of cells are two-dimensionally arranged in a rectangular area, information encoded by the color, density, or luminance of each cell is expressed in color, and the rectangular area is A two-dimensional code reader capable of reading a two-dimensional code provided with a plurality of color reference patterns serving as a standard of cell display colors used for each cell, the imaging means for imaging the two-dimensional code, and the imaging means In the code image of the two-dimensional code imaged by the color, the display color of each cell image is discriminated based on the color information obtained from each cell image and the color information obtained from the color reference pattern image, respectively. comprising a determination unit, the contribution degree of each of the respective color reference pattern when said determining the display color of each cell image, a setting unit operable to set for each cell image, wherein the setting hand Calculates the distance from the cell image of interest to each of the plurality of color reference patterns in the setting for each cell image, and according to the distance from the cell image of interest for each color reference pattern The color determination unit is configured to set each contribution degree by weighting, and the color determination unit includes color information obtained from the images of the plurality of color reference patterns in the color reference pattern including images of a plurality of cells, respectively. , Based on the degree of contribution set for each cell image, generates cell-specific reference data used for color determination of each cell image, and determines the display color of each cell image from each cell image. The determination is based on the obtained color information and the reference data for each cell corresponding to each cell image.

請求項2の発明は、前記設定手段が、前記各セル画像毎に、複数の前記色参照パターンの中から色判別に寄与させる基準パターンを選択する選択手段を備え、前記色判別手段が、前記各セル画像の色判別に用いる前記セル別基準データを、前記選択手段によって前記各セル画像毎に選択された前記基準パターンに基づいてそれぞれ生成することを特徴としている。 The invention of claim 2 includes a selection unit that selects a reference pattern that contributes to color discrimination from among the plurality of color reference patterns for each of the cell images, and the color discrimination unit includes: The cell-specific reference data used for color determination of each cell image is generated based on the reference pattern selected for each cell image by the selection unit.

請求項3の発明は、前記選択手段が、前記各セル画像毎に、前記各セル画像の色判別に寄与させる前記基準パターンを、複数の前記色参照パターンの中から前記各セル画像からの距離に基づいて選択することを特徴としている。 According to a third aspect of the present invention, for each of the cell images, the reference pattern that causes the selection unit to contribute to color determination of the cell image is a distance from the cell image from among the plurality of color reference patterns. It is characterized by selecting based on.

請求項4の発明は、前記選択手段が、前記色参照パターンに汚れが生じているか否かを判断する判断手段を備えており、複数の前記色参照パターンの内の前記判断手段によって汚れが生じていないと判断されたパターンを前記基準パターンとして選択することを特徴としている。 According to a fourth aspect of the present invention, the selection unit includes a determination unit that determines whether or not the color reference pattern is contaminated, and the determination unit among a plurality of the color reference patterns causes the contamination. A pattern determined not to be selected is selected as the reference pattern.

請求項5の発明は、更に、各色参照パターンのいずれかのセルの画像に汚れが生じているか否かを判断する判断手段が設けられており、前記色判別手段が、前記選択手段によって選択された前記基準パターンにおいて、いずれかのセルに汚れが生じている場合、前記基準パターンにおけるその汚損セルを除いた部分の色情報に基づいて前記セル別基準データを生成することを特徴としている。 The invention of claim 5 is further provided with a judging means for judging whether or not the image of any cell of each color reference pattern is stained, and the color judging means is selected by the selecting means. In the reference pattern, when any cell is contaminated, the reference data for each cell is generated based on the color information of the portion excluding the dirty cell in the reference pattern.

請求項6の発明は、前記汚れを判断するための固定値が予め記憶手段に記憶されており、前記判断手段が、各色参照パターンの画像から得られる色情報を前記固定値と比較することで、前記各色参照パターンに前記汚れが生じているか否かを判断することを特徴としている。 According to a sixth aspect of the present invention, a fixed value for determining the stain is stored in advance in a storage unit, and the determination unit compares color information obtained from an image of each color reference pattern with the fixed value. It is characterized in that it is determined whether or not the stain is generated in each color reference pattern.

請求項7の発明は、前記判断手段が、前記二次元コード内に存在する一部又は全部の前記色参照パターンの色情報に基づいて前記汚れを判断するための基準値を生成し、各色参照パターンの画像から得られる色情報を前記基準値と比較することで、前記各色参照パターンに前記汚れが生じているか否かを判断することを特徴としている。 According to a seventh aspect of the present invention, the determination unit generates a reference value for determining the stain based on color information of a part or all of the color reference patterns existing in the two-dimensional code, and each color reference The color information obtained from the pattern image is compared with the reference value to determine whether or not the stain is generated in each color reference pattern.

請求項の発明は、複数のセルが矩形領域内に二次元的に配置されると共に、各々のセルの色彩又は濃度又は輝度により符号化された情報がカラー表現され、且つ前記矩形領域内に各セルに使用するセル表示色の基準となる色参照パターンが複数設けられた二次元コードを読み取る読取方法であって、撮像手段によって前記二次元コードを撮像し、前記撮像手段によって撮像された前記二次元コードのコード画像を記憶手段に記憶し、前記コード画像を構成する各セル画像の表示色を判別する際の前記各色参照パターンの各々の寄与度合を、設定手段により、着目する前記セル画像から複数の前記色参照パターンそれぞれまでの距離を算出し、前記各色参照パターン毎に、着目する前記セル画像からの前記距離に応じた重み付けをして前記寄与度合をそれぞれ設定する方法で前記各セル画像毎に設定し、更に、色判別手段により、複数のセルの画像からなる前記色参照パターンにおいて、複数の前記色参照パターンの前記画像からそれぞれ得られる色情報と、前記各セル画像毎に設定される前記寄与度合とに基づいて、前記各セル画像の色判別に用いるセル別基準データを生成し、且つ前記各セル画像から得られる色情報と前記各セル画像に対応する前記セル別基準データとに基づいて前記各セル画像の前記表示色を判別することを特徴としている。 In the invention of claim 8 , a plurality of cells are two-dimensionally arranged in the rectangular area, and information encoded by the color, density, or luminance of each cell is expressed in color, and the rectangular area includes A reading method for reading a two-dimensional code provided with a plurality of color reference patterns serving as a standard of cell display colors used for each cell, wherein the two-dimensional code is picked up by an image pickup means, and the image picked up by the image pickup means storing a code image of the two-dimensional code in the storage unit, the contribution degree of each of the color reference pattern when determining the display color of each cell images forming the code image, and more setting means, focusing said cell A distance from the image to each of the plurality of color reference patterns is calculated, and each of the color reference patterns is weighted according to the distance from the cell image of interest, and the offset is calculated. Set the at how to set the degree respectively for each cell image, further, the color discrimination means, in the color reference pattern consisting of images of a plurality of cells, respectively obtained from the images of a plurality of said color reference pattern color Based on the information and the contribution degree set for each cell image, the cell-specific reference data used for color discrimination of each cell image is generated, and the color information obtained from each cell image and each The display color of each cell image is determined based on the reference data for each cell corresponding to the cell image.

請求項1の発明は、各セル画像の表示色を判別する際の各色参照パターンの各々の寄与度合を、各セル画像毎に設定しており、複数のセルの画像からなる色参照パターンにおいて、複数の色参照パターンの画像からそれぞれ得られる色情報と、各セル画像毎に設定される寄与度合とに基づいて、各セル画像の色判別に用いるセル別基準データを生成している。そして、各セル画像の表示色を、各セル画像から得られる色情報と各セル画像に対応するセル別基準データとに基づいて判別している。このようにすると、各セル画像毎に色判別に用いる基準データ(セル別基準データ)を定めることができ、各セルの色判定を精度高く適切に行いやすくなる。 In the invention of claim 1, the degree of contribution of each color reference pattern when determining the display color of each cell image is set for each cell image, and in the color reference pattern composed of images of a plurality of cells , Based on the color information respectively obtained from the images of the plurality of color reference patterns and the degree of contribution set for each cell image, reference data for each cell used for color discrimination of each cell image is generated. Then, the display color of each cell image is determined based on the color information obtained from each cell image and the reference data for each cell corresponding to each cell image. In this way, it is possible to determine reference data (reference data for each cell) used for color discrimination for each cell image, and it is easy to accurately and appropriately perform color determination for each cell.

また、各セル画像毎の設定において、セル画像から複数の色参照パターンそれぞれまでの距離を算出し、各色参照パターン毎に、セル画像からの距離に応じた重み付けをして寄与度合をそれぞれ設定している。このようにすると、各セル画像の基準データ(セル別基準データ)を設定する際に、各色参照パターンまでの距離を適切に考慮して、各色参照パターンの寄与度合を定めることができ、より近い距離の色参照パターンを重視した適切な基準設定が可能となる。 Also, in the setting for each cell image, the distance from the cell image to each of a plurality of color reference patterns is calculated, and the contribution degree is set by weighting each color reference pattern according to the distance from the cell image. ing. In this way, when setting the standard data (standard data for each cell) of each cell image, the degree of contribution of each color reference pattern can be determined by appropriately considering the distance to each color reference pattern, and closer. Appropriate standard setting that emphasizes the color reference pattern of the distance can be performed.

請求項の発明は、各セル画像毎に、複数の色参照パターンの中から色判別に寄与させる基準パターンを選択しており、その選択された基準パターンに基づいて、各セル画像の色判別に用いるセル別基準データを生成している。このようにすると、各セル画像の判別に用いるセル別基準データを、それぞれ、寄与させるべき色参照パターンによって生成することができ、寄与させるべきでない色参照パターンを排除した適切な基準設定が可能となる。 The invention according to claim 2 selects, for each cell image, a reference pattern that contributes to color determination from among a plurality of color reference patterns, and based on the selected reference pattern, determines the color of each cell image. Cell-specific reference data used in the above. In this way, the cell-specific standard data used for discrimination of each cell image can be generated based on the color reference pattern that should be contributed, and appropriate standard setting that eliminates the color reference pattern that should not be contributed is possible. Become.

請求項の発明は、各セル画像の色判別に寄与させる基準パターンを、複数の色参照パターンの中から各セル画像からの距離に基づいて選択している。このようにすると、寄与させるべきでない遠い距離にある色参照パターンを排除して、各セル画像の判別に用いる基準データ(セル別基準データ)を生成することができ、一層適切な基準設定が可能となる。 According to a third aspect of the present invention, a reference pattern that contributes to color discrimination of each cell image is selected from a plurality of color reference patterns based on the distance from each cell image. In this way, it is possible to eliminate the color reference pattern at a distant distance that should not be contributed, and to generate standard data (standard data for each cell) used for discrimination of each cell image, thereby enabling more appropriate standard setting It becomes.

請求項の発明は、複数の色参照パターンの内、汚れが生じていないと判断されたパターンを基準パターンとして選択している。このようにすると、汚れが生じている色参照パターンを除いてセル別基準データを生成することができるため、汚れの影響を排除した精度の高い色判別が可能となる。 According to the fourth aspect of the present invention, a pattern that is determined not to be contaminated among a plurality of color reference patterns is selected as a standard pattern. In this way, since the cell-basis standard data can be generated except for the color reference pattern in which the stain is generated, it is possible to perform color discrimination with high accuracy without the influence of the stain.

請求項の発明は、各色参照パターンのいずれかのセルの画像に汚れが生じているか否かを判断可能とされており、選択手段によって選択された基準パターンにおいて、いずれかのセルに汚れが生じている場合、基準パターンにおけるその汚損セルを除いた部分の色情報に基づいてセル別基準データを生成している。このようにすると、寄与させるべき基準パターンを反映させつつ汚損セルの影響を排除してセル別基準データを生成することができる。従って、各セル画像の基準設定に際し、適切な色参照パターン(基準パターン)の適切な部分のみを選択的に取り入れ、より望ましいセル別基準データを生成することができる。 According to the invention of claim 5 , it is possible to determine whether or not the image of any cell of each color reference pattern is stained. In the reference pattern selected by the selection means, any cell is stained. If it has occurred, the reference data for each cell is generated based on the color information of the portion excluding the dirty cell in the reference pattern. In this way, the reference data for each cell can be generated while reflecting the reference pattern to be contributed and eliminating the influence of the fouling cell. Therefore, when setting the standard of each cell image, it is possible to selectively incorporate only an appropriate portion of an appropriate color reference pattern (standard pattern) and generate more desirable cell-specific reference data.

請求項の発明は、汚れを判断するための固定値が予め記憶手段に記憶されており、各色参照パターンの画像から得られる色情報を固定値と比較することで、各色参照パターンに汚れが生じているか否かを判断している。このようにすると、各色参照パターンに汚れが生じているか否かを簡易な構成で適切に判断できる。 According to the sixth aspect of the present invention, a fixed value for determining contamination is stored in advance in the storage means, and each color reference pattern is stained by comparing the color information obtained from the image of each color reference pattern with the fixed value. It is judged whether it has occurred. In this way, it is possible to appropriately determine whether or not each color reference pattern is soiled with a simple configuration.

請求項の発明は、二次元コード内に存在する一部又は全部の色参照パターンの色情報に基づいて汚れを判断するための基準値を生成し、各色参照パターンの画像から得られる色情報を基準値と比較することで、各色参照パターンに汚れが生じているか否かを判断している。このようにすると、二次元コード内の色参照パターンの色情報に基づいて、各色参照パターンの汚れを相対的に判断することができ、読取環境が多様に変化しても汚れを適切に判断できる。 According to the seventh aspect of the present invention, color information obtained from the image of each color reference pattern is generated by generating a reference value for judging stains based on the color information of a part or all of the color reference patterns existing in the two-dimensional code. Is compared with the reference value to determine whether or not each color reference pattern is contaminated. In this way, it is possible to relatively determine the stain of each color reference pattern based on the color information of the color reference pattern in the two-dimensional code, and to appropriately determine the stain even if the reading environment changes in various ways. .

請求項の発明によれば、請求項1と同様の効果を奏する読取方法を実現できる。 According to the invention of claim 8 , it is possible to realize a reading method having the same effect as that of claim 1.

図1は、本発明の第1実施形態に係る二次元コード読取装置の電気的構成を概略的に例示するブロック図である。FIG. 1 is a block diagram schematically illustrating an electrical configuration of a two-dimensional code reader according to the first embodiment of the present invention. 図2は、図1の二次元コード読取装置によって読み取られる二次元コードを概略的に例示する概略図である。FIG. 2 is a schematic view schematically illustrating a two-dimensional code read by the two-dimensional code reading device of FIG. 図3は、色参照パターンの一例を概念的に示す概略図である。FIG. 3 is a schematic diagram conceptually illustrating an example of a color reference pattern. 図4は、図1の二次元コード読取装置で行われる読取処理を例示するフローチャートである。FIG. 4 is a flowchart illustrating a reading process performed by the two-dimensional code reading apparatus of FIG. 図5は、図4の読取処理におけるデコード処理を例示するフローチャートである。FIG. 5 is a flowchart illustrating a decoding process in the reading process of FIG. 図6は、図5のデコード処理で行われるセル色認識処理を例示するフローチャートである。FIG. 6 is a flowchart illustrating a cell color recognition process performed in the decoding process of FIG. 図7は、図6のセル色認識処理で行われる基準作成処理を例示するフローチャートである。FIG. 7 is a flowchart illustrating the reference creation process performed in the cell color recognition process of FIG. 図8(a)は、S21で選択されたいずれかの色参照パターンについての各色の各成分値を概念的に示す説明図であり、図8(b)は、図8(a)とは異なる色参照パターンについての各色の各成分値を概念的に示す説明図である。FIG. 8A is an explanatory diagram conceptually showing the component values of each color for any color reference pattern selected in S21, and FIG. 8B is different from FIG. 8A. It is explanatory drawing which shows each component value of each color about a color reference pattern notionally. 図9は、各色の各成分についての基準範囲が固定値(固定範囲)として定められる例を概念的に説明する説明図である。FIG. 9 is an explanatory diagram conceptually illustrating an example in which the reference range for each component of each color is defined as a fixed value (fixed range). 図10(a)は、二次元コード内の複数の色参照パターンに基づいて、各色の各成分についての平均値をそれぞれ算出した例を示す説明図であり、図10(b)は、図10(a)の各平均値に基づいて各色の各成分についての基準範囲を設定した例を示す説明図である。FIG. 10A is an explanatory diagram showing an example in which an average value for each component of each color is calculated based on a plurality of color reference patterns in the two-dimensional code, and FIG. It is explanatory drawing which shows the example which set the reference range about each component of each color based on each average value of (a). 図11は、着目セル(色認識を行おうとするセル)に近い複数の色参照パターンを選択した例を示す説明図である。FIG. 11 is an explanatory diagram illustrating an example in which a plurality of color reference patterns close to a target cell (a cell in which color recognition is to be performed) are selected. 図12(a)は、色参照パターンの別例1を示す説明図であり、図12(b)は、色参照パターンの別例2を示す説明図である。FIG. 12A is an explanatory diagram illustrating another example 1 of the color reference pattern, and FIG. 12B is an explanatory diagram illustrating another example 2 of the color reference pattern. 図13は、3つの色参照パターンが選択され、これら3つの色参照パターンに基づいてセル別基準データを生成する例を説明する説明図である。FIG. 13 is an explanatory diagram for explaining an example in which three color reference patterns are selected and cell-specific reference data is generated based on these three color reference patterns.

[第1実施形態]
以下、本発明を具現化した第1実施形態について、図面を参照して説明する。
(全体構成)
まず、第1実施形態に係る二次元コード読取装置の全体構成を概説する。
本実施形態に係る二次元コード読取装置1は、主に、照明光源21、受光センサ23、フィルタ25、結像レンズ27等の光学系と、メモリ35、制御回路40、操作スイッチ42、液晶表示装置46等のマイクロコンピュータ(以下「マイコン」という)系と、電源スイッチ41、電池49等の電源系と、から構成されている。
[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 two-dimensional code reader according to the first embodiment will be outlined.
The two-dimensional code reader 1 according to the present embodiment 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, a memory 35, a control circuit 40, an operation switch 42, and a liquid crystal display. A microcomputer (hereinafter referred to as “microcomputer”) system such as the device 46 and a power system such as a power switch 41 and a battery 49 are configured.

光学系は、照明光源21、受光センサ23、フィルタ25、結像レンズ27等から構成されている。照明光源21は、照明光Lfを発光可能な照明光源として機能するもので、例えば、LEDとこのLEDの出射側に設けられる拡散レンズ、集光レンズ等とから構成されている。本実施形態では、ハウジングの読取口(図1では図示略)を介して読取対象物Rに向けて照明光Lfを照射可能に構成されている。この読取対象物Rは、例えば、包装容器や包装用紙あるいはラベルといった表示媒体に相当するもので、この読取対象物Rには読取対象となる二次元コード100が印刷等によって形成されている。   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 the illumination light Lf, and includes, for example, an LED and a diffusing lens, a condensing lens, and the like provided on the emission side of the LED. In this embodiment, the illumination light Lf can be irradiated toward the reading object R through a reading port (not shown in FIG. 1) of the housing. The reading object R corresponds to, for example, a display medium such as a packaging container, wrapping paper, or label, and a two-dimensional code 100 to be read is formed on the reading object R by printing or the like.

受光センサ23は、{読取対象物Rや二次元コード100に照射されて反射した反射光Lrを受光可能に構成されるもので、例えば、C−MOSやCCD等の固体撮像素子である受光素子を2次元に配列したエリアセンサが、これに相当する。受光センサ23は、結像レンズ27を介して入射する入射光を受光面23aにて受光し得る構成でプリント配線板(図示略)に実装されている。本実施形態では、受光センサ23が「撮像手段」の一例に相当する。   The light receiving sensor 23 is configured to be capable of receiving the reflected light Lr irradiated and reflected on the reading object R or the two-dimensional code 100. For example, the light receiving element 23 is a solid-state imaging device such as a C-MOS or CCD. This corresponds to an area sensor in which the two-dimensional array is arranged. The light receiving sensor 23 is mounted on a printed wiring board (not shown) in such a configuration that incident light incident through the imaging lens 27 can be received by the light receiving surface 23a. In the present embodiment, the light receiving sensor 23 corresponds to an example of “imaging means”.

また、フィルタ25は、反射光Lrの波長相当以下の光の通過を許容し、当該波長相当を超える光の通過を遮断し得る光学的なローパスフィルタで、反射光Lrの波長相当を超える不要な光が受光センサ23に入射することを抑制している。また、結像レンズ27は、外部から読取口を介して入射する入射光を集光して受光センサ23の受光面23aに像を結像可能な結像光学系として機能するもので、例えば、鏡筒とこの鏡筒内に収容される複数の集光レンズとにより構成されている。   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 can block passage of light that exceeds that of the reflected light, and is unnecessary for exceeding the wavelength of the reflected light Lr. Light is prevented from entering the light receiving sensor 23. The imaging lens 27 functions as an imaging optical system capable of condensing incident light incident from the outside via a reading port and forming an image on the light receiving surface 23a of the light receiving sensor 23. For example, A lens barrel and a plurality of condensing lenses housed in the lens barrel are configured.

次に、マイコン系の構成概要を説明する。マイコン系は、増幅回路31、A/D変換回路33、メモリ35、アドレス発生回路36、同期信号発生回路38、制御回路40、操作スイッチ42、LED43、ブザー44、液晶表示装置46、通信インタフェース48等から構成されている。このマイコン系は、その名の通り、マイコン(情報処理装置)として機能し得る制御回路40及びメモリ35を中心に構成されるもので、前述した光学系によって撮像された二次元コード100の画像信号をハードウェア的およびソフトウェア的に信号処理し得るものである。また制御回路40は、当該二次元コード読取装置1の全体システムに関する制御も行っている。   Next, a configuration outline of the microcomputer system will be described. 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 device 46, and a communication interface 48. Etc. As the name suggests, this microcomputer system is composed mainly of a control circuit 40 and a memory 35 that can function as a microcomputer (information processing apparatus). The image signal of the two-dimensional code 100 imaged by the optical system described above. Can be processed in hardware and software. The control circuit 40 also performs control related to the entire system of the two-dimensional code reader 1.

光学系の受光センサ23から出力される画像信号(アナログ信号)は、増幅回路31に入力されることで所定ゲインで増幅された後、A/D変換回路33に入力されると、アナログ信号からディジタル信号に変換される。そして、ディジタル化された画像信号、つまり画像データ(画像情報)は、メモリ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. Converted into a digital signal. When the digitized image signal, that is, image data (image information) is input to the memory 35, it is stored in the image data storage area. The synchronization signal generation circuit 38 is configured 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. Thus, the storage address of the image data stored in the memory 35 can be generated.

メモリ35は、半導体メモリ装置として構成されており、例えばRAM(DRAM、SRAM等)やROM(EPROM、EEPROM等)がこれに相当する。このメモリ35のうちのRAMには、前述した画像データ蓄積領域のほかに、制御回路40が算術演算や論理演算等の各処理時に利用する作業領域や読取条件テーブルも確保可能に構成されている。またROMには、読取処理、解析処理等を実行可能な所定プログラムやその他、照明光源21、受光センサ23等の各ハードウェアを制御可能なシステムプログラム等が予め格納されている。   The memory 35 is configured as 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 reading processing, analysis processing, and the like, and a system program that can control each hardware such as the illumination light source 21 and the light receiving sensor 23.

制御回路40は、二次元コード読取装置1全体を制御可能なマイコンで、CPU、システムバス、入出力インタフェース等からなるもので、メモリ35とともに情報処理装置を構成し得るもので情報処理機能を有する。この制御回路40は、内蔵された入出力インタフェースを介して種々の入出力装置(周辺装置)と接続可能に構成されており、本実施形態の場合、電源スイッチ41、操作スイッチ42、LED43、ブザー44、液晶表示装置46、通信インタフェース48等が制御回路40に接続されている。なお、通信インタフェース48には、当該二次元コード読取装置1の上位システムに相当するホストコンピュータHST等が接続可能とされている。また、電源系は、電源スイッチ41、電池49等によって構成されており、制御回路40による電源スイッチ41のオンオフ制御により、電池49から上述した各装置や各回路に供給される駆動電圧の導通や遮断が制御されている。   The control circuit 40 is a microcomputer that can control the entire two-dimensional code reader 1 and includes a CPU, a system bus, an input / output interface, and the like. The control circuit 40 can constitute an information processing device together with the memory 35 and has an information processing function. . The control circuit 40 is configured to be connectable to various input / output devices (peripheral devices) via a built-in input / output interface. In this embodiment, the control circuit 40 includes a power switch 41, an operation switch 42, an LED 43, a buzzer. 44, a liquid crystal display device 46, a communication interface 48, and the like are connected to the control circuit 40. The communication interface 48 can be connected to a host computer HST or the like corresponding to the host system of the two-dimensional code reader 1. The power supply system includes a power switch 41, a battery 49, and the like. When the power switch 41 is turned on and off by the control circuit 40, the conduction of the drive voltage supplied from the battery 49 to each device and each circuit described above is performed. Shut-off is controlled.

(二次元コード)
次に、二次元コード読取装置1の読取対象となる二次元コードを説明する。
図2は、二次元コード読取装置1によって読み取られる二次元コード100を概略的に例示するものである。図2に示す二次元コード100は、複数のセルCがマトリックス状に配列されてなるものであり、複数のコードブロック(データコードブロック107、誤り訂正コードブロック108)と、第1の特定パターン102と、第2の特定パターン103、104と、色参照パターン110、120、130、140、150、160、170、180、190(以下、これら色参照パターンを色参照パターン110〜190とも称する)を備えた構成をなしている。この二次元コード100は、外形が正方形状のセルCが集合してマトリックス状に配置されたセル集合体として構成されており、図2の例では、セル数が縦横同数(35セル×35セル)となる配列で構成されている。また、二次元コード100を構成するコード領域(セルCが配置される領域)は、外形が矩形状の矩形領域(図2の例では、外形が正方形状の正方形領域)とされている。
(Two-dimensional code)
Next, a two-dimensional code to be read by the two-dimensional code reader 1 will be described.
FIG. 2 schematically illustrates a two-dimensional code 100 read by the two-dimensional code reader 1. A two-dimensional code 100 shown in FIG. 2 includes a plurality of cells C arranged in a matrix, and includes a plurality of code blocks (a data code block 107 and an error correction code block 108) and a first specific pattern 102. The second specific patterns 103 and 104, and the color reference patterns 110, 120, 130, 140, 150, 160, 170, 180, and 190 (hereinafter, these color reference patterns are also referred to as color reference patterns 110 to 190). It has a prepared structure. The two-dimensional code 100 is configured as a cell aggregate in which cells C having a square outer shape are aggregated and arranged in a matrix, and in the example of FIG. 2, the number of cells is the same number (35 cells × 35 cells). ). In addition, the code area (area where the cell C is arranged) constituting the two-dimensional code 100 is a rectangular area whose outer shape is rectangular (in the example of FIG. 2, a square area whose outer shape is square).

なお、図2では、一部のセルのみについて符号Cを付しており、他のセルの符号は省略している。また、図2では、一部の誤り訂正コードブロック108の位置を一点鎖線にて概念的に示しており、他の誤り訂正コードブロックについては図示を省略している。また、一部のデータコードブロック107の位置について二点鎖線にて概念的に示しており、他のデータコードブロック107については図示を省略している。また、図2では、データが記録される領域(データ記録領域)を破線AR1にて概念的に示しており、このデータ記録領域AR1内の具体的セル構成(各コードブロックの具体的セル構成等)は省略して示している。   In FIG. 2, only some of the cells are denoted by reference symbol C, and the reference numerals of other cells are omitted. In FIG. 2, the positions of some error correction code blocks 108 are conceptually indicated by alternate long and short dash lines, and other error correction code blocks are not shown. Further, the positions of some data code blocks 107 are conceptually shown by two-dot chain lines, and the other data code blocks 107 are not shown. In FIG. 2, an area (data recording area) in which data is recorded is conceptually indicated by a broken line AR1, and a specific cell configuration in this data recording area AR1 (specific cell configuration of each code block, etc.) ) Is omitted.

本実施形態の二次元コード100は、色彩又は濃度又は輝度の異なる3種類以上のセルを用いたいわゆるカラーコードとして構成されるものであり、図2では、その一例として、黒色セル、白色セル、赤色セル、緑色セル、青色セル、シアン色セル、マゼンダ色セル、黄色セル、の8色のセルを用いた構成を示している。なお、本実施形態及び他の実施形態を通し、黒色セルをCb、白色セルをCwで示すとともに、緑色セルを符号Cg、赤色セルをCr、青色セルをCu、黄色セルをCy、シアン色セルをCn、マゼンダ色セルをCmとそれぞれ示すこととする。   The two-dimensional code 100 of the present embodiment is configured as a so-called color code using three or more types of cells having different colors, densities, or luminances. In FIG. 2, as an example, a black cell, a white cell, A configuration using eight color cells of a red cell, a green cell, a blue cell, a cyan cell, a magenta cell, and a yellow cell is shown. Throughout this embodiment and other embodiments, the black cell is indicated by Cb, the white cell is indicated by Cw, the green cell is indicated by Cg, the red cell is Cr, the blue cell is Cu, the yellow cell is Cy, and the cyan cell. Is represented as Cn, and the magenta cell as Cm.

二次元コード100の一部を構成するコードブロックは、図2の二次元コード100では、データコードブロック107と、誤り訂正コードブロック108とに分けられており、いずれも複数のセルCが集合した構成をなしている。   The code block constituting a part of the two-dimensional code 100 is divided into a data code block 107 and an error correction code block 108 in the two-dimensional code 100 of FIG. It has a configuration.

データコードブロック107は、デコードの対象となるデータを符号化した符号化データ(データコード語)を複数のセルによって表現したブロックであり、データコードブロック107を構成する各セルは、予め定められた複数種類のセル(図2の例では上述の8色のセル)の中からいずれかの種類のセルが選択されて用いられている。なお、図2では、8つのセルが4行2列のマトリックス状に配列されたデータコードブロック107を二点鎖線にて概念的に例示しているが、データコードブロック107のセル数やブロック構成はこれ以外であってもよい。   The data code block 107 is a block in which encoded data (data code word) obtained by encoding data to be decoded is expressed by a plurality of cells. Each cell constituting the data code block 107 is determined in advance. Any type of cell is selected from a plurality of types of cells (the above-described eight color cells in the example of FIG. 2). In FIG. 2, the data code block 107 in which eight cells are arranged in a matrix of 4 rows and 2 columns is conceptually illustrated by a two-dot chain line, but the number of cells and the block configuration of the data code block 107 are illustrated. May be other than this.

各データコードブロック107は、デコードすべき符号化データ(データコード語)に対応したセルの配列で構成されている。具体的には、セル表示色が、数値に対応付けられており、例えば、データ値「0」に対して第1の色「白」、データ値「1」に対して第2の色「赤」、データ値「2」に対して第3の色「緑」、データ値「3」に対して第4の色「青」、データ値「4」、に対して第5の色「マゼンタ」、データ値「5」に対して第6の色「黄」、データ値「6」に対して第7の色「シアン」、データ値「7」、に対して第8の色「黒」、がそれぞれ対応付けられている。   Each data code block 107 is composed of an array of cells corresponding to encoded data (data code words) to be decoded. Specifically, the cell display color is associated with a numerical value. For example, the first color “white” for the data value “0” and the second color “red” for the data value “1”. ”, The third color“ green ”for the data value“ 2 ”, the fourth color“ blue ”for the data value“ 3 ”, and the fifth color“ magenta ”for the data value“ 4 ”. The sixth color “yellow” for the data value “5”, the seventh color “cyan” for the data value “6”, the eighth color “black” for the data value “7”, Are associated with each other.

誤り訂正コードブロック108は、データコードブロック107の誤り訂正を行うための誤り訂正コード語によって構成されている。この誤り訂正コードブロック108を構成する誤り訂正コード語は、データコードブロック107を構成する符号化データ(データコード語)に基づいて生成されたものである。なお、データコード語に基づいて誤り訂正コード語を生成する方法としては、例えば公知のリード・ソロモン誤り訂正方式を用いることができる。   The error correction code block 108 is composed of error correction code words for performing error correction of the data code block 107. The error correction code word constituting the error correction code block 108 is generated based on the encoded data (data code word) constituting the data code block 107. As a method for generating an error correction code word based on a data code word, for example, a known Reed-Solomon error correction method can be used.

第1の特定パターン102は、二次元コード100の矩形領域において4つ設けられた角部(矩形領域における角を構成する部分)105a〜105dのうち、規定の角部105aに配置されるものである。図2の例では第1の特定パターン102の外形が矩形状(詳しくは正方形状)に構成されており、第1の特定パターン102の外縁を構成する2辺によって矩形領域における規定の角部105aの角位置が定められている。具体的には、中心に第1の色のセル(黒色セル)が1つ配置され、その第1の色のセル(黒色セル)の周りを複数種類のセルが矩形状に囲んでいる。さらに、その環状のセル群(複数色のセル群)の周りを第1の色のセル(黒色セル102a)が環状かつ矩形状に囲んだ構成をなし、それが最外周のセル群として構成されている。そして、その最外周のセル群の外形が矩形状(正方形状)に構成され、第1の特定パターン102全体として外形が矩形状(正方形状)となっている。   The first specific pattern 102 is arranged at a prescribed corner 105a among four corners (portions constituting corners in the rectangular area) 105a to 105d provided in the rectangular area of the two-dimensional code 100. is there. In the example of FIG. 2, the outer shape of the first specific pattern 102 is formed in a rectangular shape (specifically, a square shape), and a predetermined corner portion 105 a in the rectangular region is defined by two sides that form the outer edge of the first specific pattern 102. The angular position of is determined. Specifically, one cell of the first color (black cell) is arranged at the center, and a plurality of types of cells surround the first color cell (black cell) in a rectangular shape. Further, the annular cell group (multi-color cell group) is surrounded by a first color cell (black cell 102a) in an annular and rectangular shape, which is configured as the outermost cell group. ing. The outermost cell group has a rectangular (square) outer shape, and the first specific pattern 102 as a whole has a rectangular (square) outer shape.

この第1の特定パターン102は、矩形領域における各セルCの位置の特定するための要素として機能するものであり、具体的には、二次元コード100を光学的情報読取装置で読み取ったときに得られる画像データにおいて規定の角部105aの位置を特定するために用いられると共に、その画像データにおいて二次元コード100の向きを特定するために用いられる。なお、本明細書全体を通し、第1の特定パターン102、第2の特定パターン103、104、及び後述する色参照パターン110〜190は、二次元コードに含まれるデータ(デコードすべきデータ)に関係なく一定のパターンとして構成されている。   The first specific pattern 102 functions as an element for specifying the position of each cell C in the rectangular area. Specifically, when the two-dimensional code 100 is read by the optical information reader. It is used to specify the position of the prescribed corner 105a in the obtained image data, and is used to specify the orientation of the two-dimensional code 100 in the image data. Throughout this specification, the first specific pattern 102, the second specific patterns 103 and 104, and color reference patterns 110 to 190 described later are included in data (data to be decoded) included in the two-dimensional code. Regardless of what is configured as a certain pattern.

第2の特定パターン103、104は、コード領域(矩形領域)の境界をなす4つの辺(4つの境界辺)のうち、第1の特定パターン102が接する境界辺に隣接して配置されるものであり、一方のパターン(第2の特定パターン103)が一方の境界辺に沿って配置され、他方のパターン(第2の特定パターン104)が他方の境界辺に沿って配置されている。これら第2の特定パターン103、104は、二次元コード100のコード領域(矩形領域)を背景から分離するために利用され、後述する読み取りの際にこれら第2の特定パターン103,104を認識することで境界辺の位置を特定できるようになっている。なお、図2の例では、第2の特定パターン103、104のいずれもが、白色セルと黒色セルとを交互に配置してなる白黒交互パターンによって構成されているが、他のパターンによって構成されていてもよい。   The second specific patterns 103 and 104 are arranged adjacent to the boundary side in contact with the first specific pattern 102 among the four sides (four boundary sides) forming the boundary of the code region (rectangular region). One pattern (second specific pattern 103) is arranged along one boundary side, and the other pattern (second specific pattern 104) is arranged along the other boundary side. These second specific patterns 103 and 104 are used to separate the code area (rectangular area) of the two-dimensional code 100 from the background, and the second specific patterns 103 and 104 are recognized at the time of reading to be described later. Thus, the position of the boundary side can be specified. In the example of FIG. 2, each of the second specific patterns 103 and 104 is configured by a black and white alternating pattern in which white cells and black cells are alternately arranged, but is configured by other patterns. It may be.

次に、色参照パターン110〜190について説明する。色参照パターン110〜190は、矩形領域内の各セルに使用するセル表示色の基準となるパターンであり、いずれも、複数のセルがマトリックス状(図2の例では3行3列のマトリックス状)に配置された構成をなしている。図2の例では、全部の色参照パターン110〜190が同一の構成となっており、いずれも、二次元コード100で用いられる全セル表示色(黒色、白色、赤色、緑色、青色、マゼンタ色、シアン色、黄色)を表示するように構成されている。   Next, the color reference patterns 110 to 190 will be described. The color reference patterns 110 to 190 are patterns that serve as the standard of the cell display color used for each cell in the rectangular area, and in each case, a plurality of cells are arranged in a matrix (in the example of FIG. 2, a matrix of 3 rows and 3 columns). ). In the example of FIG. 2, all the color reference patterns 110 to 190 have the same configuration, and all the cell display colors (black, white, red, green, blue, magenta) used in the two-dimensional code 100 are used. , Cyan, yellow).

図3は、色参照パターン110を拡大して示しており、この例では、中心に黒色セル110iが配置され、その黒色セル110iの周囲を、複数色のセルが囲んでいる。これら複数色のセルを、角部に配置される白色セル110aから時計回りに説明すると、白色セル110a、シアン色セル110b、赤色セル110c、緑色セル110g、白色セル110e、マゼンタ色セル110f、青色セル110g、黄色セル110hの順に配置されている。なお、図3では、色参照パターン110のみを示しているが、これ以外の色参照パターン120〜190は色参照パターン110と同一の構成であるため、これら当該色参照パターン120〜190についての拡大図及び詳細な説明は省略する。また、図2の例では、各色参照パターン110〜190が矩形領域の4つの角部105a、105b、105c、105d等にそれぞれ配置されているが、色参照パターンの配置場所や色参照パターンの数は図2の構成に限定されるものではない。   FIG. 3 is an enlarged view of the color reference pattern 110. In this example, a black cell 110i is arranged at the center, and a plurality of cells surround the black cell 110i. These multi-colored cells will be described clockwise from the white cell 110a arranged at the corner. The white cell 110a, the cyan cell 110b, the red cell 110c, the green cell 110g, the white cell 110e, the magenta cell 110f, and blue Cells 110g and yellow cells 110h are arranged in this order. In FIG. 3, only the color reference pattern 110 is shown, but the other color reference patterns 120 to 190 have the same configuration as the color reference pattern 110, so that the color reference patterns 120 to 190 are enlarged. The drawings and detailed description are omitted. In the example of FIG. 2, the color reference patterns 110 to 190 are arranged at the four corners 105 a, 105 b, 105 c, 105 d, etc. of the rectangular area, but the color reference pattern placement location and the number of color reference patterns Is not limited to the configuration of FIG.

(読取処置)
次に、二次元コード読取装置1で行われる読取処理について説明する。
図4は、二次元コード読取装置1で行われる読取処理の流れを例示するフローチャートである。図4に示す読取処理は、例えば作業者が所定操作(例えば、操作スイッチ42のオン操作)を行うことで開始され、まず、画像取得処理が行われる(S1)。この処理では、二次元コード100が付された読取対象物R(図1)が受光センサ23によって撮像され、二次元コード100の画像データがメモリ35に記憶される。
(Reading treatment)
Next, a reading process performed by the two-dimensional code reader 1 will be described.
FIG. 4 is a flowchart illustrating the flow of reading processing performed by the two-dimensional code reading device 1. The reading process shown in FIG. 4 is started, for example, when a worker performs a predetermined operation (for example, an ON operation of the operation switch 42), and first, an image acquisition process is performed (S1). In this process, the reading object R (FIG. 1) to which the two-dimensional code 100 is attached is imaged by the light receiving sensor 23, and the image data of the two-dimensional code 100 is stored in the memory 35.

その後、S1にて取得された画像データにおいて二次元コード100のコード領域(矩形領域)を特定する処理を行う(S2)。この特定処理では、例えば外縁が特定図形(例えば四角形)となっている領域を抽出したり、或いは、外縁の明暗変化、色変化が激しい領域を抽出することで行うことができる。なお、画像処理の分野において異なる色の領域を区別する技術は各種提供されているため、これら公知の方法を用いて領域を特定してもよい。   Thereafter, a process of specifying a code area (rectangular area) of the two-dimensional code 100 in the image data acquired in S1 is performed (S2). This identification process can be performed, for example, by extracting a region whose outer edge is a specific figure (for example, a quadrangle), or by extracting a region where the outer edge has a sharp change in brightness and color. Since various techniques for distinguishing different color areas are provided in the field of image processing, the areas may be specified using these known methods.

S2の特定処理の後には、S2の処理においてコード領域(矩形領域)が特定できたか否かを判断し(S3)、特定できた場合にはS3にてYesに進み、デコード処理を行う(S4)。一方、特定できなかった場合には、S3にてNoに進み、当該読取処理を終了する。   After the specifying process of S2, it is determined whether or not the code area (rectangular area) can be specified in the process of S2 (S3). If it can be specified, the process proceeds to Yes in S3 and the decoding process is performed (S4). ). On the other hand, if it cannot be specified, the process proceeds to No in S3, and the reading process ends.

次に、S4のデコード処理について説明する。S4のデコード処理は、例えば図5のような流れで行われ、まず、コード領域(矩形領域)をセル単位に分割し、セル位置を特定する処理を行う(S11)。このS11の処理により、コード領域内において各セル位置が特定されることになる。   Next, the decoding process in S4 will be described. The decoding process of S4 is performed, for example, as shown in FIG. 5. First, the code area (rectangular area) is divided into cell units, and the process of specifying the cell position is performed (S11). By the processing of S11, each cell position is specified in the code area.

S11の処理の後には、S11で特定された全セルの内の未選択となっているいずれかのセルを選択する処理を行う。本実施形態では、コード領域を構成する各セルに対してS13、S14の処理が行われるようになっており、このS12の処理では、S13、S14の処理が未だ行われていないいずれかのセルを選択することになる。   After the process of S11, the process which selects the cell which is not selected among all the cells specified by S11 is performed. In the present embodiment, the processes of S13 and S14 are performed on each cell constituting the code area. In the process of S12, any cell for which the processes of S13 and S14 have not been performed yet. Will be selected.

S12でいずれかのセルが選択された後には、その選択されたセルの色を認識する処理を行う(S13)。S13のセル色認識処理は、例えば図6のような流れで行われ、まず、S12で選択されたセル(現在の着目セル)に近いK個のパターンを選択する処理を行う(S21)。このKの値は、様々とすることができ、二次元コード内に存在する色参照パターンの数(図2の例では「9」)としても良く、二次元コード内に存在する色参照パターンの数よりも小さい値としてもよい。例えば、図2のような二次元コード100を読み取る場合、Kの値が「4」であれば、全色参照パターン110〜190の内、S12で選択されたセルに近いものから順に4つ選択することになる。   After any cell is selected in S12, processing for recognizing the color of the selected cell is performed (S13). The cell color recognition process of S13 is performed, for example, as shown in FIG. 6. First, a process of selecting K patterns close to the cell selected in S12 (the current target cell) is performed (S21). The value of K can vary, and may be the number of color reference patterns existing in the two-dimensional code (“9” in the example of FIG. 2). It is good also as a value smaller than a number. For example, when the two-dimensional code 100 as shown in FIG. 2 is read, if the value of K is “4”, four of all color reference patterns 110 to 190 are selected in order from the one closest to the cell selected in S12. Will do.

S21において、現在着目しているセル(S12で選択されたセル)に近いK個の色参照パターンが選択された後には、そのK個の中から未処理のいずれかの色参照パターンを選択する(S22)。本実施形態では、S21で選択された各色参照パターンに対してS23、S24の処理が行われるようになっており、S22では、未だS23、S24の処理が行われていない色参照パターンを選択することになる。   In S21, after K color reference patterns close to the currently focused cell (the cell selected in S12) are selected, any unprocessed color reference pattern is selected from the K color reference patterns. (S22). In this embodiment, the processes of S23 and S24 are performed for each color reference pattern selected in S21. In S22, a color reference pattern for which the processes of S23 and S24 have not yet been performed is selected. It will be.

S22においていずれかの色参照パターンが選択された後には、その選択された色参照パターンまでの距離を算出すると共にメモリ35に記憶し(S23)、更に、その色参照パターンの各セルの色成分を取得する処理を行う(S24)。   After any color reference pattern is selected in S22, the distance to the selected color reference pattern is calculated and stored in the memory 35 (S23), and the color components of each cell of the color reference pattern are further calculated. (S24).

例えば、現在着目しているセル(S12で選択されたセル)が図2に示すセルC1であり、S22で選択された色参照パターンが、色参照パターン110である場合には、まず、S23においてセルC1から色参照パターン110までの距離を算出すると共にメモリ35に記憶する。この距離の算出については、ユークリッド距離やマンハッタン距離等の公知の様々な方法を採用できる。更に、S24において、色参照パターン110の各セル110a〜110iの色成分を取得する。具体的には、各色のセル110a〜110iについて、それぞれR成分値、G成分値、B成分値を求め、メモリ35に記憶する。なお、図3のようにいずれかの色(図3では白色)のセルが複数ある場合、その色については、それら複数の内のいずれかのセルのみによって各成分値を取得してもよく、複数のセルにおける各成分の平均値を求めてもよい。このような処理を行うことにより、現在着目している色参照パターンについて図8(a)のようなデータが得られる。   For example, if the currently focused cell (the cell selected in S12) is the cell C1 shown in FIG. 2 and the color reference pattern selected in S22 is the color reference pattern 110, first, in S23 The distance from the cell C1 to the color reference pattern 110 is calculated and stored in the memory 35. For calculating this distance, various known methods such as Euclidean distance and Manhattan distance can be employed. Further, in S24, the color components of the cells 110a to 110i of the color reference pattern 110 are acquired. Specifically, the R component value, the G component value, and the B component value are obtained and stored in the memory 35 for the cells 110 a to 110 i of the respective colors. In addition, when there are a plurality of cells of any color (white in FIG. 3) as shown in FIG. 3, each component value may be acquired only by any one of the plurality of cells for that color. You may obtain | require the average value of each component in a some cell. By performing such processing, data as shown in FIG. 8A is obtained for the color reference pattern currently focused on.

図24の処理の後には、K個目の色参照パターンについてのS23、S24の処理が終了したか否か(即ち、S21で選択されたK個全ての色参照パターンについてS23、S24の処理が終了したか否か)を判断し(S25)、終了した場合にはS25にてYesに進み、基準作成処理を行う(S26)。一方、K番目の色参照パターンまで終わっていない場合には、S25にてNoに進み、残っているいずれかの色参照パターンについてS22以降の処理を繰り返し、その色参照パターンに基づいて図8(b)のようなデータを取得する。このような処理をK個全ての色参照パターンについて繰り返し、K個全ての色参照パターンについて処理が終わると、図8(a)(b)のようなデータがK個の色参照パターン全てについて得られることになる。   After the processing of FIG. 24, whether or not the processing of S23 and S24 for the Kth color reference pattern is completed (that is, the processing of S23 and S24 is performed for all the K color reference patterns selected in S21). It is determined whether or not the process has been completed (S25). If the process has been completed, the process proceeds to Yes in S25, and a reference creation process is performed (S26). On the other hand, if the Kth color reference pattern has not been completed, the process proceeds to No in S25, and the processing from S22 onward is repeated for any remaining color reference pattern, and FIG. Data like b) is acquired. Such processing is repeated for all K color reference patterns, and when the processing is completed for all K color reference patterns, data as shown in FIGS. 8A and 8B is obtained for all K color reference patterns. Will be.

次に、S26の基準作成処理について説明する。S26の基準作成処理は、例えば図7のような流れで行われる。この処理では、まず、S21で選択されたK個の色参照パターンの中から、未選択の色参照パターンをいずれか一つ選択する(S31)。本実施形態では、S21で選択されたK個の色参照パターン全てに対してS32〜S36の処理が行われるようになっており、S31の処理では、S21で選択されたK個の中から未だS33〜S36の処理が行われていないいずれかの色参照パターンを選択することになる。   Next, the reference creation process of S26 will be described. The reference creation process of S26 is performed in the flow as shown in FIG. 7, for example. In this process, first, an unselected color reference pattern is selected from the K color reference patterns selected in S21 (S31). In the present embodiment, the processes of S32 to S36 are performed for all K color reference patterns selected in S21. In the process of S31, the process is still out of the K colors selected in S21. Any color reference pattern for which the processing of S33 to S36 has not been performed is selected.

S31の処理の後には、S31で選択された色参照パターンにおいて、未選択のいずれかの色を一つ選択する(S32)。本実施形態では、S31で選択された色参照パターンの全ての色に対してS33〜S36の処理が行われるようになっており、S32の処理では、S31で選択された色参照パターンにおける全ての色の中から未だS33〜S36の処理が行われていないいずれかの色を選択することになる。   After the process of S31, one of the unselected colors is selected in the color reference pattern selected in S31 (S32). In the present embodiment, the processing of S33 to S36 is performed for all the colors of the color reference pattern selected in S31. In the processing of S32, all the colors in the color reference pattern selected in S31 are processed. Any color that has not yet been subjected to the processing of S33 to S36 is selected from the colors.

そして、S31で選択された色参照パターンにおけるS32で選択された色についてのデータ(図6のS21〜S25の処理で生成された各成分値)を参照し、当該データにおけるR成分値、G成分値、B成分値が基準内に収まっているか否かを判断する(S33)。   Then, the data (the component values generated by the processing of S21 to S25 in FIG. 6) for the color selected in S32 in the color reference pattern selected in S31 is referred to, and the R component value and G component in the data are referred to. It is determined whether the value and the B component value are within the standard (S33).

S33の判断処理を行うための基準範囲は、予め固定値として定められていてもよく、S33よりも前の所定時期に算出、設定処理を行うようにしもよい。予め固定値として定めておく場合、想定される各色毎に、R成分値、G成分値、B成分値の各基準範囲を図9のように固定範囲として定めておけばよい。図9の例では、例えば黒色セルについては、R成分の基準範囲をRbmin以上、Rbmax未満と定め、G成分の基準範囲をGbmin以上、Gbmax未満と定め、B成分の基準範囲をBbmin以上、Bbmax未満と定めており、他の色のセルについても、R成分、G成分、B成分のそれぞれの基準範囲が定められている。   The reference range for performing the determination process of S33 may be set in advance as a fixed value, and the calculation and setting process may be performed at a predetermined time before S33. In the case where the fixed values are set in advance, the reference ranges of the R component value, the G component value, and the B component value may be set as fixed ranges as shown in FIG. 9 for each assumed color. In the example of FIG. 9, for example, for a black cell, the R component reference range is defined as Rbmin or more and less than Rbmax, the G component reference range is defined as Gbmin or more and less than Gbmax, the B component reference range is defined as Bbmin or more, and Bbmax. The reference ranges of the R component, the G component, and the B component are also determined for cells of other colors.

また、S3よりも前の所定時期に基準範囲を算出、設定する場合、二次元コード100に設けられた9つの色参照パターン110〜190の一部又は全部の色参照パターンの色情報に基づいて基準範囲を定めるようにすればよい。具体的には、例えば、図6のS25において、Yesに進んだ後、S26の基準作成処理を行う前に、S21〜S25の処理で得られたデータに基づいて、各色の各成分値についての基準範囲を設定する基準範囲設定処理を行うようにすればよい。   Further, when the reference range is calculated and set at a predetermined time before S3, it is based on the color information of some or all of the nine color reference patterns 110 to 190 provided in the two-dimensional code 100. A reference range may be defined. Specifically, for example, after proceeding to Yes in S25 of FIG. 6 and before performing the reference creation process of S26, based on the data obtained in the processes of S21 to S25, A reference range setting process for setting the reference range may be performed.

この例としては、まず、S21で選択されたK個の色参照パターンのデータに基づき各色の各成分値の平均値を求める。例えば、S21〜S25の処理により、K個の色参照パターンの各黒色セルに基づいて、K個のR成分値、K個のG成分値、K個のB成分値が得られているため、これらK個のR成分値、K個のG成分値、K個のB成分値のそれぞれの平均値Rbave、Rgave、Bbaveを求める。同様に、S21〜S25の処理により、K個の色参照パターンの各白色セルに基づいて、K個のR成分値、K個のG成分値、K個のB成分値が得られているため、これらK個のR成分値、K個のG成分値、K個のB成分値のそれぞれの平均値Rwave、Rwave、Bwaveを求める。他の色についても、同様であり、図10(a)のように、K個の色参照パターンの各色毎に、R成分値の平均値、G成分値の平均値、B成分値の平均値を求める。   As an example of this, first, an average value of each component value of each color is obtained based on the data of the K color reference patterns selected in S21. For example, because of the processing of S21 to S25, K R component values, K G component values, and K B component values are obtained based on each black cell of the K color reference patterns. Average values Rbave, Rgave, and Bbave of these K R component values, K G component values, and K B component values are obtained. Similarly, because of the processing of S21 to S25, K R component values, K G component values, and K B component values are obtained based on the white cells of the K color reference patterns. Then, average values Rwave, Rwave, and Bwave of these K R component values, K G component values, and K B component values are obtained. The same applies to the other colors. As shown in FIG. 10A, the average value of the R component value, the average value of the G component value, and the average value of the B component value for each color of the K color reference patterns. Ask for.

そして、図10(a)のように得られた各色の各成分平均値に基づいて、各色の各成分についての基準範囲(基準値)を設定する。基準範囲の設定方法は様々に考えられるが、図10(b)の例では、各色の各成分平均値のプラスマイナス一定範囲を、各色の各成分についての基準範囲として設定している。例えば、黒色セルのR成分については、K個の黒色セルのR成分平均値Rbaveを中央値として、「Rbave−α以上、Rbave+α未満」の範囲を基準範囲(基準値)としている。また、黒色セルのG成分、B成分についても同様に基準範囲が設定され、他の色のR成分、G成分、B成分についても同様に準範囲が設定される。なお、この例では、図10(b)に示す各色の各成分についての基準範囲が「汚れを判断するための基準値」の一例に相当する。   Then, based on each component average value of each color obtained as shown in FIG. 10A, a reference range (reference value) for each component of each color is set. There are various methods for setting the reference range, but in the example of FIG. 10B, a certain range of the average value of each component of each color is set as the reference range for each component of each color. For example, for the R component of the black cell, the R component average value Rbave of the K black cells is set as the median value, and the range of “Rbave−α or more and less than Rbave + α” is set as the reference range (reference value). Similarly, the reference range is set for the G component and B component of the black cell, and the sub-range is set similarly for the R component, G component, and B component of the other colors. In this example, the reference range for each component of each color shown in FIG. 10B corresponds to an example of “reference value for determining contamination”.

図7のS33では、図9或いは10(b)のように設定された基準範囲に基づいて、着目している色参照パターン(S31で選択された色参照パターン)の着目色(S32で選択された色)の各成分値が基準内に収まっているか否かを判断する。   In S33 of FIG. 7, based on the standard range set as shown in FIG. 9 or 10 (b), the target color (the color reference pattern selected in S31) of the target color (selected in S32) is selected. It is determined whether each component value of (color) is within the standard.

例えば、図10(b)のような基準範囲が定められており、S31において、図8(a)のような色参照パターンK1が選択され、S32において、黒色が選択された場合には、当該色参照パターンK1の黒色セルのR成分値Rb1がRbave−α以上Rbave+α未満の範囲に収まっているか否か、G成分値Gb1がGbave−α以上Gbave+α未満の範囲に収まっているか否か、B成分値Bb1がBbave−α以上Bbave+α未満の範囲に収まっているか否かを判断する。いずれの成分値Rb1、Gb1、Bb1も基準範囲に収まっていれば、当該色参照パターンK1の黒色セルについては基準内に収まっていると判断し、S33にてYesに進むことになる。一方、成分値Rb1、Gb1、Bb1のいずれか一つでも基準範囲内に収まっていない場合には、当該色参照パターンK1の黒色セルについては基準内に収まっていないと判断し、S33にてNoに進むことになる。   For example, a standard range as shown in FIG. 10B is defined, and when the color reference pattern K1 as shown in FIG. 8A is selected in S31 and black is selected in S32, Whether the R component value Rb1 of the black cell of the color reference pattern K1 is within the range of Rbave−α or more and less than Rbave + α, whether the G component value Gb1 is within the range of Gbave−α or more and less than Gbave + α, B component It is determined whether or not the value Bb1 is within the range of Bbave−α or more and less than Bbave + α. If any of the component values Rb1, Gb1, and Bb1 are within the standard range, it is determined that the black cell of the color reference pattern K1 is within the standard, and the process proceeds to Yes in S33. On the other hand, if any one of the component values Rb1, Gb1, and Bb1 is not within the standard range, it is determined that the black cell of the color reference pattern K1 is not within the standard, and No in S33. Will proceed to.

S33にてYesに進む場合、重み付け値を算出する処理を行う(S34)。
本実施形態では、図6のS23の処理において、色認識(色判別)を行おうとする着目セル画像(即ち、S12で選択されたセル)から複数の色参照パターン(S21で選択されたK個の色参照パターン)それぞれまでの距離を算出しており、図7のS34では、色参照パターン毎に、セル画像からの距離に応じた重み付けを算出している。重み付けは例えば以下の数1によって算出される。
When the process proceeds to Yes in S33, a process of calculating a weight value is performed (S34).
In the present embodiment, in the process of S23 of FIG. 6, a plurality of color reference patterns (K pieces selected in S21) are selected from the target cell image (that is, the cell selected in S12) to be subjected to color recognition (color discrimination). Color reference patterns), and the weights corresponding to the distance from the cell image are calculated for each color reference pattern in S34 of FIG. For example, the weighting is calculated by the following formula 1.

Figure 0005267323
Figure 0005267323

数1において、Wnは、着目しているn番目の色参照パターンの重みを示す値である。また、Lnは、色認識を行おうとするセル(図5のS12で選択されたセル)から着目しているn番目の色参照パターンまでの距離である。また、Lmaxは、S21で選択されたK個の色参照パターンの内の、色認識を行おうとするセル(図5のS12で選択されたセル)から最も遠い色参照パターンまでの距離である。   In Equation 1, Wn is a value indicating the weight of the nth color reference pattern of interest. Ln is the distance from the cell in which color recognition is to be performed (the cell selected in S12 in FIG. 5) to the nth color reference pattern of interest. Further, Lmax is the distance from the cell to be color-recognized among the K color reference patterns selected in S21 (the cell selected in S12 in FIG. 5) to the farthest color reference pattern.

例えば、図11のように、セルC1が色認識を行うセルであり、図6のS21においてこのセルC1の近くの4つの色参照パターン110、120、180、190が選択された場合、S31で色参照パターン110が選択されたときにS34で算出される重み付け値は、L4/L1となる。同様に、S31で色参照パターン120が選択されたときにS34で算出される重み付け値は、L4/L2となり、S31で色参照パターン180が選択されたときにS34で算出される重み付け値は、L4/L3となり、S31で色参照パターン190が選択されたときにS34で算出される重み付け値は、L4/L4となる。このように、着目セルC1に近い色参照パターンほど重み付け値が大きくなるように重み付けされる。   For example, as shown in FIG. 11, when the cell C1 is a cell that performs color recognition, and four color reference patterns 110, 120, 180, and 190 near the cell C1 are selected in S21 of FIG. The weight value calculated in S34 when the color reference pattern 110 is selected is L4 / L1. Similarly, when the color reference pattern 120 is selected in S31, the weight value calculated in S34 is L4 / L2, and when the color reference pattern 180 is selected in S31, the weight value calculated in S34 is L4 / L3, and when the color reference pattern 190 is selected in S31, the weight value calculated in S34 is L4 / L4. Thus, the color reference pattern closer to the cell of interest C1 is weighted so that the weighting value becomes larger.

一方、S33にてNoに進む場合には、着目している色参照パターンの着目色についての重み付けを「0」に設定する。この場合、S31で選択された色参照パターンにおけるS32で選択された色の各成分値は、基準作成に反映されない。   On the other hand, when the process proceeds to No in S33, the weight for the target color of the target color reference pattern is set to “0”. In this case, each component value of the color selected in S32 in the color reference pattern selected in S31 is not reflected in the standard creation.

S34の処理の後又はS35の処理の後には、S32で選択された着目色の各成分値に
対して、S34又はS35で設定された重み付け値を掛け合わせた値を算出する(S36)。例えば、図11に示すようなケースにおいて、S31にて色参照パターン110が選択され、S32で黒色セルが選択されたとき、色参照パターン110の各色の各成分値が図8(a)のような場合には、S33にてYesに進むときには(即ち、黒色セルの各成分値が基準内に収まっているときには)、黒色セルの各成分値Rb1,Gb1,Bb1に対してS34で算出された重みL4/L1をそれぞれ掛け合わせ、それら乗算値「Rb1×L4/L1」、「Gb1×L4/L1」「Bb1×L4/L1」を取得する。なお、S33にてNoに進む場合には、黒色セルの各成分値Rb1,Gb1,Bb1に対し「0」を掛け合わせるため、各成分の乗算値は全て0となる。
After the process of S34 or after the process of S35, a value obtained by multiplying each component value of the target color selected in S32 by the weight value set in S34 or S35 is calculated (S36). For example, in the case shown in FIG. 11, when the color reference pattern 110 is selected in S31 and the black cell is selected in S32, the component values of each color of the color reference pattern 110 are as shown in FIG. In this case, when the process proceeds to Yes in S33 (that is, when the component values of the black cells are within the reference), the calculation is performed for the component values Rb1, Gb1, Bb1 of the black cells in S34. Each of the weights L4 / L1 is multiplied to obtain the multiplication values “Rb1 × L4 / L1”, “Gb1 × L4 / L1”, and “Bb1 × L4 / L1”. When the process proceeds to No in S33, the component values Rb1, Gb1, and Bb1 of the black cells are multiplied by “0”, so that the multiplication values of the components are all 0.

S36にて上記乗算値を取得した後には、着目している色参照パターン(S31で選択された色参照パターン)のすべての色についてS33〜S36の処理を行った否かを判断し(S37)、S33〜S36の処理を行っていない色が残っている場合にはS37にてNoに進み、その残っている色の中からいずれかの色を選択し(S32)、S33以降の処理を繰り返す。着目している色参照パターン(S31で選択された色参照パターン)のすべての色についてS33〜S36の処理を行った場合には、S37にてYesに進み、S21で選択されたK個全ての色参照パターンについてS32〜S37の処理を行ったか否かを判断する(S38)。S21で選択されたK個の色参照パターンの中で、S32〜S37の処理を行っていない色参照パターンが残っている場合には、S38にてNoに進み、その残っている色参照パターンの中からいずれかの色参照パターンを選択し(S31)、S32〜S37の処理を繰り返す。   After obtaining the multiplication value in S36, it is determined whether or not the processing of S33 to S36 has been performed for all the colors of the color reference pattern of interest (the color reference pattern selected in S31) (S37). If a color that has not been subjected to the processing of S33 to S36 remains, the process proceeds to No in S37, selects one of the remaining colors (S32), and repeats the processing after S33. . When the processing of S33 to S36 is performed for all the colors of the color reference pattern of interest (the color reference pattern selected in S31), the process proceeds to Yes in S37, and all the K selected in S21 are processed. It is determined whether or not the processes of S32 to S37 have been performed for the color reference pattern (S38). If the color reference patterns that have not been subjected to the processing of S32 to S37 remain among the K color reference patterns selected in S21, the process proceeds to No in S38, and the remaining color reference patterns. One of the color reference patterns is selected from the inside (S31), and the processes of S32 to S37 are repeated.

S21で選択されたK個の色参照パターン全てについてS32〜S37の処理を行った場合には、S38にてYesに進み、各色について成分毎の基準データ(セル別基準データ)を算出する処理を行う。この処理では、各色の各成分毎に、S36で算出された乗算値の総和とS34、S35で算出された重み付けの総和とを求めると共に乗算値の総和を重み付けの総和で割った値を求め、これを各色の各成分についての基準データとする。例えば、黒色セルについての各成分毎の基準データを生成する場合、まず、各色参照パターンの各黒色セルに対して行われたS34又はS35の算出結果をすべて加算することで、黒色セルについての重み付け値の総和を求める。また、各色参照パターンの各黒色セルに対して行われたS36の処理の算出結果を、R成分毎、G成分毎、B成分毎に、それぞれすべて加算することで、黒色セルのR成分についての乗算値の総和、黒色セルのG成分についての乗算値の総和、黒色セルのB成分についての乗算値の総和をそれぞれ求める。そして、黒色セルのR成分について得られた乗算値の総和を、黒色セルについての重み付け値の総和で割ることで、黒色セルのR成分の基準データを得ることができる。同様に、黒色セルのG成分についての乗算値の総和を、黒色セルについての重み付け値の総和で割ることで、黒色セルのG成分の基準データを得ることができ、黒色セルのB成分についての乗算値の総和を、黒色セルについての重み付け値の総和で割ることで、黒色セルのB成分の基準データを得ることができる。なお、他の色についても同様の方法で各成分の基準データを取得することができる。   When the processes of S32 to S37 have been performed for all K color reference patterns selected in S21, the process proceeds to Yes in S38, and the process of calculating the reference data (cell-specific reference data) for each component for each color is performed. Do. In this process, for each component of each color, the sum of the multiplication values calculated in S36 and the sum of the weights calculated in S34 and S35 and the value obtained by dividing the sum of the multiplication values by the sum of the weights are obtained. This is used as reference data for each component of each color. For example, when generating standard data for each component for a black cell, first, by adding all the calculation results of S34 or S35 performed for each black cell of each color reference pattern, weighting for the black cell Find the sum of values. In addition, by adding all the calculation results of the process of S36 performed for each black cell of each color reference pattern for each R component, for each G component, and for each B component, The sum of the multiplication values, the sum of the multiplication values for the G component of the black cell, and the sum of the multiplication values for the B component of the black cell are obtained. Then, by dividing the sum of the multiplication values obtained for the R component of the black cell by the sum of the weighted values for the black cell, reference data for the R component of the black cell can be obtained. Similarly, the reference data for the G component of the black cell can be obtained by dividing the sum of the multiplication values for the G component of the black cell by the sum of the weighting values for the black cell. By dividing the sum of the multiplication values by the sum of the weight values for the black cells, the reference data for the B component of the black cells can be obtained. The reference data of each component can be acquired for other colors in the same manner.

次に、図11を参照し、基準データの具体的算出例を説明する。なお、以下では、赤色セルについてのR成分基準データ、G成分基準データ、B成分基準データを算出する方法を代表例として説明する。なお、図11では、セルC1についてのセル色認識処理(S13)に際し、S21において4つの色参照パターン110、120、180、190が選択された例を示しており、これら各色参照パターン110、120、180、190の各赤色セルから検出されたR成分値、B成分値、B成分値を、それぞれの色参照パターン近傍に例示している。また、以下の説明では、色認識を行おうとする着目セルC1から各色参照パターン110、120、180、190までの距離L1、L2、L3,L4を、それぞれL1=30、L2=60、L3=80、L4=120としている。また、以下では、赤色セルについての、R成分基準範囲、G成分基準範囲、B成分基準範囲がそれぞれ、「150以上」「130未満」「130未満」と設定されたものとして説明する。   Next, a specific calculation example of the reference data will be described with reference to FIG. In the following, a method for calculating R component reference data, G component reference data, and B component reference data for a red cell will be described as a representative example. FIG. 11 shows an example in which four color reference patterns 110, 120, 180, and 190 are selected in S21 during the cell color recognition process (S13) for the cell C1, and each of these color reference patterns 110 and 120 is shown. , 180 and 190, the R component value, the B component value, and the B component value detected in the vicinity of each color reference pattern. In the following description, the distances L1, L2, L3, and L4 from the target cell C1 to be color-recognized to the respective color reference patterns 110, 120, 180, and 190 are represented by L1 = 30, L2 = 60, and L3 =, respectively. 80 and L4 = 120. In the following description, it is assumed that the R component reference range, the G component reference range, and the B component reference range for the red cell are set to “150 or more”, “less than 130”, and “less than 130”, respectively.

図11の例では、図7のS31で色参照パターン110が選択され、S32で赤色セルが選択されたとき、当該赤色セルの各成分値が全て基準範囲内に収まっているため、S33にてYesに進むことになる。そして、S34では、重み付け値がL4/L1=120/30=4として算出される。また、S31で色参照パターン120が選択され、S32で赤色セルが選択されたときにも、当該赤色セルの各成分値が全て基準範囲内に収まっているため、S33にてYesに進むことになる。そして、S34では、重み付け値がL4/L2=120/60=2として算出される。一方、S31で色参照パターン180が選択され、S32で赤色セルが選択されたときには、当該赤色セルのB成分値が基準範囲内に収まっていないため、S33にてNoに進むことになる。この場合には、重み付け値は0となる。一方、S31で色参照パターン190が選択され、S32で赤色セルが選択されたときには、当該赤色セルの各成分値が全て基準範囲内に収まっているため、S33にてYesに進むことになる。そして、S34では、重み付け値がL4/L4=120/120=1として算出される。この場合、赤色セルについての重み付け値の総和は4+2+0+1=7となる。   In the example of FIG. 11, when the color reference pattern 110 is selected in S31 of FIG. 7 and the red cell is selected in S32, all the component values of the red cell are within the reference range. Proceed to Yes. In S34, the weighting value is calculated as L4 / L1 = 120/30 = 4. Further, when the color reference pattern 120 is selected in S31 and the red cell is selected in S32, since all the component values of the red cell are within the standard range, the process proceeds to Yes in S33. Become. In S34, the weighting value is calculated as L4 / L2 = 120/60 = 2. On the other hand, when the color reference pattern 180 is selected in S31 and the red cell is selected in S32, the B component value of the red cell does not fall within the reference range, so the process proceeds to No in S33. In this case, the weighting value is 0. On the other hand, when the color reference pattern 190 is selected in S31 and the red cell is selected in S32, since all the component values of the red cell are within the standard range, the process proceeds to Yes in S33. In S34, the weighting value is calculated as L4 / L4 = 120/120 = 1. In this case, the sum of the weight values for the red cell is 4 + 2 + 0 + 1 = 7.

また、図7のS31で色参照パターン110が選択され、S32で赤色セルが選択される場合には、上述したように、S34において重み付け値「4」が得られるため、S36では、色参照パターン110のR成分値「200」、G成分値「100」、B成分値「80」にそれぞれ「4」が掛け合わされ、R成分乗算値「200×4」、G成分乗算値「100×4」、B成分乗算値「80×4」が得られる。同様に、図7のS31で色参照パターン120が選択され、S32で赤色セルが選択される場合には、色参照パターン120についてのR成分乗算値「210×2」、G成分乗算値「60×2」、B成分乗算値「70×2」が得られる。また、図7のS31で色参照パターン190が選択され、S32で赤色セルが選択される場合には、色参照パターン190についてのR成分乗算値「220×1」、G成分乗算値「80×1」、B成分乗算値「80×1」が得られる。なお、図7のS31で色参照パターン180が選択され、S32で赤色セルが選択される場合には、S33にてNoに進むため、色参照パターン180についてのR成分乗算値、G成分乗算値、B成分乗算値はいずれも「0」となる。   Further, when the color reference pattern 110 is selected in S31 of FIG. 7 and the red cell is selected in S32, the weight value “4” is obtained in S34 as described above. 110 R component value “200”, G component value “100”, and B component value “80” are each multiplied by “4” to obtain an R component multiplication value “200 × 4” and a G component multiplication value “100 × 4”. , B component multiplication value “80 × 4” is obtained. Similarly, when the color reference pattern 120 is selected in S31 of FIG. 7 and the red cell is selected in S32, the R component multiplication value “210 × 2” and the G component multiplication value “60” for the color reference pattern 120 are selected. × 2 ”and the B component multiplication value“ 70 × 2 ”are obtained. When the color reference pattern 190 is selected in S31 of FIG. 7 and the red cell is selected in S32, the R component multiplication value “220 × 1” and the G component multiplication value “80 ×” for the color reference pattern 190 are selected. 1 ”and the B component multiplication value“ 80 × 1 ”are obtained. When the color reference pattern 180 is selected in S31 of FIG. 7 and the red cell is selected in S32, the process proceeds to No in S33, so that the R component multiplication value and the G component multiplication value for the color reference pattern 180 are processed. , B component multiplication values are both “0”.

赤色セルのR成分基準データは、色参照パターン110、120、180、190のR成分乗算値の総和(200×4+210×2+220×1=1440)を、上記重み付け値の総和「7」で割った値であり、この場合「206」と定められる。同様に、赤色セルのG成分基準データは、色参照パターン110、120、180、190のG成分乗算値の総和(100×4+60×2+80×1=600)を、上記重み付け値の総和「7」で割った値であり、この場合「86」と定められる。また、赤色セルのB成分基準データは、色参照パターン110、120、180、190のR成分乗算値の総和(80×4+70×2+80×1=540)を、上記重み付け値の総和「7」で割った値であり、この場合「77」と定められる。   The R component standard data of the red cell is obtained by dividing the sum of the R component multiplication values (200 × 4 + 210 × 2 + 220 × 1 = 1440) of the color reference patterns 110, 120, 180, and 190 by the sum “7” of the weight values. Value, in this case “206”. Similarly, the G component standard data of the red cell is the sum (100 × 4 + 60 × 2 + 80 × 1 = 600) of the G component multiplication values of the color reference patterns 110, 120, 180, and 190, and the sum of the weight values is “7”. In this case, “86” is determined. Further, the B component standard data of the red cell is the sum of the R component multiplication values (80 × 4 + 70 × 2 + 80 × 1 = 540) of the color reference patterns 110, 120, 180, and 190, and the sum of the weight values is “7”. It is a divided value, and in this case, it is determined as “77”.

上記のように各色の各成分についての基準データ(セル別基準データ)が算出された後には、図6のS27においてセル色を特定する処理を行う。この処理では、例えば、色認識を行おうとするセル(即ち、図5のS12で選択されたセル)のR成分値、G成分値、B成分値を、図7のS39で生成された各色の基準データ(R成分基準データ、G成分基準データ、B成分基準データ)と比較し、基準データの各成分値が着目セルのR成分値、G成分値、B成分値と最も近い色を当該着目セルの色とすることができる。この「最も近い」点についての判断方法は様々に考えられるが、例えば、各色毎に、R成分基準データ、G成分基準データ、B成分基準データのそれぞれと、着目セルのR成分値、G成分値、B成分値それぞれとの差を求めると共にそれら差の絶対値の総和を求めるようにすればよい。この場合、差の絶対値の総和が小さい色を着目セルの色とすることができる。   After the reference data (cell-specific reference data) for each component of each color is calculated as described above, a process for specifying the cell color is performed in S27 of FIG. In this process, for example, the R component value, the G component value, and the B component value of the cell to be color-recognized (that is, the cell selected in S12 of FIG. 5) are obtained from each color generated in S39 of FIG. Compared with the reference data (R component reference data, G component reference data, B component reference data), each component value of the reference data is the color closest to the R component value, G component value, and B component value of the target cell. It can be the color of the cell. There are various methods for determining the “closest” point. For example, for each color, R component reference data, G component reference data, and B component reference data, and the R component value and G component of the cell of interest. What is necessary is just to obtain | require the difference with each value and B component value, and to obtain | require the sum total of the absolute value of those differences. In this case, a color having a small sum of absolute values of differences can be set as the color of the target cell.

図6のセル色認識処理が終わった後には、その着目セルの色(S27で特定された色)を当該色に対応付けられたデータに変換する(S14)。そして、全てのセルについてS13、S14の処理が行われたか否かを判断し、S11で特定された全セルにおいて、S13、S14の処理が行われていないセルが残っている場合には、S15に進み、S12においてその残っているセルのいずれかを選択してS13、S14の処理を繰り返す。このS13の処理では、S12にて新たに着目されたセルに対応する色参照パターン選択処理(S21)、基準作成処理(S26)等が行われることになる。なお、S11で特定された全てのセルについてS13、S14の処理が行われた場合には、S15にてYesに進み、公知の誤り訂正処理(S16)を行った後、デコード処理を終了する。   After the cell color recognition process of FIG. 6 is completed, the color of the target cell (the color specified in S27) is converted into data associated with the color (S14). Then, it is determined whether or not the processes of S13 and S14 have been performed for all the cells, and in all the cells specified in S11, if cells that have not been subjected to the processes of S13 and S14 remain, S15 In S12, any of the remaining cells is selected in S12, and the processes in S13 and S14 are repeated. In the process of S13, a color reference pattern selection process (S21), a standard creation process (S26), and the like corresponding to the cell newly focused in S12 are performed. If the processes of S13 and S14 have been performed for all the cells specified in S11, the process proceeds to Yes in S15, and after performing a known error correction process (S16), the decoding process is terminated.

なお、本実施形態では、図4〜図7の処理を実行する制御回路40が、「色判別手段」の一例に相当し、受光センサ23(撮像手段)によって撮像された二次元コード100のコード画像において、各セル画像の表示色を、各セル画像から得られる色情報(各成分値)と色参照パターンの画像から得られる色情報とに基づいてそれぞれ判別するように機能する。   In the present embodiment, the control circuit 40 that executes the processes of FIGS. 4 to 7 corresponds to an example of a “color determination unit”, and the code of the two-dimensional code 100 captured by the light receiving sensor 23 (imaging unit). In the image, the display color of each cell image functions to be discriminated based on the color information (each component value) obtained from each cell image and the color information obtained from the color reference pattern image.

また、S26の処理を行い得る制御回路40は、「設定手段」の一例に相当し、各セル画像の表示色を判別する際の、各色参照パターンの各々の「寄与度合」を、各セル画像毎に設定するように機能する。   The control circuit 40 capable of performing the processing of S26 corresponds to an example of “setting means”, and determines the “contribution degree” of each color reference pattern when determining the display color of each cell image. It works to set every time.

また、S21、S33の処理を行い得る制御回路40は、「選択手段」の一例に相当し、各セル画像毎に、複数の色参照パターンの中から色判別に寄与させる基準パターンを選択するように機能する。   The control circuit 40 capable of performing the processes of S21 and S33 corresponds to an example of “selecting means”, and selects a reference pattern that contributes to color discrimination from a plurality of color reference patterns for each cell image. To work.

また、S33の処理を行い得る制御回路40は、「判断手段」の一例に相当し、各色参照パターンのいずれかのセルに汚れが生じているか否かを判断するように機能する。   The control circuit 40 capable of performing the process of S33 corresponds to an example of “determination means” and functions to determine whether any cell of each color reference pattern is contaminated.

また、「色判別手段」に相当する制御回路40は、複数の色参照パターンの各画像からそれぞれ得られる色情報と、各セル画像毎に設定される寄与度合とに基づいて、各セル画像の色判別に用いるセル別基準データを生成し(S39:図7)、各セル画像の表示色を、各セル画像から得られる色情報(各成分値)と各セル画像に対応するセル別基準データ(S39で生成された基準データ)とに基づいて判別するように機能している。具体的には、各セル画像の色判別に用いる「セル別基準データ」を、上記「選択手段」によって各セル画像毎に選択された基準パターンに基づいてそれぞれ生成するように機能している。また、上記「選択手段」によって選択された基準パターンにおいて、いずれかのセルに汚れが生じている場合、その汚れが生じている基準パターンにおけるその汚損セルを除いた部分の色情報に基づいてセル別基準データを生成するように機能している。   Further, the control circuit 40 corresponding to the “color discriminating means”, based on the color information obtained from each image of a plurality of color reference patterns and the contribution degree set for each cell image, Cell-specific reference data used for color discrimination is generated (S39: FIG. 7), the display color of each cell image is the color information (each component value) obtained from each cell image, and the cell-specific reference data corresponding to each cell image. It functions to discriminate based on (reference data generated in S39). Specifically, it functions to generate “cell-specific reference data” used for color determination of each cell image based on the reference pattern selected for each cell image by the “selecting means”. In addition, in the reference pattern selected by the “selecting means”, if any cell is contaminated, the cell is based on the color information of the portion excluding the contaminated cell in the reference pattern where the contamination is generated. It functions to generate different reference data.

(本実施形態の主な効果)
本実施形態に係る二次元コード読取装置1では、各セル画像の表示色を判別する際の各色参照パターンの各々の寄与度合を、各セル画像毎に設定しており、複数の色参照パターンの各画像からそれぞれ得られる色情報と、各セル画像毎に設定される寄与度合とに基づいて、各セル画像の色判別に用いるセル別基準データを生成している。そして、各セル画像の表示色を、各セル画像から得られる色情報(各成分値)と各セル画像に対応するセル別基準データとに基づいて判別している。このようにすると、各セル画像毎に色判別に用いる基準データ(セル別基準データ)を定めることができ、各セルの色判定を精度高く適切に行いやすくなる。
(Main effects of this embodiment)
In the two-dimensional code reading device 1 according to the present embodiment, the degree of contribution of each color reference pattern when determining the display color of each cell image is set for each cell image, and a plurality of color reference patterns are displayed. Based on the color information obtained from each image and the contribution level set for each cell image, reference data for each cell used for color discrimination of each cell image is generated. Then, the display color of each cell image is determined based on the color information (each component value) obtained from each cell image and the reference data for each cell corresponding to each cell image. In this way, it is possible to determine reference data (reference data for each cell) used for color discrimination for each cell image, and it is easy to accurately and appropriately perform color determination for each cell.

また、各セル画像毎の設定において、セル画像から複数の色参照パターンそれぞれまでの距離を算出し、各色参照パターン毎に、セル画像からの距離に応じた重み付けをして寄与度合をそれぞれ設定している。このようにすると、各セル画像の基準データ(セル別基準データ)を設定する際に、各色参照パターンまでの距離を適切に考慮して、各色参照パターンの寄与度合を定めることができ、より近い距離の色参照パターンを重視した適切な基準設定が可能となる。   Also, in the setting for each cell image, the distance from the cell image to each of a plurality of color reference patterns is calculated, and the contribution degree is set by weighting each color reference pattern according to the distance from the cell image. ing. In this way, when setting the standard data (standard data for each cell) of each cell image, the degree of contribution of each color reference pattern can be determined by appropriately considering the distance to each color reference pattern, and closer. Appropriate standard setting that emphasizes the color reference pattern of the distance can be performed.

また、各セル画像毎に、複数の色参照パターンの中から色判別に寄与させる基準パターンを選択しており、その選択された基準パターンに基づいて、各セル画像の色判別に用いるセル別基準データを生成している。このようにすると、各セル画像の判別に用いるセル別基準データを、それぞれ、寄与させるべき色参照パターンによって生成することができ、寄与させるべきでない色参照パターンを排除した適切な基準設定が可能となる。   In addition, for each cell image, a standard pattern that contributes to color discrimination is selected from among a plurality of color reference patterns. Based on the selected standard pattern, a cell-specific standard used for color discrimination of each cell image Data is being generated. In this way, the cell-specific standard data used for discrimination of each cell image can be generated based on the color reference pattern that should be contributed, and appropriate standard setting that eliminates the color reference pattern that should not be contributed is possible. Become.

具体的には図6のS21に示すように、各セル画像の色判別に寄与させる基準パターンを、複数の色参照パターンの中から各セル画像からの距離に基づいて選択している。このようにすると、寄与させるべきでない遠い距離にある色参照パターンを排除して、各セル画像の判別に用いる基準データ(セル別基準データ)を生成することができ、一層適切な基準設定が可能となる。   Specifically, as shown in S21 of FIG. 6, a reference pattern that contributes to the color discrimination of each cell image is selected from a plurality of color reference patterns based on the distance from each cell image. In this way, it is possible to eliminate the color reference pattern at a distant distance that should not be contributed, and to generate standard data (standard data for each cell) used for discrimination of each cell image, thereby enabling more appropriate standard setting It becomes.

また、上記実施形態では、S21で選択された色参照パターン(基準パターン)において、いずれかのセルに汚れが生じている場合、その汚れが生じている基準バターンについては、汚損セルを除いた部分の色情報をセル別基準データに反映させている。このようにすると、寄与させるべき基準パターンを反映させつつ汚損セルの影響を排除してセル別基準データを生成することができる。従って、各セル画像の基準設定に際し、適切な色参照パターン(基準パターン)の適切な部分のみを選択的に取り入れ、より望ましいセル別基準データを生成することができる。   In the above embodiment, in the color reference pattern (standard pattern) selected in S21, if any cell is contaminated, the reference pattern in which the contamination is generated is a portion excluding the contaminated cell. Color information is reflected in the reference data for each cell. In this way, the reference data for each cell can be generated while reflecting the reference pattern to be contributed and eliminating the influence of the fouling cell. Therefore, when setting the standard of each cell image, it is possible to selectively incorporate only an appropriate portion of an appropriate color reference pattern (standard pattern) and generate more desirable cell-specific reference data.

また、汚れを判断するための固定値(図9のような各基準範囲)を予めメモリ35(記憶手段)に記憶する方式を用いる場合、各色参照パターンの画像から得られる色情報(各色の各成分値)を固定値と比較することで、各色参照パターンに汚れが生じているか否かを判断することができる。このようにすると、各色参照パターンに汚れが生じているか否かを簡易な構成で適切に判断できるようになる。   In addition, when using a method in which a fixed value for determining dirt (each standard range as shown in FIG. 9) is stored in the memory 35 (storage means) in advance, color information (each color of each color) obtained from the image of each color reference pattern is used. By comparing the (component value) with a fixed value, it is possible to determine whether each color reference pattern is contaminated. This makes it possible to appropriately determine whether or not each color reference pattern is contaminated with a simple configuration.

また、二次元コード内に存在する一部の色参照パターンの色情報に基づいて汚れを判断するための基準値を生成する方式を用いる場合、各色参照パターンの画像から得られる色情報(各色の各成分値)を基準値と比較(例えば、図10(a)のような平均値に基づいて定められる基準範囲(図10(b))と比較)することで、各色参照パターンに汚れが生じているか否かを判断することができる。このようにすると、二次元コード内の色参照パターンの色情報に基づいて、各色参照パターンの汚れを相対的に判断することができ、読取環境が多様に変化しても汚れを適切に判断できる。   In addition, when using a method for generating a reference value for determining a stain based on color information of a part of color reference patterns existing in the two-dimensional code, color information obtained from an image of each color reference pattern (for each color) Each component value) is compared with a reference value (for example, compared with a reference range (FIG. 10B) determined based on an average value as shown in FIG. 10A), so that each color reference pattern is stained. It can be determined whether or not. In this way, it is possible to relatively determine the stain of each color reference pattern based on the color information of the color reference pattern in the two-dimensional code, and to appropriately determine the stain even if the reading environment changes in various ways. .

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

上記実施形態では、読取対象となる二次元コード100において、3行3列で構成され8色のセルを有する色参照パターンが設けられた例を示したが、色参照パターンの構成はこれに限定されず、他の色参照パターンであっても本発明を同様に適用できる。例えば、図12(a)のような2行2列の3色の色参照パターンが用いられていてもよく、図12(b)のように、4行4列の16色の色参照パターンが用いられていてもよい。   In the above-described embodiment, an example in which a color reference pattern having eight rows of cells configured in three rows and three columns is provided in the two-dimensional code 100 to be read has been described. However, the configuration of the color reference pattern is limited to this. However, the present invention can be similarly applied to other color reference patterns. For example, a color reference pattern of 3 colors of 2 rows and 2 columns as shown in FIG. 12A may be used, and a color reference pattern of 16 colors of 4 rows and 4 columns as shown in FIG. It may be used.

上記実施形態では、基準作成に際し、着目するセル近傍の4つの色参照パターンを用いる例を示したが、この方法に限定されない。例えば、図13のように着目するセル近傍の3つの色参照パターンを基準作成に用いるようにしてもよく、各セルの基準作成に際し、二次元コード内の全ての色参照パターンを用いるようにしてもよい。   In the above-described embodiment, an example in which four color reference patterns in the vicinity of a target cell are used in creating a standard is shown, but the present invention is not limited to this method. For example, as shown in FIG. 13, three color reference patterns in the vicinity of the cell of interest may be used for creating a standard. When creating a standard for each cell, all the color reference patterns in the two-dimensional code are used. Also good.

上記実施形態では、S21で選択された色参照パターン(基準パターン)において、いずれかのセルに汚れが生じている場合、基準パターンにおけるその汚損セルを除いた部分の色情報に基づいてセル別基準データを生成していたが、いずれかのセルに汚れが生じている場合、その色参照パターン全体を排除するようにしてもよい。この場合、図7の処理において、S35を省略し、S33にてNoに進む場合には、着目している色参照パターンを選択対象(基準パターン)から除外する処理を行い、S31の処理に戻るように基準作成処理を変更すればよい。このようにすると、汚れが生じている色参照パターンを除いてセル別基準データを生成することができるため、汚れの影響を排除した精度の高い色判別が可能となる。   In the above-described embodiment, if any cell is soiled in the color reference pattern (standard pattern) selected in S21, the cell-based standard is based on the color information of the portion of the standard pattern excluding the dirty cell. Although data has been generated, if any cell is contaminated, the entire color reference pattern may be excluded. In this case, in the process of FIG. 7, when S35 is omitted and the process proceeds to No in S33, a process of excluding the focused color reference pattern from the selection target (standard pattern) is performed, and the process returns to S31. The reference creation process may be changed as described above. In this way, since the cell-basis standard data can be generated except for the color reference pattern in which the stain is generated, it is possible to perform color discrimination with high accuracy without the influence of the stain.

上記実施形態では、二次元コード内の一部の色参照パターン(S21で選択される色参照パターン)に基づいて、図10(a)のような平均値を求め、図10(b)のような基準範囲を設定する例を説明したが、二次元コード内の全部の色参照パターンに基づいて図10(a)のような平均値を求め、図10(b)のような基準範囲を設定するようにしてもよい。   In the above embodiment, an average value as shown in FIG. 10A is obtained based on a part of the color reference patterns (color reference patterns selected in S21) in the two-dimensional code, as shown in FIG. An example of setting a standard range has been described, but an average value as shown in FIG. 10A is obtained based on all the color reference patterns in the two-dimensional code, and a standard range as shown in FIG. 10B is set. You may make it do.

1…二次元コード読取装置
23…受光センサ(撮像手段)
35…メモリ(記憶手段)
40…制御回路(色判別手段,設定手段,選択手段,判断手段)
100…二次元コード
110,120,130,140,150,160,170,180,190…色参照パターン
C…セル
DESCRIPTION OF SYMBOLS 1 ... Two-dimensional code reader 23 ... Light receiving sensor (imaging means)
35 ... Memory (storage means)
40. Control circuit (color discrimination means, setting means, selection means, determination means)
100 ... Two-dimensional code 110, 120, 130, 140, 150, 160, 170, 180, 190 ... Color reference pattern
C ... cell

Claims (8)

複数のセルが矩形領域内に二次元的に配置されると共に、各々のセルの色彩又は濃度又は輝度により符号化された情報がカラー表現され、且つ前記矩形領域内に各セルに使用するセル表示色の基準となる色参照パターンが複数設けられた二次元コードを読取可能な二次元コード読取装置であって、
前記二次元コードを撮像する撮像手段と、
前記撮像手段によって撮像された前記二次元コードのコード画像において、各セル画像の表示色を、前記各セル画像から得られる色情報と前記色参照パターンの画像から得られる色情報とに基づいてそれぞれ判別する色判別手段と、
前記各セル画像の前記表示色を判別する際の前記各色参照パターンの各々の寄与度合を、前記各セル画像毎に設定する設定手段と、
を備え、
前記設定手段は、前記各セル画像毎の設定において、着目する前記セル画像から複数の前記色参照パターンそれぞれまでの距離を算出し、前記各色参照パターン毎に、着目する前記セル画像からの前記距離に応じた重み付けをして前記寄与度合をそれぞれ設定する構成であり、
前記色判別手段は、
複数のセルの画像からなる前記色参照パターンにおいて、複数の前記色参照パターンの前記画像からそれぞれ得られる色情報と、前記各セル画像毎に設定される前記寄与度合とに基づいて、前記各セル画像の色判別に用いるセル別基準データを生成し、
前記各セル画像の前記表示色を、前記各セル画像から得られる色情報と前記各セル画像に対応する前記セル別基準データとに基づいて判別することを特徴とする二次元コード読取装置。
A plurality of cells are two-dimensionally arranged in the rectangular area, and the information encoded by the color, density or brightness of each cell is expressed in color, and the cell display used for each cell in the rectangular area A two-dimensional code reader capable of reading a two-dimensional code provided with a plurality of color reference patterns serving as color standards,
Imaging means for imaging the two-dimensional code;
In the code image of the two-dimensional code imaged by the imaging means, the display color of each cell image is based on color information obtained from each cell image and color information obtained from the image of the color reference pattern, respectively. Color discriminating means for discriminating;
Setting means for the contribution degree of each of the respective color reference pattern when determining the display color of each cell image, set the in each cell image,
With
In the setting for each cell image, the setting unit calculates a distance from the cell image of interest to each of the plurality of color reference patterns, and the distance from the cell image of interest for each color reference pattern Is configured to set the contribution degree by weighting according to
The color discrimination means
In the color reference pattern composed of images of a plurality of cells, each cell based on color information obtained from each of the images of the plurality of color reference patterns and the contribution set for each cell image Generate cell-specific reference data to be used for image color discrimination,
The two-dimensional code reading apparatus characterized in that the display color of each cell image is determined based on color information obtained from each cell image and the reference data for each cell corresponding to each cell image.
前記設定手段は、前記各セル画像毎に、複数の前記色参照パターンの中から色判別に寄与させる基準パターンを選択する選択手段を備え、
前記色判別手段は、前記各セル画像の色判別に用いる前記セル別基準データを、前記選択手段によって前記各セル画像毎に選択された前記基準パターンに基づいてそれぞれ生成することを特徴とする請求項に記載の二次元コード読取装置。
The setting means includes a selection means for selecting a standard pattern that contributes to color discrimination from among the plurality of color reference patterns for each cell image,
The color discriminating unit generates the cell-specific reference data used for color discrimination of each cell image based on the reference pattern selected for each cell image by the selection unit. Item 2. The two-dimensional code reader according to Item 1 .
前記選択手段は、前記各セル画像毎に、前記各セル画像の色判別に寄与させる前記基準パターンを、複数の前記色参照パターンの中から前記各セル画像からの距離に基づいて選択することを特徴とする請求項に記載の二次元コード読取装置。 The selection means selects, for each cell image, the reference pattern that contributes to color discrimination of each cell image based on a distance from each cell image from among the plurality of color reference patterns. The two-dimensional code reader according to claim 2 , wherein 前記選択手段は、
前記色参照パターンに汚れが生じているか否かを判断する判断手段を備え、
複数の前記色参照パターンの内の前記判断手段によって汚れが生じていないと判断されたパターンを前記基準パターンとして選択することを特徴とする請求項又は請求項に記載の二次元コード読取装置。
The selection means includes
A judging means for judging whether or not the color reference pattern is soiled;
Two-dimensional code reader according to pattern determined that is not occurring soiled by the determining means of the plurality of the color reference pattern to claim 2 or claim 3, characterized in that selected as the reference pattern .
前記各色参照パターンのいずれかのセルの前記画像に汚れが生じているか否かを判断する判断手段を備え、
前記色判別手段は、前記選択手段によって選択された前記基準パターンにおいて、いずれかのセルに汚れが生じている場合、前記基準パターンにおけるその汚損セルを除いた部分の色情報に基づいて前記セル別基準データを生成することを特徴とする請求項又は請求項に記載の二次元コード読取装置。
Comprising a determining means for determining whether said fouling on an image of one of the cells of each color reference pattern occurs,
In the reference pattern selected by the selection unit, the color determination unit, when any cell is contaminated, the color discrimination unit, based on the color information of the portion excluding the contamination cell in the reference pattern. two-dimensional code reading apparatus according to claim 2 or claim 3, characterized in that to generate the reference data.
前記汚れを判断するための固定値が予め記憶手段に記憶されており、
前記判断手段は、前記各色参照パターンの画像から得られる色情報を前記固定値と比較することで、前記各色参照パターンに前記汚れが生じているか否かを判断することを特徴とする請求項又は請求項に記載の二次元コード読取装置。
A fixed value for determining the dirt is stored in the storage means in advance,
Said determination means, said by the color information obtained from the image of each color reference pattern is compared with the fixed value, according to claim 4, characterized in that determining whether the dirt to the each color reference pattern occurs Or the two-dimensional code reader of Claim 5 .
前記判断手段は、
前記二次元コード内に存在する一部又は全部の前記色参照パターンの色情報に基づいて前記汚れを判断するための基準値を生成し、
前記各色参照パターンの画像から得られる色情報を前記基準値と比較することで、前記各色参照パターンに前記汚れが生じているか否かを判断することを特徴とする請求項又は請求項に記載の二次元コード読取装置。
The determination means includes
Generating a reference value for determining the stain based on color information of a part or all of the color reference pattern existing in the two-dimensional code;
Wherein by the color information obtained from the image of each color reference pattern is compared with the reference value, to claim 4 or claim 5, characterized in that determining whether the dirt to the each color reference pattern occurs The two-dimensional code reading device described.
複数のセルが矩形領域内に二次元的に配置されると共に、各々のセルの色彩又は濃度又は輝度により符号化された情報がカラー表現され、且つ前記矩形領域内に各セルに使用するセル表示色の基準となる色参照パターンが複数設けられた二次元コードを読み取る読取方法であって、
撮像手段によって前記二次元コードを撮像し、
前記撮像手段によって撮像された前記二次元コードのコード画像を記憶手段に記憶し、
前記コード画像を構成する各セル画像の表示色を判別する際の前記各色参照パターンの各々の寄与度合を、設定手段により、着目する前記セル画像から複数の前記色参照パターンそれぞれまでの距離を算出し、前記各色参照パターン毎に、着目する前記セル画像からの前記距離に応じた重み付けをして前記寄与度合をそれぞれ設定する方法で前記各セル画像毎に設定し、
更に、色判別手段により、複数のセルの画像からなる前記色参照パターンにおいて、複数の前記色参照パターンの前記画像からそれぞれ得られる色情報と、前記各セル画像毎に設定される前記寄与度合とに基づいて、前記各セル画像の色判別に用いるセル別基準データを生成し、且つ前記各セル画像から得られる色情報と前記各セル画像に対応する前記セル別基準データとに基づいて前記各セル画像の前記表示色を判別することを特徴とする二次元コードの読取方法。
A plurality of cells are two-dimensionally arranged in the rectangular area, and the information encoded by the color, density or brightness of each cell is expressed in color, and the cell display used for each cell in the rectangular area A reading method for reading a two-dimensional code provided with a plurality of color reference patterns serving as color standards,
Imaging the two-dimensional code by imaging means,
Storing the code image of the two-dimensional code imaged by the imaging means in a storage means;
The contribution degree of each of the color reference pattern when determining the display color of each cell images forming the code image, and more setting means, a distance from the focused the cell image to the plurality of said color reference pattern Calculating, for each color reference pattern, weighting according to the distance from the cell image of interest and setting the degree of contribution for each cell image,
Further, in the color reference pattern composed of images of a plurality of cells by the color discrimination means, color information obtained from the images of the plurality of color reference patterns, and the contribution degree set for each of the cell images, Based on the color information obtained from each cell image and the cell-specific reference data corresponding to each cell image A method for reading a two-dimensional code, wherein the display color of a cell image is determined.
JP2009121672A 2009-05-20 2009-05-20 Two-dimensional code reader Expired - Fee Related JP5267323B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009121672A JP5267323B2 (en) 2009-05-20 2009-05-20 Two-dimensional code reader

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009121672A JP5267323B2 (en) 2009-05-20 2009-05-20 Two-dimensional code reader

Publications (2)

Publication Number Publication Date
JP2010271812A JP2010271812A (en) 2010-12-02
JP5267323B2 true JP5267323B2 (en) 2013-08-21

Family

ID=43419801

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009121672A Expired - Fee Related JP5267323B2 (en) 2009-05-20 2009-05-20 Two-dimensional code reader

Country Status (1)

Country Link
JP (1) JP5267323B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6590335B2 (en) * 2015-04-14 2019-10-16 株式会社テララコード研究所 Two-dimensional code and method for reading the two-dimensional code
WO2024062844A1 (en) * 2022-09-21 2024-03-28 株式会社デンソー Information code, code generation method, and code reading method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10283446A (en) * 1997-04-08 1998-10-23 Nippon I D Tec Kk Multicolor recording type matrix code recording sheet
JP3923796B2 (en) * 2001-12-11 2007-06-06 株式会社リコー Two-dimensional code, two-dimensional code creation method, two-dimensional code decoding method, apparatus for executing the method, program for executing the method on a computer, and computer-readable recording medium recording the program

Also Published As

Publication number Publication date
JP2010271812A (en) 2010-12-02

Similar Documents

Publication Publication Date Title
JP3996520B2 (en) Two-dimensional information code and generation method thereof
US9711113B2 (en) Information code, information code producing method, information code reader, and system which uses information code
JP4054184B2 (en) Defective pixel correction device
CN104052979B (en) For device and the technology of image processing
JP2007201530A (en) Pixel defect correction apparatus
CN102685511A (en) Image processing apparatus and image processing method
JP2011186613A (en) Method for creating and method for decoding two-dimensional color code
JP2021119465A (en) Enhanced matrix symbol error correction method
JP2009259187A (en) Information code, method for generating information code, and display method for information code
CN107018407A (en) Information processor, evaluation figure, evaluation system and method for evaluating performance
JP5267323B2 (en) Two-dimensional code reader
JP2019168388A (en) Image inspection method and image inspection device
EP1976308A2 (en) Device and method for measuring noise characteristics of image sensor
CN102204239A (en) Single row based defective pixel correction
JP2010061217A (en) Two-dimensional code
JP5381944B2 (en) Optical information reader
JP2014116706A (en) Two-dimensional color code display apparatus, display method, reading device, and reading method
JP4241803B2 (en) Two-dimensional information code reading method and reading apparatus
JP2011054211A (en) Two-dimensional code dividing and displaying method, two-dimensional code reading method, and two-dimensional code reader
JP5293853B1 (en) Bar code reader
CN112042185B (en) Image sensor and related electronic device
KR20150009842A (en) System for testing camera module centering and method for testing camera module centering using the same
JP7024665B2 (en) Information code, information code generation method, information code generator and information code reading system
JP2011197856A (en) Optical information reading device
JP5218281B2 (en) Information code reader

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20110822

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20121108

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20121204

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130201

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130222

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130422

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

Ref document number: 5267323

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

LAPS Cancellation because of no payment of annual fees