JP2004013188A - Business form reading device, business form reading method and program therefor - Google Patents
Business form reading device, business form reading method and program therefor Download PDFInfo
- Publication number
- JP2004013188A JP2004013188A JP2002161429A JP2002161429A JP2004013188A JP 2004013188 A JP2004013188 A JP 2004013188A JP 2002161429 A JP2002161429 A JP 2002161429A JP 2002161429 A JP2002161429 A JP 2002161429A JP 2004013188 A JP2004013188 A JP 2004013188A
- Authority
- JP
- Japan
- Prior art keywords
- ruled line
- line
- ruled
- storage unit
- character
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims description 67
- 238000001514 detection method Methods 0.000 claims abstract description 153
- 238000012545 processing Methods 0.000 claims description 19
- 230000000452 restraining effect Effects 0.000 abstract 2
- 238000005192 partition Methods 0.000 description 14
- 238000013500 data storage Methods 0.000 description 13
- 238000010586 diagram Methods 0.000 description 12
- 238000002372 labelling Methods 0.000 description 8
- 238000012937 correction Methods 0.000 description 6
- 239000000284 extract Substances 0.000 description 4
- 238000012015 optical character recognition Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000003708 edge detection Methods 0.000 description 1
- 238000013139 quantization Methods 0.000 description 1
- 238000005070 sampling Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
Images
Landscapes
- Character Input (AREA)
- Image Analysis (AREA)
Abstract
Description
【0001】
【発明の属する技術分野】
本発明は、複数の線分からなる罫線が印刷された帳票に手書きまたは印刷された文字を光学的に読取る、帳票読取り装置および帳票読取り方法に関する。さらには、本発明は、そのような帳票読取り方法を実現するプログラムに関する。
【0002】
【従来の技術】
光学的文字読取り装置(OCR:Optical Character Reader)の1つに帳票読取り装置がある。この帳票読取り装置では、所定の書式の文字記入枠が予め印刷された専用帳票が用いられる。専用帳票には、文字記入枠がドロップアウトカラー(人間には見えるが、装置には検出されない色、例えば薄いオレンジ色や青色)で印刷されたものと、非ドロップアウトカラー(例えば黒色)で印刷されたものとがある。前者の専用帳票を用いる場合は、帳票画像を入力する際に、文字記入枠が自動的に消え、記入された文字だけが読み込まれるため、文字認識時の処理が簡単になる。これに対して、後者の専用帳票を用いる場合は、文字記入枠が残るため、文字認識時にこの残った文字記入枠を検出して削除する必要があり、その分、文字認識時の処理が複雑化する。
【0003】
文字記入枠が非ドロップアウトカラーで印刷された専用帳票を用いる帳票読取り装置では、専用帳票に印刷された文字記入枠の各罫線の位置情報を予め取得しておき、この取得した罫線の位置情報に基づいて、入力帳票画像から罫線を検出するのが一般的である。そのような帳票読取り装置の一例として、例えば特開2000−132636号公報に記載された文字認識装置がある。
【0004】
図14は、上記公報に記載された文字認識装置の概略構成を示すブロック図である。図14に示す文字認識装置110は、イメージスキャナ部111、イメージデータ記憶部112、文字枠登録データ格納部113、文字枠位置検出部114、文字認識部115、方向コード記憶部116、枠候補記憶部117、及び枠コーナ候補座標記憶部118を有する。
【0005】
イメージスキャナ部111は、非ドロップアウトカラーで印刷された文字枠内に文字が記入された帳票を光学的に読取って、2値データからなる帳票イメージデータを取得する。取得された帳票イメージデータは2次元画像としてイメージデータ記憶部112に格納される。文字枠登録データ格納部113は、予め登録された枠座標値を含む文字枠登録データを格納するためのもので、例えば各文字枠の基準となる位置及び大きさが格納される。
【0006】
文字枠位置検出部114は、イメージデータ記憶部112に格納された帳票イメージデータと文字枠登録データ格納部113に予め格納されている文字枠登録データを比較して文字枠の位置を決定する。決定された文字枠の位置のイメージは、文字認識部115に供給される。
【0007】
文字認識部115は、文字枠位置検出部114から入力された文字枠の位置のイメージから、文字枠内の帳票イメージデータに基づく文字認識を行う。方向コード記憶部116、枠候補記憶部117、及び枠コーナ候補座標記憶部118は、文字枠位置検出部114による文字枠位置の決定に際して得られる、枠領域方向コード、枠線候補及び枠コーナ候補をそれぞれ記憶する。
【0008】
以下、この文字認識装置110の文字認識動作について説明する。
【0009】
セットされた帳票をイメージスキャナ部111で光学的に読取ると、イメージスキャナ部111にて取得された帳票イメージデータが記憶部112に格納される。すると、文字枠位置検出部114が、イメージデータ記憶部112に格納された帳票イメージデータと文字枠登録データ格納部113に予め格納されている文字枠登録データを比較して、以下の手順で文字枠の位置を決定する。
【0010】
まず、イメージデータ記憶部112に格納された帳票イメージデータと、文字枠登録データ格納部113に予め格納されている、枠座標値を含む文字枠登録データとから、文字枠を検出する領域を決定する。
【0011】
次いで、上記決定した枠検出領域内の黒画素が連結している部分を、輪郭トレースして枠領域方向コード(XY座標上で黒画素連結部分がどの方向を向いているのか示すもので、具体的には、8つの方向を数字で示したもの)を抽出し、該抽出した枠領域方向コードを輪郭座標と対応付けて方向コード記憶部116に記憶させる。さらに、方向コード記憶部116に記憶された枠領域方向コードから文字枠内側位置の候補を求めてそれを枠線候補記憶部117に記憶させる。そして、枠線候補記憶部117に記憶させた枠線候補位置に基づき作成した候補枠線が書き込まれた画像に対し、ラベリングを行った後、文字枠のコーナ位置候補座標を検出し、それを枠コーナ候補記憶部118に記憶させる。
【0012】
最後に、枠コーナ候補記憶部118に記憶させた文字枠のコーナ位置候補座用と、文字枠登録データ格納部113に格納されている枠座標値を含む文字枠登録データとから文字枠内側の位置を決定する。
【0013】
上述のようにして文字枠位置検出部114が文字枠内側の位置を決定した後、文字認識部115が、その文字枠内側の位置のイメージに関する文字認識を行う。
【0014】
上記の他、罫線や枠線と文字が重なった場合の文字の誤認識を防止できる文字認識装置が特開2001−147988号公報により開示されている。この文字認識装置では、原稿の読取りイメージから罫線を除去して1文字ずつ文字イメージが切出され、その切出された文字イメージについて、罫線との接触情報を取得するとともに文字認識が行われる。そして、その取得した接触情報と認識結果に基づいて、上記切出された文字イメージを予め登録された予測形状情報から予測される形状に近づけるように補正した補正イメージ群を取得し、その取得した補正イメージ群の中から認識候補イメージを選択し、その選択した認識候補イメージに対する認識文字を出力するか否かの評価が行われる。このように構成することで、非ドロップアウトカラーの1色刷りで罫線または枠線が印刷された帳票などをイメージリーダで読取る際の認識率向上を図っている。
【0015】
【発明が解決しようとする課題】
最近では、上述した専用帳票に限らず、一般に使用されている、OCRによる読取りを目的としていない帳票(以下、一般用帳票と称す。)についても、帳票に記入された文字情報の電子化が望まれている。この一般用帳票は、専用帳票に比べて、要求される罫線の印刷精度が低いため、ロッドの違いなどにより、印刷された罫線の位置にずれがあったり、印刷された罫線自体がかすれや潰れによって不鮮明であったりすることが多い。このため、予め取得した罫線の位置情報に基づいて入力帳票画像から罫線を検出する従来の帳票読取り装置でそのような一般用帳票の読取りを行う場合は、以下のような問題が生じる。
【0016】
(問題点1)
検出対象である罫線がかすれていると、罫線検出が正しく行われず、その結果、文字読取り位置を正しく検出できないという問題が生じる。特に、一般用帳票は、罫線の印刷精度が低いため、検出対象である罫線の位置と予め取得した罫線の位置情報との間にずれが生じ、正確な罫線の検出を行うことは非常に困難である。
【0017】
(問題点2)
1つの文字枠内が仕切り線(罫線)で仕切られた罫線枠では、その仕切り線は短い線分であることが多く、罫線枠内の黒画素をX軸およびY軸へ投影したパターン(ヒストグラム)を用いて記入文字の検出を行う場合、仕切り線自体にかすれがあると、記入文字と仕切り線とを正確に区別することができないため、罫線の誤検出が生じる。図15に、仕切り線の一部がかすれた罫線枠に記入された文字のヒストグラムの一例を示す。この例では、2本の仕切り線で仕切られた罫線枠に、左から「1」、「1」、「2」の文字が順に記入されている。中央の枠を構成する2本の仕切り線はともに一部がかすれており、このため、中央の枠部分におけるx軸上の投影パターンは、仕切り線部分と文字「1」の部分で黒画素の積算値が近い値になっている。この場合、文字「1」の部分を誤って罫線として検出することがある。特に、一般用帳票では、上記のように検出対象である罫線の位置と予め取得した罫線の位置情報との間にずれが生じるため、そのような誤検出を生じ易い。
【0018】
特開2000−132636号公報に記載されたものは、検出対象である罫線がかすれていると、罫線の位置を正確に決定することができないため、上述した問題点1と同様な問題が生じる。また、罫線枠に記入された文字を認識する際に、仕切り線(罫線)を誤検出する場合があり、上述した問題点2と同様な問題が生じる。
【0019】
特開2001−147988号公報に記載のものにおいては、切り出された文字イメージを予め登録された予測形状情報から予測される形状に近づけるように補正することで、罫線枠に記入された文字を正しく検出することができるが、これはあくまでも専用帳票を用いた場合のことであり、罫線の印刷精度の低い一般用帳票を用いた場合には、上記のように検出対象である罫線の位置と予め取得した罫線の位置情報との間のずれが大きくなるため、罫線枠の位置や文字記入位を正しく検出することができない。また、検出対象である罫線がかすれていると、罫線の位置を正確に決定することができない。よって、特開2001−147988号公報に記載のものにおいても、上述した問題点1、2と同様な問題が生じる。
【0020】
本発明の目的は、上述した各問題を解決し、印刷制度の低い帳票の、かすれや潰れなどによって一部が不鮮明になった罫線についても正確に検出することのできる、帳票読取り装置および帳票読取り方法ならびにプログラムを提供することにある。
【0021】
【課題を解決するための手段】
上記目的を達成するため、本発明の帳票読取り装置は、複数の線分からなる罫線が印刷された帳票のディジタル画像を取り込む画像入力手段と、
前記罫線に関する所定の罫線情報および前記複数の線分間の特定の関係を示す拘束条件が予め格納された第1の記憶手段と、
前記第1の記憶手段に格納された所定の罫線情報に基づいて、前記画像入力手段により取り込まれたディジタル画像から所定の検出条件で前記罫線を検出する罫線検出手段と、
前記罫線検出手段によって検出された罫線検出結果を格納する第2の記憶手段と、
前記第2の記憶手段に格納された罫線検出結果と前記第1の記憶手段に格納された所定の罫線情報および拘束条件との照合を行うことで、誤検出した線分および未検出の線分があるか否かを調べ、誤検出した罫線がある場合は、該誤検出した罫線を前記罫線検出結果から削除し、未検出の罫線がある場合は、前記罫線検出手段に前記所定の検出条件とは異なる検出条件で該未検出の罫線の再検出を行わせる罫線照合手段とを有することを特徴とする。
【0022】
本発明の帳票読取り方法は、複数の線分からなる罫線が印刷された帳票のディジタル画像を取り込む第1のステップと、
前記罫線に関する所定の罫線情報および前記複数の線分間の特定の関係を示す拘束条件を第1の記憶部に予め格納しておく第2のステップと、
前記第1の記憶部に格納された所定の罫線情報に基づいて、前記第1のステップで取り込まれたディジタル画像から所定の検出条件で前記罫線を検出する第3のステップと、
前記第3のステップで検出された罫線検出結果を第2の記憶部に格納する第4のステップと、
前記第2の記憶部に格納された罫線検出結果と前記第1の記憶部に格納された所定の罫線情報および拘束条件との照合を行うことで、誤検出した線分および未検出の線分があるか否かを調べる第5のステップと、
前記第5のステップで誤検出した罫線がある場合は、該誤検出した罫線を前記罫線検出結果から削除する第6のステップと、
前記第5のステップで未検出の罫線がある場合は、前記所定の検出条件とは異なる検出条件で該未検出の罫線の再検出を行う第7のステップとを含むことを特徴とする。
【0023】
本発明のプログラムは、複数の線分からなる罫線が印刷された帳票のディジタル画像を取り込む第1の処理と、
前記罫線に関する所定の罫線情報および前記複数の線分間の特定の関係を示す拘束条件を第1の記憶部に予め格納しておく第2の処理と、
前記第1の記憶部に格納された所定の罫線情報に基づいて、前記第1の処理で取り込まれたディジタル画像から所定の検出条件で前記罫線を検出する第3の処理と、
前記第3の処理で検出された罫線検出結果を第2の記憶部に格納する第4の処理と、
前記第2の記憶部に格納された罫線検出結果と前記第1の記憶部に格納された所定の罫線情報および拘束条件との照合を行うことで、誤検出した線分および未検出の線分があるか否かを調べる第5の処理と、
前記第5の処理で誤検出した罫線がある場合は、該誤検出した罫線を前記罫線検出結果から削除する第6の処理と、
前記第5の処理で未検出の罫線がある場合は、前記所定の検出条件とは異なる検出条件で該未検出の罫線の再検出を行う第7の処理とをコンピュータに実行させることを特徴とする。
【0024】
上記のとおりの本発明においては、ディジタル画像から検出された罫線検出結果と予め格納されている罫線情報および拘束条件との照合を行うことで、誤検出した罫線および未検出の罫線があるか否かの判定が行われる。拘束条件は、後述の実施形態でいうところの罫線レイアウト拘束条件であって、例えば平行に配置されている線分の長さが等しい、平行に配置されている複数の線分の間隔が等しい、文字記入枠を構成する4本の線分が他の線分と接触しない矩形形状を成す、といった条件である。罫線情報との照合に加えて、この拘束条件を用いた照合を行うことで、従来検出できなかった、一部にかすれや潰れを有する罫線(線分)の正確な検出が可能になっている。
【0025】
具体的に説明すると、例えば、図15に示した例において、従来は、文字「1」を線分として誤検出した場合、x軸上の投影パターンから6本の線分が検出される。これに対して、本発明では、特定の関係として例えば所定の間隔で等間隔、かつ、平行な4本の線分という拘束条件が設定される。この拘束条件に基づいて、検出された6本の線分のうちから、誤検出された線分(文字「1」に対応する)が抽出されて罫線検出結果から削除される。また、x軸上の投影パターンから3本の線分しか検出されなかった場合、すなわち、1本の線分が未検出となっている場合には、上記の拘束条件との照合により、その未検出となった線分が抽出され、該抽出された未検出の線分について再検出が行われる。再検出は、検出条件を変えて繰り返し行われるので、かならず未検出の線分が検出されることになる。
【0026】
【発明の実施の形態】
次に、本発明の実施形態について図面を参照して説明する。
【0027】
図1は、本発明の一実施形態である帳票読取り装置の概略構成を示すブロック図である。この帳票読取り装置は、専用帳票はもとより、一般用帳票を読取り対象とするものであって、その構成は帳票フォーム情報記憶部1、画像入力部2、画像メモリ3、罫線検出部4、罫線検出結果記憶部5、罫線照合部6、文字検出部7、文字認識部8、文字認識辞書9からなる。
【0028】
帳票フォーム情報記憶部1は、読取り対象である、罫線が非ドロップアウトカラーで印刷された帳票に関する、罫線位置、罫線レイアウト拘束条件および文字読取り位置が予め格納されるものであって、罫線情報記憶部101、罫線レイアウト拘束条件記憶部102および文字読取り位置記憶部103の3つの記憶部からなる。ここで、罫線位置は、帳票の文字記入面(紙面)の所定の位置を基準としたXY座標系における、罫線の各線分の両端の座標(始点・終点座標)や長さである。文字読取り位置は、同じXY座標系における文字枠の座標である。罫線レイアウト拘束条件は、罫線を構成する各線分間の特定の関係を示す条件で、例えば平行に配置されている線分の長さが等しい、といった条件である。
【0029】
画像入力部2は、帳票紙面を例えばCCDラインセンサーによる走査やCCDエリアセンサーによる入力などよって2次元サンプリングするとともに、得られた画像の濃淡を量子化して、格子状2次元配列を持つディジタル画像を生成する。量子化は2値または16値あるいは256値の多値で行ってもよい。ただし、2値画像においては文字および罫線の部分の画素値を1、背景部分の画素値を0とする。以降の説明において、2値画像中の値1をとる画素を黒画素、値0をとる画素を白画素と呼ぶものとする。
【0030】
画像メモリ3は、画像入力部2で生成されたディジタル画像を格納するメモリである。このメモリは、罫線検出部4による画素単位での読出し/書込みが可能であるとともに、文字検出部7による画素単位での読出しが可能である。
【0031】
罫線検出部4は、画像メモリ3に格納されたディジタル画像から帳票上の罫線を線分単位に検出する。罫線検出結果記憶部5は、罫線検出部4で検出された線分単位の罫線を保持する。罫線照合部6は、罫線検出結果記憶部5に記憶された線分単位の罫線に帳票フォーム記憶部1に記憶された罫線位置および罫線レイアウト拘束条件を当てはめて、未検出や誤検出された罫線の有無を検証して、誤検出罫線の廃棄を行ったり、未検出罫線の再検出を罫線検出部4へ指示したりする。
【0032】
文字検出部7は、帳票フォーム記憶部1に記憶された文字読取り位置と罫線検出結果記憶部5に記憶された罫線情報とを参照して画像メモリ3に格納されたディジタル画像から文字読取り位置を特定する。文字認識部8は、文字検出部7で特定された領域内の文字パターンを抽出し、文字認識辞書9を参照して文字認識を行う。文字認識辞書9には、所定の文字の特徴がカテゴリ毎に格納されている。
【0033】
次に、本実施形態の帳票読取り装置の動作について具体的に説明する。図2は、図1に示した帳票読取り装置の文字認識の全体動作を説明するためのフローチャート図である。以下、図1および図2を参照して動作を説明する。
【0034】
読取り対象である帳票が所定の部位にセットされると、画像入力部2を介してそのセットされた帳票の紙面の2次元ディジタル画像が入力され、この入力された2次元ディジタル画像が画像メモリ3に格納される(ステップS1)。
【0035】
次いで、罫線検出部4が、画像メモリ3に格納されている2次元ディジタル画像(帳票画像)を読み出して、該読み出した2次元ディジタル画像(帳票画像)を2値化し、該2値化画像から罫線を検出する(ステップS2)。この罫線検出部4による罫線検出の結果は、罫線検出結果記憶部5に格納される。
【0036】
次いで、罫線照合部6が、罫線検出結果記憶部5に格納された罫線検出結果と帳票フォーム情報記憶部1に予め登録されている罫線情報との照合を行う。この照合では、罫線情報記憶部101に格納されている、罫線を構成する各線分の位置(罫線位置)および線分同士の接続状態を用いて罫線検出結果が正しいか否かを判定する(第1の判定)とともに、罫線レイアウト拘束条件記憶部102に格納されている罫線拘束条件に基づいて罫線検出結果が正しいか否かを判定する(第2の判定)。この照合により、誤検出された線分および未検出の線分(罫線情報記憶部101に登録されているにも関わらず診検出となった線分)が抽出される。罫線照合部6は、誤検出の線分については、罫線検出結果記憶部5に格納された罫線検出結果から削除し、未検出の線分については、罫線再検出指示を罫線検出部4に送信して罫線の再検出を行わせる。罫線再検出指示を受けた罫線検出部4は、例えば、2値化しきい値の変更や罫線情報記憶部101の座標情報を利用した検出範囲の絞り込みを行った上で罫線の再検出を実行する。全ての罫線が正しく検出されるまで、上記第1および第2の判定、誤検出した罫線の削除および罫線再検出の処理が繰り返されて、罫線検出結果が補正される(ステップS3)。
【0037】
罫線検出結果の補正が完了し、全ての罫線が正しく検出された後、文字検出部7が、文字読取り位置記憶部103に予め格納されている文字読取り位置と、罫線検出結果記憶部5に格納された、上記補正が施された罫線検出結果とから文字認識を行うべき位置(文字読取り位置)を特定し(ステップS4)、その特定された文字読取り位置の画像から1文字単位の文字パターンを切り出す。そして、文字認識部8が、文字検出部7により切り出された文字パターンの特徴を抽出し、この抽出した特徴と文字認識辞書9に予め格納されている文字特徴とのパターンマッチングを調べることで文字認識を行う(ステップS5)。
【0038】
次に、本実施形態の帳票読取り装置の各構成部について詳細に説明する。
【0039】
罫線情報記憶部101は、予め、帳票上の罫線を構成する各線分について、始点、終点、接続・交差点の各座標値を保持している。図3に、帳票の一例を示し、図4に、その帳票に関する、罫線情報記憶部101に記憶される罫線情報の一部を示す。
【0040】
図3に示す帳票Aは、線分(1)〜(10)からなる第1の罫線枠と、線分(12)〜(21)からなる第2の罫線枠とが印刷されたものである。罫線情報記憶部101には、帳票Aの左上の位置を基準(0,0)とするXY座標系における、各線分(1)〜(21)の両端の座標や長さ、交差点の情報が、図4に示すような表の形で格納される。格納される情報は、各線分(1)〜(21)に対してそれぞれ対応する番号が割り振られる。図4中、(Xs,Ys)は線分の始点,(Xe,Ye)は線分の終点,tmaxは線分が他の線分と接続または交差する点(以下、接続点と称する)の数である。{(Xt(1),Yt(1)),(Xt(2),Yt(2)),・・・,(Xt(tmax),Yt(tmax))}は接続点の座標である。{L(1),L(2),・・・,L(tmax)}は、各接続点で接続している他の線分の番号である。{F(1),F(2),・・・,F(tmax)}は、各接続点の形態を表わす属性コードで、以下の9種類が存在する。
【0041】
[接続点の形態を表わす属性コード]
・表枠の左上隅コーナー :01
・表枠の右上隅コーナー :02
・表枠の左下隅コーナー :03
・表枠の右下隅コーナー :04
・十字交差点 :05
・T字交差点 :06
・上下逆T字交差点 :07
・左90°回転T字交差点:08
・右90°回転T字交差点:09
罫線レイアウト拘束条件記憶部102に保持される罫線レイアウト拘束条件には、罫線を構成する線分の部分集合に対する、例えば以下のような4つの条件がある。
【0042】
条件1:線分が平行。
【0043】
条件2:線分の長さが等しい。
【0044】
条件3:線分の間隔が等しい。
【0045】
条件4:4本の線分が他の線分と接触しない矩形形状を成す。
これら罫線レイアウト拘束条件は一例であって、必要に応じて接続点の形態や数などの他の条件を追加することもできる。
【0046】
罫線レイアウト拘束条件記憶部102には、上記の条件のいずれか1つ、または複数を同時に満たす線分群が1つのグループとして登録されている。図5に、図3に示した帳票に関する罫線レイアウト拘束条件の具体例を示す。図5中、グループ1は、条件1および条件2を同時に満たす線分群であり、線分番号1、5、4の計3本の線分が属している。グループ2は、条件2および条件3を同時に満たす線分群であり、線分番号2、6、7、8、9、10、3の計7本の線分が属している。グループ3は、条件1〜3を同時に満たす線分群であり、線分番号6、7、8、9、10の計5本の線分が属している。
【0047】
文字読取り位置記憶部103には、予め罫線で囲まれた文字読取り領域(以下、セルと称す)を囲む4本の罫線の番号が登録されている。ある文字列を記入するためのセルが仕切り線で文字単位に分割されているような場合には、仕切り線の数と仕切り線の線分番号も登録される。図6に、図3に示した帳票に対応する文字読取り位置記憶部103の記憶内容の一部を示す。図6に示す例では、フィールド番号1、2、3で示される3つのセルの例が示されている。フィールド番号1のセルは、当該セルを囲む上端、下端、左端、右端の各罫線がそれぞれ線分番号5、4、2、3の線分により形成され、当該セル内が線分番号6、7、8、9、10の計5本の仕切り線により仕切られたものである。フィールド番号2、3のセルは、いずれも仕切り線を持たない。
【0048】
罫線検出部4は、画像メモリ3に格納されたディジタル画像から帳票上の罫線を線分単位に検出し、その検出結果を罫線検出結果記憶部105に格納する。図7に、罫線検出部4による罫線検出処理の一手順を示す。以下、図7を参照して罫線検出処理の手順を説明する。
【0049】
まず、画像メモリ3に格納されたディジタル画像の階調が2値でない場合に、該ディジタル画像を文字および罫線部分で画素値1、背景部分で画素値0をとる2値画像に変換して、画像メモリ3へ上書きする(ステップS401)。次いで、2値化されたディジタル画像から帳票の4辺をHough変換などで検出する帳票端検出処理を行う(ステップS402)。次いで、2値化されたディジタル画像上で、罫線を構成する全ての画素に罫線ラベルと罫線の方向コードを付与する罫線ラベリング処理を行う(ステップS403)。次いで、罫線ラベルが付与されたディジタル画像を対象として罫線を線分単位に検出する線分検出処理を行う(ステップS404)。最後に、罫線検出結果を対象として、罫線間の交差点・接続点(形状としてはコーナーまたは分岐を表現する)の座標情報を求めて、これを罫線検出結果記憶部5に格納する。
【0050】
上述のステップS403での罫線ラベリング処理は、具体的には以下のようにして行われる。
【0051】
図8に罫線ラベリング処理の一手順を示す。まず、2値化されたディジタル画像をラスタ走査して黒画素を探索する(ステップS501、S502)。黒画素が検出された場合は、ラスタ走査を一時中止し(ステップS503)、検出された黒画素を中心として直線状の探索エリアを例えば0°〜180°の範囲内で一定角度刻みに回転させ、各回転角度における探索エリア内に含まれている黒画素の数Bをカウントし、探索エリアの面積S(画素数)に対する黒画素エリア(黒画素)の割合T[T=100×B÷S]を求める(ステップS504)。
【0052】
図9に、直線状の探索エリアを模式的に示す。図9に示すように、着目している黒画素を中心として直線状の探索エリアを一定角度単位で回転させれば、罫線のある部分では、黒画素エリア(黒画素)の割合Tが多くなる。探索エリアの大きさにもよるが、通常、割合Tの値が70%以上であれば罫線である可能性が非常に高い。この例では、角度刻みを45°としている。
【0053】
上記ステップS504にて全ての回転角度について黒画素エリア(黒画素)の割合Tが求められると、次いで、黒画素数が最大となる回転角度の探索エリアについて、黒画素エリア(黒画素)の割合Tがしきい値Tth(例えば70%)を超えたかどうかを調べる(ステップS505)。割合Tがしきい値Tthを超えた場合は、その探索エリア含まれている全ての黒画素に対して罫線であることを示す罫線ラベルを付与するとともに、その探索エリアの角度を示す方向コードを付与する(ステップS506)。図10に、方向コードの一例を示す。図10に示す例では、所定の角度(45度)で区分された4方向が0〜3の数値からなる方向コードで表されている。各方向は、図9に示した直線状の探索エリアの回転角度に相当する。
【0054】
上記ステップS506で罫線ラベルおよび方向コードを付与した後は、ラスタ走査を再開し(ステップS507)、上述したステップS502〜S506の処理を繰り返す。また、上記ステップS505で割合Tがしきい値Tth以下の場合も、同様にステップS507に移ってラスタ走査を再開し、上述したステップS502〜S506の処理を繰り返す。
【0055】
以上の処理により、ディジタル画像の各画素について罫線ラベリングが施され、その結果が罫線検出結果記憶部5に格納される。図11に、ディジタル画像の各画素について保存される罫線ラベルと回転角のフォーマットの一例を示す。この図11に示す例では、各画素についての保存容量を8ビットとしている。ビット「b0」は、画素値(「1:図形」、「0:背景」)を表す。ビット「b1」は、線分検出フラグ(「1:検出済み」、「2:未検出」)を表す。ビット「b2」は、線分検出完了フラグ(「1:完了」、「2:未完了」)を表す。ビット「b4」および「b5」は、方向コードを表す。ビット「b6」は罫線判定完了フラグ(「1:完了」、「0:未完了」)を表す。ビット「b7」は、罫線ラベル(「1:罫線」、「0:罫線以外」)を表す。なお、ビット「b3」は空きビットである。
【0056】
上述のステップS404での線分検出処理は、具体的には以下のようにして行われる。
【0057】
図12に線分検出処理の一手順を示す。この線分検出処理では、上述の図8に示した罫線ラベリング処理が施された後の、罫線ラベルが付与されたディジタル画像を対象として罫線を線分単位に検出する。線分の検出には、図11に示したフォーマットの線分検出フラグ(ビットb1)、線分検出完了フラグ(ビットb2)を利用する。これら2つのフラグは、線分開始時には値「0」に初期化されているものとする。
【0058】
まず、ラスタ走査を行って(ステップS511)、罫線ラベルの付いた画素で線分検出完了フラグの値が0のものを探索する(ステップS512)。線分検出完了フラグの値が0の画素が検出された場合は、ラスタ走査を一旦中止する(ステップS513)。そして、検出された画素の線分検出フラグに値1を付与し、該画素を起点として市街地距離d≦N(N=1、2、3、・・・)の範囲内で、条件B1〜B3を全て満たす黒画素を探索し(ステップS514)、検出された全ての黒画素の線分検出フラグに値1を付与して(ステップS515)、線分の端点を求める(ステップS516)。ここで、起点の方向コードはC0(図10参照)である。市街地距離は、2点間で、x方向の距離差Δxの絶対値とy方向の距離差Δyの絶対値の和(|Δx|+|Δy|)で与えられる。条件B1〜B3は、具体的には以下のような条件である。
【0059】
条件B1:線分検出フラグの値が0
条件B2:近傍8画素のいずれかの画素の線分検出フラグの値が1
条件B3:方向コードが起点の方向コードC0と一致
上記ステップS514〜S516の処理は、具体的には、以下のサブステップ1〜3からなるサブプロセスを含む。
【0060】
サブステップ1:
市街地距離d≦1の範囲内で、黒画素の探索を行い、検出された全ての黒画素の線分検出フラグに値1を付与する。続いて、市街地距離d≦2の範囲内で、黒画素の探索を行い、検出された全ての黒画素の線分検出フラグに値1を付与する。市街地距離dの値を3、4、5、・・・と順次増やして同様な処理を行う。条件B1〜B3を満たす黒画素が無くなった時点で、探索処理は終了する。
【0061】
サブステップ2:
線分検出フラグの値が1の画素のうち、起点の方向コード(ここでは、C0)が示す方向にあって起点から最もユークリッド距離の大きい画素を線分の端点とみなし、その座標値を罫線検出結果記憶部5に格納する。また、起点の方向コードが示す方向と逆方向にあって起点から最もユークリッド距離の大きい画素を線分のもう一方の端点とみなし、その座標値を罫線検出結果記憶部5に格納する。ただし、座標値は全て帳票端検出処理(図7のステップS402)で検出された帳票の左上隅コーナーが原点となるよに並進補正され、帳票の横および縦の辺がそれぞれ水平、垂直になるように回転補正された座標系で保存されるものとする。以後、画像データ上で検出される座標値も同様に並進補正および回転補正が施された後に保存されるものとする。
【0062】
サブステップ3:
画像データ前面をラスタ走査して線分検出フラグの値が1である黒画素を検出し、検出された黒画素について、その線分検出フラグの値をゼロクリアするとともに、線分検出完了フラグに値1をセットし、サブプロセスを終了する。
【0063】
上述のステップS514〜S516により線分の両端の座標値が罫線検出結果記憶部5に格納されると、ラスタ走査を再開し(ステップS517)、次の線分の端点を求める。全ての線分が検出され、それぞれ端点が求められたら、線分検出処理を終了する。
【0064】
以上、本実施形態の帳票読取り装置における罫線検出動作の概略について説明したが、本実施形態の帳票読取り装置の特徴は、図2に示したステップS3の罫線情報の照合および補正にある。以下、この罫線情報の補正について具体的に説明する。
【0065】
まず、罫線照合部6による照合について説明する。罫線照合部6は、帳票フォーム情報記憶部1中の罫線情報記憶部101および罫線レイアウト拘束条件記憶部102から、画像入力された帳票の罫線の線分単位の情報、及び該線分間の拘束条件を読み出して、罫線検出結果記憶部105中の線分情報と照合する。この照合の具体的な手順を図13に示す。
【0066】
図13を参照すると、まず、図5に例示した罫線レイアウト拘束条件記憶部102に登録されているk番目のデータグループから、罫線レイアウト拘束条件と該条件を満たす線分の番号(L1、L2、・・・、L(k_nc))を取り出す(ステップS601)。ここで(k_nc)はk番目のデータグループに登録されている線分の本数である。また、データグループは、k=1、2、3、・・・、k_maxだけ登録されているものとする。
【0067】
次いで、罫線レイアウト拘束条件記憶部102のk番目のデータグループから取り出された線分の番号で罫線情報記憶部101を参照することによって該線分の始点座標、終点座標を取り出し、罫線検出結果記憶部5中の線分の始点座標、終点座標と照合する(ステップS602)。
【0068】
罫線検出結果記憶部5の中に一致する線分が見つかった場合は、対応する罫線情報記憶部101の線分番号を罫線検出結果記憶部5に書き込む。罫線情報記憶部101から取り出されて照合に失敗した線分については、罫線照合部6内部に一時的に線分番号を保存する。該k番目のデータグループから取り出された全ての線分照合が終了した時点で、照合に失敗した線分がある場合には、該線分の、後述するようなTop−Down的手法による再検出を罫線検出部4へ指示する(ステップS603)。
【0069】
該k番目のデータグループに登録されている全ての罫線が検出された後は、罫線情報記憶部101側の線分の座標値と罫線検出結果記憶部5側の線分の座標値との平均のずれ量(ΔX、ΔY)を罫線照合部6内部に保存する(ステップS604)。
【0070】
上記ステップS601〜S604の処理を、罫線レイアウト拘束条件記憶部102に登録されている(k_max)個のデータグループについて実行する。
【0071】
次いで、罫線情報記憶部101に登録されているその他の線分について、上記S604で罫線照合部6内部に保存したずれ量(ΔX、ΔY)を修正した上で、罫線検出結果記憶部5に保持された線分との照合を行う(ステップS605)。このとき、線分に含まれる接続点の形態および数についても照合を行うことによって、照合の誤りの発生を防ぐ。罫線情報記憶部101に登録されている線分で照合に失敗したものについては、罫線照合部6内部に一時的にその線分番号を保存する。
【0072】
全ての照合が終わった後、照合に失敗した線分がある場合には、該線分の再検出を罫線検出部4へ指示する(ステップS606)。また、罫線検出結果記憶部5の中に罫線情報記憶部101に登録されている線分と対応の付かない線分が残っている場合にはこれを削除する(ステップS607)。
【0073】
次に、罫線再検出指示を受けた罫線検出部4による線分の再検出について説明する。
【0074】
再検出する線分に関して罫線レイアウト上の拘束条件が罫線レイアウト拘束条件記憶部102に登録されている場合には、罫線照合部6を経由してその罫線レイアウト拘束条件記憶部102に登録されている線分の始点・終点座標値を読出し、誤差を見込んで該線分が含まれている部分領域を特定し、該部分領域内において罫線のかすれを防ぐ2値化しきい値の調整後、再度2値化を行う。罫線レイアウト上の拘束条件として記述されている、平行した2または3以上の本数の線分を検出する場合には、拘束条件を満たす複数線分を優先的に検出する。以上の「Top−Down」的な検出により再検出時の検出制度が向上する。
【0075】
再検出する線分に関して罫線レイアウト上の拘束条件が罫線レイアウト拘束条件記憶部102に登録されていない場合には、罫線検出部4は、罫線情報記憶部101に登録されている線分の始点・終点座標値を読出し、誤差を見込んで該線分が含まれている部分領域を特定し、該部分領域内において罫線のかすれを防ぐ2値化しきい値の調整後、再度2値化を行う。これにより再検出時の検出制度が向上する。
【0076】
次に、上述した罫線の照合および補正の処理が施された罫線検出結果に基づく文字読取り位置の特定および文字認識処理について説明する。
【0077】
文字検出部7は、帳票フォーム情報記憶部1の文字読取り位置記憶部103からOCR読取りする文字フィールドを囲む4本の罫線(線分)の罫線番号(線分番号)を読み出し、さらにその罫線番号(線分番号)に基づいて罫線の始点終点座標を罫線情報記憶部101から読み出し、画像入力部2から入力されたディジタル画像上における文字フィールド(文字読取り位置)を特定し、該特定した文字フィールドのイメージから文字パターンを抽出する。文字パターンの抽出は、例えば、特定した文字フィールド内の黒画素をx軸およびy軸へ投影してできたパターンから黒画素の積算値がしきい値以上である1文字単位の部分画像を切り出すことによって実現可能である。
【0078】
文字認識部8は、文字検出部7から得られた1文字単位の画像から認識のための文字特徴を抽出する。そして、これを文字認識辞書9にカテゴリ毎に格納されている文字特徴と順次照合して最も類似度の高いカテゴリを認識結果として出力することで文字認識を行う。
【0079】
以上説明した、罫線の照合および補正の処理により、印刷された罫線にかすれや潰れがあっても、その罫線を正確に検出することができ、正確な文字記入位置を取得することができる。この罫線検出は、専用帳票はいうまでものなく、一般用帳票においても有効である。
【0080】
以上説明した本実施形態の帳票読取り装置における、罫線検出に関する一連の処理は、基本的にはプログラムにより実現することができる。このプログラムは、帳票読取り装置を構成するコンピュータのハードディスク内に予めインストールされていてもよく、また、CD−ROMなどの記録媒体により提供されもよい。さらには、このプログラムは、インターネットを介して提供(ダウンロード)してもよい。
【0081】
【発明の効果】
以上説明したように、本発明によれば、一部が不鮮明な罫線(線分)や罫線枠(文字枠)の仕切り線についても正確に検出することができので、従来検出することができなかった、罫線の印刷精度の低い一般用帳票を高精度にOCR読取りすることができるという効果がある。
【図面の簡単な説明】
【図1】本発明の一実施形態である帳票読取り装置の概略構成を示すブロック図である。
【図2】図1に示す帳票読取り装置の文字認識の全体動作を説明するためのフローチャート図である。
【図3】帳票の一例を示す模式図である。
【図4】図3に示す帳票に関する罫線情報の一部を示す図である。
【図5】図3に示す帳票に関する罫線レイアウト拘束条件の一例を示す図である。
【図6】図3に示す帳票に対応する文字読取り位置の一例を示す図である。
【図7】図1に示す帳票読取り装置の罫線検出部による罫線検出処理の一手順を示すフローチャート図である。
【図8】図1に示す帳票読取り装置の罫線検出部による罫線ラベリング処理の一手順を示すフローチャート図である。
【図9】直線状の探索エリアの一例を示す模式図である。
【図10】方向コードの一例を示す模式図である。
【図11】図8に示す罫線ラベリング処理で使用される罫線ラベルと回転角のフォーマットの一例を示す図である。
【図12】図1に示す帳票読取り装置の罫線検出部による線分検出処理の一手順を示すフローチャート図である。
【図13】図1に示す帳票読取り装置の罫線照合部による照合の一手順を示すフローチャート図である。
【図14】特開2000−132636号公報に記載されている文字認識装置の概略構成を示すブロック図である。
【図15】従来の帳票読取り装置における、仕切り線の一部がかすれた罫線枠に記入された文字のヒストグラムの一例を示す模式図である。
【符号の説明】
1 帳票フォーム情報記憶部
2 画像入力部
3 画像メモリ
4 罫線検出部
5 罫線検出結果記憶部
6 罫線照合部
7 文字検出部
8 文字認識部
9 文字認識辞書
101 罫線情報記憶部
102 罫線レイアウト拘束条件記憶部
103 文字読取り位置記憶部
110 文字認識装置
111 イメージスキャナ部
112 イメージデータ記憶部
113 文字枠登録データ記憶部
114 文字枠位置検出部
115 文字認識部
116 方向コード記憶部
117 枠線候補記憶部
118 枠コーナー候補座標記憶部[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a form reading apparatus and a form reading method for optically reading characters handwritten or printed on a form on which ruled lines composed of a plurality of line segments are printed. Further, the present invention relates to a program for realizing such a form reading method.
[0002]
[Prior art]
One of the optical character readers (OCR) is a form reader. This form reader uses a dedicated form in which a character entry frame of a predetermined format is printed in advance. In the dedicated form, the character entry frame is printed in a dropout color (visible to humans but not detected by the device, for example, light orange or blue), and in a non-dropout color (for example, black) Some have been done. When the former dedicated form is used, the character entry frame automatically disappears when the form image is input, and only the entered characters are read, so that the processing at the time of character recognition is simplified. On the other hand, when the latter dedicated form is used, since the character entry frame remains, it is necessary to detect and delete the remaining character entry frame at the time of character recognition, which complicates the processing at the time of character recognition. Become
[0003]
In a form reader using a special form in which the character entry frame is printed in a non-dropout color, the position information of each ruled line of the character entry frame printed on the dedicated form is acquired in advance, and the acquired position information of the ruled line is obtained. Is generally detected based on the input form image. As an example of such a form reading device, there is a character recognition device described in, for example, JP-A-2000-132636.
[0004]
FIG. 14 is a block diagram showing a schematic configuration of the character recognition device described in the above publication. A
[0005]
The
[0006]
The character frame
[0007]
The
[0008]
Hereinafter, the character recognition operation of the
[0009]
When the set form is optically read by the
[0010]
First, an area for detecting a character frame is determined from the form image data stored in the image
[0011]
Next, the portion where the black pixels in the determined frame detection region are connected is contour-traced to indicate the frame region direction code (indicating in which direction the black pixel connection portion is oriented on the XY coordinates. Specifically, eight directions are indicated by numerals), and the extracted frame area direction code is stored in the direction
[0012]
Finally, the inside of the character frame is determined from the character frame corner position candidate data stored in the frame corner
[0013]
After the character frame
[0014]
In addition to the above, Japanese Patent Application Laid-Open No. 2001-147988 discloses a character recognition device capable of preventing erroneous character recognition when a character overlaps a ruled line or a frame line. In this character recognition device, a ruled line is removed from a read image of a document, and a character image is cut out one character at a time. With respect to the cut out character image, contact information with the ruled line is obtained and character recognition is performed. Then, based on the obtained contact information and the recognition result, a corrected image group obtained by correcting the cut-out character image so as to approximate a shape predicted from pre-registered predicted shape information is obtained. A recognition candidate image is selected from the group of corrected images, and whether or not to output a recognition character corresponding to the selected recognition candidate image is evaluated. With this configuration, the recognition rate is improved when an image reader reads a form or the like on which ruled lines or frame lines are printed in one-color non-dropout color printing.
[0015]
[Problems to be solved by the invention]
In recent years, digitization of character information entered in not only the above-mentioned dedicated form but also a generally used form not intended for reading by OCR (hereinafter, referred to as a general form) has been desired. It is rare. Since the required printing accuracy of this ruled line is lower than that of the special form, the position of the printed ruled line is shifted due to the difference of rods, etc., and the printed ruled line itself is blurred or crushed. Is often blurred. Therefore, when such a general form is read by a conventional form reader that detects a ruled line from an input form image based on the position information of the ruled line acquired in advance, the following problem occurs.
[0016]
(Issue 1)
If the ruled line to be detected is blurred, ruled line detection is not performed correctly, and as a result, a problem arises in that the character reading position cannot be correctly detected. In particular, since the printing accuracy of the ruled line is low in the general form, a deviation occurs between the position of the ruled line to be detected and the position information of the ruled line acquired in advance, and it is very difficult to accurately detect the ruled line. It is.
[0017]
(Issue 2)
In a ruled line frame in which one character frame is divided by a dividing line (ruled line), the dividing line is often a short line segment, and a pattern (histogram) in which black pixels in the ruled line frame are projected on the X axis and the Y axis. In the case where the written characters are detected by using ()), if the partition lines themselves are blurred, the written characters and the partition lines cannot be accurately distinguished, and erroneous detection of ruled lines occurs. FIG. 15 shows an example of a histogram of a character entered in a ruled line frame in which a part of a partition line is blurred. In this example, the characters "1", "1", and "2" are sequentially entered from the left in a ruled line frame separated by two partition lines. The two partition lines constituting the central frame are partially blurred, so that the projected pattern on the x-axis in the central frame portion is a black pixel between the partition line portion and the character “1”. The integrated value is close. In this case, the character "1" may be erroneously detected as a ruled line. In particular, in the general business form, such a erroneous detection is likely to occur because a deviation occurs between the position of the ruled line to be detected and the position information of the ruled line acquired in advance as described above.
[0018]
In the technique disclosed in Japanese Patent Application Laid-Open No. 2000-132636, if the ruled line to be detected is blurred, the position of the ruled line cannot be accurately determined, and thus the same problem as the above-described
[0019]
In the technique described in Japanese Patent Application Laid-Open No. 2001-147988, a character written in a ruled line frame is correctly corrected by correcting a cut-out character image so as to approach a shape predicted from pre-registered predicted shape information. It can be detected, but this is only when a dedicated form is used, and when using a general form with low printing accuracy of the ruled line, the position of the ruled line to be detected is Since the deviation from the acquired ruled line position information increases, the position of the ruled line frame and the position of the character entry cannot be correctly detected. Further, if the ruled line to be detected is blurred, the position of the ruled line cannot be determined accurately. Therefore, the one described in Japanese Patent Application Laid-Open No. 2001-147988 has the same problem as the
[0020]
SUMMARY OF THE INVENTION An object of the present invention is to solve the above-described problems and to accurately detect even a ruled line of a form having a low printing system, which is partially blurred due to blurring or crushing. It is to provide a method and a program.
[0021]
[Means for Solving the Problems]
In order to achieve the above object, a form reading apparatus of the present invention includes image input means for capturing a digital image of a form on which a ruled line composed of a plurality of line segments is printed,
First storage means in which predetermined ruled line information regarding the ruled line and constraint conditions indicating a specific relationship between the plurality of line segments are stored in advance;
Ruled line detection means for detecting the ruled lines from digital images captured by the image input means under predetermined detection conditions based on predetermined ruled line information stored in the first storage means;
Second storage means for storing a ruled line detection result detected by the ruled line detection means;
By comparing the ruled line detection result stored in the second storage unit with predetermined ruled line information and constraint conditions stored in the first storage unit, erroneously detected line segments and undetected line segments are compared. It is checked whether or not there is a ruled line. If there is an erroneously detected ruled line, the erroneously detected ruled line is deleted from the ruled line detection result. And a rule matching means for re-detecting the undetected rule under a different detection condition.
[0022]
A form reading method according to the present invention includes a first step of capturing a digital image of a form on which a ruled line composed of a plurality of line segments is printed;
A second step of storing predetermined ruled line information relating to the ruled line and a constraint condition indicating a specific relationship between the plurality of line segments in a first storage unit in advance;
A third step of detecting the ruled lines from the digital image captured in the first step under predetermined detection conditions based on the predetermined ruled line information stored in the first storage unit;
A fourth step of storing the ruled line detection result detected in the third step in a second storage unit;
By comparing the ruled line detection result stored in the second storage unit with predetermined ruled line information and constraint conditions stored in the first storage unit, erroneously detected line segments and undetected line segments are compared. A fifth step for determining whether there is
When there is a ruled line that is erroneously detected in the fifth step, a sixth step of deleting the erroneously detected ruled line from the ruled line detection result;
In a case where there is an undetected ruled line in the fifth step, a seventh step of re-detecting the undetected ruled line under a detection condition different from the predetermined detection condition is included.
[0023]
The program according to the present invention includes a first process for capturing a digital image of a form on which a ruled line composed of a plurality of line segments is printed,
A second process in which predetermined ruled line information relating to the ruled line and a constraint condition indicating a specific relationship between the plurality of line segments are stored in a first storage unit in advance;
A third process of detecting the ruled line from the digital image captured in the first process under a predetermined detection condition based on the predetermined ruled line information stored in the first storage unit;
A fourth process of storing a ruled line detection result detected in the third process in a second storage unit;
By comparing the ruled line detection result stored in the second storage unit with predetermined ruled line information and constraint conditions stored in the first storage unit, erroneously detected line segments and undetected line segments are compared. A fifth process for checking whether or not there is
When there is a ruled line that is erroneously detected in the fifth process, a sixth process of deleting the erroneously detected ruled line from the ruled line detection result;
In a case where there is an undetected ruled line in the fifth process, the computer is configured to execute a seventh process of re-detecting the undetected ruled line under a detection condition different from the predetermined detection condition. I do.
[0024]
In the present invention as described above, by comparing a ruled line detection result detected from a digital image with ruled line information and constraint conditions stored in advance, it is possible to determine whether there are erroneously detected ruled lines and undetected ruled lines. Is determined. The constraint condition is a ruled line layout constraint condition referred to in the embodiment described later, for example, the length of the line segments arranged in parallel is equal, the interval of a plurality of line segments arranged in parallel is equal, This is a condition that four line segments forming the character entry frame form a rectangular shape that does not contact other line segments. By performing matching using this constraint condition in addition to matching with ruled line information, it is possible to accurately detect ruled lines (line segments) partially blurred or crushed, which could not be detected conventionally. .
[0025]
Specifically, for example, in the example shown in FIG. 15, conventionally, when the character “1” is erroneously detected as a line segment, six line segments are detected from the projection pattern on the x-axis. On the other hand, in the present invention, as a specific relationship, for example, a constraint condition of four parallel line segments at equal intervals at predetermined intervals is set. On the basis of the constraint condition, an erroneously detected line segment (corresponding to the character "1") is extracted from the six detected line segments and deleted from the ruled line detection result. Further, when only three line segments are detected from the projection pattern on the x-axis, that is, when one line segment has not been detected, it is determined by comparing with the above constraint condition that the line segment has not been detected. The detected line segment is extracted, and the extracted undetected line segment is re-detected. Since the re-detection is repeatedly performed with the detection conditions changed, an undetected line segment is always detected.
[0026]
BEST MODE FOR CARRYING OUT THE INVENTION
Next, an embodiment of the present invention will be described with reference to the drawings.
[0027]
FIG. 1 is a block diagram showing a schematic configuration of a form reading apparatus according to one embodiment of the present invention. This form reader is intended for reading not only a dedicated form but also a general form. The form is composed of a form
[0028]
The form
[0029]
The
[0030]
The
[0031]
The ruled
[0032]
The
[0033]
Next, the operation of the form reader of the present embodiment will be specifically described. FIG. 2 is a flowchart for explaining the overall character recognition operation of the form reader shown in FIG. The operation will be described below with reference to FIGS.
[0034]
When a form to be read is set at a predetermined site, a two-dimensional digital image of the paper of the set form is input via the
[0035]
Next, the ruled
[0036]
Next, the ruled
[0037]
After the correction of the ruled line detection result is completed and all the ruled lines are correctly detected, the
[0038]
Next, each component of the form reader of the present embodiment will be described in detail.
[0039]
The ruled line
[0040]
Form A shown in FIG. 3 is obtained by printing a first ruled line frame composed of line segments (1) to (10) and a second ruled line frame composed of line segments (12) to (21). . The ruled line
[0041]
[Attribute code indicating form of connection point]
・ The upper left corner of the table frame: 01
・ Top right corner of the table frame: 02
・ The lower left corner of the table frame: 03
・ The lower right corner of the table frame: 04
・ Cross intersection: 05
・ T-junction: 06
・ Upside down T-shaped intersection: 07
・ T-shaped intersection at 90 ° to the left: 08
・ Turn right 90 ° intersection: 09
The ruled line layout constraint conditions held in the ruled line layout constraint
[0042]
Condition 1: Line segments are parallel.
[0043]
Condition 2: the lengths of the line segments are equal.
[0044]
Condition 3: The intervals of the line segments are equal.
[0045]
Condition 4: The four line segments form a rectangular shape that does not contact other line segments.
These ruled line layout constraint conditions are merely examples, and other conditions such as the form and number of connection points can be added as necessary.
[0046]
In the ruled line layout constraint
[0047]
In the character reading
[0048]
The ruled
[0049]
First, when the gradation of the digital image stored in the
[0050]
The ruled line labeling processing in step S403 described above is specifically performed as follows.
[0051]
FIG. 8 shows a procedure of the ruled line labeling process. First, the binarized digital image is raster-scanned to search for black pixels (steps S501 and S502). If a black pixel is detected, the raster scanning is temporarily stopped (step S503), and the linear search area is rotated around the detected black pixel at a fixed angle within a range of, for example, 0 ° to 180 °. , The number B of black pixels included in the search area at each rotation angle is counted, and the ratio T [T = 100 × B ÷ S] of the black pixel area (black pixels) to the area S (number of pixels) of the search area. ] (Step S504).
[0052]
FIG. 9 schematically shows a linear search area. As shown in FIG. 9, if the linear search area is rotated by a fixed angle unit around the black pixel of interest, the ratio T of the black pixel area (black pixels) increases in the ruled portion. . Although depending on the size of the search area, usually, if the value of the ratio T is 70% or more, the possibility of a ruled line is very high. In this example, the angle increment is 45 °.
[0053]
When the ratio T of the black pixel area (black pixels) is obtained for all the rotation angles in step S504, the ratio of the black pixel area (black pixels) is then determined for the rotation angle search area where the number of black pixels is the largest. It is checked whether T has exceeded a threshold value Tth (for example, 70%) (step S505). When the ratio T exceeds the threshold value Tth, a ruled line label indicating a ruled line is given to all the black pixels included in the search area, and a direction code indicating the angle of the search area is assigned. It is provided (step S506). FIG. 10 shows an example of the direction code. In the example shown in FIG. 10, four directions divided by a predetermined angle (45 degrees) are represented by direction codes having numerical values of 0 to 3. Each direction corresponds to the rotation angle of the linear search area shown in FIG.
[0054]
After adding the ruled line label and the direction code in the above step S506, the raster scanning is restarted (step S507), and the processes in steps S502 to S506 described above are repeated. Also, if the ratio T is equal to or smaller than the threshold value Tth in step S505, the process similarly proceeds to step S507 to restart raster scanning and repeat the above-described processing in steps S502 to S506.
[0055]
By the above processing, ruled line labeling is performed for each pixel of the digital image, and the result is stored in the ruled line detection
[0056]
The line segment detection processing in step S404 described above is specifically performed as follows.
[0057]
FIG. 12 shows one procedure of the line segment detection processing. In this line segment detection processing, a ruled line is detected for each line segment in the digital image to which the ruled line label is added after the ruled line labeling processing shown in FIG. For detecting a line segment, a line segment detection flag (bit b1) and a line segment detection completion flag (bit b2) in the format shown in FIG. 11 are used. It is assumed that these two flags are initialized to the value “0” at the start of the line segment.
[0058]
First, a raster scan is performed (step S511), and a pixel with a ruled line label with a line segment detection completion flag value of 0 is searched (step S512). If a pixel having a line segment detection completion flag value of 0 is detected, raster scanning is temporarily stopped (step S513). Then, a
[0059]
Condition B1: The value of the line segment detection flag is 0
Condition B2: The value of the line segment detection flag of one of the eight neighboring pixels is 1
Condition B3: the direction code matches the direction code C0 of the starting point
Specifically, the processing in steps S514 to S516 includes a subprocess including the following
[0060]
Substep 1:
A search for black pixels is performed within the range of the urban area distance d ≦ 1, and the
[0061]
Substep 2:
Among the pixels having a line segment detection flag value of 1, a pixel located in the direction indicated by the direction code (here, C0) of the starting point and having the largest Euclidean distance from the starting point is regarded as an end point of the line segment, and its coordinate value is determined as a ruled line. It is stored in the detection
[0062]
Sub-step 3:
The front side of the image data is raster-scanned to detect black pixels having a line segment detection flag value of 1, and for the detected black pixel, the line segment detection flag value is cleared to zero and the line segment detection completion flag is set to a value.
[0063]
When the coordinate values of both ends of the line segment are stored in the ruled line detection
[0064]
The outline of the ruled line detection operation in the form reading apparatus of the present embodiment has been described above. The feature of the form reading apparatus of the present embodiment lies in the collation and correction of the ruled line information in step S3 shown in FIG. Hereinafter, the correction of the ruled line information will be specifically described.
[0065]
First, the matching performed by the ruled
[0066]
Referring to FIG. 13, first, from the k-th data group registered in the ruled-line layout constraint
[0067]
Next, by referring to the ruled line
[0068]
When a matching line segment is found in the ruled line detection
[0069]
After all the ruled lines registered in the k-th data group are detected, the average of the coordinate value of the line segment on the ruled line
[0070]
The processing of steps S601 to S604 is executed for (k_max) data groups registered in the ruled line layout constraint
[0071]
Next, with respect to the other line segments registered in the ruled line
[0072]
If there is a line segment for which collation has failed after all collation is completed, re-detection of the line segment is instructed to the ruled line detection unit 4 (step S606). If a line segment not associated with the line segment registered in the ruled line
[0073]
Next, re-detection of a line segment by the ruled
[0074]
When the constraint condition on the ruled line layout regarding the line segment to be re-detected is registered in the ruled line layout constraint
[0075]
When the constraint condition on the ruled line layout regarding the line segment to be re-detected is not registered in the ruled line layout constraint
[0076]
Next, a description will be given of a character reading position identification and character recognition process based on a ruled line detection result subjected to the above-described ruled line collation and correction processing.
[0077]
The
[0078]
The
[0079]
As described above, even if the printed ruled line is blurred or crushed, the ruled line can be accurately detected and the accurate character entry position can be obtained by the process of collating and correcting the ruled line described above. This ruled line detection is effective not only in a dedicated form but also in a general form.
[0080]
A series of processes related to ruled line detection in the form reader according to the present embodiment described above can be basically realized by a program. This program may be installed in advance in a hard disk of a computer constituting the form reader, or may be provided by a recording medium such as a CD-ROM. Further, this program may be provided (downloaded) via the Internet.
[0081]
【The invention's effect】
As described above, according to the present invention, a ruled line (line segment) or a partition line of a ruled line frame (character frame), which is partially unclear, can be accurately detected. In addition, there is an effect that a general form with low printing accuracy of ruled lines can be OCR-read with high accuracy.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a schematic configuration of a form reading apparatus according to an embodiment of the present invention.
FIG. 2 is a flowchart for explaining the overall character recognition operation of the form reader shown in FIG. 1;
FIG. 3 is a schematic diagram illustrating an example of a form.
FIG. 4 is a diagram showing a part of ruled line information on the form shown in FIG. 3;
FIG. 5 is a diagram showing an example of ruled line layout constraint conditions for the form shown in FIG. 3;
6 is a diagram showing an example of a character reading position corresponding to the form shown in FIG.
FIG. 7 is a flowchart illustrating a procedure of a ruled line detection process performed by a ruled line detection unit of the form reading apparatus illustrated in FIG. 1;
FIG. 8 is a flowchart illustrating a procedure of a ruled line labeling process performed by a ruled line detection unit of the form reading apparatus illustrated in FIG. 1;
FIG. 9 is a schematic diagram illustrating an example of a linear search area.
FIG. 10 is a schematic diagram showing an example of a direction code.
11 is a diagram illustrating an example of a format of a ruled line label and a rotation angle used in the ruled line labeling process illustrated in FIG. 8;
12 is a flowchart illustrating a procedure of a line segment detection process performed by a ruled line detection unit of the form reading apparatus illustrated in FIG.
FIG. 13 is a flowchart illustrating a procedure of collation performed by a ruled line collation unit of the form reading apparatus illustrated in FIG. 1;
FIG. 14 is a block diagram showing a schematic configuration of a character recognition device described in JP-A-2000-132636.
FIG. 15 is a schematic diagram showing an example of a histogram of a character entered in a ruled line frame in which a part of a partition line is blurred in a conventional form reader.
[Explanation of symbols]
1 Form information storage
2 Image input unit
3 Image memory
4 Ruled line detector
5 Ruled line detection result storage
6 Ruled line collation section
7 Character detector
8 Character recognition unit
9 Character recognition dictionary
101 Ruled line information storage unit
102 Ruled line layout constraint condition storage unit
103 Character reading position storage
110 character recognition device
111 Image Scanner
112 Image data storage
113 Character frame registration data storage unit
114 character frame position detector
115 Character Recognition Unit
116 Direction code storage
117 Frame line candidate storage unit
118 Frame corner candidate coordinate storage unit
Claims (18)
前記罫線に関する所定の罫線情報および前記複数の線分間の特定の関係を示す拘束条件が予め格納された第1の記憶手段と、
前記第1の記憶手段に格納された所定の罫線情報に基づいて、前記画像入力手段により取り込まれたディジタル画像から所定の検出条件で前記罫線を検出する罫線検出手段と、
前記罫線検出手段によって検出された罫線検出結果を格納する第2の記憶手段と、
前記第2の記憶手段に格納された罫線検出結果と前記第1の記憶手段に格納された所定の罫線情報および拘束条件との照合を行うことで、誤検出した線分および未検出の線分があるか否かを調べ、誤検出した罫線がある場合は、該誤検出した罫線を前記罫線検出結果から削除し、未検出の罫線がある場合は、前記罫線検出手段に前記所定の検出条件とは異なる検出条件で該未検出の罫線の再検出を行わせる罫線照合手段とを有することを特徴とする帳票読取り装置。Image input means for capturing a digital image of a form on which a ruled line composed of a plurality of line segments is printed,
First storage means in which predetermined ruled line information regarding the ruled line and constraint conditions indicating a specific relationship between the plurality of line segments are stored in advance;
Ruled line detection means for detecting the ruled lines from digital images captured by the image input means under predetermined detection conditions based on predetermined ruled line information stored in the first storage means;
Second storage means for storing a ruled line detection result detected by the ruled line detection means;
By comparing the ruled line detection result stored in the second storage unit with predetermined ruled line information and constraint conditions stored in the first storage unit, erroneously detected line segments and undetected line segments are compared. It is checked whether or not there is a ruled line. If there is an erroneously detected ruled line, the erroneously detected ruled line is deleted from the ruled line detection result. And a rule matching means for re-detecting the undetected rule under a different detection condition.
前記文字検出手段で抽出された文字パターンに基づいて文字を認識する文字認識手段とをさらに有することを特徴とする請求項5に記載の帳票読取り装置。The ruled line matching unit deletes the erroneously detected ruled line and re-detects the undetected ruled line, and stores the ruled line detection result stored in the second storage unit and the position information stored in the first storage unit. A character detecting means for specifying a character reading position on the digital image and extracting a character pattern in the specified area;
6. The form reading apparatus according to claim 5, further comprising a character recognizing unit that recognizes a character based on the character pattern extracted by the character detecting unit.
前記罫線に関する所定の罫線情報および前記複数の線分間の特定の関係を示す拘束条件を第1の記憶部に予め格納しておく第2のステップと、
前記第1の記憶部に格納された所定の罫線情報に基づいて、前記第1のステップで取り込まれたディジタル画像から所定の検出条件で前記罫線を検出する第3のステップと、
前記第3のステップで検出された罫線検出結果を第2の記憶部に格納する第4のステップと、
前記第2の記憶部に格納された罫線検出結果と前記第1の記憶部に格納された所定の罫線情報および拘束条件との照合を行うことで、誤検出した線分および未検出の線分があるか否かを調べる第5のステップと、
前記第5のステップで誤検出した罫線がある場合は、該誤検出した罫線を前記罫線検出結果から削除する第6のステップと、
前記第5のステップで未検出の罫線がある場合は、前記所定の検出条件とは異なる検出条件で該未検出の罫線の再検出を行う第7のステップとを含むことを特徴とする帳票読取り方法。A first step of capturing a digital image of a form on which a ruled line composed of a plurality of line segments is printed;
A second step of storing predetermined ruled line information relating to the ruled line and a constraint condition indicating a specific relationship between the plurality of line segments in a first storage unit in advance;
A third step of detecting the ruled lines from the digital image captured in the first step under predetermined detection conditions based on the predetermined ruled line information stored in the first storage unit;
A fourth step of storing the ruled line detection result detected in the third step in a second storage unit;
By comparing the ruled line detection result stored in the second storage unit with predetermined ruled line information and constraint conditions stored in the first storage unit, erroneously detected line segments and undetected line segments are compared. A fifth step for determining whether there is
When there is a ruled line that is erroneously detected in the fifth step, a sixth step of deleting the erroneously detected ruled line from the ruled line detection result;
A step of re-detecting the undetected rule line under a detection condition different from the predetermined detection condition when there is an undetected rule line in the fifth step. Method.
前記特定された文字読取り位置の領域内の文字パターンを抽出するステップと、
前記抽出した文字パターンに基づいて文字を認識するステップとをさらに含むことを特徴とする請求項11に記載の帳票読取り方法。The erroneously detected ruled line is deleted and the undetected ruled line is re-detected, and the ruled line detection result stored in the second storage unit and the position information stored in the first storage unit are referred to. Identifying a character reading position on the digital image;
Extracting a character pattern in the area of the specified character reading position;
The method according to claim 11, further comprising the step of recognizing a character based on the extracted character pattern.
前記罫線に関する所定の罫線情報および前記複数の線分間の特定の関係を示す拘束条件を第1の記憶部に予め格納しておく第2の処理と、
前記第1の記憶部に格納された所定の罫線情報に基づいて、前記第1の処理で取り込まれたディジタル画像から所定の検出条件で前記罫線を検出する第3の処理と、
前記第3の処理で検出された罫線検出結果を第2の記憶部に格納する第4の処理と、
前記第2の記憶部に格納された罫線検出結果と前記第1の記憶部に格納された所定の罫線情報および拘束条件との照合を行うことで、誤検出した線分および未検出の線分があるか否かを調べる第5の処理と、
前記第5の処理で誤検出した罫線がある場合は、該誤検出した罫線を前記罫線検出結果から削除する第6の処理と、
前記第5の処理で未検出の罫線がある場合は、前記所定の検出条件とは異なる検出条件で該未検出の罫線の再検出を行う第7の処理とをコンピュータに実行させるためのプログラム。First processing for capturing a digital image of a form on which ruled lines composed of a plurality of line segments are printed;
A second process in which predetermined ruled line information relating to the ruled line and a constraint condition indicating a specific relationship between the plurality of line segments are stored in a first storage unit in advance;
A third process of detecting the ruled line from the digital image captured in the first process under a predetermined detection condition based on the predetermined ruled line information stored in the first storage unit;
A fourth process of storing a ruled line detection result detected in the third process in a second storage unit;
By comparing the ruled line detection result stored in the second storage unit with predetermined ruled line information and constraint conditions stored in the first storage unit, erroneously detected line segments and undetected line segments are compared. A fifth process for checking whether or not there is
When there is a ruled line that is erroneously detected in the fifth process, a sixth process of deleting the erroneously detected ruled line from the ruled line detection result;
A program for causing a computer to execute, when there is an undetected ruled line in the fifth process, a seventh process of redetecting the undetected ruled line under a detection condition different from the predetermined detection condition.
前記特定された文字読取り位置の領域内の文字パターンを抽出する処理と、
前記抽出した文字パターンに基づいて文字を認識する処理とをさらにコンピュータに実行させることを特徴とする請求項17に記載のプログラム。The erroneously detected ruled line is deleted and the undetected ruled line is re-detected, and the ruled line detection result stored in the second storage unit and the position information stored in the first storage unit are referred to. Processing for specifying a character reading position on the digital image;
A process of extracting a character pattern in the area of the specified character reading position;
18. The program according to claim 17, further causing a computer to execute a process of recognizing a character based on the extracted character pattern.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2002161429A JP2004013188A (en) | 2002-06-03 | 2002-06-03 | Business form reading device, business form reading method and program therefor |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2002161429A JP2004013188A (en) | 2002-06-03 | 2002-06-03 | Business form reading device, business form reading method and program therefor |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JP2004013188A true JP2004013188A (en) | 2004-01-15 |
Family
ID=30430499
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2002161429A Pending JP2004013188A (en) | 2002-06-03 | 2002-06-03 | Business form reading device, business form reading method and program therefor |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2004013188A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2008059298A (en) * | 2006-08-31 | 2008-03-13 | Fujitsu Ltd | Ruled line extraction program, ruled line extraction device, ruled line extraction method |
| CN113379713A (en) * | 2021-06-23 | 2021-09-10 | 京东数科海益信息科技有限公司 | Certificate image detection method and device |
-
2002
- 2002-06-03 JP JP2002161429A patent/JP2004013188A/en active Pending
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2008059298A (en) * | 2006-08-31 | 2008-03-13 | Fujitsu Ltd | Ruled line extraction program, ruled line extraction device, ruled line extraction method |
| CN113379713A (en) * | 2021-06-23 | 2021-09-10 | 京东数科海益信息科技有限公司 | Certificate image detection method and device |
| CN113379713B (en) * | 2021-06-23 | 2024-02-09 | 京东科技信息技术有限公司 | Certificate image detection method and device |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US5410611A (en) | Method for identifying word bounding boxes in text | |
| US5539841A (en) | Method for comparing image sections to determine similarity therebetween | |
| JP3308032B2 (en) | Skew correction method, skew angle detection method, skew correction device, and skew angle detection device | |
| US5335290A (en) | Segmentation of text, picture and lines of a document image | |
| EP0764308B1 (en) | System and method for automatic page registration and automatic zone detection during forms processing | |
| EP0738987B1 (en) | Processing machine readable forms | |
| JP3345224B2 (en) | Pattern extraction device, pattern re-recognition table creation device, and pattern recognition device | |
| US20130194448A1 (en) | Rules for merging blocks of connected components in natural images | |
| US20140219561A1 (en) | Character segmentation device and character segmentation method | |
| JPH07234915A (en) | Image recognizing device | |
| CN1383094A (en) | Bill discriminating method | |
| US20020051574A1 (en) | Character recognition method, program and recording medium | |
| JPH02306386A (en) | character recognition device | |
| EP0651337A1 (en) | Object recognizing method, its apparatus, and image processing method and its apparatus | |
| JP2008028716A (en) | Image processing method and apparatus | |
| JP3268552B2 (en) | Area extraction method, destination area extraction method, destination area extraction apparatus, and image processing apparatus | |
| JP2008084105A (en) | Character cutout method and character recognition device | |
| JP2004013188A (en) | Business form reading device, business form reading method and program therefor | |
| JP2000322514A (en) | Pattern extraction device and character segmentation device | |
| JP3090070B2 (en) | Form identification method and device | |
| US7103220B2 (en) | Image processing apparatus, method and program, and storage medium | |
| JPH0728935A (en) | Document image processor | |
| JP4221960B2 (en) | Form identification device and identification method thereof | |
| JP7599640B2 (en) | Method and device for recognizing specific fields on forms | |
| JP2004280530A (en) | System and method for processing form |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| RD03 | Notification of appointment of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7423 Effective date: 20041215 |
|
| RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20041215 |
|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20050517 |
|
| RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20060126 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20080417 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20080423 |
|
| A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20090826 |