[go: up one dir, main page]

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 PDF

Info

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
Application number
JP2002161429A
Other languages
Japanese (ja)
Inventor
Naoya Tanaka
田中 直哉
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.)
NEC Corp
Original Assignee
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP2002161429A priority Critical patent/JP2004013188A/en
Publication of JP2004013188A publication Critical patent/JP2004013188A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Character Input (AREA)
  • Image Analysis (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a business form reading device which exactly detects a ruled line, a part of which is faint and patchy. <P>SOLUTION: The business form reading device is provided with an image input part 2 which takes in the digital image of a business form on which the ruled line comprising a plurality of segment lines is printed; a business form format information storage part 1 which preliminarily stores prescribed ruled line information on the ruled line and restraining conditions showing specific relations among a plurality of the segment lines; a ruled line detecting part 4 which detects the ruled line from the digital image with a prescribed retrieval condition, based on the prescribed ruled line information; a ruled line detection result storage part 5 which stores the result of the detection of the ruled line; and a ruled line collating part 6 which checks whether a segment line which is wrongly detected or not exists by collating the result of the detection of the ruled line with the prescribed ruled line information and the restraining conditions, deletes the wrongly detected ruled line from the result of the detection of the ruled lines when the wrongly detected ruled line exists, and lets the ruled line detecting part 4 detect again the non-detected ruled line with retrieval conditons different from the prescribed retrieval conditions, when the non-detectd ruled line exists. <P>COPYRIGHT: (C)2004,JPO

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 character recognition device 110 shown in FIG. 14 includes an image scanner unit 111, an image data storage unit 112, a character frame registration data storage unit 113, a character frame position detection unit 114, a character recognition unit 115, a direction code storage unit 116, and frame candidate storage. A unit 117 and a frame corner candidate coordinate storage unit 118 are provided.
[0005]
The image scanner unit 111 optically reads a form in which characters are entered in a character frame printed in a non-dropout color, and acquires form image data including binary data. The acquired form image data is stored in the image data storage unit 112 as a two-dimensional image. The character frame registration data storage unit 113 stores character frame registration data including frame coordinate values registered in advance, and stores, for example, a reference position and size of each character frame.
[0006]
The character frame position detecting unit 114 determines the position of the character frame by comparing the form image data stored in the image data storage unit 112 with the character frame registration data stored in the character frame registration data storage unit 113 in advance. The image of the position of the determined character frame is supplied to the character recognition unit 115.
[0007]
The character recognition unit 115 performs character recognition based on the form image data in the character frame from the image of the position of the character frame input from the character frame position detection unit 114. The direction code storage unit 116, the frame candidate storage unit 117, and the frame corner candidate coordinate storage unit 118 store the frame area direction code, the frame line candidate, and the frame corner candidate obtained when the character frame position detection unit 114 determines the character frame position. Are respectively stored.
[0008]
Hereinafter, the character recognition operation of the character recognition device 110 will be described.
[0009]
When the set form is optically read by the image scanner unit 111, the form image data acquired by the image scanner unit 111 is stored in the storage unit 112. Then, the character frame position detection unit 114 compares the form image data stored in the image data storage unit 112 with the character frame registration data stored in advance in the character frame registration data storage unit 113, and performs a character Determine the position of the frame.
[0010]
First, an area for detecting a character frame is determined from the form image data stored in the image data storage unit 112 and the character frame registration data including the frame coordinate values stored in the character frame registration data storage unit 113 in advance. I do.
[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 code storage unit 116 in association with the outline coordinates. Further, a candidate for the inside position of the character frame is obtained from the frame area direction code stored in the direction code storage unit 116 and stored in the frame line candidate storage unit 117. Then, after labeling the image in which the candidate frame created based on the frame candidate position stored in the frame candidate storage unit 117 is written, the corner position candidate coordinates of the character frame are detected, and are detected. It is stored in the frame corner candidate storage unit 118.
[0012]
Finally, the inside of the character frame is determined from the character frame corner position candidate data stored in the frame corner candidate storage unit 118 and the character frame registration data including the frame coordinate values stored in the character frame registration data storage unit 113. Determine the position.
[0013]
After the character frame position detection unit 114 determines the position inside the character frame as described above, the character recognition unit 115 performs character recognition on the image at the position inside 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 problem 1 occurs. In addition, when recognizing a character written in a ruled line frame, a partition line (ruled line) may be erroneously detected, and the same problem as the problem 2 described above occurs.
[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 problems 1 and 2 described above.
[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 information storage unit 1, an image input unit 2, an image memory 3, a ruled line detecting unit 4, a ruled line detecting unit. It comprises a result storage unit 5, a ruled line collation unit 6, a character detection unit 7, a character recognition unit 8, and a character recognition dictionary 9.
[0028]
The form information storage unit 1 stores ruled line positions, ruled line layout constraint conditions, and character reading positions for a form to be read in which ruled lines are printed in a non-dropout color. A storage unit 101, a ruled line layout constraint condition storage unit 102, and a character reading position storage unit 103. Here, the ruled line position is the coordinates (start point / end point coordinates) and length of both ends of each line of the ruled line in the XY coordinate system based on a predetermined position of the character entry surface (paper surface) of the form. The character reading position is the coordinates of the character frame in the same XY coordinate system. The ruled line layout constraint condition is a condition indicating a specific relationship between the lines constituting the ruled line, for example, a condition that the lengths of the lines arranged in parallel are equal.
[0029]
The image input unit 2 performs two-dimensional sampling on the form paper by, for example, scanning with a CCD line sensor or input using a CCD area sensor, and quantizes the shading of the obtained image to convert a digital image having a grid-like two-dimensional array. Generate. The quantization may be performed in binary, 16 or 256 values. However, in the binary image, the pixel value of a character and a ruled line is set to 1 and the pixel value of a background portion is set to 0. In the following description, a pixel having a value of 1 in a binary image is called a black pixel, and a pixel having a value of 0 is called a white pixel.
[0030]
The image memory 3 is a memory for storing a digital image generated by the image input unit 2. This memory can be read / written in pixel units by the ruled line detection unit 4 and can be read in pixel units by the character detection unit 7.
[0031]
The ruled line detection unit 4 detects ruled lines on a form from a digital image stored in the image memory 3 in units of line segments. The ruled line detection result storage unit 5 stores the ruled lines detected by the ruled line detection unit 4 in units of line segments. The ruled line matching unit 6 applies ruled line positions and ruled line layout constraint conditions stored in the form storage unit 1 to ruled lines stored in the ruled line detection result storage unit 5 and stores ruled lines that are not detected or erroneously detected. The presence / absence of the ruled line is verified to discard the erroneously detected ruled line, or instruct the ruled line detection unit 4 to re-detect an undetected ruled line.
[0032]
The character detection unit 7 refers to the character reading position stored in the form storage unit 1 and the ruled line information stored in the ruled line detection result storage unit 5 to determine the character reading position from the digital image stored in the image memory 3. Identify. The character recognition unit 8 extracts a character pattern in the area specified by the character detection unit 7 and performs character recognition with reference to the character recognition dictionary 9. The character recognition dictionary 9 stores predetermined character features for each category.
[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 image input unit 2 and the input two-dimensional digital image is stored in an image memory 3. (Step S1).
[0035]
Next, the ruled line detection unit 4 reads the two-dimensional digital image (form image) stored in the image memory 3, binarizes the read two-dimensional digital image (form image), and converts the read two-dimensional digital image (form image) from the binarized image. A ruled line is detected (step S2). The ruled line detection result by the ruled line detection unit 4 is stored in the ruled line detection result storage unit 5.
[0036]
Next, the ruled line matching unit 6 compares the ruled line detection result stored in the ruled line detection result storage unit 5 with ruled line information registered in the form information storage unit 1 in advance. In this comparison, it is determined whether or not the ruled line detection result is correct by using the positions of the line segments (ruled line positions) constituting the ruled lines and the connection state of the line segments stored in the ruled line information storage unit 101 (step # 1). 1), and whether or not the ruled line detection result is correct is determined based on the ruled line constraint condition stored in the ruled line layout constraint condition storage unit 102 (second decision). As a result of this collation, a line segment that has been erroneously detected and a line segment that has not been detected (a line segment that has been detected in spite of being registered in the ruled line information storage unit 101) are extracted. The ruled line collating unit 6 deletes the line segment detected erroneously from the ruled line detection result stored in the ruled line detection result storage unit 5 and transmits a ruled line redetection instruction to the ruled line detecting unit 4 for the undetected line segment. To make the ruled line re-detected. Upon receiving the ruled line re-detection instruction, the ruled line detection unit 4 re-detects the ruled line after, for example, changing the binarization threshold or narrowing down the detection range using the coordinate information of the ruled line information storage unit 101. . Until all ruled lines are correctly detected, the above-described first and second determinations, the process of deleting erroneously detected ruled lines, and the process of re-detecting ruled lines are repeated, and the ruled line detection result is corrected (step S3).
[0037]
After the correction of the ruled line detection result is completed and all the ruled lines are correctly detected, the character detection unit 7 stores the character reading position stored in the character reading position storage unit 103 in advance and the ruled line detection result storage unit 5 A position (character reading position) at which character recognition is to be performed is specified from the corrected ruled line detection result (step S4), and a character pattern in units of one character is determined from the image at the specified character reading position. cut. Then, the character recognizing unit 8 extracts the features of the character pattern cut out by the character detecting unit 7, and checks the pattern matching between the extracted features and the character features stored in the character recognition dictionary 9 in advance. Recognition is performed (step S5).
[0038]
Next, each component of the form reader of the present embodiment will be described in detail.
[0039]
The ruled line information storage unit 101 previously stores, for each line segment forming a ruled line on a form, coordinate values of a start point, an end point, and a connection / intersection. FIG. 3 shows an example of a form, and FIG. 4 shows a part of ruled line information stored in the ruled line information storage unit 101 regarding the form.
[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 information storage unit 101 stores information on the coordinates, lengths, and intersections of both ends of each line segment (1) to (21) in the XY coordinate system based on the upper left position of the form A as a reference (0, 0). It is stored in the form of a table as shown in FIG. The stored information is assigned a number corresponding to each of the line segments (1) to (21). In FIG. 4, (Xs, Ys) is the start point of the line segment, (Xe, Ye) is the end point of the line segment, and tmax is the point at which the line segment connects or intersects with another line segment (hereinafter referred to as a connection point). Is a number. {(Xt (1), Yt (1)), (Xt (2), Yt (2)),..., (Xt (tmax), Yt (tmax))} are the coordinates of the connection point. {L (1), L (2),..., L (tmax)} are the numbers of other line segments connected at each connection point. {F (1), F (2),..., F (tmax)} are attribute codes representing the form of each connection point, and there are the following nine types.
[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 condition storage unit 102 include, for example, the following four conditions for a subset of the line segments constituting the ruled line.
[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 condition storage unit 102, a group of line segments satisfying one or more of the above conditions at the same time is registered as one group. FIG. 5 shows a specific example of the ruled line layout constraint condition for the form shown in FIG. In FIG. 5, a group 1 is a line segment group that satisfies the conditions 1 and 2 at the same time, and includes a total of three line segments with line segment numbers 1, 5, and 4. Group 2 is a line segment group that satisfies conditions 2 and 3 at the same time, and includes a total of seven line segments with line segment numbers 2, 6, 7, 8, 9, 10, and 3. Group 3 is a group of line segments satisfying the conditions 1 to 3 at the same time, and includes a total of five line segments with line segment numbers 6, 7, 8, 9, and 10.
[0047]
In the character reading position storage unit 103, numbers of four ruled lines surrounding a character reading area (hereinafter, referred to as a cell) surrounded by ruled lines are registered in advance. In the case where a cell for writing a certain character string is divided into character units by partition lines, the number of partition lines and the line segment number of the partition line are also registered. FIG. 6 shows a part of the storage contents of the character reading position storage unit 103 corresponding to the form shown in FIG. In the example shown in FIG. 6, an example of three cells indicated by field numbers 1, 2, and 3 is shown. In the cell with the field number 1, the upper, lower, left, and right ruled lines surrounding the cell are respectively formed by the line numbers 5, 4, 2, and 3, and the inside of the cell is line numbers 6 and 7. , 8, 9, and 10 are divided by a total of five partition lines. The cells of field numbers 2 and 3 have no partition line.
[0048]
The ruled line detection unit 4 detects ruled lines on a form from the digital image stored in the image memory 3 for each line segment, and stores the detection result in the ruled line detection result storage unit 105. FIG. 7 shows a procedure of a ruled line detection process by the ruled line detection unit 4. Hereinafter, the procedure of the ruled line detection processing will be described with reference to FIG.
[0049]
First, when the gradation of the digital image stored in the image memory 3 is not binary, the digital image is converted into a binary image having a pixel value of 1 in a character and a ruled line portion and a pixel value of 0 in a background portion. It overwrites the image memory 3 (step S401). Next, form edge detection processing for detecting the four sides of the form from the binarized digital image by Hough transform or the like is performed (step S402). Next, a ruled line labeling process is performed on the binarized digital image, in which a ruled line label and a direction code of the ruled line are assigned to all pixels constituting the ruled line (step S403). Next, line segment detection processing for detecting a rule line in units of line segments is performed on the digital image to which the rule line label is added (step S404). Finally, for the ruled line detection results, coordinate information of intersections / connection points (shapes representing corners or branches) between the ruled lines are obtained and stored in the ruled line detection result storage unit 5.
[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 result storage unit 5. FIG. 11 shows an example of a format of a ruled line label and a rotation angle stored for each pixel of the digital image. In the example shown in FIG. 11, the storage capacity for each pixel is 8 bits. Bit “b0” represents a pixel value (“1: graphic”, “0: background”). Bit “b1” indicates a line segment detection flag (“1: detected”, “2: not detected”). The bit “b2” indicates a line segment detection completion flag (“1: completed”, “2: uncompleted”). Bits “b4” and “b5” represent a direction code. Bit “b6” indicates a ruled line determination completion flag (“1: completed”, “0: not completed”). Bit “b7” represents a ruled line label (“1: ruled line”, “0: other than ruled line”). Note that bit “b3” is an empty bit.
[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 value 1 is assigned to the line segment detection flag of the detected pixel, and the conditions B1 to B3 are set within the range of the city distance d ≦ N (N = 1, 2, 3,...) Starting from the pixel. Are searched for (step S514), the value 1 is added to the line segment detection flags of all the detected black pixels (step S515), and the end point of the line segment is obtained (step S516). Here, the direction code of the starting point is C0 (see FIG. 10). The city distance is given by the sum (| Δx | + | Δy |) of the absolute value of the distance difference Δx in the x direction and the absolute value of the distance difference Δy in the y direction between two points. The conditions B1 to B3 are specifically the following conditions.
[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 substeps 1 to 3.
[0060]
Substep 1:
A search for black pixels is performed within the range of the urban area distance d ≦ 1, and the value 1 is assigned to the line segment detection flags of all detected black pixels. Subsequently, a search for black pixels is performed within the range of the urban area distance d ≦ 2, and the value 1 is assigned to the line segment detection flags of all detected black pixels. The same processing is performed by sequentially increasing the value of the city area distance d to 3, 4, 5,. The search process ends when there are no more black pixels satisfying the conditions B1 to B3.
[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 result storage unit 5. Further, a pixel in the direction opposite to the direction indicated by the direction code of the starting point and having the largest Euclidean distance from the starting point is regarded as the other end point of the line segment, and its coordinate value is stored in the ruled line detection result storage unit 5. However, all the coordinate values are translated and corrected so that the upper left corner of the form detected in the form end detection process (step S402 in FIG. 7) becomes the origin, and the horizontal and vertical sides of the form become horizontal and vertical, respectively. It is assumed that the image data is stored in the coordinate system corrected for rotation as described above. Hereafter, it is assumed that the coordinate values detected on the image data are similarly stored after being subjected to translation correction and rotation correction.
[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. Set 1 and end the subprocess.
[0063]
When the coordinate values of both ends of the line segment are stored in the ruled line detection result storage unit 5 in steps S514 to S516, raster scanning is restarted (step S517), and the end point of the next line segment is obtained. When all the line segments have been detected and the end points have been obtained, the line segment detection processing is terminated.
[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 line matching unit 6 will be described. The ruled line collating unit 6 obtains information on a line segment unit of a ruled line of an image-inputted form and a constraint condition for the line segment from a ruled line information storage unit 101 and a ruled line layout constraint condition storage unit 102 in the form form information storage unit 1. Is read and collated with the line segment information in the ruled line detection result storage unit 105. FIG. 13 shows a specific procedure of this collation.
[0066]
Referring to FIG. 13, first, from the k-th data group registered in the ruled-line layout constraint condition storage unit 102 illustrated in FIG. 5, the ruled-line layout constraint condition and the number of line segments (L1, L2, .., L (k_nc)) are extracted (step S601). Here, (k_nc) is the number of line segments registered in the k-th data group. It is also assumed that data groups are registered only for k = 1, 2, 3,..., K_max.
[0067]
Next, by referring to the ruled line information storage unit 101 with the line segment number extracted from the k-th data group of the ruled line layout constraint condition storage unit 102, the start point coordinates and end point coordinates of the line segment are extracted, and the ruled line detection result storage is performed. The start point coordinates and the end point coordinates of the line segment in the section 5 are collated (step S602).
[0068]
When a matching line segment is found in the ruled line detection result storage unit 5, the corresponding line segment number in the ruled line information storage unit 101 is written in the ruled line detection result storage unit 5. For the line segment that has been extracted from the ruled line information storage unit 101 and has failed in the collation, the line segment number is temporarily stored inside the ruled line collating unit 6. At the time when all the line segments extracted from the k-th data group have been collated, if there is a line segment that failed to be collated, the line segment is re-detected by a Top-Down method as described later. To the ruled line detection unit 4 (step S603).
[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 information storage unit 101 and the coordinate value of the line segment on the ruled line detection result storage unit 5 side is obtained. The deviation amounts (ΔX, ΔY) are stored in the ruled line collation unit 6 (step S604).
[0070]
The processing of steps S601 to S604 is executed for (k_max) data groups registered in the ruled line layout constraint condition storage unit 102.
[0071]
Next, with respect to the other line segments registered in the ruled line information storage unit 101, the shift amounts (ΔX, ΔY) stored in the ruled line collation unit 6 in S604 are corrected, and stored in the ruled line detection result storage unit 5. The collation with the performed line segment is performed (step S605). At this time, the form and the number of connection points included in the line segment are also compared to prevent occurrence of an error in the comparison. For line segments registered in the ruled line information storage unit 101 that failed to be compared, the line segment numbers are temporarily stored in the ruled line matching unit 6.
[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 information storage unit 101 remains in the ruled line detection result storage unit 5, it is deleted (step S607).
[0073]
Next, re-detection of a line segment by the ruled line detection unit 4 that has received the ruled line re-detection instruction will be described.
[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 condition storage unit 102, the constraint condition is registered in the ruled line layout constraint condition storage unit 102 via the ruled line collation unit 6. The coordinate values of the start and end points of the line segment are read out, the partial region including the line segment is specified in anticipation of an error, and after adjusting the binarization threshold value for preventing blurring of the ruled line in the partial region, the value is adjusted again. Perform value conversion. When detecting two or three or more parallel line segments described as the constraint condition on the ruled line layout, a plurality of line segments satisfying the constraint condition are detected with priority. The detection accuracy at the time of re-detection is improved by the above “Top-Down” detection.
[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 condition storage unit 102, the ruled line detection unit 4 determines whether the starting point of the line segment registered in the ruled line information storage unit 101 The end point coordinate value is read, a partial area including the line segment is specified in anticipation of an error, and after adjusting a binarization threshold value for preventing blurring of a ruled line in the partial area, binarization is performed again. This improves the detection accuracy at the time of re-detection.
[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 character detection unit 7 reads the ruled line numbers (line segment numbers) of the four ruled lines (line segments) surrounding the character field to be OCR-read from the character reading position storage unit 103 of the form information storage unit 1, and further reads the ruled line numbers. The coordinates of the start point and the end point of the ruled line are read out from the ruled line information storage unit 101 based on the (line segment number), and a character field (character reading position) on the digital image input from the image input unit 2 is specified. Extract character pattern from image of. The character pattern is extracted, for example, by extracting a partial image in units of one character in which the integrated value of the black pixels is equal to or larger than a threshold value from a pattern formed by projecting black pixels in the specified character field on the x-axis and the y-axis. This is feasible.
[0078]
The character recognizing unit 8 extracts a character feature for recognition from the image of one character obtained from the character detecting unit 7. Then, this is sequentially collated with character features stored in the character recognition dictionary 9 for each category, and the category having the highest similarity is output as a recognition result to perform character recognition.
[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.
前記罫線検出手段は、前記未検出の線分の再検出を行う場合に、前記第1の記憶手段に格納された拘束条件の中に、前記未検出の線分についての拘束条件が含まれている場合は、該未検出の線分に関する拘束条件を利用することを特徴とする請求項1に記載の帳票読取り装置。In the case where the ruled line detection unit performs the re-detection of the undetected line segment, the constraint condition stored in the first storage unit includes a constraint condition for the undetected line segment. 2. The form reading apparatus according to claim 1, wherein when there is, a constraint condition regarding the undetected line segment is used. 前記罫線検出手段は、前記未検出の線分に関する拘束条件が平行な線分が複数あることを示す場合は、複数の平行な線分を優先して検出することを特徴とする請求項2に記載の帳票読取り装置。3. The ruled line detecting means according to claim 2, wherein when the constraint condition relating to the undetected line segment indicates that there are a plurality of parallel line segments, the ruled line detecting means preferentially detects the plurality of parallel line segments. Form reader as described. 前記所定の罫線情報は、前記罫線に関する所定の座標系における位置および論理構造を含むことを特徴とする請求項1に記載の帳票読取り装置。2. The form reading apparatus according to claim 1, wherein the predetermined ruled line information includes a position and a logical structure of the ruled line in a predetermined coordinate system. 前記罫線は、文字記入枠を構成するものであることを特徴とする請求項1に記載の帳票読取り装置。2. The form reading apparatus according to claim 1, wherein the ruled line forms a character entry frame. 前記罫線照合手段による誤検出した罫線の削除および未検出の罫線の再検出が行われて前記第2の記憶手段に格納された罫線検出結果と前記第1の記憶手段に格納された位置情報とを参照して、前記ディジタル画像上における文字読取り位置を特定し、該特定された領域内の文字パターンを抽出する文字検出手段と、
前記文字検出手段で抽出された文字パターンに基づいて文字を認識する文字認識手段とをさらに有することを特徴とする請求項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のステップと、
前記罫線に関する所定の罫線情報および前記複数の線分間の特定の関係を示す拘束条件を第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.
前記第7のステップは、前記第1の記憶部に格納された拘束条件の中に、前記未検出の線分についての拘束条件が含まれている場合は、該未検出の線分に関する拘束条件を利用するステップを含むことを特徴とする請求項7に記載の帳票読取り方法。In the seventh step, when the constraint condition stored in the first storage unit includes a constraint condition for the undetected line segment, the constraint condition for the undetected line segment is included. 8. The form reading method according to claim 7, further comprising the step of using the form. 前記第7のステップは、前記未検出の線分に関する拘束条件が平行な線分が複数あることを示す場合は、複数の平行な線分を優先して検出するステップを含むことを特徴とする請求項7に記載の帳票読取り方法。The seventh step includes a step of, when the constraint condition relating to the undetected line segment indicates that there are a plurality of parallel line segments, detecting the plurality of parallel line segments with priority. The form reading method according to claim 7. 前記所定の罫線情報は、前記罫線に関する所定の座標系における位置および論理構造を含むことを特徴とする請求項7に記載の帳票読取り方法。8. The form reading method according to claim 7, wherein the predetermined ruled line information includes a position and a logical structure of the ruled line in a predetermined coordinate system. 前記罫線は、文字記入枠を構成するものであることを特徴とする請求項7に記載の帳票読取り方法。The form reading method according to claim 7, wherein the ruled line forms a character entry frame. 前記誤検出した罫線の削除および未検出の罫線の再検出が行われて前記第2の記憶部に格納された罫線検出結果と前記第1の記憶部に格納された位置情報とを参照して、前記ディジタル画像上における文字読取り位置を特定するステップと、
前記特定された文字読取り位置の領域内の文字パターンを抽出するステップと、
前記抽出した文字パターンに基づいて文字を認識するステップとをさらに含むことを特徴とする請求項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の処理と、
前記罫線に関する所定の罫線情報および前記複数の線分間の特定の関係を示す拘束条件を第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.
前記第7の処理は、前記第1の記憶部に格納された拘束条件の中に、前記未検出の線分についての拘束条件が含まれている場合は、該未検出の線分に関する拘束条件を利用する処理を含むことを特徴とする請求項13に記載のプログラム。The seventh process may include, if the constraint condition stored in the first storage unit includes a constraint condition for the undetected line segment, the constraint condition relating to the undetected line segment. The program according to claim 13, further comprising: a process for utilizing the program. 前記第7の処理は、前記未検出の線分に関する拘束条件が平行な線分が複数あることを示す場合は、複数の平行な線分を優先して検出する処理を含むことを特徴とする請求項13に記載のプログラム。The seventh process is characterized in that when the constraint condition regarding the undetected line segment indicates that there are a plurality of parallel line segments, the seventh process includes a process of preferentially detecting the plurality of parallel line segments. The program according to claim 13. 前記所定の罫線情報は、前記罫線に関する所定の座標系における位置および論理構造を含むことを特徴とする請求項13に記載のプログラム。14. The program according to claim 13, wherein the predetermined ruled line information includes a position and a logical structure of the ruled line in a predetermined coordinate system. 前記罫線は、文字記入枠を構成するものであることを特徴とする請求項13に記載のプログラム。14. The program according to claim 13, wherein the ruled line forms a character entry frame. 前記誤検出した罫線の削除および未検出の罫線の再検出が行われて前記第2の記憶部に格納された罫線検出結果と前記第1の記憶部に格納された位置情報とを参照して、前記ディジタル画像上における文字読取り位置を特定する処理と、
前記特定された文字読取り位置の領域内の文字パターンを抽出する処理と、
前記抽出した文字パターンに基づいて文字を認識する処理とをさらにコンピュータに実行させることを特徴とする請求項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.
JP2002161429A 2002-06-03 2002-06-03 Business form reading device, business form reading method and program therefor Pending JP2004013188A (en)

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)

* Cited by examiner, † Cited by third party
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

Cited By (3)

* Cited by examiner, † Cited by third party
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