JP4163406B2 - Bar code recognition device - Google Patents

Bar code recognition device Download PDF

Info

Publication number
JP4163406B2
JP4163406B2 JP2001304253A JP2001304253A JP4163406B2 JP 4163406 B2 JP4163406 B2 JP 4163406B2 JP 2001304253 A JP2001304253 A JP 2001304253A JP 2001304253 A JP2001304253 A JP 2001304253A JP 4163406 B2 JP4163406 B2 JP 4163406B2
Authority
JP
Japan
Prior art keywords
bar
barcode
width
input image
labeling
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
JP2001304253A
Other languages
Japanese (ja)
Other versions
JP2003108915A (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.)
Sharp Corp
Original Assignee
Sharp Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sharp Corp filed Critical Sharp Corp
Priority to JP2001304253A priority Critical patent/JP4163406B2/en
Publication of JP2003108915A publication Critical patent/JP2003108915A/en
Application granted granted Critical
Publication of JP4163406B2 publication Critical patent/JP4163406B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
本発明は、入力した画像データからバーコード領域を抽出してバーコードを認識するバーコード認識装置、認識方法、プログラム等に関する。
【0002】
【従来の技術】
近年、小型で、低消費電力のイメージセンサが開発されたことに伴い、携帯電話機などの携帯型装置にカメラを内蔵することが可能となり、内蔵カメラにより撮影した画像を、電子メールで即座に送信できることが可能となっている。これらの内蔵カメラは、小型であることが優先され、一般的なデジタルカメラよりも解像度が低い。
【0003】
また、近年の携帯電話機は、インターネットに接続する機能を有している。インターネットに接続するには、URLをキーから入力する必要があり、携帯電話機のキーでは、長いURLを打ち込むために手間がかかっていた。そこで、URLを一意の番号で管理し、その番号に対応するバーコードを印刷したものをバーコードリーダで読み込むことにより、URLの入力の手間を省き、ユーザの使い勝手をよくする試みがなされている。このような装置では、別途バーコードリーダを携帯電話機に接続する必要がある。
【0004】
そこで、カメラを内蔵した携帯装置では、その内蔵カメラにより入力したバーコード画像に対してバーコードを認識できれば、別途バーコードリーダを用意しなくても、このようなサービスを利用することができる。
しかし、現在の内蔵カメラの解像度は、バーコードリーダに用いられるイメージセンサよりも解像度が低く、高精度でバーコードを認識することが困難であった。
【0005】
また、バーコードの認識を困難にする原因として、入力画像中に撮影されるバーの幅が一定ではないということがある。これは、バーコードとカメラの距離関係は、入力するたびに変わってくる為である。接写するタイプのスキャナでは、常にバーコードを一定の大きさで入力できるので、バーの幅をあらかじめ決めておくことができるが、手で保持したカメラでバーコードを撮影する場合は、一定のバー幅をあらかじめ決めておくことはできない。
【0006】
バーの幅をイメージスキャナにより入力されたバーコード画像から決定し、バーコードを認識する手法が提案されている。例えば、特開平6−325197号公報では、走査線ごとに画素の幅の度数を計数することによりバーの幅を決定している。幅を決定する原理について説明する。
【0007】
図19は、検出頻度と幅との関係を示す図である。図19に示すように、走査線に対して幅の検出頻度を抽出する。これにより、ある閾値以上の頻度の領域を有効な幅として検出する。図19の例では、区間1,2,3が有効な幅である。さらに、この有効な幅の区間の長いもの2つを選択し、バーの幅としている。この手法では、頻度の多い上位2つの幅から、「細い」、「太い」の2種類の幅を検出することができるが、低解像度の画像では、頻度のピークの間隔が短くなり、検出が不安定という問題がある。また、複数の幅を持つバーコードには対応できない。
【0008】
また、カメラによりバーコードを撮影した場合、バーコード周辺にあるバーコード以外の文字や模様などの領域も入力画像に含まれる。したがって、入力画像からバーコード領域を抽出する必要がある。特開平9−16701号公報(図19)では、バーの間隔がある閾値以内であることを条件として、バーコード領域を抽出している。スキャナのように比較的安定して、入力画像を得られるシステムについては、有効である。しかし、カメラを手で保持しながらバーコードを入力するために、バーの幅は、被写体とカメラの距離によるばらつきが多く、固定の閾値では、うまく抽出できないことがあり問題となっていた。
このような問題を解決するために、特開平9−22437号公報では、バーコード領域を抽出する時に、バーコード特有のパターンを調べることで抽出精度を改善しようとしている。
【0009】
図18は、バーコードの構成の説明図である。図示のように、バーコード1にはバーコード特有のレフトガードバー2(又は、スタートバー)、センターバー3、ライトガードバー4(又は、エンドバー)がある。この場合、レフトガードバー2はバーコード1の開始点側(左側)に設けてあり、黒バーと白バーが交互に並んだパターンで構成され、バーコード1の開始情報として「101」の情報(モジュール表現)を設定したパターンである。センターバー3はバーコード1の中央位置に設けてあり、黒バーと白バーが交互に並んだパターンで構成され、バーコード1の中心情報として「01010」の情報(モジュール表現)を設定したパターンである。ライトガードバー4はバーコード1の終了点側に設けてあり、黒バーと白バーが交互に並んだパターンで構成され、バーコード1の終了情報として「101」の情報(モジュール表現)を設定したパターンである。
【0010】
レフトガードバー2とセンターバー3との間に6桁の左側データキャラクタ5が、センターバー3とライトガードバー4との間に6桁の右側データキャラクタ6とチェックデジット7が配置されている。なお、バーコード1下の左端の数値はプレフィックスデジット8を表わしている。
【0011】
図20は、従来のバーコード抽出の処理の流れを示すフローチャートである。まず、前記のようにバーの間隔がある閾値以内であるところを複雑領域として抽出する(ステップ401)。複雑領域は、バーコードが存在するであろうと推測される領域ということがきる。
【0012】
次に、抽出された複雑領域から前記のセンターバー、ライトガードバー、レフトガードバーの有無を判定し、抽出された複雑領域がバーコードであるかどうかを判定する(ステップ402〜ステップ404)。そして、バーコードであると判定された領域に対し、バーコードの各キャラクタを認識する(ステップ405)。
【0013】
ここで、センターバー、ライトガードバー、レフトガードバーの有無を判定する際に、抽出したバーの幅とあらかじめ定められたバーのモジュール幅を基準にしてバー構造のモジュール表現のパターンを照合している。モジュール幅は、スキャナの解像度により、あらかじめ定められる。
例えば、200dpiの解像度を有するスキャナで帳票を読み取った場合は、1モジュール当たり4画素で表現されるので、モジュール幅は、4画素と定められる。
【0014】
しかし、前記したように、カメラを手で保持しながらバーコードを入力するために、バーの幅は、被写体とカメラの距離によるばらつきが多いので、モジュール幅をあらかじめ特定することはできないという問題があった。
また、低解像度のカメラで入力した画像は、バーの幅が2画素程度となり、4種類の幅を用いるようなバーコードでは、入力時のノイズなどにより、モジュール幅と完全に等しい幅のバーは存在せず、厳密に幅を比較するだけでは、太いバーを細いと誤認識することがあり、正しく照合できないという問題もあった。
【0015】
この問題を解決するために、特開平4−263381号公報では、規定されているパターンにあるバーの幅と入力されたバーの幅を比較する時、バー幅が等しいという判定は、ある幅をもたせてその範囲内にあるときに等しいとする。例えば、バー幅aとバー幅bが等しい条件は、
1.25a≧b≧0.75a
となる。しかし、低解像度のデジタルカメラで、バーコードを撮影した場合、その画像におけるバーの最小の幅は、2画素程度しかない。幅2画素は、実際には、入力処理の誤差などにより2画素幅が、1画素幅や3画素幅になることがある。この場合、幅の変動は、実際の幅の50%となり、変動が大きい。幅が太い場合は、4画素が、5画素、3画素になる場合が多い。この場合は、変動の幅は、実際の幅に対して、25%となる。前記のようにすべてのバーの幅を比較する際に、幅の範囲をすべて同一に決定してしまうと、バー幅に対する変動が大きい等の場合に、正しく判定できないという問題があった。
【0016】
【発明が解決しようとする課題】
本発明が解決しようとする課題は、低解像度のイメージセンサを用いて撮影したバーコード画像より高精度にバーコードを認識することである。このためには、入力した画像より、精度よくバーコード領域を抽出することが必要である。また、入力画像中のバーの幅が変動していても正しく認識できるように、あらかじめバーの幅を指定せず、入力画像中からバーの幅を取り出すことが必要である。また、低解像度のイメージセンサを用いることにより、最も幅の狭いバーの幅は2画素程度になるが、この時でも、ノイズなどの影響を受けずに正確に複数のバーの幅を判定し認識することが必要である。また、複数の幅を持つバーコードでも対応できるようにすることも必要である。
本発明はかかる問題点に鑑みてなされたものであり、携帯端末に内蔵される小型のイメージセンサで撮影された低解像度の画像においても、バーコードを精度よく認識できるバーコード認識装置を提供することを目的とする。
【0017】
【課題を解決するための手段】
本発明のバーコード認識装置は、入力画像に対して前処理を行う前処理手段と、前処理後の入力画像に対して2値化を行う2値化処理手段と、2値化処理後の入力画像に対してラベル付けを行うラベル付け手段と、ラベル付け後の入力画像からバーコード領域を抽出するバーコード領域抽出手段と、抽出されたバーコード領域からバーコードを認識するバーコード認識手段と、を具備することを特徴とする。
【0018】
また、本発明のバーコード認識装置において、前処理手段は、ヒストグラム変換を行うことが望ましい。
また、2値化処理手段は、画像の2値化における閾値の決定方法として、判別分析法を用いることが望ましい。
【0019】
本発明のバーコード認識装置において、ラベル付け手段は、入力画像に対して1つ1つの連結されたパターン毎に個別の数値名を振ることによりラベル付けを行うことが望ましい。
また、ラベル付け手段によりラベル付けされた入力画像より、バーの幅を、当該バーに係るラベルの黒画素数/垂直方向の高さで定義することが望ましい。
また、バー又はスペースの幅を照合するときに、幅に応じた幅の許容範囲を設定することが望ましい。
【0020】
また、本発明のバーコード認識装置において、バーコード領域抽出手段は、バーの隣接関係を抽出し、その隣接関係からバーの左端とバーの右端とを決定し、バーの左端とバーの右端との間のバーの数がある規定値と一致することによりバーコード領域を抽出することが望ましい。
【0021】
また、バーの隣接関係は、2つのバーが共有する走査線があること、2つのバーの高さの差がある範囲内であること、2つのバーの間隔がある範囲内であることをすべて満たす場合に隣接していると判定し、バーの高さの差の範囲及びバーの間隔の範囲が、基準となるバーの高さと幅から適応的に求められることが望ましい。
【0022】
また、本発明のバーコード認識装置において、バーコード認識は、バーコード領域抽出手段により抽出されたバーコード領域内のバーで最小の幅を単位幅として用い、前記抽出されたバーコード領域におけるこの単位幅の整数倍のバー及びスペースの幅のパターンの並びと予め規定されたバー及びスペースの幅のパターンの並びとを照合することにより行うことが望ましい。
また、バーコード認識は、単位幅を変化させて繰り返し行うことが望ましい。
【0023】
本発明のバーコード認識装置によれば、携帯端末に内蔵されるような小型のイメージセンサで用いたカメラにより、撮影したバーコード画像より、精度よく、バーコードを認識することができる。また、本発明によれば、低解像度のカメラを用いた場合にもバーコードを認識することができるため、特別にバーコードリーダを付加しなくともバーコードを読み取ることができる。
【0024】
また、本発明に係る携帯電話機は、本発明のバーコード認識装置を備えたことを特徴とする。携帯電話機にバーコード認識装置を組み込むことにより、どこでも手軽にバーコード認識ができるようになり、さらに、バーコード認識装置で認識したバーコードを即座に送信可能である。
【0025】
また、本発明に係るバーコード認識方法は、入力画像に対して前処理を行う工程と、前処理後の入力画像に対して2値化を行う工程と、2値化処理後の入力画像に対してラベル付けを行う工程と、ラベル付け後の入力画像からバーコード領域を抽出する工程と、抽出されたバーコード領域からバーコードを認識する工程と、を有することを特徴とする。
また、本発明は、コンピュータをバーコード認識装置として機能させるプログラムとして、また、当該プログラムを記録した記録媒体としても実現できる。
【0026】
【発明の実施の形態】
本発明においては、入力された画像に対し、ヒストグラム変換の前処理を実施した後に、2値化を行い、さらにラベル付け処理を行う。ラベル付けされた画像より、バーコードの構造の特徴に基づき、バーの隣接関係を計算する。隣接関係は、1例として、以下の条件を満たしているバー候補の連結領域を隣接バーとして、画像のすべての連結領域について調べる。
(1)図21に示すように、2つのバーに共有される水平走査線9が存在する。
(2)図22に示すように、隣り合うバー高の差がある範囲内である。ここでは、バー高の20%以内であることとする。
(3)図23に示すように、位置座標のX方向の差がある範囲内である。ここでは、バー幅の6倍以内であることとする。
【0027】
次に、左端と右端に挟まれているバーの数をカウントし、カウント値が規定数であれば、バーコード領域として抽出する。抽出されたバーコード領域内の黒画素の連結領域の幅からバーコードのモジュール幅となる単位幅を決定する。
単位幅の整数倍のバー及びスペースの幅のパターンの並びで、規定されているバーコードパターンと抽出されたバーコード領域におけるパターンとを照合することによりバーコードを認識する。認識は、バーコードのレフトガードのパターンを最初に照合し、成功したら順次、左側6桁のパターン、プレフィックスデジット、センターバー、右側6桁のパターンと照合を行う。前記のパターンの照合の際には、バー及びスペースの幅に応じて、すなわち倍率ごとに許容範囲を設けることにより、低解像度の画像中でのノイズなどの影響を軽減する。
本発明によれば、携帯端末に内蔵される小型のイメージセンサで撮影された低解像度の画像においても、バーコードを精度よく認識することができる。
以下、本発明の実施の形態について、添付図面を参照して詳細に説明する。
【0028】
図1は、バーコード認識の処理の流れを示すフローチャートである。
図1において、ステップ1では、入力画像に対し、前処理として、ヒストグラム変換を行う。入力画像の輝度の最小値をYiとし、最大値をYjとすると輝度Yに対する変換後の輝度Y’は、下記式(1)で求まる。
【0029】
【数1】

Figure 0004163406
【0030】
まず、輝度Y’の微分値を求め、微分値が閾値以上の画素をエッジ部とし、このエッジ部についての輝度のヒストグラムを作成する。
ステップ2では、ステップ1の処理画像に対して、2値化を行う。2値化処理で輝度の微分値計算を安定させ、コントラストの低い画像に対し、コントラストを向上する。
上記で求めたヒストグラムから2値化閾値を決定し、画像の2値化を行う。閾値の決定方法は、例えば、判別分析法を用いればよい。判別分析法は、以下のようにして行う。
【0031】
輝度の範囲が「0からD」である画像を閾値tで2値化したとき、輝度が「0〜t−1」の画素の平均輝度をf0、輝度が「tからD」の画素の平均輝度をf1、画像全体の平均輝度をf、輝度kをもつ画素の数をnkとすれば、クラス間分散σB 2は下記式(2)となり、クラス内分散σI 2は下記式(3)となる。
【0032】
【数2】
Figure 0004163406
【0033】
【数3】
Figure 0004163406
このときの分散比は下記式(4)に示すようになるので、このF(t)を最大にするtを閾値とする。
【0034】
【数4】
Figure 0004163406
【0035】
ステップ3では、ラベル付け処理を行う。ラベル付け処理は、図2に示すように、2値化後の画像の黒画素(画素値が1とする)に対し、連結しているすべての黒画素に一意のラベルをつけることである。連結している黒画素が占める領域を連結領域という。ラベル付けの方法は、いろいろあるが一例として、以下のような方法がある。
【0036】
(1)画像上を左上から右下に向けて走査し、画素値が1であり、かつラベルが付けられていない画素Pを見つけ、新しいラベルを付ける。
(2)画素Pに対して、画像内の連結しているすべての画素に同じラベルをつける(図中10〜12はラベルである)。
(3)(1)に戻り、まだラベルの付けられていない画素が見つかったら、新しいラベルを付けて(2)の処理を行う。
(4)画像全体の走査が終わったとき、処理を終了する。
【0037】
ステップ4では、ラベル付け結果より、連結黒画素の高さ、幅から構成されるパターン情報より、バーコードである、黒画素の連結領域(バー)が所定の条件下に並んだ領域をバーコード領域として抽出する。
ステップ5では、抽出されたバーコード領域のバーとスペースの幅の並びを調べ、バーコードを認識する。
ステップ4のバーコード領域の抽出は、ラベル付けされた、各連結領域の隣接関係を調べることにより、実行される。以降、ラベル付けされて連結領域をバーと呼ぶ。
【0038】
図3、図4は、隣接するバーの探索処理の流れを示すフローチャートである。
隣接関係は、バーの幅と高さおよび位置の情報を用いて行う。次のようにバー幅、バー高を求める。
バー高:連結領域を囲む矩形の高さ
バー幅:連結領域の面積/バー高
連結領域を囲む矩形の左上の座標をそのバーの位置座標とする。
隣接の条件を1例として、次のように定める。
(1)2つのバーに共有される水平走査線が存在する。
(2)隣り合うバー高の差は、バー高の20%以内である。
(3)位置座標のX方向の差は、バー幅6倍以内である。
【0039】
上記の条件を満たし、対象となるバーの位置座標に一番近い位置座標をもつバーをそのバーの隣接バーとする。隣接バーは、左側と右側にそれぞれ存在する可能性がある。
全てのバーに対して隣接関係が求まったら、次の手順でバーコード領域であるかどうかを検査する。
【0040】
図3、図4により隣接バーの探索処理の流れを説明する。図3、図4において、以下のように定義する。
バー(L):ラベルLがつけられた連結領域(バー)
バー高(L):ラベルLがつけられたバーの高さ(バー高)
バー幅(L):ラベルLがつけられたバーの幅(バー幅)
バー位置_x(L):ラベルLがつけられたバーの位置座標のx座標
MAX_LABEL:ラベルの最大値
MIN_LABEL:ラベルの最小値
左距離:バーの左側に存在するバーの水平距離の最小値
右距離:バーの右側に存在するバーの水平距離の最小値
バー距離(L,L2):ラベルLがつけられたバーとラベルL2がつけられたバーの水平距離
バー高差(L,L2):ラベルLがつけられたバーとラベルL2がつけられたバーの高さの差
ステップ101では、まず、探索の基準となる着目バーを示すラベルを変数Lに代入する。ラベルは、ラベルの最小値(LABEL_MIN)から、ラベルの最大値(LABEL_MAX)へと順に増加する。
【0041】
ステップ102では、着目バーに対する隣接候補となるバーを示すラベルを変数L2に代入する。ラベルは、ラベルの最小値(LABEL_MIN)から、ラベルの最大値(LABEL_MAX)へと順に増加する。
ステップ103では、変数Lと変数L2の値が同じ、つまり同じバーを示しているときは、ステップ116に行く。そうでなければ、ステップ104に進む。ステップ104では、前記の条件(1)に示す条件をテストする。条件(1)を満たしていれば、ステップ105に進む。満たしていなければ、ステップ116に進む。
【0042】
ステップ105では、変数Lで示されるラベルのついているバーのバー高と変数L2で示されるラベルのついているバーのバー高差を計算する。
ステップ106では、前記の条件(2)に示す条件をテストする。条件(2)を満たしていれば、ステップ107に進む。満たしていなければ、ステップ116に進む。
【0043】
ステップ107では、変数Lで示されるラベルのついているバーのバー位置と変数L2で示されるラベルのついているバー位置の水平方向の距離を計算する。ステップ108では、前記の条件(3)に示す条件をテストする。条件(2)を満たしていれば、ステップ109に進む。満たしていなければ、ステップ116に進む。条件(3)は、バーの幅に対する相対値を閾値としているので、入力画像のバーの幅が一定でなくても正しく判定ができる。
【0044】
ステップ109では、変数Lで示されるラベルのついているバーに対して、変数L2で示されるラベルのついているバーが右側にあるのか、左側にあるのかをバー位置座標を基準に判定する。右側にあると判定された場合は、ステップ110に、左側にあると判定された場合は、ステップ113にそれぞれ進む。
【0045】
ステップ110では、現在までに見つかった右側のバーとの最小距離を保存してある変数「右距離」と現在の右側のバーとの距離を比較し、より距離が近ければ、ステップ111に進む。そうでなければ、このバーは、右隣ではないとして、ステップ116に進む。
【0046】
ステップ111では、変数L2で示されるラベルのついているバーが右隣であるとし、変数L2の値を記憶する。ステップ112では、変数「右距離」を更新する。ステップ113では、現在までに見つかった左側のバーとの最小距離を保存してある変数「左距離」と現在の左側のバーとの距離を比較し、より距離が近ければステップ114に進む。そうでなければ、このバーは、左隣ではないとして、ステップ116に進む。
【0047】
ステップ114では、変数L2で示されるラベルのついているバーが左隣であるとし、変数L2の値を記憶する。ステップ115では、変数「左距離」を更新する。ステップ116では、変数L2を次に小さいラベルヘと更新する。
ステップ117では、変数L2により隣接候補として探索されていないラベルがあれば、ステップ103に進み、処理を繰り返す。全てのラベルについて探索が終わったら、ステップ118に進む。
【0048】
ステップ118では、変数Lを順次大きいラベルヘと更新する。このとき、ステップ111および114で記憶された右隣バー、左隣バーを変数Lで示されるバーの右隣バー、左隣バーとしてそれぞれ確定する。
ステップ119では、変数Lにより探索されていないラベルがあれば、ステップ102に進み、処理を繰り返す。全てのラベルについて探索が終わったら、ステップ120に進み、処理を終了する。
【0049】
以上のようにして、隣接関係が求まったら次に示す手順にて、バーコード領域であるかどうかの判定を行う。
まず、左隣のバーが存在しないバーを左端バーとして、マークする。次に、左端バーから順次、右隣のバーを探索する。右隣のバーが存在しないバーを右端バーとして、マークする。
【0050】
左端バーから、右端バーまでのバーの数をカウントし、バーの数が規定の数であれば、左端バーから右端バーまでのバーとこれらのバー間のスペースが在る領域をバーコード領域とする。規定の数は、バーコードの規格により、決まる。例えばJAN13桁のバーコードであれば、バーの数は30となる。
抽出されたバーコード領域に含まれるバーに対して、バーコード認識の処理を行う。
【0051】
図5は、バーコード認識の処理の流れを示すフローチャートである。
ステップ201では、まず、バーおよびスペースの幅を評価する基準となる単位幅を決定する。バーコード領域内のバー幅で、最小のものを単位幅とする。単位幅は、バーコードのモジュール幅に相当する。
【0052】
ステップ202では、左端の2本のバーを対象にレフトガードバーのパターンと照合し、レフトガードであるかどうかテストする。レフトガードであると判定されたら、ステップ203に進む。そうでなければ、ステップ212に進む。
ステップ203では、次の12本のバーに対して、左側6桁の数値を認識する。ステップ204では、左側の6桁の認識がすべて正常に完了したか判定する。正常に完了していたらステップ205に進む。そうでなければ、ステップ212に進む。
【0053】
ステップ205では、左側6桁の偶数、奇数パリティの組み合わせから、プレフィックスデジットを認識する。ステップ206では、プレフィックスデジットが矛盾なく認識できたかどうか判定する。矛盾なく認識できていれば、ステップ206に進む。そうでなければ、ステップ212に進む。
ステップ207では、次の2本のバーに対して、センターバーのパターンと照合し、センターバーであるかどうかテストする。センターバーであると判定されたら、ステップ208に進む。そうでなければ、ステップ212に進む。
【0054】
ステップ208では、次の12本のバーに対して、右側6桁の数値を認識する。ステップ209では、右側の6桁の認識がすべて正常に完了したか判定する。正常に完了していたらステップ210に進む。そうでなければ、ステップ212に進む。
ステップ210では、チェックデジットのテストを行う。チェックデジットに矛盾がなければ、ステップ211に進む。そうでなければ、ステップ212に進む。
【0055】
なお、チェックデジットとは、読み取りに誤りがないかをチェックするために算出された数値で、右側6桁の数値のうち最後の1桁がチェックデジットとなっている。チェックデジット以外の11桁より規定の算出方法によりチェックデジットを算出する。その算出結果と読み取ったチェックデジットを照合し、等しければ矛盾がないとする。図18の例ではチェックデジットは右端の数値4である。
【0056】
ステップ211では、認識が成功したとして処理を終了する。ステップ212では、単位幅を1画素増加させる。ステップ213では、単位幅の増加が3以下であるかどうか判定する。3以下であれば、ステップ202へと進み、再度同様な認識処理を行う。そうでなければステップ214に進む。ステップ214では、認識が失敗したとして処理を終了する。
前記のレフトガードのテスト、センターバーのテスト、数値の認識において、バー及びスペース幅をあらかじめ規定されているパターンと比較し評価をする。その評価の手順について次に述べる。
【0057】
図6は、スペース幅を説明するための図であり、図7は、許容誤差率を説明するための図である。
バーとスペースの幅は、単位幅の整数倍であり、倍率ごとに評価される。スペース幅15は、図6に示すように、隣接する2つのバー13,14間の幅である。スペース幅15は、次のように求める。
【0058】
隣接するバー(L)13とバー(L2)14に対して、水平走査線ごとにバー間の画素数を求める。バー(L)13およびバー(L2)14が共有する全走査線におけるバー間の画素数の平均をスペース幅15とする。
バーコードのパターンは、基準となるモジュール幅(単位幅)の整数倍の幅を持つバーまたは、スペースの並びで規定されている。幅の倍率をそれぞれ1,2,3,4とする。ここで、最も狭い幅が1、もっとも広い幅が4である。
【0059】
次の条件を満たす最小の倍率が、そのバー(スペース)幅の倍率となる。すなわち、バー(スペース)幅が倍率×単位幅±許容誤差の範囲内にあることが条件である。
ここで、許容誤差は、許容誤差=倍率×単位幅×許容誤差率で定義される。許容誤差率は、倍率ごとに図7に示すように規定されている。ここで、許容誤差を持たせるのは、2値化による画素の欠落の影響を考慮したためである。低解像度のデジタルカメラで、バーコードを撮影した場合、その画像における単位幅は、2画素程度しかない。2値化を行うと、バーの画像に、1画素の程度の欠けや、膨張のノイズが存在する。幅2画素のバーとして許容誤差なしで比較すると、1画素幅や3画素幅は、異なる幅として認識される。しかし、実際には、2値化のノイズにより2画素幅が、1画素幅や3画素幅になることがある。許容誤差を設けることにより、この幅の変動を考慮し、同じ幅であると認識することができる。
【0060】
前記ステップ202のレフトガードのテストは、次のように行う。
図8は、レフトガードの幅の並びパターンを説明するための図であり、図9は、レフトガードのバー、スペースの並びパターンを説明するための図である。
図8及び図9に示すように規定されたレフトガードのバー、スペースの幅の並びパターンと、抽出されたバーコード領域において幅の評価に基づいて求めたレフトガードの幅のバー、スペースの並びパターンとを照合し、パターンが一致した場合、そのバーは、有効なレフトガードを構成するバーであるとする。
【0061】
前記ステップ203、208の数値の認識は、次のように行う。
図10は、数値に対するバー及びスペースの幅の並びのパターンの規定を示す図であり、図11は、図10に示す幅1から幅4が、バー幅か、スペース幅であるかの組み合わせを示す図であり、図12は、数値の認識の処理の流れを示すフローチャートである。
【0062】
図10において、左側の6桁に対する幅の並びパターンには、奇数パリティと偶数パリティが存在する。図10に示す幅の並びは、奇数パリティのときである。偶数パリティの時は、同じ表を逆方向から、つまり幅4、幅3、幅2、幅1と読む。例えば奇数パリティで数値9は、左から3倍幅のスペース、単位幅のバー、単位幅のスペース、2倍幅のバーの並びパターンで表され、偶数パリティで数値1は、左から、単位幅のスペース、2倍幅のバー、2倍幅のスペース、2倍幅のバーの並びパターンで表される(図18の左側1,2番のデータキャラクター参照)。
【0063】
図11において、センターバーよりも左側の6桁と右側の6桁では、バーとスペースの並びのパターンが異なるので、図11では、2種類のパターンが定義されている。例えば、右側で奇数パリティで数値6は、左から、単位幅のバー、単位幅のスペース、単位幅のバー、4倍幅のスペースの並びパターンで表される(図18の右側1番のデータキャラクター参照)。
【0064】
図12のフローチャートにおいて、ステップ301では、左側の6桁のデータキャラクターに対して、レフトガードのテストと同様な手順で、対象のバー、スペースの幅の並びのパターンを求める。
ステップ302では、図10及び図11に規定された照合パターンを用いて、前記した幅の評価を行い、バーとスペースの並びのパターンが一致するかどうか順に調べる。左側6桁においては、奇数パリティの幅パターンか偶数パリティの幅パターンかも順次調べる。
【0065】
ステップ303では、パターンが一致すると判定された時は、ステップ304に進む。そうでなければ、ステップ307に進む。ステップ304では、入力画像より得られた実際の幅と規定されている幅のパターンとの幅差を求める。幅差は、対応する4つの幅のそれぞれの差の合計値とする。
【0066】
ステップ305では、幅差がそれまでに見つかったものよりも小さかった場合は、ステップ306に進む。そうでなければ、ステップ307に進む。
ステップ306では、そのパターンに対応する数値を認識候補の数値として記憶しておく。同時に、奇数パリティか偶数パリティの種別も記憶しておく。なお、幅差の初期値は、最大値に設定されている。
【0067】
ステップ307では、図10に示すすべての照合パターン(数値0〜9)について処理が終了していれば、ステップ308に進む。そうでなければ、ステップ302に進み、次の照合パターンについて処理を繰り返す。
ステップ308では、規定されている数値のパターンと一致した場合に、その数値を認識結果とし、ステップ309に進み、認識成功として処理を終了する。そうでなければ、認識不成功として、ステップ310に進み、処理を終了する。
ステップ205のプレフィックスデジットの認識は、次のようにして行う。
【0068】
図13は、奇数パリティと偶数パリティの組み合わせ結果(プレフィックスデジット)を示す図であり、図14は、センターバーの幅の並びパターンを示す図であり、図15は、センターバーのバー、スペースの並びパターンを示す図である。
【0069】
ステップ205においては、左側6桁の認識がすべて成功した時の奇数パリティと偶数パリティの記録からプレフィックスデジットを認識する。奇数パリティと偶数パリティの組み合わせ結果は、図13に示すようになっており、テーブルから検索し、一致したものをプレフィックスデジットとして認識する。一致する組み合わせが見つからなかったときは、プレフィックスデジットの認識は、失敗として処理を終了する。図18の例では、左側6桁のデータキャラクター5は、奇数パリティの9、偶数パリティの1、奇数パリティの2、奇数パリティの3、偶数パリティの4、偶数パリティの5であり、パリティの組み合わせは101100なのでプレフィックスデジット8は図13より4(図18の左端に表示)である。
ステップ207のセンターバーのテストは、レフトガードのテストと同様に、パターンのマッチングを行う。なお、センターバーのテストに用いるバー、スペースの幅の並びパターンは、図14及び図15に示すようになっている。
【0070】
なお、本発明は上記実施の形態に限定されず、種々変更して実施することが可能である。
また、本発明のバーコード認識装置を携帯電話機に組み込むことも可能である。携帯電話機にバーコード認識装置を組み込むことにより、どこでも手軽にバーコード認識ができるようになり、さらに、バーコード認識装置で認識したバーコードを即座に送信可能である。
【0071】
図16は本発明のバーコード認識装置をカメラ内蔵型携帯電話機に組込んだ場合のブロック図であり、カメラ内蔵型携帯電話機は電波を送受信するアンテナ21、無線通信の送受信を制御する無線部22、ユーザからのキー操作情報を入力生成するキー入力部23、文字情報や画像情報をユーザに表示する表示部24、音声信号を出力するスピーカー25、ユーザから音声信号を入力するマイク26、受信又は入力された文字情報、画像情報、音声信号を記憶する記憶メモリ27、対象となる画像情報を入力するカメラ28、及びバーコード認識装置を内蔵し、各部を制御する制御部29とから構成される。
【0072】
上記構成を有するカメラ内蔵型携帯電話機において、カメラ28より入力された画像情報(バーコード)からバーコードの認識を行う場合、ユーザはキー入力部23を操作しカメラ動作を選択する。制御部29はキー入力部からの設定に基きカメラ28を初期化し、画像情報(バーコード)の取り込みを開始する。カメラ28より取り込まれた画像情報(バーコード)は制御部29を介し記憶メモリ27に転送される。制御部29は記憶メモリ27に格納された画像情報(バーコード)を表示部24に転送し、画像情報(バーコード)の表示を行う。また、画像情報(バーコード)を連続的に取り込み、表示することで、ユーザはカメラ画像を動画として確認できる。一方、記憶メモリ27に格納された画像情報(バーコード)はバーコード認識装置を有する制御部29に転送され、本実施の形態で説明したバーコード認識処理にてバーコード認識が行われる。認識に成功した場合、認識結果を記憶メモリ27に転送し、記憶メモリ27にバーコードデータとして格納する。
【0073】
次に記憶メモリ27に格納されたバーコードデータを無線又はインターネットに接続し送信先に送信する際の動作について図17を用いて説明する。ユーザはキー入力部23を操作し無線又はインターネットへの接続を選択する。制御部29はキー入力部からの設定に基き無線部22へ無線又はインターネットへの接続を指示する。無線部22は制御部29からの指示に基づき無線又はインターネットへの接続を開始する。ユーザはキー入力部23を操作し記憶メモリ27に格納済みのバーコードデータの送信を選択する。制御部29はキー入力部23からの設定に基き記憶メモリ27に格納済みのバーコードデータを無線部22へ転送し送信を指示する。無線部22は制御部29からの指示に基づき、転送されたバーコードデータを無線又はインターネットに送信する。無線部22より送信されたバーコードデータは無線網33を介しURLデータサーバ32へと送信される。URLデータサーバ32は携帯電話端末34の無線網33とインターネット31のゲートウェイの動作制御を行う。URLデータサーバ32は受信したバーコードデータとURLデータベースから送信先のURLを検索しインターネット31への接続を行い送信先へバーコードデータを転送する。転送完了の結果は携帯端末34に送信される。
【0074】
また、本発明は、コンピュータをバーコード認識装置として機能させるプログラムとして、また、当該プログラムを記録した記録媒体としても実現できる。
本発明の電子メール通信装置は、本電子メール通信装置を機能させるためのプログラムでも実現される。このプログラムは、コンピュータで読み取り可能な記録媒体に格納されていてもよい。
【0075】
この記録媒体として、バーコード認識装置内蔵のROMそのものがプログラムメディアであってもよいし、またバーコード認識装置をCD−ROMドライブ等のプログラム読み取り装置に接続し、そこに記録媒体を挿入することで読み取り可能なCD−ROM等のプログラムメディアであってもよい。いずれの場合においても、格納されているプログラムはCPUがアクセスして実行させる構成であってもよいし、プログラムを読み出し、読み出されたプログラムは、図示されていないプログラム記憶エリアにダウンロードされて、そのプログラムが実行される方式であってもよい。このダウンロード用のプログラムは予め本体装置に格納されているものとする。
【0076】
ここで上記プログラムメディアは、本体と分離可能に構成される記録媒体であり、磁気テープやカセットテープ等のテープ系、フロッピーディスクやハードディスク等の磁気ディスクやCD−ROM/MO/MD/DVD等の光ディスクのディスク系、ICカード(メモリカードを含む)/光カード等のカード系、あるいはマスクROM、EPROM、EEPROM、フラッシュROM等による半導体メモリを含めた固定的にプログラムを担持する媒体であってもよい。
【0077】
さらに、バーコード認識装置を備える携帯電話機の送信部及び受信部を介して通信ネットワークからプログラムをダウンロードするように、流動的にプログラムを担持する媒体であってもよい。なお、このように通信ネットワークからプログラムをダウンロードする場合には、そのダウンロード用プログラムは予め装置本体に格納しておくか、あるいは別な記録媒体からインストールされるものであってもよい。なお、記録媒体に格納されている内容としてはプログラムに限定されず、データであってもよい。
【0078】
【発明の効果】
以上説明したように本発明によれば、携帯端末に内蔵されるような小型のイメージセンサで用いたカメラにより、撮影したバーコード画像より、精度よく、バーコードを認識することができる。また、本発明によれば、低解像度のカメラを用いた場合にもバーコードを認識することができるため、特別にバーコードリーダを付加しなくともバーコードを読み取ることができるようになる。
【図面の簡単な説明】
【図1】バーコード認識の処理の流れを示すフローチャートである。
【図2】ラベル付け処理の例を示す図である。
【図3】隣接するバーの探索処理の流れを示すフローチャート(前半)である。
【図4】隣接するバーの探索処理の流れを示すフローチャート(後半)である。
【図5】バーコード認識の処理の流れを示すフローチャートである。
【図6】スペース幅を説明するための図である。
【図7】許容誤差率を説明するための図である。
【図8】レフトガードの幅の並びパターンを説明するための図である。
【図9】レフトガードのバー、スペースの並びパターンを説明するための図である。
【図10】数値に対する幅の並びのパターンを示す図である。
【図11】図10に示す幅1から幅4が、バー幅か、スペース幅であるかの組み合わせを示す図である。
【図12】数値の認識の処理の流れを示すフローチャートである。
【図13】奇数パリティと偶数パリティの組み合わせ結果(プレフィックスデジット)を示す図である。
【図14】センターバーの幅の並びパターンを示す図である。
【図15】センターバーのバー、スペースの並びパターンを示す図である
【図16】カメラ内蔵型携帯電話機の構成の説明図である。
【図17】携帯電話端末のインターネットへの接続を示す図である。
【図18】バーコードの構成の説明図である。
【図19】検出頻度と幅との関係を示す図である。
【図20】従来のバーコード抽出の処理の流れを示すフローチャートである。
【図21】隣接バーの条件(1)を説明するための図である。
【図22】隣接バーの条件(2)を説明するための図である。
【図23】隣接バーの条件(3)を説明するための図である。
【符号の説明】
1 バーコード
2 レフトガードバー
3 センターバー
4 ライトガードバー
5 左側データキャラクタ
6 右側データキャラクタ
7 チェックデジット
8 プレフィックスデジット
9 水平走査線
10〜12 ラベル
13〜14 バー
15 スペース幅
21 アンテナ
22 無線部
23 キー入力部
24 表示部
25 スピーカ
26 マイク
27 記憶メモリ
28 カメラ
29 制御部
31 インターネット
32 URLデータサーバ
33 無線網
34 携帯電話端末[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a barcode recognition device, a recognition method, a program, and the like that recognize a barcode by extracting a barcode region from input image data.
[0002]
[Prior art]
In recent years, with the development of small, low power consumption image sensors, it has become possible to incorporate a camera in a portable device such as a mobile phone, and immediately send images taken by the built-in camera via e-mail. It is possible to do it. These built-in cameras are prioritized to be small, and have a lower resolution than general digital cameras.
[0003]
Moreover, recent cellular phones have a function of connecting to the Internet. In order to connect to the Internet, it is necessary to input the URL from the key. With the key of the cellular phone, it takes time and effort to enter a long URL. Therefore, an attempt is made to manage the URL with a unique number and read the printed barcode corresponding to the number with a barcode reader, thereby saving the trouble of inputting the URL and improving the usability of the user. . In such an apparatus, it is necessary to separately connect a barcode reader to the mobile phone.
[0004]
Therefore, in a portable device with a built-in camera, if a barcode can be recognized with respect to a barcode image input by the built-in camera, such a service can be used without preparing a separate barcode reader.
However, the resolution of the current built-in camera is lower than that of an image sensor used for a barcode reader, and it is difficult to recognize the barcode with high accuracy.
[0005]
Further, as a cause of difficulty in recognizing the barcode, the width of the bar photographed in the input image is not constant. This is because the distance relationship between the barcode and the camera changes each time an input is made. In a close-up type scanner, the bar code can always be entered in a certain size, so the bar width can be determined in advance, but when shooting a bar code with a camera held by hand, a certain bar The width cannot be determined in advance.
[0006]
A method has been proposed in which the width of a bar is determined from a barcode image input by an image scanner and the barcode is recognized. For example, in JP-A-6-325197, the bar width is determined by counting the frequency of the pixel width for each scanning line. The principle of determining the width will be described.
[0007]
FIG. 19 is a diagram illustrating the relationship between the detection frequency and the width. As shown in FIG. 19, the width detection frequency is extracted for the scanning line. Thereby, an area having a frequency equal to or higher than a certain threshold is detected as an effective width. In the example of FIG. 19, sections 1, 2, and 3 are effective widths. Furthermore, two long ones of the effective width section are selected as the bar width. In this method, two types of widths of “thin” and “thick” can be detected from the two most frequently used widths. However, in a low-resolution image, the frequency peak interval is shortened and detection is possible. There is a problem of instability. In addition, it cannot handle a barcode having a plurality of widths.
[0008]
In addition, when a barcode is photographed by the camera, areas such as characters and patterns other than the barcode around the barcode are included in the input image. Therefore, it is necessary to extract a barcode area from the input image. In Japanese Patent Laid-Open No. 9-16701 (FIG. 19), a barcode area is extracted on the condition that the interval between bars is within a certain threshold. It is effective for a system that can obtain an input image relatively stably, such as a scanner. However, since the bar code is input while holding the camera by hand, the width of the bar has a large variation depending on the distance between the subject and the camera, and there is a problem in that it cannot be extracted well with a fixed threshold value.
In order to solve such a problem, Japanese Patent Laid-Open No. 9-22437 discloses an attempt to improve the extraction accuracy by examining a barcode-specific pattern when extracting a barcode area.
[0009]
FIG. 18 is an explanatory diagram of a barcode configuration. As shown in the figure, the barcode 1 includes a left guard bar 2 (or start bar), a center bar 3 and a right guard bar 4 (or end bar) peculiar to the barcode. In this case, the left guard bar 2 is provided on the start point side (left side) of the barcode 1 and is configured by a pattern in which black bars and white bars are alternately arranged, and information “101” ( This is a pattern in which (module expression) is set. The center bar 3 is provided at the center position of the barcode 1 and is composed of a pattern in which black bars and white bars are alternately arranged, and a pattern in which “01010” information (module expression) is set as the center information of the barcode 1 It is. The light guard bar 4 is provided on the end point side of the bar code 1 and is composed of a pattern in which black bars and white bars are alternately arranged, and information (module expression) of “101” is set as end information of the bar code 1 It is a pattern.
[0010]
A 6-digit left data character 5 is arranged between the left guard bar 2 and the center bar 3, and a 6-digit right data character 6 and a check digit 7 are arranged between the center bar 3 and the right guard bar 4. The numerical value at the left end below the barcode 1 represents the prefix digit 8.
[0011]
FIG. 20 is a flowchart showing a flow of conventional barcode extraction processing. First, as described above, a region where the bar interval is within a certain threshold is extracted as a complex region (step 401). It can be said that the complex area is an area where it is estimated that a barcode will exist.
[0012]
Next, the presence / absence of the center bar, right guard bar, and left guard bar is determined from the extracted complex area, and it is determined whether or not the extracted complex area is a barcode (step 402 to step 404). Then, each character of the barcode is recognized for the area determined to be a barcode (step 405).
[0013]
Here, when determining the presence / absence of the center bar, the right guard bar, and the left guard bar, the pattern of the module expression of the bar structure is collated based on the extracted bar width and a predetermined bar module width. The module width is predetermined according to the resolution of the scanner.
For example, when a form is read by a scanner having a resolution of 200 dpi, the module width is determined to be 4 pixels because it is expressed by 4 pixels per module.
[0014]
However, as described above, in order to input a barcode while holding the camera by hand, the width of the bar varies greatly depending on the distance between the subject and the camera, so the module width cannot be specified in advance. there were.
An image input with a low-resolution camera has a bar width of about 2 pixels, and a bar code that uses four types of widths has a bar that is completely equal to the module width due to noise at the time of input. There is a problem that a thick bar may be misrecognized as thin if it does not exist and only the widths are strictly compared, and correct matching cannot be performed.
[0015]
In order to solve this problem, in Japanese Patent Application Laid-Open No. 4-263281, when comparing the width of the bar in the specified pattern with the width of the input bar, the determination that the bar width is equal is: Let it be equal if it is within that range. For example, the condition that the bar width a and the bar width b are equal is as follows:
1.25a ≧ b ≧ 0.75a
It becomes. However, when a barcode is photographed with a low-resolution digital camera, the minimum width of the bar in the image is only about two pixels. In practice, the width of 2 pixels may be 1 pixel width or 3 pixel width due to an error in input processing. In this case, the fluctuation of the width is 50% of the actual width, and the fluctuation is large. When the width is thick, 4 pixels are often 5 pixels and 3 pixels. In this case, the fluctuation width is 25% of the actual width. As described above, when the widths of all bars are compared, if all the width ranges are determined to be the same, there is a problem that the determination cannot be made correctly when the variation with respect to the bar width is large.
[0016]
[Problems to be solved by the invention]
The problem to be solved by the present invention is to recognize a barcode with higher accuracy than a barcode image taken using a low-resolution image sensor. For this purpose, it is necessary to extract the barcode area with high accuracy from the input image. In addition, it is necessary to extract the bar width from the input image without specifying the bar width in advance so that the bar can be correctly recognized even if the width of the bar in the input image varies. Also, by using a low-resolution image sensor, the width of the narrowest bar is about 2 pixels. Even at this time, the width of multiple bars can be accurately determined and recognized without being affected by noise. It is necessary to. It is also necessary to be able to handle barcodes having a plurality of widths.
The present invention has been made in view of such a problem, and provides a barcode recognition apparatus capable of accurately recognizing a barcode even in a low resolution image taken by a small image sensor built in a portable terminal. For the purpose.
[0017]
[Means for Solving the Problems]
The barcode recognition apparatus of the present invention includes a preprocessing unit that performs preprocessing on an input image, a binarization processing unit that performs binarization on the input image after the preprocessing, and a binarization processing unit Labeling means for labeling an input image, barcode area extraction means for extracting a barcode area from the input image after labeling, and barcode recognition means for recognizing a barcode from the extracted barcode area It is characterized by comprising.
[0018]
In the barcode recognition apparatus of the present invention, it is preferable that the preprocessing means performs histogram conversion.
Further, the binarization processing means desirably uses a discriminant analysis method as a method for determining a threshold value in binarization of an image.
[0019]
In the barcode recognition apparatus of the present invention, it is desirable that the labeling means performs labeling by assigning individual numerical values for each connected pattern to the input image.
Further, it is desirable that the width of the bar is defined by the number of black pixels of the label related to the bar / the height in the vertical direction from the input image labeled by the labeling means.
In addition, when collating the width of the bar or space, it is desirable to set an allowable range of the width according to the width.
[0020]
Further, in the barcode recognition device of the present invention, the barcode area extraction means extracts the bar adjacency, determines the left end of the bar and the right end of the bar from the adjacency, and determines the left end of the bar and the right end of the bar. It is desirable to extract the bar code area by matching the number of bars between a certain value.
[0021]
Also, the adjacency relationship between the bars means that there is a scanning line shared by the two bars, that the height difference between the two bars is within a certain range, and that the distance between the two bars is within a certain range. It is determined that the two are adjacent to each other, and it is preferable that the range of the bar height difference and the range of the bar interval are adaptively obtained from the height and width of the reference bar.
[0022]
In the barcode recognition apparatus of the present invention, the barcode recognition is performed by using the minimum width of the bars in the barcode area extracted by the barcode area extraction means as the unit width, and this in the extracted barcode area. It is desirable to perform this by collating an array of bar and space width patterns that are integral multiples of the unit width with a predetermined array of bar and space width patterns.
Further, it is desirable that the barcode recognition is repeatedly performed by changing the unit width.
[0023]
According to the barcode recognition apparatus of the present invention, a barcode can be recognized with higher accuracy than a captured barcode image by a camera used in a small image sensor built in a mobile terminal. Further, according to the present invention, since a barcode can be recognized even when a low-resolution camera is used, the barcode can be read without adding a special barcode reader.
[0024]
In addition, a mobile phone according to the present invention includes the barcode recognition device according to the present invention. By incorporating the barcode recognition device into the mobile phone, barcode recognition can be easily performed anywhere, and the barcode recognized by the barcode recognition device can be transmitted immediately.
[0025]
Further, the barcode recognition method according to the present invention includes a step of performing preprocessing on an input image, a step of binarizing an input image after preprocessing, and an input image after binarization processing. The method includes a step of performing labeling, a step of extracting a barcode area from the input image after labeling, and a step of recognizing the barcode from the extracted barcode area.
The present invention can also be realized as a program that causes a computer to function as a barcode recognition device, and also as a recording medium that records the program.
[0026]
DETAILED DESCRIPTION OF THE INVENTION
In the present invention, the input image is subjected to histogram conversion preprocessing, binarization, and labeling processing. Based on the feature of the barcode structure, the bar adjacency is calculated from the labeled image. As an example of the adjacency relationship, all connected regions of an image are examined using a connected region of candidate bars satisfying the following conditions as an adjacent bar.
(1) As shown in FIG. 21, there is a horizontal scanning line 9 shared by two bars.
(2) As shown in FIG. 22, there is a difference between adjacent bar heights. Here, it is assumed that it is within 20% of the bar height.
(3) As shown in FIG. 23, the difference in the X direction of the position coordinate is within a certain range. Here, it is assumed that it is within 6 times the bar width.
[0027]
Next, the number of bars sandwiched between the left end and the right end is counted, and if the count value is a specified number, it is extracted as a barcode area. A unit width as a module width of the barcode is determined from the width of the black pixel connection region in the extracted barcode region.
A bar code is recognized by collating a specified bar code pattern with an extracted bar code area pattern in an array of bar and space width patterns that are integral multiples of the unit width. For recognition, the bar code left guard pattern is collated first, and if successful, the left 6 digit pattern, prefix digit, center bar, and right 6 digit pattern are collated sequentially. When the pattern is collated, an allowable range is provided according to the width of the bar and space, that is, for each magnification, thereby reducing the influence of noise and the like in the low-resolution image.
According to the present invention, it is possible to accurately recognize a barcode even in a low-resolution image captured by a small image sensor built in a portable terminal.
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
[0028]
FIG. 1 is a flowchart showing the flow of barcode recognition processing.
In FIG. 1, in step 1, histogram conversion is performed on the input image as preprocessing. If the minimum value of the luminance of the input image is Yi and the maximum value is Yj, the converted luminance Y ′ with respect to the luminance Y is obtained by the following equation (1).
[0029]
[Expression 1]
Figure 0004163406
[0030]
First, a differential value of luminance Y ′ is obtained, and a pixel having a differential value equal to or larger than a threshold value is set as an edge portion, and a luminance histogram for the edge portion is created.
In step 2, binarization is performed on the processed image in step 1. The binarization process stabilizes the calculation of the differential value of luminance, and improves the contrast for images with low contrast.
A binarization threshold value is determined from the histogram obtained above, and the image is binarized. As a method for determining the threshold value, for example, a discriminant analysis method may be used. Discriminant analysis is performed as follows.
[0031]
When an image whose luminance range is “0 to D” is binarized with a threshold value t, the average luminance of pixels whose luminance is “0 to t−1” is f0, The average luminance of pixels with luminance “t to D” is f1, The average luminance of the entire image is f, and the number of pixels having luminance k is nkThen the interclass variance σB 2Becomes the following formula (2), and the intra-class variance σI 2Becomes the following formula (3).
[0032]
[Expression 2]
Figure 0004163406
[0033]
[Equation 3]
Figure 0004163406
Since the dispersion ratio at this time is as shown in the following formula (4), t that maximizes F (t) is set as a threshold value.
[0034]
[Expression 4]
Figure 0004163406
[0035]
In step 3, labeling processing is performed. As shown in FIG. 2, the labeling process is to give a unique label to all connected black pixels with respect to black pixels (pixel value is 1) of the binarized image. An area occupied by connected black pixels is called a connected area. There are various labeling methods, but examples include the following methods.
[0036]
(1) Scan the image from the upper left to the lower right, find a pixel P that has a pixel value of 1 and is not labeled, and add a new label.
(2) For the pixel P, the same label is attached to all connected pixels in the image (10 to 12 in the figure are labels).
(3) Returning to (1), if a pixel that has not yet been labeled is found, a new label is attached and the processing of (2) is performed.
(4) When the entire image has been scanned, the process is terminated.
[0037]
In step 4, based on the labeling result, an area where the black pixel connected areas (bars) are arranged under a predetermined condition based on the pattern information including the height and width of the connected black pixels is barcoded. Extract as a region.
In step 5, the arrangement of the bar and space width of the extracted barcode area is checked to recognize the barcode.
The extraction of the barcode area in step 4 is performed by examining the adjacency relationship of each connected area labeled. Hereinafter, the labeled region is referred to as a bar.
[0038]
3 and 4 are flowcharts showing the flow of search processing for adjacent bars.
The adjacency relationship is performed using information on the width, height, and position of the bar. Obtain the bar width and bar height as follows.
Bar height: the height of the rectangle surrounding the connected area
Bar width: area of connecting area / bar height
The coordinates at the upper left corner of the rectangle surrounding the connected area are taken as the position coordinates of the bar.
Taking the adjacent condition as an example, it is determined as follows.
(1) There is a horizontal scan line shared by the two bars.
(2) The difference between adjacent bar heights is within 20% of the bar height.
(3) The difference in the X direction of the position coordinates is within 6 times the bar width.
[0039]
A bar that satisfies the above condition and has a position coordinate closest to the position coordinate of the target bar is set as an adjacent bar of the bar. There may be adjacent bars on the left and right sides, respectively.
When the adjacency relationship is obtained for all the bars, it is inspected whether or not it is a barcode area by the following procedure.
[0040]
The flow of the adjacent bar search process will be described with reference to FIGS. In FIG. 3 and FIG. 4, the definitions are as follows.
Bar (L): Connected area (bar) labeled L
Bar height (L): Height of the bar with label L (bar height)
Bar width (L): The width of the bar with the label L (bar width)
Bar position_x (L): x coordinate of the position coordinate of the bar with label L attached
MAX_LABEL: Maximum label value
MIN_LABEL: Minimum value of the label
Left distance: Minimum horizontal distance of the bar on the left side of the bar
Right distance: Minimum horizontal distance of the bar on the right side of the bar
Bar distance (L, L2): Horizontal distance between the bar with label L and the bar with label L2
Bar height difference (L, L2): Difference in height between the bar with label L and the bar with label L2
In step 101, first, a label indicating a target bar as a reference for search is substituted into a variable L. The label sequentially increases from the minimum label value (LABEL_MIN) to the maximum label value (LABEL_MAX).
[0041]
In step 102, a label indicating a bar that is an adjacent candidate for the target bar is substituted into the variable L2. The label sequentially increases from the minimum label value (LABEL_MIN) to the maximum label value (LABEL_MAX).
In Step 103, when the values of the variable L and the variable L2 are the same, that is, indicate the same bar, the process goes to Step 116. Otherwise, go to step 104. In step 104, the condition shown in the condition (1) is tested. If the condition (1) is satisfied, the process proceeds to step 105. If not, go to step 116.
[0042]
In step 105, the difference between the bar height of the bar labeled with the variable L and the bar height of the bar labeled with the variable L2 is calculated.
In step 106, the condition shown in the condition (2) is tested. If the condition (2) is satisfied, the process proceeds to step 107. If not, go to step 116.
[0043]
In step 107, the horizontal distance between the bar position of the bar labeled with the variable L and the bar position labeled with the variable L2 is calculated. In step 108, the condition shown in the condition (3) is tested. If the condition (2) is satisfied, the process proceeds to step 109. If not, go to step 116. Condition (3) uses a relative value with respect to the bar width as a threshold value, so that the determination can be made correctly even if the bar width of the input image is not constant.
[0044]
In step 109, it is determined based on the bar position coordinates whether the bar labeled with the variable L2 is on the right side or the left side with respect to the bar labeled with the variable L. If it is determined to be on the right side, the process proceeds to step 110. If it is determined to be on the left side, the process proceeds to step 113.
[0045]
In step 110, the distance between the variable “right distance” in which the minimum distance to the right bar found so far is stored and the current right bar is compared. If the distance is closer, the process proceeds to step 111. Otherwise, go to step 116, assuming this bar is not right next.
[0046]
In step 111, it is assumed that the bar labeled with the variable L2 is adjacent to the right, and the value of the variable L2 is stored. In step 112, the variable “right distance” is updated. In step 113, the variable “left distance” in which the minimum distance to the left bar found so far is stored is compared with the distance between the current left bar and the process proceeds to step 114 if the distance is closer. Otherwise, go to step 116, assuming that this bar is not on the left.
[0047]
In step 114, it is assumed that the bar labeled with the variable L2 is adjacent to the left, and the value of the variable L2 is stored. In step 115, the variable “left distance” is updated. In step 116, the variable L2 is updated to the next smaller label.
In step 117, if there is a label that is not searched for as an adjacent candidate by the variable L2, the process proceeds to step 103 and the process is repeated. When the search is completed for all labels, the process proceeds to step 118.
[0048]
In step 118, the variable L is sequentially updated to a larger label. At this time, the right adjacent bar and the left adjacent bar stored in steps 111 and 114 are determined as the right adjacent bar and the left adjacent bar of the bar indicated by the variable L, respectively.
In step 119, if there is a label not searched by the variable L, the process proceeds to step 102 and the process is repeated. When the search is completed for all labels, the process proceeds to step 120 and the process is terminated.
[0049]
When the adjacency relationship is obtained as described above, it is determined whether or not it is a barcode area by the following procedure.
First, a bar that does not have an adjacent bar on the left is marked as the leftmost bar. Next, the bar on the right is searched sequentially from the left end bar. Mark the bar that does not have a bar on the right as the rightmost bar.
[0050]
Count the number of bars from the left end bar to the right end bar, and if the number of bars is the specified number, the bar area is the area from the left end bar to the right end bar and the space between these bars. To do. The specified number is determined by the barcode standard. For example, in the case of a 13-digit JAN barcode, the number of bars is 30.
Barcode recognition processing is performed on the bars included in the extracted barcode area.
[0051]
FIG. 5 is a flowchart showing the flow of barcode recognition processing.
In step 201, first, a unit width as a reference for evaluating the widths of bars and spaces is determined. The smallest bar width in the barcode area is the unit width. The unit width corresponds to the module width of the barcode.
[0052]
In step 202, the leftmost two bars are checked against the left guard bar pattern to test whether it is a left guard. If it is determined to be a left guard, the process proceeds to step 203. Otherwise, go to step 212.
In step 203, the left six digits are recognized for the next 12 bars. In step 204, it is determined whether or not the left six digits have been normally recognized. If it has been completed normally, the process proceeds to step 205. Otherwise, go to step 212.
[0053]
In step 205, a prefix digit is recognized from a combination of even and odd parity of the left six digits. In step 206, it is determined whether the prefix digits have been recognized without contradiction. If it can be recognized without contradiction, the process proceeds to step 206. Otherwise, go to step 212.
In step 207, the next two bars are compared with the center bar pattern to test whether they are center bars. If it is determined that the bar is the center bar, the process proceeds to step 208. Otherwise, go to step 212.
[0054]
In step 208, the right six digits are recognized for the next 12 bars. In step 209, it is determined whether or not the right six digits have been normally recognized. If completed successfully, go to step 210. Otherwise, go to step 212.
In step 210, a check digit test is performed. If there is no contradiction in the check digit, the process proceeds to step 211. Otherwise, go to step 212.
[0055]
The check digit is a numerical value calculated for checking whether there is an error in reading, and the last one digit among the six digits on the right side is a check digit. The check digit is calculated from the 11 digits other than the check digit using the specified calculation method. The calculated result is compared with the read check digit, and if they are equal, it is assumed that there is no contradiction. In the example of FIG. 18, the check digit is a numerical value 4 on the right end.
[0056]
In step 211, it is determined that the recognition is successful, and the process ends. In step 212, the unit width is increased by one pixel. In step 213, it is determined whether or not the increase in unit width is 3 or less. If it is 3 or less, the process proceeds to step 202 and the same recognition process is performed again. Otherwise, go to step 214. In step 214, it is determined that the recognition has failed, and the process ends.
In the left guard test, center bar test, and numerical value recognition, the bar and space widths are compared with a predetermined pattern for evaluation. The evaluation procedure is described below.
[0057]
FIG. 6 is a diagram for explaining the space width, and FIG. 7 is a diagram for explaining the allowable error rate.
The width of the bar and space is an integral multiple of the unit width and is evaluated for each magnification. As shown in FIG. 6, the space width 15 is a width between two adjacent bars 13 and 14. The space width 15 is obtained as follows.
[0058]
For the adjacent bar (L) 13 and bar (L2) 14, the number of pixels between the bars is obtained for each horizontal scanning line. The average of the number of pixels between bars in all the scanning lines shared by the bar (L) 13 and the bar (L2) 14 is defined as a space width 15.
The barcode pattern is defined by a bar or an array of spaces having a width that is an integral multiple of the reference module width (unit width). The width magnifications are 1, 2, 3, and 4, respectively. Here, the narrowest width is 1, and the widest width is 4.
[0059]
The minimum magnification that satisfies the following condition is the magnification of the bar (space) width. That is, the condition is that the bar (space) width is within the range of magnification × unit width ± allowable error.
Here, the allowable error is defined by allowable error = magnification × unit width × allowable error rate. The allowable error rate is defined for each magnification as shown in FIG. Here, the allowable error is given because the influence of missing pixels due to binarization is taken into consideration. When a barcode is photographed with a low-resolution digital camera, the unit width in the image is only about two pixels. When binarization is performed, the bar image has a chipping of about one pixel and expansion noise. When compared as a bar having a width of 2 pixels without an allowable error, the 1-pixel width and the 3-pixel width are recognized as different widths. However, in practice, the 2 pixel width may become 1 pixel width or 3 pixel width due to binarization noise. By providing an allowable error, it is possible to recognize that the width is the same in consideration of the variation in the width.
[0060]
The left guard test in step 202 is performed as follows.
FIG. 8 is a diagram for explaining a left guard width arrangement pattern, and FIG. 9 is a diagram for explaining a left guard bar / space arrangement pattern.
Left guard bar and space width arrangement patterns defined as shown in FIGS. 8 and 9 and the left guard width bar and space arrangement determined based on the width evaluation in the extracted barcode area When the pattern is matched and the pattern matches, it is assumed that the bar is a bar constituting an effective left guard.
[0061]
The numerical values in steps 203 and 208 are recognized as follows.
FIG. 10 is a diagram showing the definition of the arrangement pattern of the bar and space widths with respect to numerical values. FIG. 11 shows combinations of whether the widths 1 to 4 shown in FIG. 10 are bar widths or space widths. FIG. 12 is a flowchart showing the flow of numerical value recognition processing.
[0062]
In FIG. 10, the odd number parity and the even number parity exist in the arrangement pattern of the width for the left six digits. The arrangement of widths shown in FIG. 10 is for odd parity. In the case of even parity, the same table is read from the opposite direction, that is, width 4, width 3, width 2, and width 1. For example, the numerical value 9 for odd parity is represented by an arrangement pattern of a triple width space, unit width bar, unit width space, and double width bar from the left. Space, a double-width bar, a double-width space, and a double-width bar arrangement pattern (refer to the first and second data characters on the left side of FIG. 18).
[0063]
In FIG. 11, since the arrangement pattern of bars and spaces is different between the left six digits and the right six digits from the center bar, two types of patterns are defined in FIG. For example, the number 6 with odd parity on the right side is represented by the arrangement pattern of the unit width bar, the unit width space, the unit width bar, and the quadruple space from the left (the first data on the right side in FIG. 18). Character reference).
[0064]
In the flowchart of FIG. 12, in step 301, the target bar and space width arrangement pattern is obtained for the left six-digit data character in the same procedure as the left guard test.
In step 302, the above-described width evaluation is performed using the collation patterns defined in FIGS. 10 and 11, and it is examined in order whether or not the patterns of the bar and space arrangement match. In the left six digits, the width pattern of odd parity or the width pattern of even parity is checked sequentially.
[0065]
If it is determined in step 303 that the patterns match, the process proceeds to step 304. Otherwise, go to step 307. In step 304, the width difference between the actual width obtained from the input image and the specified width pattern is obtained. The width difference is the sum of the differences between the four corresponding widths.
[0066]
In step 305, if the width difference is smaller than that found so far, the process proceeds to step 306. Otherwise, go to step 307.
In step 306, a numerical value corresponding to the pattern is stored as a recognition candidate numerical value. At the same time, the type of odd parity or even parity is also stored. Note that the initial value of the width difference is set to the maximum value.
[0067]
If it is determined in step 307 that the processing has been completed for all the collation patterns (numerical values 0 to 9) shown in FIG. Otherwise, the process proceeds to step 302 and the process is repeated for the next matching pattern.
In step 308, if the pattern matches the specified numerical value pattern, the numerical value is set as a recognition result, the process proceeds to step 309, and the process ends as a recognition success. Otherwise, it is recognized as unsuccessful, and the process proceeds to step 310 to end the process.
The prefix digit recognition at step 205 is performed as follows.
[0068]
FIG. 13 is a diagram showing a combination result (prefix digit) of odd parity and even parity, FIG. 14 is a diagram showing an arrangement pattern of center bar widths, and FIG. 15 is a diagram of center bar bars and spaces. It is a figure which shows an arrangement pattern.
[0069]
In step 205, the prefix digits are recognized from the odd parity and even parity records when all the left six digits have been successfully recognized. The combination result of the odd parity and the even parity is as shown in FIG. 13, and it is searched from the table and the matched one is recognized as the prefix digit. When no matching combination is found, recognition of the prefix digit is a failure and the process ends. In the example of FIG. 18, the left 6-digit data character 5 is odd parity 9, even parity 1, odd parity 2, odd parity 3, odd parity 4, even parity 4, and even parity 5. Is 101100, the prefix digit 8 is 4 from FIG. 13 (displayed at the left end of FIG. 18).
The center bar test in step 207 performs pattern matching in the same manner as the left guard test. The arrangement pattern of the bar and space width used for the center bar test is as shown in FIGS.
[0070]
In addition, this invention is not limited to the said embodiment, It can change and implement variously.
It is also possible to incorporate the barcode recognition apparatus of the present invention into a mobile phone. By incorporating the barcode recognition device into the mobile phone, barcode recognition can be easily performed anywhere, and the barcode recognized by the barcode recognition device can be transmitted immediately.
[0071]
FIG. 16 is a block diagram when the barcode recognition apparatus of the present invention is incorporated into a camera built-in mobile phone. The camera built-in mobile phone has an antenna 21 for transmitting and receiving radio waves and a wireless unit 22 for controlling transmission and reception of wireless communication. A key input unit 23 for inputting and generating key operation information from the user, a display unit 24 for displaying character information and image information to the user, a speaker 25 for outputting an audio signal, a microphone 26 for inputting an audio signal from the user, receiving or A storage memory 27 that stores input character information, image information, and audio signals, a camera 28 that inputs target image information, and a control unit 29 that controls each part are incorporated. .
[0072]
In the camera built-in mobile phone having the above configuration, when the barcode is recognized from the image information (barcode) input from the camera 28, the user operates the key input unit 23 to select the camera operation. The control unit 29 initializes the camera 28 based on the setting from the key input unit, and starts capturing image information (barcode). Image information (barcode) captured from the camera 28 is transferred to the storage memory 27 via the control unit 29. The control unit 29 transfers the image information (barcode) stored in the storage memory 27 to the display unit 24 and displays the image information (barcode). In addition, by continuously capturing and displaying image information (barcode), the user can confirm the camera image as a moving image. On the other hand, the image information (barcode) stored in the storage memory 27 is transferred to the control unit 29 having the barcode recognition device, and barcode recognition is performed in the barcode recognition processing described in the present embodiment. If the recognition is successful, the recognition result is transferred to the storage memory 27 and stored as barcode data in the storage memory 27.
[0073]
Next, the operation when the barcode data stored in the storage memory 27 is connected to the wireless or Internet and transmitted to the transmission destination will be described with reference to FIG. The user operates the key input unit 23 to select connection to the wireless or the Internet. The control unit 29 instructs the radio unit 22 to connect to the radio or the Internet based on the setting from the key input unit. The wireless unit 22 starts connection to the wireless or the Internet based on an instruction from the control unit 29. The user operates the key input unit 23 to select transmission of barcode data stored in the storage memory 27. Based on the setting from the key input unit 23, the control unit 29 transfers the barcode data stored in the storage memory 27 to the wireless unit 22 and instructs transmission. Based on an instruction from the control unit 29, the wireless unit 22 transmits the transferred barcode data to the wireless or the Internet. The barcode data transmitted from the wireless unit 22 is transmitted to the URL data server 32 via the wireless network 33. The URL data server 32 controls the operation of the wireless network 33 of the mobile phone terminal 34 and the gateway of the Internet 31. The URL data server 32 retrieves the destination URL from the received barcode data and URL database, connects to the Internet 31, and transfers the barcode data to the destination. The result of the transfer completion is transmitted to the portable terminal 34.
[0074]
The present invention can also be realized as a program that causes a computer to function as a barcode recognition device, and also as a recording medium that records the program.
The electronic mail communication apparatus of the present invention is also realized by a program for causing the electronic mail communication apparatus to function. This program may be stored in a computer-readable recording medium.
[0075]
As this recording medium, the ROM itself incorporated in the barcode recognition device may be a program medium, or the barcode recognition device is connected to a program reading device such as a CD-ROM drive and the recording medium is inserted therein. It may be a program medium such as a CD-ROM that can be read by the computer. In any case, the stored program may be configured to be accessed and executed by the CPU. The program is read out, and the read program is downloaded to a program storage area (not shown). A method in which the program is executed may be used. It is assumed that this download program is stored in the main device in advance.
[0076]
Here, the program medium is a recording medium configured to be separable from the main body, such as a tape system such as a magnetic tape or a cassette tape, a magnetic disk such as a floppy disk or a hard disk, or a CD-ROM / MO / MD / DVD. Even a medium carrying a fixed program, including a disk system of an optical disk, a card system such as an IC card (including a memory card) / optical card, or a semiconductor memory such as a mask ROM, EPROM, EEPROM, flash ROM, etc. Good.
[0077]
Furthermore, it may be a medium that fluidly carries a program so that the program is downloaded from a communication network via a transmission unit and a reception unit of a mobile phone including a barcode recognition device. When the program is downloaded from the communication network as described above, the download program may be stored in the apparatus main body in advance or may be installed from another recording medium. The content stored in the recording medium is not limited to a program, and may be data.
[0078]
【The invention's effect】
As described above, according to the present invention, a barcode can be recognized with higher accuracy than a captured barcode image by a camera used in a small image sensor built in a portable terminal. Further, according to the present invention, since the barcode can be recognized even when a low resolution camera is used, the barcode can be read without adding a barcode reader.
[Brief description of the drawings]
FIG. 1 is a flowchart showing a flow of barcode recognition processing.
FIG. 2 is a diagram illustrating an example of a labeling process.
FIG. 3 is a flowchart (first half) showing a flow of search processing for adjacent bars.
FIG. 4 is a flowchart (second half) showing a flow of search processing for adjacent bars.
FIG. 5 is a flowchart showing a flow of barcode recognition processing.
FIG. 6 is a diagram for explaining a space width;
FIG. 7 is a diagram for explaining an allowable error rate.
FIG. 8 is a diagram for explaining a left guard width arrangement pattern;
FIG. 9 is a diagram for explaining an arrangement pattern of bars and spaces of a left guard.
FIG. 10 is a diagram illustrating a pattern of widths with respect to numerical values.
11 is a diagram showing a combination of whether the widths 1 to 4 shown in FIG. 10 are bar widths or space widths.
FIG. 12 is a flowchart showing the flow of a numerical value recognition process.
FIG. 13 is a diagram showing a combination result (prefix digit) of odd parity and even parity;
FIG. 14 is a diagram showing an arrangement pattern of center bar widths;
FIG. 15 is a diagram illustrating an arrangement pattern of bars and spaces of a center bar.
FIG. 16 is an explanatory diagram of a configuration of a camera built-in mobile phone.
FIG. 17 is a diagram showing a connection of a mobile phone terminal to the Internet.
FIG. 18 is an explanatory diagram of a barcode configuration.
FIG. 19 is a diagram illustrating a relationship between detection frequency and width.
FIG. 20 is a flowchart showing a flow of conventional barcode extraction processing.
FIG. 21 is a diagram for explaining condition (1) for an adjacent bar;
FIG. 22 is a diagram for explaining a condition (2) for an adjacent bar.
FIG. 23 is a diagram for explaining a condition (3) of an adjacent bar.
[Explanation of symbols]
1 Barcode
2 Left guard bar
3 Center bar
4 Light guard bar
5 Left data character
6 Right data character
7 Check digit
8 Prefix digits
9 Horizontal scan line
10-12 labels
13-14 bar
15 space width
21 Antenna
22 Radio section
23 Key input part
24 display
25 Speaker
26 microphone
27 Memory
28 Camera
29 Control unit
31 Internet
32 URL data server
33 Wireless network
34 Mobile phone terminals

Claims (14)

入力画像に対して前処理を行う前処理手段と、前処理後の入力画像に対して2値化を行う2値化処理手段と、2値化処理後の入力画像に対してラベル付けを行うラベル付け手段と、ラベル付け後の入力画像からバーコード領域を抽出するバーコード領域抽出手段と、
抽出されたバーコード領域からバーコードを認識するバーコード認識手段と、を具備し、
前記ラベル付け手段は、入力画像に対して1つ1つの連結されたパターン毎に個別の数値名を振ることによりラベル付けを行い、該ラベル付け手段によりラベル付けされた入力画像より、バーの幅を、当該バーに係るラベルの黒画素数/垂直方向の高さで定義することを特徴とするバーコード認識装置。
Pre-processing means for pre-processing the input image, binarization processing means for binarizing the pre-processed input image, and labeling the input image after the binarization processing Labeling means; barcode area extracting means for extracting a barcode area from the input image after labeling;
Barcode recognition means for recognizing a barcode from the extracted barcode area,
The labeling means performs labeling by assigning an individual numerical value for each connected pattern to the input image, and from the input image labeled by the labeling means, the bar width Is defined by the number of black pixels of the label relating to the bar / the height in the vertical direction.
前処理手段は、ヒストグラム変換を行うことを特徴とする請求項1に記載のバーコード認識装置。  2. The barcode recognition apparatus according to claim 1, wherein the preprocessing means performs histogram conversion. 2値化処理手段は、画像の2値化における閾値の決定方法として、判別分析法を用いることを特徴とする請求項1又は2に記載のバーコード認識装置。  The barcode recognition apparatus according to claim 1 or 2, wherein the binarization processing unit uses a discriminant analysis method as a threshold value determination method in the binarization of the image. バー又はスペースの幅を照合するときに、幅に応じた幅の許容範囲を設定することを特徴とする請求項1から3までのいずれか1項に記載のバーコード認識装置。  The bar code recognition apparatus according to any one of claims 1 to 3, wherein when collating the width of the bar or space, an allowable range of the width corresponding to the width is set. 前記バーコード領域抽出手段は、バーの隣接関係を抽出し、その隣接関係からバーの左端とバーの右端とを決定し、バーの左端とバーの右端との間のバーの数がある規定値と一致することによりバーコード領域を抽出することを特徴とする請求項1から4のいずれか1項に記載のバーコード認識装置。  The bar code area extraction means extracts bar adjacency, determines the left end of the bar and the right end of the bar from the adjacency, and has a predetermined value of the number of bars between the left end of the bar and the right end of the bar 5. The barcode recognition apparatus according to claim 1, wherein the barcode area is extracted by matching with the barcode area. バーの隣接関係は、2つのバーが共有する走査線があること、2つのバーの高さの差がある範囲内であること、2つのバーの間隔がある範囲内であることをすべて満たす場合に隣接していると判定し、バーの高さの差の範囲及びバーの間隔の範囲は、基準となるバーの高さと幅から適応的に求められることを特徴とする請求項5に記載のバーコード認識装置。  The adjacency relationship between the bars satisfies that there is a scanning line shared by the two bars, that the height difference between the two bars is within a certain range, and that the distance between the two bars is within a certain range. The range of the bar height difference and the bar interval range are determined adaptively from the height and width of the reference bar, according to claim 5. Bar code recognition device. バーコード認識は、バーコード領域抽出手段により抽出されたバーコード領域内のバーで最小の幅を単位幅として用い、前記抽出されたバーコード領域におけるこの単位幅の整数倍のバー及びスペースの幅のパターンの並びと予め規定されたバー及びスペースの幅のパターンの並びとを照合することにより行うことを特徴とする請求項5又は6に記載のバーコード認識装置。  Barcode recognition uses the minimum width of the bars in the barcode area extracted by the barcode area extraction means as the unit width, and the width of the bar and space that are integral multiples of this unit width in the extracted barcode area. 7. The bar code recognition apparatus according to claim 5, wherein the bar code recognizing apparatus is configured by collating the pattern of the pattern and the pattern of the bar and space width defined in advance. バーコード認識は、単位幅を変化させて繰り返し行うことを特徴とする請求項7に記載のバーコード認識装置。  8. The barcode recognition apparatus according to claim 7, wherein the barcode recognition is repeatedly performed while changing the unit width. 請求項1から8までのいずれか1項に記載のバーコード認識装置を備えたことを特徴とする携帯電話機。  A mobile phone comprising the barcode recognition device according to any one of claims 1 to 8. 入力画像に対して前処理を行う工程と、前処理後の入力画像に対して2値化を行う工程と、2値化処理後の入力画像に対してラベル付けを行う工程と、ラベル付け後の入力画像からバーコード領域を抽出する工程と、抽出されたバーコード領域からバーコードを認識する工程と、を有し、
前記ラベル付けを行う工程は、入力画像に対して1つ1つの連結されたパターン毎に個別の数値名を振ることによりラベル付けを行い、該ラベル付けを行う工程によりラベル付けされた入力画像より、バーの幅を、当該バーに係るラベルの黒画素数/垂直方向の高さで定義することを特徴とするバーコード認識方法。
A step of pre-processing the input image, a step of binarizing the input image after the pre-processing, a step of labeling the input image after the binarization processing, and after the labeling A step of extracting a barcode area from the input image, and a step of recognizing a barcode from the extracted barcode area,
In the labeling step, the input image is labeled by assigning an individual numerical value to each connected pattern, and the input image is labeled by the labeling step. The bar width is defined by the number of black pixels of the label relating to the bar / the height in the vertical direction.
コンピュータに、請求項10に記載のバーコード認識方法を実行させるためのプログラム。A program for causing a computer to execute the barcode recognition method according to claim 10. 請求項11に記載のプログラムを記録したことを特徴とするコンピュータ読み取り可能な記録媒体。  A computer-readable recording medium on which the program according to claim 11 is recorded. 入力画像に対して前処理を行う前処理手段と、前処理後の入力画像に対して2値化を行う2値化処理手段と、2値化処理後の入力画像に対してラベル付けを行うラベル付け手段と、ラベル付け後の入力画像からバーコード領域を抽出するバーコード領域抽出手段と、
抽出されたバーコード領域からバーコードを認識するバーコード認識手段と、を具備し、
前記前処理手段は画素に関する輝度の微分値を求め、該微分値が閾値以上の画素をエッジ部とし、該エッジ部についてヒストグラム変換を行うことを特徴とするバーコード認識装置。
Pre-processing means for pre-processing the input image, binarization processing means for binarizing the pre-processed input image, and labeling the input image after the binarization processing Labeling means; barcode area extracting means for extracting a barcode area from the input image after labeling;
Barcode recognition means for recognizing a barcode from the extracted barcode area,
The bar code recognition apparatus characterized in that the preprocessing means obtains a differential value of luminance relating to a pixel, sets a pixel having the differential value equal to or greater than a threshold value as an edge portion, and performs histogram conversion on the edge portion.
請求項13に記載のバーコード認識装置を備えたことを特徴とする携帯電話機。  A mobile phone comprising the barcode recognition device according to claim 13.
JP2001304253A 2001-09-28 2001-09-28 Bar code recognition device Expired - Fee Related JP4163406B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001304253A JP4163406B2 (en) 2001-09-28 2001-09-28 Bar code recognition device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001304253A JP4163406B2 (en) 2001-09-28 2001-09-28 Bar code recognition device

Publications (2)

Publication Number Publication Date
JP2003108915A JP2003108915A (en) 2003-04-11
JP4163406B2 true JP4163406B2 (en) 2008-10-08

Family

ID=19124201

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001304253A Expired - Fee Related JP4163406B2 (en) 2001-09-28 2001-09-28 Bar code recognition device

Country Status (1)

Country Link
JP (1) JP4163406B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010123138A1 (en) 2009-04-24 2010-10-28 Mizuno Yoshiro Monitoring system

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8596541B2 (en) * 2008-02-22 2013-12-03 Qualcomm Incorporated Image capture device with integrated barcode scanning
US8366004B2 (en) * 2008-02-22 2013-02-05 Qualcomm Incorporated Barcode detection based on morphological operations
WO2009145439A2 (en) * 2008-04-01 2009-12-03 (주)이토프 Code providing method using short message service, code providing device using short message service, device for recognizing codes received through short message and codes capable of being transmitted through short message
JP5321610B2 (en) * 2011-02-04 2013-10-23 カシオ計算機株式会社 Scanner device and program
JP5223940B2 (en) * 2011-03-28 2013-06-26 カシオ計算機株式会社 Scanner device and program
JP5532163B2 (en) * 2013-03-13 2014-06-25 カシオ計算機株式会社 Image processing apparatus and program
JP5768260B2 (en) * 2014-04-09 2015-08-26 カシオ計算機株式会社 Image processing apparatus and symbol reading method
JP6607122B2 (en) * 2016-03-30 2019-11-20 ブラザー工業株式会社 Image analysis device

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3265804B2 (en) * 1994-03-18 2002-03-18 富士通株式会社 Barcode reader
JPH08161423A (en) * 1994-12-06 1996-06-21 Dainippon Printing Co Ltd Illuminating device and character reader
JPH10105641A (en) * 1996-09-30 1998-04-24 Toshiba Corp Method and device for detecting machine code
JP2000285197A (en) * 1999-03-31 2000-10-13 Fujitsu Kiden Ltd Bar code recognizing method and bar code reader
JP2001014421A (en) * 1999-06-28 2001-01-19 Matsushita Electric Ind Co Ltd Bar code reader
JP2001119683A (en) * 1999-10-20 2001-04-27 Fujitsu General Ltd Image sensor device
JP2001197186A (en) * 2000-01-12 2001-07-19 Yasuhiro Tsuji Originated call connecting system for automatic recognition system of telephone set

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010123138A1 (en) 2009-04-24 2010-10-28 Mizuno Yoshiro Monitoring system

Also Published As

Publication number Publication date
JP2003108915A (en) 2003-04-11

Similar Documents

Publication Publication Date Title
JPWO2004055713A1 (en) Bar code recognition device
US11954930B2 (en) Decoding 1D-barcodes in digital capture systems
EP1909215B1 (en) Image region detection method, recording medium, and device therefor
EP2568412B1 (en) Apparatus for recognizing character and barcode simultaneously and method for controlling the same
JP4415010B2 (en) Two-dimensional code region extraction method, two-dimensional code region extraction device, electronic device, two-dimensional code region extraction program, and recording medium recording the program
US8587685B2 (en) Method and apparatus for retrieving label
US10621470B2 (en) Methods for optical character recognition (OCR)
US20130194448A1 (en) Rules for merging blocks of connected components in natural images
WO2013044875A1 (en) Linear barcode identification method and system
US20060202040A1 (en) Camera-based barcode recognition
JP4163406B2 (en) Bar code recognition device
US20230093474A1 (en) Efficient location and identification of documents in images
KR100455802B1 (en) Method and apparatus for displaying a time-varying code to a handheld terminal, and method and apparatus for approval and authentication processing by using the same
WO2020008628A1 (en) Image processing system, image processing method, and program
WO2020008629A1 (en) Image processing system, image processing method, and program
US10509934B1 (en) Methods and apparatus for improving QR code locator detectability and/or finding the corners of a locator pattern
CN108108646B (en) Bar code information identification method, terminal and computer readable storage medium
KR100791704B1 (en) Barcode recognition apparatus
KR100791705B1 (en) Barcode recognition apparatus
KR100920663B1 (en) Method For Recognizing Of 2-dimensional Code
JPH11184965A (en) Slip identification register device
WO2007052957A1 (en) Device and method of classifying an image
JPH05242224A (en) Fingerprint collating device
JP4431335B2 (en) String reader
JP5107100B2 (en) Character recognition method, character recognition device, and character recognition program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20040618

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20070412

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070424

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070625

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20080226

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20080423

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

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

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

Free format text: PAYMENT UNTIL: 20110801

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

Ref document number: 4163406

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20110801

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20120801

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20120801

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20130801

Year of fee payment: 5

LAPS Cancellation because of no payment of annual fees