JP4653215B2 - Code recognition method and apparatus, electronic apparatus, program, and storage medium - Google Patents

Code recognition method and apparatus, electronic apparatus, program, and storage medium Download PDF

Info

Publication number
JP4653215B2
JP4653215B2 JP2008506069A JP2008506069A JP4653215B2 JP 4653215 B2 JP4653215 B2 JP 4653215B2 JP 2008506069 A JP2008506069 A JP 2008506069A JP 2008506069 A JP2008506069 A JP 2008506069A JP 4653215 B2 JP4653215 B2 JP 4653215B2
Authority
JP
Japan
Prior art keywords
code
color
plane
feature amount
rectangular area
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
JP2008506069A
Other languages
Japanese (ja)
Other versions
JPWO2007108053A1 (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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Publication of JPWO2007108053A1 publication Critical patent/JPWO2007108053A1/en
Application granted granted Critical
Publication of JP4653215B2 publication Critical patent/JP4653215B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/12Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using a selected wavelength, e.g. to sense red marks and ignore blue marks

Description

本発明は、コード認識方法及び装置、電子装置、プログラム及び記憶媒体に係り、特に画像データに含まれる一次元コードや二次元コードを認識するコード認識方法及び装置、電子装置、プログラム及びコンピュータ読み取り可能な記憶媒体に関する。   The present invention relates to a code recognition method and apparatus, an electronic apparatus, a program, and a storage medium, and in particular, a code recognition method and apparatus for recognizing a one-dimensional code or a two-dimensional code included in image data, an electronic apparatus, a program, and a computer readable medium. The present invention relates to a storage medium.

図1は、一次元バーコードと二次元コードの一例を示す図である。近年、従来の一次元バーコードよりも多くの情報を埋め込むことができる二次元コードの普及が進んでいる。二次元コードでは、コード全体の二次元配列データを読み取らないとコードを認識できない。このため、二次元コードの読取りには、デジタルカメラやイメージスキャナのような画像読取装置が用いられる。   FIG. 1 is a diagram illustrating an example of a one-dimensional barcode and a two-dimensional code. In recent years, two-dimensional codes that can embed more information than conventional one-dimensional barcodes have become popular. In the two-dimensional code, the code cannot be recognized unless the two-dimensional array data of the entire code is read. For this reason, an image reading device such as a digital camera or an image scanner is used for reading the two-dimensional code.

二次元コードの普及に伴い、単一の画像読取装置を用いて一次元コード及び二次元コードの両方を自動的に認識する方法が提案されている。特許文献1では、読み取ったコードの画像データを矩形ブロックに区切り、随時走査しながら所定の条件を満たす、一次元又は二次元コードを含むブロックを特定してコードの認識を行う方法が提案されている。しかし、これらのコード認識方法は、従来より広く使用されている黒色で印刷されたコードを認識対象としており、認識に使用する画像データも単一、即ち、グレイスケールの色プレーンを使用することが前提となっている。   With the widespread use of two-dimensional codes, a method for automatically recognizing both one-dimensional codes and two-dimensional codes using a single image reading apparatus has been proposed. Patent Document 1 proposes a method for recognizing a code by identifying a block including a one-dimensional or two-dimensional code that divides image data of a read code into rectangular blocks and scans as needed and satisfies a predetermined condition. Yes. However, these code recognition methods recognize a code printed in black, which has been widely used in the past, and the image data used for recognition may be a single, that is, a gray-scale color plane. It is a premise.

二次元コードの普及に伴い、デザイン性の観点等から、黒色以外の色で印刷されたコードの使用が増加している。しかし、従来のコード認識方法は、認識対象のコートが黒色であるという前提に合わせて単一(グレイスケール)の色プレーン画像を用いてコードの認識を行うため、黒色以外の色で作成されたコードの認識は難しい。   With the spread of two-dimensional codes, the use of codes printed in colors other than black is increasing from the viewpoint of design and the like. However, since the conventional code recognition method recognizes code using a single (grayscale) color plane image in accordance with the assumption that the coat to be recognized is black, it was created in a color other than black. The code is difficult to recognize.

グレイスケールの色プレーンを使用して黒色以外の色で印刷されたコードを認識する場合の問題についてより具体的に説明する。グレイスケール(Y)と赤(R)、緑(G)、青(B)の各色プレーンの階調値は、一般に次の関係にある。   The problem in the case of recognizing a code printed in a color other than black using a gray scale color plane will be described more specifically. The gradation values of the gray scale (Y), red (R), green (G), and blue (B) color planes generally have the following relationship.

Y = 0.299 × R + 0.587 × G + 0.114 × B
通常、コードは黒(R = G = B = 0)、背景は白(R = G = B = 255)で印刷されるため、Yでのコードと背景の階調差は255となる。ここで、コードが赤(R = 255、G = B = 0)で印刷されている場合、コードのYへの寄与は29%(Y = 76)となり、Yでのコードと背景の階調差は179と低下する。このように階調差が低下する分、コードを正確に認識することは難しくなる。
特開2005−173646号公報
Y = 0.299 × R + 0.587 × G + 0.114 × B
Normally, the code is printed in black (R = G = B = 0) and the background is printed in white (R = G = B = 255), so the tone difference between the code in Y and the background is 255. Here, when the code is printed in red (R = 255, G = B = 0), the contribution of the code to Y is 29% (Y = 76), and the tone difference between the code and the background in Y Decreases to 179. As the tone difference decreases in this way, it is difficult to accurately recognize the code.
JP 2005-173646 A

このように、従来のコード認識方法は、読み取り対象となるコードが黒色であるという前提で考えられているため、黒色以外の色のコードを正確に認識することは難しいという問題があった。   As described above, since the conventional code recognition method is considered on the assumption that the code to be read is black, there is a problem that it is difficult to accurately recognize codes of colors other than black.

しかし、従来のコード認識方法は、黒色で印刷される一次元バーコードの認識から始まり二次元コードの認識へと発展してきたため、黒色以外の色のコードが読み取り対象になることは想定されておらず、従来は、黒色以外の色のコードを認識するための認識技術自体が提案されていなかった。   However, since the conventional code recognition method has started from the recognition of a one-dimensional bar code printed in black and has evolved into the recognition of a two-dimensional code, it is not assumed that codes of colors other than black will be read. Conventionally, a recognition technique itself for recognizing codes other than black has not been proposed.

そこで、本発明は、コードの色にかかわらずコードを正確に認識可能とすることのできるコード認識方法及び装置、電子装置、プログラム及び記憶媒体を提供することを目的とする。   Accordingly, an object of the present invention is to provide a code recognition method and apparatus, an electronic apparatus, a program, and a storage medium that can accurately recognize a code regardless of the color of the code.

上記の課題は、読み取ったコードのカラー画像データを複数の色プレーンの色成分に分割するステップと、1つの色プレーンを選択する選択ステップと、選択された色プレーンの色成分データに基づいてコードを認識する認識ステップとを含むことを特徴とするコード認識方法によって達成できる。   The problems described above include a step of dividing the color image data of the read code into color components of a plurality of color planes, a selection step of selecting one color plane, and a code based on the color component data of the selected color plane. And a recognition step for recognizing the code.

上記の課題は、読み取ったコードのカラー画像データを複数の色プレーンの色成分に分割する手段と、1つの色プレーンを選択する選択手段と、選択された色プレーンの色成分データに基づいてコードを認識する認識手段とを備えたことを特徴とするコード認識方法によっても達成できる。   The above problem is that the color image data of the read code is divided into color components of a plurality of color planes, a selection unit that selects one color plane, and a code based on the color component data of the selected color plane. It can also be achieved by a code recognition method characterized by comprising recognition means for recognizing.

上記の課題は、コードを読み取る画像読み取り装置と、上記の如きコード認識装置とを備えたことを特徴とする電子装置によっても達成できる。   The above object can also be achieved by an electronic device comprising an image reading device for reading a code and the code recognition device as described above.

上記の課題は、コンピュータを、上記の如きコード認識装置として動作させる手順を含むことを特徴とするプログラムによっても達成できる。   The above object can also be achieved by a program including a procedure for causing a computer to operate as the code recognition device as described above.

上記の課題は、コンピュータを、上記の如き電子装置として動作させる手順を含むことを特徴とするプログラムによっても達成できる。   The above problem can also be achieved by a program including a procedure for causing a computer to operate as the electronic device as described above.

上記の課題は、上記の如きプログラムを格納したことを特徴とするコンピュータ読み取り可能な記憶媒体によっても達成できる。   The above object can also be achieved by a computer-readable storage medium characterized by storing the above program.

本発明によれば、コードの色にかかわらずコードを正確に認識可能とすることのできるコード認識方法及び装置、電子装置、プログラム及び記憶媒体を実現できる。   According to the present invention, it is possible to realize a code recognition method and apparatus, an electronic apparatus, a program, and a storage medium capable of accurately recognizing a code regardless of the color of the code.

一次元バーコードと二次元コードの一例を示す図である。It is a figure which shows an example of a one-dimensional barcode and a two-dimensional code. 本発明になる電子装置の一実施例の要部を示すブロック図である。It is a block diagram which shows the principal part of one Example of the electronic device which becomes this invention. 本発明の一実施例の動作を説明するフローチャートである。It is a flowchart explaining operation | movement of one Example of this invention. ブロックの抽出を説明する図である。It is a figure explaining extraction of a block. ブロックの特徴量の算出を二次元コードについてより詳細に説明するフローチャートである。It is a flowchart explaining calculation of the feature-value of a block in detail about a two-dimensional code. 一次元コードの水平方向エッジ数及び垂直方向エッジ数を説明する図である。It is a figure explaining the number of horizontal direction edges and the number of vertical direction edges of a one-dimensional code. 二次元コードの水平方向エッジ数及び垂直方向エッジ数を説明する図である。It is a figure explaining the number of horizontal direction edges and the number of vertical direction edges of a two-dimensional code. ブロックの特徴量の算出を一次元コードについてより詳細に説明するフローチャートである。It is a flowchart explaining calculation of the feature-value of a block in detail about a one-dimensional code. 一次元コードの水平ライン間相関及び垂直ライン間相関を説明する図である。It is a figure explaining the correlation between horizontal lines and the correlation between vertical lines of a one-dimensional code. 二次元コードの水平ライン間相関及び垂直ライン間相関を説明する図である。It is a figure explaining the correlation between horizontal lines and the correlation between vertical lines of a two-dimensional code. コードと他の情報が重ね合わされている場合のコード認識を説明する図である。It is a figure explaining code recognition in case a code and other information are piled up. 本発明になるコード認識装置の他の実施例を説明するブロック図である。It is a block diagram explaining the other Example of the code recognition apparatus which becomes this invention.

符号の説明Explanation of symbols

1 電子装置
9 画像読取装置
10 CPU
11 ROM
12 RAM
13 通信インタフェース
14 記憶装置
15 入出力装置
16 媒体ドライブ
18 情報提供者
19 ネットワーク
20 記録媒体
31 二次元コード
41 一次元コード
51 コード認識装置
1 Electronic device 9 Image reading device 10 CPU
11 ROM
12 RAM
13 Communication interface 14 Storage device 15 Input / output device 16 Media drive 18 Information provider 19 Network 20 Recording medium 31 Two-dimensional code 41 One-dimensional code 51 Code recognition device

本発明では、読み取ったコードの画像データを複数の色プレーンの色成分に分割し、選択された色プレーンの色成分データに基づいてコードを認識する。選択される色プレーンは、予め決められていても、コード内の領域の特徴量が大きい、或いは、階調値が小さい色プレーンを自動的に選択するようにしても良い。特に後者の場合、色プレーンによって画像特徴が異なるコードであっても確実に、且つ、正確に認識可能となる。又、特徴量に基づいて、コードが一次元コードであるか二次元コードであるかの判断を行うようにしても良い。   In the present invention, the image data of the read code is divided into color components of a plurality of color planes, and the code is recognized based on the color component data of the selected color plane. The color plane to be selected may be determined in advance, or a color plane having a large feature amount in the code or a small gradation value may be automatically selected. Particularly in the latter case, even if the code has different image characteristics depending on the color plane, the code can be reliably and accurately recognized. Further, based on the feature amount, it may be determined whether the code is a one-dimensional code or a two-dimensional code.

読み取りの対象となるコードに使用される色が予めわかっている場合には、分割される色プレーンの数は2以上であれば良い。   When the color used for the code to be read is known in advance, the number of color planes to be divided may be two or more.

他方、読み取りの対象となるコードに使用される色が予めわかっていない場合には、分割される色プレーンの数を3以上、好ましくは少なくとも三原色の色プレーンを用いることで、確実にコードの認識を行うことが可能である。この場合、読み取ったコードの色に適した色プレーンを自動的に選択して認識処理を行うことが可能となるため、どのような色のコードであっても確実に、且つ、正確に認識可能となる。   On the other hand, when the color used for the code to be read is not known in advance, the number of color planes to be divided is 3 or more, preferably at least three primary color planes, so that the code can be recognized reliably. Can be done. In this case, it is possible to automatically select a color plane suitable for the color of the read code and perform recognition processing, so that any color code can be recognized reliably and accurately. It becomes.

以下に、本発明になるコード認識方法及び装置、電子装置、プログラム及び記憶媒体の各実施例を、図2以降と共に説明する。   Embodiments of a code recognition method and apparatus, electronic apparatus, program, and storage medium according to the present invention will be described below with reference to FIG.

図2は、本発明になる電子装置の一実施例の要部を示すブロック図である。図1に示す電子装置1は、バス17により接続された画像読取装置9、CPU10、ROM11、RAM12、通信インタフェース13、記憶装置14、入出力装置15及び媒体ドライブ16を有する。   FIG. 2 is a block diagram showing the main part of an embodiment of the electronic apparatus according to the present invention. The electronic device 1 shown in FIG. 1 includes an image reading device 9, a CPU 10, a ROM 11, a RAM 12, a communication interface 13, a storage device 14, an input / output device 15, and a medium drive 16 connected by a bus 17.

電子装置の本実施例は、本発明になるコード認識方法及び装置、プログラム及び記憶媒体の一実施例を採用する。   This embodiment of the electronic apparatus employs an embodiment of a code recognition method and apparatus, program, and storage medium according to the present invention.

画像読取装置9は、デジタルカメラやイメージスキャナで構成されている。CPU10は、電子装置1の全体の制御を司る。ROM11は、CPU10が実行するプログラムやデータを格納する。RAM12は、CPU10がプログラムを実行する際のワークエリアやデータ格納エリアを提供する。通信インタフェース13は、ネットワーク19を介して情報提供者18と接続可能である。情報提供者18は、他の電子装置やその記憶装置であっても良い。記憶装置14は、半導体記憶装置、磁気記憶装置(例えば、磁気ディスク装置)、光記憶装置(例えば、光ディスク装置)や光磁気記憶装置(例えば、光磁気ディスク装置)等で構成されている。入出力装置15は、キーボード等で構成された入力部と、液晶表示パネル等で構成された出力部とを含む。媒体ドライブ16は、ディスク等の可搬記録媒体20に対して情報の書き込み及び/又は読み出しを行う。ROM11は電子装置のリード可能な記憶装置を構成し、RAM12、記憶装置14及び記録媒体20をロードされた媒体ドライブ16は、電子装置1のリード/ライト可能な記憶部を構成する。   The image reading device 9 includes a digital camera and an image scanner. The CPU 10 governs overall control of the electronic device 1. The ROM 11 stores programs and data executed by the CPU 10. The RAM 12 provides a work area and a data storage area when the CPU 10 executes a program. The communication interface 13 can be connected to the information provider 18 via the network 19. The information provider 18 may be another electronic device or its storage device. The storage device 14 includes a semiconductor storage device, a magnetic storage device (for example, a magnetic disk device), an optical storage device (for example, an optical disk device), a magneto-optical storage device (for example, a magneto-optical disk device), and the like. The input / output device 15 includes an input unit configured with a keyboard or the like, and an output unit configured with a liquid crystal display panel or the like. The medium drive 16 writes information to and / or reads information from a portable recording medium 20 such as a disk. The ROM 11 constitutes a readable storage device of the electronic device, and the RAM 12, the storage device 14, and the medium drive 16 loaded with the recording medium 20 constitute a readable / writable storage unit of the electronic device 1.

電子装置1は、デスクトップ型のパーソナルコンピュータ、ラップトップ型(可搬型)のパーソナルコンピュータやPDA等の情報処理装置であっても、携帯電話等の通信装置であっても良い。尚、電子装置1が携帯電話の場合には、通信インタフェース13は、移動通信ネットワークを介して基地局やその先の相手側携帯電話と通信を行う送受信部である。   The electronic device 1 may be a desktop personal computer, a laptop (portable) personal computer, an information processing device such as a PDA, or a communication device such as a mobile phone. When the electronic device 1 is a mobile phone, the communication interface 13 is a transmission / reception unit that communicates with the base station and the other party mobile phone via the mobile communication network.

コード認識装置の本実施例は、電子装置1内の少なくともCPU10により構成される。コード認識方法及びプログラムの本実施例は、CPU10により実行される。記憶媒体の本実施例は、プログラムの本実施例を格納したコンピュータ読み取り可能な記憶媒体により構成される。コンピュータ読み取り可能な記憶媒体は、リード可能な記憶部により構成可能であり、例えば記録媒体20により構成される。尚、プログラムの本実施例は、情報提供者18からネットワーク19及び通信インタフェース13を介して電子装置1内のリード/ライト可能な記憶部に格納されるものであっても良い。   This embodiment of the code recognition device is constituted by at least the CPU 10 in the electronic device 1. This embodiment of the code recognition method and program is executed by the CPU 10. The present embodiment of the storage medium is configured by a computer-readable storage medium storing the present embodiment of the program. The computer-readable storage medium can be configured by a readable storage unit, and is configured by, for example, the recording medium 20. This embodiment of the program may be stored in a readable / writable storage unit in the electronic apparatus 1 from the information provider 18 via the network 19 and the communication interface 13.

一次元コード又は二次元コードを認識する場合、コードは画像読み取り装置9により周知の方法で読み取られて、その画像データはリード/ライト可能な記憶部に格納される。この場合、読み取り対象のコードは、紙等の媒体に印刷されたものであっても、表示画面に表示されたものであっても良い。尚、コードはデジタルカメラ等の画像読取装置9により読み取られるので、コードのみの画像を読み取ることは難しく、通常、読み取られたコードの画像データは、コードの画像に関する画像データと、コードの周囲にある背景の画像に関する画像データとからなる。   When recognizing the one-dimensional code or the two-dimensional code, the code is read by the image reading device 9 by a known method, and the image data is stored in a readable / writable storage unit. In this case, the code to be read may be printed on a medium such as paper or may be displayed on a display screen. Since the code is read by the image reading device 9 such as a digital camera, it is difficult to read the image of only the code. Usually, the image data of the read code is the image data related to the code image and the surroundings of the code. It consists of image data relating to an image of a certain background.

図3は、本実施例の動作を説明するフローチャートである。同図に示す処理は、コードが読み取られてその画像データがリード/ライト可能な記憶部に格納されるとCPU10により実行される。ここでは、説明の便宜上、二次元カラーコードが読み取られてそのカラー画像データがリード/ライト可能な記憶部に格納されているものとする。図3において、ステップS1は、リード/ライト可能な記憶部に格納されているカラー画像データを任意の複数の色成分に分割して色成分毎に色プレーンを作成する。本実施例では、説明の便宜上、カラー画像データが赤(R)、緑(G)及び青(B)の3原色の色成分に分割されて、Rプレーン、Gプレーン及びBプレーンが作成されるものとする。   FIG. 3 is a flowchart for explaining the operation of this embodiment. The processing shown in the figure is executed by the CPU 10 when the code is read and the image data is stored in a readable / writable storage unit. Here, for convenience of explanation, it is assumed that the two-dimensional color code is read and the color image data is stored in a readable / writable storage unit. In FIG. 3, step S1 divides color image data stored in a readable / writable storage unit into a plurality of arbitrary color components, and creates a color plane for each color component. In this embodiment, for convenience of explanation, color image data is divided into three primary color components of red (R), green (G), and blue (B) to create an R plane, a G plane, and a B plane. Shall.

ステップS2は、ステップS1で作成した各色プレーンにおいて、画像の任意の位置から画像を順次走査して着目する矩形領域(以下、ブロックと言う)を順番に抽出する。ブロックは、画像の左上隅から左右の主走査方向に走査して上下の副走査方向に走査を進めることで選択したり、画像の中央から周辺部に向かって走査して選択することが可能であり、走査の開始位置及び走査方向は特に限定されない。読み取ったコードの画像を短時間で検出するためにも、コードが存在する可能性の高い画像中の位置から走査を開始してブロックを抽出することが望ましい。   In step S2, in each color plane created in step S1, a rectangular area (hereinafter referred to as a block) of interest is sequentially extracted by scanning the image sequentially from an arbitrary position of the image. The block can be selected by scanning from the upper left corner of the image in the left and right main scanning directions and proceeding in the upper and lower sub scanning directions, or by scanning from the center of the image toward the periphery. There is no particular limitation on the scanning start position and scanning direction. In order to detect an image of the read code in a short time, it is desirable to start scanning from a position in the image where there is a high possibility that the code exists and extract a block.

図4は、ブロックの抽出を説明する図である。同図は、説明の便宜上、読み取られた二次元カラーコード31が赤色である場合を示す。図4の中央部分は、各R,G,Bプレーン31R,31G,31Bにおいて、一例として画像の中央から着目するブロック311R,311G,311Bが抽出された状態を示す。読み取られた二次元カラーコード31は赤色であるため、各画素が256の階調レベル(例えば、「255」が最も高い輝度、「0」が最も低い輝度を示す)で表される場合、一例としてRプレーン31Rにおけるブロック311R内の画素データの最小値は「255」、Gプレーン31Gにおけるブロック311G内の画素データの最小値は「0」、Bプレーン31Bにおけるブロック311B内の画素データの最小値は「10」である。   FIG. 4 is a diagram for explaining block extraction. This figure shows a case where the read two-dimensional color code 31 is red for convenience of explanation. The center part of FIG. 4 shows a state where blocks 311R, 311G, and 311B of interest are extracted from the center of the image as an example in each of the R, G, and B planes 31R, 31G, and 31B. Since the read two-dimensional color code 31 is red, each pixel is represented by 256 gradation levels (for example, “255” indicates the highest luminance and “0” indicates the lowest luminance). The minimum value of the pixel data in the block 311R in the R plane 31R is “255”, the minimum value of the pixel data in the block 311G in the G plane 31G is “0”, and the minimum value of the pixel data in the block 311B in the B plane 31B Is “10”.

ステップS3は、抽出したブロック内に含まれている二次元カラーコードのコード部分の特徴量を算出する。抽出したブロック内のコード部分と背景部分の判別については後述する。ここでは、Rプレーン31Rにおけるブロック311R内の画素データの最小値、Gプレーン31Gにおけるブロック311G内の画素データの最小値、及びBプレーン31Bにおけるブロック311B内の画素データの最小値を用いてコード部分の特徴量を算出する。画素データの最小値が小さいということは、画素データが示す画素の輝度が低い、即ち、画素が暗く、通常は画素の輝度が高い背景とのコントラスト差を大きくすることができることを意味する。   In step S3, the feature amount of the code portion of the two-dimensional color code included in the extracted block is calculated. Discrimination between the code portion and the background portion in the extracted block will be described later. Here, the code portion is obtained by using the minimum value of the pixel data in the block 311R in the R plane 31R, the minimum value of the pixel data in the block 311G in the G plane 31G, and the minimum value of the pixel data in the block 311B in the B plane 31B. The feature amount is calculated. When the minimum value of the pixel data is small, it means that the difference in contrast with the background in which the pixel indicated by the pixel data is low, that is, the pixel is dark and the pixel luminance is usually high can be increased.

一次元コード及び二次元コードは共に、例えば白と黒の組み合わせのようにコントラスト差が大きい2色の色を用いて印刷されている。通常、背景色に白を用いてコードが印刷されることが多いため、コードの色がより暗い、即ち、画素値がより小さい方が背景色とのコントラスト差が大きくなり、コードが一元コードであるか二次元コードであるかの判別及びコード認識を精度良く行うことが可能になる。   Both the one-dimensional code and the two-dimensional code are printed using two colors having a large contrast difference such as a combination of white and black. Since codes are usually printed using white as the background color, the code color is darker, that is, the smaller the pixel value, the greater the difference in contrast from the background color, and the code is a unified code. It is possible to accurately determine whether the code is a two-dimensional code and recognize the code.

ステップS4は、ステップS3で算出した特徴量をR,G,Bプレーン31R,31G,31B間で比較し、特徴量が強く発現している色プレーンを以後の処理用として選択する。この例では、特徴量が最も強く発現している、即ち、ブロック311R,311G,311B内の画素データのうち、最小値が最も小さいGプレーン31Gを選択する。二次元カラーコードは、赤色なので、この場合はRプレーン31Rには特徴量が現れなくなる一方、G,Bプレーン31G,31Bには特徴量が現れる。ここでは、最もコントラストの高い画像データを使用するために、特徴量の大きい方のGプレーン31Gを選択する。   In step S4, the feature amount calculated in step S3 is compared between the R, G, and B planes 31R, 31G, and 31B, and a color plane in which the feature amount is strongly expressed is selected for subsequent processing. In this example, the G plane 31G having the smallest feature value is selected from among the pixel data in the blocks 311R, 311G, and 311B. Since the two-dimensional color code is red, in this case, the feature quantity does not appear on the R plane 31R, while the feature quantity appears on the G and B planes 31G and 31B. Here, in order to use the image data with the highest contrast, the G plane 31G having the larger feature amount is selected.

ステップS5は、選択されたGプレーン31Gの二次元コード31の画像データを用いて一次元コードと二次元コードの判別やコード内容の認識等の認識処理を行う。特徴量の最も大きなGプレーン31Gの画像データを用いて認識処理を行うので、認識処理をより高精度に行うことが可能となる。   In step S5, recognition processing such as discrimination between a one-dimensional code and a two-dimensional code and recognition of code contents is performed using the image data of the two-dimensional code 31 of the selected G plane 31G. Since the recognition process is performed using the image data of the G plane 31G having the largest feature amount, the recognition process can be performed with higher accuracy.

尚、ステップS4における色プレーンの選択は、特徴量の最も大きな色プレーンを選択する方法に限定されるものではない。例えば、抽出したブロックの画素データの最小値が所定値以下のR,G,Bプレーン31R,31G,31Bのうち、予め設定された優先順位が最も高い色プレーンを選択するようにしても良い。このように色プレーンを選択すると、例えば赤色の2次元コードの上に青色の文字等が書かれていても、Bプレーン31Bを選択してステップS5の認識処理に用いることで、青色の文字等の影響を受けることなく高精度の認識処理を行うことが可能となる。ただし、この場合は、優先順位の高い順にB,G,Rプレーン31B,31G,31Rが予め設定されており、抽出したブロックの画素データの最小値が例えば「15」以下の色プレーンのうちで優先順位の最も高い色プレーンを選択するものとする。このように、カラーコードの状態やステップS5の認識処理で行う処理に応じて、ステップS4における色プレーンの選択基準を選定すれば良い。   Note that the selection of the color plane in step S4 is not limited to the method of selecting the color plane having the largest feature amount. For example, the color plane having the highest preset priority order may be selected from among the R, G, B planes 31R, 31G, 31B having a minimum value of pixel data of the extracted block equal to or less than a predetermined value. When the color plane is selected in this way, for example, even if a blue character or the like is written on the red two-dimensional code, the B plane 31B is selected and used for the recognition processing in step S5, so that the blue character or the like is selected. It is possible to perform highly accurate recognition processing without being affected by the above. However, in this case, the B, G, and R planes 31B, 31G, and 31R are preset in descending order of priority, and the minimum value of the pixel data of the extracted block is, for example, among “15” or less color planes. It is assumed that the color plane with the highest priority is selected. In this way, the color plane selection criterion in step S4 may be selected in accordance with the state of the color code and the processing performed in the recognition processing in step S5.

ステップS5の認識処理では、読み取り対象のカラーコードが二次元カラーコードであることが予めわかっていれば、ステップS4で選択された色プレーンの画像データを用いてコード内容を周知の方法で認識することができる。又、読み取り対象のカラーコードが一次元カラーコードであるか二次元カラーコードであるかが予めわかっていない場合には、ステップS4で選択された色プレーンの画像データを用いて読み取られたカラーコードが一次元カラーコードであるか二次元カラーコードであるかの判定を行ってから、そのコード内容を認識することもできる。   In the recognition processing in step S5, if it is known in advance that the color code to be read is a two-dimensional color code, the code content is recognized by a known method using the image data of the color plane selected in step S4. be able to. If it is not known beforehand whether the color code to be read is a one-dimensional color code or a two-dimensional color code, the color code read using the image data of the color plane selected in step S4. It is also possible to recognize the code contents after determining whether is a one-dimensional color code or a two-dimensional color code.

図5は、図3に示すステップS3におけるブロックの特徴量の算出を二次元コードについてより詳細に説明するフローチャートである。図5中、図3と同一ステップには同一符号を付し、その説明は省略する。   FIG. 5 is a flowchart for explaining the calculation of the block feature amount in step S3 shown in FIG. 3 in more detail for the two-dimensional code. In FIG. 5, the same steps as those in FIG. 3 are denoted by the same reference numerals, and the description thereof is omitted.

図5において、ステップS31は、読み取られたコードから抽出されたブロックの特徴量を上記の如く算出する。ステップS32は、例えば画素値の最小値が最も小さいGプレーン31Gについて、抽出したブロック311Gの画素値の標準偏差SDが閾値SDcより大きいか否かを判定する。一次元コード及び二次元コードは共に、例えば白と黒の組み合わせのようにコントラスト差が大きい2色の色を用いて印刷されている。又、コード部分(コード内の領域)では、2色の色の占める面積比が1:1に近い。このため、コード部分では、画素値のばらつき(又は、標準偏差)が背景部分での画素値のばらつき(又は、標準偏差)より大きいという特徴が有る。このように、コード部分と背景部分とでは、画素値の標準偏差SDが異なるので、閾値SDcより標準偏差SDが大きければコード部分であることが判別できる。又、コントラスト差がより大きい程、コードが一元コードであるか二次元コードであるかの判別及びコード認識を精度良く行うことが可能になる。従って、ブロック内の画素値の標準偏差SDが閾値SDcより大きく、且つ、そのような標準偏差SDのうち最大の標準偏差SDを有するブロックの色プレーンを選択することで、コードが一元コードであるか二次元コードであるかの判別及びコード認識を更に精度良く行うことができる。   In FIG. 5, step S31 calculates the feature amount of the block extracted from the read code as described above. In step S32, for example, for the G plane 31G having the smallest minimum pixel value, it is determined whether or not the standard deviation SD of the pixel value of the extracted block 311G is larger than the threshold value SDc. Both the one-dimensional code and the two-dimensional code are printed using two colors having a large contrast difference such as a combination of white and black. In the code portion (region in the code), the area ratio occupied by the two colors is close to 1: 1. For this reason, the code portion has a feature that the variation (or standard deviation) of the pixel value is larger than the variation (or standard deviation) of the pixel value in the background portion. Thus, since the standard deviation SD of the pixel value is different between the code portion and the background portion, it can be determined that the code portion is the code portion if the standard deviation SD is larger than the threshold value SDc. In addition, as the contrast difference is larger, it is possible to accurately determine whether the code is a unitary code or a two-dimensional code and to recognize the code. Therefore, by selecting a color plane of a block in which the standard deviation SD of the pixel values in the block is larger than the threshold value SDc and has the maximum standard deviation SD among such standard deviations SD, the code is a unified code. Or two-dimensional code and code recognition can be performed with higher accuracy.

ステップS32の判定結果がYESであると、ステップS33は、例えば抽出したブロック311Gの水平方向エッジ数Heが閾値Eminより大きく、且つ、垂直方向エッジ数Veが閾値Eminより大きいか否かを判定する。   If the decision result in the step S32 is YES, a step S33 decides whether, for example, the horizontal edge number He of the extracted block 311G is larger than the threshold value Emin and the vertical edge number Ve is larger than the threshold value Emin. .

一次元コードは、異なった太さや間隔をもつ平行な直線(バー)の組合せによってデータを表現するコードである。バーに垂直な直線上の画素を取り出した場合、コード部分のどこを切り出してもバーの画素値の変化点(エッジ)が取り出した直線上に含まれるバーの数に対応した数だけ存在するが、バーに平行な直線上の画素を取り出した場合はエッジが存在しないという特徴を有する。他方、二次元コードは、二次元に配置した明暗ドット(セル)の組み合わせによってデータを表現するコードである。セルは、コード部分ではできるだけ一様に配置されるように構成されている。セルの配列に平行及び垂直な直線上の画素を取り出した場合、コード部分のどこを切り出しても、水平及び垂直な直線上のどちらにも同様に画素値の変化点が存在するという特徴を有する。従って、水平及び垂直ライン内のエッジ数が所定の範囲内にあり、且つ、最大となるブロックを有する色プレーンを選択することで、コードが一元コードであるか二次元コードであるかの判別及びコード認識を更に精度良く行うことができる。   The one-dimensional code is a code that represents data by a combination of parallel straight lines (bars) having different thicknesses and intervals. When pixels on a straight line perpendicular to the bar are taken out, there are as many change points (edges) of the bar pixel value as there are bars corresponding to the number of bars included on the extracted straight line, regardless of where the code portion is cut out. When pixels on a straight line parallel to the bar are taken out, there is a feature that no edge exists. On the other hand, the two-dimensional code is a code that represents data by a combination of light and dark dots (cells) arranged two-dimensionally. The cells are configured to be arranged as uniformly as possible in the code portion. When pixels on a straight line parallel to and perpendicular to the cell array are taken out, there is a feature that the change point of the pixel value exists on both the horizontal and vertical lines regardless of where the code portion is cut out. . Therefore, by selecting a color plane having the largest number of edges in the horizontal and vertical lines and having the largest block, it is possible to determine whether the code is a one-dimensional code or a two-dimensional code. Code recognition can be performed more accurately.

図6は、一次元コードの水平方向エッジ数He及び垂直方向エッジ数Veを説明する図であり、図7は、二次元コードの水平方向エッジ数He及び垂直方向エッジ数Veを説明する図である。水平方向エッジ数Heとは、抽出したブロック内のコード部分を水平方向に走査した場合に横切るパターンのエッジ(即ち、画素値の変化点)であり、垂直方向エッジ数Veとは、抽出したブロック内のコード部分を垂直方向に走査した場合に横切るパターンのエッジ(即ち、画素値の変化点)である。図6及び図7において、上部はコード全体を示し、下部は抽出されたブロックと水平方向エッジ数He及び垂直方向エッジ数Veを示す。図6からもわかるように、一次元コードの場合は、水平方向エッジ数Heが波線で示すどの垂直方向位置で走査しても全て「10」で同じであり、且つ、垂直方向エッジ数Veが波線で示すどの水平方向位置で走査しても全て「0」である。他方、図7からもわかるように、二次元コードの場合は、水平方向エッジ数Heが波線で示す位置により「4」、「6」、「7」と異なり、且つ、垂直方向エッジ数Veが波線で示す位置により「7」、「2」、「4」と異なる。二次元コードの場合、所定サイズのブロック内の水平方向エッジ数He及び垂直方向エッジ数Veがいずれも所定の閾値Eminより大きいようにコードパターンが構成されているので、ステップS33により一次元コードと二次元コードとが判別できる。   FIG. 6 is a diagram illustrating the number of horizontal edges He and the number of vertical edges Ve of a one-dimensional code, and FIG. 7 is a diagram illustrating the number of horizontal edges He and the number of vertical edges Ve of a two-dimensional code. is there. The horizontal edge number He is an edge of a pattern that traverses when the code portion in the extracted block is scanned in the horizontal direction (that is, the change point of the pixel value), and the vertical edge number Ve is the extracted block. This is an edge of a pattern that traverses when the inner code portion is scanned in the vertical direction (that is, a change point of pixel value). 6 and 7, the upper part shows the entire code, and the lower part shows the extracted block, the number of horizontal edges He, and the number of vertical edges Ve. As can be seen from FIG. 6, in the case of a one-dimensional code, the horizontal edge number He is the same as “10” regardless of the vertical position indicated by the wavy line, and the vertical edge number Ve is the same. All the scans at any position in the horizontal direction indicated by the broken line are “0”. On the other hand, as can be seen from FIG. 7, in the case of the two-dimensional code, the horizontal edge number He differs from “4”, “6”, “7” depending on the position indicated by the wavy line, and the vertical edge number Ve is It differs from “7”, “2”, and “4” depending on the position indicated by the wavy line. In the case of a two-dimensional code, since the code pattern is configured such that the number of horizontal edges He and the number of vertical edges Ve in a block of a predetermined size are both greater than a predetermined threshold value Emin, the one-dimensional code is converted in step S33. A two-dimensional code can be distinguished.

ステップS33の判定結果がYESであると、ステップS34は、抽出したブロックの黒画素率BPrが下限閾値BPminより大きく、且つ、上限閾値BPmaxより小さいか否かを判定する。ここで、下限閾値BPminと上限閾値BPmaxの間の範囲に、黒画素率BPrの基準値BPRが含まれるものとする。又、黒画素率BPrとは、対象となる色プレーンの画素値が小さい(例えば、輝度値が最小の)画素の、画素値が大きい(例えば、輝度値が最大の)画素に対する比率を言う。一次元コード及び二次元コードは共に、例えば白と黒の組み合わせのようなコントラスト差が大きい2色の色を用いて印刷されている。背景部分が白画素でコード部分が黒画素であるものとすると、特に二次元コード部分では、これらの白画素と黒画素の面積比が基準値(例えば、50%)を含む所定の範囲(例えば、50%±10%)内になるようにコードパターンが予め構成されている。このように、コード部分と背景部分とでは、黒画素率が異なるので、黒画素率BPrが下限閾値BPmin(>BPR)より大きく、且つ、上限閾値BPmax(<BPR)より小さければコード部分、即ち、二次元コードのコード部分であることが(ステップS33の判定結果がYESであるため)判別できる。従って、ブロック内の黒画素の比率(又は、白画素の比率)が基準値を含む所定の範囲内になり、且つ、基準値に最も近いブロックを有する色プレーンを選択することで、コードが一元コードであるか二次元コードであるかの判別及びコード認識を更に精度良く行うことができる。   If the decision result in the step S33 is YES, a step S34 decides whether or not the black pixel rate BPr of the extracted block is larger than the lower limit threshold BPmin and smaller than the upper limit threshold BPmax. Here, it is assumed that the reference value BPR of the black pixel ratio BPr is included in the range between the lower limit threshold BPmin and the upper limit threshold BPmax. The black pixel ratio BPr is a ratio of pixels having a small pixel value (for example, the minimum luminance value) to a pixel having a large pixel value (for example, the maximum luminance value). Both the one-dimensional code and the two-dimensional code are printed using two colors having a large contrast difference such as a combination of white and black. Assuming that the background portion is a white pixel and the code portion is a black pixel, particularly in the two-dimensional code portion, the area ratio between the white pixel and the black pixel includes a predetermined range (for example, 50%) (for example, , 50% ± 10%), the code pattern is configured in advance. Thus, since the black pixel rate is different between the code portion and the background portion, if the black pixel rate BPr is larger than the lower threshold BPmin (> BPR) and smaller than the upper threshold BPmax (<BPR), the code portion, that is, It can be determined that it is a code portion of the two-dimensional code (since the determination result in step S33 is YES). Therefore, the code is unified by selecting a color plane having a block whose black pixel ratio (or white pixel ratio) in the block is within a predetermined range including the reference value and having a block closest to the reference value. Whether it is a code or a two-dimensional code and code recognition can be performed with higher accuracy.

ステップS32,S33,S34のいずれかの判定結果がNOであると、ステップS35は抽出したブロックに二次元コードは無いと判断し、処理はステップS2へ戻り次のブロックを抽出する。他方、ステップS34の判定結果がYESであると、ステップS36は抽出したブロックに二次元コードがあると判断し、処理はステップS4へ進む。この場合、ステップS36において読み取られたカラーコードは二次元カラーコードであることが判断されているので、ステップS5では、ステップS4で選択された色プレーンの画像データを用いて二次元コードのコード内容を周知の方法で認識すれば良い。   If the determination result of any of steps S32, S33, and S34 is NO, step S35 determines that there is no two-dimensional code in the extracted block, and the process returns to step S2 to extract the next block. On the other hand, if the decision result in the step S34 is YES, a step S36 judges that there is a two-dimensional code in the extracted block, and the process advances to a step S4. In this case, since it is determined that the color code read in step S36 is a two-dimensional color code, in step S5, the code content of the two-dimensional code using the image data of the color plane selected in step S4. May be recognized by a known method.

尚、所定数のブロックを抽出した後も処理がステップS35へ進む場合には、例えばエラーメッセージを入出力部15へ出力しても、図8と共に後述する一次元コードがあるか否かの判断を行うようにしても良い。   If the process proceeds to step S35 even after a predetermined number of blocks have been extracted, for example, even if an error message is output to the input / output unit 15, it is determined whether there is a one-dimensional code described later with reference to FIG. May be performed.

図8は、図3に示すステップS3におけるブロックの特徴量の算出を一次元コードについてより詳細に説明するフローチャートである。図8中、図3と同一ステップには同一符号を付し、その説明は省略する。   FIG. 8 is a flowchart for explaining the calculation of the block feature amount in step S3 shown in FIG. 3 in more detail for the one-dimensional code. In FIG. 8, the same steps as those in FIG. 3 are denoted by the same reference numerals, and the description thereof is omitted.

図8において、ステップS301は、読み取られたコードから抽出されたブロックの特徴量を上記の如く算出する。ステップS302は、例えば画素値の最小値が最も小さいGプレーン31Gについて、抽出したブロック311Gの画素値の標準偏差SDが閾値SDcより大きいか否かを判定する。コード部分と背景部分とでは、画素値の標準偏差SDが異なるので、閾値SDcより標準偏差SDが大きければコード部分であることが判別できる。ステップS302の判定結果がYESであると、ステップS303は、例えば抽出したブロック311Gの水平方向エッジ数Heが閾値Eminより大きいか、或いは、垂直方向エッジ数Veが閾値Eminより大きいか否かを判定する。図6及び図7と共に説明したように、一次元コードの場合は垂直方向エッジ数Veが「0」なので、ステップS303により抽出したブロック内に一次元コードのコード部分があるか否かを判定することができる。   In FIG. 8, step S301 calculates the feature amount of the block extracted from the read code as described above. In step S302, for example, for the G plane 31G having the smallest pixel value, it is determined whether or not the standard deviation SD of the pixel value of the extracted block 311G is larger than the threshold value SDc. Since the standard deviation SD of the pixel value is different between the code portion and the background portion, if the standard deviation SD is larger than the threshold value SDc, it can be determined that it is the code portion. If the decision result in the step S302 is YES, a step S303 decides whether, for example, the horizontal edge number He of the extracted block 311G is larger than the threshold value Emin or whether the vertical edge number Ve is larger than the threshold value Emin. To do. As described with reference to FIGS. 6 and 7, since the number of vertical edges Ve is “0” in the case of a one-dimensional code, it is determined whether or not there is a code portion of the one-dimensional code in the block extracted in step S303. be able to.

ステップS303の判定結果がYESであると、ステップS304は、抽出したブロックの水平ライン間相関Hsが閾値Sminより大きいか、或いは、垂直ライン間相関Vsが閾値Sminより大きいか否かを判定する。   If the decision result in the step S303 is YES, a step S304 decides whether or not the horizontal line correlation Hs of the extracted block is larger than the threshold value Smin or whether the vertical line correlation Vs is larger than the threshold value Smin.

一次元コードは、コード部分でバーに垂直な直線とその近傍の平行直線との間で相互相関を取った場合は極めて強い相関を示すが、バーに平行な直線とその近傍の平行直線との間で相互相関を取った場合には相関が殆ど無いという特を有する。他方、二次元コードは、セルの配列に平行及び垂直な直線とその近傍の平行直線との間で相互相関を取った場合、特に明確な相関が無いという特徴を有する。又、文字や写真等が印刷されている背景部分の場合も、一次元コード程強い相関を示すことは無い。従って、ブロック内の特定の水平ライン間の相関及び特定の垂直ライン間の相関が所定の範囲内にあり、且つ、最大となるブロックを有する色プレーンを選択することで、コードが一元コードであるか二次元コードであるかの判別及びコード認識を更に精度良く行うことができる。   The one-dimensional code shows an extremely strong correlation when a cross-correlation is taken between a straight line perpendicular to the bar and the parallel line in the vicinity of the code part. When cross-correlation is taken, there is a characteristic that there is almost no correlation. On the other hand, the two-dimensional code has a feature that there is no particularly clear correlation when a cross-correlation is taken between a straight line parallel and perpendicular to the cell arrangement and a parallel straight line in the vicinity thereof. Also, in the case of a background portion where characters, photographs, etc. are printed, the correlation is not as strong as that of a one-dimensional code. Accordingly, by selecting a color plane having a block in which the correlation between specific horizontal lines in a block and the correlation between specific vertical lines are within a predetermined range, and the code is the largest, the code is a unitary code. Or two-dimensional code and code recognition can be performed with higher accuracy.

図9は、一次元コードの水平ライン間相関Hs及び垂直ライン間相関Vsを説明する図であり、図10は、二次元コードの水平ライン間相関Hs及び垂直ライン間相関Vsを説明する図である。水平ライン間相関Hsとは、抽出したブロック内のコード部分を水平方向に走査した場合に横切るパターンの相関であり、垂直ライン間相関Vsとは、抽出したブロック内のコード部分を垂直方向に走査した場合に横切るパターンの相関である。図9及び図10において、上部はコード全体を示し、下部は抽出されたブロックと水平ライン間相関Hs及び垂直ライン間相関Vsを示す。図9からもわかるように、一次元コードの場合は、水平ライン間相関Hsが一点鎖線で示すどの垂直方向位置で走査しても大きく、且つ、垂直ライン間相関Vsが一点鎖線で示すどの水平方向位置で走査しても無い。他方、図10からもわかるように、二次元コードの場合は、水平ライン間相関Hsが一点鎖線で示すどの位置で走査しても小さく、且つ、垂直ライン間相関Vsが一点鎖線で示すどの位置で走査しても小さい。一次元コードの場合、ブロック内の水平ライン間相関Hsが大きくなるようにコードパターンが構成されているので、水平ライン間相関Hs又は垂直ライン間相関Vsが閾値Sminより大きければ、一次元コードのコード部分であることが(ステップS303の判定結果がYESであるため)判別できる。   FIG. 9 is a diagram illustrating the horizontal line correlation Hs and the vertical line correlation Vs of the one-dimensional code, and FIG. 10 is a diagram illustrating the horizontal line correlation Hs and the vertical line correlation Vs of the two-dimensional code. is there. The inter-horizontal line correlation Hs is a cross-correlation pattern when the code portion in the extracted block is scanned in the horizontal direction, and the vertical inter-line correlation Vs is scanned in the code portion in the extracted block in the vertical direction. It is the correlation of the pattern that crosses the case. 9 and 10, the upper part shows the entire code, and the lower part shows the extracted block, horizontal line correlation Hs, and vertical line correlation Vs. As can be seen from FIG. 9, in the case of a one-dimensional code, the horizontal line correlation Hs is large regardless of the vertical position indicated by the one-dot chain line, and the horizontal line correlation Vs is indicated by the one-dot chain line. There is no scanning in the direction position. On the other hand, as can be seen from FIG. 10, in the case of a two-dimensional code, the horizontal line correlation Hs is small at any position indicated by the one-dot chain line, and the vertical line correlation Vs is indicated by the one-dot chain line. It is small even if it scans with. In the case of a one-dimensional code, the code pattern is configured such that the horizontal line correlation Hs in the block is large. Therefore, if the horizontal line correlation Hs or the vertical line correlation Vs is greater than the threshold value Smin, It can be determined that it is a code portion (since the determination result in step S303 is YES).

ステップS302,S303,S304のいずれかの判定結果がNOであると、ステップS305は抽出したブロックに一次元コードは無いと判断し、処理はステップS2へ戻り次のブロックを抽出する。他方、ステップS304の判定結果がYESであると、ステップS306は抽出したブロックに一次元コードがあると判断し、処理はステップS4へ進む。この場合、ステップS306において読み取られたカラーコードは一次元カラーコードであることが判断されているので、ステップS5では、ステップS4で選択された色プレーンの画像データを用いて一次元コードのコード内容を周知の方法で認識すれば良い。   If the determination result in any of steps S302, S303, and S304 is NO, step S305 determines that there is no one-dimensional code in the extracted block, and the process returns to step S2 to extract the next block. On the other hand, if the decision result in the step S304 is YES, a step S306 judges that there is a one-dimensional code in the extracted block, and the process advances to a step S4. In this case, since it is determined that the color code read in step S306 is a one-dimensional color code, in step S5, the code content of the one-dimensional code using the image data of the color plane selected in step S4. May be recognized by a known method.

尚、所定数のブロックを抽出した後も処理がステップS305へ進む場合には、例えばエラーメッセージを入出力部15へ出力しても、図5と共に説明した二次元コードがあるか否かの判断を行うようにしても良い。   If the process proceeds to step S305 after extracting a predetermined number of blocks, for example, even if an error message is output to the input / output unit 15, it is determined whether or not there is the two-dimensional code described with reference to FIG. May be performed.

読み取り対象のコードが二次元コードであることがわかっている場合には、図5の処理のみを行えば良く、読み取り対象のコードが一次元コードであることがわかっている場合には、図8の処理のみを行えば良い。   When it is known that the code to be read is a two-dimensional code, only the processing of FIG. 5 needs to be performed. When it is known that the code to be read is a one-dimensional code, FIG. It is sufficient to perform only the process.

又、読み取り対象のコードが一次元コードであるか二次元コードであるかわからない場合には、図5の処理を行ってステップS35が所定回数行われるとステップS3の処理を図8に示すステップS3の処理に切り替えるようにしても、図8の処理を行ってステップS305が所定回数行われるとステップS3の処理を図5に示すステップS3の処理に切り替えるようにしても良い。更に、図5に示すステップS3と図8に示すステップS3の処理を並行して行うようにすることも可能である。 一次元コード及び二次元コードのコード部分には、背景部分とは異なる特徴量が複数存在するので、これらの特徴量を複数組み合わせて色プレーンの選択を行うことで、コードが一元コードであるか二次元コードであるかの判別及びコード認識を更に精度良く行うことができる。   If it is not known whether the code to be read is a one-dimensional code or a two-dimensional code, the process of FIG. 5 is performed and step S35 is performed a predetermined number of times. Even if the process is switched to the process of FIG. 8, when the process of FIG. 8 is performed and step S305 is performed a predetermined number of times, the process of step S3 may be switched to the process of step S3 shown in FIG. Furthermore, it is possible to perform the processes of step S3 shown in FIG. 5 and step S3 shown in FIG. 8 in parallel. Since the code part of the one-dimensional code and the two-dimensional code has a plurality of feature quantities different from the background part, whether the code is a unified code by selecting a color plane by combining these feature quantities. Whether it is a two-dimensional code and code recognition can be performed with higher accuracy.

図11は、コードと他の情報が重ね合わされている場合のコード認識を説明する図である。同図は、説明の便宜上、読み取られた一次元カラーコード41が黒色であり、且つ、コード部分の上に赤色の文字「FUJITSU」が書かれている場合を示す。図11の中央部分は、各R,G,Bプレーン41R,41G,41Bにおいて、一例として画像の中央より右よりの部分から着目するブロック411R,411G,411Bが抽出された状態を示す。読み取られた一次元カラーコード41のコード部分の上には文字が書かれているため、一例としてRプレーン41Rにおけるブロック411R内の画素データの水平ライン間相関Hsは「0.90」、Gプレーン41Gにおけるブロック411G内の画素データの水平ライン間相関Hsは「0.20」、Bプレーン41Bにおけるブロック411B内の画素データの水平ライン間相関Hsは「0.20」である。   FIG. 11 is a diagram for explaining code recognition when a code and other information are superimposed. For the sake of convenience of explanation, the figure shows a case where the read one-dimensional color code 41 is black and a red character “FUJITSU” is written on the code portion. The center part of FIG. 11 shows a state in which the blocks 411R, 411G, and 411B of interest are extracted from the right part from the center of the image in each R, G, B plane 41R, 41G, 41B as an example. Since characters are written on the code portion of the read one-dimensional color code 41, the horizontal line correlation Hs of the pixel data in the block 411R in the R plane 41R is “0.90” as an example, and the G plane. The inter-horizontal line correlation Hs of the pixel data in the block 411G in 41G is “0.20”, and the inter-horizontal line correlation Hs of the pixel data in the block 411B in the B plane 41B is “0.20”.

この場合、図3に示すステップS3は、抽出したブロック内に含まれている一次元カラーコードのコード部分の特徴量として、上記水平ライン間相関Hsを算出する。又、ステップS4における色プレーンの選択は、この場合は特徴量の最も大きな色プレーンを選択する方法を採用する。例えば、抽出したブロックの画素データの水平ライン間相関Hsが所定値以上のR,G,Bプレーン41R,41G,41Bのうち、予め設定された優先順位が最も高い色プレーンを選択するようにしても良い。このように色プレーンを選択すると、黒色の一次元コードの上に赤色の文字等が書かれていても、Rプレーン41Rを選択してステップS5の認識処理に用いることで、赤色の文字等の影響を受けることなく高精度の認識処理を行うことが可能となる。ただし、この場合は、優先順位の高い順にR,G,Bプレーン41R,41G,41Bが予め設定されており、抽出したブロックの画素データの水平ライン間相関Hsが例えば「0.85」以上の色プレーンのうちで優先順位の最も高い色プレーンを選択するものとする。このように、カラーコードの状態やステップS5の認識処理で行う処理に応じて、ステップS4における色プレーンの選択基準を選定すれば良い。   In this case, in step S3 shown in FIG. 3, the horizontal line correlation Hs is calculated as the feature amount of the code portion of the one-dimensional color code included in the extracted block. In this case, the color plane selection in step S4 employs a method of selecting the color plane having the largest feature amount. For example, the color plane having the highest preset priority order is selected from among the R, G, B planes 41R, 41G, 41B having the horizontal line correlation Hs of the extracted block pixel data equal to or greater than a predetermined value. Also good. When a color plane is selected in this way, even if a red character or the like is written on a black one-dimensional code, the R plane 41R is selected and used for the recognition processing in step S5. It is possible to perform highly accurate recognition processing without being affected. However, in this case, the R, G, and B planes 41R, 41G, and 41B are preset in descending order of priority, and the horizontal line correlation Hs of the pixel data of the extracted block is, for example, “0.85” or more. It is assumed that the color plane having the highest priority among the color planes is selected. In this way, the color plane selection criterion in step S4 may be selected in accordance with the state of the color code and the processing performed in the recognition processing in step S5.

図12は、本発明になるコード認識装置の他の実施例を説明するブロック図である。上記実施例では、コード認識装置がソフトウェアにより構成されているが、本実施例では、コード認識装置がハードウェアにより構成されている。   FIG. 12 is a block diagram for explaining another embodiment of the code recognition apparatus according to the present invention. In the above embodiment, the code recognition device is configured by software. However, in this embodiment, the code recognition device is configured by hardware.

図12に示すコード認識装置51は、画像読み取り部61、画像データ生成部62、コード判定部63、色プレーン選択部64、コード認識処理部65及び認識結果出力部66を有する。   12 includes an image reading unit 61, an image data generation unit 62, a code determination unit 63, a color plane selection unit 64, a code recognition processing unit 65, and a recognition result output unit 66.

画像読み取り部61は、デジタルカメラ等からなり、図2に示す画像読み取り装置9に相当する。画像データ生成部62は、図3に示すステップS1及びS2の処理を行う。コード判定部63は、図3に示すステップS3の処理を行う。色プレーン選択部64は、図3に示すステップS4の処理を行う。コード認識処理部65は、図3に示すステップS5の処理を行う。認識結果出力部66は、コード認識処理部65により得られた認識結果を、コード認識装置51の外部へ出力するためのインタフェースを構成する。   The image reading unit 61 includes a digital camera or the like, and corresponds to the image reading device 9 shown in FIG. The image data generation unit 62 performs the processes of steps S1 and S2 shown in FIG. The code determination unit 63 performs the process of step S3 shown in FIG. The color plane selection unit 64 performs the process of step S4 shown in FIG. The code recognition processing unit 65 performs the process of step S5 shown in FIG. The recognition result output unit 66 constitutes an interface for outputting the recognition result obtained by the code recognition processing unit 65 to the outside of the code recognition device 51.

尚、画像データ生成部62、コード判定部63、色プレーン選択部64及びコード認識処理部65のうち、3つ以下の部分が行う処理をソフトウェア処理により実現しても良いことは、言うまでもない。   Needless to say, the processing performed by three or less of the image data generation unit 62, the code determination unit 63, the color plane selection unit 64, and the code recognition processing unit 65 may be realized by software processing.

上述の如く、本発明では、コードを読み取って入力されたカラー画像データから任意の複数の色成分毎の色プレーンを作成した後、各色プレーンの画像データを矩形ブロック単位に区切って、ブロック毎にコードの特徴量の算出を行い、特徴量からコードの有無とその種類を判別する。色プレーン毎のコードの特徴量を比較し、例えば特徴量が最も強く発現している色プレーンを用いてコードの有無とその種類を判別すると共に、コード認識を行う。これにより、黒以外の色のコードを処理する場合にも、コードの判別及び認識に適した色プレーンを選択して処理を行うことが可能なため、精度良く、且つ、高速にコードの認識処理を行うことが可能である。   As described above, in the present invention, after a code is read and a color plane for each of a plurality of color components is created from input color image data, the image data of each color plane is divided into units of rectangular blocks, and each block is divided. The feature amount of the code is calculated, and the presence / absence and type of the code are determined from the feature amount. The feature amount of the code for each color plane is compared, and for example, the presence / absence and type of the code is determined using the color plane in which the feature amount is most strongly expressed, and the code is recognized. As a result, even when a code of a color other than black is processed, it is possible to perform processing by selecting a color plane suitable for code discrimination and recognition, so that the code recognition process can be performed accurately and at high speed. Can be done.

精度良く、且つ、高速にコードの認識処理を行うために、ブロック内の画素値のばらつきが所定の範囲内で最大になるブロックを有する色プレーンを選択したり、ブロック内の白又は黒画素の比率が所定の範囲内になるブロックを有する色プレーンを選択したり、ブロック内の水平及び垂直ライン内のエッジ数が所定の範囲内になるブロックを有する色プレーンを選択したり、ブロック内の特定の水平ライン間の相関及び垂直ライン間の相関が所定の範囲内になるブロックを有する色プレーンを選択したりすることができる。   In order to perform code recognition processing with high accuracy and high speed, a color plane having a block in which the variation of the pixel value in the block is maximum within a predetermined range is selected, or white or black pixels in the block are selected. Select a color plane with a block whose ratio falls within a predetermined range, select a color plane with a block whose number of edges in the horizontal and vertical lines within the block falls within a predetermined range, or identify within a block A color plane having a block in which the correlation between the horizontal lines and the correlation between the vertical lines falls within a predetermined range can be selected.

このように、一次元コード及び二次元コードのコード部分には、背景部分と異なる特徴量が複数存在するので、これらの特徴量を複数組み合わせて色プレーンの選択を行うことで、コードが一元コードであるか二次元コードであるかの判別及びコード認識を更に精度良く行うことができる。   In this way, since there are a plurality of feature quantities different from the background part in the code part of the one-dimensional code and the two-dimensional code, the code is unified by selecting a color plane by combining a plurality of these feature quantities. And code recognition can be performed with higher accuracy.

以上説明したように、本発明によれば、読み取られたコードの色に適した色プレーンを自動的に選択して認識処理を行うことが可能となるため、どのような色で作成されたコードでも確実に認識可能となる。   As described above, according to the present invention, it is possible to automatically select a color plane suitable for the color of the read code and perform a recognition process. But it can be recognized reliably.

本発明は、読み取り対象のコードの色にかかわらず、コードが一元コードであるか二次元コードであるかの判別及びコード認識に適用可能である。   The present invention can be applied to determination of whether a code is a unitary code or a two-dimensional code and code recognition regardless of the color of a code to be read.

以上、本発明を実施例により説明したが、本発明は上記実施例に限定されるものではなく、本発明の範囲内で種々の変形及び改良が可能であることは言うまでもない。   While the present invention has been described with reference to the embodiments, it is needless to say that the present invention is not limited to the above-described embodiments, and various modifications and improvements can be made within the scope of the present invention.

Claims (11)

読み取ったコードのカラー画像データを複数の色プレーンの色成分に分割するステップと、
各色プレーンの任意の位置から矩形領域を抽出する抽出ステップと、
各色プレーンの矩形領域内に含まれているコードの特徴量を算出する算出ステップと、
該特徴量に基づいて1つの色プレーンを選択する選択ステップと、
選択された色プレーンの色成分データに基づいてコードを認識する認識ステップとを含み、
該算出ステップは、該矩形領域内の画素値のばらつきを特徴量として算出し、該選択ステップは、該ばらつきが所定の範囲内で最大となる矩形領域を有する色プレーンを選択することを特徴とする、コード認識方法。
Dividing the color image data of the read code into color components of a plurality of color planes;
An extraction step of extracting a rectangular region from an arbitrary position of each color plane;
A calculation step for calculating a feature amount of a code included in a rectangular area of each color plane;
A selection step of selecting one color plane based on the feature amount ;
Look contains a recognition step of recognizing code based on the color component data of the selected color plane,
The calculating step calculates a variation in pixel values in the rectangular area as a feature amount, and the selecting step selects a color plane having a rectangular area where the variation is maximum within a predetermined range. A code recognition method.
該算出ステップは、該矩形領域内の画素値の最小値を特徴量として算出し、該選択ステップは、該最小値が所定の範囲内で最小となる矩形領域を有する色プレーンを選択することを特徴とする、請求項1記載のコード認識方法。  The calculation step calculates the minimum value of the pixel value in the rectangular area as a feature amount, and the selection step selects a color plane having a rectangular area where the minimum value is the minimum within a predetermined range. The code recognition method according to claim 1, wherein the code recognition method is characterized. 該算出ステップは、該矩形領域内の白画素と黒画素の比率を特徴量として算出し、該選択ステップは、該比率が基準値を含む所定の範囲内にあり、且つ、該基準値に最も近い値になるブロックを有するプレーンを選択することを特徴とする、請求項1又は2項記載のコード認識方法。  The calculating step calculates a ratio between white pixels and black pixels in the rectangular area as a feature amount, and the selecting step is within a predetermined range including the reference value, and is the largest in the reference value. 3. The code recognition method according to claim 1, wherein a plane having a block having a close value is selected. 該算出ステップは、該矩形領域内の水平ライン及び垂直ライン内の画素値の変化点の個数を特徴量として算出し、該選択ステップは、該個数が所定の範囲内にあり、且つ、最大となるブロックを有するプレーンを選択することを特徴とする、請求項1〜3のいずれか1項記載のコード認識方法。  The calculating step calculates the number of pixel value change points in the horizontal line and the vertical line in the rectangular area as a feature amount, and the selecting step includes the number within a predetermined range and a maximum value. The code recognition method according to claim 1, wherein a plane having a block is selected. 該算出ステップは、該矩形領域内の特定の水平ライン間及び垂直ライン間の相関を特徴量として算出し、該選択ステップは、該相関が所定の範囲内にあり、且つ、最大となるブロックを有するプレーンを選択することを特徴とする、請求項1〜4のいずれか1項記載のコード認識方法。  The calculating step calculates a correlation between specific horizontal lines and vertical lines in the rectangular area as a feature amount, and the selecting step selects a block in which the correlation is within a predetermined range and becomes the maximum. The code recognition method according to any one of claims 1 to 4, wherein a plane to be selected is selected. コンピュータ、請求項1〜5のいずれか1項記載のコード認識方法の各ステップを実行させる手順を含むことを特徴とする、プログラム。 A computer, characterized in that it comprises a procedure for executing the steps of the code recognition method according to any one of claims 1-5, program. 読み取ったコードのカラー画像データを複数の色プレーンの色成分に分割する手段と、
各色プレーンの任意の位置から矩形領域を抽出する抽出手段と、
各色プレーンの矩形領域内に含まれているコードの特徴量を算出する算出手段と、
該特徴量に基づいて1つの色プレーンを選択する選択手段と、
選択された色プレーンの色成分データに基づいてコードを認識する認識手段とを備え
該算出手段は、該矩形領域内の画素値のばらつきを特徴量として算出し、該選択手段は、該ばらつきが所定の範囲内で最大となる矩形領域を有する色プレーンを選択することを特徴とする、電子装置。
Means for dividing the color image data of the read code into color components of a plurality of color planes;
Extraction means for extracting a rectangular region from an arbitrary position of each color plane;
A calculation means for calculating a feature amount of a code included in a rectangular area of each color plane;
Selection means for selecting one color plane based on the feature amount ;
Recognizing means for recognizing the code based on the color component data of the selected color plane ,
The calculating means calculates a variation in pixel values in the rectangular area as a feature amount, and the selecting means selects a color plane having a rectangular area where the variation is maximum within a predetermined range. Electronic devices.
該算出手段は、該矩形領域内の画素値の最小値を特徴量として算出し、該選択手段は、該最小値が所定の範囲内で最小となる矩形領域を有する色プレーンを選択することを特徴とする、請求項7記載の電子装置。  The calculation means calculates the minimum value of the pixel values in the rectangular area as a feature amount, and the selection means selects a color plane having a rectangular area where the minimum value is minimum within a predetermined range. The electronic device according to claim 7, wherein the electronic device is characterized. 該算出手段は、該矩形領域内の白画素と黒画素の比率を特徴量として算出し、該選択手段は、該比率が基準値を含む所定の範囲内にあり、且つ、基準値に最も近い値になるブロックを有するプレーンを選択することを特徴とする、請求項7又は8記載の電子装置。  The calculating means calculates a ratio between white pixels and black pixels in the rectangular area as a feature amount, and the selecting means is within a predetermined range including the reference value and closest to the reference value. 9. The electronic device according to claim 7, wherein a plane having a block to be a value is selected. 該算出手段は、該矩形領域内の水平ライン及び垂直ライン内の画素値の変化点の個数を特徴量として算出し、該選択手段は、該個数が所定の範囲内にあり、且つ、最大となるブロックを有するプレーンを選択することを特徴とする、請求項7〜9のいずれか1項記載の電子装置。  The calculating means calculates the number of change points of the pixel values in the horizontal line and the vertical line in the rectangular area as a feature amount, and the selecting means is such that the number is within a predetermined range and is the maximum. The electronic device according to claim 7, wherein a plane having a block is selected. 該算出手段は、該矩形領域内の特定の水平ライン間及び垂直ライン間の相関を特徴量として算出し、該選択手段は、該相関が所定の範囲内にあり、且つ、最大となるブロックを有するプレーンを選択することを特徴とする、請求項7〜10のいずれか1項記載の電子装置。  The calculating means calculates a correlation between specific horizontal lines and vertical lines in the rectangular area as a feature amount, and the selecting means calculates a block in which the correlation is within a predetermined range and becomes the maximum. The electronic device according to claim 7, wherein the plane is selected.
JP2008506069A 2006-03-16 2006-03-16 Code recognition method and apparatus, electronic apparatus, program, and storage medium Expired - Fee Related JP4653215B2 (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2006/305255 WO2007108053A1 (en) 2006-03-16 2006-03-16 Code recognition method and device, electronic device, program, and storage medium

Publications (2)

Publication Number Publication Date
JPWO2007108053A1 JPWO2007108053A1 (en) 2009-07-30
JP4653215B2 true JP4653215B2 (en) 2011-03-16

Family

ID=38522094

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008506069A Expired - Fee Related JP4653215B2 (en) 2006-03-16 2006-03-16 Code recognition method and apparatus, electronic apparatus, program, and storage medium

Country Status (2)

Country Link
JP (1) JP4653215B2 (en)
WO (1) WO2007108053A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017082607A1 (en) 2015-11-09 2017-05-18 Samsung Electronics Co., Ltd. Electronic device and operating method of the same

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001283149A (en) * 2000-03-31 2001-10-12 Denso Corp Information code reading device
JP2005310148A (en) * 1992-09-28 2005-11-04 Olympus Corp Reproducing device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02129776A (en) * 1988-11-10 1990-05-17 Eastman Kodatsuku Japan Kk Bar code reader
JPH03245283A (en) * 1990-02-23 1991-10-31 Nakane:Kk Remote control information transmission system by retro-reflector with filter
JP2005346646A (en) * 2004-06-07 2005-12-15 Matsushita Electric Ind Co Ltd Mobile terminal for tracing transport object

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005310148A (en) * 1992-09-28 2005-11-04 Olympus Corp Reproducing device
JP2001283149A (en) * 2000-03-31 2001-10-12 Denso Corp Information code reading device

Also Published As

Publication number Publication date
JPWO2007108053A1 (en) 2009-07-30
WO2007108053A1 (en) 2007-09-27

Similar Documents

Publication Publication Date Title
EP1456816B1 (en) Apparatus and method for recognizing code
US20210064859A1 (en) Image processing system, image processing method, and storage medium
EP1993071A1 (en) Image zone detection
US20070140564A1 (en) 2-Dimensional code region extraction method, 2-dimensional code region extraction device, electronic device, 2-dimensional code region extraction program, and recording medium containing the program
US20080018951A1 (en) Image processing apparatus and control method thereof
JP2008099149A (en) Image processor, image processing method and image processing program
US9558433B2 (en) Image processing apparatus generating partially erased image data and supplementary data supplementing partially erased image data
CN110210467B (en) Formula positioning method of text image, image processing device and storage medium
US8705134B2 (en) Method of processing an image to clarify text in the image
JP2010074342A (en) Image processing apparatus, image forming apparatus, and program
JP4653215B2 (en) Code recognition method and apparatus, electronic apparatus, program, and storage medium
EP0949801A2 (en) Image process apparatus, image process method and storage medium
JP4868139B2 (en) Image processing apparatus and image processing program
JP2004127203A (en) Image processor, image processing method, program for causing computer to execute the method, and computer readable recording medium with the program recorded thereon
JP4910635B2 (en) Image processing apparatus and image processing program
JP3838981B2 (en) Image processing apparatus, image processing method, and image processing program
JP2007257360A (en) Two-dimensional code, two-dimensional code reader and two-dimensional code-reading program
JPH11317874A (en) Picture processor and its processing method
US7920737B2 (en) Code image processing method and code image processing apparatus
JP5056063B2 (en) Image processing apparatus and image processing program
CN111681161B (en) Restoration method and device for folded two-dimensional code image and computer readable storage medium
US20080225340A1 (en) Image processing apparatus, image processing method, and computer program product
US9098768B2 (en) Character detection apparatus, character detection method, and computer-readable storage medium
US20230351781A1 (en) Line removal from an image
JP4973603B2 (en) Image processing apparatus and image processing program

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100713

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100913

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

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20101216

R150 Certificate of patent or registration of utility model

Ref document number: 4653215

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20131224

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees