JP3565310B2 - Ruled line extracting apparatus and method for extracting ruled lines from general document images - Google Patents

Ruled line extracting apparatus and method for extracting ruled lines from general document images Download PDF

Info

Publication number
JP3565310B2
JP3565310B2 JP34685097A JP34685097A JP3565310B2 JP 3565310 B2 JP3565310 B2 JP 3565310B2 JP 34685097 A JP34685097 A JP 34685097A JP 34685097 A JP34685097 A JP 34685097A JP 3565310 B2 JP3565310 B2 JP 3565310B2
Authority
JP
Japan
Prior art keywords
pattern
line
straight line
patterns
size
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP34685097A
Other languages
Japanese (ja)
Other versions
JPH10232939A (en
Inventor
裕 勝山
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP34685097A priority Critical patent/JP3565310B2/en
Publication of JPH10232939A publication Critical patent/JPH10232939A/en
Application granted granted Critical
Publication of JP3565310B2 publication Critical patent/JP3565310B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Processing Or Creating Images (AREA)
  • Image Processing (AREA)
  • Document Processing Apparatus (AREA)
  • Image Analysis (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、光電変換装置等により読み込まれた任意の文書画像から罫線部分を抽出する罫線抽出装置および方法に関する。
【0002】
【従来の技術】
近年、オフィス作業の効率化のために、紙文書を電子化して光ディスク等に保存する電子ファイリングシステムの需要が増加している。従来の電子ファイリングシステムにおいては、紙文書がイメージスキャナ等の光電変換装置で画像に変換され、それに検索のためのキーワードが付与されて、光ディスクやハードディスクに保存される。しかし、これらのキーワード等はキー入力する必要があり、その入力作業が煩雑であった。
【0003】
この不便さを解消するための、本出願人による先願の技術として、「文書画像からのタイトル抽出装置および方法」(特願平07−341983)がある。この方法によれば、画像に含まれる文書タイトルが、キーワードとして自動的に抽出/登録される。また、表形式文書を含む様々な文書の画像から、タイトル、宛先、発信元情報等の管理情報を自動抽出することができ、例えば、表外にあるタイトルは、約90%の精度で抽出できることが分かっている。
【0004】
しかし、表内のタイトルについては抽出精度が約55%に過ぎず、実用化するには精度が不十分である。表内のタイトル等のキーワードを高精度で抽出するには、表を構成する罫線を正確に抽出する必要がある。罫線抽出技術は、主として、文字等が規則的に並んでいる帳票を対象に開発されてきた。
【0005】
従来の罫線抽出技術としては、「画像抽出方式」(特開平6−309498)と「画像抽出装置」(特開平7−28937)がある。これらの技術によれば、帳票内の枠の位置等の情報入力を必要とせずに、枠の抽出や除去を行うことが可能である。処理可能な帳票は、一文字枠、ブロック枠(横一行枠またはフリーフォーマット枠)、または枠の外形が矩形状になっており横枠線が規則的に配置されている構造を持つ表を有するものである。
【0006】
また、本出願人による先願の罫線抽出技術としては、「枠抽出装置及び矩形抽出装置」(特願平7−203259)、「パターン領域切り出し方式及びパターン抽出装置」(特願平7−282171)、および「パターン抽出装置及びパターン領域の切り出し方法」(特願平8−107568)がある。
【0007】
これらの技術によれば、図48に示すように枠の外形が矩形であっても、また、図49に示すように枠の外形が矩形でなくても、枠の抽出および除去を行うことができる。さらに、図49の網掛け部分のように、枠で囲まれた矩形の中にさらに細かい構造を持つ表形式枠についても、枠の抽出および除去を行うことが可能である。以下に、処理の概要を示す。
【0008】
(1)細線化:マスク処理によって、縦横の線分を細線化し、文字と枠の太さの差をなくす。
(2)線分抽出:「画像抽出方式」(特開平6−309498)における隣接投影法を用いて、比較的長い直線の抽出を行う。隣接投影とは、注目する行または列に含まれる画素の投影値に、その周囲の行または列の投影値を足し合せた結果を、注目する行または列の最終的な投影値とする方法である。この投影法によれば、特定の行または列の周囲の画素分布を大局的に捉えることができる。
【0009】
(3)直線抽出:抽出された線分を順に探索し、線分と線分の間に一定長さ以上の途切れがないかどうかを検査する。間にそのような途切れがない線分同士を順に統合していき、長い直線を抽出する。
【0010】
(4)直線統合:抽出された直線同士を再度統合する。かすれにより2つ以上の部分に分離された直線を、1つの直線に統合する。
(5)直線伸張:規則的な帳票であると分かっているときに限り、かすれにより短くなった直線の伸張処理を行い、本来の長さに修復する。
【0011】
【発明が解決しようとする課題】
しかしながら、上述した罫線抽出技術には次のような問題がある。
先願の技術において、帳票の枠の形状に関しては、規則的な構造であっても不規則な構造であっても、矩形領域で構成されている表形式枠であれば、処理可能である。また、対象としていた罫線は、実線、点線の場合とも、かすれのあるなしに関わらず処理可能である。また、規則的な表であると分かっている場合にのみ、極度のかすれにより短くなった直線を伸ばす処理を行っている。
【0012】
しかし、一般的な入力画像には、図50に示すように、文字が太いフォントで記載されていたり、表内に網掛け部分があったりするものも含まれる。このような場合、文字同士が接触して潰れた文字列上から誤って罫線が抽出され、正しい罫線と誤抽出された罫線が誤って統合されることがある。
【0013】
また、網掛けの部分のような黒画素の固まりに接触した罫線や、文字に接触している罫線は、抽出することができない。こうした不具合をなくすためには、あらかじめ罫線構造が分かっている帳票のような表形式文書のみを、処理対象とすることが望ましい。
【0014】
しかし、電子ファイリングで扱われる一般文書にはどのような形式の表が含まれるか、あらかじめ分かっておらず、潰れた文字等を含む様々な画像が入力される可能性が高い。したがって、先願の技術のままでは、必ずしも正しい罫線抽出ができないという問題がある。
【0015】
本発明の課題は、あらかじめ罫線構造が予測できない一般の文書画像から、罫線部分を正しく抽出することのできる罫線抽出装置および方法を提供することである。
【0016】
【課題を解決するための手段】
図1は、本発明の罫線抽出装置の原理図である。図1の罫線抽出装置は、本発明の第1、第2、第3、第4、第5、第6、第7、第8、第9、第10、および第11の原理を含み、推定手段1、格納手段2、線分抽出手段3、計算手段4、直線抽出手段5、グラフ生成手段6、直線処理手段7、直線統合手段8、および直線除去手段9を備える。
【0017】
第1の原理において、推定手段1は、入力画像に含まれる標準パターンの大きさを推定する。直線抽出手段5は、上記標準パターンの大きさの情報に基づいてしきい値を設定し、そのしきい値を用いて、上記入力画像から1つ以上の直線パターンの情報を抽出する。
【0018】
標準パターンとは、入力画像に最も多く含まれる標準的な大きさの文字等のパターンに相当する。この標準パターンとしては、例えば、文字を表す画素連結領域が用いられ、その大きさの情報としては、例えば、その領域の外接矩形の高さまたは幅が用いられる。
【0019】
また、直線パターンとは、横長または縦長のマスクを用いたマスク処理および線分統合処理により、入力画像から抽出された横長または縦長のパターンに相当する。直線パターンの情報としては、例えば、そのパターンを構成する複数の線分パターンの外接矩形の座標値等が含まれる。線分パターンとは、マスク処理により画像から切り取られた線分状の画素領域に相当する。
【0020】
直線抽出手段5は、標準パターンの大きさに基づいて各種しきい値を決定し、画像中の直線パターンをそれらのしきい値によって分別する。これにより、網掛け部分や接触文字等に由来する直線パターンを罫線候補から除外し、正しい罫線候補を抽出することができる。
【0021】
第2の原理において、直線抽出手段5は、入力画像から1つ以上の直線パターンの情報を抽出する。計算手段4は、上記1つ以上の直線パターンの大きさの代表値を求める。直線処理手段7は、上記代表値に基づいてしきい値を設定し、そのしきい値を用いて、上記1つ以上の直線パターンの情報を処理する。
【0022】
計算手段4は、例えば、複数の直線パターンの高さまたは幅のヒストグラムから、直線パターンの代表的な大きさを求める。直線処理手段7は、この代表値付近にしきい値を設定し、それ以上の大きさの直線パターンを罫線候補から除外する等の処理を行って、正しい罫線候補を抽出することができる。
【0023】
第3の原理において、直線抽出手段5は、入力画像から1つ以上の直線パターンの情報を抽出する。計算手段4は、上記1つ以上の直線パターンを構成する1つ以上の線分パターンの大きさの代表値を求める。直線処理手段7は、上記代表値に基づいてしきい値を設定し、そのしきい値を用いて、上記1つ以上の直線パターンの情報を処理する。
【0024】
線分パターンは、上述したように、マスク処理により画像から切り取られた線分状の画素領域に相当する。計算手段4は、例えば、複数の線分パターンの高さまたは幅のヒストグラムから、線分パターンの代表的な大きさを求める。直線処理手段7は、この代表値に基づくしきい値より大きい線分パターンのみから構成される直線パターンを罫線候補から除外する等の処理を行って、正しい罫線候補を抽出することができる。
【0025】
第4の原理において、線分抽出手段3は、入力画像から1つ以上の線分パターンの情報を抽出する。格納手段2は、上記1つ以上の線分パターンの情報を、大きな線分パターンの情報と小さな線分パターンの情報とに区別して格納する。直線抽出手段5は、上記1つ以上の線分パターンの接続状態を調べ、途中に上記大きな線分パターンが存在するとき、その大きな線分パターンの大きさに関わらず、他の複数の線分パターンが構成する直線パターンを抽出する。
【0026】
線分パターンの情報としては、例えば、その外接矩形の座標値等が含まれる。格納手段2は、例えば、適当なしきい値より大きな線分パターンの情報に特定の属性情報を付加し、それ以外の小さな線分パターンの情報と区別して格納する。直線抽出手段5は、例えば、互いに重複する複数の線分パターンを統合して、それらの外接矩形を直線パターンとして抽出する際に、大きな線分パターンを無視して、その両側の小さな線分パターン同士を適当に接続する処理を行う。
【0027】
これにより、網掛け部分や文字等の大きな画素領域に接触した罫線の画像から、その領域の大きさに影響されない直線パターンを、正しい罫線候補として抽出することができる。
【0028】
第5の原理において、直線抽出手段5は、入力画像から1つ以上の直線パターンの情報を抽出する。直線統合手段8は、上記1つ以上の直線パターンに含まれる2つの直線パターンがほとんど重複する場合に、それらの2つの直線パターンを1つに統合する。
【0029】
直線統合手段8が、ほとんど重複する2つの直線パターンを統合することで、冗長な直線情報を削減し、正しい罫線候補を抽出することができる。
第6の原理において、直線抽出手段5は、入力画像から1つ以上の直線パターンの情報を抽出する。直線除去手段9は、上記1つ以上の直線パターンのうちの1つの形に関する情報と、それらの1つ以上の直線パターンに含まれる2つの直線パターンの間の距離に関する情報のうち、少なくとも一方の情報を用いて、それらの1つ以上の直線パターンのうちの1つを除去するかどうかを判定する。
【0030】
直線除去手段9が、例えば、直線パターンの縦横比や隣の直線パターンまでの距離に基づいて、その直線パターンの罫線らしさを判定し、罫線らしくない直線パターンを除去する。これにより、網掛け部分や潰れた文字列等に由来する直線パターンを罫線候補から除外し、正しい罫線候補を抽出することができる。
【0031】
第7の原理において、直線抽出手段5は、入力画像から1つ以上の直線パターンの情報を抽出する。直線除去手段9は、上記1つ以上の直線パターンに含まれる横直線パターンと縦直線パターンの接続関係に基づき、それらの横直線パターンと縦直線パターンのうちの一方を除去するかどうかを判定する。
【0032】
直線除去手段9が、例えば、いずれの横直線パターンとも接触しない縦直線パターンや、いずれの縦直線パターンとも接触しない横直線パターンを、罫線候補から除外する。これにより、潰れた文字列等に由来する直線パターンを罫線候補から除外し、正しい罫線候補を抽出することができる。
【0033】
第8の原理において、直線抽出手段5は、入力画像から1つ以上の直線パターンの情報を抽出する。直線除去手段9は、上記1つ以上の直線パターンに含まれ、ほとんど重複する2つの直線パターンのうちの、短い方を除去する。
【0034】
直線除去手段9が、ほとんど重複する2つの直線パターンのうち短い方を除去することで、冗長な直線情報を削減し、正しい罫線候補を抽出することができる。
【0035】
第9の原理において、直線抽出手段5は、入力画像から1つ以上の直線パターンの情報を抽出する。直線統合手段8は、上記1つ以上の直線パターンのうち部分的に重複する2つの直線パターンを統合してできる直線パターンの大きさが所定値程度になる場合に、統合後の直線パターンを罫線候補とする。
【0036】
直線統合手段8は、例えば、2つの直線パターンを統合してできる直線パターンの太さが直線パターンの代表的な太さ程度であれば、その統合処理を実行する。これにより、冗長な直線情報を削減し、正しい罫線候補を抽出することができる。
【0037】
第10の原理において、直線抽出手段5は、入力画像から1つ以上の直線パターンの情報を抽出する。直線除去手段9は、上記1つ以上の直線パターンのうち、しきい値より大きな線分パターンだけで構成されている直線パターンを除去する。
【0038】
直線除去手段9は、例えば、線分パターンの代表的な太さに比べてかなり太い線分パターンだけから構成される直線パターンを、罫線候補から除外する。これにより、潰れた文字列等に由来する直線パターンを罫線候補から除外し、正しい罫線候補を抽出することができる。
【0039】
第11の原理において、直線抽出手段5は、入力画像から直線パターンの情報を抽出する。グラフ生成手段6は、上記直線パターンを構成する1つ以上の線分パターンのうち、標準的な大きさの線分パターンの内部の画素数を求めて、その直線パターンの周囲における画素数のグラフを生成する。直線除去手段9は、上記グラフの形状に基づいて、上記直線パターンを除去するかどうかを判定する。
【0040】
グラフ生成手段6は、例えば、直線パターンを構成する線分パターンの集合から大きな線分パターンを除いて、標準的な大きさの線分パターンの集合を生成する。そして、それらを直線パターンの周囲の領域にシフトさせて、シフト量と画素数との関係を表すグラフを生成する。また、直線除去手段9は、例えば、そのグラフの形状がなだらかで極大値がはっきりしない場合に、直線パターンを罫線候補から除外する。
【0041】
網掛け部分や潰れた文字列等の内部より抽出された直線パターンの場合、その周囲に画素がまんべんなく分布していることが多い。このような場合に、グラフの形状がなだらかとなり、その直線パターンが罫線候補から除外されるので、正しい罫線候補を抽出することができる。
また、本発明の別の罫線抽出装置は、推定手段1、直線抽出手段5、および直線除去手段9を備える。推定手段1は、入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして、その標準パターンの大きさを推定する。直線抽出手段5は、入力画像から1つ以上の直線パターンの情報を抽出する。そして、直線除去手段9は、標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、上記1つ以上の直線パターンから太さのしきい値より太い直線パターンまたは長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出し、罫線候補の直線パターンの中で隣り合う2つの直線パターンのうち一方の直線パターンが長さのしきい値より短い場合にその直線パターンを除去する処理、または隣り合う2つの直線パターンの距離が標準パターンの大きさに基づく別のしきい値より小さい場合にそれらの直線パターンのうち一方を除去する処理を行う。
また、本発明のさらに別の罫線抽出装置は、推定手段1、直線抽出手段5、および直線除去手段9を備える。推定手段1は、入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして、その標準パターンの大きさを推定する。直線抽出手段5は、入力画像から1つ以上の直線パターンの情報を抽出する。そして、直線除去手段9は、標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、上記1つ以上の直線パターンから太さのしきい値より太い直線パターンまたは長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出し、罫線候補の直線パターンの中で隣り合う2つの横直線パターンの距離が標準パターンの大きさより小さい場合に、それらの横直線パターンのそれぞれを対象として横直線パターンと縦直線パターンの接続関係を調べ、接続関係に基づきその横直線パターンを除去し、罫線候補の直線パターンの中で隣り合う2つの縦直線パターンの距離が標準パターンの大きさより小さい場合に、それらの縦直線パターンのそれぞれを対象として縦直線パターンと横直線パターンの接続関係を調べ、接続関係に基づきその縦直線パターンを除去する。
また、本発明のさらに別の罫線抽出装置は、推定手段1、直線抽出手段5、および直線除去手段9を備える。推定手段1は、入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして、その標準パターンの大きさを推定する。直線抽出手段5は、入力画像から1つ以上の直線パターンの情報を抽出する。そして、直線除去手段9は、標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、上記1つ以上の直線パターンから太さのしきい値より太い直線パターンまたは長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出し、罫線候補の直線パターンの中でほとんど重複する2つの直線パターンの距離が標準パターンの大きさより小さい場合に、それらの直線パターンのうち短い方を除去する。
また、本発明のさらに別の罫線抽出装置は、推定手段1、計算手段4、直線抽出手段5、直線統合手段8、および直線除去手段9を備える。推定手段1は、入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして、その標準パターンの大きさを推定する。直線抽出手段5は、入力画像から1つ以上の直線パターンの情報を抽出する。直線除去手段9は、標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、上記1つ以上の直線パターンから太さのしきい値より太い直線パターンまたは長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出する。計算手段4は、上記1つ以上の直線パターンの大きさの代表値を求める。そして、直線統合手段8は、罫線候補の直線パターンのうち部分的に重複する2つの直線パターンを統合してできる直線パターンの大きさが代表値程度になる場合に、統合後の直線パターンを罫線候補とする。
また、本発明のさらに別の罫線抽出装置は、推定手段1、直線抽出手段5、および直線 除去手段9を備える。推定手段1は、入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして、その標準パターンの大きさを推定する。直線抽出手段5は、横長または縦長のマスクを用いたマスク処理により入力画像から斜め成分を取り除くことで1つ以上の線分パターンを抽出し、抽出された線分パターンを統合して直線パターンを生成することにより、入力画像から1つ以上の直線パターンの情報を抽出する。そして、直線除去手段9は、標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、上記1つ以上の直線パターンから太さのしきい値より太い直線パターンまたは長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出する。
また、本発明のさらに別の罫線抽出装置は、推定手段1、計算手段4、直線抽出手段5、および直線除去手段9を備える。推定手段1は、入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして、その標準パターンの大きさを推定する。直線抽出手段5は、入力画像から1つ以上の直線パターンの情報を抽出する。計算手段4は、上記1つ以上の直線パターンを構成する1つ以上の線分パターンの大きさの代表値を求める。そして、直線除去手段9は、標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、上記1つ以上の直線パターンから太さのしきい値より太い直線パターンまたは長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出し、代表値に基づいて線分パターンのしきい値を設定し、罫線候補の直線パターンから、線分パターンのしきい値より大きな線分パターンだけで構成されている直線パターンを除去する。
また、本発明のさらに別の罫線抽出装置は、推定手段1、格納手段2、直線抽出手段5、および直線除去手段9を備える。推定手段1は、入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして、その標準パターンの大きさを推定する。格納手段2は、1つ以上の線分パターンの情報を、太さがしきい値より大きな線分パターンの情報と大きな線分パターン以外の小さな線分パターンの情報とに区別して格納する。直線抽出手段5は、1つ以上の線分パターンの接続状態を調べ、途中に大きな線分パターンが存在するとき、その大きな線分パターンの大きさに関わらず、他の複数の線分パターンが構成する直線パターンを抽出することにより、入力画像から1つ以上の直線パターンの情報を抽出する。そして、直線除去手段9は、標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、上記1つ以上の直線パターンから太さのしきい値より太い直線パターンまたは長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出する。
また、本発明のさらに別の罫線抽出装置は、推定手段1、直線抽出手段5、グラフ生成手段6、および直線除去手段9を備える。推定手段1は、入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして、その標準パターンの大きさを推定する。直線抽出手段5は、入力画像から1つ以上の直線パターンの情報を抽出する。直線除去手段9は、標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、上記1つ以上の直線パターンから太さのしきい値より太い直線パターンまたは長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出する。グラフ生成手段6は、罫線候補の直線パターンのうちの1つの直線パターンを構成する1つ以上の線分パターンのうち、標準的な大きさの線分パターンを表す1つ以上の線分矩形を、その直線パターンの周囲で直線パターンの長さ方向と垂直にシフトさせながら、各シフト位置における1つ以上の線分矩形の内部の黒画素数の総和を求める処理を繰り返して、得られた黒画素数の総和を各シフト位置に対してプロットすることにより、その直線パターンの周囲における線分矩形のシフト量と黒画素数の総和との関係を表すグラフを生成する。そして、直線除去手段9は、グラフの形状に基づいてその直線パターンを除去するかどうかを判定する。
【0042】
例えば、図1の格納手段2は、後述する図3におけるメモリ32に対応し、推定手段1、線分抽出手段3、計算手段4、直線抽出手段5、グラフ生成手段6、直線処理手段7、直線統合手段8、および直線除去手段9は、CPU(中央処理装置)31およびメモリ32に対応する。
【0043】
【発明の実施の形態】
以下、図面を参照しながら、本発明の実施の形態を詳細に説明する。
現在、表内のタイトル等のキーワードを高精度に自動抽出するために、表形式文書のフォーム学習システムが開発されつつある。このシステムでは、あらかじめ表を含む文書を登録しておいて、登録文書については後で高い精度で正しいキーワードを抽出することが可能になる。本発明は、表形式文書のフォーム学習時において、文書画像から罫線を正しく抽出するために用いることができる。
【0044】
本発明では、従来および先願の帳票用の罫線抽出技術を改良し、罫線を構成する小線分の情報を活用して、本来の罫線から抽出された直線と文字列上から誤抽出された直線とを区別する。これにより、文字が罫線に接触している場合でも、正しく罫線を抽出することができる。
【0045】
また、表内の潰れ部分から抽出された線分があっても、本来の罫線から抽出された線分のみに注目して、罫線候補を求める。そして、罫線の形状、位置関係、罫線内部の線分の黒画素の分布状況から、正しい罫線だけを抽出する。
【0046】
以下の実施形態においては、サイズや位置や傾きが分からない枠が単数または複数個あり、それらの枠に対して、枠に接触した文字、枠からはみ出した文字を含む多様な文字が書かれているような文書を対象とする。そして、そのような文書の画像から枠を抽出する場合を考える。
【0047】
図2は、実施形態の罫線抽出装置の機能ブロック図である。図2において、対象となる入力パターン11は、極端な傾きや回転を補正した後の2値画像である。また、網掛けされた処理ブロックが、主として、「パターン抽出装置及びパターン領域の切り出し方法」(特願平8−107568)等の先願とは異なる処理を表す。
【0048】
まず、縮小処理部12が画像を縮小し、連結パターン抽出部13が連結パターンを抽出した後、罫線抽出装置は矩形高さの最頻値を計算し(処理P1)、マスク処理部14が細線化を行う。
【0049】
次に、横直線抽出部15が、横隣接投影(処理P2)、横線分検出(処理P3)、横線分統合(処理P4)、および横直線探索(処理P5)を行った後、罫線抽出装置は横点線検出(処理P6)を行う。次に、縦直線抽出部16が、縦隣接投影(処理P7)、縦線分検出(処理P8)、縦線分統合(処理P9)、および縦直線探索(処理P10)を行った後、罫線抽出装置は縦点線検出(処理P11)を行う。
【0050】
次に、罫線抽出装置は、横直線の高さの最頻値を計算し(処理P12)、縦直線の幅の最頻値を計算し(処理P13)、横線分の高さの最頻値を計算し(処理P14)、縦線分の幅の最頻値を計算する(処理P15)。次に、完全に重複する直線同士を統合し(処理P16)、直線矩形の形や隣の直線矩形までの距離を元に不要な直線を除去する(処理P17)。次に、縦横の直線間の接続関係を元に不要な直線を除去し(処理P18)、部分的に重複する直線同士を統合する(処理P19)。
【0051】
次に、罫線抽出装置は、他の直線とほぼ完全に重複する直線を除去し(処理P20)、所定のしきい値より大きな線分だけから成る直線を除去する(処理P21)。そして、別のしきい値より大きな線分にマークを付け(処理P22)、対象とする線分をシフトしながら直線をチェックし、不要な直線を除去して(処理P23)、残された直線を出力する。
【0052】
本実施形態の罫線抽出装置は、例えば図3に示すような情報処理装置(コンピュータ)により実現される。図3の情報処理装置は、CPU31、メモリ32、入力装置33、出力装置34、外部記憶装置35、媒体駆動装置36、ネットワーク接続装置37、光電変換装置38を備え、それらの各装置はバス39により互いに結合されている。
【0053】
CPU31は、メモリ32に格納されたプログラムを実行して、図2に示した各処理を行う。メモリ32としては、例えばROM(read only memory)、RAM(random access memory)等が用いられる。メモリ32には、上述のプログラムと処理に必要なデータが格納される。
【0054】
入力装置32は、例えばキーボード、ポインティングデバイス等に相当し、ユーザからの要求や指示の入力に用いられる。また、出力装置34は、表示装置やプリンタ等に相当し、処理結果等の出力に用いられる。
【0055】
外部記憶装置35は、例えば、磁気ディスク装置、光ディスク装置、光磁気ディスク装置等である。この外部記憶装置35に、上述のプログラムとデータを保存しておき、必要に応じて、それらをメモリ32にロードして使用することができる。また、外部記憶装置35は、画像やキーワード等を保存する、電子ファイリングシステムのデータベースとしても使用される。
【0056】
媒体駆動装置36は、可搬記録媒体40を駆動し、その記憶内容にアクセスすることができる。可搬記録媒体40としては、メモリカード、フロッピーディスク、CD−ROM(compact disk read only memory )、光ディスク、光磁気ディスク等、任意のコンピュータ読み取り可能な記録媒体を使用することができる。この可搬記録媒体40に、上述のプログラムとデータを格納しておき、必要に応じて、それらをメモリ32にロードして使用することができる。
【0057】
ネットワーク接続装置37は、LAN(local area network)等の任意の通信ネットワークに接続され、通信に伴うデータ変換等を行って、外部の情報提供者のデータベース40′等と通信する。これにより、罫線抽出装置は、必要に応じて、上述のプログラムとデータをデータベース40′からネットワークを介して受け取り、それらをメモリ32にロードして使用することができる。
【0058】
また、光電変換装置38は、例えばイメージスキャナであり、処理対象となる一般の文書画像を入力する。
メモリ32内では、処理に必要なデータが、例えば図4に示すような構造で管理される。図4において、1つの入力画像の情報41は、画像に含まれる表(表形式枠)の数と各表毎の情報42から成る。
【0059】
各表情報42は、表の外接矩形の座標値、表に含まれるセルの数、各セル毎の情報43、表に含まれる水平直線(横直線)の数、各水平直線毎の情報44、表に含まれる垂直直線(縦直線)の数、および各垂直直線毎の情報44から成る。ここで、セルとは、上下左右を罫線で囲まれた領域を表す。
【0060】
また、各セル情報43はセルの座標値を含み、各直線情報44は、直線を表す矩形の座標値、直線の属性情報、直線に含まれる小線分の数、各小線分毎の情報45、および画像全体における直線の通し番号から成る。そして、各小線分情報45は、小線分の属性情報と小線分を表す矩形の座標値を含む。直線および小線分の属性情報は、例えば実線と破線を区別したり、高さまたは幅が一定値を越えるワイルドカード(wildcard)線分と他の線分を区別したりするのに用いられる。
次に、図5から図24までを参照しながら、図2の各処理を順に説明する。
【0061】
縮小処理部12は、入力パターン11の画像がある一定以上の解像度を持ち、その画像の大きさが比較的大きい場合に、処理の効率化のため、画像の縮小処理を行う。入力された原画像はそのまま記憶しておく。
【0062】
連結パターン抽出部13は、複数の表が配置される位置の相対的な関係に依存することなく、各パターンを安定にピックアップするために、上下左右8連結で繋がっている黒画素連結領域を部分パターンとして、ラベリングにより抽出する。そして、これらの部分パターンを判別して、画像に含まれる表のパターンを抽出する。
【0063】
ラベリングで得られた部分パターンのサイズが後に必要になるので、連結パターン抽出部13は、部分パターンを近似する外接矩形の角の座標をラベリングの処理中に算出しておく。そして、抽出された部分パターンの中で、一定以上の大きさのあるパターンを表の候補であるとして抽出する。
【0064】
大きな連結パターンを抽出する際、大きな連結パターンの内側にあり、かつ一定以上の大きさのあるパターンも同時に抽出し、それらの大小のパターンを同じラベルを持つパターンとして扱う。こうすることで、本来1つの表を表すパターンが、かすれにより2つ以上のパターンに分離してしまったような場合に、これらを同じラベルに属するパターンとして処理することが可能になる。なお、これ以降、対象とするパターンの大きさを元に、許容できるかすれの長さを算出することにする。
【0065】
図5は、上述のようなラベリング処理の例を示している。図5(a)のような画像において、連結パターン抽出部13は、始めに一番大きな外接矩形を持つパターン51を抽出し、それにラベルを付加する。次に、パターン52とパターン57の間にある横線パターン56は一定以上の横幅があるため、これを大きいパターン51の一部であるとみなし、図5(b)に示すように、以下の処理ではこれらを同じラベルのパターンとして扱う。したがって、パターン56には、パターン51と同じラベルが付加される。
【0066】
次に、罫線抽出装置は、処理P1において、先願の「文書画像からのタイトル抽出装置および方法」(特願平07−341983)の方法を用いて、連結パターン抽出部13により抽出された矩形の高さの頻度分布を表すヒストグラムを求める。そして、その最頻値most freq heightを求め、これを文書に含まれる標準的な文字の大きさと推定する。求められた最頻値は、以下の処理において各種しきい値を設定するために用いられる。この最頻値の計算処理は、次のようにして行われる。
【0067】
まず、ラベリング結果の外接矩形の集合から、図6に示すような矩形高さのヒストグラムを作成する。図6において、横軸が各外接矩形の高さを表し、縦軸がその高さを持つ矩形の数(頻度値)を表す。ここでは、外接矩形の高さは、1画素の高さを単位高さとして求められる。
【0068】
次に、頻度値と、その頻度値を持つ矩形高さの内で最大の高さとの対応関係を求め、メモリ32内に矩形高さテーブルとして保存する。そして、そのテーブルの中を頻度値0から順に調査していき、高さの変化が1以内で頻度値の変化するものが連続し、それらの頻度値の変化の合計が所定値以上の場合に、それらの連続する高さのうちで最も高いものを矩形高さの最頻値most freq heightとする。
【0069】
図7は、図6のヒストグラムに対応する矩形高さテーブルの内容を表すヒストグラムを示している。図7において、頻度値が急激に変化する高さが最頻値となっていることがわかる。このようにして最頻値を求めれば、1文字よりも小さなノイズの影響を排除することができ、文書に含まれる標準的な大きさの文字の高さが得られる。
【0070】
図8は、矩形高さテーブルの簡単な例を示している。図8においては、4つの頻度値と、各頻度値を持つ矩形高さの内で最大の高さとが、それぞれペアで格納されている。最頻値を求めるために、この矩形高さテーブルの内容をヒストグラムにすると図9のようになる。
【0071】
図9のヒストグラムを、頻度値の低いところから、つまり高さの高いところから順に見ていくと、高さが10、9、8の位置で、頻度値がそれぞれ5、5、7だけ変化していることが分かる。これらの連続する高さの差は1であり、頻度値の変化の合計は17である。頻度値の変化のしきい値を9とすると、高さ10、9、8において頻度値の変化の合計がそれ以上となっているので、それらの中で最初に現れた高さ10をmost freq heightとする。
【0072】
次に、マスク処理部14は、連結パターン抽出部13により抽出された、ある一定以上の大きさを持つ連結パターンと、その内部に存在する一定以上の大きさを持つ連結パターン(前者と同じラベルを持つパターン)とを表の候補とする。そして、先願の「枠抽出装置及び矩形抽出装置」(特願平7−203259)の方法を用いて、マスク処理を行う。
【0073】
このマスク処理は、画像から極端な斜め成分を省き、表だけに存在する長い直線を抽出しやすくするために行われる。具体的には、マスク処理部14は、画像全体に対して、大きさの決められた横長、縦長の2種類のマスク矩形による走査を行う。マスク内での黒画素のパターンの占める割合を算出し、それがある一定値以上であれば、そのマスク内の領域全体を黒画素で埋めてパターンとして残し、また一定値以下であれば、マスク内のパターンを削除する。こうして、縦横成分の抽出を行う。
【0074】
ここで、複数の行または列が続いて、上記割合が所定のしきい値以上に達した場合、それらの連続するパターンをまとめて大きな矩形範囲をつくり、その中心線を処理結果とする。これにより、太いパターンが細線化される。また、処理結果の線分パターン同士の隙間が開かないようにするため、マスクの適用範囲を、お互いに重なりを持つように設定する。マスク処理前の原画像は、マスク処理後の画像とは別に記憶しておく。
【0075】
図10は、図5(b)に示した2つのパターン51、56を対象としてマスク処理を行った結果を示している。この場合、図10(a)に示す処理前の画像は、図10(b)に示すように変換される。図10(b)では、パターン51、56の縦横成分のみが抽出され、パターン全体が細線化されている。また、マスク処理において一部のパターンが補足された結果、パターン51とパターン56が繋がっていることが分かる。
【0076】
次に、横直線抽出部15は、処理P2において、図10(b)のような、部分パターンのマスク処理画像に対して、従来の隣接投影法を用いて投影値を算出する。そして、処理P3において、ある一定長さの横線分あるいは横直線の一部を、図11に示すように矩形近似して検出する。これらの処理ではマスク処理画像を使用しているが、以下の処理では原画像を使用する。
【0077】
次に、横直線抽出部15は、処理P4において、線分同士の接続状態を調査して、いくつかの線分が構成する直線を罫線候補として抽出する。この処理では、図12に示すように、検出された矩形線分のうち近隣の矩形線分同士を統合して長い直線を検出し、検出された直線をその外接矩形で近似する。
【0078】
線分を統合する際、図13に示すように、途中に一定以上の太い線分(ワイルドカード)61があった場合には、それらを無視し、太い線分を除いた細い線分だけを対象として統合を行う。ある線分がワイルドカードであるかどうかは、図4の線分情報45に記述された属性情報により区別される。このように、大きな線分があるとき、それを含んだ直線を出力するのではなく、その大きな線分を直線に反映しないような統合処理を行う。
【0079】
これにより、網掛け部分や、罫線に接触した文字や図形等のパターンがあっても、それらを除いて罫線だけを抽出することができる。このような統合処理の詳細については後述することにする。統合の結果抽出された直線の情報には、図4に示したように、それを構成する各線分の情報が含まれている。
【0080】
次に、横直線抽出部15は、処理P5において、矩形近似された横直線の左右端を正確に検出するために、図14に示すように、その直線内のパターン(画素)の探索を行う。探索の途中で、進行方向に画素のない部分(空白)が存在した場合、一定の画素数までは画素があるものと仮定して、進行方向に探索を続行する。一定画素数を越えて空白が存在した場合には、その位置を端点として探索を終了する。以下の処理では、探索によって検出された端点が、直線の端点として用いられる。
【0081】
次に、罫線抽出装置は、処理P6において、先願の「枠抽出装置及び矩形抽出装置」(特願平7−203259)の方法を用いて、横点線を抽出する。この処理では、一定の大きさを持ち、かつ規則正しく並んでいる部分パターンを探し、それらのパターンを矩形で囲んで、点線の位置を表現する。
【0082】
以下の処理では、点線の位置を示す矩形を、既に検出されている直線の位置を示す矩形と同様に扱う。ただし、点線に対応する直線の属性情報には破線属性が設定され、実線に対応する直線の属性情報には実線属性が設定されて、両者は区別される。
【0083】
また、縦直線抽出部16の処理P7、P8、P9、およびP10と、縦点線検出処理P11については、上述の横直線および横点線の場合と同様である。
次に、罫線抽出装置は、処理P12において、横直線高さの代表値を計算する。この処理では、抽出された横直線の高さのヒストグラムを作成し、最も頻度の大きな高さを、横直線高さの最頻値mfheightとし、これを横直線高さの代表値として用いる。また、同様にして、処理P13において、縦直線幅の代表値(最頻値)mfwidthを計算する。
【0084】
これらの代表値は、以下の処理において、各種しきい値を設定するために用いられる。また、横直線高さ/縦直線幅の代表値として、上記最頻値以外の適当な値を代わりに用いてもよい。
【0085】
次に、罫線抽出装置は、処理P14において、横線分高さの代表値を計算する。この処理では、画像内のすべての横直線を構成しているすべての横線分の高さのヒストグラムを作成し、最も頻度の大きな高さを、横線分高さの最頻値mfheight smallとし、これを横線分高さの代表値として用いる。また、同様にして、処理P15において、すべての縦直線を構成しているすべての縦線分の幅の最頻値mfwidth smallを計算する。
【0086】
これらの代表値もまた、以下の処理において、各種しきい値を設定するために用いられる。また、横線分高さ/縦線分幅の代表値として、上記最頻値以外の適当な値を代わりに用いてもよい。
【0087】
次に、罫線抽出装置は、処理P16において、完全に重複する直線同士を統合する。この処理では、1つの直線が別の直線とほぼ完全に重複している場合に、それらを1つに統合する。例えば、図15に示すような重複する2つの直線62、63において、重複しない部分の高さH1が一定の許容画素数INTEGDOT以内であれば、これらは完全に重複するものとみなし、1つの直線矩形64に統合する。INTEGDOTの値は、例えば2に設定される。
【0088】
次に、罫線抽出装置は、処理P17において、直線矩形の形や隣り合う直線矩形間の距離に基づいて、不要な直線を除去する。横直線の処理に関しては、まず、高さのしきい値th heiと長さのしきい値th lenを、それぞれ次式により計算する。
th hei=most freq height*2/3 (1)
th len=most freq height*5 (2)
そして、以下の4つの場合において、該当する横直線を削除する。
(a)横直線矩形の縦横比(高さ/幅)がしきい値FTH(=0.11)以上の場合。
(b)横直線矩形の縦横比がしきい値FTH2(=0.04)以上で、かつ、横直線矩形の高さが高さのしきい値th hei以上の場合。
(c)横直線矩形の幅が長さのしきい値th lenよりも小さい場合。
(d)カレント横直線よりも下にあり、それに最も近い横直線の幅が、長さのしきい値th lenよりも小さい場合。
【0089】
例えば、図16においては、直線67は(a)の場合に該当するため削除され、直線68は(b)の場合に該当するため削除され、直線69は(c)の場合に該当するため削除される。また、直線65をカレント横直線とすると、直線66は(d)の場合に該当するため削除される。
【0090】
さらに、2つの隣り合う直線間の距離が、most freq heightから求めたしきい値よりも小さい場合、それらの直線の一方(例えば長さの短い方)を除去する。縦直線の処理に関しても同様である。
【0091】
次に、罫線抽出装置は、処理P18において、縦横直線の接続関係に基づき、一部の不要な直線を除去する。横直線の処理に関しては、まず、注目する横直線矩形の端点がいずれの縦直線矩形とも接しない場合、その横直線矩形を削除する。これにより、表の枠を構成しない直線、例えば潰れて繋がった文字列上から抽出されたような孤立した直線が除去される。
【0092】
例えば図17においては、横直線70の2つの端点74、75はそれぞれ縦直線71、72に接しているため、この直線70は削除されず、横直線73はいずれの縦直線とも接していないので削除される。縦直線の処理に関しても同様である。
【0093】
しかし、このような除去処理では、画像の文字パターン等の影響で、本来残しておくべき直線が除去されてしまうことがある。例えば、図18のような画像において、縦直線76の端点77、78はいずれの横直線とも接していないので、縦直線76は、表の枠を構成しているにもかかわらず、削除されてしまう。
【0094】
そこで、必要な直線を残すために、除去処理の対象を互いに近接している2本の直線に限定することにする。この場合、まず、カレント横直線矩形iよりも下にあり、その矩形iとの距離が矩形高さの最頻値most freq heightよりも小さい横直線矩形jを求める。
【0095】
そして、これらの横直線矩形i、jのそれぞれについて、その矩形の端点がいずれの縦直線矩形とも接しなく、かつ、いずれの縦直線矩形の端点もその矩形と接しない場合に、その横直線矩形を削除する。縦直線の処理に関しても同様である。このような除去処理を行えば、図18の縦直線76は処理対象にならないので、削除されずに残る。
【0096】
また、図19においては、まず、近接する横直線79、80が対象となるが、これらの横直線79、80の端点は縦直線82に接しているので、横直線79、80は削除されない。次に、横直線80に近接する横直線81が対象となり、この横直線81はいずれの縦直線とも接していないので削除される。また、近接する縦直線83、84のうち、縦直線83は、端点が横直線79と接しているので残され、縦直線84はいずれの横直線とも接していないので削除される。
【0097】
次に、罫線抽出装置は、処理P19において、部分的に重複する直線同士を統合する。この処理では、横直線に関しては、まず、幅(長さ)の長い順に並び替える。次に、長さの長い順に、1つの直線iに注目して、その直線と部分的に重複する1つ以上の直線を求める。
【0098】
そして、部分的に重複する直線を直線iと仮想的に統合して1つの直線矩形とした場合に、その高さがしきい値(mfheight+THDOT)以下となるのであれば、その統合を実行する。THDOTの値は、例えば2に設定される。これにより、直線同士を統合した結果が高さの最頻値mfheight程度になる場合に、それらが1つに統合される。縦直線の処理に関しても同様である。
【0099】
図20においては、直線85と直線86が部分的に重複し、直線86と直線87が部分的に重複している。これらのうち、直線85と直線86を統合すると、統合された矩形の高さがしきい値を越えるため、直線86と直線87のみを統合して、それらの外接矩形88で近似する。縦直線の処理に関しても同様である。
【0100】
ここで、このような直線同士の統合処理を行うのは、本来1つの直線のパターンから抽出された複数の線分矩形が、処理P4、P9だけでは、完全に統合されない場合があるからである。例えば、図21に示すような重複する2つの横直線89、90の場合、それぞれに含まれる線分矩形(斜線部分)同士は離れているので、処理P4では、直線89と直線90は統合されない。このような場合でも、処理P19によれば、両者を統合することが可能である。
【0101】
次に、罫線抽出装置は、処理P20において、ほぼ完全に重複する2つの直線のうちの短い方を除去する。この処理では、横直線に関しては、まず、1つの横直線矩形を長さの長い順にソートする。次に、長い順に1つずつ横直線矩形iを取り出し、その横直線矩形iに部分的に重複する他の横直線矩形jに注目する。この時、直線iと直線jの上下関係が、図22に示すような関係にあるものを処理対象とする。図22において、直線91を直線iとすると、直線92、93が直線jに相当する。
【0102】
次に、直線iと直線jの間で横方向に重複している範囲を求め、その長さlen3と直線jの横幅len2の比len3/len2が、しきい値OVERRATEよりも大きい時、直線jを削除候補として、以下の処理を行う。ただし、OVERRATEの値は、1より小さいものとする。
【0103】
まず、直線iと直線jの間の縦方向の距離を求める。この場合、直線iと直線jの座標値の差を距離としてもよいが、直線が傾いた場合を考慮して、これらの直線内の小線分矩形間の距離を、直線間の距離と定義することにする。このような距離値の求め方を、図23を参照しながら説明する。
【0104】
図23において、横方向をx軸とし、縦方向をy軸とすると、直線iと直線jは、x=xminkukanの位置から、x=xmaxkukanの位置までの長さlen3の区間で横方向に重複しており、それぞれ内部に複数の線分を持っている。
【0105】
まず、罫線抽出装置は、直線i内の線分の集合から、線分統合処理P4でワイルドカードではないと判断された線分であって、最初に重複部分にかかるものを取り出し、それを基準線分とする。ここでは、線分94が基準線分となる。そして、基準線分94のx座標(xmin1,xmax1)を求める。
【0106】
次に、直線j内の線分の集合を対象にして、x座標がxmin1からxmax1までの範囲にかかる線分をすべて抽出する。そして、抽出された線分と直線i内の基準線分94とのy方向の距離の平均値を求め、それを直線iと直線jの間の距離値とする。
【0107】
ここでは、直線j内の対応する線分は線分95だけなので、これと基準線分94との距離dが、そのまま直線iと直線jの間の距離値となる。このような計算方法により、直線が傾いた場合でも、正しい直線間の距離が求められる。
【0108】
罫線抽出装置は、こうして得られた直線iと直線jの距離を元にして、直線jを削除するかどうかを決定する。まず、図22の直線92のように、直線jが直線iより上にある場合は、それらの距離がしきい値OVERDOT以内であれば、直線jを削除する。OVERDOTの値は、例えば1に設定される。また、直線93のように、直線jが直線iより下にある場合は、それらの距離がしきい値most freq heightよりも小さければ、直線jを削除する。
【0109】
次に、罫線抽出装置は、処理P21において、一定のしきい値より大きい線分だけで構成されている直線を除去する。この処理では、横直線内のすべて線分の高さがしきい値(mfheight small*2−1)よりも大きい場合に、その直線を文字列上から誤って抽出された直線とみなして、削除する。縦直線の処理に関しても同様である。
【0110】
次に、罫線抽出装置は、処理P22、23において、直線矩形を構成する線分矩形がしきい値より大きな場合、その線分矩形の情報にマークを付けて、マークが付いていない線分矩形の内部の黒画素の総和を求める。このとき、マークが付いていない線分矩形の集合を、直線矩形の長さ方向と垂直な方向に動かして、シフト量と黒画素総数の関係を表すグラフを作成する。そして、グラフの形状がなだらかな場合に、その直線矩形を罫線候補から除外する。
【0111】
罫線抽出装置は、まず、処理P22において、処理P23のための前処理を行う。この処理では、横直線内の線分の高さが、しきい値mfheight smallより大きな場合、その線分の属性情報をワイルドカードに設定して、処理P23で使用しないようにする。縦直線の処理に関しても同様である。
【0112】
次に、処理P23において、線分シフトによる直線のチェック/除去処理を行う。この処理では、まず、1つの横直線矩形を構成する複数の横線分矩形内の黒画素数の総和を求め、それをシフト量0の位置(中心位置)における黒画素総数とする。次に、線分矩形を横直線矩形の長さ方向と垂直な方向(縦方向)に、横直線矩形の高さ分だけ上下にシフトして、各位置での黒画素総数を求め、シフト量に対する黒画素総数のグラフを作成する。
【0113】
そして、中心位置付近の黒画素総数の極大値を基準とし、上下の両方向に離れた位置の黒画素総数の分布が一定比率未満になる場合に、その直線矩形は罫線であるとみなして出力する。それ以外の場合は、その直線矩形は文字列等から誤って抽出された直線であり、罫線ではないものとみなして、削除する。縦直線の処理についても同様である。
【0114】
例えば図50に示した画像の場合、図24に示すようなグラフが作成される。図24において、グラフ96、97は、それぞれ対応する横直線の周囲の黒画素の分布を表している。このとき、横直線の高さをheightとすると、横直線内の各線分は、y方向に+/−heightの区間で1画素ずつシフトされ、各シフト位置における線分内の黒画素の総数がプロットされている。
【0115】
グラフ96の場合は、シフト量0の位置に黒画素総数の極大値Peakがあり、その上下において、黒画素総数の分布はPeakのTHSHIFT倍の値を下回っている。ここでは、THSHIFTの値は、例えば0.44に設定される。このような分布は、シフト量0の位置に黒画素が集中していることを表しており、その位置に対応する横直線が罫線であるとみなされる。
【0116】
これに対して、グラフ97の場合は、+/−heightの区間の黒画素総数の分布がなだらかで、シフト量0の位置の上下においても、PeakのTHSHIFT倍の値を下回らない。このような分布は、シフト量0の位置の上下に黒画素が分散していることを表しており、その位置に対応する横直線は罫線ではないものとみなされ、削除される。
【0117】
このような直線のチェック/除去処理を行えば、表内の網掛け部分や潰れた文字列上から抽出された直線が除去され、本来の罫線のみが処理結果として出力される。このチェック/除去処理の詳細については後述することにする。
【0118】
次に、図25から図36までを参照しながら、上述の各処理の具体例について述べる。図25は、処理P4における横線分統合後の画像データを示しており、図26は、図25の画像の一部を示している。図26の状態は、処理P16における完全重複直線の統合前の画像データに対応し、図27は、その統合後の画像データを示している。
【0119】
図26において、ラベル66を持つ直線矩形101とラベル3を持つ直線矩形106は、図27においては1つに統合されていることが分かる。同様に、ラベル67、68、69、70を持つ直線矩形102、103、104、105は、それぞれ、ラベル4、5、6、7を持つ直線矩形107、108、109、110と統合されている。
【0120】
また、図28は、図27の画像に対して処理P17、18を施し、直線の形、位置および接続関係を元に直線を除去した後の画像データを示している。図27においてラベル35、37、38を持つ直線矩形111、112、113は、図28においては削除されていることが分かる。
【0121】
また、図29は、処理P19における部分重複直線の統合前の画像データを示しており、図30は、その統合後の画像データを示している。図29において、ラベル25を持つ直線矩形121とラベル20を持つ直線矩形124は、図30においては1つに統合されていることが分かる。同様に、ラベル26、27を持つ直線矩形122、123は、それぞれ、ラベル21、22を持つ直線矩形125、126と統合されている。
【0122】
また、図31は、処理P20におけるほぼ完全に重複する直線の除去前の画像データを示しており、図32は、その除去後の画像データを示している。図31における直線矩形131が、図32においては削除されていることが分かる。
【0123】
また、図33は、処理P21における大きな線分だけから成る直線の除去前の画像データを示しており、図34は、その除去後の画像データを示している。図33における直線矩形141が、図34においては削除されていることが分かる。
【0124】
さらに、図35は、処理P23における線分シフトによる直線のチェック/除去前の画像データを示しており、図36は、そのチェック/除去後の画像データを示している。図35における直線矩形151、152、153が、図36においては削除されていることが分かる。
【0125】
次に、図37から図41までを参照しながら、線分統合処理について詳細に説明する。図37、38、39、40、41は、図2における横線分統合処理P4のフローチャートである。
【0126】
この処理においては、横直線抽出部15は、大きな黒画素塊をワイルドカード矩形として扱い、その前後に8連結で接続される横長の線分矩形に注目する。そして、ワイルドカード矩形を挟んでお互いに8連結の関係にある線分矩形を統合していき、1つの横に長い統合矩形を横直線として求める。
【0127】
処理が開始されると、横直線抽出部15は、まず、横線分の高さの最頻値mfheight smallを用いて次式の各しきい値を計算し、直線数を0とおく(図37、ステップS1)。
th height=
mfheight small+TH HEIGHTDOT (3)
standard h=mfheight small+1 (4)
ここで、TH HEIGHTDOTの値は、例えば2に設定される。次に、互いに連結する複数の線分矩形のうちの1つの高さを調べ(ステップS2)、それがしきい値th heightより大きければ、それをワイルドカード矩形としてマークする(ステップS3)。このとき、その線分矩形の属性情報の識別変数useを9とおくことにより、ワイルドカード属性を設定する。
【0128】
それ以外の線分矩形は通常の矩形(スタンダード矩形)として、use=0とおく(ステップS4)。そして、連結するすべての線分矩形をマークしたかどうかを判定し(ステップS5)、まだ線分矩形が残っていれば、ステップS2以降の処理を繰り返す。
【0129】
すべての線分矩形をマークし終えると、1つの矩形をカレント矩形iとして取り出し、xlf=カレント矩形iの左端座標、xr=カレント矩形iの右端座標、yup=カレント矩形iの上端座標、ybl=カレント矩形iの下端座標、line start=yup、line end=yblとおく(ステップS6)。そして、カレント矩形iのuseが0または9であるかどうか調べる(ステップS7)。
【0130】
カレント矩形iのuseが0または9であれば、startxlf=xlf、startxr=xr、startyup=yup、startybl=yblとおき(ステップS8)、次に、use=0かどうかを判定する(図38、ステップS9)。use=0であれば、standard st=yup、standard en=ybl、b use=0、use=1、height=ybl−yup+1とおく(ステップS10)。
【0131】
use=0は、カレント矩形iがワイルドカードではなく、スタンダードとして設定されていることを意味し、use=1はカレント矩形iが使用済みであることを意味する。ステップS9でuse=0でなければ、standard st=0、standard en=0、b use=9、height2=ybl−yup+1とおく(ステップS11)。b use=9は、カレント矩形iがワイルドカードであるため、スタンダードとして設定されないことを意味する。
【0132】
次に、他の線分矩形をカレント矩形kとして取り出し、rxlf=カレント矩形kの左端座標、rxr=カレント矩形kの右端座標、ryup=カレント矩形kの上端座標、rybl=カレント矩形kの下端座標とおく(ステップS12)。
【0133】
そして、カレント矩形iがスタンダードとして設定されているかどうか、すなわち、b use=0であるかどうかを調べる(ステップS13)。b use=0であれば、次に、カレント矩形kのuseが9であるかどうかを調べる(ステップS14)。ここで、use=9の場合は、カレント矩形iがスタンダードで、カレント矩形kがワイルドカードであることを意味する。
【0134】
use=9のとき、xr+1≧rxlf、xr<rxr、ybl+1≧ryup、およびyup−1≦ryblが成り立つかどうかを判定する(ステップS15)。これらの条件が成り立つ時、カレント矩形kがカレント矩形iの右側にあり、両者が横と縦に1画素(1ドット)以上の重なりを有することを意味する。そこで、xr=rxrとおいて、カレント矩形iの右端をカレント矩形kの右端まで延長する(ステップS16)。
【0135】
ステップS14でuse=9でないとき、次に、use=0であるかどうかを調べる(図39、ステップS17)。ここで、use=0の場合は、カレント矩形iがスタンダードで、カレント矩形kがワイルドカードでないことを意味する。そこで、次に、xr+1≧rxlf、xr<rxr、ybl+1≧ryup、およびyup−1≦ryblが成り立ち、かつ、カレント矩形kの高さがstandard h+/−4以内かどうかを判定する(ステップS18)。
【0136】
これらの条件が成り立つ時、xr=rxr、yup=ryup、ybl=rybl、use=2、hei=rybl−ryup+1とおく(ステップS19)。これは、カレント矩形iの右端をカレント矩形kの右端まで延長し、上下端の座標をカレント矩形kのものに置き換えることを意味する。また、use=2はカレント矩形kが使用済みであることを意味する。
【0137】
次に、hei>heightが成り立つかどうかを判定し(ステップS20)、成り立てばheight=heiとおく(ステップS21)。次に、ryup<line startが成り立つかどうかを判定し(ステップS22)、成り立てばline start=ryupとおく(ステップS23)。さらに、rybl>line endが成り立つかどうかを判定し(ステップS24)、成り立てばline end=ryblとおく(ステップS25)。
【0138】
これらの処理の後、次にb use=9かどうかを判定する(図40、ステップS26)。図38のステップS13、S15、図39のステップS18、S20、S22、S24で判定結果がNoのときは、直ちにステップS26以降の処理に移る。
【0139】
ここで、b use=9であれば、次に、カレント矩形kのuseが9であるかどうかを調べる(ステップS27)。use=9の場合は、カレント矩形iとカレント矩形kの両方がワイルドカードであることを意味をする。そこで、xr+1≧rxlf、xr<rxr、ybl+1≧ryup、およびyup−1≦ryblが成り立つかどうかを判定する(ステップS28)。
【0140】
これらの条件が成り立つ時、カレント矩形kがカレント矩形iの右側にあり、両者が横と縦に1ドット以上の重なりを有するので、xr=rxrとおいて、カレント矩形iの右端をカレント矩形kの右端まで延長する(ステップS29)。
【0141】
ステップS27でuse=9でないとき、次に、use=0であるかどうかを調べる(ステップS30)。ここで、use=0の場合は、カレント矩形iがワイルドカードで、カレント矩形kがワイルドカードでないことを意味をする。そこで、xr+1≧rxlf、xr<rxr、line end≧ryup、およびline start<ryblが成り立つかどうかを判定する(ステップS31)。
【0142】
これらの条件が成り立つ時、xr=rxr、yup=ryup、ybl=rybl、use=2、line start=ryup、line end=rybl、hei=rybl−ryup+1、standard st=ryup、standard en=ryblとおく(ステップS32)。
【0143】
これは、カレント矩形iの右端をカレント矩形kの右端まで延長し、上下端の座標をカレント矩形kのものに置き換えることを意味する。また、use=2はカレント矩形kが使用済みであることを意味する。そして、hei>heightが成り立つかどうかを判定し(ステップS33)、成り立てばheight=heiとおく(ステップS34)。
【0144】
次に、カレント矩形kとして、連結するすべての線分矩形を取り出したかどうかを判定する(図41、ステップS35)。図40のステップS26、S28、S30、S31、S33で判定結果がNoのときは、直ちにステップS35以降の処理に移る。ここで、残っている線分矩形があれば、図38のステップS13以降の処理を繰り返す。
【0145】
すべての線分矩形について処理が終われば、b use=9であるかどうかを判定する(ステップS36)。ここで、b use=9でなければ、xlf、xr、line start、line endを、それぞれ抽出した直線矩形の左端、右端、上端、下端の座標として保存し、直線数を1だけインクリメントする(ステップS37)。
【0146】
ステップS36でb use=9となるのは、カレント矩形iとそれに連結するすべての矩形がワイルドカードであった場合なので、この場合は直線として保存しない。
【0147】
次に、カレント矩形iとしてすべての線分矩形を取り出したかどうかを判定し(ステップS38)、残っている線分矩形があれば、図37のステップS6以降の処理を繰り返す。ステップS7でカレント矩形iのuseが0または9でない場合は、取り出した線分矩形が既に使用済みであることを意味するので、直ちにステップS38の処理に移り、次の線分矩形を取り出す。そして、すべての線分矩形が取り出されると、処理を終了する。
【0148】
このようにして、ワイルドカードを飛び越して、その両側の横線分矩形を統合し、標準的な線分だけを含む横直線を抽出することができる。図2における縦線分統合処理P9も、同様のフローに従って行われる。
次に、図42から図47までを参照しながら、線分シフトによる直線のチェック/除去処理のフローを詳細に説明する。図42、43、44、45、46、47は、図2の処理P23における横直線のチェック/除去処理のフローチャートである。この処理においては、罫線抽出装置は、各横直線の周囲の黒画素の分布を元にして、その直線が正しい罫線かどうかを判別し、正しい罫線のみを残して、他のものを除去する。
【0149】
処理が開始されると、罫線抽出装置は、まず、処理済の横直線数を表す変数cntと、正しい罫線と判定された横直線数を表す変数newcountを、ともに0とおく(図42、ステップS41)。ただし、cntとnewcountは、0を起点にしてカウントされる。
【0150】
次に、cnt番目の横直線の属性が破線を表すかどうかを調べる(ステップS42)。それが破線属性であれば、その横直線の直線情報をすべてnewcount番目の罫線情報としてコピーし、cntとnewcountを1ずつインクリメントして(ステップS43)、ステップS42で次の横直線の判定を行う。
【0151】
cnt番目の横直線の属性が破線属性でなければ、それは実線に対応するものとみなし、その横直線矩形の高さをheightとおき(ステップS44)、heightが2以下かどうかを判定する(ステップS45)。heightが2より大きければ、その値を変更せず、heightが2以下であれば、それを3に変更する(ステップS46)。
【0152】
そして、pos=height、maxsum=0、top bound=0、bottom bound=0、shift=−1*height、sum=0、j=0とおく(ステップS47)。変数posは、画像内での上下方向の位置を指定するために用いられ、変数maxsumは、黒画素総数のグラフにおける極大値を表す。
【0153】
また、変数top boundは、グラフの区間が画像の上端に達したかどうかを表すフラグとして用いられ、変数bottom boundは、グラフの区間が画像の下端に達したかどうかを表すフラグとして用いられる。変数shiftの値は、横直線内の線分矩形の上下方向のシフト量を表し、変数sumは、複数の線分矩形内の黒画素の総数を表す。
【0154】
次に、cnt番目の横直線内のj番目の小線分(線分矩形)の属性がワイルドカードかどうかを調べる(図43、ステップS48)。それがワイルドカード属性であれば、jを1だけインクリメントして(ステップS49)、ステップS48で次の小線分を判定する。
【0155】
j番目の小線分の属性がワイルドカードでなければ、それは通常の線分矩形に対応するとみなし、xmin=j番目の小線分の左端座標、xmax=j番目の小線分の右端座標、ymin=j番目の小線分の上端座標+shift、ymax=j番目の小線分の下端座標+shiftとおく(ステップS50)。ただし、こうして決められたyminまたはymaxの位置が画像座標内にない場合は、最も近い画像端のy座標をyminまたはymaxとする。
【0156】
そして、変数xmin、xmax、ymin、ymaxの各値で区切られる矩形領域内の黒画素の数を計算して、それをblack dotとおき、sum=sum+black dotとする。
【0157】
次に、yminが画像の上端に対応するかどうかを判定し(ステップS51)、上端であればtop bound=1とおく(ステップS52)。また、ymaxが画像の下端に対応するかどうかを判定し(ステップS53)、下端であればbottom bound=1とおく(ステップS54)。
【0158】
次に、変数jの値がcnt番目の横直線内の最後の小線分に対応するかどうかを判定する(ステップS55)。それが最後の小線分に対応しなければ、jを1だけインクリメントして(ステップS56)、ステップS48以降の処理を繰り返す。それが最後の小線分に対応すれば、histo[pos+shift]=sumとおく(図44、ステップS57)。
【0159】
ここで、histo[p]は、y方向の位置パラメータpの値に対応するグラフの値(黒画素の総数)を表す。例えば、pos=height、shift=−heightの場合は、histo[pos+shift]=histo[0]となり、パラメータ値0の位置に対応するグラフの値を表す。
【0160】
次に、sumとmaxsumを比較し(ステップS58)、sumがmaxsumより大きければ、maxsum=sumとおく(ステップS59)。
次に、shiftとheightを比較する(ステップS60)。shiftがheight以下であれば、shift=shift+1とおいて、sumとjを初期値0に戻し(ステップS61)、ステップS48以降の処理を繰り返す。これにより、シフト量が1画素分変化した位置に対応するグラフの値が計算される。
【0161】
そして、shiftの値がheightを越えると、次に、histo[pos−1]とhisto[pos]とを比較する(ステップS62)。ここで、histo[pos]は、シフト量0の位置に対応するグラフの値を表す。histo[pos−1]がhisto[pos]より大きければ、次に、histo[pos−1]とhisto[pos+1]とを比較する(ステップS63)。
【0162】
そして、histo[pos−1]がhisto[pos+1]より大きければ、maxpos=pos−1、maxsum=histo[pos−1]とおく(ステップS64)。また、histo[pos−1]がhisto[pos+1]以下であれば、maxpos=pos+1、maxsum=histo[pos+1]とおく(ステップS65)。
【0163】
ステップS62において、histo[pos−1]がhisto[pos]以下であれば、次に、histo[pos]とhisto[pos+1]とを比較する(ステップS66)。
【0164】
そして、histo[pos]がhisto[pos+1]以上であれば、maxpos=pos、maxsum=histo[pos]とおく(ステップS67)。また、histo[pos]がhisto[pos+1]より小さければ、maxpos=pos+1、maxsum=histo[pos+1]とおく(ステップS68)。
【0165】
このような処理により、histo[pos−1]、histo[pos]、およびhisto[pos+1]のうちの最大値が、maxsumに設定され、それに対応するパラメータ値がmaxposに設定される。したがって、このmaxsumは、シフト量0の位置付近におけるグラフの極大値を表し、図24のPeakに対応する。
【0166】
次に、得られたmaxsum(=histo[maxpos])の値を用いて、次式により、しきい値thを計算する(図45、ステップS69)。
th=maxsum*THSHIFT (5)
ここで、パラメータTHSHIFTは、極大値maxsumに対するしきい値thの比率を表し、0〜1.0の間で適当に設定される。
【0167】
そして、lineokflag1=0、lineokflag2=0、minval=0xffff、shift=−1*heightとおく。変数lineokflag1およびlineokflag2は、極大値に対応する位置の上下両側におけるチェック結果を表すフラグとして用いられ、変数minvalは、グラフの最小値を表す。
【0168】
次に、histo[pos+shift]とthを比較する(ステップS70)。そして、histo[pos+shift]がthより小さければ、極大値に対応する位置の上側では黒画素の数が減少しているとみなし、lineokflag1=1とおく(ステップS71)。したがって、lineokflag1=1は、上側におけるチェック結果がOKであることを表す。
【0169】
次に、histo[pos+shift]とminvalを比較する(ステップS72)。そして、histo[pos+shift]がminvalより小さければ、minval=histo[pos+shift]とおく(ステップS73)。
【0170】
次に、(pos+shift)とmaxposを比較し(ステップS74)、(pos+shift)がmaxpos以下であれば、shift=shift+1とおいて(ステップS75)、ステップS70以降の処理を繰り返す。これにより、シフト量が1画素分変化した位置で、再びグラフの値が調べられる。
【0171】
(pos+shift)がmaxposを越えれば、次に、histo[pos+shift]とthを比較する(図46、ステップS76)。そして、histo[pos+shift]がth以上であれば、次に、histo[pos+shift]とminvalを比較する(ステップS77)。そして、histo[pos+shift]がminvalより小さければ、minval=histo[pos+shift]とおく(ステップS78)。
【0172】
次に、shiftとheightを比較し(ステップS79)、shiftがheight以下であれば、shift=shift+1とおいて(ステップS80)、ステップS76以降の処理を繰り返す。これにより、シフト量が1画素分変化した位置で、再びグラフの値が調べられる。
【0173】
ステップS76において、histo[pos+shift]がthより小さければ、極大値に対応する位置の下側では黒画素の数が減少しているとみなし、lineokflag2=1とおく(ステップS81)。したがって、lineokflag2=1は、下側におけるチェック結果がOKであることを表す。
【0174】
次に、lineokflag1とtop boundの値を調べる(図47、ステップS82)。そして、lineokflag1=0かつtop bound=1であれば、対象とするcnt番目の横直線は画像の上端部付近の横罫線に対応するとみなして、lineokflag1=1とおく(ステップS83)。
【0175】
次に、lineokflag2とbottom boundの値を調べる(ステップS84)。そして、lineokflag2=0かつbottom bound=1であれば、cnt番目の横直線は画像の下端部付近の横罫線に対応するとみなして、lineokflag2=1とおく(ステップS85)。
【0176】
次に、lineokflag1およびlineokflag2の最終的な値を調べる(ステップS86)。lineokflag1=lineokflag2=1であれば、cnt番目の横直線は正しい横罫線であると判定し、その直線情報をnewcount番目の罫線情報としてコピーし、newcountを1だけインクリメントする(ステップS87)。
【0177】
また、lineokflag1=0またはlineokflag2=0であれば、cnt番目の横直線は正しい横罫線ではないと判定し、その直線情報は罫線情報として保存しない。
【0178】
次に、cntが画像内の最後の横直線に対応するかどうかを調べ(ステップS88)、まだ横直線が残っていれば、cntを1だけインクリメントして(ステップS89)、次の横直線についてステップS42以降の処理を繰り返す。そして、cntが最後の横直線に対応する値になれば、処理を終了する。
【0179】
このような処理を行えば、直線上の黒画素数とその周囲の黒画素数との比較に基づいて罫線らしさがチェックされるので、網掛け部分や潰れた文字列等から誤って抽出された直線が効率よく除去される。縦方向の直線についても、同様のチェック/除去処理が行われる。
【0180】
以上説明したように、本実施形態によれば、画像のかすれの有無にかかわらず、実線と点線の混在する表の画像であっても、また、網掛け部分や、文字と罫線が接触した部分があっても、正確に罫線を抽出することが可能になる。
【0181】
本発明の罫線抽出技術は、電子ファイリングだけでなく、記号や文字を含む広い意味での図形と直線が重なったパターンから、その図形だけを切り出す技術に適用される。例えば、手書き文字認識装置、印刷文字認識装置、図面認識における文字、記号等のパターンの切り出し、および画像中の罫線と物体、図形、文字等の接触部分の分離に適用可能である。
【0182】
また、直線や線分を表す領域の形状は必ずしも矩形でなくてもよく、直線または曲線により囲まれた任意の形状の領域を用いることができる。この場合、用いる形状に応じて、直線や線分の位置、高さ、および幅、それらの間の距離等を適当に定義すれば、図2と同様の処理を行うことができる。
【0183】
【発明の効果】
本発明によれば、あらかじめ罫線構造が予測できない一般の文書画像から、罫線部分を正しく抽出することができる。
【0184】
例えば、表の中に網掛け部分がある場合でも、その画像から正しく罫線を抽出することが可能となる。また、文字と罫線が接触している場合で、表の構造情報があらかじめ分かっていなくても、正しく罫線を抽出することが可能である。さらに、文字列が潰れ気味に印刷されている場合、または文字同士が高密度に印刷されている場合でも、文字列上から誤って罫線を抽出する確率が低くなる。
【図面の簡単な説明】
【図1】本発明の罫線抽出装置の原理図である。
【図2】罫線抽出装置の機能ブロック図である。
【図3】情報処理装置の構成図である。
【図4】データ構造を示す図である。
【図5】ラベリング処理を示す図である。
【図6】高さのヒストグラムを示す図である。
【図7】高さの最頻値を求めるためのヒストグラムを示す図である。
【図8】矩形高さテーブルを示す図である。
【図9】矩形高さテーブルの内容に対応するヒストグラムを示す図である。
【図10】マスク処理を示す図である。
【図11】線分検出処理を示す図である。
【図12】第1の線分統合処理を示す図である。
【図13】第2の線分統合処理を示す図である。
【図14】直線探索処理を示す図である。
【図15】完全重複直線の統合処理を示す図である。
【図16】第1の直線除去処理を示す図である。
【図17】第2の直線除去処理を示す図である。
【図18】除去すべきではない直線を示す図である。
【図19】第3の直線除去処理を示す図である。
【図20】部分重複直線の統合処理を示す図である。
【図21】部分重複直線の内部を示す図である。
【図22】第4の直線除去処理を示す図である。
【図23】2本の直線間の距離値の求め方を示す図である。
【図24】第5の直線除去処理を示す図である。
【図25】横線分の統合処理後の画像を示す図である。
【図26】完全重複直線の統合処理前の画像を示す図である。
【図27】完全重複直線の統合処理後の画像を示す図である。
【図28】直線の形、位置と縦横直線の接続関係による除去処理後の画像を示す図である。
【図29】部分重複直線の統合処理前の画像を示す図である。
【図30】部分重複直線の統合処理後の画像を示す図である。
【図31】ほぼ完全に重複する直線の除去処理前の画像を示す図である。
【図32】ほぼ完全に重複する直線の除去処理後の画像を示す図である。
【図33】大きな線分だけからなる直線の除去処理前の画像を示す図である。
【図34】大きな線分だけからなる直線の除去処理後の画像を示す図である。
【図35】線分シフトによる直線チェック/除去処理前の画像を示す図である。
【図36】線分シフトによる直線チェック/除去処理後の画像を示す図である。
【図37】線分統合処理のフローチャート(その1)である。
【図38】線分統合処理のフローチャート(その2)である。
【図39】線分統合処理のフローチャート(その3)である。
【図40】線分統合処理のフローチャート(その4)である。
【図41】線分統合処理のフローチャート(その5)である。
【図42】直線のチェック/除去処理のフローチャート(その1)である。
【図43】直線のチェック/除去処理のフローチャート(その2)である。
【図44】直線のチェック/除去処理のフローチャート(その3)である。
【図45】直線のチェック/除去処理のフローチャート(その4)である。
【図46】直線のチェック/除去処理のフローチャート(その5)である。
【図47】直線のチェック/除去処理のフローチャート(その6)である。
【図48】単純な表形式枠を示す図である。
【図49】複雑な表形式枠を示す図である。
【図50】罫線抽出の困難な表形式枠を示す図である。
【符号の説明】
1 推定手段
2 格納手段
3 線分抽出手段
4 計算手段
5 直線抽出手段
6 グラフ生成手段
7 直線処理手段
8 直線統合手段
9 直線除去手段
11 入力パターン
12 縮小処理部
13 連結パターン抽出部
14 マスク処理部
15 横直線抽出部
16 縦直線抽出部
31 CPU
32 メモリ
33 入力装置
34 出力装置
35 外部記憶装置
36 媒体駆動装置
37 ネットワーク接続装置
38 光電変換装置
39 バス
40 可搬記録媒体
40′ データベース
41 画像情報
42 表情報
43 セル情報
44 直線情報
45 線分情報
51、52、53、54、55、56、57、58 パターン
61 ワイルドカード
62、63、64、65、66、67、68、69、70、71、72、73、76、79、80、81、82、83、84、85、86、87、88、89、90、91、92、93、101、102、103、104、105、106、107、108、109、110、111、112、113、121、122、123、124、125、126、131、141、151、152、153直線矩形
74、75、77、78 端点
94、95 線分矩形
96、97 グラフ
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a ruled line extraction device and a method for extracting a ruled line portion from an arbitrary document image read by a photoelectric conversion device or the like.
[0002]
[Prior art]
2. Description of the Related Art In recent years, there has been an increasing demand for an electronic filing system for digitizing a paper document and storing it on an optical disk or the like in order to make office work more efficient. In a conventional electronic filing system, a paper document is converted into an image by a photoelectric conversion device such as an image scanner, and a keyword for search is added to the image, and is stored on an optical disk or a hard disk. However, these keywords and the like need to be keyed, and the input operation is complicated.
[0003]
As a prior application technique by the present applicant for solving this inconvenience, there is “Apparatus and method for extracting title from document image” (Japanese Patent Application No. 07-341983). According to this method, the document title included in the image is automatically extracted / registered as a keyword. In addition, management information such as title, destination, and source information can be automatically extracted from images of various documents including a table format document. For example, a title outside a table can be extracted with an accuracy of about 90%. I know.
[0004]
However, the extraction accuracy of the titles in the table is only about 55%, which is insufficient for practical use. To extract keywords such as titles in a table with high precision, it is necessary to accurately extract ruled lines constituting the table. Ruled line extraction technology has been developed mainly for forms in which characters and the like are regularly arranged.
[0005]
As a conventional ruled line extraction technique, there are an "image extraction method" (JP-A-6-309498) and an "image extraction device" (JP-A-7-28937). According to these techniques, it is possible to extract or remove a frame without having to input information such as the position of a frame in a form. A form that can be processed has a single character frame, a block frame (one horizontal line frame or a free format frame), or a table having a structure in which the outline of the frame is rectangular and the horizontal frame lines are regularly arranged. It is.
[0006]
Further, as the ruled line extraction technology of the prior application by the present applicant, “frame extraction device and rectangle extraction device” (Japanese Patent Application No. 7-203259), “pattern area cutout method and pattern extraction device” (Japanese Patent Application No. 7-282171). ) And "Pattern Extraction Apparatus and Pattern Area Extraction Method" (Japanese Patent Application No. 8-107568).
[0007]
According to these techniques, even if the outline of the frame is rectangular as shown in FIG. 48, or even if the outline of the frame is not rectangular as shown in FIG. 49, the extraction and removal of the frame can be performed. it can. Further, as in the shaded portion in FIG. 49, it is also possible to extract and remove a frame in a tabular form having a finer structure in a rectangle surrounded by the frame. The outline of the process is shown below.
[0008]
(1) Thinning: Vertical and horizontal line segments are thinned by mask processing to eliminate the difference in thickness between characters and frames.
(2) Line segment extraction: A relatively long straight line is extracted by using the adjacent projection method in "Image Extraction Method" (Japanese Patent Laid-Open No. 6-309498). The adjacent projection is a method in which the projection value of a pixel included in a row or column of interest is added to the projection value of a surrounding row or column, and the result is used as the final projection value of the row or column of interest. is there. According to this projection method, the pixel distribution around a specific row or column can be grasped globally.
[0009]
(3) Straight line extraction: The extracted line segments are searched in order, and it is checked whether there is a break of a certain length or more between the line segments. Line segments without such a break are sequentially integrated, and a long straight line is extracted.
[0010]
(4) Straight line integration: The extracted straight lines are integrated again. A straight line separated into two or more parts by blurring is integrated into one straight line.
(5) Straight line expansion: Only when it is known that the document is a regular form, the straight line shortened due to blurring is expanded and restored to its original length.
[0011]
[Problems to be solved by the invention]
However, the above-described ruled line extraction technique has the following problems.
In the technology of the prior application, the form of a form can be processed as long as it has a regular or irregular structure as long as it is a tabular frame composed of rectangular areas. Also, the ruled line that is the target can be processed regardless of whether it is blurred or not, whether it is a solid line or a dotted line. Further, only when it is known that the table is a regular table, a process of extending a straight line shortened by extreme blurring is performed.
[0012]
However, as shown in FIG. 50, a general input image includes an image in which characters are described in a bold font or a table has a shaded portion. In such a case, a ruled line may be erroneously extracted from a character string crushed due to contact between characters, and a correct ruled line and a erroneously extracted ruled line may be erroneously integrated.
[0013]
Further, a ruled line contacting a cluster of black pixels, such as a hatched portion, or a ruled line contacting a character cannot be extracted. In order to eliminate such inconveniences, it is desirable that only a tabular document such as a form having a known ruled line structure be processed.
[0014]
However, it is not known in advance what type of table is included in a general document handled by electronic filing, and there is a high possibility that various images including broken characters and the like are input. Therefore, there is a problem that it is not always possible to correctly extract ruled lines using the technique of the prior application.
[0015]
SUMMARY OF THE INVENTION An object of the present invention is to provide a ruled line extracting apparatus and method capable of correctly extracting a ruled line portion from a general document image whose ruled line structure cannot be predicted in advance.
[0016]
[Means for Solving the Problems]
FIG. 1 is a diagram illustrating the principle of a ruled line extracting apparatus according to the present invention. The ruled line extraction device of FIG. 1 includes the first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, and eleventh principles of the present invention and performs estimation. It comprises means 1, storage means 2, line segment extracting means 3, calculating means 4, straight line extracting means 5, graph generating means 6, straight line processing means 7, straight line integrating means 8, and straight line removing means 9.
[0017]
In the first principle, the estimating means 1 estimates the size of a standard pattern included in an input image. The straight line extracting means 5 sets a threshold value based on the information on the size of the standard pattern, and extracts information on one or more straight line patterns from the input image using the threshold value.
[0018]
The standard pattern corresponds to a pattern such as a character having a standard size most often included in the input image. As the standard pattern, for example, a pixel connection area representing a character is used, and as the size information, for example, the height or width of a circumscribed rectangle of the area is used.
[0019]
The linear pattern corresponds to a horizontal or vertical pattern extracted from an input image by mask processing using a horizontal or vertical mask and line segment integration processing. The information of the straight line pattern includes, for example, coordinate values of a circumscribed rectangle of a plurality of line segment patterns constituting the pattern. The line segment pattern corresponds to a line-shaped pixel region cut out from an image by mask processing.
[0020]
The straight line extracting means 5 determines various threshold values based on the size of the standard pattern, and classifies the straight line patterns in the image based on the threshold values. As a result, a straight line pattern derived from a shaded portion, a contact character, or the like can be excluded from ruled line candidates, and a correct ruled line candidate can be extracted.
[0021]
According to the second principle, the straight line extracting means 5 extracts information of one or more straight line patterns from the input image. The calculating means 4 calculates a representative value of the size of the one or more linear patterns. The straight line processing means 7 sets a threshold value based on the representative value, and processes the information of the one or more linear patterns using the threshold value.
[0022]
The calculating means 4 calculates a representative size of the straight line pattern from a histogram of the heights or widths of the plurality of straight line patterns, for example. The straight line processing means 7 can set a threshold value in the vicinity of the representative value and perform processing such as excluding a linear pattern having a larger size from the ruled line candidates, thereby extracting a correct ruled line candidate.
[0023]
According to the third principle, the straight line extracting unit 5 extracts information of one or more straight line patterns from the input image. The calculating means 4 calculates a representative value of the size of one or more line segment patterns constituting the one or more linear patterns. The straight line processing means 7 sets a threshold value based on the representative value, and processes the information of the one or more linear patterns using the threshold value.
[0024]
As described above, the line segment pattern corresponds to a line-shaped pixel region cut out from the image by the mask processing. The calculating means 4 obtains a representative size of the line segment pattern from a histogram of the heights or widths of the plurality of line segment patterns, for example. The straight line processing means 7 can perform processing such as excluding a straight line pattern composed of only line segment patterns larger than the threshold value based on the representative value from ruled line candidates, and can extract correct ruled line candidates.
[0025]
According to the fourth principle, the line segment extraction unit 3 extracts information of one or more line segment patterns from an input image. The storage unit 2 stores the information of the one or more line segment patterns separately into information of a large line segment pattern and information of a small line segment pattern. The straight line extraction unit 5 checks the connection state of the one or more line segment patterns, and when the large line segment pattern exists in the middle, regardless of the size of the large line segment pattern, other line segments. A straight line pattern formed by the pattern is extracted.
[0026]
The information of the line segment pattern includes, for example, the coordinate values of the circumscribed rectangle. The storage unit 2 adds specific attribute information to information on a line segment pattern larger than an appropriate threshold value, for example, and stores the information separately from information on other small line segment patterns. The straight line extracting means 5 ignores a large line segment pattern and extracts a small line segment pattern on both sides when integrating a plurality of overlapping line segment patterns and extracting a circumscribed rectangle as a straight line pattern. A process for appropriately connecting each other is performed.
[0027]
As a result, a straight line pattern that is not affected by the size of the large pixel area such as a shaded portion or a character can be extracted as a correct rule line candidate from the image of the ruled line.
[0028]
According to the fifth principle, the straight line extracting means 5 extracts information of one or more straight line patterns from the input image. When the two straight line patterns included in the one or more straight line patterns almost overlap, the straight line integrating unit 8 integrates the two straight line patterns into one.
[0029]
The straight line integrating unit 8 integrates two almost overlapping straight line patterns, thereby reducing redundant straight line information and extracting correct ruled line candidates.
According to the sixth principle, the straight line extracting means 5 extracts information of one or more straight line patterns from the input image. The straight line removing unit 9 is configured to output at least one of information on one of the one or more straight line patterns and information on a distance between two straight line patterns included in the one or more straight line patterns. The information is used to determine whether to remove one of the one or more linear patterns.
[0030]
The straight line removing unit 9 determines the likelihood of a ruled line of the straight line pattern based on, for example, the aspect ratio of the straight line pattern and the distance to the next straight line pattern, and removes a straight line pattern that is not like a ruled line. As a result, a straight line pattern derived from a shaded portion, a crushed character string, or the like can be excluded from ruled line candidates, and a correct ruled line candidate can be extracted.
[0031]
According to the seventh principle, the straight line extracting means 5 extracts information of one or more straight line patterns from the input image. The straight line removing unit 9 determines whether to remove one of the horizontal straight line pattern and the vertical straight line pattern based on the connection relationship between the horizontal straight line pattern and the vertical straight line pattern included in the one or more straight line patterns. .
[0032]
The straight line removing unit 9 excludes, for example, a vertical straight line pattern that does not contact any horizontal straight line pattern or a horizontal straight line pattern that does not contact any vertical straight line pattern from ruled line candidates. Thus, a straight line pattern derived from a crushed character string or the like can be excluded from ruled line candidates, and a correct ruled line candidate can be extracted.
[0033]
In the eighth principle, the straight line extracting unit 5 extracts information of one or more straight line patterns from an input image. The straight line removing unit 9 removes a shorter one of two almost linear pattern included in the one or more straight line patterns.
[0034]
The straight line removing unit 9 removes the shorter one of the two almost overlapping straight line patterns, so that redundant straight line information can be reduced and correct ruled line candidates can be extracted.
[0035]
In the ninth principle, the straight line extracting unit 5 extracts information of one or more straight line patterns from an input image. When the size of a straight line pattern obtained by integrating two partially overlapping straight line patterns of the one or more straight line patterns becomes approximately a predetermined value, the straight line integrating means 8 creates a ruled line Make it a candidate.
[0036]
For example, if the thickness of the straight line pattern formed by integrating the two straight line patterns is about the typical thickness of the straight line pattern, the straight line integrating means 8 executes the integration process. As a result, redundant straight line information can be reduced, and correct ruled line candidates can be extracted.
[0037]
In the tenth principle, the straight line extracting unit 5 extracts information of one or more straight line patterns from an input image. The straight line removing means 9 removes a straight line pattern composed of only line segment patterns larger than the threshold value from the one or more straight line patterns.
[0038]
The straight line removing means 9 excludes, for example, a straight line pattern composed of only line segment patterns that are considerably thicker than the typical line segment pattern from ruled line candidates. Thus, a straight line pattern derived from a crushed character string or the like can be excluded from ruled line candidates, and a correct ruled line candidate can be extracted.
[0039]
In the eleventh principle, the straight line extracting unit 5 extracts information on a straight line pattern from an input image. The graph generation means 6 obtains the number of pixels inside a standard size line segment pattern from one or more line segment patterns constituting the straight line pattern, and obtains a graph of the number of pixels around the straight line pattern. Generate The straight line removing unit 9 determines whether to remove the straight line pattern based on the shape of the graph.
[0040]
The graph generation means 6 generates a set of line segment patterns of a standard size, for example, excluding a large line segment pattern from the set of line segment patterns forming a straight line pattern. Then, they are shifted to the area around the linear pattern, and a graph representing the relationship between the shift amount and the number of pixels is generated. Further, for example, when the shape of the graph is gentle and the maximum value is not clear, the straight line removing unit 9 removes the straight line pattern from the ruled line candidates.
[0041]
In the case of a straight line pattern extracted from the inside of a shaded portion, a crushed character string, or the like, pixels are often distributed evenly around the pattern. In such a case, the shape of the graph becomes smooth and the straight line pattern is excluded from the ruled line candidates, so that a correct ruled line candidate can be extracted.
Another ruled line extracting device of the present invention includes an estimating unit 1, a straight line extracting unit 5, and a straight line removing unit 9. The estimating means 1 estimates the size of the standard pattern, using a pattern of a standard size that is often included in the input image as a standard pattern. The straight line extracting unit 5 extracts information of one or more straight line patterns from the input image. Then, the straight line removing unit 9 sets a threshold value of the thickness or length of the straight line pattern based on the information of the size of the standard pattern, and the one or more straight line patterns is thicker than the threshold value of the thickness. Extract straight line patterns of ruled line candidates by removing straight line patterns or straight line patterns shorter than the length thresholdThen, when one of the two adjacent straight lines among the straight line patterns of the ruled line candidate is shorter than the length threshold value, the processing of removing the straight line pattern, or the distance between the two adjacent straight line patterns Is smaller than another threshold value based on the size of the standard pattern, a process of removing one of the linear patterns is performed.
Further, still another ruled line extracting apparatus of the present invention includes an estimating unit 1, a straight line extracting unit 5, and a straight line removing unit 9. The estimating means 1 estimates the size of the standard pattern, using a pattern of a standard size that is often included in the input image as a standard pattern. The straight line extracting unit 5 extracts information of one or more straight line patterns from the input image. Then, the straight line removing unit 9 sets a threshold value of the thickness or length of the straight line pattern based on the information of the size of the standard pattern, and the one or more straight line patterns is thicker than the threshold value of the thickness. By removing a straight line pattern or a straight line pattern shorter than the length threshold value, a straight line pattern of the ruled line candidate is extracted, and the distance between two adjacent horizontal straight line patterns in the straight line pattern of the ruled line candidate is equal to the size of the standard pattern. If it is smaller, the connection relationship between the horizontal straight line pattern and the vertical straight line pattern is checked for each of the horizontal straight line patterns, the horizontal straight line pattern is removed based on the connection relationship, and the adjacent straight line patterns in the ruled line candidate are adjacent to each other. When the distance between two vertical straight line patterns is smaller than the size of the standard pattern, the vertical straight line pattern is applied to each of those vertical straight line patterns. Examine the connection of the lateral linear pattern, removing the vertical straight line pattern based on the connection relationship.
Further, still another ruled line extracting apparatus of the present invention includes an estimating unit 1, a straight line extracting unit 5, and a straight line removing unit 9. The estimating means 1 estimates the size of the standard pattern, using a pattern of a standard size that is often included in the input image as a standard pattern. The straight line extracting unit 5 extracts information of one or more straight line patterns from the input image. Then, the straight line removing unit 9 sets a threshold value of the thickness or length of the straight line pattern based on the information of the size of the standard pattern, and the one or more straight line patterns is thicker than the threshold value of the thickness. By removing the straight line pattern or the straight line pattern shorter than the length threshold, the straight line pattern of the ruled line candidate is extracted, and the distance between two straight line patterns almost overlapping in the straight line pattern of the ruled line candidate is equal to the size of the standard pattern. If it is smaller, the shorter one of those linear patterns is removed.
Further, still another ruled line extracting device of the present invention includes an estimating means 1, a calculating means 4, a straight line extracting means 5, a straight line integrating means 8, and a straight line removing means 9. The estimating means 1 estimates the size of the standard pattern, using a pattern of a standard size that is often included in the input image as a standard pattern. The straight line extracting unit 5 extracts information of one or more straight line patterns from the input image. The straight line removing means 9 sets a threshold value of the thickness or length of the straight line pattern based on the information on the size of the standard pattern, and sets a straight line pattern larger than the thickness threshold value from the one or more straight line patterns. Alternatively, a straight line pattern of a ruled line candidate is extracted by removing a straight line pattern shorter than the length threshold value. The calculating means 4 calculates a representative value of the size of the one or more linear patterns. When the size of a straight line pattern obtained by integrating two partially overlapping straight line patterns among the straight line patterns of the ruled line candidates is approximately the representative value, the straight line integrating means 8 converts the straight line pattern after integration into a ruled line. Make it a candidate.
Further, still another ruled line extracting device according to the present invention includes an estimating unit 1, a straight line extracting unit 5, A removing unit 9 is provided. The estimating means 1 estimates the size of the standard pattern, using a pattern of a standard size that is often included in the input image as a standard pattern. The straight line extraction unit 5 extracts one or more line segment patterns by removing oblique components from the input image by mask processing using a horizontally long or vertically long mask, and integrates the extracted line segment patterns to form a straight line pattern. By generating, information of one or more linear patterns is extracted from the input image. Then, the straight line removing unit 9 sets a threshold value of the thickness or length of the straight line pattern based on the information of the size of the standard pattern, and the one or more straight line patterns is thicker than the threshold value of the thickness. By removing a straight line pattern or a straight line pattern shorter than the length threshold, a straight line pattern of a ruled line candidate is extracted.
Further, still another ruled line extracting device of the present invention includes an estimating unit 1, a calculating unit 4, a straight line extracting unit 5, and a straight line removing unit 9. The estimating means 1 estimates the size of the standard pattern, using a pattern of a standard size that is often included in the input image as a standard pattern. The straight line extracting unit 5 extracts information of one or more straight line patterns from the input image. The calculating means 4 calculates a representative value of the size of one or more line segment patterns constituting the one or more linear patterns. Then, the straight line removing unit 9 sets a threshold value of the thickness or length of the straight line pattern based on the information of the size of the standard pattern, and the one or more straight line patterns is thicker than the threshold value of the thickness. By removing a straight line pattern or a straight line pattern shorter than the length threshold, a straight line pattern of the ruled line candidate is extracted, and a threshold value of the line segment pattern is set based on the representative value. , A straight line pattern composed of only line segment patterns larger than the threshold value of the line segment pattern is removed.
Further, still another ruled line extraction device of the present invention includes an estimation unit 1, a storage unit 2, a straight line extraction unit 5, and a straight line removal unit 9. The estimating means 1 estimates the size of the standard pattern, using a pattern of a standard size that is often included in the input image as a standard pattern. The storage unit 2 stores information of one or more line segment patterns separately into information of line segment patterns having a thickness larger than the threshold and information of small line segment patterns other than the large line segment patterns. The straight line extraction unit 5 checks the connection state of one or more line segment patterns, and when a large line segment pattern exists in the middle, regardless of the size of the large line segment pattern, By extracting the constituent linear patterns, information on one or more linear patterns is extracted from the input image. Then, the straight line removing unit 9 sets a threshold value of the thickness or length of the straight line pattern based on the information of the size of the standard pattern, and the one or more straight line patterns is thicker than the threshold value of the thickness. By removing a straight line pattern or a straight line pattern shorter than the length threshold, a straight line pattern of a ruled line candidate is extracted.
Further, still another ruled line extracting apparatus of the present invention includes an estimating unit 1, a straight line extracting unit 5, a graph generating unit 6, and a straight line removing unit 9. The estimating means 1 estimates the size of the standard pattern, using a pattern of a standard size that is often included in the input image as a standard pattern. The straight line extracting unit 5 extracts information of one or more straight line patterns from the input image. The straight line removing means 9 sets a threshold value of the thickness or length of the straight line pattern based on the information on the size of the standard pattern, and sets a straight line pattern larger than the thickness threshold value from the one or more straight line patterns. Alternatively, a straight line pattern of a ruled line candidate is extracted by removing a straight line pattern shorter than the length threshold value. The graph generating means 6 generates one or more line segment rectangles representing a line segment pattern of a standard size among one or more line segment patterns constituting one straight line pattern among the straight line patterns of the ruled line candidates. The process of obtaining the total number of black pixels inside one or more line segment rectangles at each shift position while shifting vertically around the length of the straight line pattern around the straight line pattern is repeated. By plotting the sum of the number of pixels for each shift position, a graph representing the relationship between the shift amount of the line segment rectangle around the linear pattern and the sum of the number of black pixels is generated. Then, the straight line removing unit 9 determines whether to remove the straight line pattern based on the shape of the graph.
[0042]
For example, the storage unit 2 in FIG. 1 corresponds to the memory 32 in FIG. 3 described later, and includes an estimation unit 1, a line segment extraction unit 3, a calculation unit 4, a line extraction unit 5, a graph generation unit 6, a line processing unit 7, The straight line integrating means 8 and the straight line removing means 9 correspond to the CPU (central processing unit) 31 and the memory 32.
[0043]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
At present, a form learning system for tabular documents is being developed in order to automatically extract keywords such as titles in tables with high accuracy. In this system, a document including a table is registered in advance, and a correct keyword can be extracted later with high accuracy from the registered document. INDUSTRIAL APPLICABILITY The present invention can be used to correctly extract a ruled line from a document image when learning a form of a tabular document.
[0044]
In the present invention, the conventional and prior application ruled line extraction technology for forms is improved, and information on small lines constituting the ruled line is utilized to extract erroneously extracted lines from the original ruled line and character strings. Distinguish from a straight line. Thus, even when a character is in contact with a ruled line, the ruled line can be correctly extracted.
[0045]
Further, even if there is a line segment extracted from a collapsed portion in the table, a ruled line candidate is obtained by paying attention only to the line segment extracted from the original ruled line. Then, only the correct ruled line is extracted from the ruled line shape, positional relationship, and the distribution of black pixels of the line segment inside the ruled line.
[0046]
In the following embodiments, there is one or more frames whose size, position, and inclination are not known, and various characters including characters that touch the frame and characters that protrude from the frame are written on those frames. Target documents. Then, consider a case where a frame is extracted from an image of such a document.
[0047]
FIG. 2 is a functional block diagram of the ruled line extraction device according to the embodiment. In FIG. 2, a target input pattern 11 is a binary image after an extreme inclination or rotation has been corrected. The shaded processing blocks mainly represent processes different from those of the prior application such as “pattern extraction device and pattern region cutting method” (Japanese Patent Application No. 8-107568).
[0048]
First, after the reduction processing unit 12 reduces the image and the connection pattern extraction unit 13 extracts the connection pattern, the ruled line extraction device calculates the mode value of the rectangular height (processing P1), and the mask processing unit 14 determines Perform the conversion.
[0049]
Next, the horizontal line extraction unit 15 performs horizontal adjacent projection (process P2), horizontal line segment detection (process P3), horizontal line segment integration (process P4), and horizontal line search (process P5). Performs horizontal dotted line detection (process P6). Next, the vertical straight line extraction unit 16 performs vertical adjacent projection (process P7), vertical line segment detection (process P8), vertical line segment integration (process P9), and vertical line search (process P10). The extraction device performs vertical dotted line detection (process P11).
[0050]
Next, the ruled line extraction device calculates the mode of the height of the horizontal line (process P12), calculates the mode of the width of the vertical line (process P13), and calculates the mode of the height of the horizontal line. Is calculated (process P14), and the mode of the width of the vertical line is calculated (process P15). Next, completely overlapping straight lines are integrated (process P16), and unnecessary straight lines are removed based on the shape of the straight rectangle or the distance to the next straight rectangle (process P17). Next, unnecessary straight lines are removed based on the connection relationship between the vertical and horizontal straight lines (process P18), and partially overlapping straight lines are integrated (process P19).
[0051]
Next, the ruled line extraction device removes a straight line that almost completely overlaps with another straight line (process P20), and removes a straight line consisting only of a line segment larger than a predetermined threshold (process P21). Then, a mark is added to a line segment larger than another threshold value (process P22), a straight line is checked while shifting the target line segment, an unnecessary straight line is removed (process P23), and the remaining straight line is removed. Is output.
[0052]
The ruled line extraction device of the present embodiment is realized by, for example, an information processing device (computer) as shown in FIG. 3 includes a CPU 31, a memory 32, an input device 33, an output device 34, an external storage device 35, a medium drive device 36, a network connection device 37, and a photoelectric conversion device 38. Are connected to each other.
[0053]
The CPU 31 executes a program stored in the memory 32 to perform each processing shown in FIG. As the memory 32, for example, a ROM (read only memory), a RAM (random access memory), or the like is used. The memory 32 stores the above-described programs and data necessary for processing.
[0054]
The input device 32 corresponds to, for example, a keyboard, a pointing device, or the like, and is used for inputting a request or instruction from a user. The output device 34 corresponds to a display device, a printer, or the like, and is used for outputting a processing result or the like.
[0055]
The external storage device 35 is, for example, a magnetic disk device, an optical disk device, a magneto-optical disk device, or the like. The above-described program and data can be stored in the external storage device 35, and can be used by loading them into the memory 32 as needed. The external storage device 35 is also used as a database of an electronic filing system for storing images, keywords, and the like.
[0056]
The medium driving device 36 drives the portable recording medium 40 and can access the stored contents. As the portable recording medium 40, any computer-readable recording medium such as a memory card, a floppy disk, a compact disk read only memory (CD-ROM), an optical disk, and a magneto-optical disk can be used. The above-described program and data are stored in the portable recording medium 40, and can be used by loading them into the memory 32 as needed.
[0057]
The network connection device 37 is connected to an arbitrary communication network such as a LAN (local area network), performs data conversion accompanying communication, and communicates with an external information provider database 40 ′. As a result, the ruled line extracting apparatus can receive the above-mentioned programs and data from the database 40 'via the network as needed, and load them into the memory 32 for use.
[0058]
The photoelectric conversion device 38 is, for example, an image scanner, and inputs a general document image to be processed.
In the memory 32, data necessary for processing is managed in a structure as shown in FIG. 4, for example. In FIG. 4, the information 41 of one input image includes the number of tables (table type frames) included in the image and information 42 for each table.
[0059]
Each table information 42 includes coordinate values of a circumscribed rectangle of the table, the number of cells included in the table, information 43 for each cell, the number of horizontal straight lines (horizontal straight lines) included in the table, information 44 for each horizontal straight line, The table includes the number of vertical straight lines (vertical straight lines) included in the table and information 44 for each vertical straight line. Here, the cell represents an area surrounded by ruled lines at the top, bottom, left and right.
[0060]
Further, each cell information 43 includes a coordinate value of a cell, and each straight line information 44 includes coordinate values of a rectangle representing a straight line, attribute information of the straight line, the number of small line segments included in the straight line, and information for each small line segment. 45, and the serial number of the straight line in the entire image. Each piece of line segment information 45 includes attribute information of the line segment and coordinate values of a rectangle representing the line segment. The attribute information of a straight line and a small line segment is used, for example, to distinguish between a solid line and a broken line, or to distinguish a wildcard line segment whose height or width exceeds a certain value from another line segment.
Next, each process of FIG. 2 will be described in order with reference to FIGS.
[0061]
When the image of the input pattern 11 has a certain resolution or higher and the size of the image is relatively large, the reduction processing unit 12 performs image reduction processing to increase the processing efficiency. The input original image is stored as it is.
[0062]
In order to stably pick up each pattern without depending on the relative relationship between the positions at which the plurality of tables are arranged, the connection pattern extraction unit 13 extracts a black pixel connection area connected by eight connections in the up, down, left, and right directions. The pattern is extracted by labeling. Then, these partial patterns are determined, and a table pattern included in the image is extracted.
[0063]
Since the size of the partial pattern obtained by labeling is required later, the connection pattern extracting unit 13 calculates the coordinates of the corners of the circumscribed rectangle approximating the partial pattern during the labeling process. Then, among the extracted partial patterns, a pattern having a certain size or more is extracted as a table candidate.
[0064]
When a large connection pattern is extracted, patterns that are inside the large connection pattern and have a certain size or more are also extracted at the same time, and those large and small patterns are treated as patterns having the same label. By doing so, when a pattern that originally represents one table is separated into two or more patterns by blurring, it becomes possible to process these as patterns belonging to the same label. Hereinafter, the allowable blur length will be calculated based on the size of the target pattern.
[0065]
FIG. 5 shows an example of the labeling process as described above. In the image as shown in FIG. 5A, the connection pattern extraction unit 13 first extracts the pattern 51 having the largest circumscribed rectangle, and adds a label to it. Next, since the horizontal line pattern 56 between the pattern 52 and the pattern 57 has a certain width or more, it is regarded as a part of the large pattern 51, and the following processing is performed as shown in FIG. Now treat these as patterns with the same label. Therefore, the same label as the pattern 51 is added to the pattern 56.
[0066]
Next, in the process P1, the ruled line extracting apparatus uses the method of the previous application “Device and method for extracting title from document image” (Japanese Patent Application No. 07-341983) to extract the rectangle extracted by the connected pattern extracting unit 13. A histogram representing the frequency distribution of the height of is obtained. And the mode value most freq height is obtained, and is estimated as the size of a standard character included in the document. The obtained mode value is used for setting various threshold values in the following processing. The calculation process of the mode is performed as follows.
[0067]
First, a histogram of rectangular height as shown in FIG. 6 is created from a set of circumscribed rectangles as a result of labeling. In FIG. 6, the horizontal axis represents the height of each circumscribed rectangle, and the vertical axis represents the number (frequency value) of rectangles having that height. Here, the height of the circumscribed rectangle is determined using the height of one pixel as a unit height.
[0068]
Next, the correspondence between the frequency value and the maximum height among the rectangular heights having the frequency value is determined, and is stored in the memory 32 as a rectangular height table. Then, the table is examined in order from the frequency value 0, and when the change in the frequency value is continuous within 1 and the total change in the frequency values is equal to or more than the predetermined value, , The highest of these consecutive heights is the mode value most of the rectangular height freq height.
[0069]
FIG. 7 shows a histogram representing the contents of the rectangular height table corresponding to the histogram of FIG. In FIG. 7, it can be seen that the height at which the frequency value changes abruptly is the mode. By obtaining the mode value in this manner, the influence of noise smaller than one character can be eliminated, and the height of a character having a standard size included in the document can be obtained.
[0070]
FIG. 8 shows a simple example of a rectangular height table. In FIG. 8, four frequency values and the maximum height among rectangular heights having each frequency value are stored in pairs. FIG. 9 shows a histogram of the contents of the rectangular height table in order to obtain the mode.
[0071]
When the histogram of FIG. 9 is viewed in order from a place where the frequency value is low, that is, from a place where the height is high, the frequency values change by 5, 5, and 7 at positions where the height is 10, 9, and 8, respectively. You can see that. The difference between these successive heights is 1 and the total change in frequency value is 17. Assuming that the threshold value of the change in the frequency value is 9, the sum of the changes in the frequency values at the heights 10, 9, and 8 is greater than that. freq height.
[0072]
Next, the mask processing unit 14 extracts a connection pattern having a certain size or more extracted by the connection pattern extraction unit 13 and a connection pattern having a certain size or more existing therein (the same label as the former). ) And are candidates for the table. Then, a mask process is performed by using the method of the prior application “frame extraction device and rectangle extraction device” (Japanese Patent Application No. 7-203259).
[0073]
This mask processing is performed in order to eliminate an extremely oblique component from an image and to easily extract a long straight line existing only in a table. Specifically, the mask processing unit 14 scans the entire image using two types of mask rectangles of a predetermined size, a horizontally long image and a vertically long image. Calculate the proportion of the pattern of black pixels in the mask, and if it is a certain value or more, fill the entire area in the mask with black pixels and leave it as a pattern. Delete the pattern in. Thus, the vertical and horizontal components are extracted.
[0074]
Here, when a plurality of rows or columns continue and the above ratio reaches a predetermined threshold value or more, the continuous patterns are combined to form a large rectangular range, and the center line thereof is set as a processing result. Thereby, a thick pattern is thinned. Further, in order to prevent a gap between the line segment patterns resulting from the processing from being opened, the application range of the mask is set so as to overlap each other. The original image before the mask processing is stored separately from the image after the mask processing.
[0075]
FIG. 10 shows the result of performing the mask processing on the two patterns 51 and 56 shown in FIG. 5B. In this case, the image before the processing shown in FIG. 10A is converted as shown in FIG. In FIG. 10B, only the vertical and horizontal components of the patterns 51 and 56 are extracted, and the entire pattern is thinned. Further, as a result of supplementing some patterns in the mask processing, it can be seen that the patterns 51 and 56 are connected.
[0076]
Next, in process P2, the horizontal straight line extraction unit 15 calculates a projection value for the mask processing image of the partial pattern as shown in FIG. 10B by using the conventional adjacent projection method. Then, in process P3, a horizontal line segment or a part of the horizontal line having a certain length is approximated by a rectangle as shown in FIG. 11 and detected. In these processes, a mask processed image is used, but in the following processes, an original image is used.
[0077]
Next, in process P4, the horizontal straight line extraction unit 15 examines a connection state between the line segments, and extracts a straight line formed by some line segments as ruled line candidates. In this processing, as shown in FIG. 12, neighboring rectangular line segments among the detected rectangular line segments are integrated to detect a long straight line, and the detected straight line is approximated by its circumscribed rectangle.
[0078]
When integrating the line segments, as shown in FIG. 13, if there is a certain thick line segment (wild card) 61 in the middle, it is ignored and only the thin line segment excluding the thick line segment is removed. Perform integration as a target. Whether a certain line segment is a wild card is distinguished by the attribute information described in the line segment information 45 of FIG. As described above, when there is a large line segment, a straight line including the large line segment is not output, but integration processing is performed so that the large line segment is not reflected on the straight line.
[0079]
As a result, even if there is a pattern such as a shaded portion or a character or a figure in contact with the ruled line, it is possible to extract only the ruled line excluding the pattern. The details of such integration processing will be described later. As shown in FIG. 4, the information on the straight line extracted as a result of the integration includes information on each line segment constituting the straight line.
[0080]
Next, in the process P5, the horizontal straight line extraction unit 15 searches for a pattern (pixel) in the straight line as shown in FIG. 14 in order to accurately detect the left and right ends of the rectangular straight line. . If there is a portion (blank) having no pixels in the traveling direction during the search, the search is continued in the traveling direction on the assumption that there are pixels up to a certain number of pixels. If a blank exists beyond a certain number of pixels, the search is terminated with that position as an end point. In the following processing, the end point detected by the search is used as the end point of the straight line.
[0081]
Next, in process P6, the ruled line extraction device extracts a horizontal dotted line by using the method of the "frame extraction device and rectangle extraction device" of the prior application (Japanese Patent Application No. 7-203259). In this process, partial patterns having a certain size and regularly arranged are searched for, and the positions of the dotted lines are represented by surrounding these patterns with rectangles.
[0082]
In the following processing, the rectangle indicating the position of the dotted line is treated in the same manner as the rectangle indicating the position of the already detected straight line. However, the attribute information of the straight line corresponding to the dotted line is set to the attribute of the broken line, and the attribute information of the straight line corresponding to the solid line is set to the attribute of the solid line, so that the two are distinguished.
[0083]
The processes P7, P8, P9, and P10 of the vertical straight line extraction unit 16 and the vertical dotted line detection process P11 are the same as those for the horizontal straight line and the horizontal dotted line described above.
Next, in process P12, the ruled line extraction device calculates a representative value of the horizontal straight line height. In this process, a histogram of the heights of the extracted horizontal straight lines is created, and the most frequent height is set as a mode value mfheight of the horizontal straight line height, and this is used as a representative value of the horizontal straight line height. Similarly, in process P13, a representative value (mode value) mfwidth of the vertical straight line width is calculated.
[0084]
These representative values are used to set various threshold values in the following processing. As a representative value of the horizontal straight line height / the vertical straight line width, an appropriate value other than the above-described mode may be used instead.
[0085]
Next, in process P14, the ruled line extraction device calculates a representative value of the horizontal line segment height. In this process, a histogram of the heights of all the horizontal line segments forming all the horizontal straight lines in the image is created, and the most frequent height is determined as the mode value mfheight of the horizontal line segment height. small, which is used as a representative value of the horizontal line segment height. Similarly, in process P15, the mode mfwidth of the width of all the vertical line segments forming all the vertical straight lines Calculate small.
[0086]
These representative values are also used for setting various threshold values in the following processing. Further, as a representative value of the horizontal line segment height / the vertical line segment width, an appropriate value other than the above-mentioned mode may be used instead.
[0087]
Next, in process P16, the ruled line extraction device integrates completely overlapping straight lines. In this process, when one straight line almost completely overlaps another straight line, they are integrated into one. For example, in the two overlapping straight lines 62 and 63 as shown in FIG. 15, if the height H1 of the non-overlapping portion is within a certain allowable number of pixels INTEGDOT, these are regarded as completely overlapping and one straight line Merge into rectangle 64. The value of INTEGDOT is set to 2, for example.
[0088]
Next, in process P17, the ruled line extraction device removes unnecessary straight lines based on the shape of the straight rectangles and the distance between adjacent straight rectangles. Regarding the processing of the horizontal straight line, first, the height threshold th hei and length threshold th len is calculated by the following equations.
th hei = most freq height * 2/3 (1)
th len = most freq height * 5 (2)
Then, in the following four cases, the corresponding horizontal straight line is deleted.
(A) When the aspect ratio (height / width) of the horizontal straight rectangle is equal to or greater than the threshold value FTH (= 0.11).
(B) The aspect ratio of the horizontal straight-line rectangle is equal to or more than the threshold value FTH2 (= 0.04), and the height of the horizontal straight-line rectangle is the threshold value th of the height. hei or more.
(C) The width of the horizontal rectilinear rectangle is the length threshold th If less than len.
(D) The width of the nearest horizontal straight line below the current horizontal straight line is the length threshold th. If less than len.
[0089]
For example, in FIG. 16, the straight line 67 is deleted because it corresponds to the case (a), the straight line 68 is deleted because it corresponds to the case (b), and the straight line 69 is deleted because it corresponds to the case (c). Is done. If the straight line 65 is a current horizontal straight line, the straight line 66 is deleted because it corresponds to the case of (d).
[0090]
Furthermore, the distance between two adjacent straight lines is most freq If it is smaller than the threshold obtained from the height, one of the straight lines (for example, the shorter one) is removed. The same applies to the processing of the vertical straight line.
[0091]
Next, in process P18, the ruled line extracting device removes some unnecessary straight lines based on the connection relationship between the vertical and horizontal straight lines. Regarding the processing of the horizontal straight line, first, when the end point of the horizontal straight line rectangle of interest does not touch any vertical straight line rectangle, the horizontal straight line rectangle is deleted. As a result, straight lines that do not form a table frame, for example, isolated straight lines extracted from crushed and connected character strings are removed.
[0092]
For example, in FIG. 17, since two end points 74 and 75 of the horizontal straight line 70 are in contact with the vertical straight lines 71 and 72, respectively, this straight line 70 is not deleted, and the horizontal straight line 73 is not in contact with any of the vertical straight lines. Deleted. The same applies to the processing of the vertical straight line.
[0093]
However, in such a removal process, a straight line that should be originally left may be removed due to the influence of a character pattern or the like of an image. For example, in the image as shown in FIG. 18, the end points 77 and 78 of the vertical straight line 76 are not in contact with any horizontal straight line. Therefore, the vertical straight line 76 is deleted even though it constitutes a table frame. I will.
[0094]
Therefore, in order to leave a necessary straight line, the target of the removal processing is limited to two straight lines that are close to each other. In this case, first, the rectangle is located below the current horizontal straight line rectangle i, and the distance to the rectangle i is the mode value most of the rectangle height most. freq A horizontal straight-line rectangle j smaller than height is obtained.
[0095]
For each of these horizontal straight-line rectangles i and j, if the end point of the rectangle does not touch any of the vertical straight-line rectangles, and if the end point of any of the vertical straight-line rectangles does not touch the rectangle, the horizontal straight-line rectangle Remove. The same applies to the processing of the vertical straight line. If such a removal process is performed, the vertical straight line 76 in FIG. 18 does not become a processing target, and thus remains without being deleted.
[0096]
Also, in FIG. 19, first, adjacent horizontal straight lines 79 and 80 are targeted. However, since the end points of these horizontal straight lines 79 and 80 are in contact with the vertical straight line 82, the horizontal straight lines 79 and 80 are not deleted. Next, a horizontal straight line 81 adjacent to the horizontal straight line 80 is targeted, and this horizontal straight line 81 is deleted because it is not in contact with any vertical straight line. Further, of the adjacent vertical straight lines 83 and 84, the vertical straight line 83 is left because the end point is in contact with the horizontal straight line 79, and the vertical straight line 84 is deleted because it is not in contact with any horizontal straight line.
[0097]
Next, in process P19, the ruled line extraction device integrates partially overlapping straight lines. In this process, the horizontal straight lines are first sorted in ascending order of width (length). Next, one or more straight lines partially overlapping the straight line i are obtained by focusing on one straight line i in the order of the length.
[0098]
Then, when a partially overlapping straight line is virtually merged with the straight line i to form one straight rectangle, if the height is equal to or less than a threshold value (mfheight + THDOT), the merging is executed. The value of THDOT is set to 2, for example. Thereby, when the result of integrating the straight lines is about the most frequent height value mfheight, they are integrated into one. The same applies to the processing of the vertical straight line.
[0099]
In FIG. 20, the straight line 85 and the straight line 86 partially overlap, and the straight line 86 and the straight line 87 partially overlap. Among these, when the straight line 85 and the straight line 86 are integrated, the height of the integrated rectangle exceeds the threshold value. Therefore, only the straight line 86 and the straight line 87 are integrated and approximated by their circumscribed rectangle 88. The same applies to the processing of the vertical straight line.
[0100]
Here, the reason why such a straight line integration process is performed is that a plurality of line segment rectangles originally extracted from a single straight line pattern may not be completely integrated only by the processes P4 and P9. . For example, in the case of two overlapping horizontal straight lines 89 and 90 as shown in FIG. 21, the line segment rectangles (hatched portions) included in the two are separated from each other. . Even in such a case, according to the process P19, both can be integrated.
[0101]
Next, in process P20, the ruled line extraction device removes the shorter one of the two lines that almost completely overlap. In this process, regarding the horizontal straight line, first, one horizontal straight line rectangle is sorted in order of the length. Next, one horizontal straight-line rectangle i is extracted one by one in the longest order, and attention is paid to another horizontal straight-line rectangle j that partially overlaps the horizontal straight-line rectangle i. At this time, a line having a vertical relationship between the straight line i and the straight line j as shown in FIG. 22 is to be processed. In FIG. 22, when a straight line 91 is a straight line i, straight lines 92 and 93 correspond to a straight line j.
[0102]
Next, a range in which the straight line i and the straight line j overlap in the horizontal direction is determined. When the ratio len3 / len2 of the length len3 and the horizontal width len2 of the straight line j is larger than the threshold OVERRATE, the straight line j is determined. Is performed as a deletion candidate, and the following processing is performed. However, the value of OVERRATE shall be smaller than 1.
[0103]
First, a vertical distance between the straight line i and the straight line j is obtained. In this case, the difference between the coordinate values of the straight line i and the straight line j may be used as the distance. In consideration of the case where the straight line is inclined, the distance between the small line segment rectangles in these straight lines is defined as the distance between the straight lines. I will do it. How to obtain such a distance value will be described with reference to FIG.
[0104]
In FIG. 23, assuming that the horizontal direction is the x-axis and the vertical direction is the y-axis, the straight line i and the straight line j overlap in the horizontal direction in a section of length len3 from the position of x = xminkukan to the position of x = xmaxkukan. And each has a plurality of line segments inside.
[0105]
First, the ruled line extraction device extracts, from the set of line segments in the straight line i, the line segment determined to be not a wild card in the line segment integration process P4, which first overlaps the overlapping portion, and uses it as a reference. It is a line segment. Here, the line segment 94 is the reference line segment. Then, the x coordinate (xmin1, xmax1) of the reference line segment 94 is obtained.
[0106]
Next, with respect to a set of line segments in the straight line j, all the line segments whose x coordinate ranges from xmin1 to xmax1 are extracted. Then, the average value of the distance in the y direction between the extracted line segment and the reference line segment 94 in the straight line i is obtained, and the average value is set as the distance value between the straight line i and the straight line j.
[0107]
Here, since the corresponding line segment in the straight line j is only the line segment 95, the distance d between the line segment and the reference line segment 94 is the distance value between the straight line i and the straight line j. By such a calculation method, a correct distance between straight lines can be obtained even when the straight lines are inclined.
[0108]
The ruled line extraction device determines whether or not to delete the straight line j based on the distance between the straight line i and the straight line j thus obtained. First, when the straight line j is above the straight line i as in the straight line 92 in FIG. 22, if the distance between them is within the threshold OVERDOT, the straight line j is deleted. The value of OVERDOT is set to 1, for example. Further, when the straight line j is below the straight line i as in the straight line 93, the distance between them is equal to the threshold most. freq If it is smaller than height, the straight line j is deleted.
[0109]
Next, in process P21, the ruled line extraction device removes a straight line composed of only line segments larger than a certain threshold value. In this process,ofThe height of the line segment is a threshold (mfheight If smaller than (small * 2-1), the line is regarded as a line erroneously extracted from the character string and deleted. The same applies to the processing of the vertical straight line.
[0110]
Next, in the processes P22 and P23, if the line segment rectangle forming the straight line rectangle is larger than the threshold in the processes P22 and P23, the ruled line extraction device attaches a mark to the information of the line segment rectangle and outputs the line segment rectangle without the mark. The sum of black pixels inside is calculated. At this time, a set of line segment rectangles with no mark is moved in a direction perpendicular to the length direction of the straight rectangle, and a graph representing the relationship between the shift amount and the total number of black pixels is created. Then, when the shape of the graph is gentle, the straight line rectangle is excluded from ruled line candidates.
[0111]
The ruled line extracting apparatus first performs preprocessing for processing P23 in processing P22. In this processing, the height of the line segment in the horizontal straight line is determined by the threshold value mfheight. If it is larger than small, the attribute information of the line segment is set as a wild card so as not to be used in the process P23. The same applies to the processing of the vertical straight line.
[0112]
Next, in process P23, a straight line check / removal process by line segment shift is performed. In this process, first, the total sum of the number of black pixels in a plurality of horizontal line segment rectangles forming one horizontal straight line rectangle is determined, and is set as the total number of black pixels at the position of the shift amount 0 (center position). Next, the line segment rectangle is shifted up and down in the direction (vertical direction) perpendicular to the length direction of the horizontal straight line rectangle by the height of the horizontal straight line rectangle, and the total number of black pixels at each position is obtained. Create a graph of the total number of black pixels for.
[0113]
When the distribution of the total number of black pixels at positions separated in both the upper and lower directions is less than a certain ratio with reference to the maximum value of the total number of black pixels near the center position, the linear rectangle is regarded as a ruled line and output. . In other cases, the straight-line rectangle is a straight line erroneously extracted from a character string or the like and is not a ruled line, and is deleted. The same applies to the processing of the vertical straight line.
[0114]
For example, in the case of the image shown in FIG. 50, a graph as shown in FIG. 24 is created. In FIG. 24, graphs 96 and 97 represent the distribution of black pixels around the corresponding horizontal straight line. At this time, assuming that the height of the horizontal straight line is height, each line segment in the horizontal straight line is shifted one pixel at a time in a +/- height section in the y direction, and the total number of black pixels in the line segment at each shift position is Are plotted.
[0115]
In the case of the graph 96, the maximum value Peak of the total number of black pixels is located at the position of the shift amount 0, and the distribution of the total number of black pixels is below the value of THSHFT times Peak as above and below. Here, the value of THSHIFT is set to, for example, 0.44. Such a distribution indicates that black pixels are concentrated at the position of the shift amount 0, and the horizontal straight line corresponding to the position is regarded as a ruled line.
[0116]
On the other hand, in the case of the graph 97, the distribution of the total number of black pixels in the section of +/- height is gentle, and does not fall below the value of THSHFTFT times Peak even above and below the position of the shift amount 0. Such a distribution indicates that black pixels are scattered above and below the position of the shift amount 0, and the horizontal straight line corresponding to that position is regarded as not a ruled line and is deleted.
[0117]
If such a straight line check / removal process is performed, the straight line extracted from the shaded portion or the crushed character string in the table is removed, and only the original ruled line is output as the processing result. The details of this check / removal process will be described later.
[0118]
Next, specific examples of the above-described processes will be described with reference to FIGS. FIG. 25 shows image data after horizontal line segment integration in the process P4, and FIG. 26 shows a part of the image of FIG. The state in FIG. 26 corresponds to the image data before the integration of the completely overlapping straight lines in the process P16, and FIG. 27 shows the image data after the integration.
[0119]
In FIG. 26, it can be seen that the straight rectangle 101 having the label 66 and the straight rectangle 106 having the label 3 are integrated into one in FIG. Similarly, the rectilinear rectangles 102, 103, 104 and 105 having the labels 67, 68, 69 and 70 are integrated with the rectilinear rectangles 107, 108, 109 and 110 having the labels 4, 5, 6, and 7, respectively. .
[0120]
FIG. 28 shows image data after processing P17 and P18 have been performed on the image of FIG. 27 and straight lines have been removed based on the shape, position, and connection relationship of the straight lines. 27, the straight rectangles 111, 112 and 113 having the labels 35, 37 and 38 are deleted in FIG.
[0121]
FIG. 29 shows image data before integration of the partially overlapping straight lines in the process P19, and FIG. 30 shows image data after the integration. 29, the straight rectangle 121 having the label 25 and the straight rectangle 124 having the label 20 are integrated into one in FIG. Similarly, straight rectangles 122 and 123 having labels 26 and 27 are integrated with straight rectangles 125 and 126 having labels 21 and 22, respectively.
[0122]
FIG. 31 shows image data before removal of the almost completely overlapping straight line in the process P20, and FIG. 32 shows image data after the removal. It can be seen that the straight rectangle 131 in FIG. 31 has been deleted in FIG.
[0123]
FIG. 33 shows image data before removal of a straight line composed only of a large line segment in the process P21, and FIG. 34 shows image data after the removal. It can be seen that the straight rectangle 141 in FIG. 33 has been deleted in FIG.
[0124]
Further, FIG. 35 shows the image data before the check / removal of the straight line by the line segment shift in the process P23, and FIG. 36 shows the image data after the check / removal. It can be seen that the straight rectangles 151, 152, 153 in FIG. 35 have been deleted in FIG.
[0125]
Next, the line segment integration processing will be described in detail with reference to FIGS. 37, 38, 39, 40, and 41 are flowcharts of the horizontal line segment integration process P4 in FIG.
[0126]
In this process, the horizontal straight line extraction unit 15 treats a large black pixel block as a wild card rectangle, and focuses on a horizontally long line segment rectangle connected by eight connections before and after it. Then, line segment rectangles having an 8-connected relationship with each other are integrated with the wild card rectangle interposed therebetween, and one horizontally long integrated rectangle is obtained as a horizontal straight line.
[0127]
When the process is started, the horizontal straight line extraction unit 15 firstly determines the mode value mfheight of the height of the horizontal line segment. Each threshold value of the following equation is calculated using small, and the number of straight lines is set to 0 (FIG. 37, step S1).
th height =
MFHEIGHT small + TH HEIGHTDOT (3)
standard h = mfheight small + 1 (4)
Where TH The value of HEIGHTDOT is set to 2, for example. Next, the height of one of a plurality of line segment rectangles connected to each other is checked (step S2), and the height If it is larger than height, it is marked as a wildcard rectangle (step S3). At this time, a wildcard attribute is set by setting the identification variable use of the attribute information of the line segment rectangle to 9.
[0128]
For other line segment rectangles, use = 0 is set as a normal rectangle (standard rectangle) (step S4). Then, it is determined whether or not all the connected line segment rectangles have been marked (step S5), and if line segment rectangles still remain, the processing from step S2 is repeated.
[0129]
When all the line segment rectangles have been marked, one rectangle is extracted as the current rectangle i, xlf = the left end coordinate of the current rectangle i, xr = the right end coordinate of the current rectangle i, yup = the upper end coordinate of the current rectangle i, ybl = Bottom coordinate of current rectangle i, line start = yup, line end = ybl is set (step S6). Then, it is checked whether the use of the current rectangle i is 0 or 9 (step S7).
[0130]
If the use of the current rectangle i is 0 or 9, startxlf = xlf, startxr = xr, startup = yup, starttybl = ybl are set (step S8), and it is determined whether use = 0 (FIG. 38, Step S9). If use = 0, standard st = yup, standard en = ybl, b Use = 0, use = 1, and height = ybl-yup + 1 (step S10).
[0131]
b use = 0 means that the current rectangle i is set as a standard rather than a wildcard, and use = 1 means that the current rectangle i has been used. If use = 0 is not satisfied in step S9, standard st = 0, standard en = 0, b Use = 9 and height2 = ybl-yup + 1 are set (step S11). b use = 9 means that the current rectangle i is not set as a standard because it is a wild card.
[0132]
Next, another line segment rectangle is extracted as the current rectangle k, and rxlf = the left end coordinate of the current rectangle k, rxr = the right end coordinate of the current rectangle k, ryup = the upper end coordinate of the current rectangle k, and rybl = the lower end coordinate of the current rectangle k. (Step S12).
[0133]
Then, whether the current rectangle i is set as the standard, that is, b It is checked whether use = 0 (step S13). b If use = 0, it is checked whether the use of the current rectangle k is 9 (step S14). Here, when use = 9, it means that the current rectangle i is a standard and the current rectangle k is a wild card.
[0134]
When use = 9, it is determined whether or not xr + 1 ≧ rxlf, xr <rxr, ybl + 1 ≧ ryup, and yup−1 ≦ rybl are satisfied (step S15). When these conditions are satisfied, it means that the current rectangle k is on the right side of the current rectangle i, and both have a horizontal and vertical overlap of one pixel (one dot) or more. Therefore, with xr = rxr, the right end of the current rectangle i is extended to the right end of the current rectangle k (step S16).
[0135]
If use is not 9 in step S14, it is next checked whether use = 0 (FIG. 39, step S17). Here, if use = 0, it means that the current rectangle i is a standard and the current rectangle k is not a wild card. Therefore, next, xr + 1 ≧ rxlf, xr <rxr, ybl + 1 ≧ ryup, and yup−1 ≦ rybl hold, and the height of the current rectangle k is standard. It is determined whether it is within h +/- 4 (step S18).
[0136]
When these conditions are satisfied, xr = rxr, yup = ryup, ybl = rybl, use = 2, and hei = rybl-ryup + 1 are set (step S19). This means that the right end of the current rectangle i is extended to the right end of the current rectangle k, and the coordinates of the upper and lower ends are replaced with those of the current rectangle k. Use = 2 means that the current rectangle k has been used.
[0137]
Next, it is determined whether hei> height holds (step S20), and if so, height = hei is set (step S21). Next, ryup <line It is determined whether or not start is satisfied (step S22). Start = ryup is set (step S23). Furthermore, rybl> line It is determined whether or not end is satisfied (step S24). end = rybl is set (step S25).
[0138]
After these processes, then b It is determined whether use = 9 (FIG. 40, step S26). If the determination result is No in steps S13 and S15 in FIG. 38 and steps S18, S20, S22 and S24 in FIG. 39, the process immediately proceeds to step S26 and subsequent steps.
[0139]
Where b If use = 9, it is checked whether or not the use of the current rectangle k is 9 (step S27). When use = 9, it means that both the current rectangle i and the current rectangle k are wildcards. Then, it is determined whether or not xr + 1 ≧ rxlf, xr <rxr, ybl + 1 ≧ ryup, and yup−1 ≦ rybl are satisfied (step S28).
[0140]
When these conditions are satisfied, the current rectangle k is on the right side of the current rectangle i, and both have an overlap of one or more dots in the horizontal and vertical directions. Therefore, with xr = rxr, the right end of the current rectangle i is Extend to the right end (step S29).
[0141]
If use is not 9 in step S27, it is next checked whether use is 0 (step S30). Here, if use = 0, it means that the current rectangle i is a wild card and the current rectangle k is not a wild card. Therefore, xr + 1 ≧ rxlf, xr <rxr, line end ≧ ryup, and line It is determined whether start <rybl is satisfied (step S31).
[0142]
When these conditions hold, xr = rxr, yup = ryup, ybl = rybl, use = 2, line start = ryup, line end = rybl, hei = rybl-ryup + 1, standard st = ryup, standard en = rybl is set (step S32).
[0143]
This means that the right end of the current rectangle i is extended to the right end of the current rectangle k, and the coordinates of the upper and lower ends are replaced with those of the current rectangle k. Use = 2 means that the current rectangle k has been used. Then, it is determined whether or not height> height holds (step S33), and if so, height = hei is set (step S34).
[0144]
Next, it is determined whether or not all connected line segment rectangles have been extracted as the current rectangle k (FIG. 41, step S35). If the determination result in Steps S26, S28, S30, S31, and S33 of FIG. 40 is No, the process immediately proceeds to Step S35 and the subsequent steps. Here, if there is a remaining line segment rectangle, the processing from step S13 in FIG. 38 is repeated.
[0145]
When the processing is completed for all the line segment rectangles, b It is determined whether use = 9 (step S36). Where b If use = 9, xlf, xr, line start, line The end is stored as the coordinates of the left end, right end, upper end, and lower end of the extracted straight line rectangle, and the number of straight lines is incremented by 1 (step S37).
[0146]
B in step S36 Use = 9 because the current rectangle i and all the rectangles connected to it are wildcards, and are not stored as straight lines in this case.
[0147]
Next, it is determined whether or not all the line segment rectangles have been extracted as the current rectangle i (step S38). If there is a remaining line segment rectangle, the processing from step S6 in FIG. 37 is repeated. If the use of the current rectangle i is not 0 or 9 in step S7, it means that the extracted line segment rectangle has already been used, so the process immediately proceeds to step S38, and the next line segment rectangle is extracted. When all the line segment rectangles have been extracted, the processing is terminated.
[0148]
In this way, it is possible to jump over the wild card, integrate the horizontal line segment rectangles on both sides thereof, and extract a horizontal line including only standard line segments. The vertical line segment integration process P9 in FIG. 2 is also performed according to a similar flow.
Next, the flow of a straight line check / removal process by line segment shift will be described in detail with reference to FIGS. 42, 43, 44, 45, 46 and 47 are flowcharts of the horizontal straight line check / removal process in the process P23 of FIG. In this processing, the ruled line extraction device determines whether or not the straight line is a correct ruled line based on the distribution of black pixels around each horizontal straight line, and removes other lines while leaving only the correct ruled line.
[0149]
When the process is started, the ruled line extraction apparatus first sets both a variable cnt representing the number of processed horizontal straight lines and a variable newcount representing the number of horizontal straight lines determined to be correct ruled lines to 0 (FIG. 42, step S41). However, cnt and newcount are counted starting from 0.
[0150]
Next, it is checked whether or not the attribute of the cnt-th horizontal straight line represents a broken line (step S42). If it is the broken line attribute, all the straight line information of the horizontal straight line is copied as the newcount-th ruled line information, cnt and newcount are incremented by 1 (step S43), and the next horizontal straight line is determined in step S42. .
[0151]
If the attribute of the cnt-th horizontal straight line is not the broken line attribute, it is regarded as corresponding to the solid line, the height of the horizontal straight line rectangle is set to height (step S44), and it is determined whether height is 2 or less (step S44). S45). If height is greater than 2, the value is not changed, and if height is 2 or less, it is changed to 3 (step S46).
[0152]
Then, pos = height, maxsum = 0, top bound = 0, bottom Bound = 0, shift = −1 * height, sum = 0, and j = 0 (step S47). The variable pos is used to specify the position in the vertical direction in the image, and the variable maxsum represents the maximum value in the graph of the total number of black pixels.
[0153]
Also, the variable top "bound" is used as a flag indicating whether or not the section of the graph has reached the upper end of the image, and the variable "bottom" is used. The bound is used as a flag indicating whether the section of the graph has reached the lower end of the image. The value of the variable shift indicates the amount of shift in the vertical direction of the line segment rectangle in the horizontal straight line, and the variable sum indicates the total number of black pixels in the plurality of line segment rectangles.
[0154]
Next, it is checked whether or not the attribute of the j-th small line segment (line segment rectangle) in the cnt-th horizontal straight line is a wild card (FIG. 43, step S48). If it is a wildcard attribute, j is incremented by 1 (step S49), and the next small line segment is determined in step S48.
[0155]
If the attribute of the j-th line segment is not a wild card, it is regarded as corresponding to a normal line segment rectangle, and xmin = the left end coordinate of the j-th line segment, xmax = the right end coordinate of the j-th line segment, ymin = upper coordinate of j-th small line segment + shift, and ymax = lower coordinate of j-th small line segment + shift (step S50). However, if the position of ymin or ymax determined in this way is not within the image coordinates, the y coordinate of the closest image end is set to ymin or ymax.
[0156]
Then, the number of black pixels in the rectangular area divided by the values of the variables xmin, xmax, ymin, and ymax is calculated, and the calculated number is set to black. dot and sum = sum + black dot.
[0157]
Next, it is determined whether or not ymin corresponds to the upper end of the image (step S51). Bound = 1 is set (step S52). Also, it is determined whether or not ymax corresponds to the lower end of the image (step S53). Bound = 1 is set (step S54).
[0158]
Next, it is determined whether or not the value of the variable j corresponds to the last small line segment in the cnt-th horizontal straight line (step S55). If it does not correspond to the last small line segment, j is incremented by 1 (step S56), and the processing from step S48 is repeated. If it corresponds to the last small line segment, histo [pos + shift] = sum is set (FIG. 44, step S57).
[0159]
Here, histo [p] represents the value of the graph (total number of black pixels) corresponding to the value of the position parameter p in the y direction. For example, when pos = height and shift = −height, histo [pos + shift] = histo [0], which represents the value of the graph corresponding to the position of the parameter value 0.
[0160]
Next, sum and maxsum are compared (step S58), and if sum is greater than maxsum, maxsum = sum is set (step S59).
Next, shift and height are compared (step S60). If shift is equal to or less than height, shift = shift + 1 is set, sum and j are returned to the initial values 0 (step S61), and the processing from step S48 is repeated. Thereby, the value of the graph corresponding to the position where the shift amount has changed by one pixel is calculated.
[0161]
When the value of shift exceeds height, next, histo [pos-1] is compared with histo [pos] (step S62). Here, histo [pos] represents the value of the graph corresponding to the position of the shift amount 0. If histo [pos-1] is larger than histo [pos], then histo [pos-1] and histo [pos + 1] are compared (step S63).
[0162]
Then, if histo [pos-1] is larger than histo [pos + 1], maxpos = pos-1 and maxsum = histo [pos-1] are set (step S64). If histo [pos-1] is equal to or smaller than histo [pos + 1], maxpos = pos + 1 and maxsum = histo [pos + 1] are set (step S65).
[0163]
If histo [pos-1] is equal to or smaller than histo [pos] in step S62, then histo [pos] is compared with histo [pos + 1] (step S66).
[0164]
If histo [pos] is greater than or equal to histo [pos + 1], then set maxpos = pos and maxsum = histo [pos] (step S67). If histo [pos] is smaller than histo [pos + 1], maxpos = pos + 1 and maxsum = histo [pos + 1] are set (step S68).
[0165]
Through such processing, the maximum value of histo [pos-1], histo [pos], and histo [pos + 1] is set to maxsum, and the corresponding parameter value is set to maxpos. Accordingly, this maxsum represents the maximum value of the graph near the position of the shift amount 0, and corresponds to Peak in FIG.
[0166]
Next, using the obtained value of maxsum (= histo [maxpos]), the threshold th is calculated by the following equation (FIG. 45, step S69).
th = maxsum * THSHIFT (5)
Here, the parameter THSHIFT represents the ratio of the threshold value th to the maximum value maxsum, and is appropriately set between 0 and 1.0.
[0167]
Then, lineokflag1 = 0, lineokflag2 = 0, minval = 0xffff, and shift = -1 * height. The variables lineokflag1 and lineokflag2 are used as flags indicating check results on the upper and lower sides of the position corresponding to the local maximum value, and the variable minval represents the minimum value of the graph.
[0168]
Next, histo [pos + shift] is compared with th (step S70). Then, if histo [pos + shift] is smaller than th, it is considered that the number of black pixels has decreased above the position corresponding to the local maximum, and lineokflag1 = 1 is set (step S71). Therefore, lineokflag1 = 1 indicates that the check result on the upper side is OK.
[0169]
Next, histo [pos + shift] is compared with minval (step S72). If histo [pos + shift] is smaller than minval, minval = histo [pos + shift] is set (step S73).
[0170]
Next, (pos + shift) is compared with maxpos (step S74). If (pos + shift) is equal to or less than maxpos, shift = shift + 1 is set (step S75), and the processing from step S70 is repeated. Thus, the value of the graph is checked again at the position where the shift amount has changed by one pixel.
[0171]
If (pos + shift) exceeds maxpos, then histo [pos + shift] is compared with th (FIG. 46, step S76). Then, if histo [pos + shift] is greater than or equal to th, then histo [pos + shift] is compared with minval (step S77). If histo [pos + shift] is smaller than minval, minval = histo [pos + shift] is set (step S78).
[0172]
Next, shift and height are compared (step S79). If shift is equal to or less than height, shift = shift + 1 is set (step S80), and the processing from step S76 is repeated. Thus, the value of the graph is checked again at the position where the shift amount has changed by one pixel.
[0173]
In step S76, if histo [pos + shift] is smaller than th, it is considered that the number of black pixels has decreased below the position corresponding to the local maximum, and lineokflag2 = 1 is set (step S81). Therefore, lineokflag2 = 1 indicates that the check result on the lower side is OK.
[0174]
Next, lineokflag1 and top The value of bound is checked (FIG. 47, step S82). Then, lineokflag1 = 0 and top If bound = 1, it is assumed that the target cnt-th horizontal straight line corresponds to the horizontal ruled line near the upper end of the image, and lineokflag1 = 1 is set (step S83).
[0175]
Next, lineokflag2 and bottom The value of bound is checked (step S84). Then, lineokflag2 = 0 and bottom If bound = 1, it is assumed that the cnt-th horizontal straight line corresponds to the horizontal ruled line near the lower end of the image, and lineokflag2 = 1 is set (step S85).
[0176]
Next, the final values of lineokflag1 and lineokflag2 are checked (step S86). If lineokflag1 = lineokflag2 = 1, it is determined that the cnt-th horizontal straight line is a correct horizontal ruled line, the line information is copied as newcount-th ruled line information, and newcount is incremented by 1 (step S87).
[0177]
If lineokflag1 = 0 or lineokflag2 = 0, it is determined that the cnt-th horizontal straight line is not a correct horizontal ruled line, and the line information is not stored as ruled line information.
[0178]
Next, it is checked whether or not cnt corresponds to the last horizontal straight line in the image (step S88). If there is still a horizontal straight line, cnt is incremented by 1 (step S89), and the next horizontal straight line is determined. The processing after step S42 is repeated. When cnt becomes a value corresponding to the last horizontal straight line, the processing is terminated.
[0179]
By performing such processing, the ruler line likelihood is checked based on the comparison between the number of black pixels on the straight line and the number of black pixels around the straight line. Straight lines are efficiently removed. The same check / removal process is performed on the vertical straight line.
[0180]
As described above, according to the present embodiment, regardless of the presence or absence of blurring of an image, even if the image is a table in which solid lines and dotted lines are mixed, a shaded portion or a portion where a character and a ruled line are in contact Even if there is, it is possible to accurately extract the ruled line.
[0181]
The ruled line extraction technique of the present invention is applied not only to electronic filing but also to a technique of cutting out only a graphic from a pattern in which a graphic including a symbol or a character and a straight line overlap with each other in a broad sense. For example, the present invention can be applied to a handwritten character recognition device, a printed character recognition device, cutout of patterns such as characters and symbols in drawing recognition, and separation of contact portions between ruled lines in an image and objects, figures, characters, and the like.
[0182]
In addition, the shape of the area representing the straight line or the line segment is not necessarily rectangular, and an area having an arbitrary shape surrounded by a straight line or a curve can be used. In this case, if the positions, heights, and widths of the straight lines and line segments, the distance between them, and the like are appropriately defined according to the shape to be used, the same processing as in FIG. 2 can be performed.
[0183]
【The invention's effect】
According to the present invention, a ruled line portion can be correctly extracted from a general document image whose ruled line structure cannot be predicted in advance.
[0184]
For example, even when a table has a shaded portion, it is possible to correctly extract ruled lines from the image. Further, when a character and a ruled line are in contact with each other, it is possible to correctly extract the ruled line even if the structural information of the table is not known in advance. Furthermore, even when the character string is printed in a slightly collapsed state or when characters are printed at a high density, the probability of erroneously extracting ruled lines from the character string is reduced.
[Brief description of the drawings]
FIG. 1 is a diagram illustrating the principle of a ruled line extraction device according to the present invention.
FIG. 2 is a functional block diagram of the ruled line extraction device.
FIG. 3 is a configuration diagram of an information processing apparatus.
FIG. 4 is a diagram showing a data structure.
FIG. 5 is a diagram showing a labeling process.
FIG. 6 is a diagram showing a height histogram.
FIG. 7 is a diagram showing a histogram for obtaining a mode value of height.
FIG. 8 is a diagram showing a rectangular height table.
FIG. 9 is a diagram showing a histogram corresponding to the contents of a rectangular height table.
FIG. 10 is a diagram showing a mask process.
FIG. 11 is a diagram illustrating a line segment detection process.
FIG. 12 is a diagram showing a first line segment integration process.
FIG. 13 is a diagram illustrating a second line segment integration process.
FIG. 14 is a diagram showing a straight line search process.
FIG. 15 is a diagram showing a process of integrating completely overlapping straight lines.
FIG. 16 is a diagram illustrating a first straight line removal process.
FIG. 17 is a diagram illustrating a second straight line removal process.
FIG. 18 illustrates a straight line that should not be removed.
FIG. 19 is a diagram illustrating a third straight line removal process.
FIG. 20 is a diagram showing a process of integrating partially overlapping straight lines.
FIG. 21 is a diagram showing the inside of a partially overlapping straight line.
FIG. 22 is a diagram illustrating a fourth straight line removal process.
FIG. 23 is a diagram illustrating a method of obtaining a distance value between two straight lines.
FIG. 24 is a diagram illustrating a fifth straight line removal process.
FIG. 25 is a diagram showing an image after horizontal line integration processing;
FIG. 26 is a diagram showing an image of a completely overlapped straight line before integration processing.
FIG. 27 is a diagram showing an image after a completely overlapping straight line is integrated.
FIG. 28 is a diagram showing an image after the removal processing based on the connection relationship between the shape and position of the straight line and the vertical and horizontal straight lines.
FIG. 29 is a diagram showing an image before a partial overlapping straight line integration process.
FIG. 30 is a diagram showing an image after the process of integrating partially overlapping straight lines;
FIG. 31 is a diagram showing an image before a straight line that is almost completely overlapped is removed.
FIG. 32 is a diagram showing an image after a process of removing almost completely overlapping straight lines.
FIG. 33 is a diagram illustrating an image before a process of removing a straight line composed of only large line segments;
FIG. 34 is a diagram showing an image after the removal processing of a straight line composed of only large line segments.
FIG. 35 is a diagram showing an image before straight line check / removal processing by line segment shift.
FIG. 36 is a diagram showing an image after a straight line check / removal process by a line segment shift;
FIG. 37 is a flowchart (part 1) of a line segment integration process.
FIG. 38 is a flowchart (part 2) of a line segment integration process.
FIG. 39 is a flowchart (part 3) of a line segment integration process.
FIG. 40 is a flowchart (part 4) of the line segment integration process.
FIG. 41 is a flowchart (part 5) of a line segment integration process.
FIG. 42 is a flowchart (part 1) of a straight line check / removal process;
FIG. 43 is a flowchart (part 2) of a straight line check / removal process;
FIG. 44 is a flowchart (part 3) of a straight line check / removal process;
FIG. 45 is a flowchart (part 4) of a straight line check / removal process;
FIG. 46 is a flowchart (part 5) of a straight line check / removal process;
FIG. 47 is a flowchart (part 6) of a straight line check / removal process;
FIG. 48 is a diagram showing a simple tabular frame.
FIG. 49 is a diagram showing a complicated tabular frame.
FIG. 50 is a diagram showing a tabular frame in which it is difficult to extract ruled lines.
[Explanation of symbols]
1 Estimation means
2 Storage means
3 Line segment extraction means
4 Calculation means
5 Straight line extraction means
6 Graph generation means
7 Straight line processing means
8 Straight line integration means
9 Straight line removal means
11 Input pattern
12 Reduction processing section
13 Connection pattern extraction unit
14 Mask processing unit
15 Horizontal line extraction unit
16 Vertical straight line extraction unit
31 CPU
32 memories
33 Input device
34 Output device
35 External storage device
36 Medium drive
37 Network connection device
38 Photoelectric conversion device
39 bus
40 Portable recording media
40 'database
41 Image information
42 Table information
43 cell information
44 Straight line information
45 line segment information
51, 52, 53, 54, 55, 56, 57, 58 patterns
61 Wild Card
62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 76, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 121, 122, 123, 124, 125, 126, 131, 141, 151, 152, 153 straight rectangle
74, 75, 77, 78 Endpoint
94, 95 line segment rectangle
96, 97 graph

Claims (22)

入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定する推定手段と、
前記入力画像から1つ以上の直線パターンの情報を抽出する直線抽出手段と、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、前記1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出し、該罫線候補の直線パターンの中で隣り合う2つの直線パターンのうち一方の直線パターンが該長さのしきい値より短い場合に該一方の直線パターンを除去する処理、または該隣り合う2つの直線パターンの距離が前記標準パターンの大きさに基づく別のしきい値より小さい場合に該2つの直線パターンのうち一方を除去する処理を行う直線除去手段と
を備えることを特徴とする罫線抽出装置。
Estimating means for estimating the size of the standard pattern as a standard pattern with a standard size pattern often included in the input image,
Straight line extraction means for extracting information of one or more straight line patterns from the input image;
Setting a threshold value of the thickness or length of the linear pattern based on the information on the size of the standard pattern; and determining the linear pattern or the length of the one or more linear patterns that is larger than the threshold value of the thickness. by removing the short straight pattern than the threshold, extracts a straight line pattern of the ruled line candidate, one of the linear pattern of the two linear pattern adjacent in the linear pattern of the ruled line candidate said long Sanoshi A process of removing the one straight line pattern when the distance is shorter than a threshold value, or a process of removing the two straight line patterns when the distance between the two adjacent straight line patterns is smaller than another threshold value based on the size of the standard pattern. Straight line removing means for removing one of them ;
1. A ruled line extraction device comprising:
入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定する推定手段と、
前記入力画像から1つ以上の直線パターンの情報を抽出する直線抽出手段と、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、前記1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出し、該罫線候補の直線パターンの中で隣り合う2つの横直線パターンの距離が前記標準パターンの大きさより小さい場合に、該2つの横直線パターンのそれぞれを対象として該横直線パターンと縦直線パターンの接続関係を調べ、該接続関係に基づき該横直線パターンを除去し、該罫線候補の直線パターンの中で隣り合う2つの縦直線パターンの距離が該標準パターンの大きさより小さい場合に、該2つの縦直線パターンのそれぞれを対象として該縦直線パターンと横直線パターンの接続関係を調べ、該接続関係に基づき該縦直線パターンを除去する直線除去手段と
を備えることを特徴とする罫線抽出装置。
Estimating means for estimating the size of the standard pattern as a standard pattern with a standard size pattern often included in the input image,
Straight line extraction means for extracting information of one or more straight line patterns from the input image;
Setting a threshold value of the thickness or length of the linear pattern based on the information on the size of the standard pattern; by removing the short straight pattern than the threshold, it extracts a straight line pattern of the ruled line candidate, if the distance of the two lateral linear pattern adjacent in the linear pattern of the ruled line candidate is smaller than the size of the standard pattern Next, the connection relationship between the horizontal straight line pattern and the vertical straight line pattern is checked for each of the two horizontal straight line patterns, and the horizontal straight line pattern is removed based on the connection relationship. When the distance between two matching vertical linear patterns is smaller than the size of the standard pattern, the vertical linear pattern and the horizontal Examine the connection of the line pattern, and the line removing means for removing said longitudinal linear pattern on the basis of the connection relation
1. A ruled line extraction device comprising:
入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定する推定手段と、
前記入力画像から1つ以上の直線パターンの情報を抽出する直線抽出手段と、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、前記1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出し、該罫線候補の直線パターンの中でほとんど重複する2つの直線パターンの距離が前記標準パターンの大きさより小さい場合に、該2つの直線パターンのうち短い方を除去する直線除去手段と
を備えることを特徴とする罫線抽出装置。
Estimating means for estimating the size of the standard pattern as a standard pattern with a standard size pattern often included in the input image,
Straight line extraction means for extracting information of one or more straight line patterns from the input image;
Setting a threshold value of the thickness or length of the linear pattern based on the information on the size of the standard pattern; by removing the short straight pattern than the threshold, it extracts a straight line pattern of the ruled line candidate, if the distance between two linear pattern with little overlap in a linear pattern of the ruled line candidate is smaller than the size of the standard pattern Straight line removing means for removing a shorter one of the two straight line patterns ;
1. A ruled line extraction device comprising:
入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定する推定手段と、
前記入力画像から1つ以上の直線パターンの情報を抽出する直線抽出手段と、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、前記1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出する直線除去手段と、
前記1つ以上の直線パターンの大きさの代表値を求める計算手段と、
前記罫線候補の直線パターンのうち部分的に重複する2つの直線パターンを統合してできる直線パターンの大きさが前記代表値程度になる場合に、統合後の直線パターンを罫線候補とする直線統合手段と
を備えることを特徴とする罫線抽出装置。
Estimating means for estimating the size of the standard pattern as a standard pattern with a standard size pattern often included in the input image,
Straight line extraction means for extracting information of one or more straight line patterns from the input image;
Setting a threshold value of the thickness or length of the linear pattern based on the information on the size of the standard pattern; A straight line removing means for extracting a straight line pattern of a ruled line candidate by removing a straight line pattern shorter than the threshold value of
Calculating means for obtaining a representative value of the size of the one or more linear patterns;
A straight line integrating unit that uses the combined straight line pattern as a rule candidate when the size of a straight line pattern obtained by integrating two partially overlapping straight line patterns among the straight line patterns of the rule candidate is approximately the representative value; When
1. A ruled line extraction device comprising:
前記計算手段は、前記1つ以上の直線パターンに含まれる横直線パターンの高さのヒストグラムと縦直線パターンの幅のヒストグラムのうちの1つから、前記代表値を求めることを特徴とする請求項記載の罫線抽出装置。2. The method according to claim 1, wherein the calculating unit obtains the representative value from one of a histogram of the height of the horizontal linear pattern and a histogram of the width of the vertical linear pattern included in the one or more linear patterns. 4. The ruled line extraction device according to 4 . 入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定する推定手段と、
横長または縦長のマスクを用いたマスク処理により前記入力画像から斜め成分を取り除くことで1つ以上の線分パターンを抽出し、抽出された線分パターンを統合して直線パターンを生成することにより、前記入力画像から1つ以上の直線パターンの情報を抽出する直線抽出手段と、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、前記1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出する直線除去手段と
を備えることを特徴とする罫線抽出装置。
Estimating means for estimating the size of the standard pattern as a standard pattern with a standard size pattern often included in the input image,
By removing one or more line segment patterns by removing oblique components from the input image by mask processing using a horizontally or vertically elongated mask, and integrating the extracted line segment patterns to generate a straight line pattern , Straight line extraction means for extracting information of one or more straight line patterns from the input image;
Setting a threshold value of the thickness or length of the linear pattern based on the information on the size of the standard pattern; A straight line removing means for extracting a straight line pattern of a ruled line candidate by removing a straight line pattern shorter than the threshold value of
1. A ruled line extraction device comprising:
入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定する推定手段と、
前記入力画像から1つ以上の直線パターンの情報を抽出する直線抽出手段と、
前記1つ以上の直線パターンを構成する1つ以上の線分パターンの大きさの代表値を求める計算手段と、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、前記1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出し、前記代表値に基づいて線分パターンのしきい値を設定し、罫線候補の直線パターンから、該線分パターンのしきい値より大きな線分パターンだけで構成されている直線パターンを除去する直線除去手段と
を備えることを特徴とする罫線抽出装置。
Estimating means for estimating the size of the standard pattern as a standard pattern with a standard size pattern often included in the input image,
Straight line extraction means for extracting information of one or more straight line patterns from the input image;
Calculating means for calculating a representative value of the size of one or more line segment patterns constituting the one or more linear patterns ;
Setting a threshold value of the thickness or length of the linear pattern based on the information on the size of the standard pattern; by removing the short straight pattern than the threshold, it extracts a straight line pattern of the ruled line candidate, sets the threshold of the segment patterns based on the representative value, from the linear pattern of the ruled line candidate,該線Straight line removing means for removing a straight line pattern composed only of line segment patterns larger than the threshold value of the minute pattern ;
1. A ruled line extraction device comprising:
前記計算手段は、前記1つ以上の線分パターンに含まれる横線分パターンの高さのヒストグラムと縦直線パターンの幅のヒストグラムのうちの1つから、前記代表値を求めることを特徴とする請求項記載の罫線抽出装置。The said calculation means calculates | requires the said representative value from one of the histogram of the height of the horizontal line pattern contained in the one or more line pattern, and the histogram of the width of a vertical line pattern. Item 7. A ruled line extraction device according to Item 7 . 入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定する推定手段と、
1つ以上の線分パターンの情報を、太さがしきい値より大きな線分パターンの情報と該大きな線分パターン以外の小さな線分パターンの情報とに区別して格納する格納手段と、
前記1つ以上の線分パターンの接続状態を調べ、途中に前記大きな線分パターンが存在するとき、該大きな線分パターンの大きさに関わらず、他の複数の線分パターンが構成する直線パターンを抽出することにより、前記入力画像から1つ以上の直線パターンの情報を抽出する直線抽出手段と、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、前記1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出する直線除去手段と
を備えることを特徴とする罫線抽出装置。
Estimating means for estimating the size of the standard pattern as a standard pattern with a standard size pattern often included in the input image,
Storage means for separately storing information of one or more line segment patterns into information of line segment patterns whose thickness is larger than the threshold value and information of small line segment patterns other than the large line pattern ;
The connection state of the one or more line segment patterns is checked, and when the large line segment pattern exists in the middle, the linear pattern formed by the other plurality of line segment patterns regardless of the size of the large line segment pattern A straight line extracting means for extracting information of one or more straight line patterns from the input image by extracting
Setting a threshold value of the thickness or length of the linear pattern based on the information on the size of the standard pattern; A straight line removing means for extracting a straight line pattern of a ruled line candidate by removing a straight line pattern shorter than the threshold value of
1. A ruled line extraction device comprising:
入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定する推定手段と、
前記入力画像から1つ以上の直線パターンの情報を抽出する直線抽出手段と、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、前記1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出する直線除去手段と、
前記罫線候補の直線パターンのうちの1つの直線パターンを構成する1つ以上の線分パターンのうち、標準的な大きさの線分パターンを表す1つ以上の線分矩形を、該1つの直 線パターンの周囲で該1つの直線パターンの長さ方向と垂直にシフトさせながら、各シフト位置における該1つ以上の線分矩形の内部の画素数の総和を求める処理を繰り返して、得られた黒画素数の総和を各シフト位置に対してプロットすることにより、該1つの直線パターンの周囲における線分矩形のシフト量と黒画素数の総和との関係を表すグラフを生成するグラフ生成手段とを備え、
前記直線除去手段は、前記グラフの形状に基づいて前記1つの直線パターンを除去するかどうかを判定することを特徴とする罫線抽出装置。
Estimating means for estimating the size of the standard pattern as a standard pattern with a standard size pattern often included in the input image,
Straight line extraction means for extracting information of one or more straight line patterns from the input image;
Setting a threshold value of the thickness or length of the linear pattern based on the information on the size of the standard pattern; A straight line removing means for extracting a straight line pattern of a ruled line candidate by removing a straight line pattern shorter than the threshold value of
One or more line segment rectangles representing a standard-sized line segment pattern among one or more line segment patterns constituting one straight line pattern among the straight line patterns of the ruled line candidates are defined as one straight line. The process of obtaining the total number of black pixels inside the one or more line segment rectangles at each shift position while shifting vertically around the line pattern perpendicular to the length direction of the one linear pattern is obtained. Graph generating means for generating a graph representing the relationship between the shift amount of the line segment rectangle around the one straight line pattern and the total number of black pixels by plotting the total number of black pixels for each shift position. With
The ruled line extracting device, wherein the straight line removing unit determines whether to remove the one straight line pattern based on a shape of the graph.
前記1つ以上の線分パターンのうち太さがしきい値より大きな線分パターンの情報にマークを付けて、該1つ以上の線分パターンの情報を格納する格納手段をさらに備え、前記グラフ生成手段は、前記1つ以上の線分パターンのうちマークが付いていない線分パターンを、前記標準的な大きさの線分パターンとみなすことを特徴とする請求項10記載の罫線抽出装置。The graph generating means further comprises a storage unit for marking information on the line segment pattern having a thickness larger than a threshold value among the one or more line segment patterns and storing the information on the one or more line segment patterns. 11. The ruled line extracting apparatus according to claim 10 , wherein the line segment pattern having no mark among the one or more line segment patterns is regarded as the standard size line segment pattern. 前記直線除去手段は、前記グラフの形状がなだらかな場合に前記1つの直線パターンを除去することを特徴とする請求項10記載の罫線抽出装置。 The straight line removal means ruled-line extraction device of claim 10, wherein the shape of the graph to remove the one linear pattern when gentle. コンピュータのためのプログラムを記録した記録媒体であって、
入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定する機能と、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定する機能と、
1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出する機能と、
前記1つ以上の直線パターンの大きさの代表値を求める機能と、
前記罫線候補の直線パターンのうち部分的に重複する2つの直線パターンを統合してできる直線パターンの大きさが前記代表値程度になる場合に、統合後の直線パターンを罫線候補とする機能と
前記コンピュータに実現させるためのプログラムを記録したコンピュータ読み取り可能な記録媒体。
A recording medium recording a program for a computer,
A function of estimating the size of the standard pattern using a pattern of a standard size often included in the input image as a standard pattern,
A function of setting a threshold of the thickness or length of the linear pattern based on the information of the size of the standard pattern,
A function of extracting a line pattern of a ruled line candidate by removing a line pattern thicker than the thickness threshold or a line pattern shorter than the length threshold from one or more line patterns;
A function of obtaining a representative value of the size of the one or more linear patterns;
When the size of a straight line pattern obtained by integrating two partially overlapping straight line patterns among the straight line patterns of the ruled line candidate is about the representative value, a function of using the straightened pattern after integration as a ruled line candidate;
And a computer-readable recording medium recording a program for causing the computer to realize the above.
コンピュータのためのプログラムを記録した記録媒体であって、
入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定する機能と、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定する機能と、
横長または縦長のマスクを用いたマスク処理により前記入力画像から斜め成分を取り除くことで1つ以上の線分パターンを抽出し、抽出された線分パターンを統合して直線パターンを生成し、1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出する機能と
を前記コンピュータに実現させるためのプログラムを記録したコンピュータ読み取り可能な記録媒体。
A recording medium recording a program for a computer,
A function of estimating the size of the standard pattern using a pattern of a standard size often included in the input image as a standard pattern,
A function of setting a threshold of the thickness or length of the linear pattern based on the information of the size of the standard pattern,
One or more line segments pattern by removing an oblique component from the input image extracted by the mask processing using the horizontal or vertical mask, to generate a linear pattern by integrating the extracted line segments pattern, one A function of extracting a straight line pattern of a ruled line candidate by removing a straight line pattern thicker than the threshold value of the thickness or a straight line pattern shorter than the threshold value of the length from the straight line pattern.
And a computer-readable recording medium recording a program for causing the computer to realize the above .
コンピュータのためのプログラムを記録した記録媒体であって、
入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定する機能と、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定する機能と、
1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出する機能と、
前記1つ以上の直線パターンを構成する1つ以上の線分パターンの大きさの代表値を求める機能と、
前記代表値に基づいて線分パターンのしきい値を設定する機能と、
前記罫線候補の直線パターンから、該線分パターンのしきい値より大きな線分パターンだけで構成されている直線パターンを除去する機能と
前記コンピュータに実現させるためのプログラムを記録したコンピュータ読み取り可能な記録媒体。
A recording medium recording a program for a computer,
A function of estimating the size of the standard pattern using a pattern of a standard size often included in the input image as a standard pattern,
A function of setting a threshold of the thickness or length of the linear pattern based on the information of the size of the standard pattern,
A function of extracting a line pattern of a ruled line candidate by removing a line pattern thicker than the thickness threshold or a line pattern shorter than the length threshold from one or more line patterns;
A function of obtaining a representative value of the size of one or more line segment patterns constituting the one or more linear patterns;
A function of setting a threshold value of the line segment pattern based on the representative value,
A function of removing, from the straight line pattern of the ruled line candidate, a straight line pattern composed of only line segment patterns larger than the threshold value of the line segment pattern;
And a computer-readable recording medium recording a program for causing the computer to realize the above.
コンピュータのためのプログラムを記録した記録媒体であって、
入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定する機能と、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定する機能と、
1つ以上の線分パターンの情報を、太さがしきい値より大きな線分パターンの情報と該大きな線分パターン以外の小さな線分パターンの情報とに区別して格納し、前記1つ以上の線分パターンの接続状態を調べ、途中に前記大きな線分パターンが存在するとき、該大きな線分パターンの大きさに関わらず、他の複数の線分パターンが構成する直線パターンを抽出し、1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出する機能と
を前記コンピュータに実現させるためのプログラムを記録したコンピュータ読み取り可能な記録媒体。
A recording medium recording a program for a computer,
A function of estimating the size of the standard pattern using a pattern of a standard size often included in the input image as a standard pattern,
A function of setting a threshold of the thickness or length of the linear pattern based on the information of the size of the standard pattern,
The information on one or more line segments is stored separately from the information on the line segment patterns whose thickness is larger than the threshold value and the information on the small line segment patterns other than the large line segment patterns. The connection state of the patterns is checked, and when the large line segment pattern exists in the middle, regardless of the size of the large line segment pattern, a straight line pattern constituted by other plural line segment patterns is extracted , and one or more line patterns are extracted. A function of extracting a straight line pattern of a ruled line candidate by removing a straight line pattern thicker than the thickness threshold or a straight line pattern shorter than the length threshold from the straight line pattern.
And a computer-readable recording medium recording a program for causing the computer to realize the above .
コンピュータのためのプログラムを記録した記録媒体であって、
入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定する機能と、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定する機能と、
1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出する機能と、
前記罫線候補の直線パターンのうちの1つの直線パターンを構成する1つ以上の線分パターンのうち、標準的な大きさの線分パターンを表す1つ以上の線分矩形を、該1つの直線パターンの周囲で該1つの直線パターンの長さ方向と垂直にシフトさせながら、各シフト位置における該1つ以上の線分矩形の内部の画素数の総和を求める処理を繰り返して、得られた黒画素数の総和を各シフト位置に対してプロットすることにより、該1つの直線パターンの周囲における線分矩形のシフト量と黒画素数の総和との関係を表すグラフを生成する機能と、
前記グラフの形状に基づいて前記1つの直線パターンを除去するかどうかを判定する機能と
前記コンピュータに実現させるためのプログラムを記録したコンピュータ読み取り可能な記録媒体。
A recording medium recording a program for a computer,
A function of estimating the size of the standard pattern using a pattern of a standard size often included in the input image as a standard pattern,
A function of setting a threshold of the thickness or length of the linear pattern based on the information of the size of the standard pattern,
A function of extracting a line pattern of a ruled line candidate by removing a line pattern thicker than the thickness threshold or a line pattern shorter than the length threshold from one or more line patterns;
One or more line segment rectangles representing a standard-sized line segment pattern among one or more line segment patterns constituting one straight line pattern among the straight line patterns of the ruled line candidates are defined by the one straight line. The process of obtaining the total number of black pixels inside the one or more line segment rectangles at each shift position while shifting vertically around the length of the one linear pattern around the pattern is obtained. A function of plotting the sum of the number of black pixels for each shift position to generate a graph representing the relationship between the shift amount of the line segment rectangle around the one straight line pattern and the sum of the number of black pixels;
A function of determining whether to remove the one straight line pattern based on the shape of the graph;
And a computer-readable recording medium recording a program for causing the computer to realize the above.
入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定し、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、
1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出し、
前記1つ以上の直線パターンの大きさの代表値を求め、
前記罫線候補の直線パターンのうち部分的に重複する2つの直線パターンを統合してできる直線パターンの大きさが前記代表値程度になる場合に、統合後の直線パターンを罫線候補とする
ことを特徴とする罫線抽出方法。
Estimating the size of the standard pattern as a standard pattern with a pattern of a standard size often included in the input image,
Set a threshold of the thickness or length of the linear pattern based on the information of the size of the standard pattern,
By removing a line pattern that is thicker than the thickness threshold or a line pattern that is shorter than the length threshold from one or more line patterns, a line pattern of a ruled line candidate is extracted,
Calculating a representative value of the size of the one or more linear patterns;
When the size of a straight line pattern obtained by integrating two partially overlapping straight line patterns among the straight line patterns of the ruled line candidate is approximately the representative value, the combined straight line pattern is set as a ruled line candidate. Ruled line extraction method.
入力画像に多く含まれる標準的な大きさのパターンを標準パターン として該標準パターンの大きさを推定し、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、
横長または縦長のマスクを用いたマスク処理により前記入力画像から斜め成分を取り除くことで1つ以上の線分パターンを抽出し、抽出された線分パターンを統合して直線パターンを生成し、1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出する
ことを特徴とする罫線抽出方法。
Estimating the size of the standard pattern as a standard pattern with a pattern of a standard size often included in the input image ,
Set a threshold of the thickness or length of the linear pattern based on the information of the size of the standard pattern,
One or more line segments pattern by removing an oblique component from the input image extracted by the mask processing using the horizontal or vertical mask, to generate a linear pattern by integrating the extracted line segments pattern, one A straight line pattern of a ruled line candidate is extracted by removing a straight line pattern thicker than the threshold value of the thickness or a straight line pattern shorter than the threshold value of the length from the above straight line patterns.
A method for extracting ruled lines , characterized in that :
入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定し、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、
1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出し、
前記1つ以上の直線パターンを構成する1つ以上の線分パターンの大きさの代表値を求め、
前記代表値に基づいて線分パターンのしきい値を設定し、
前記罫線候補の直線パターンから、該線分パターンのしきい値より大きな線分パターンだけで構成されている直線パターンを除去する
ことを特徴とする罫線抽出方法。
Estimating the size of the standard pattern as a standard pattern with a pattern of a standard size often included in the input image,
Set a threshold of the thickness or length of the linear pattern based on the information of the size of the standard pattern,
By removing a line pattern that is thicker than the thickness threshold or a line pattern that is shorter than the length threshold from one or more line patterns, a line pattern of a ruled line candidate is extracted,
Obtaining a representative value of the size of one or more line segment patterns constituting the one or more linear patterns;
Setting a threshold value of the line segment pattern based on the representative value,
Removing, from the line pattern of the ruled line candidate, a line pattern consisting only of line segment patterns larger than the threshold value of the line segment pattern;
A method for extracting ruled lines , characterized in that :
入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定し、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、
1つ以上の線分パターンの情報を、太さがしきい値より大きな線分パターンの情報と該大きな線分パターン以外の小さな線分パターンの情報とに区別して格納し、前記1つ以上の線分パターンの接続状態を調べ、途中に前記大きな線分パターンが存在するとき、該大きな線分パターンの大きさに関わらず、他の複数の線分パターンが構成する直線パターンを抽出し、1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出する
ことを特徴とする罫線抽出方法。
Estimating the size of the standard pattern as a standard pattern with a pattern of a standard size often included in the input image,
Set a threshold of the thickness or length of the linear pattern based on the information of the size of the standard pattern,
The information on one or more line segments is stored separately from the information on the line segment patterns whose thickness is larger than the threshold value and the information on the small line segment patterns other than the large line segment patterns. The connection state of the patterns is checked, and when the large line segment pattern exists in the middle, regardless of the size of the large line segment pattern, a straight line pattern constituted by other plural line segment patterns is extracted , and one or more line patterns are extracted. By extracting a straight line pattern thicker than the threshold value of the thickness or a straight line pattern shorter than the threshold value of the length from the straight line pattern, a straight line pattern of a ruled line candidate is extracted.
A method for extracting ruled lines , characterized in that :
入力画像に多く含まれる標準的な大きさのパターンを標準パターンとして該標準パターンの大きさを推定し、
前記標準パターンの大きさの情報に基づいて直線パターンの太さまたは長さのしきい値を設定し、
1つ以上の直線パターンから該太さのしきい値より太い直線パターンまたは該長さのしきい値より短い直線パターンを除去することにより、罫線候補の直線パターンを抽出し、
前記罫線候補の直線パターンのうちの1つの直線パターンを構成する1つ以上の線分パターンのうち、標準的な大きさの線分パターンを表す1つ以上の線分矩形を、該1つの直線パターンの周囲で該1つの直線パターンの長さ方向と垂直にシフトさせながら、各シフト位置における該1つ以上の線分矩形の内部の画素数の総和を求める処理を繰り返して、得られた黒画素数の総和を各シフト位置に対してプロットすることにより、該1つの直線パターンの周囲における線分矩形のシフト量と黒画素数の総和との関係を表すグラフを生成し、
前記グラフの形状に基づいて前記1つの直線パターンを除去するかどうかを判定する
ことを特徴とする罫線抽出方法。
Estimating the size of the standard pattern as a standard pattern with a pattern of a standard size often included in the input image,
Set a threshold of the thickness or length of the linear pattern based on the information of the size of the standard pattern,
By removing a line pattern that is thicker than the thickness threshold or a line pattern that is shorter than the length threshold from one or more line patterns, a line pattern of a ruled line candidate is extracted,
One or more line segment rectangles representing a standard-sized line segment pattern among one or more line segment patterns constituting one straight line pattern among the straight line patterns of the ruled line candidates are defined by the one straight line. The process of obtaining the total number of black pixels inside the one or more line segment rectangles at each shift position while shifting vertically around the length of the one linear pattern around the pattern is obtained. By plotting the total number of black pixels for each shift position, a graph representing the relationship between the shift amount of the line segment rectangle around the one straight line pattern and the total number of black pixels is generated,
Determining whether to remove the one straight line pattern based on the shape of the graph
A method for extracting ruled lines , characterized in that :
JP34685097A 1996-12-20 1997-12-16 Ruled line extracting apparatus and method for extracting ruled lines from general document images Expired - Fee Related JP3565310B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP34685097A JP3565310B2 (en) 1996-12-20 1997-12-16 Ruled line extracting apparatus and method for extracting ruled lines from general document images

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP8-342185 1996-12-20
JP34218596 1996-12-20
JP34685097A JP3565310B2 (en) 1996-12-20 1997-12-16 Ruled line extracting apparatus and method for extracting ruled lines from general document images

Publications (2)

Publication Number Publication Date
JPH10232939A JPH10232939A (en) 1998-09-02
JP3565310B2 true JP3565310B2 (en) 2004-09-15

Family

ID=26577181

Family Applications (1)

Application Number Title Priority Date Filing Date
JP34685097A Expired - Fee Related JP3565310B2 (en) 1996-12-20 1997-12-16 Ruled line extracting apparatus and method for extracting ruled lines from general document images

Country Status (1)

Country Link
JP (1) JP3565310B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4588000B2 (en) * 2006-09-04 2010-11-24 三星デジタルイメージング株式会社 Imaging apparatus and imaging method
JP6272061B2 (en) * 2014-01-31 2018-01-31 キヤノン株式会社 Image forming apparatus, control method thereof, and program

Also Published As

Publication number Publication date
JPH10232939A (en) 1998-09-02

Similar Documents

Publication Publication Date Title
EP0854434B1 (en) Ruled line extracting apparatus for extracting ruled line from normal document image and method thereof
JP3904840B2 (en) Ruled line extraction device for extracting ruled lines from multi-valued images
KR100311633B1 (en) Title extraction apparatus and method from document image
JP2951814B2 (en) Image extraction method
EP0854433B1 (en) Caption and photo extraction from scanned document images
EP2569930B1 (en) Segmentation of a word bitmap into individual characters or glyphs during an ocr process
EP1310912A2 (en) Image processing method, apparatus and system
JP3393098B2 (en) Apparatus and method for extracting user-enclosed area
JP3411472B2 (en) Pattern extraction device
Mohammad et al. An adaptive text-line extraction algorithm for printed Arabic documents with diacritics
JP2006085665A (en) Image processing device, image processing program, storage medium, image processing method, and image forming apparatus
JP4049560B2 (en) Halftone dot removal method and system
US6175664B1 (en) Optical character reader with tangent detection for detecting tilt of image data
JP3565310B2 (en) Ruled line extracting apparatus and method for extracting ruled lines from general document images
JP2006253842A (en) Image processor, image forming apparatus, program, storage medium and image processing method
JP3852218B2 (en) Image processing method and image processing apparatus
JP2868134B2 (en) Image processing method and apparatus
JP3798179B2 (en) Pattern extraction device and character segmentation device
JPH10154204A (en) Pattern recognition device and method therefor
JP3517077B2 (en) Pattern extraction device and method for extracting pattern area
JP4194309B2 (en) Document direction estimation method and document direction estimation program
JPH11191135A (en) Japanese/english discriminating method for document image, document recognizing method and recording medium
JPH05159062A (en) Document recognition device
JP3534997B2 (en) Ruled line extraction device and method
JPH04130979A (en) Character picture segmenting method

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040330

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040506

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20040601

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040602

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20090618

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20100618

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20110618

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20120618

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20120618

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20130618

Year of fee payment: 9

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

Free format text: PAYMENT UNTIL: 20140618

Year of fee payment: 10

LAPS Cancellation because of no payment of annual fees