JP4208520B2 - Image processing apparatus, image processing method, program, and storage medium - Google Patents

Image processing apparatus, image processing method, program, and storage medium Download PDF

Info

Publication number
JP4208520B2
JP4208520B2 JP2002244991A JP2002244991A JP4208520B2 JP 4208520 B2 JP4208520 B2 JP 4208520B2 JP 2002244991 A JP2002244991 A JP 2002244991A JP 2002244991 A JP2002244991 A JP 2002244991A JP 4208520 B2 JP4208520 B2 JP 4208520B2
Authority
JP
Japan
Prior art keywords
ruled line
line information
partial
image processing
edge
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
JP2002244991A
Other languages
Japanese (ja)
Other versions
JP2004086436A (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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP2002244991A priority Critical patent/JP4208520B2/en
Publication of JP2004086436A publication Critical patent/JP2004086436A/en
Application granted granted Critical
Publication of JP4208520B2 publication Critical patent/JP4208520B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明が属する技術分野】
本発明は画像処理装置および画像処理方法、プログラムおよび記憶媒体に関するものである。
【0002】
【従来の技術】
近年、情報の電子化が進み、紙文書と電子化文書を相互に変換する需要が高まっている。紙文書を電子化する際には、スキャナなどにより画像を光電変換して画素データ化するだけでなく、記載内容毎に領域分割し、記載内容に最適の形態でデータ化することが望ましい。
【0003】
領域分割に際しては、記載内容を認識し、テキスト領域、記号領域、図領域、写真領域、表領域等、性質の異なる領域毎に分割し、テキスト領域や記号領域は文字コード情報、図領域内の線データや表領域の表枠はベクトルデータ、写真領域は画素データ、表の内容は構造データ等にデータ化する。
【0004】
表形式の文書は、その論理的内部構造が重要であることはいうまでもないが、罫線の形状は、意匠的効果やデータ構造の視覚的表現として大きな意味を持っており、それらの情報を忠実に抽出する必要性は高い。
【0005】
また、紙データを参考に帳票文書を電子的に作成する際、あらかじめ紙面の表情報を忠実にデータ化できれば、文書作成の手間を大きく軽減することができる。
【0006】
領域分割処理に関しては、例えばUSP5680478号公報記載の処理が提案されており、文書画像中の黒画素塊、白画素塊の集合を抽出し、その形状、大きさ、集合状態等から、文字、絵や図、表、枠、線といった特徴的な領域を抽出している。
【0007】
また領域分割処理を使わずに、画像からランレングス等を用いて原始的な線情報を抽出する方法も存在する。
【0008】
【発明が解決しようとする課題】
しかし、USP5680478号公報記載の領域分割処理は、表領域及び論理的内部構造は認識するものの、表罫線の線の太さや属性等、意匠的効果やデータ構造の視覚的表現に関する情報は抽出できなかった。
【0009】
特に、処理の高速化のために、処理対象画像を縮小して領域分割することがあり、処理結果を実サイズに戻す際に、座標値に量子化誤差が生じる。
【0010】
またランレングス等による線情報の抽出では、線の集合のデータが得られるのみであり、論理的内部構造の情報等は得られず、文字や図など、表以外の情報が混在している画像では、罫線部分を正しく抽出できず、抽出された情報には誤りが多く含まれる。
【0011】
本発明は、このような従来の問題点を解消すべく創案されたもので、表、文字、画像などが混在する画像から、表の罫線に関する情報を正しく抽出することを目的とする。
【0012】
【課題を解決するための手段】
本発明に係る画像処理装置は、2値画像データから表領域を抽出する領域抽出手段と、前記抽出された表領域内部の白画素塊の境界近傍において左右方向のエッジと上下方向のエッジを求め、該左右方向のエッジと上下方向のエッジそれぞれから求めたエッジヒストグラムに基づいて、部分罫線情報を取得する部分罫線情報取得手段と、前記部分罫線情報に基づいて、前記表領域の罫線情報を取得する罫線情報取得手段とを備える。これによって表の罫線に関する情報を正しく抽出し得る。
【0013】
本発明に係る画像処理装置は、罫線枠角部が曲線であったとき、前記曲線の曲率半径を求める罫線枠角部処理手段をさらに備えることにより、表の意匠的表現力を高め得る。
【0014】
本発明に係る画像処理装置において、前記罫線情報取得手段は、前記部分罫線情報取得手段で取得した部分罫線情報に含まれる該部分罫線の位置情報を、隣接する部分罫線の部分罫線情報に基づいて補正し、当該補正された部分罫線情報に基づいて、前記表領域の罫線情報を取得するものであってもよい。これによって表の部分罫線情報を正確に抽出でき、意匠的表現力をさらに高め得る。
【0015】
本発明に係る画像処理装置において、前記罫線情報取得手段は、前記部分罫線情報取得手段で取得した部分罫線情報に含まれる太さ情報をグループ化して、各グループの代表値を決定し、該部分罫線情報に含まれる太さ情報を該代表値に基づいて補正し、当該補正された部分罫線情報に基づいて、前記表領域の罫線情報を取得するものであってもよい。これによって表の部分罫線情報を正確に抽出でき、意匠的表現力を更に高め得る。
【0016】
本発明に係る画像処理装置において、前記罫線情報取得手段は、前記部分罫線情報に含まれる太さ情報が等しく、且つ同一直線上の位置に存在する部分罫線を統合して、前記表領域の罫線情報を取得するものであってもよい。これによって表の部分罫線情報を正確に抽出でき、意匠的表現力を更に高め得る。
本発明に係る画像処理装置において、前記部分罫線情報取得手段は、前記左右方向のエッジと上下方向のエッジそれぞれから求めたエッジヒストグラムに基づいて、通常の部分罫線が存在するか、2重罫線が存在するか、文字が接触した部分罫線が存在するか、罫線が存在しないか、片側が塗り潰しの領域であるか、の少なくともいずれかを判別し、該判別結果を前記部分罫線情報として取得するものであってもよい。
【0017】
本発明に係る画像処理装置において、前記領域抽出手段は、前記2値画像データから黒画素塊を抽出し、前記黒画素塊が略四角形であって、かつ内部の白画素塊が整列良であったときに、前記黒画素塊を表領域と判定するものであってもよい。これによって、表領域を正確に抽出し得る。
【0018】
本発明に係る画像処理装置において、前記罫線枠角部処理手段は、前記表領域内部の白画素隗に基づいて前記表を矩形領域とした場合の頂点を定め、該頂点から表領域内部に向かって傾きが略45度の直線に沿って罫線を構成する黒画素を探索し、該探索された黒画素の位置に基づいて前記曲率半径を求めるものであってもよい。これによって、デジタル画像における曲率半径を容易に求めることが可能である。
【0019】
本発明に係る画像処理方法は、画像処理装置の領域抽出手段が、2値画像データから表領域を抽出する領域抽出ステップと、画像処理装置の部分罫線情報取得手段が、前記抽出された表領域内部の白画素塊の境界近傍において左右方向のエッジと上下方向のエッジを求め、該左右方向のエッジと上下方向のエッジそれぞれから求めたエッジヒストグラムに基づいて、部分罫線情報を取得する部分罫線情報取得ステップと、画像処理装置の罫線情報取得手段が、前記部分罫線情報に基づいて、前記表領域の罫線情報を取得する罫線情報取得ステップとを備える。これによって、表の罫線に関する情報を正しく抽出し得る。
【0020】
【発明の実施の形態】
[画像処理装置]
次に本発明に係る画像処理装置の一実施形態を図面に基づいて説明する。
【0021】
図1は、本発明に係る画像処理装置の一実施例構成を示すブロック図、図2は、図1の画像処理装置の装置構成例の図である。
【0022】
図1において、画像処理装置100は、用紙に記録された画像を光電変換し、画素データとして入力する入力部101と、画像データから表および枠領域を抽出する領域分割処理部102と、表領域内の罫線の位置や太さなどの詳細情報を抽出する表罫線抽出部103と、表罫線の情報を出力する出力部104とを備える。
【0023】
図2において、画像処理装置100の装置構成例においては、スキャナ装置201によって入力部の光電変換動作を実行し、コンピュータ装置204によって領域分割処理部102および表罫線抽出部103の処理を実行する。ユーザはキーボード・マウスなどの入力装置203によって画像処理装置100の動作を制御する。なお、本実施形態では入力部としてスキャナ装置201を用いるものとするが、この入力部101は領域分割処理部102に画像データを入力するものであればどのようなものでもよく、例えば、ネットワークを介して接続された情報処理装置から画像データが送信されるものとしてもよい。
【0024】
画像処理装置100は、表罫線抽出部103で抽出した詳細情報を画像処理装置内部のメモリ(不図示)に出力して格納させる。出力部104はこの内部メモリに相当するものとするが、出力部104としてディスプレイ装置204およびプリンタ装置205を含むようにしてもよく、表罫線の情報は画面表示されたり、用紙に出力されたりする。
【0025】
[画像処理方法]
次に本発明に係る画像処理方法の一実施形態を図面に基づいて説明する。
【0026】
図3は、図1の画像処理装置で実行される画像処理方法の一実施形態を示すフローチャート、図4は、図3の画像処理方法における領域分割処理S302の詳細を示すフローチャート、図5は、図3の画像処理方法における罫線抽出処理S303の詳細を示すフローチャート、図6は、図1の画像処理装置に入力される画像の例を示す図、図7は、図4の領域分割処理による属性毎の領域分類の例を示す図、図8は、8連結の黒画素塊の例を示す図、図9は、4連結の白画素塊の例を示す図、図10は、四角形の黒画素塊とそれ以外の黒画素塊の例を示す図、図11は、黒画素塊内部の白画素塊の整列状態例を示す図、図12は、表の論理的内部構造の抽出例を示す図、図13は、表内の部分罫線に対する左右エッジのピークの例を示す図、図14は、仰角45度の接線位置と半径の関係を示す図、図15は、罫線補正処理の例を示す図、図16は、罫線の論理位置の例を示す図、図17は、図4の領域分割処理による属性毎の領域分類の他の例を示す図である。
【0027】
図1の画像処理装置で実行される画像処理方法は以下のステップを含む。
【0028】
ステップS301:紙文書をスキャンして、該用紙に記載されている画像から電子的な2値画像を得る。なお、スキャナ201で紙文書を多値(グレイスケールあるいはフルカラー)でスキャンして2値化の処理まで実行するようにしてもよいし、あるいは、スキャナ201で紙文書を多値でスキャンし、これをコンピュータ装置204において2値化するようにしてもよい。
【0029】
ステップS302:領域分割処理部102において領域分割処理を実行する。領域分割処理は、例えば、図17における文字、図、表を含む画像17Aを、文字領域C17−1、C17−2、C17−3、C17−4、図領域P17、表領域T17、線領域L17の各領域に分割する。本実施形態では、この領域分割処理で得られた領域のうち表領域T17を特に注目し、該表領域に対して行われる処理について述べることとする。なお、領域分割処理の詳細については、図4のフローチャートを用いて後述する。
【0030】
ステップS303:表領域は罫線で囲まれた白画素隗の領域(「行列」という。)を含み、ここでは各行列(白画素隗領域)を囲む各罫線を部分罫線ということとする。ステップS303では、部分罫線を抽出し、その位置、太さを特定する。ステップS302の領域分割処理で複数の表領域が抽出された場合、各表領域について部分罫線の抽出、特定を実行する。部分罫線の処理では、図13(A)の部分罫線、(B)の上下罫線に接触した文字、(C)の2重罫線、(D)の文字が接触した部分罫線が抽出される。部分罫線の処理については、図5のフローチャートを用いて後述する。
【0031】
ステップS304:行列を囲む罫線枠の角部が曲線状であったとき、その曲率半径を検出する。例えば、図14に示すような罫線枠の角部につき、その曲率半径rを式1401(図14参照:r=n/(2−(2^(1/2))))により算出する。表罫線抽出処理部で抽出された表罫線情報に基づき出力する画像において曲率半径rを正確に再現すれば、表の意匠的効果やデータ構造の視覚的表現が再現され、画像の説得力が高まる。曲率半径rを求める処理については後述する。
【0032】
ステップS305:図15は文字が接触した部分罫線であり、2重罫線と誤認識される。このような誤認識を修正するため、隣合う部分罫線の位置を参照して、部分罫線の情報を補正する。部分罫線補正の処理については後述する。
【0033】
ステップS306:図16に示すように、3行3列の表は部分罫線が水平、垂直方向に直列する。この直列状態を検出すれば、全体の行列の罫線が直線で表現されるように、部分罫線を統合し得る。これによって表の意匠的表現力を高め得る。部分罫線の統合処理については後述する。
【0034】
ステップS307:ステップS302〜S306の処理に基づき、罫線位置、太さ、内部論理構造、角部曲率半径に加え、統合された罫線の始点、終点の情報を含む罫線情報を出力する。例えば、図16の3行3列の表の最上辺の罫線において、始点、終点の情報は、線の交点に割り当てた論理位置を用いて[0,0]−[3,0]と表現される。
【0035】
以上の処理により、表、文字、画像などが混在する画像から、表の罫線に関する情報を正しく抽出し得る。
【0036】
図4において、ステップS302における領域分割処理は以下のステップにより実行される。なお解像度の高い画像に対しては、処理の高速化のため、画像に縮小処理を施してから領域分割処理をおこなうことが一般的である。領域分割処理終了後には、その出力領域情報の座標値を元の座標系に戻し、元のサイズにおける領域情報に復元する。ここでは、処理結果のうち、表あるいは枠の領域情報を利用することを想定し、文字や図など他属性の領域に対する処理の詳細な説明は省略する。
【0037】
ステップS401:画像からすべての黒画素の8連結輪郭塊を抽出する。黒画素の8連結輪郭塊とは、図8に示すように、縦横斜めの少なくともいずれかで接触した黒画素の集合の輪郭(以下「黒画素塊」という。)のことである。なお、輪郭が黒画素であることが黒画素塊の条件であり、輪郭以外の内部がすべて白画素であっても、黒画素塊と呼ぶ。
【0038】
ステップS402:全ての黒画素塊について高さ、幅を求め、所定の最大文字高さ、最大文字幅に基づく閾値と比較する。高さ、幅がこの閾値より小さい黒画素塊を文字要素と判断し、「CHAR」の符号を付す。「CHAR」の黒画素塊のうち近接したものをグループ化し、「TEXT」の符号を付す。なお文字の処理は本発明とは直接関係がないので説明を省略する。高さまたは幅が閾値以上の黒画素塊についてはステップS403に移行する。
【0039】
ステップS403:黒画素塊は縦横比を求め、所定値以上の縦長または横長の黒画素塊については線と判定し、「LINE」の符号を付す。縦長または横長でなかった黒画素塊についてはステップS404に移行する。
【0040】
ステップS404:黒画素塊の輪郭に注目し、輪郭が細い斜めの線状であるとき、黒画素塊を斜線と判定し、ステップS403と同様、「LINE」の符号を付す。輪郭が細い斜めの線状でないと判断した場合はステップS405に進む。
【0041】
ステップS405:黒画素塊の輪郭形状が四角形かどうかを判定する。四角形であると判断したならばステップS406に移行し、四角形でないと判断した場合は、黒画素塊を図と判断して、「PICTURE」の符号を付す。例えば、図10において、(A)の表の画像は四角形の黒画素塊と判断され、(B)の鳥の画像は四角形以外の黒画素塊と判断される。
【0042】
ステップS406:黒画素塊の内部に存在する白画素の4連結塊を抽出する。白画素の4連結領域塊とは、図9に示すように、縦横のいずれか(斜め方向を除く)で接触した白画素の集合の輪郭(以下「白画素塊」という。)のことである。
【0043】
ステップS407:ステップS406で抽出された白画素塊の整列良否を判定する。白画素塊の形状がほぼ四角形であり、かつ黒画素塊内をほぼ隙間無く埋めている場合、白画素塊の整列を良と判定する。内部白画素塊の整列が良い黒画素塊は表と判定し、「TABLE」の符号を付す。整列が良くない黒画素塊は図と判定し、「PICTURE」の符号を付す。例えば、図11において、(a)、(b)の表は、内部白画素塊が整列良と判断され、「TABLE」の符号が付される。図11(c)の星形を含む領域は整列不良と判定され、「PICTURE」の符号が付される。
【0044】
例えば図6に示す、表、文字、図を含む画像を、ステップS402〜S407の処理により領域分割すれば、図7のデータが生成され、文字領域「TEXT」、図領域「PICTURE」、表領域「TABLE」が抽出される。
【0045】
ステップS408:以上の処理で領域分割された画像について、表領域「TABLE」の内部構造から行列情報を抽出する。すなわち、表領域内部の白画素塊を、表構造を論理的に表現できるような行列上へ仮想的に配置する。この行列は、表領域を水平、垂直の境界線で区切り、1個のセル(升目)内に2つ以上の白画素塊を存在させない。このように形成した表において、各セルに座標(x,y)を与える。xは行内位置、yは列内位置を示す。座標は各白画素塊が表構造を論理的に表現するとき、行列上の配置に対応する。前記水平方向の境界線のうち近接するものをグループ化し、グループ内で平均的位置に統合することにより、表の水平罫線の候補が抽出される。同様に、前記垂直方向の境界線のうち近接するものをグループ化し、グループ内で平均的位置に統合することにより、表の垂直罫線の候補が抽出される。
【0046】
図12において、図12(a)は「TABLE」の符号が付された黒画素塊であり、内部に8個の白画素塊が存在する。図12(b)に示すように、これら白画素塊の外接四角形群は8個存在し、図12(c)に示すように、これら外接四角形の水平境界線を統合することにより水平罫線が生成される。同様に垂直方向の境界線を統合し、図12(d)に示すように、セルが決定される。各セルには座標(x,y)を与える。図12(e)は、白画素塊を行列にあてはめた状態を示す。
【0047】
ステップS409:表領域の各白画素塊に対し、その内部に黒画素が存在するかどうか調べ、存在する場合は処理対象にその黒画素塊を追加する。
【0048】
ステップS410:文書画像データ中に未処理の黒画素塊があればステップS402に戻り、全ての黒画素塊を処理し終えたところで、領域分割処理を終了する。
【0049】
ステップS303における部分罫線抽出処理を、図5を用いて説明する(なお、図5は垂直方向罫線を抽出する場合である)。ここでは、表領域内に存在する白画素塊(行列)に注目し、その白画素隗の境界に部分罫線が存在すると仮定し、その正確な位置や太さの情報を求める。白画素塊の領域座標は、罫線と接触した文字やノイズなどにより、実際の罫線とずれている場合がある。
【0050】
なお、元画像を縮小して領域分割処理をおこなった場合、求めた座標値が例えば4あるいは2の倍数に限定されているので、縮小なしの画像で以下の処理を行う必要がある。ステップS303の処理によって、正確な部分罫線情報が抽出できる。
【0051】
ステップS501:白画素隗の外接矩形領域の境界線を初期の罫線位置候補とし、その境界線の近傍に所定幅×白画素塊高さの探索領域をとる。
ステップS502:探索領域内で、右方向エッジ(右に白画素が存在する黒画素)のヒストグラムと左方向エッジ(左に白画素が存在する黒画素)のヒストグラムを取得する。右方向エッジのヒストグラムとは、右に白画素が存在する黒画素のx座標値を抽出し、各x座標値において右方向エッジの個数をカウントしたものである。左方向エッジのヒストグラムとは、左に白画素が存在する黒画素のx座標値を抽出し、各x座標値において左方向エッジの個数をカウントしたものである。
【0052】
ステップS503:右方向エッジのヒストグラムおよび左方向エッジのヒストグラムのピークを求め、ピーク数、座標値、ピーク値(回数)を求める。取得したピーク数(0〜k)およびその座標値、ピーク値は記憶しておく。
【0053】
なお最大値抽出を容易にするため、ヒストグラムに対し適宜フィルタを施してもよい。また、最大ピーク数は2以上の数で制限してもよい。本例では、左右方向それぞれのエッジで、最大2個のピークを取得するとして、左方向エッジのピーク数をLkとし、座標値、ピーク値をそれぞれ(Lx1,Lp1)、(Lx2,Lp2)とし、右方向エッジのピーク数をRkとし、座標値、ピーク値を(Rx1,Rp1)、(Rx2,Rp2)と表現する。なおLp1>Lp2、Rp1>Rp2である。
【0054】
さらに、探索領域の高さに対し所定の比率をなす値を閾値Tとし、閾値T以下のピークを無視したときのピーク数をLn、Rnとする。
【0055】
図13において、Ln、Rnの組み合わせにより、探索領域の罫線の状態は(A)、(B)、(C)、(D)のように分類される。(A)はLn=Rn=1であり、部分罫線である。(B)はLn=Rn=0であり、部分罫線は存在しない。(C)はLn=Rn=2であり、2重罫線である。(D)はLn=0またはRn=0であり、文字が接触した部分罫線である。図13の破線1301は探索領域を示す。
【0056】
ステップS504:Ln=Rn=1か否か判断し、Ln=Rn=1ならばステップS505に移行し、それ以外ならばステップS508に移行する。
【0057】
ステップS505:Lx1<=Rx1か否か判断し、Lx1<=Rx1ならばステップS506に移行する。
【0058】
ステップS506:(Lx1+Rx1)/2の位置に太さ(Rx1−Lx1+1)の罫線が存在すると判定する。それ以外のときは、ステップS507に移行する。
【0059】
ステップS507:罫線は存在しないと判定する。
【0060】
ステップS508:Ln=Rn=0か否か判断し、Ln=Rn=0ならばステップS509に移行し、それ以外のときはステップS509に移行する。
【0061】
ステップS509:Ln=Rn=2か否か判断し、Ln=Rn=2ならばステップS510に移行し、それ以外のときはステップS512に移行する。
【0062】
ステップS510:Lx1<=Rx1<Lx2<=Rx2か、Lx1<=Rx2<Lx2<Rx1か、Lx2<=Rx1<Lx1<=Rx2か、あるいはLx2<=Rx2<Lx1<=Rx1のいずれかを満たすか判断する。これらのいずれかであったときはステップS511に移行し、それ以外のときはステップS516に移行する。
【0063】
ステップS511:{min(Lx1,Lx2)+max(Rx1,Rx2)}/2の位置に、太さ{max(Rx1,Rx2)−min(Lx1,Lx2)+1}の2重罫線が存在すると判断する。
【0064】
ステップS512:Ln=0またはRn=0か否か判断し、Ln=0またはRn=0のときはステップS513に移行する。それ以外のときはステップS516に移行する。
【0065】
ステップS513:Ln=0ならば左方向エッジヒストグラムに閾値T以下のピークがあるかどうかを調べ、Rn=0ならば右方向エッジヒストグラムに、閾値T以下のピークがあるかどうかを調べる。ピークがあればステップS514に移行し、それ以外はステップS515に移行する。
【0066】
ステップS514:探索領域において、片側に文字などが接触して明確なエッジは現れていないが、罫線は存在していると判定する。ピークがない場合は、ステップS515に移行する。
【0067】
ステップS515:片側が塗り潰しの領域であると判定する。
【0068】
ステップS516:ステップS504、S508、S509、S512のいずれもあてはまらない場合、すなわちLn=2かつRn=1、またはLn=1かつRn=2の場合ステップS516が実行され、Lx1<=Rx1のときステップS517に移行する。それ以外のときはステップS518に移行する。
【0069】
ステップS517:(Lx1+Rx1)/2の位置に太さ(Rx1−Lx1+1)の罫線が存在すると判定する。それ以外の場合はステップS518に移行する。
【0070】
ステップS518:Ln=2かつLx2<=Rx1のときステップS519に移行する。それ以外の場合はステップS520に移行する。
【0071】
ステップS519:(Lx2+Rx1)/2の位置に太さ(Rx1−Lx2+1)の罫線が存在すると判定する。
【0072】
ステップS520:Rn=2かつLx1<=Rx2のときステップS521に移行する。それ以外の場合はステップS522に移行する。
【0073】
ステップS521:(Lx1+Rx2)/2の位置に太さ(Rx2−Lx1+1)の罫線が存在すると判断する。
【0074】
ステップS522:探索領域には罫線は存在しないと判定する。
【0075】
以上のステップS501〜S522の処理は、全ての白画素塊の左右方向エッジに適用される。但し、同一罫線について処理が重複しないようにする。これによって垂直方向罫線が抽出される。
【0076】
さらに、白画素塊の上下方向エッジについて同様の処理を実行し、水平方向罫線を抽出する。処理内容は、左右方向エッジと方向が90度異なるだけであり、全く同様であるので、説明は省略する。
【0077】
図14に示すように、罫線枠角部の曲率半径の算出に際しては、角部の頂点Pにおいて曲線に接し、かつ水平な罫線に対し45度の角度をなす直線Lを引く。直線Lと水平な罫線との交点をQとするとき、PQ間の距離nと曲率半径rとの間には、式1401(図14参照:r=n/(2−(2^(1/2))))の関係が成立する。よって、距離nを検出することによって曲率半径rを求めることができる。
【0078】
実画像上ではこのような幾何学的な処理が容易でないこともあり、例えば、以下のような処理が採用される。
【0079】
まず注目する角部(ここでは表枠の左下の角が円弧を描いている場合を例にして説明する)において、説明を簡単にするため、水平な座標軸(図14のx軸)の原点を白画素塊左端に対応させ、水平な座標軸(図14のy軸)の原点を白画素塊下端に対応させた座標系を定義するものとする(なお、この座標系に限らず、任意の座標系で処理可能である)。この座標系で、図14の直線M上の画素を原点Pから円弧の中心に向かって探索する。白画素塊の高さをhとすると、探索していく画素の座標(i,j)は、i=j=0,1,2,3・・・,hの順で探索していき、最初に黒画素となった座標を直線Lと罫線の円弧とが接する接点Sとみなす。このときの接点Sの座標を(is, is)とすると、PQ間の距離nは、n=2*isで求められるので、画素数nと上式1401により、曲率半径を計算できる。
【0080】
なお黒画素を発見したときも、その黒画素が孤立点であるかどうか調べ、孤立点であると判断すればノイズとして処理し、更に探索を続けることにより、ノイズに対しても頑健なものとなる。
【0081】
図15において、注目する罫線が文字「外」と接触しているとき、ステップS303の処理では、左方向エッジのピークとして(Lx1,Lp1)、(Lx2,Lp2)、右方向エッジのピークとして(Rx1,Rp1)、(Rx2,Rp2)が抽出される。ここでは、Lx1〜Rx2間に2重罫線があると誤認識される。しかし、ステップS305において、ひとつ下の罫線の左右端と最も一致するピークの組を再探索し、Lx2、Rx2を得る。これにより、上の部分罫線の位置および太さ情報は正確なものに修正される。
【0082】
図16において、直列する部分罫線を統合して意匠的効果の高い3行3列の表が生成されている。部分罫線の統合に際しては、同一線上にあり(直列する)、同じ太さの部分罫線を統合して、罫線情報を整理する。
【0083】
ステップS305までの処理で求められた部分罫線の位置は、ノイズや付着画素、あるいは読み取り解像度に起因する量子化誤差等により、誤差を含む。そこで、部分罫線の太さを平均化する。平均化は、全部分罫線の太さの分布を求め、グループ化可能な太さをグループ化する。各グループの太さの平均値等から太さの代表値を設定し、各グループに属する部分罫線の太さを代表値に統一する。2重罫線は他の部分罫線と別にグループ化してもよい。
【0084】
その後、統一された太さが等しく、かつ同一線上で隣りあう部分罫線を一本の罫線に統合する。同様に、罫線の位置についても、平均的な位置となるように調整する。
【0085】
以上の処理により出力された罫線情報は、画像に表示したり、再び紙に出力するための基礎情報として用いることができる。しかも、罫線の物理的情報として位置や太さなどが対ノイズ、画像状態変動に対して良好に得られるうえに、論理的表構造配置にも適合するものであるので、種々の用途に親和性の高い情報となっている。
【0086】
[プログラム]
図1、図2の画像処理装置における制御プログラムには、前記画像処理方法の実施形態を実行するためのプログラムが含まれる。このプログラムはステップS301〜S307、ステップS401〜S410、ステップS501〜S522の処理を実行するルーチンを含む。
【0087】
[記憶媒体]
本発明にかかる画像処理方法は図1、図2の画像処理装置以外の装置、例えば汎用的なコンピュータでも実施可能であり、その場合、記憶媒体等で提供される制御プログラムを汎用コンピュータの外部記憶装置にセットし、オペレータ等の指示によりCPU等で実行してもよい。
【0088】
【発明の効果】
本発明によれば、表の罫線に関する情報を正しく抽出し得る。
また、罫線情報を正しく抽出できるので、表を正確に再現することも可能となる。
【図面の簡単な説明】
【図1】 本発明に係る画像処理装置の一実施例構成を示すブロック図である。
【図2】 図1の画像処理装置の装置構成例の図である。
【図3】 図1の画像処理装置で実行される画像処理方法の一実施形態を示すフローチャートである。
【図4】 図3の画像処理方法における領域分割処理を示すフローチャートである。
【図5】 図3の画像処理方法における罫線抽出処理を示すフローチャートである。
【図6】 図1の画像処理装置に入力される画像の例を示す図である。
【図7】 図4の領域分割処理による属性毎の領域分類の例を示す図である。
【図8】 8連結の黒画素塊の例を示す図である。
【図9】 4連結の白画素塊の例を示す図である。
【図10】 四角形の黒画素塊とそれ以外の黒画素塊の例を示す図である。
【図11】 黒画素塊内部の白画素塊の整列状態例を示す図である。
【図12】 表の論理的内部構造の抽出例を示す図である。
【図13】 表内の部分罫線に対する左右エッジのピークの例を示す図である。
【図14】 仰角45度の接線位置と半径の関係を示す図である。
【図15】 罫線補正処理の例を示す図である。
【図16】 罫線の論理位置の例を示す図である。
【図17】 図4の領域分割処理による属性毎の領域分類の他の例を示す図である。
【符号の説明】
100 画像処理装置
101 入力部
102 領域分割部
103 表罫線抽出部
104 出力部
[0001]
[Technical field to which the invention belongs]
The present invention relates to an image processing apparatus, an image processing method, a program, and a storage medium.
[0002]
[Prior art]
In recent years, computerization of information has progressed, and there is an increasing demand for mutual conversion between paper documents and computerized documents. When a paper document is digitized, it is desirable not only to photoelectrically convert the image into a pixel data by a scanner or the like, but also to divide the area for each description content and convert it into a data that is optimal for the description content.
[0003]
When dividing the area, it recognizes the contents of the description and divides it into areas with different properties such as text area, symbol area, figure area, photo area, table area, etc. Line data and the table frame of the table area are converted into vector data, the photograph area is converted into pixel data, and the table contents are converted into structure data.
[0004]
Needless to say, the logical internal structure of tabular documents is important, but the shape of ruled lines has a great meaning as a visual representation of design effects and data structures. The need to extract faithfully is high.
[0005]
Further, when a form document is electronically created with reference to paper data, if the table information on the paper surface can be faithfully converted into data in advance, the time and labor required for document creation can be greatly reduced.
[0006]
Regarding the area division processing, for example, the processing described in US Pat. No. 5,680,478 has been proposed. A set of black pixel blocks and white pixel blocks in a document image is extracted, and characters, pictures, and the like are extracted from the shape, size, set state, and the like. And characteristic areas such as charts, tables, frames, and lines are extracted.
[0007]
There is also a method for extracting primitive line information from an image using run length or the like without using region division processing.
[0008]
[Problems to be solved by the invention]
However, the area dividing process described in US Pat. No. 5,680,478 recognizes the table area and the logical internal structure, but cannot extract information on the design effect and the visual representation of the data structure, such as the thickness and attribute of the table ruled line. It was.
[0009]
In particular, in order to speed up the processing, the processing target image may be reduced and divided into regions, and when the processing result is returned to the actual size, a quantization error occurs in the coordinate value.
[0010]
Extraction of line information by run length, etc. can only obtain data of a set of lines, not information of logical internal structure, etc., and images that contain information other than tables such as characters and diagrams However, the ruled line portion cannot be extracted correctly, and the extracted information contains many errors.
[0011]
The present invention has been made to solve such a conventional problem, and it is an object of the present invention to correctly extract information on ruled lines of a table from an image in which tables, characters, images, and the like are mixed.
[0012]
[Means for Solving the Problems]
An image processing apparatus according to the present invention includes an area extraction unit that extracts a table area from binary image data, and a boundary between white pixel blocks inside the extracted table area. Left and right edges and top and bottom Find the edge of the direction Left and right edges and top and bottom Partial ruled line information acquisition means for acquiring partial ruled line information based on edge histograms obtained from each edge in the direction, and ruled line information acquisition means for acquiring ruled line information of the table area based on the partial ruled line information . As a result, information regarding the ruled lines of the table can be correctly extracted.
[0013]
The image processing apparatus according to the present invention can further enhance the design expressive power of the table by further including ruled line frame corner processing means for obtaining the curvature radius of the curved line when the ruled line frame corner is a curve.
[0014]
In the image processing apparatus according to the present invention, the ruled line information acquisition unit may determine the position information of the partial ruled line included in the partial ruled line information acquired by the partial ruled line information acquisition unit based on the partial ruled line information of adjacent partial ruled lines. Correction may be performed and the ruled line information of the table area may be acquired based on the corrected partial ruled line information. Thereby, the partial ruled line information of the table can be extracted accurately, and the design expressive power can be further enhanced.
[0015]
In the image processing apparatus according to the present invention, the ruled line information acquisition unit groups thickness information included in the partial ruled line information acquired by the partial ruled line information acquisition unit, determines a representative value of each group, The thickness information included in the ruled line information may be corrected based on the representative value, and the ruled line information of the table area may be acquired based on the corrected partial ruled line information. Thereby, the partial ruled line information of the table can be accurately extracted, and the design expressive power can be further enhanced.
[0016]
In the image processing apparatus according to the present invention, the ruled line information acquisition unit integrates partial ruled lines that are equal in thickness information included in the partial ruled line information and are located on the same straight line, so that the ruled line of the table area is integrated. Information may be acquired. Thereby, the partial ruled line information of the table can be accurately extracted, and the design expressive power can be further enhanced.
In the image processing apparatus according to the present invention, the partial ruled line information acquisition means includes the Left and right edges and top and bottom Normal partial ruled line based on edge histogram obtained from each edge in direction Is there Double ruled line Is there , Partial ruled lines where characters touch Is present, or there is no ruled line, or one side is filled Or at least one of them may be determined, and the determination result may be acquired as the partial ruled line information.
[0017]
In the image processing apparatus according to the present invention, the region extracting unit extracts a black pixel block from the binary image data, the black pixel block is substantially square, and the internal white pixel block is well aligned. The black pixel block may be determined as a surface area. As a result, the table area can be accurately extracted.
[0018]
In the image processing apparatus according to the present invention, the ruled line frame corner processing means determines a vertex when the table is a rectangular region based on white pixels in the table region, and moves from the vertex toward the inside of the table region. Alternatively, a black pixel constituting a ruled line may be searched along a straight line having an inclination of about 45 degrees, and the radius of curvature may be obtained based on the position of the searched black pixel. Thereby, the radius of curvature in the digital image can be easily obtained.
[0019]
An image processing method according to the present invention includes: The area extraction means of the image processing device A region extracting step of extracting a table region from the binary image data; The partial ruled line information acquisition means of the image processing device In the vicinity of the boundary of the white pixel block inside the extracted table area Left and right edges and top and bottom Find the edge of the direction Left and right edges and top and bottom A partial ruled line information acquisition step for acquiring partial ruled line information based on an edge histogram obtained from each edge in the direction; Ruled line information acquisition means of the image processing device A ruled line information acquisition step of acquiring ruled line information of the table area based on the partial ruled line information. As a result, information regarding the ruled lines of the table can be correctly extracted.
[0020]
DETAILED DESCRIPTION OF THE INVENTION
[Image processing device]
Next, an embodiment of an image processing apparatus according to the present invention will be described with reference to the drawings.
[0021]
FIG. 1 is a block diagram showing a configuration of an embodiment of an image processing apparatus according to the present invention, and FIG. 2 is a diagram of a configuration example of the image processing apparatus of FIG.
[0022]
In FIG. 1, an image processing apparatus 100 photoelectrically converts an image recorded on a sheet and inputs it as pixel data, an area division processing unit 102 that extracts a table and a frame area from image data, a table area A table ruled line extraction unit 103 that extracts detailed information such as the position and thickness of the ruled line in the table, and an output unit 104 that outputs information on the table ruled line.
[0023]
In FIG. 2, in the device configuration example of the image processing apparatus 100, the photoelectric conversion operation of the input unit is executed by the scanner device 201, and the processing of the area division processing unit 102 and the table ruled line extraction unit 103 is executed by the computer device 204. The user controls the operation of the image processing apparatus 100 using the input device 203 such as a keyboard / mouse. In this embodiment, the scanner device 201 is used as an input unit. However, the input unit 101 may be any unit that inputs image data to the area division processing unit 102. For example, a network is used. The image data may be transmitted from an information processing apparatus connected via the network.
[0024]
The image processing apparatus 100 outputs and stores the detailed information extracted by the table ruled line extraction unit 103 to a memory (not shown) inside the image processing apparatus. Although the output unit 104 corresponds to the internal memory, the output unit 104 may include a display device 204 and a printer device 205, and information on the front ruled line is displayed on a screen or output to paper.
[0025]
[Image processing method]
Next, an embodiment of an image processing method according to the present invention will be described with reference to the drawings.
[0026]
FIG. 3 is a flowchart showing an embodiment of an image processing method executed by the image processing apparatus of FIG. 1, FIG. 4 is a flowchart showing details of the region division processing S302 in the image processing method of FIG. 3, and FIG. 3 is a flowchart showing details of ruled line extraction processing S303 in the image processing method of FIG. 3, FIG. 6 is a diagram showing an example of an image input to the image processing apparatus of FIG. 1, and FIG. FIG. 8 shows an example of an 8-connected black pixel block, FIG. 9 shows an example of a 4-connected white pixel block, and FIG. 10 shows a rectangular black pixel. FIG. 11 is a diagram showing an example of an alignment state of white pixel blocks inside a black pixel block, and FIG. 12 is a diagram showing an example of extraction of a logical internal structure of a table. FIG. 13 is a diagram showing an example of left and right edge peaks for partial ruled lines in the table. 14 is a diagram showing the relationship between the tangent position at an elevation angle of 45 degrees and the radius, FIG. 15 is a diagram showing an example of ruled line correction processing, FIG. 16 is a diagram showing an example of logical positions of ruled lines, and FIG. It is a figure which shows the other example of the area | region classification for every attribute by this area | region division process.
[0027]
The image processing method executed by the image processing apparatus of FIG. 1 includes the following steps.
[0028]
Step S301: A paper document is scanned to obtain an electronic binary image from the image described on the paper. Note that the scanner 201 may scan the paper document with multiple values (gray scale or full color) and execute binarization processing, or the scanner 201 may scan the paper document with multiple values and May be binarized in the computer device 204.
[0029]
Step S302: The area division processing unit 102 executes area division processing. In the area dividing process, for example, an image 17A including characters, figures, and tables in FIG. 17 is converted into character areas C17-1, C17-2, C17-3, C17-4, figure area P17, table area T17, and line area L17. Divide each area. In the present embodiment, the table area T17 among the areas obtained by the area division process will be particularly noted, and the process performed on the table area will be described. The details of the area division processing will be described later with reference to the flowchart of FIG.
[0030]
Step S303: The table area includes an area of white pixels 囲 ま (referred to as “matrix”) surrounded by ruled lines. Here, each ruled line surrounding each matrix (white pixel 隗 area) is referred to as a partial ruled line. In step S303, a partial ruled line is extracted and its position and thickness are specified. When a plurality of table areas are extracted by the area dividing process in step S302, partial ruled lines are extracted and specified for each table area. In the process of the partial ruled line, the partial ruled line in FIG. 13A, the character in contact with the upper and lower ruled lines in (B), the double ruled line in (C), and the partial ruled line in contact with the character in (D) are extracted. The process of partial ruled lines will be described later with reference to the flowchart of FIG.
[0031]
Step S304: When the corner of the ruled line frame surrounding the matrix is curved, the radius of curvature is detected. For example, the radius of curvature r of a corner portion of a ruled line frame as shown in FIG. 14 is calculated by an expression 1401 (see FIG. 14: r = n / (2- (2 ^ (1/2)))). If the radius of curvature r is accurately reproduced in the image output based on the table ruled line information extracted by the table ruled line extraction processing unit, the design effect of the table and the visual expression of the data structure are reproduced, and the persuasive power of the image is increased. . The process for obtaining the curvature radius r will be described later.
[0032]
Step S305: FIG. 15 shows a partial ruled line in contact with a character, which is erroneously recognized as a double ruled line. In order to correct such erroneous recognition, the information on the partial ruled lines is corrected with reference to the positions of the adjacent partial ruled lines. The partial ruled line correction process will be described later.
[0033]
Step S306: As shown in FIG. 16, in the 3 × 3 table, the partial ruled lines are arranged in series in the horizontal and vertical directions. If this serial state is detected, the partial ruled lines can be integrated so that the ruled lines of the entire matrix are represented by straight lines. This can enhance the design expressive power of the table. The partial ruled line integration process will be described later.
[0034]
Step S307: Based on the processing of steps S302 to S306, in addition to the ruled line position, thickness, internal logical structure, and corner radius of curvature, ruled line information including integrated ruled line start point and end point information is output. For example, in the ruled line on the uppermost side of the table of 3 rows and 3 columns of FIG. 16, the information of the start point and the end point is expressed as [0,0]-[3,0] using the logical position assigned to the intersection of the lines. The
[0035]
With the above processing, information regarding the ruled lines of the table can be correctly extracted from an image in which tables, characters, images, and the like are mixed.
[0036]
In FIG. 4, the area dividing process in step S302 is executed by the following steps. For high-resolution images, in order to increase the processing speed, it is common to perform region division processing after reducing the image. After the region division processing is completed, the coordinate value of the output region information is returned to the original coordinate system and restored to the region information at the original size. Here, it is assumed that area information of a table or a frame is used in the processing results, and detailed description of the processing for areas of other attributes such as characters and diagrams is omitted.
[0037]
Step S401: Extract eight connected contour blocks of all black pixels from the image. As shown in FIG. 8, the black pixel 8-connected contour block is a contour of a set of black pixels (hereinafter referred to as “black pixel block”) in contact with at least one of vertical and horizontal directions. Note that a black pixel block is that the contour is a black pixel, and even if the inside other than the contour is all white pixels, it is called a black pixel block.
[0038]
Step S402: The height and width are obtained for all black pixel blocks, and compared with thresholds based on a predetermined maximum character height and maximum character width. A black pixel block whose height and width are smaller than the threshold values is determined as a character element, and a symbol “CHAR” is attached. Among the black pixel blocks of “CHAR”, those close to each other are grouped and given a “TEXT” symbol. Since character processing is not directly related to the present invention, description thereof is omitted. For a black pixel block whose height or width is greater than or equal to the threshold value, the process proceeds to step S403.
[0039]
Step S403: A black pixel block is obtained with an aspect ratio, and a vertically or horizontally long black pixel block exceeding a predetermined value is determined to be a line, and is labeled with “LINE”. For black pixel blocks that are not vertically long or horizontally long, the process proceeds to step S404.
[0040]
Step S404: Paying attention to the outline of the black pixel block, when the outline is a thin diagonal line, the black pixel block is determined to be a diagonal line, and the sign of “LINE” is added as in step S403. If it is determined that the contour is not a thin diagonal line, the process proceeds to step S405.
[0041]
Step S405: It is determined whether the outline shape of the black pixel block is a quadrangle. If it is determined that the pixel is a quadrangle, the process proceeds to step S406. If it is determined that the pixel is not a quadrangle, the black pixel block is determined to be a figure, and a “PICTURE” symbol is assigned. For example, in FIG. 10, the image in the table of (A) is determined to be a square black pixel block, and the bird image of (B) is determined to be a black pixel block other than a square.
[0042]
Step S406: Four connected chunks of white pixels existing inside the black pixel chunk are extracted. As shown in FIG. 9, the four connected region block of white pixels is the outline of a set of white pixels (hereinafter referred to as “white pixel block”) in contact in either the vertical or horizontal direction (excluding the diagonal direction). .
[0043]
Step S407: It is determined whether or not the white pixel block extracted in step S406 is aligned. If the shape of the white pixel block is substantially square and the black pixel block is filled with almost no gap, the alignment of the white pixel block is determined to be good. A black pixel block in which the internal white pixel block is well aligned is determined to be a table, and is labeled “TABLE”. A black pixel block that is not well aligned is determined to be a figure and is given the symbol “PICTURE”. For example, in FIG. 11, in the tables of (a) and (b), the internal white pixel block is determined to be well-aligned, and is labeled “TABLE”. The area including the star shape in FIG. 11C is determined to be misaligned, and is given the symbol “PICTURE”.
[0044]
For example, if an image including a table, characters, and diagrams shown in FIG. 6 is divided into regions by the processes of steps S402 to S407, the data of FIG. “TABLE” is extracted.
[0045]
Step S408: The matrix information is extracted from the internal structure of the table region “TABLE” for the image divided into regions by the above processing. That is, the white pixel block in the table area is virtually arranged on a matrix that can logically represent the table structure. In this matrix, a table area is divided by horizontal and vertical boundaries, and two or more white pixel blocks do not exist in one cell (cell). In the table formed in this way, coordinates (x, y) are given to each cell. x indicates an in-row position, and y indicates an in-column position. The coordinates correspond to the arrangement on the matrix when each white pixel block logically represents the table structure. By grouping adjacent horizontal boundary lines and integrating them into an average position within the group, candidates for horizontal ruled lines in the table are extracted. Similarly, candidates for vertical ruled lines in a table are extracted by grouping adjacent ones of the boundary lines in the vertical direction and integrating them into an average position within the group.
[0046]
In FIG. 12, FIG. 12A shows a black pixel block labeled “TABLE”, and there are eight white pixel blocks inside. As shown in FIG. 12B, there are eight circumscribed square groups of these white pixel blocks. As shown in FIG. 12C, horizontal ruled lines are generated by integrating the horizontal boundary lines of these circumscribed squares. Is done. Similarly, the boundary lines in the vertical direction are integrated, and a cell is determined as shown in FIG. Each cell is given coordinates (x, y). FIG. 12E shows a state where white pixel blocks are applied to a matrix.
[0047]
Step S409: For each white pixel block in the table area, it is checked whether or not there is a black pixel inside. If there is, the black pixel block is added to the processing target.
[0048]
Step S410: If there is an unprocessed black pixel block in the document image data, the process returns to step S402, and when all the black pixel blocks have been processed, the region dividing process is terminated.
[0049]
The partial ruled line extraction process in step S303 will be described with reference to FIG. 5 (note that FIG. 5 shows a case where a vertical ruled line is extracted). Here, attention is paid to a white pixel block (matrix) existing in the table region, and it is assumed that a partial ruled line exists at the boundary of the white pixel 隗, and information on the accurate position and thickness is obtained. The area coordinates of the white pixel block may deviate from the actual ruled line due to characters or noise that come into contact with the ruled line.
[0050]
Note that when the original image is reduced and the region dividing process is performed, the obtained coordinate value is limited to a multiple of 4 or 2, for example, and therefore the following process needs to be performed on the image without the reduction. Through the processing in step S303, accurate partial ruled line information can be extracted.
[0051]
Step S501: The boundary line of the circumscribed rectangular area of the white pixel と し is set as the initial ruled line position candidate, and a search area of a predetermined width × white pixel block height is taken near the boundary line.
Step S502: A histogram of a right edge (a black pixel having a white pixel on the right) and a histogram of a left edge (a black pixel having a white pixel on the left) are acquired within the search area. The histogram of the right edge is obtained by extracting the x coordinate value of a black pixel having a white pixel on the right and counting the number of right edges at each x coordinate value. The histogram of the left edge is obtained by extracting the x coordinate value of a black pixel having a white pixel on the left and counting the number of left edges in each x coordinate value.
[0052]
Step S503: The right edge histogram and the left edge histogram peak are obtained, and the peak number, coordinate value, and peak value (number of times) are obtained. The acquired peak number (0 to k), its coordinate value, and peak value are stored.
[0053]
In order to facilitate maximum value extraction, a filter may be appropriately applied to the histogram. The maximum number of peaks may be limited by a number of 2 or more. In this example, it is assumed that a maximum of two peaks are acquired at each edge in the left and right directions, the number of peaks at the left edge is Lk, and the coordinate values and peak values are (Lx1, Lp1) and (Lx2, Lp2), respectively. The peak number of the right edge is Rk, and the coordinate value and peak value are expressed as (Rx1, Rp1) and (Rx2, Rp2). Note that Lp1> Lp2 and Rp1> Rp2.
[0054]
Further, a value forming a predetermined ratio with respect to the height of the search area is set as a threshold T, and the numbers of peaks when ignoring peaks below the threshold T are set as Ln and Rn.
[0055]
In FIG. 13, the state of the ruled line in the search area is classified as (A), (B), (C), (D) by the combination of Ln and Rn. (A) is Ln = Rn = 1 and is a partial ruled line. (B) is Ln = Rn = 0, and there is no partial ruled line. (C) is Ln = Rn = 2 and is a double ruled line. (D) is Ln = 0 or Rn = 0, and is a partial ruled line in contact with characters. A broken line 1301 in FIG. 13 indicates a search area.
[0056]
Step S504: It is determined whether Ln = Rn = 1. If Ln = Rn = 1, the process proceeds to step S505. Otherwise, the process proceeds to step S508.
[0057]
Step S505: It is determined whether Lx1 <= Rx1, and if Lx1 <= Rx1, the process proceeds to step S506.
[0058]
Step S506: It is determined that a ruled line having a thickness (Rx1-Lx1 + 1) exists at the position of (Lx1 + Rx1) / 2. Otherwise, the process proceeds to step S507.
[0059]
Step S507: It is determined that there is no ruled line.
[0060]
Step S508: It is determined whether Ln = Rn = 0. If Ln = Rn = 0, the process proceeds to step S509. Otherwise, the process proceeds to step S509.
[0061]
Step S509: It is determined whether or not Ln = Rn = 2. If Ln = Rn = 2, the process proceeds to step S510, and otherwise, the process proceeds to step S512.
[0062]
Step S510: Lx1 <= Rx1 <Lx2 <= Rx2, Lx1 <= Rx2 <Lx2 <Rx1, Lx2 <= Rx1 <Lx1 <= Rx2, or Lx2 <= Rx2 <Lx1 <= Rx1 is satisfied Judge. If it is any of these, the process proceeds to step S511, and otherwise, the process proceeds to step S516.
[0063]
Step S511: It is determined that a double ruled line having a thickness {max (Rx1, Rx2) -min (Lx1, Lx2) +1} exists at a position of {min (Lx1, Lx2) + max (Rx1, Rx2)} / 2. .
[0064]
Step S512: It is determined whether Ln = 0 or Rn = 0. If Ln = 0 or Rn = 0, the process proceeds to step S513. Otherwise, the process proceeds to step S516.
[0065]
Step S513: If Ln = 0, it is checked whether the left edge histogram has a peak below the threshold T, and if Rn = 0, it is checked whether the right edge histogram has a peak below the threshold T. If there is a peak, the process proceeds to step S514, and otherwise, the process proceeds to step S515.
[0066]
Step S514: In the search area, it is determined that a ruled line is present although a character or the like is in contact with one side and no clear edge appears. If there is no peak, the process proceeds to step S515.
[0067]
Step S515: It is determined that one side is a painted area.
[0068]
Step S516: If none of Steps S504, S508, S509, and S512 applies, that is, if Ln = 2 and Rn = 1, or Ln = 1 and Rn = 2, Step S516 is executed, and if Lx1 <= Rx1, Step S516 is executed. The process proceeds to S517. Otherwise, the process proceeds to step S518.
[0069]
Step S517: It is determined that a ruled line having a thickness (Rx1-Lx1 + 1) exists at the position of (Lx1 + Rx1) / 2. Otherwise, the process proceeds to step S518.
[0070]
Step S518: When Ln = 2 and Lx2 <= Rx1, the process proceeds to step S519. Otherwise, the process proceeds to step S520.
[0071]
Step S519: It is determined that a ruled line having a thickness (Rx1-Lx2 + 1) exists at the position of (Lx2 + Rx1) / 2.
[0072]
Step S520: When Rn = 2 and Lx1 <= Rx2, the process proceeds to step S521. Otherwise, the process proceeds to step S522.
[0073]
Step S521: It is determined that a ruled line having a thickness (Rx2-Lx1 + 1) exists at the position of (Lx1 + Rx2) / 2.
[0074]
Step S522: It is determined that there is no ruled line in the search area.
[0075]
The processes in steps S501 to S522 are applied to the left and right edges of all white pixel blocks. However, processing should not be repeated for the same ruled line. As a result, a vertical ruled line is extracted.
[0076]
Further, the same processing is executed for the vertical edge of the white pixel block to extract a horizontal ruled line. The processing contents are exactly the same except that the direction is 90 degrees different from the left-right direction edge, and the description is omitted.
[0077]
As shown in FIG. 14, when calculating the radius of curvature of the corner of the ruled line frame, a straight line L that touches the curve at the apex P of the corner and forms an angle of 45 degrees with respect to the horizontal ruled line is drawn. When the intersection of the straight line L and the horizontal ruled line is Q, there is an expression 1401 (see FIG. 14: r = n / (2- (2 ^ (1 / 2)))) is established. Therefore, the radius of curvature r can be obtained by detecting the distance n.
[0078]
Such geometric processing may not be easy on a real image. For example, the following processing is adopted.
[0079]
First, in the corner of interest (here, the case where the lower left corner of the table frame draws an arc will be described as an example), in order to simplify the explanation, the origin of the horizontal coordinate axis (x-axis in FIG. 14) is set. A coordinate system is defined that corresponds to the left end of the white pixel block and the origin of the horizontal coordinate axis (y-axis in FIG. 14) corresponds to the bottom end of the white pixel block (not limited to this coordinate system, but arbitrary coordinates) System can be processed). In this coordinate system, the pixels on the straight line M in FIG. 14 are searched from the origin P toward the center of the arc. When the height of the white pixel block is h, the coordinates (i, j) of the pixel to be searched are searched in the order of i = j = 0, 1, 2, 3,. The coordinates of the black pixel are regarded as the contact S where the straight line L and the arc of the ruled line contact. Assuming that the coordinates of the contact S at this time are (is, is), the distance n between PQs is obtained by n = 2 * is.
[0080]
Even when a black pixel is found, it is checked whether the black pixel is an isolated point, and if it is determined to be an isolated point, it is processed as noise, and further searching is continued to be robust against noise. Become.
[0081]
In FIG. 15, when the ruled line of interest is in contact with the character “outside”, the processing in step S303 is (Lx1, Lp1), (Lx2, Lp2) as the peak in the left direction edge, and ( Rx1, Rp1) and (Rx2, Rp2) are extracted. Here, it is erroneously recognized that there is a double ruled line between Lx1 and Rx2. However, in step S305, a pair of peaks that most closely matches the left and right ends of the next lower ruled line is searched again to obtain Lx2 and Rx2. As a result, the position and thickness information of the upper partial ruled line is corrected to be accurate.
[0082]
In FIG. 16, a 3 × 3 table with a high design effect is generated by integrating the partial ruled lines in series. When integrating partial ruled lines, ruled line information is organized by integrating partial ruled lines that are on the same line (in series) and have the same thickness.
[0083]
The position of the partial ruled line obtained by the processing up to step S305 includes an error due to noise, attached pixels, a quantization error caused by reading resolution, or the like. Therefore, the thickness of the partial ruled lines is averaged. In the averaging, the distribution of thicknesses of all partial ruled lines is obtained, and the groupable thicknesses are grouped. A representative value of the thickness is set from the average value of the thickness of each group, and the thickness of the partial ruled lines belonging to each group is unified to the representative value. Double ruled lines may be grouped separately from other partial ruled lines.
[0084]
Thereafter, the partial ruled lines having the same uniform thickness and adjacent on the same line are integrated into one ruled line. Similarly, the position of the ruled line is also adjusted to be an average position.
[0085]
The ruled line information output by the above processing can be used as basic information to be displayed on an image or output again on paper. In addition, the physical information of the ruled lines can be obtained with respect to noise and image state fluctuations in terms of position and thickness, etc., and is compatible with logical table structure layout, so it is compatible with various applications. High information.
[0086]
[program]
The control program in the image processing apparatus of FIGS. 1 and 2 includes a program for executing the embodiment of the image processing method. This program includes a routine for executing the processes of steps S301 to S307, steps S401 to S410, and steps S501 to S522.
[0087]
[Storage medium]
The image processing method according to the present invention can also be implemented by an apparatus other than the image processing apparatuses of FIGS. 1 and 2, for example, a general-purpose computer. In this case, a control program provided on a storage medium or the like is stored in an external storage of the general-purpose computer. It may be set in the apparatus and executed by a CPU or the like according to an instruction from an operator or the like.
[0088]
【The invention's effect】
According to the present invention, it is possible to correctly extract information related to the ruled line of the table.
Further, the ruled line information can be correctly extracted, so that the table can be accurately reproduced.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration of an embodiment of an image processing apparatus according to the present invention.
FIG. 2 is a diagram illustrating an example of a device configuration of the image processing device in FIG. 1;
FIG. 3 is a flowchart showing an embodiment of an image processing method executed by the image processing apparatus of FIG. 1;
4 is a flowchart showing region division processing in the image processing method of FIG. 3;
5 is a flowchart showing ruled line extraction processing in the image processing method of FIG. 3;
6 is a diagram illustrating an example of an image input to the image processing apparatus in FIG. 1. FIG.
7 is a diagram illustrating an example of region classification for each attribute by the region division processing of FIG. 4; FIG.
FIG. 8 is a diagram illustrating an example of eight connected black pixel blocks;
FIG. 9 is a diagram illustrating an example of a 4-connected white pixel block.
FIG. 10 is a diagram illustrating an example of a rectangular black pixel block and other black pixel blocks.
FIG. 11 is a diagram illustrating an example of an alignment state of white pixel blocks inside a black pixel block.
FIG. 12 is a diagram illustrating an example of extracting a logical internal structure of a table.
FIG. 13 is a diagram showing an example of left and right edge peaks for partial ruled lines in a table.
FIG. 14 is a diagram showing a relationship between a tangent position at an elevation angle of 45 degrees and a radius.
FIG. 15 is a diagram illustrating an example of ruled line correction processing;
FIG. 16 is a diagram illustrating an example of logical positions of ruled lines.
FIG. 17 is a diagram illustrating another example of area classification for each attribute by the area division processing in FIG. 4;
[Explanation of symbols]
100 Image processing apparatus
101 Input section
102 Region division unit
103 Table ruled line extraction unit
104 Output section

Claims (12)

2値画像データから表領域を抽出する領域抽出手段と、
前記抽出された表領域内部の白画素塊の境界近傍において左右方向のエッジと上下方向のエッジを求め、該左右方向のエッジと上下方向のエッジそれぞれから求めたエッジヒストグラムに基づいて、部分罫線情報を取得する部分罫線情報取得手段と、
前記部分罫線情報に基づいて、前記表領域の罫線情報を取得する罫線情報取得手段と、
を備えることを特徴とする画像処理装置。
Area extraction means for extracting a table area from binary image data;
Obtains the vertical edges and horizontal direction of the edge near the boundary of the extracted table region inside the white pixel block, based on the edge histogram calculated from each edge of the horizontal direction of the edge in the vertical direction, part ruled line information Partial ruled line information acquisition means for acquiring
Ruled line information acquisition means for acquiring ruled line information of the table area based on the partial ruled line information;
An image processing apparatus comprising:
罫線枠角部が曲線であったとき、前記曲線の曲率半径を求める罫線枠角部処理手段をさらに備えたことを特徴とする請求項1記載の画像処理装置。  2. The image processing apparatus according to claim 1, further comprising ruled line frame corner processing means for obtaining a radius of curvature of the curved line when the ruled line frame corner is a curve. 前記罫線情報取得手段は、前記部分罫線情報取得手段で取得した部分罫線情報に含まれる該部分罫線の位置情報を、隣接する部分罫線の部分罫線情報に基づいて補正し、当該補正された部分罫線情報に基づいて、前記表領域の罫線情報を取得することを特徴とする請求項1または2のいずれかに記載の画像処理装置。  The ruled line information acquisition unit corrects the position information of the partial ruled line included in the partial ruled line information acquired by the partial ruled line information acquisition unit based on the partial ruled line information of the adjacent partial ruled line, and the corrected partial ruled line The image processing apparatus according to claim 1, wherein ruled line information of the table area is acquired based on the information. 前記罫線情報取得手段は、前記部分罫線情報取得手段で取得した部分罫線情報に含まれる太さ情報をグループ化して、各グループの代表値を決定し、該部分罫線情報に含まれる太さ情報を該代表値に基づいて補正し、当該補正された部分罫線情報に基づいて、前記表領域の罫線情報を取得することを特徴とする請求項1乃至3のいずれかに記載の画像処理装置。  The ruled line information acquisition unit groups thickness information included in the partial ruled line information acquired by the partial ruled line information acquisition unit, determines a representative value of each group, and determines the thickness information included in the partial ruled line information. The image processing apparatus according to claim 1, wherein the image processing apparatus corrects based on the representative value, and acquires ruled line information of the table area based on the corrected partial ruled line information. 前記罫線情報取得手段は、前記部分罫線情報に含まれる太さ情報が等しく、且つ同一直線上の位置に存在する部分罫線を統合して、前記表領域の罫線情報を取得することを特徴とする請求項1乃至4のいずれかに記載の画像処理装置。  The ruled line information acquisition means acquires the ruled line information of the table region by integrating partial ruled lines that are equal in thickness information included in the partial ruled line information and are present on the same straight line. The image processing apparatus according to claim 1. 前記部分罫線情報取得手段は、前記左右方向のエッジと上下方向のエッジそれぞれから求めたエッジヒストグラムに基づいて、通常の部分罫線が存在するか、2重罫線が存在するか、文字が接触した部分罫線が存在するか、罫線が存在しないか、片側が塗り潰しの領域であるか、の少なくともいずれか判別し、該判別結果を前記部分罫線情報として取得することを特徴とする請求項1乃至5のいずれかに記載の画像処理装置。The partial ruled line information acquisition unit is configured to determine whether a normal partial ruled line exists, a double ruled line exists, or a character contacts based on edge histograms obtained from the left and right edges and the vertical edges. 6. The method according to claim 1, wherein at least one of a ruled line is present, a ruled line is not present, and one side is a filled area is determined, and the determination result is acquired as the partial ruled line information. An image processing apparatus according to any one of the above. 前記領域抽出手段は、前記2値画像データから黒画素塊を抽出し、前記黒画素塊が略四角形であって、かつ内部の白画素塊が整列良であったときに、前記黒画素塊を表領域と判定することを特徴とする請求項1乃至6のいずれかに記載の画像処理装置。  The region extracting means extracts a black pixel block from the binary image data, and when the black pixel block is substantially square and the internal white pixel block is well aligned, The image processing apparatus according to claim 1, wherein the image processing apparatus is determined as a table area. 前記罫線枠角部処理手段は、前記表領域内部の白画素隗に基づいて前記表を矩形領域とした場合の頂点を定め、該頂点から表領域内部に向かって傾きが略45度の直線に沿って罫線を構成する黒画素を探索し、該探索された黒画素の位置に基づいて前記曲率半径を求めることを特徴とする請求項2に記載の画像処理装置。  The ruled line frame corner processing means determines a vertex when the table is a rectangular region based on the white pixel wrinkles inside the table region, and makes a straight line with an inclination of approximately 45 degrees from the vertex toward the inside of the table region. The image processing apparatus according to claim 2, wherein a black pixel that forms a ruled line is searched for, and the curvature radius is obtained based on a position of the searched black pixel. 前記左右方向のエッジとは、右に白画素が存在する黒画素を示す右方向エッジと、左に白画素が存在する黒画素を示す右方向エッジであり、The left and right edge is a right edge indicating a black pixel having a white pixel on the right and a right edge indicating a black pixel having a white pixel on the left,
前記部分罫線情報取得手段は、前記左右方向のエッジから求めたエッジヒストグラムに基づいて、垂直方向罫線の部分罫線情報を取得することを特徴とする請求項1乃至8のいずれかに記載の画像処理装置。The image processing according to any one of claims 1 to 8, wherein the partial ruled line information acquisition unit acquires partial ruled line information of a vertical ruled line based on an edge histogram obtained from the left and right edges. apparatus.
画像処理装置の領域抽出手段が、2値画像データから表領域を抽出する領域抽出ステップと、
画像処理装置の部分罫線情報取得手段が、前記抽出された表領域内部の白画素塊の境界近傍において左右方向のエッジと上下方向のエッジを求め、該左右方向のエッジと上下方向のエッジそれぞれから求めたエッジヒストグラムに基づいて、部分罫線情報を取得する部分罫線情報取得ステップと、
画像処理装置の罫線情報取得手段が、前記部分罫線情報に基づいて、前記表領域の罫線情報を取得する罫線情報取得ステップと、
を備えることを特徴とする画像処理方法。
A region extracting step in which a region extracting unit of the image processing device extracts a table region from the binary image data;
Part ruled line information acquisition unit of the image processing apparatus, the vertical edges and horizontal direction of the edge near the boundary of the extracted table region inside the white pixel blocks determined, with the horizontal direction of the edge from the vertical edge, respectively Based on the obtained edge histogram, a partial ruled line information acquisition step for acquiring partial ruled line information;
Ruled line information acquisition means for acquiring ruled line information of the table area based on the partial ruled line information , the ruled line information acquiring unit of the image processing apparatus ;
An image processing method comprising:
2値画像データから表領域を抽出する領域抽出ステップと、
前記抽出された表領域内部の白画素塊の境界近傍において左右方向のエッジと上下方向のエッジを求め、該左右方向のエッジと上下方向のエッジそれぞれから求めたエッジヒストグラムに基づいて、部分罫線情報を取得する部分罫線情報取得ステップと、
前記部分罫線情報に基づいて、前記表領域の罫線情報を取得する罫線情報取得ステップと、
をコンピュータに実行させるため、コンピュータが実行可能なプログラム。
A region extracting step of extracting a table region from the binary image data;
Obtains the vertical edges and horizontal direction of the edge near the boundary of the extracted table region inside the white pixel block, based on the edge histogram calculated from each edge of the horizontal direction of the edge in the vertical direction, part ruled line information Partial ruled line information acquisition step for acquiring,
Ruled line information acquisition step for acquiring ruled line information of the table area based on the partial ruled line information;
For causing a computer to execute the computer-executable program.
請求項11に記載のプログラムが格納されたコンピュータ読取可能な記憶媒体。A computer-readable storage medium in which the program according to claim 11 is stored.
JP2002244991A 2002-08-26 2002-08-26 Image processing apparatus, image processing method, program, and storage medium Expired - Fee Related JP4208520B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002244991A JP4208520B2 (en) 2002-08-26 2002-08-26 Image processing apparatus, image processing method, program, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002244991A JP4208520B2 (en) 2002-08-26 2002-08-26 Image processing apparatus, image processing method, program, and storage medium

Publications (2)

Publication Number Publication Date
JP2004086436A JP2004086436A (en) 2004-03-18
JP4208520B2 true JP4208520B2 (en) 2009-01-14

Family

ID=32053314

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002244991A Expired - Fee Related JP4208520B2 (en) 2002-08-26 2002-08-26 Image processing apparatus, image processing method, program, and storage medium

Country Status (1)

Country Link
JP (1) JP4208520B2 (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008252862A (en) * 2007-03-05 2008-10-16 Ricoh Co Ltd Image processing apparatus, image processing method, and image processing program
JP5042917B2 (en) * 2007-07-12 2012-10-03 株式会社リコー Image processing apparatus and program
JP5361574B2 (en) * 2009-07-01 2013-12-04 キヤノン株式会社 Image processing apparatus, image processing method, and program
JP5465015B2 (en) 2010-01-06 2014-04-09 キヤノン株式会社 Apparatus and method for digitizing documents
US10607381B2 (en) 2014-07-07 2020-03-31 Canon Kabushiki Kaisha Information processing apparatus
JP6452329B2 (en) * 2014-07-07 2019-01-16 キヤノン株式会社 Information processing apparatus, information processing method, and program
JP6430919B2 (en) * 2015-11-27 2018-11-28 日本電信電話株式会社 Ruled line frame correction method, ruled line frame correction apparatus, and ruled line frame correction program
CN111860502A (en) * 2020-07-15 2020-10-30 北京思图场景数据科技服务有限公司 Picture table identification method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
JP2004086436A (en) 2004-03-18

Similar Documents

Publication Publication Date Title
JP4646797B2 (en) Image processing apparatus, control method therefor, and program
US7170647B2 (en) Document processing apparatus and method
JP3883696B2 (en) Method for scanning and detecting multiple photos and removing artificial edges
US8428356B2 (en) Image processing device and image processing method for generating electronic document with a table line determination portion
JP5934762B2 (en) Document modification detection method by character comparison using character shape characteristics, computer program, recording medium, and information processing apparatus
JP5387193B2 (en) Image processing system, image processing apparatus, and program
US20120243796A1 (en) Image processing apparatus, computer readable medium storing program, and image processing method
JP2012243307A (en) Method for detecting strain in input image, device for detecting strain in input image and computer readable medium
JP6874387B2 (en) Image processing equipment, image processing methods and programs
CN101697228A (en) Method for processing text images
JP2004126648A (en) Image processing method, image processor, and image processing program
CN114529925B (en) Method for identifying table structure of whole line table
US10423851B2 (en) Method, apparatus, and computer-readable medium for processing an image with horizontal and vertical text
JP4582204B2 (en) Image processing apparatus, image conversion method, and computer program
CN115619656A (en) Digital file deviation rectifying method and system
JP4208520B2 (en) Image processing apparatus, image processing method, program, and storage medium
JP5005732B2 (en) Image forming apparatus and image processing method
CN104463126A (en) Automatic slant angle detecting method for scanned document image
JP5271956B2 (en) Document orientation detection method and apparatus
JP6546385B2 (en) IMAGE PROCESSING APPARATUS, CONTROL METHOD THEREOF, AND PROGRAM
JP4825888B2 (en) Document image processing apparatus and document image processing method
US20020164087A1 (en) System and method for fast rotation of binary images using block matching method
CN107680046A (en) Image rectification method, device, storage medium and computer equipment
JP2013065164A (en) Image processing device, image processing method, and image processing program
JP5418057B2 (en) Image processing apparatus and computer program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050822

RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7421

Effective date: 20060606

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20080715

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20080916

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

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20081021

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

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20111031

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20121031

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20131031

Year of fee payment: 5

LAPS Cancellation because of no payment of annual fees