[go: up one dir, main page]

JP4267965B2 - Bar code reader - Google Patents

Bar code reader Download PDF

Info

Publication number
JP4267965B2
JP4267965B2 JP2003134566A JP2003134566A JP4267965B2 JP 4267965 B2 JP4267965 B2 JP 4267965B2 JP 2003134566 A JP2003134566 A JP 2003134566A JP 2003134566 A JP2003134566 A JP 2003134566A JP 4267965 B2 JP4267965 B2 JP 4267965B2
Authority
JP
Japan
Prior art keywords
code
barcode
image
vertex
pixels
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
JP2003134566A
Other languages
Japanese (ja)
Other versions
JP2004341616A (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.)
Ricoh Co Ltd
Original Assignee
Ricoh Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ricoh Co Ltd filed Critical Ricoh Co Ltd
Priority to JP2003134566A priority Critical patent/JP4267965B2/en
Publication of JP2004341616A publication Critical patent/JP2004341616A/en
Application granted granted Critical
Publication of JP4267965B2 publication Critical patent/JP4267965B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
本発明は、画像の読み取りに関し、特にバーコードを読み取るバーコード読取装置に関する。
【0002】
【従来の技術】
業務の電子化が進展しており、流通する電子文書が増大している一方、CRT、LCDなどのディスプレイの文書表示品質はいまだ紙への印刷品質に劣る点も多いために、電子的に作成された文書を紙文書として紙に印刷する機会が増大している。これらの紙文書に対して行われた手書き作業を有効に利用するために、加筆情報を電子化する手段が必要とされているが、現在使われている手書き入力装置は機能が低いため使い勝手が悪いものである。
【0003】
手書き入力装置として、例えば、タブレット、デジタイザとよばれ、板状のセンサーとペン型の装置を用いてコンピュータへ手書き入力を行う装置が存在しているが、これらの装置は単純に加筆座標情報を取得するだけであり、紙文書への手書き作業を電子文書に反映するためには不具合が生ずる。
【0004】
その不具合は、例えば電子文書を印刷した紙の上への加筆する場合に、元の電子文書に加筆を挿入することが望ましいにもかかわらず、電子文書に加筆を挿入することが不可能なことが挙げられる。
【0005】
またスキャナ装置を用いても紙文書を電子文書とすることが可能であるが、この場合にも紙文書への手書き作業を電子文書に反映するためには不具合が生ずる。例えば電子文書を印刷した紙文書をスキャナで再び電子化した場合、ワープロソフトなどで作成した元の電子文書が存在するにもかかわらず、別の電子文書として画像文書が作成されるだけであり、また、その画像文書も、元の電子文書と加筆情報が混在して画像化されており、もとの電子文書に加筆情報を挿入することが不可能である。
【0006】
これらの従来の装置では、加筆座標を取得する機能や、画像を取得する機能しかなく、紙に印刷された元の電子文書がどのようなものであるかを識別不可能であり、取得した加筆座標を挿入すべき電子文書が不明なために上記のような不具合が生じている。
【0007】
こうした問題を解決するために、特許文献1や特許文献3においては次のような方法で解決している。まず電子的に作成された文書を印刷する際に、バーコードなどの機械が識別しやすい模様によって元の電子文書を特定する文書識別情報を同時に印刷する。ここで、文書識別情報とは紙文書に印刷された元となる電子ファイルの保存場所、ファイル名、ページ番号などを表す情報、あるいはそれらを管理する情報であり、たとえば『//C:\MyDocument¥tmp.doc、pp1』などの情報である。
【0008】
次に印刷された紙文書への手書き入力時には、加筆された座標情報と共に文書識別情報を取得する。さらに加筆情報を電子文書に挿入するとき、文書識別情報に従って、筆記の加えられた紙文書がどのような電子文書を印刷したものかを識別し、加筆情報を適切な電子文書へ挿入することを可能としている。
【0009】
特に特許文献2においては、手書き入力装置上に複数の紙文書を積載して設置し、めくりながら自動的に識別することが可能になっており、大量の紙へ施された加筆操作を適切に電子文書に反映し、電子文書と紙文書とを相互に用いて業務をより効率よく実施することが可能になっている。
【0010】
図22に従来例の手書き情報入力装置の概略図を示す。この手書き情報入力装置は、複数の紙文書に行われる手書き情報を取得する装置である。また、手書き情報入力装置は、手書き情報を入力可能な手書き入力部と、複数の紙文書にそれぞれ固有の番号として割り振られた文書識別情報を読み取り可能な文書識別情報読取装置とを有する。
【0011】
利用時には積載設置された複数の紙文書をめくりながら文書識別情報を読み取り、取得した手書き情報を適切な電子文書に挿入する。
【0012】
このとき、紙文書をめくりながら利用するために2次元コードリーダ、バーコードリーダなどによって構成される文書識別情報読取装置は、紙文書の横に設置され、バーコードなどによって紙文書上に表される文書識別情報を斜めから読むことが必要になる。
【0013】
また、このとき、コードリーダの撮像面は、光学系の収差の影響によって画像が暗くなることなどを避けるために光軸と直交するように設置されるので、コードの印刷面とは斜めに対峙することとなる。このとき、十分な光量を得ることができ、深い被写界深度をもつ光学系であれば、広い範囲で鮮明な画像を得ることが可能であるが、斜めから撮像した場合、いわゆる遠近法で描かれた絵画と同様に、通常長方形ないしは正方形の2次元コードを斜めの光学系で読み取ると台形に変形して写る。この現象と逆の現象は、たとえば、プロジェクターによる画像を斜めに壁面に投影した場合、もともとは長方形の図形が台形に変形する現象に見られる。
【0014】
つまり、斜めの光学系では、手前側が大きく、模様の密度が粗く写り、奥側が小さく、模様の密度が密に写ることになる。一方、撮像システムで用いられる2次元撮像素子としては、CCD、C−MOSセンサーが一般的だが、いずれも細かな撮像素子がマトリックス状に一様に分布している。このような一様に分布している撮像素子を用いて、模様の密度の異なる2次元コードを斜めから読み取る場合、最も密度の高く撮像される部分が読み取れるような大きさで撮像する。つまり、奥側の小さく移っている画像は2次元コード内のひとつのブロックをひとつの素子が読み取るようになっているのに対し、手前側の大きく写っている画像ではひとつのパターン(ブロック)を複数の素子が読み取っている。このように手前側の密度の低い部分では、複数の素子が同一のブロック、同一の情報を表現しているため、情報を効率よく表現することが困難である。
【0015】
一方、電子文書が増加するにつれて印刷される紙文書も増加するため、文書識別に必要とされるコードは、より大きな容量を持つコードが必要となっている。文書識別情報読取装置003の大きさやコードを印刷する面積の制約上、たとえば1次元コードとして6桁のCode39形式を用いて、文書識別に利用した場合には、表現できる情報量は36^6=21億である。しかし、前述のように印刷される紙文書の量は増加しており、これは通常の業務において印刷されるすべての紙文書を識別するためには不十分なものである。一方2次元コードにおいては、たとえば、12×6のセル(白黒の最小単位)を持つ2次元コードの場合、誤り訂正符号が32ビットであるならば、表現できる情報量は2^40=1兆であり、誤り訂正符号が16ビットであるならば、2^56=7.2京である。これは上記のCode39の場合と比較してはるかに大きく、通常の紙文書を識別するのに十分な情報量である。
【0016】
以上述べたように従来の手書き文字入力装置では、紙文書の識別に用いられる機械読み取り可能な模様(コード)としてはバーコードが用いられており、その容量に限りがあるために大量の電子文書と紙文書とを連携して利用することが困難であった。こうした現状から、手書き入力装置における識別可能文書の量を増加させるために、斜めから読む光学系でも容易に読み取り可能な2次元コードの開発が求められている。
【0017】
ところで、そのコードの実際の使用に際しては、筆記が開始される前に素早く高精度に読み取る必要があるため、できる限り画像データを処理する量を減らし、かつ画像の品質が悪くとも精度のよいアルゴリズムが必要となってくる。
【0018】
特許文献2では、異なる2種類のセルサイズを有する2次元コードについての記述があるが、その目的は、手持ちのハンディバーコードリーダと、ベルトコンベアを流れる物品に貼られた2次元コードを読み取る固定式バーコードリーダと両者で読み取りが可能になるように発明されたもので、本発明のように斜めから読み取ることを想定していない。
【0019】
【特許文献1】
特開平9−91083号公報
【0020】
【特許文献2】
特開平11−328301号公報
【0021】
【特許文献3】
特開2000−112646号公報
【0022】
【発明が解決しようとする課題】
本発明は、このような問題点に鑑み、高速かつ精度の高い2次元コードのバーコード読取装置を提供することを目的とする。
【0023】
【課題を解決するための手段】
上記課題を解決するために、本発明は、四角形の枠を有するバーコードを撮影することにより、前記バーコードが射影された射影画像を取得し、前記バーコードが表す情報を読み取るバーコード読み取り装置において、前記射影画像を含む画像の四隅から斜め走査を行って黒画素を検出し、検出した黒画素から所定の方向に所定の画素数だけ画素を追跡し、追跡した画素が全て黒画素である場合の前記検出した黒画素を、前記射影画像に撮影されたバーコードであるバーコード画像の枠の頂点候補として検出する頂点候補検出手段と、前記頂点候補に基づき、前記バーコード画像の枠を検出するとともに、前記バーコード画像の頂点を確定させるコード枠検出手段と、前記バーコードの枠の頂点と、前記バーコード画像の枠の頂点に基づき、射影変換係数を算出する射影変換係数算出手段と、前記射影変換係数を用いて、前記バーコード画像から前記バーコードが表す情報を取得するデータサンプリング手段とを有することを特徴とする。
【0026】
また、上記課題を解決するために、本発明は、前記コード枠検出手段は、各頂点候補に基づいて各頂点候補ごとに定まる画素同士を結ぶ線分上の画素のうち、前記バーコードの画素の占める割合が、所定の割合以上の場合、前記バーコード画像に撮影されたバーコードの枠を検出したと判定することを特徴とする。
【0027】
また、上記課題を解決するために、本発明は、前記バーコードの枠の内部は、前記データサンプリング手段が情報を取得するために、2種類の色のうちのいずれか一方の色で情報を表す情報領域を複数含み、前記データサンプリング手段は、前記情報領域内で複数の画素の色を取得し、取得した色のうち、一方の色が占める割合に応じて該情報領域が表す情報を取得することを特徴とする。
【0028】
また、上記課題を解決するために、本発明は、前記データサンプリング手段は、前記バーコードでの前記情報領域の位置と、前記射影画像に撮影された情報領域の位置とを、前記射影変換係数を用いて対応付けることを特徴とする。
【0029】
また、上記課題を解決するために、本発明は、前記バーコードに設けられ、予め定められた位置に配置された前記情報領域が表すパターン情報を検出するファインダ検出部をさらに有することを特徴とする。
【0030】
また、上記課題を解決するために、本発明は、前記データサンプリング手段が取得した情報が、訂正可能な誤りを有する場合、該誤りを訂正する誤り訂正手段をさらに有することを特徴とする。
【0031】
また、上記課題を解決するために、本発明は、前記データサンプリング手段が取得した情報を数値に変換するフォーマット変換部をさらに有することを特徴とする。
【0032】
以上のように、本発明によれば、高速かつ精度の高い2次元コードのバーコード読取装置を提供することができる。
【0033】
【発明の実施の形態】
以下、図面を参照し、本発明の実施形態について説明する。なお、本実施の形態におけるバーコード読取装置は、例えば、図22の文書識別情報読取装置の部分に設けられるものであっても良いし、単体であっても良い。
【0034】
最初に、バーコード読取装置が読み取る画像について説明する。まず、図1に示される2次元コードについて説明する。2次元コードは、図に示されるように、周囲が黒枠で囲まれ、内部に白または黒で1ビットの情報をあらわす最小単位であり情報領域であるセルが、図2に示されるように72個配置されている。従って、この2次元コードは、72ビットの情報を表現することができる。
【0035】
この2次元コードを斜め上から読み取ると、バーコード読取装置が得られるコード画像はセルが大きい下側の部分が縮小されて、台形の形状となる。2次元コード全体のコード画像はこのようにゆがむが、バーコード読取装置で撮影されたコード画像内の各セルは撮像素子の複数画素を占め、その面積はセルの位置に関係なく概略等しくなる。
【0036】
このように上側のセルの大きさは小さく、下側のセルの大きさが大きい2次元コードにより、斜め上からコード画像を読み取るように設けられたバーコード読取装置の撮像素子は、セルの白黒情報の安定した撮影が可能になる。
【0037】
また、2次元コードの他の例として、図3に示される台形コード(平面図)がある。この台形コードは、バーコード読取装置が斜め上から読み取る場合、撮像素子と各セルの距離に応じてセルの大きさが大きくなるようにした2次元コードである。
【0038】
この台形コードの場合、セルは各行に12個配置され、6行あるので、セルの総数は72個ある。このセルの総数は図1の2次元コードのセルの総数と等しいので、この台形コードで表現できるビット数は図1の2次元コードで表現できるビット数と等しい。ちなみに、72ビットのデータは、データの配置を表した図4に示されるように配置される。
【0039】
また、2次元コードの他の例として、図5のように矩形の2次元コード50を射影変換し、台形の2次元コード51に変形した2次元コードを使用することもできる.この場合に、斜め上から撮影した場合に得られるコードの画像は、2次元コード50に近いものが得られる。なお、2次元コード51が表現できる情報量は、72ビットである。
【0040】
上述した3つの2次元コードにおいて共通していることの1つは、コード全体の大きさは横長となっていることである。その理由は、縦長にすると、セルの縦方向の長さが大きくなり、コード全体のサイズが非常に大きくなり、小さい大きさで大容量のデータを表現できるという2次元コードのメリットがなくなるためである。
【0041】
また、バーコード読取装置からみた場合、コードとの距離は縦方向の変化に比べ横方向の変化の方が大きくなるため、バーコード読取装置から遠いところにあるセルは縦横比が大きい長方形にするのが適当である。したがって、図3、5の例ではセルの横の長さの変化より縦の長さの変化のほうを大きくすることにより、バーコード読取装置で撮影したコード画像ではコードの各セルは正方形に近い形状となる。
【0042】
以上説明した2次元コードが、本実施の形態において、バーコード読取装置が読み取る画像である。次に、上述した2次元コードを作成する2次元コード作成装置について図6を用いて説明する。
【0043】
2次元コード作成装置は、フォーマット変換部20と、誤り訂正部21と、コード画像作成部23とを有する。
【0044】
フォーマット変換部20は、入力された数字文字列をコンピュータ内で通常扱われる整数型56ビットデータに変換する。
【0045】
誤り訂正部21は、整数型56ビットデータに変換されたデータに、誤り訂正符号16ビットを付加する。
【0046】
この誤り訂正符号として、リードソロモン符号が用いられる。このリードソロモン符号は、バイト単位の誤りを訂正できる強力な誤り訂正方式であり、誤り訂正符号長の半分以下の誤りを訂正することができる。なお、リードソロモン誤り訂正符号の詳細については、昭晃堂「符号理論(コンピュータ基礎講座18)」宮川、岩垂、今井共著など、多数の書籍に記されている。
【0047】
本実施の形態の場合には、誤り訂正符号長が2バイトなので1バイトの誤り訂正が可能である。
【0048】
コード画像作成部23は、データおよび誤り訂正符号データを図2に示したように2次元コードの各セルに割り当てて、2次元コードの画像を作成する。
【0049】
データおよび誤り訂正符号データのセルへの割り当ては、整数型56ビットデータが1〜56までのセルに、誤り訂正符号のデータ16ビットが57〜72のセルとなっている。なお、コード画像作成時には、規定された頂点座標、セル中心座標が用いられる。この規定座標はコード読み取り時にも使用される。
【0050】
コードの作成はソフトウェアで行ってもよく、図7にその方法のフローチャートを示す。
【0051】
まず、ステップS101で、数字文字列が入力される。ステップS102では、数字文字列がコンピュータ内で通常扱われる整数型56ビットデータに変換される。整数型データに変換されたデータは、ステップS103で、誤り訂正符号16ビットが付加される。この誤り訂正符号は、先ほどと同様にリードソロモン符号が用いられる。このようにして作成されたデータおよび誤り訂正符号データは、ステップS104で、図2や図4に示すように2次元コードの各セルに割り当てられ、2次元コードの画像ができあがる。データのセルへの割り当ても、先ほどと同様に整数型56ビットデータが1〜56までのセルに、誤り訂正符号のデータ16ビットが57〜72のセルとなっている。また、コード画像作成時には、規定された頂点座標、セル中心座標が用いられる.この規定座標はコード読み取り時にも使用される。
【0052】
次に、上述した2次元コードを読み取るバーコード読取装置について説明する。バーコード読取装置は、図8に示されるように、頂点候補検出部11と、コード枠検出部12と、射影変換係数算出部13と、データサンプリング部14と、誤り訂正部15と、フォーマット変換部16とを有する。
【0053】
頂点候補検出部11は、2次元コードの頂点候補を検出する。コード枠検出部12は、頂点候補に基づき、後述するコード枠を検出する。コード枠が検出されることで、頂点候補は真の頂点と確定される。
【0054】
射影変換係数算出部13は、コード枠検出部12で検出されたコード枠の各頂点の座標と、コード画像を作成した時のコード枠の各頂点の規定座標とから、作成したコードの各セルの規定中心座標と読み取ったコード画像の各セルの中心とをマッピングする係数である射影変換係数を求める。
【0055】
データサンプリング部14は、射影変換係数算出部13で求めた射影変換係数を用いて、2次元コードのデータのサンプリングを行う。誤り訂正部15は、データサンプリング部14が読み取ったデータが誤りかどうか判定し、誤りがないか、あるいは誤り訂正が可能ならば、誤り訂正符号以外の整数型56ビットのデータをフォーマット変換部16へ出力する。フォーマット変換部16ではデータを数字文字列に変換して出力する。
【0056】
次に、頂点候補検出部11の処理の詳細について説明する。まず、図9に示すように画像の四隅から斜め走査を行い、黒画素を検出する。検出された黒画素をA、B、C、Dとする。
【0057】
次に、頂点候補検出部11は、図10に示されるように、A、B、C、Dから矢印の方向、例えばAなら右下45度、Bなら左下45度というように、セルの一辺の画素数の1/√2の画素数だけ画素を追跡してそれらがすべて黒画素かどうかを判定する。それらがすべて黒画素であれば、頂点候補検出部11は、A、B、C、Dを頂点候補として検出し、コード枠検出部12に処理を移す。
【0058】
コード枠検出部12について説明する。コード枠検出部12では、図11のように、頂点候補A、B、C、Dから1/√2の画素数だけ追跡した終端どうしを結ぶ黒枠判定ライン52、53、54、55を通過する画素の黒画素の割合が全ての直線において直線毎に8割以上存在すればそれをコード枠であると判定し、頂点候補A、B、C、Dを2次元コードの頂点A、B、C、Dとして確定する。このとき、同時に頂点A、B、C、Dの座標も検出される。
【0059】
次に射影変換係数算出部13について説明する。射影変換係数算出部13では、コード枠検出部12で検出されたコード枠の各頂点の座標と、コード画像を作成した時のコード枠の各頂点の規定座標とから、作成したコードの各セルの規定中心座標と読み取ったコード画像の各セルの中心とをマッピングする係数である射影変換係数を求める。この射影変換係数の求め方は後に説明する。
【0060】
次にデータサンプリング部14について説明する。データサンプリング部14には、コード画像、コードを作成した時点の各セルの規定中心座標、射影変換係数が入力される。データサンプリング部14は、射影変換係数算出部13で求めた射影変換係数を用いて、作成したコード画像の各セルの規定中心座標を射影変換することにより、読み取ったコード画像の各セルの中心座標を求める。
【0061】
データサンプリング部14は、求めた中心座標を画像データのサンプリング中心座標とし、その座標を中心とする3x3画素の黒画素数が白画素数を上回れば‘1’、そうでなければ‘0’としてデータを読み出す。読み出された72ビットのデータは誤り訂正部15に入力、配列され、誤り訂正の判定が行われる。誤りがないか、あるいは誤り訂正が可能ならば、誤り訂正部15は、誤り訂正符号以外の整数型56ビットのデータをフォーマット変換部16へ出力する。フォーマット変換部16ではデータを数字文字列に変換して出力し、数字文字列が復元される。
【0062】
上述した2次元コードの読取もソフトウェアでおこなってもよく、図12にその方法のフローチャートを示す。ステップS201で斜め上から2次元コードを撮像したコード画像が入力される。ステップS202では、2次元コードの頂点候補が検出される。
【0063】
このステップS202では、図9に示すように画像の四隅から斜め走査が行われ、黒画素が検出される。検出された黒画素をA、B、C、Dとする。さらにステップS202では、図10に示されるように、A、B、C、Dから矢印の方向、例えばAなら右下45度、Bなら左下45度というように、セルの一辺の画素数の1/√2の画素数だけ画素が追跡され、それらがすべて黒画素かどうかが判定される。それらがすべて黒画素であればA、B、C、Dが頂点候補として検出され、ステップS203に処理が移る。
【0064】
ステップS203では、図11に示されるように、頂点候補A、B、C、Dから追跡した終端どうしを結ぶ黒枠判定ライン52、53、54、55を通過する画素の黒画素の割合が、全ての直線において直線毎に8割以上存在すればそれをコード枠であると判定され、頂点候補A、B、C、Dが2次元コードの頂点A、B、C、Dとして確定される。このとき、同時に頂点A、B、C、Dの座標も検出される。
【0065】
このステップS203で、コードが検出できなければ、ステップS204の分岐処理でエンドに分岐し、読み取りは終了する。コードが検出された場合は、次のステップS205へ処理は進む。
【0066】
ステップS205では、ステップS203で検出されたコード枠の各頂点の座標と、コード画像を作成した時のコード枠の各頂点の規定座標とから、作成したコードの各セルの規定中心座標と読み取ったコード画像の各セルの中心とをマッピングする係数である射影変換係数が求められる。
【0067】
次のステップS206では、コード画像、射影変換係数、作成したコード画像の各セルの規定中心座標が入力され、ステップS205で求まった射影変換係数を用いて、作成したコード画像の各セルの規定中心座標を射影変換することにより、読み取ったコード画像の各セルの中心座標を求める。
【0068】
さらに、ステップS206では、求めた中心座標を画像データのサンプリング中心座標とし、その座標を中心とする3x3画素の黒画素数が白画素数を上回れば‘1’、そうでなければ ‘0’としてデータが読み出される。読み出された72ビットのデータは、ステップS207で、誤り訂正の判定が行われる。誤りがないか、あるいは誤り訂正が可能ならば、誤り訂正符号以外の整数型56ビットのデータは、ステップS208で、データを数字文字列に変換され、ステップS209で、数字文字列が復元される。
【0069】
次に、射影変換係数の求め方について説明する。射影変換とは3次元空間内の図形・物体を2次元平面・スクリーンへと表示したときの変換である。3次元空間内の物体の座標を2次元平面上の座標へと変換するものであり、3次元画像処理の手法として広く知られたものである。
【0070】
このような射影変換を正確に行うためには、撮像系の位置、光学的特性などが明らかになる必要がある。しかし、さまざまな装置へ対応することを考えると、さまざまな装置すべての撮像系の位置などを特定し、正確に定めることは困難である。
【0071】
その一方で、斜めから撮像する光学系で読み取りやすくなるという効果を発揮するためには、必ずしも正確な射影変換を施す必要はない。例えば、従来の矩形、一様密度のセルで表現される2次元コードではなく、台形や多様な密度のコードであれば、斜めからの光学系で読取が容易になるという効果を発揮することができる。
【0072】
こうした台形コードや多様なセルサイズを実現する簡単な例を図13で説明する。図13に示すような光学系において、読み取った画像は、射影変換によって、もともと長方形であった図形が台形に変形する。
【0073】
このとき、台形の長辺と短辺との比率(X1/X3)は撮像素子からコードのそれぞれの領域への距離の比率の逆数(L3/L1)と等しくなる。本実施の形態においては、通常は矩形で各セルの大きさが均一である2次元コードの代わりに、上記の射影変換をキャンセルできるようなセルの形状や大きさを持つ2次元コードを作成する。
【0074】
セルの大きさの決定は、2次元コードの1行ごとに一定の倍率で行う.この変形の倍率は2次元コードの1行の間においても、撮像面からの距離が異なっているが、たとえば1行の中間の位置における倍率で、1行の上部から下部まで等しい倍率で変換する。この操作によって、階段状のセル境界を持つ形状の2次元コードが得られる(図1、3の2次元コード)。あるいは、厳密に射影変換演算を行って図5のような2次元コードを作成してもよい。
【0075】
次に、厳密な射影変換を、図14を用いて説明する。図14には、読み取られたコード画像を模式的に示したコード画像60と、電子的に生成されたコードを模式的に示したコード61とが示されている。また、コード画像60のAs〜Dsと、コード61のAr〜Drは各頂点であり、括弧内のxs1やyr2は、座標を表している。また、PskとPrkは、あるセルの中心座標を表す。
【0076】
コード画像60のAs〜Dsと、コード61のAr〜Drの頂点は、図15に示される数式を満たす。これらの数式▲1▼▲2▼は、コード61などコードの座標を定めるためのコード座標から、コード画像60などコード画像の座標を定める座標への変換式を表しており、Ar〜DrからAs〜Dsへの座標変換を規定する。
【0077】
式▲1▼は、頂点のX座標に関する数式であり、式▲2▼は、頂点のY座標に関する数式であり、式▲1▼▲2▼の添え字iは、1から4まで動く。これらの数式で、b1〜b8は変換パラメータで、未知数である。これら変換パラメータは、Ar〜Dr、As〜Dsの各座標値を式に代入して八元一次連立方程式を生成し、解くことにより求められる。b1〜b8が求められると、電子的に生成されたコードの各セルの中心座標Prkを変換してコード画像のサンプリング中心座標Pskを求めることができる。
【0078】
次に、コードを高速かつ高精度で認識するための第2の実施の形態について説明する。この実施の形態は、バーコード読取装置だけではなく、スキャナ等の読み取りデバイスを使用した場合にも有効なものである。
【0079】
具体的に第2の実施の形態は、黒枠で囲まれた図形がコードであるか否かどうか、あるいはコードはどの方向を向いているか、というような判定を容易にし、高速かつ高精度とするものである。
【0080】
第2の実施の形態で使用する2次元コードは、図5に示したコードを用いるが、図16に示すようにコードの中心に一意にそのコードの向きが定まる所定のパターン(以下、ファインダパターン62と記す)を保持する。
【0081】
このファインダパターン62は、図16に示されるように、コードの中心に4x2セルを準備し、黒6セル、白2セルから構成され、パターンには方向性が存在する.
このファインダパターン62と、黒の矩形で囲まれた図形とを比較することにより、黒の矩形で囲まれた図形がコードであるか否かを素早く判定することができるし、コードの向きもすぐに判定することができる。その理由は、ファインダパターン62がなければ、誤り訂正を行わなければコードであるか否かが判定できないためである。
【0082】
次に、図17を用いて2次元コード作成装置について説明する。
【0083】
2次元コード作成装置は、フォーマット変換部70と、誤り訂正部71と、コード画像作成部72とを有する。
【0084】
フォーマット変換部20は、入力された数字文字列をコンピュータ内で通常扱われる整数型48ビットデータに変換する。
【0085】
誤り訂正部21は、整数型48ビットデータに変換されたデータと、ファインダパターンを著わす8ビットデータに、誤り訂正符号16ビットを付加する。この誤り訂正符号として、リードソロモン符号が用いられる。
【0086】
コード画像作成部23は、データおよび誤り訂正符号データを図18に示すように2次元コードの各セルに割り当てて、2次元コードの画像を作成する。
【0087】
データ、ファインダパターンおよび誤り訂正符号データのセルへの割り当ては、図18に示すようにファインダパターンを表すデータは1〜8、整数型48ビットデータが9〜56までのセルに、誤り訂正符号のデータ16ビットが57〜72のセルとなっている。なお、コード画像作成時には、規定された頂点座標、セル中心座標が用いられる.この規定座標はコード読み取り時にも使用される.
コードの作成はソフトウェアで行ってもよく、図19にその方法のフローチャートを示す。
【0088】
まず、ステップS301で、数字文字列が入力される。ステップS302では、数字文字列がコンピュータ内で通常扱われる整数型48ビットデータに変換される。次のステップS303では、ファインダパターン8ビットが入力される。また、整数型データに変換されたデータは、ステップS304で、生成された誤り訂正符号16ビットが付加される。この誤り訂正符号は、リードソロモン符号が用いられる。このようにして作成されたデータ、ファインダパターンおよび誤り訂正符号データは、ステップS305で、2次元コードの各セルに割り当てられ、2次元コードの画像ができあがる。
【0089】
データのセルへの割り当ては、ファインダパターンを表すデータは図18の1〜8、整数型48ビットデータが9〜56までのセルに、誤り訂正符号のデータ16ビットが57〜72のセルとなっている。なお、コード画像作成時には、規定された頂点座標、セル中心座標が用いられる。この規定座標はコード読み取り時にも使用される。
【0090】
次に、上述した2次元コードを読み取るバーコード読取装置について説明する。バーコード読取装置は、図20に示されるように、頂点候補検出部81と、コード枠検出部82と、射影変換係数算出部83と、ファインダ検出部84と、データサンプリング部85と、誤り訂正部86と、フォーマット変換部87とを有する。
【0091】
頂点候補検出部81は、2次元コードの頂点候補を検出する。コード枠検出部82は、頂点候補に基づき、コード枠を検出する。コード枠が検出されることで、頂点候補は真の頂点と確定される。
【0092】
射影変換係数算出部83は、コード枠検出部12で検出されたコード枠の各頂点の座標と、コード画像を作成した時のコード枠の各頂点の規定座標とから、作成したコードの各セルの規定中心座標と読み取ったコード画像の各セルの中心とをマッピングする係数である射影変換係数を求める。
【0093】
ファインダ検出部84は、ファインダの検出など、ファインダに関する処理を行う。データサンプリング部85は、射影変換係数算出部83で求めた射影変換係数を用いて、2次元コードのデータのサンプリングを行う。誤り訂正部86は、データサンプリング部85が読み取ったデータが誤りかどうか判定し、誤りがないか、あるいは誤り訂正が可能ならば、誤り訂正符号以外の整数型56ビットのデータをフォーマット変換部87へ出力する。フォーマット変換部87ではデータを数字文字列に変換して出力する。
【0094】
次に、頂点候補検出部81の処理の詳細について説明する。頂点候補検出部81は、頂点候補検出部11(図8参照)と同様に、図9に示すように画像の四隅から斜め走査を行い、黒画素を検出する。検出された黒画素をA、B、C、Dとする。
【0095】
次に、頂点候補検出部81は、図10に示されるように、A、B、C、Dから矢印の方向、例えばAなら右下45度、Bなら左下45度というように、セルの一辺の画素数の1/√2の画素数だけ画素を追跡してそれらがすべて黒画素かどうかを判定する。それらがすべて黒画素であれば、頂点候補検出部11は、A、B、C、Dを頂点候補として検出し、コード枠検出部82に処理を移す。
【0096】
コード枠検出部82について説明する。コード枠検出部82もコード枠検出部12と同様に、図11のように、頂点候補A、B、C、Dから1/√2の画素数だけ追跡した終端どうしを結ぶ黒枠判定ライン52、53、54、55を通過する画素の黒画素の割合が全ての直線において直線毎に8割以上存在すればそれをコード枠であると判定し、頂点候補A、B、C、Dを2次元コードの頂点A、B、C、Dとして確定する。このとき、同時に頂点A、B、C、Dの座標も検出される。
【0097】
次に射影変換係数算出部83について説明する。射影変換係数算出部83も、射影変換係数算出部13と同様に、コード枠検出部82で検出されたコード枠の各頂点の座標と、コード画像を作成した時のコード枠の各頂点の規定座標とから、作成したコードの各セルの規定中心座標と読み取ったコード画像の各セルの中心とをマッピングする係数である射影変換係数を求める。
【0098】
次に、ファインダ検出部84について説明する。ファインダ検出部84は、ファインダパターンの検出を試みる。ファインダ検出部84には、コード画像、射影変換係数、作成したコードのファインダパターンを構成する各セルの規定中心座標が入力される。
【0099】
ファインダ検出部84は、作成したコード画像のファインダパターンを構成する各セルの規定中心座標を射影変換することにより、読み取ったコード画像の各セルの中心座標を求める。
【0100】
ファインダ検出部84は、求めた中心座標を画像データのサンプリング中心座標とし、その座標を中心とする3x3画素の黒画素数が白画素数を上回れば‘1’、そうでなければ‘0’としてデータを読み出し、読み出したデータとファインダパターンの真のデータを比較し、誤りが1つ以下であれば、現在扱っている図形がコードであると判定する。もし、誤りが2つ以上である場合は、コードの向きが合っていない可能性があるので、コードを90度ずつ回転させてファインダパターンの検出を行う。4つの向きでファインダパターンの検出を行っても、ファインダが検出されなかった場合に初めて現在処理している画像はコードではないと判定する。
【0101】
次にデータサンプリング部85について説明する。データサンプリング部85もデータサンプリング部と同様に、コード画像、コードを作成した時点の各セルの規定中心座標、射影変換係数が入力される。データサンプリング部85は、射影変換係数算出部83で求めた射影変換係数を用いて、作成したコード画像の各セルの規定中心座標を射影変換することにより、読み取ったコード画像の各セルの中心座標を求める。
【0102】
データサンプリング部85は、求めた中心座標を画像データのサンプリング中心座標とし、その座標を中心とする3x3画素の黒画素数が白画素数を上回れば‘1’、そうでなければ‘0’としてデータを読み出す。読み出された72ビットのデータは誤り訂正部86に入力、配列され、誤り訂正の判定が行われる。誤りがないか、あるいは誤り訂正が可能ならば、誤り訂正符号とファインダパターンデータ以外のデータ整数型48ビットのデータをフォーマット変換部87へ出力する。フォーマット変換部87ではデータを数字文字列に変換して出力する。
【0103】
上述した2次元コードの読取もソフトウェアでおこなってもよく、図21にその方法のフローチャートを示す。ステップS401で斜め上から2次元コードを撮像したコード画像が入力される。ステップS402では、2次元コードの頂点候補が検出される。
【0104】
このステップS402では、図9に示すように画像の四隅から斜め走査が行われ、黒画素が検出される。検出された黒画素をA、B、C、Dとする。さらにステップS402では、図10に示されるように、A、B、C、Dから矢印の方向、例えばAなら右下45度、Bなら左下45度というように、セルの一辺の画素数の1/√2の画素数だけ画素が追跡され、それらがすべて黒画素かどうかが判定される。それらがすべて黒画素であればA、B、C、Dが頂点候補として検出され、ステップS403に処理が移る。
【0105】
ステップS403では、図11に示されるように、頂点候補A、B、C、Dから追跡した終端どうしを結ぶ黒枠判定ライン52、53、54、55を通過する画素の黒画素の割合が、全ての直線において直線毎に8割以上存在すればそれをコード枠であると判定され、頂点候補A、B、C、Dが2次元コードの頂点A、B、C、Dとして確定される。このとき、同時に頂点A、B、C、Dの座標も検出される。
【0106】
このステップS403で、コードが検出できなければ、ステップS404の分岐処理でエンドに分岐し、読み取りは終了する。コードが検出された場合は、次のステップS405へ処理は進む。
【0107】
ステップS405では、ステップS403で検出されたコード枠の各頂点の座標と、コード画像を作成した時のコード枠の各頂点の規定座標とから、作成したコードの各セルの規定中心座標と読み取ったコード画像の各セルの中心とをマッピングする係数である射影変換係数が求められる。
【0108】
次のステップS406では、ファインダの検出が試みられる。このステップS406では、コード画像、射影変換係数、作成したコードのファインダパターンを構成する各セルの規定中心座標が入力される。また、ステップS406では、作成したコード画像のファインダパターンを構成する各セルの規定中心座標を射影変換することにより、読み取ったコード画像の各セルの中心座標を求め、それを画像データのサンプリング中心座標とし、その座標を中心とする3x3画素の黒画素数が白画素数を上回れば‘1’、そうでなければ‘0’としてデータを読み出し、読み出したデータとファインダパターンの真のデータを比較し、誤りが1つ以下であれば、現在扱っている図形がコードであると判定される。もし、誤りが2つ以上である場合は、コードの向きが合っていない可能性があるので、コードを90度ずつ回転させてファインダパターンの検出を行う。4つの向きでファインダパターンの検出を行っても、ファインダが検出されなかった場合に初めて現在処理している画像はコードではないと判定する。
【0109】
ファインダ検出が成功した場合は次のステップS408へ進み、失敗した場合は処理を終了する。
【0110】
次のステップS408では、コード画像、射影変換係数、作成したコード画像の各セルの規定中心座標が入力され、ステップS405で求まった射影変換係数を用いて、作成したコード画像の各セルの規定中心座標を射影変換することにより、読み取ったコード画像の各セルの中心座標を求める。
【0111】
さらに、ステップS408では、求めた中心座標を画像データのサンプリング中心座標とし、その座標を中心とする3x3画素の黒画素数が白画素数を上回れば‘1’、そうでなければ ‘0’としてデータが読み出される。読み出された72ビットのデータは、ステップS409で、誤り訂正の判定が行われる。誤りがないか、あるいは誤り訂正が可能ならば、誤り訂正符号以外の整数型48ビットのデータは、ステップS410で、データを数字文字列に変換され、ステップS411で、数字文字列が復元される。
【0112】
上記の例では、使用できるデータは56ビットから48ビットに減少したが、コードのセル数を増やしてより多くのデータを保持することも可能である.セル数を14x8とすれば112ビット(14バイト)のデータを格納することができ、例えばデータに72ビット、ファインダに8ビット、誤り訂正32ビットに割り当てることができる.いくつのセルが必要かは用途によって決まる.
この実施例では、ファインダパターンを使用してコードであるか否かの判定、コードの方向の判定も高速にできるので図22の手書き入力装置だけでなく、スキャナ、デジタルカメラ等の様々なデバイスを利用してコードを読み取ることが可能になる。
【0113】
【発明の効果】
以上のように、本発明によれば、高速かつ精度の高い2次元コードのバーコード読取装置を提供することができる。
【図面の簡単な説明】
【図1】2次元コードを示す図である。
【図2】データの配置位置を示す図である。
【図3】2次元コードを示す図である。
【図4】データの配置位置を示す図である。
【図5】射影変換を示す図である。
【図6】2次元コード作成装置を構成する各部を示す図である。
【図7】2次元コード作成処理を示すフローチャートである。
【図8】バーコード読取装置を構成する各部を示す図である。
【図9】頂点画素検出を示す図である。
【図10】頂点候補検出を示す図である。
【図11】コード枠検出を示す図である。
【図12】2次元コード読み取り処理を示すフローチャートである。
【図13】斜め方向からの読み取る様子を示す図である。
【図14】コード画像とコードを示す図である。
【図15】変換パラメータを求める数式を示す図である。
【図16】ファインダパターンを示す2次元コードを示す図である。
【図17】2次元コード作成装置を構成する各部を示す図である。
【図18】データの配置位置を示す図である。
【図19】2次元コード作成処理を示すフローチャートである。
【図20】バーコード読取装置を構成する各部を示す図である。
【図21】2次元コード読み取り処理を示すフローチャートである。
【図22】手書き入力装置を示す図である。
【符号の説明】
11、81…頂点候補検出部
12、82…コード検出部
13、83…射影変換係数算出部
14、85…データサンプリング部
15、86…誤り訂正部
16、20、70、87…フォーマット変換部
21、71…誤り訂正部
23、72…コード画像作成部
50、51…2次元コード
52、53、54、55…黒枠判定ライン
60…コード画像
61…コード
62…ファインダパターン
84…ファインダ検出部
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to image reading, and more particularly, to a bar code reader for reading bar codes.
[0002]
[Prior art]
While the digitization of business is progressing and the number of electronic documents in circulation is increasing, the document display quality of displays such as CRT and LCD is still inferior to the print quality on paper, so it is created electronically Opportunities to print the printed document on paper as a paper document are increasing. In order to effectively use the handwriting work performed on these paper documents, a means for digitizing the added information is required. However, the handwriting input devices currently used are low in functionality and thus are easy to use. It ’s bad.
[0003]
As a handwriting input device, for example, there are devices called a tablet and a digitizer, which perform handwriting input to a computer using a plate-shaped sensor and a pen-type device. In order to reflect the handwritten work on the paper document in the electronic document, there is a problem.
[0004]
The problem is that, for example, when an electronic document is written on printed paper, it is desirable to insert the original electronic document, but it is impossible to insert the electronic document. Is mentioned.
[0005]
Even if a scanner device is used, a paper document can be converted into an electronic document. However, in this case as well, there is a problem in reflecting the handwriting operation on the paper document in the electronic document. For example, when a paper document on which an electronic document is printed is digitized again with a scanner, an image document is only created as another electronic document, even though the original electronic document created with word processing software exists. Further, the image document is also imaged by mixing the original electronic document and the additional information, and it is impossible to insert the additional information into the original electronic document.
[0006]
These conventional devices only have a function for acquiring the retouched coordinates and a function for acquiring the image, and cannot identify what the original electronic document printed on the paper looks like. Since the electronic document into which the coordinates are to be inserted is unknown, the above-described problem occurs.
[0007]
In order to solve these problems, Patent Document 1 and Patent Document 3 solve the problem by the following method. First, when printing an electronically created document, document identification information for specifying the original electronic document is simultaneously printed with a pattern such as a barcode that can be easily identified by a machine. Here, the document identification information is information indicating the storage location, file name, page number, etc. of the original electronic file printed on the paper document, or information for managing them. For example, “// C: \ MyDocument ¥ tmp. doc, pp1 ”and the like.
[0008]
Next, at the time of handwriting input to a printed paper document, document identification information is acquired together with the added coordinate information. Furthermore, when inserting additional information into an electronic document, according to the document identification information, identify what electronic document the printed paper document has been printed on, and insert the additional information into an appropriate electronic document. It is possible.
[0009]
In particular, in Patent Document 2, a plurality of paper documents are stacked and placed on a handwriting input device, and can be automatically identified while being turned. Reflecting on the electronic document, it is possible to more efficiently implement the business by using the electronic document and the paper document mutually.
[0010]
FIG. 22 shows a schematic diagram of a conventional handwritten information input apparatus. This handwritten information input device is a device that acquires handwritten information performed on a plurality of paper documents. The handwritten information input device includes a handwritten input unit that can input handwritten information, and a document identification information reading device that can read document identification information assigned to each of a plurality of paper documents as a unique number.
[0011]
When using, the document identification information is read while turning a plurality of stacked paper documents, and the acquired handwritten information is inserted into an appropriate electronic document.
[0012]
At this time, a document identification information reading device constituted by a two-dimensional code reader, a barcode reader, or the like for use while turning a paper document is installed beside the paper document and displayed on the paper document by a barcode or the like. It is necessary to read the document identification information from an angle.
[0013]
At this time, the imaging surface of the code reader is placed so as to be orthogonal to the optical axis in order to avoid darkening the image due to the aberration of the optical system. Will be. At this time, a sufficient amount of light can be obtained, and if it is an optical system having a deep depth of field, it is possible to obtain a clear image in a wide range. As with the paintings that are drawn, when a rectangular or square two-dimensional code is read with an oblique optical system, it is transformed into a trapezoid. A phenomenon opposite to this phenomenon can be seen, for example, in the case where an image by a projector is projected obliquely on a wall surface, and a rectangular figure is originally transformed into a trapezoid.
[0014]
That is, in the oblique optical system, the front side is large and the pattern density is rough, and the back side is small and the pattern density is dense. On the other hand, as a two-dimensional image sensor used in the image pickup system, a CCD and a C-MOS sensor are generally used, but fine image sensors are uniformly distributed in a matrix. When such a uniformly distributed image sensor is used to read a two-dimensional code having a different pattern density from an oblique direction, the image is captured in such a size that a portion to be imaged with the highest density can be read. In other words, one element reads one block in the two-dimensional code in the small moving image on the back side, while one pattern (block) appears in the large image on the near side. Multiple elements are reading. In this way, in the portion having a low density on the near side, since a plurality of elements express the same block and the same information, it is difficult to efficiently express the information.
[0015]
On the other hand, as the number of electronic documents increases, the number of paper documents to be printed also increases. Therefore, a code required for document identification is required to have a larger capacity. Due to restrictions on the size of the document identification information reading device 003 and the area where the code is printed, for example, when a 6-digit Code39 format is used as a one-dimensional code and used for document identification, the amount of information that can be expressed is 36 ^ 6 = 2.1 billion. However, as described above, the amount of paper documents printed is increasing, which is insufficient to identify all paper documents printed in normal business operations. On the other hand, in the two-dimensional code, for example, in the case of a two-dimensional code having 12 × 6 cells (black and white minimum unit), if the error correction code is 32 bits, the amount of information that can be expressed is 2 ^ 40 = 1 trillion. If the error correction code is 16 bits, 2 ^ 56 = 7.2 K. This is much larger than the case of Code 39 above, and is an amount of information sufficient to identify a normal paper document.
[0016]
As described above, in the conventional handwritten character input device, a barcode is used as a machine-readable pattern (code) used for identifying a paper document, and because of its limited capacity, a large amount of electronic documents And paper documents were difficult to use in cooperation. Under these circumstances, in order to increase the amount of identifiable documents in a handwriting input device, development of a two-dimensional code that can be easily read by an optical system that is read from an oblique direction is required.
[0017]
By the way, when actually using the code, it is necessary to read it quickly and with high accuracy before writing begins. Therefore, the amount of image data processed is reduced as much as possible, and an accurate algorithm is available even if the image quality is poor. Will be needed.
[0018]
In Patent Document 2, there is a description of a two-dimensional code having two different cell sizes. The purpose is to fix a hand-held bar code reader and a two-dimensional code affixed to an article flowing on a belt conveyor. It was invented so that it can be read by both the bar code reader and it is not assumed to be read obliquely as in the present invention.
[0019]
[Patent Document 1]
JP-A-9-91083
[0020]
[Patent Document 2]
JP 11-328301 A
[0021]
[Patent Document 3]
JP 2000-112646 A
[0022]
[Problems to be solved by the invention]
The present invention has been made in view of such problems, and an object of the present invention is to provide a high-speed and high-accuracy two-dimensional code barcode reader.
[0023]
[Means for Solving the Problems]
In order to solve the above-mentioned problem, the present invention acquires a projected image on which the barcode is projected by photographing a barcode having a rectangular frame, and reads the information represented by the barcode. In the projection image The black pixel is detected by performing oblique scanning from the four corners of the image including the pixel, the predetermined number of pixels are tracked in the predetermined direction from the detected black pixel, and the detection is performed when all the tracked pixels are black pixels. Black pixels, Vertex candidates for a frame of a barcode image that is a barcode photographed in the projected image As A vertex candidate detecting means for detecting; a code frame detecting means for detecting a frame of the barcode image and determining a vertex of the barcode image based on the vertex candidate; a vertex of the barcode frame; Projection conversion coefficient calculation means for calculating a projection conversion coefficient based on the vertex of the frame of the barcode image; and data sampling means for acquiring information represented by the barcode from the barcode image using the projection conversion coefficient. It is characterized by having.
[0026]
In order to solve the above-described problem, the present invention provides the code frame detection unit, wherein the barcode pixel is a pixel on the line segment among pixels on a line segment connecting pixels determined for each vertex candidate based on each vertex candidate. When the ratio occupied by is greater than or equal to a predetermined ratio, it is determined that a barcode frame photographed in the barcode image is detected.
[0027]
In order to solve the above-mentioned problem, the present invention provides that the inside of the frame of the barcode has information in one of two colors for the data sampling means to acquire information. A plurality of information areas to be represented, wherein the data sampling unit obtains colors of a plurality of pixels in the information area, and obtains information represented by the information area in accordance with a ratio occupied by one of the obtained colors It is characterized by doing.
[0028]
In order to solve the above-mentioned problem, the present invention provides the data sampling unit, wherein the position of the information area in the barcode and the position of the information area photographed in the projected image are converted to the projective transformation coefficient. It is characterized by making it correspond using.
[0029]
In order to solve the above problem, the present invention further includes a finder detection unit that detects pattern information represented by the information area that is provided in the barcode and is arranged at a predetermined position. To do.
[0030]
In order to solve the above problem, the present invention is characterized by further comprising error correction means for correcting an error when the information acquired by the data sampling means has a correctable error.
[0031]
In order to solve the above-mentioned problem, the present invention further includes a format conversion unit that converts information acquired by the data sampling unit into a numerical value.
[0032]
As described above, according to the present invention, it is possible to provide a high-speed and high-accuracy two-dimensional code barcode reader.
[0033]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings. Note that the barcode reader in the present embodiment may be provided, for example, in the document identification information reader of FIG. 22 or may be a single unit.
[0034]
First, an image read by the barcode reader will be described. First, the two-dimensional code shown in FIG. 1 will be described. As shown in the figure, the two-dimensional code is surrounded by a black frame, and the cell which is the smallest unit and information area representing 1-bit information in white or black is 72 as shown in FIG. Are arranged. Therefore, this two-dimensional code can express 72-bit information.
[0035]
When this two-dimensional code is read obliquely from above, the code image obtained by the bar code reader is reduced to a trapezoidal shape by reducing the lower part where the cells are large. The code image of the entire two-dimensional code is distorted in this way, but each cell in the code image photographed by the barcode reader occupies a plurality of pixels of the image sensor, and the area thereof is approximately equal regardless of the position of the cell.
[0036]
As described above, the image sensor of the barcode reader provided to read the code image obliquely from above with a two-dimensional code in which the size of the upper cell is small and the size of the lower cell is large is Stable shooting of information becomes possible.
[0037]
Another example of the two-dimensional code is a trapezoidal code (plan view) shown in FIG. This trapezoidal code is a two-dimensional code in which the size of the cell increases in accordance with the distance between the imaging element and each cell when the barcode reader reads from obliquely above.
[0038]
In the case of this trapezoidal code, 12 cells are arranged in each row and there are 6 rows, so the total number of cells is 72. Since the total number of cells is equal to the total number of cells of the two-dimensional code in FIG. 1, the number of bits that can be expressed by the trapezoid code is equal to the number of bits that can be expressed by the two-dimensional code of FIG. Incidentally, the 72-bit data is arranged as shown in FIG. 4 showing the arrangement of the data.
[0039]
As another example of the two-dimensional code, a two-dimensional code obtained by projective transformation of a rectangular two-dimensional code 50 as shown in FIG. 5 and transformed into a trapezoidal two-dimensional code 51 can be used. In this case, an image of the code obtained when the image is taken obliquely from above is obtained that is close to the two-dimensional code 50. The amount of information that can be expressed by the two-dimensional code 51 is 72 bits.
[0040]
One thing common to the three two-dimensional codes described above is that the size of the entire code is horizontally long. The reason for this is that if the cell is vertically long, the vertical length of the cell becomes large, the overall size of the code becomes very large, and the advantage of the two-dimensional code that it is possible to express a large amount of data with a small size is lost. is there.
[0041]
When viewed from the bar code reader, the distance from the code is larger in the horizontal direction than in the vertical direction, so the cells far from the bar code reader are rectangular with a large aspect ratio. Is appropriate. Therefore, in the example of FIGS. 3 and 5, by making the change in the vertical length larger than the change in the horizontal length of the cell, each cell of the code is close to a square in the code image taken by the barcode reader. It becomes a shape.
[0042]
The two-dimensional code described above is an image read by the barcode reader in the present embodiment. Next, a two-dimensional code creation apparatus that creates the above-described two-dimensional code will be described with reference to FIG.
[0043]
The two-dimensional code creation device includes a format conversion unit 20, an error correction unit 21, and a code image creation unit 23.
[0044]
The format conversion unit 20 converts the input numeric character string into integer 56-bit data that is normally handled in the computer.
[0045]
The error correction unit 21 adds 16 bits of an error correction code to the data converted into the integer type 56-bit data.
[0046]
A Reed-Solomon code is used as this error correction code. This Reed-Solomon code is a powerful error correction method capable of correcting an error in byte units, and can correct an error of half or less of the error correction code length. The details of Reed-Solomon error correction codes are described in many books such as Shogodo “Code Theory (Computer Fundamental Course 18)” by Miyagawa, Iwabuchi, and Imai.
[0047]
In this embodiment, since the error correction code length is 2 bytes, 1-byte error correction is possible.
[0048]
The code image creation unit 23 assigns the data and the error correction code data to each cell of the two-dimensional code as shown in FIG. 2, and creates a two-dimensional code image.
[0049]
Data and error correction code data are assigned to cells in which integer 56-bit data is 1 to 56 cells and error correction code data 16 bits is 57 to 72 cells. Note that the specified vertex coordinates and cell center coordinates are used when creating the code image. This specified coordinate is also used when reading the code.
[0050]
The code may be generated by software, and FIG. 7 shows a flowchart of the method.
[0051]
First, in step S101, a numeric character string is input. In step S102, the numeric character string is converted into integer type 56-bit data that is normally handled in the computer. The data converted to integer data is added with 16 bits of error correction code in step S103. As this error correction code, a Reed-Solomon code is used as before. The data and error correction code data created in this way are assigned to each cell of the two-dimensional code in step S104 as shown in FIGS. 2 and 4, and a two-dimensional code image is created. Similarly to the previous case, the data is assigned to cells in which the integer type 56-bit data is 1 to 56, and the error correction code data 16 bits is 57 to 72 cells. In addition, when creating a code image, the specified vertex coordinates and cell center coordinates are used. This specified coordinate is also used when reading the code.
[0052]
Next, a barcode reader that reads the above-described two-dimensional code will be described. As shown in FIG. 8, the barcode reader includes a vertex candidate detection unit 11, a code frame detection unit 12, a projective transformation coefficient calculation unit 13, a data sampling unit 14, an error correction unit 15, and a format conversion. Part 16.
[0053]
The vertex candidate detection unit 11 detects a vertex candidate of the two-dimensional code. The code frame detection unit 12 detects a code frame to be described later based on the vertex candidates. By detecting the code frame, the vertex candidate is determined as a true vertex.
[0054]
The projective transformation coefficient calculation unit 13 calculates each cell of the created code from the coordinates of each vertex of the code frame detected by the code frame detection unit 12 and the specified coordinates of each vertex of the code frame when the code image is created. A projective transformation coefficient that is a coefficient for mapping the prescribed center coordinates of the cell and the center of each cell of the read code image is obtained.
[0055]
The data sampling unit 14 samples the data of the two-dimensional code using the projection transformation coefficient obtained by the projection transformation coefficient calculation unit 13. The error correction unit 15 determines whether the data read by the data sampling unit 14 is an error. If there is no error or error correction is possible, the format conversion unit 16 converts the integer type 56-bit data other than the error correction code. Output to. The format converter 16 converts the data into a numeric character string and outputs it.
[0056]
Next, details of processing of the vertex candidate detection unit 11 will be described. First, as shown in FIG. 9, oblique scanning is performed from the four corners of the image to detect black pixels. Let the detected black pixels be A, B, C, and D.
[0057]
Next, as shown in FIG. 10, the vertex candidate detection unit 11 performs one side of the cell from A, B, C, and D in the direction of the arrow, for example, 45 degrees lower right for A and 45 degrees lower left for B. The pixels are tracked by the number of pixels which is 1 / √2 of the number of pixels in the above, and it is determined whether or not they are all black pixels. If all of them are black pixels, the vertex candidate detection unit 11 detects A, B, C, and D as vertex candidates, and moves the processing to the code frame detection unit 12.
[0058]
The code frame detection unit 12 will be described. As shown in FIG. 11, the code frame detection unit 12 passes through black frame determination lines 52, 53, 54, and 55 that connect the end points tracked by the number of pixels of 1 / √2 from the vertex candidates A, B, C, and D. If the ratio of black pixels of pixels is 80% or more for every straight line in each straight line, it is determined that it is a code frame, and vertex candidates A, B, C, and D are designated as vertices A, B, and C of the two-dimensional code. , D is confirmed. At this time, the coordinates of the vertices A, B, C, and D are also detected.
[0059]
Next, the projective transformation coefficient calculation unit 13 will be described. In the projective transformation coefficient calculation unit 13, each cell of the generated code is determined from the coordinates of each vertex of the code frame detected by the code frame detection unit 12 and the specified coordinates of each vertex of the code frame when the code image is generated. A projective transformation coefficient that is a coefficient for mapping the prescribed center coordinates of the cell and the center of each cell of the read code image is obtained. A method for obtaining the projective transformation coefficient will be described later.
[0060]
Next, the data sampling unit 14 will be described. The data sampling unit 14 receives the code image, the specified center coordinates of each cell when the code is created, and the projective transformation coefficient. The data sampling unit 14 performs projective transformation on the specified center coordinates of each cell of the generated code image using the projection transformation coefficient obtained by the projection transformation coefficient calculation unit 13, thereby the center coordinates of each cell of the read code image. Ask for.
[0061]
The data sampling unit 14 sets the obtained center coordinate as the sampling center coordinate of the image data, and sets it to “1” if the number of black pixels of 3 × 3 pixels centering on the coordinate exceeds the number of white pixels, and to “0” otherwise. Read data. The read 72-bit data is input and arranged in the error correction unit 15, and determination of error correction is performed. If there is no error or error correction is possible, the error correction unit 15 outputs integer type 56-bit data other than the error correction code to the format conversion unit 16. The format converter 16 converts the data into a numeric character string and outputs it, thereby restoring the numeric character string.
[0062]
The above-described reading of the two-dimensional code may be performed by software, and FIG. 12 shows a flowchart of the method. In step S201, a code image obtained by imaging a two-dimensional code is input from diagonally above. In step S202, a vertex candidate of a two-dimensional code is detected.
[0063]
In step S202, as shown in FIG. 9, diagonal scanning is performed from the four corners of the image, and black pixels are detected. Let the detected black pixels be A, B, C, and D. Further, in step S202, as shown in FIG. 10, the number of pixels on one side of the cell is 1 in the direction of arrows from A, B, C, D, for example, 45 degrees lower right for A and 45 degrees lower left for B. Pixels are tracked by the number of pixels of / √2, and it is determined whether they are all black pixels. If they are all black pixels, A, B, C and D are detected as vertex candidates, and the process proceeds to step S203.
[0064]
In step S203, as shown in FIG. 11, the ratios of the black pixels passing through the black frame determination lines 52, 53, 54, and 55 connecting the end points tracked from the vertex candidates A, B, C, and D are all If 80% or more exists in each straight line, it is determined that it is a code frame, and vertex candidates A, B, C, D are determined as vertices A, B, C, D of the two-dimensional code. At this time, the coordinates of the vertices A, B, C, and D are also detected.
[0065]
If no code can be detected in step S203, the process branches to the end in the branching process in step S204, and the reading ends. If a code is detected, the process proceeds to the next step S205.
[0066]
In step S205, the specified center coordinates of each cell of the generated code are read from the coordinates of each vertex of the code frame detected in step S203 and the specified coordinates of each vertex of the code frame when the code image is generated. A projective transformation coefficient that is a coefficient for mapping the center of each cell of the code image is obtained.
[0067]
In the next step S206, the code image, the projective transformation coefficient, and the specified center coordinates of each cell of the created code image are input, and the specified center of each cell of the created code image is obtained using the projective transformation coefficient obtained in step S205. By performing projective transformation of the coordinates, the center coordinates of each cell of the read code image are obtained.
[0068]
Further, in step S206, the obtained center coordinate is set as the sampling center coordinate of the image data. If the number of black pixels of 3 × 3 pixels centering on the coordinate exceeds the number of white pixels, it is set to “1”, and otherwise set to “0”. Data is read out. The read 72-bit data is subjected to error correction determination in step S207. If there is no error or error correction is possible, the integer type 56-bit data other than the error correction code is converted into a numeric character string in step S208, and the numeric character string is restored in step S209. .
[0069]
Next, how to obtain the projective transformation coefficient will be described. Projective transformation is transformation when a figure / object in a three-dimensional space is displayed on a two-dimensional plane / screen. This is a technique for converting the coordinates of an object in a three-dimensional space into coordinates on a two-dimensional plane, and is widely known as a three-dimensional image processing technique.
[0070]
In order to perform such projection conversion accurately, it is necessary to clarify the position of the imaging system, optical characteristics, and the like. However, considering the compatibility with various devices, it is difficult to specify and accurately determine the positions of the imaging systems of all the various devices.
[0071]
On the other hand, it is not always necessary to perform an accurate projective transformation in order to exhibit the effect of being easily read by an optical system that captures an image from an oblique direction. For example, a trapezoidal or various density code can be used to facilitate reading with an oblique optical system, rather than a conventional rectangular, two-dimensional code represented by uniform density cells. it can.
[0072]
A simple example for realizing such trapezoidal codes and various cell sizes will be described with reference to FIG. In the optical system as shown in FIG. 13, the read image is transformed into a trapezoidal figure by the projective transformation.
[0073]
At this time, the ratio (X1 / X3) between the long side and the short side of the trapezoid is equal to the reciprocal (L3 / L1) of the ratio of the distance from the image sensor to each area of the code. In this embodiment, instead of a two-dimensional code that is normally rectangular and has a uniform cell size, a two-dimensional code having a cell shape and size that can cancel the above projective transformation is created. .
[0074]
The cell size is determined at a constant magnification for each line of the 2D code. The magnification of this deformation is different in the distance from the imaging surface even in one line of the two-dimensional code. For example, the magnification at the middle position of one line is converted at the same magnification from the top to the bottom of one line. . By this operation, a two-dimensional code having a stepped cell boundary is obtained (two-dimensional code in FIGS. 1 and 3). Alternatively, a two-dimensional code as shown in FIG. 5 may be created by strictly performing projective transformation calculation.
[0075]
Next, strict projective transformation will be described with reference to FIG. FIG. 14 shows a code image 60 schematically showing a read code image and a code 61 schematically showing an electronically generated code. Further, As to Ds of the code image 60 and Ar to Dr of the code 61 are vertices, and xs1 and yr2 in parentheses represent coordinates. Psk and Prk represent the center coordinates of a certain cell.
[0076]
The vertices of As to Ds of the code image 60 and Ar to Dr of the code 61 satisfy the mathematical formula shown in FIG. These mathematical formulas (1) and (2) represent conversion formulas from code coordinates for determining the coordinates of the code, such as the code 61, to coordinates for determining the coordinates of the code image, such as the code image 60, from Ar to Dr to As. Define coordinate transformation to ~ Ds.
[0077]
Expression (1) is an expression related to the X coordinate of the vertex, Expression (2) is an expression related to the Y coordinate of the vertex, and the subscript i of Expression (1) and (2) moves from 1 to 4. In these mathematical formulas, b1 to b8 are conversion parameters, which are unknown numbers. These conversion parameters are obtained by substituting the coordinate values of Ar to Dr and As to Ds into an equation to generate and solve an eight-way linear simultaneous equation. When b1 to b8 are obtained, the center coordinate Prk of each cell of the electronically generated code can be converted to obtain the sampling center coordinate Psk of the code image.
[0078]
Next, a second embodiment for recognizing codes with high speed and high accuracy will be described. This embodiment is effective not only when a barcode reader is used but also when a reading device such as a scanner is used.
[0079]
Specifically, in the second embodiment, it is easy to determine whether or not a figure surrounded by a black frame is a code, or in which direction the code is oriented, and it is fast and accurate. Is.
[0080]
As the two-dimensional code used in the second embodiment, the code shown in FIG. 5 is used. As shown in FIG. 16, a predetermined pattern in which the direction of the code is uniquely determined at the center of the code (hereinafter referred to as a finder pattern). 62).
[0081]
As shown in FIG. 16, the finder pattern 62 includes 4 × 2 cells at the center of the code and is composed of 6 black cells and 2 white cells. The pattern has directionality.
By comparing this finder pattern 62 with a figure enclosed by a black rectangle, it is possible to quickly determine whether or not the figure enclosed by the black rectangle is a code, and the direction of the code is also immediately Can be determined. The reason is that if the finder pattern 62 is not provided, it cannot be determined whether or not the code is provided unless error correction is performed.
[0082]
Next, a two-dimensional code creation device will be described with reference to FIG.
[0083]
The two-dimensional code creation device includes a format conversion unit 70, an error correction unit 71, and a code image creation unit 72.
[0084]
The format conversion unit 20 converts the input numeric character string into integer type 48-bit data normally handled in the computer.
[0085]
The error correction unit 21 adds 16 bits of error correction code to the data converted into integer type 48-bit data and the 8-bit data that represents the finder pattern. A Reed-Solomon code is used as this error correction code.
[0086]
The code image creation unit 23 assigns the data and the error correction code data to each cell of the two-dimensional code as shown in FIG. 18, and creates a two-dimensional code image.
[0087]
As shown in FIG. 18, the data, the finder pattern, and the error correction code data are assigned to the cells. As shown in FIG. 18, the data representing the finder pattern is 1 to 8 and the integer type 48-bit data is 9 to 56 cells. Data 16 bits are 57 to 72 cells. When creating a code image, the specified vertex coordinates and cell center coordinates are used. This specified coordinate is also used when reading the code.
The code may be generated by software, and FIG. 19 shows a flowchart of the method.
[0088]
First, in step S301, a numeric character string is input. In step S302, the numeric character string is converted into integer type 48-bit data normally handled in the computer. In the next step S303, 8 bits of the finder pattern are input. Further, the data converted into the integer type data is added with 16 bits of the generated error correction code in step S304. As this error correction code, a Reed-Solomon code is used. The data, finder pattern, and error correction code data created in this way are assigned to each cell of the two-dimensional code in step S305, and a two-dimensional code image is created.
[0089]
As for the allocation of data to cells, the data representing the finder pattern is 1 to 8 in FIG. 18, the integer 48-bit data is 9 to 56 cells, and the error correction code data 16 bits is 57 to 72 cells. ing. Note that the specified vertex coordinates and cell center coordinates are used when creating the code image. This specified coordinate is also used when reading the code.
[0090]
Next, a barcode reader that reads the above-described two-dimensional code will be described. As shown in FIG. 20, the barcode reader includes a vertex candidate detector 81, a code frame detector 82, a projective transformation coefficient calculator 83, a finder detector 84, a data sampling unit 85, and an error correction. Section 86 and format conversion section 87.
[0091]
The vertex candidate detection unit 81 detects a vertex candidate of the two-dimensional code. The code frame detection unit 82 detects a code frame based on the vertex candidates. By detecting the code frame, the vertex candidate is determined as a true vertex.
[0092]
The projective transformation coefficient calculation unit 83 calculates each cell of the created code from the coordinates of each vertex of the code frame detected by the code frame detection unit 12 and the specified coordinates of each vertex of the code frame when the code image is created. A projective transformation coefficient that is a coefficient for mapping the prescribed center coordinates of the cell and the center of each cell of the read code image is obtained.
[0093]
The finder detection unit 84 performs processing related to the finder, such as finder detection. The data sampling unit 85 samples the data of the two-dimensional code using the projection conversion coefficient obtained by the projection conversion coefficient calculation unit 83. The error correction unit 86 determines whether or not the data read by the data sampling unit 85 is an error. If there is no error or error correction is possible, the format conversion unit 87 converts the integer type 56-bit data other than the error correction code. Output to. The format converter 87 converts the data into a numeric character string and outputs it.
[0094]
Next, details of the processing of the vertex candidate detection unit 81 will be described. Similarly to the vertex candidate detection unit 11 (see FIG. 8), the vertex candidate detection unit 81 performs oblique scanning from the four corners of the image as shown in FIG. 9 to detect black pixels. Let the detected black pixels be A, B, C, and D.
[0095]
Next, as shown in FIG. 10, the vertex candidate detection unit 81 performs a side of the cell such as A, B, C, D in the direction of the arrow, for example, 45 degrees lower right for A and 45 degrees lower left for B. The pixels are tracked by the number of pixels which is 1 / √2 of the number of pixels in the above, and it is determined whether they are all black pixels. If they are all black pixels, the vertex candidate detection unit 11 detects A, B, C, and D as vertex candidates, and moves the process to the code frame detection unit 82.
[0096]
The code frame detection unit 82 will be described. Similarly to the code frame detection unit 12, the code frame detection unit 82, as shown in FIG. 11, a black frame determination line 52 connecting the end points traced by the number of pixels 1 / √2 from the vertex candidates A, B, C, D. If the ratio of black pixels passing through 53, 54 and 55 is 80% or more for every straight line in all the straight lines, it is determined that it is a code frame, and vertex candidates A, B, C and D are two-dimensionally displayed. Determine as vertices A, B, C, D of the code. At this time, the coordinates of the vertices A, B, C, and D are also detected.
[0097]
Next, the projective transformation coefficient calculation unit 83 will be described. Similarly to the projection conversion coefficient calculation unit 13, the projective conversion coefficient calculation unit 83 also defines the coordinates of each vertex of the code frame detected by the code frame detection unit 82 and the vertices of the code frame when the code image is created. From the coordinates, a projective transformation coefficient that is a coefficient for mapping the specified center coordinates of each cell of the generated code and the center of each cell of the read code image is obtained.
[0098]
Next, the finder detection unit 84 will be described. The finder detection unit 84 attempts to detect a finder pattern. The finder detection unit 84 receives the code image, the projective transformation coefficient, and the specified center coordinates of each cell constituting the finder pattern of the created code.
[0099]
The finder detection unit 84 obtains the center coordinates of each cell of the read code image by performing projective transformation on the specified center coordinates of each cell constituting the finder pattern of the generated code image.
[0100]
The finder detection unit 84 sets the obtained center coordinate as the sampling center coordinate of the image data, and sets “1” if the number of black pixels of 3 × 3 pixels centered on the coordinate exceeds the number of white pixels, and sets it to “0” otherwise. The data is read, and the read data is compared with the true data of the finder pattern. If there is one or less error, it is determined that the currently handled graphic is a code. If there are two or more errors, there is a possibility that the direction of the code does not match, so the finder pattern is detected by rotating the code by 90 degrees. Even if the finder pattern is detected in the four directions, if the finder is not detected, it is determined that the currently processed image is not a code.
[0101]
Next, the data sampling unit 85 will be described. Similarly to the data sampling unit, the data sampling unit 85 receives the code image, the specified center coordinates of each cell at the time when the code is created, and the projective transformation coefficient. The data sampling unit 85 performs projective transformation of the specified center coordinates of each cell of the created code image using the projection transformation coefficient obtained by the projection transformation coefficient calculation unit 83, thereby the center coordinates of each cell of the read code image. Ask for.
[0102]
The data sampling unit 85 sets the obtained center coordinate as the sampling center coordinate of the image data, and sets “1” if the number of black pixels of 3 × 3 pixels centering on the coordinate exceeds the number of white pixels, and sets it to “0” otherwise. Read data. The read 72-bit data is input to the error correction unit 86 and arranged, and error correction is determined. If there is no error or if error correction is possible, data integer type 48-bit data other than the error correction code and finder pattern data is output to the format converter 87. The format converter 87 converts the data into a numeric character string and outputs it.
[0103]
The above-described two-dimensional code may be read by software, and FIG. 21 shows a flowchart of the method. In step S401, a code image obtained by imaging a two-dimensional code is input from diagonally above. In step S402, vertex candidates for the two-dimensional code are detected.
[0104]
In step S402, as shown in FIG. 9, diagonal scanning is performed from the four corners of the image, and black pixels are detected. Let the detected black pixels be A, B, C, and D. Further, in step S402, as shown in FIG. 10, the number of pixels on one side of the cell is 1 in the direction of arrows from A, B, C, D, for example, 45 degrees lower right for A and 45 degrees lower left for B. Pixels are tracked by the number of pixels of / √2, and it is determined whether they are all black pixels. If they are all black pixels, A, B, C, and D are detected as vertex candidates, and the process proceeds to step S403.
[0105]
In step S403, as shown in FIG. 11, the ratios of the black pixels that pass through the black frame determination lines 52, 53, 54, and 55 connecting the end points tracked from the vertex candidates A, B, C, and D are all If 80% or more of each straight line exists, it is determined that it is a code frame, and vertex candidates A, B, C, and D are determined as vertices A, B, C, and D of the two-dimensional code. At this time, the coordinates of the vertices A, B, C, and D are also detected.
[0106]
If no code can be detected in step S403, the process branches to the end in the branch process of step S404, and the reading ends. If a code is detected, the process proceeds to the next step S405.
[0107]
In step S405, the specified center coordinates of each cell of the generated code are read from the coordinates of each vertex of the code frame detected in step S403 and the specified coordinates of each vertex of the code frame when the code image is generated. A projective transformation coefficient that is a coefficient for mapping the center of each cell of the code image is obtained.
[0108]
In the next step S406, detection of a finder is attempted. In step S406, the code image, the projective transformation coefficient, and the specified center coordinates of each cell constituting the finder pattern of the created code are input. In step S406, the center coordinates of each cell of the read code image are obtained by projective transformation of the specified center coordinates of each cell constituting the finder pattern of the generated code image, and this is obtained as the sampling center coordinates of the image data. If the number of black pixels of 3x3 pixels centered on the coordinates exceeds the number of white pixels, the data is read as '1', otherwise it is read as '0', and the read data is compared with the true data of the finder pattern If the number of errors is 1 or less, it is determined that the currently handled graphic is a code. If there are two or more errors, the direction of the code may not match, so the finder pattern is detected by rotating the code by 90 degrees. Even if the finder pattern is detected in the four directions, if the finder is not detected, it is determined that the currently processed image is not a code.
[0109]
When the finder detection is successful, the process proceeds to the next step S408, and when it is unsuccessful, the process is terminated.
[0110]
In the next step S408, the code image, the projective transformation coefficient, and the specified center coordinates of each cell of the created code image are input, and the specified center of each cell of the created code image is obtained using the projective transformation coefficient obtained in step S405. By performing projective transformation of the coordinates, the center coordinates of each cell of the read code image are obtained.
[0111]
Further, in step S408, the obtained center coordinate is set as the sampling center coordinate of the image data, and is set to '1' if the number of black pixels of 3x3 pixels centering on the coordinate exceeds the number of white pixels, otherwise set to '0'. Data is read out. The read 72-bit data is subjected to error correction determination in step S409. If there is no error or error correction is possible, the integer type 48-bit data other than the error correction code is converted into a numeric character string in step S410, and the numeric character string is restored in step S411. .
[0112]
In the above example, the usable data is reduced from 56 bits to 48 bits, but it is possible to increase the number of cells in the code to hold more data. If the number of cells is 14 × 8, 112 bits (14 bytes) of data can be stored. For example, 72 bits can be assigned to data, 8 bits can be assigned to the finder, and 32 bits can be assigned to error correction. How many cells are needed depends on the application.
In this embodiment, since it is possible to determine whether the code is a code using a finder pattern and to determine the direction of the code at high speed, various devices such as a scanner and a digital camera can be used in addition to the handwriting input device of FIG. It is possible to read the code using it.
[0113]
【The invention's effect】
As described above, according to the present invention, it is possible to provide a high-speed and high-accuracy two-dimensional code barcode reader.
[Brief description of the drawings]
FIG. 1 is a diagram showing a two-dimensional code.
FIG. 2 is a diagram showing data arrangement positions.
FIG. 3 is a diagram showing a two-dimensional code.
FIG. 4 is a diagram illustrating data arrangement positions.
FIG. 5 is a diagram illustrating projective transformation.
FIG. 6 is a diagram illustrating each part of the two-dimensional code creation device.
FIG. 7 is a flowchart showing a two-dimensional code creation process.
FIG. 8 is a diagram showing each part constituting the barcode reading apparatus.
FIG. 9 is a diagram illustrating vertex pixel detection.
FIG. 10 is a diagram illustrating vertex candidate detection.
FIG. 11 is a diagram illustrating code frame detection.
FIG. 12 is a flowchart showing a two-dimensional code reading process.
FIG. 13 is a diagram illustrating a state of reading from an oblique direction.
FIG. 14 is a diagram illustrating a code image and a code.
FIG. 15 is a diagram illustrating mathematical formulas for obtaining conversion parameters.
FIG. 16 is a diagram illustrating a two-dimensional code indicating a finder pattern.
FIG. 17 is a diagram illustrating each part of the two-dimensional code creation device.
FIG. 18 is a diagram illustrating data arrangement positions.
FIG. 19 is a flowchart showing a two-dimensional code creation process.
FIG. 20 is a diagram showing each part constituting the barcode reading apparatus.
FIG. 21 is a flowchart showing a two-dimensional code reading process.
FIG. 22 is a diagram illustrating a handwriting input device.
[Explanation of symbols]
11, 81 ... vertex candidate detection unit
12, 82 ... code detector
13, 83 ... Projection conversion coefficient calculation unit
14, 85 ... Data sampling unit
15, 86 ... Error correction section
16, 20, 70, 87 ... format conversion unit
21, 71 ... error correction section
23, 72: Code image creation unit
50, 51 ... 2D code
52, 53, 54, 55 ... black frame determination line
60 ... Code image
61 ... Code
62 ... Finder pattern
84 ... Finder detection section

Claims (7)

四角形の枠を有するバーコードを撮影することにより、前記バーコードが射影された射影画像を取得し、前記バーコードが表す情報を読み取るバーコード読み取り装置において、
前記射影画像を含む画像の四隅から斜め走査を行って黒画素を検出し、検出した黒画素から所定の方向に所定の画素数だけ画素を追跡し、追跡した画素が全て黒画素である場合の前記検出した黒画素を、前記射影画像に撮影されたバーコードであるバーコード画像の枠の頂点候補として検出する頂点候補検出手段と、
前記頂点候補に基づき、前記バーコード画像の枠を検出するとともに、前記バーコード画像の頂点を確定させるコード枠検出手段と、
前記バーコードの枠の頂点と、前記バーコード画像の枠の頂点に基づき、射影変換係数を算出する射影変換係数算出手段と、
前記射影変換係数を用いて、前記バーコード画像から前記バーコードが表す情報を取得するデータサンプリング手段と
を有することを特徴とするバーコード読取装置。
By capturing a barcode having a rectangular frame, a projected image obtained by projecting the barcode is obtained, and a barcode reader that reads information represented by the barcode,
When the black pixel is detected by performing oblique scanning from the four corners of the image including the projected image, the predetermined number of pixels are tracked in the predetermined direction from the detected black pixel, and the tracked pixels are all black pixels Vertex candidate detection means for detecting the detected black pixel as a vertex candidate of a frame of a barcode image that is a barcode photographed in the projected image;
Based on the vertex candidates, code frame detection means for detecting a frame of the barcode image and determining the vertex of the barcode image;
A projection transformation coefficient calculating means for calculating a projection transformation coefficient based on the vertex of the barcode frame and the vertex of the barcode image frame;
And a data sampling unit that acquires information represented by the barcode from the barcode image using the projective transformation coefficient.
前記コード枠検出手段は、各頂点候補に基づいて各頂点候補ごとに定まる画素同士を結ぶ線分上の画素のうち、前記バーコードの画素の占める割合が、所定の割合以上の場合、前記バーコード画像に撮影されたバーコードの枠を検出したと判定することを特徴とする請求項1に記載のバーコード読取装置。  The code frame detection means, when the ratio of pixels of the barcode among the pixels on the line segment connecting the pixels determined for each vertex candidate based on each vertex candidate is a predetermined ratio or more, 2. The barcode reading apparatus according to claim 1, wherein it is determined that a frame of the barcode photographed in the code image is detected. 前記バーコードの枠の内部は、前記データサンプリング手段が情報を取得するために、2種類の色のうちのいずれか一方の色で情報を表す情報領域を複数含み、
前記データサンプリング手段は、前記情報領域内で複数の画素の色を取得し、取得した色のうち、一方の色が占める割合に応じて該情報領域が表す情報を取得することを特徴とする請求項1または2に記載のバーコード読取装置。
The inside of the barcode frame includes a plurality of information areas representing information in one of two colors for the data sampling means to acquire information,
The data sampling unit acquires colors of a plurality of pixels in the information area, and acquires information represented by the information area according to a ratio occupied by one of the acquired colors. Item 3. A barcode reader according to item 1 or 2 .
前記データサンプリング手段は、前記バーコードでの前記情報領域の位置と、前記射影画像に撮影された情報領域の位置とを、前記射影変換係数を用いて対応付けることを特徴とする請求項に記載のバーコード読取装置。It said data sampling means, according to claim 3, wherein the position of said information regions of the bar code, and the position of the imaging information area to the projection image, and wherein the associating with the projective transform coefficients Bar code reader. 前記バーコードに設けられ、予め定められた位置に配置された前記情報領域が表すパターン情報を検出するファインダ検出部をさらに有することを特徴とする請求項またはに記載のバーコード読取装置。Wherein provided on the bar code, bar code reading according to claim 3 or 4, further comprising a finder detection unit that detects a pattern information represented by the information area disposed at a predetermined position device. 前記データサンプリング手段が取得した情報が、訂正可能な誤りを有する場合、該誤りを訂正する誤り訂正手段をさらに有することを特徴とする請求項1からのいずれか1項に記載のバーコード読取装置。Information the data sampling unit has acquired, if having correctable errors, reading the bar code according to any one of claims 1 to 5, further comprising error correction means for correcting該誤Ri apparatus. 前記データサンプリング手段が取得した情報を数値に変換するフォーマット変換部をさらに有することを特徴とする請求項1から6いずれか1項に記載のバーコード読取装置。It said data sampling means bar code reader according to any of the preceding Claims 1, further comprising a format converting unit for converting the numerical values acquired information.
JP2003134566A 2003-05-13 2003-05-13 Bar code reader Expired - Fee Related JP4267965B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003134566A JP4267965B2 (en) 2003-05-13 2003-05-13 Bar code reader

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003134566A JP4267965B2 (en) 2003-05-13 2003-05-13 Bar code reader

Publications (2)

Publication Number Publication Date
JP2004341616A JP2004341616A (en) 2004-12-02
JP4267965B2 true JP4267965B2 (en) 2009-05-27

Family

ID=33525097

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003134566A Expired - Fee Related JP4267965B2 (en) 2003-05-13 2003-05-13 Bar code reader

Country Status (1)

Country Link
JP (1) JP4267965B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3644281A4 (en) 2017-06-20 2021-04-28 Sony Interactive Entertainment Inc. Calibration device, calibration chart, chart pattern generation device, and calibration method
KR102463560B1 (en) * 2017-11-10 2022-11-07 대우조선해양 주식회사 Calibration device of laser vision system
JP7222593B2 (en) * 2018-10-26 2023-02-15 大阪シーリング印刷株式会社 Two-dimensional code

Also Published As

Publication number Publication date
JP2004341616A (en) 2004-12-02

Similar Documents

Publication Publication Date Title
US9892300B2 (en) Two-dimensional code
US6786412B2 (en) Two-dimensional code reading method, two-dimensional code reading program, recording medium with two-dimensional code reading program, two-dimensional code reading device, digital camera and portable terminal with digital camera
US8553284B2 (en) Information input/output method using dot pattern
US10679175B2 (en) Two-dimensional code, system for creation of two-dimensional code, and analysis program
JP3883696B2 (en) Method for scanning and detecting multiple photos and removing artificial edges
JP5525636B2 (en) Optoelectronic device and calibration method for measuring the size of a structure or object
US20070171288A1 (en) Image correction apparatus and method, image correction database creating method, information data provision apparatus, image processing apparatus, information terminal, and information database apparatus
US9898637B2 (en) Two-dimensional code
US8237983B2 (en) Information input output method using dot pattern
JP2006079615A (en) Method for confirming position of qr code (r), device and storage medium
US7380718B2 (en) Method for reading out symbol information and device for reading out symbol information
JP2012510235A (en) Image processing for curve correction
JP6150675B2 (en) Position information display system and method
CN112686959B (en) Correction method and device for image to be identified
JP4574503B2 (en) Image processing apparatus, image processing method, and program
JP4267965B2 (en) Bar code reader
JP4314148B2 (en) Two-dimensional code reader
JP2017102841A (en) Two-dimensional code, two-dimensional code analyzing method, two-dimensional code analyzing apparatus, and program for analyzing two-dimensional code
JP4890112B2 (en) Image processing apparatus and image processing method
JPH11316795A (en) Two-dimensional code decoding device and storage medium
KR100860110B1 (en) Information input / output method using dot pattern
JP4102741B2 (en) Optical information reader and image data analysis method
JP4397866B2 (en) Two-dimensional pattern reading device, two-dimensional pattern reading method
RU2381552C2 (en) Information input/output method using dot pattern
JP2003196588A (en) Information reproducer, and method of reproducing information

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060112

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20080602

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20080617

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20080815

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

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

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20120227

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20130227

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20130227

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20140227

Year of fee payment: 5

LAPS Cancellation because of no payment of annual fees