JP3733155B2 - Image processing apparatus and method - Google Patents
Image processing apparatus and method Download PDFInfo
- Publication number
- JP3733155B2 JP3733155B2 JP02290095A JP2290095A JP3733155B2 JP 3733155 B2 JP3733155 B2 JP 3733155B2 JP 02290095 A JP02290095 A JP 02290095A JP 2290095 A JP2290095 A JP 2290095A JP 3733155 B2 JP3733155 B2 JP 3733155B2
- Authority
- JP
- Japan
- Prior art keywords
- image
- area
- input image
- region
- binarization
- 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
Links
Images
Landscapes
- Character Input (AREA)
Description
【0001】
【産業上の利用分野】
本発明は画像処理装置及びその方法に関し、例えば、画像中の文字認識処理のための画像領域の分割処理を行なう画像処理装置及びその方法に関するものである。
【0002】
【従来の技術】
近年の画像処理技術の進歩に伴い、文字や写真、グラフ等が混在した画像を例えばコンピュータ等の画像処理装置において処理することが増えてきた。この場合の処理手順としては、まずスキャナ等の画像入力装置で処理対象の画像を読み取り、画像処理装置に入力する。そして、画像処理装置では入力された画像に対して黒画素領域を抽出する領域分割処理や光学的文字認識処理(以下、OCR処理)等を施し、文書管理を行って、得られた画像や文字を利用していた。尚、領域分割処理とは、画像中の黒画素を分割・抽出することにより、その画像中の文字/写真/グラフ/表等の領域をそれぞれの特徴によって分離し、各領域情報を取り出す処理である。また、OCR処理とは、画像内の文字領域について、該文字イメージを形成するビットマップを文字コードへ変換する文字認識処理である。
【0003】
次に、上述した従来の画像処理装置における文字を含んだ画像処理を図17のフローチャートに示し、説明する。
【0004】
まず、ステップS221で原稿となる画像をスキャナ等の画像処理装置により入力する。尚、この入力は、例えば8ビットの多値画像データとして行なわれる。次にステップS222において、画像入力時に発生するスキャナの電気的ノイズの除去をはじめ、入力された原稿画像の劣化、原稿の傾き等を補正する。次いでステップS223で、入力画像に対して所定の固定閾値による単純2値化を施して領域分割処理を行い、各領域データを出力することにより、文字領域を抽出する。尚、この時の単純2値化処理は、例えば入力画像の濃度に応じた2値化処理であっても良い。そしてステップS224では、抽出された文字領域に対して各領域毎にOCR処理又は擬似中間調処理等の所望する画像処理を行なうことにより、文字認識を行う。そして最後にステップS225において、認識された文字等の処理結果を表示する。
【0005】
以上説明した様に従来の画像処理装置においては、入力画像を固定閾値での単純2値化、又は原稿画像の濃度に応じた単純2値化の後、領域分割処理を行うことによって画像中の文書領域を抽出し、文字認識処理を行っていた。
【0006】
【発明が解決しようとする課題】
しかしながら、上記従来の画像処理装置においては、以下に示す問題点があった。
【0007】
例えば、原稿画像の下地が白であって、文字が黒色、又は灰色によって描かれている場合について考える。この場合、即ち原稿画像内に3つ以上の輝度レベル対象が混在しており、このような画像に対して固定閾値による単純2値化を施すと、灰色の文字領域については「白」として2値化される領域と、「黒」として2値化される領域とが発生する。これら2領域は不規則に発生するため、灰色文字のつぶれやかすれ等が発生し、高精度の2値化結果が得られなかった。従って正確な領域分割処理を行うことができなかった。
【0008】
また、原稿画像の濃度に応じた単純2値化を行う場合においても、例えば下地も純粋に「白」ではないため、下地を「白」、黒色文字と灰色文字を「黒」として2値化したり、又は、下地と灰色文字を「白」、黒色文字を「黒」として2値化してしまっていた。従って、やはり灰色文字を精度良く2値化することができないため正確な領域分割処理を行うことができなかった。
【0009】
更に、灰色文字の領域を灰色文字領域として、特に黒文字領域と区別するように分割することができなかった。
【0010】
本発明は上述した問題点を解決するためになされたものであり、3つ以上の輝度レベル対象が存在した画像を処理する場合においても、輝度階層別に高精度に2値化を行うことにより、正確な領域分割処理が可能となる画像処理装置及びその方法を提供することを目的とする。
【0011】
【課題を解決するための手段】
上述した目的を達成するために、本発明は以下の構成を備える。
【0012】
即ち、本発明の一側面に係る画像処理装置は、第1入力画像のヒストグラムを算出するヒストグラム算出手段と、前記ヒストグラムの分布の偏りを示す統計量が所定の範囲内に収まるように2値化閾値を設定する閾値設定手段と、前記閾値設定手段により設定された2値化閾値により前記第1入力画像を2値化して2値画像を生成する2値化手段と、前記2値化手段で生成された2値画像から領域を分割する領域分割手段と、前記分割された領域を前記第1入力画像から削除することによって第2入力画像を生成し、当該生成された第2入力画像を前記第1入力画像の代わりに用いて前記ヒストグラム算出手段と前記閾値設定手段と前記領域分割手段とによる処理を繰り返すことによって、輝度階層別に分割された領域を取得する繰り返し手段とを有することを特徴とする。
【0016】
【作用】
以上の構成により、輝度階層別に2値化閾値を算出し、該輝度階層別の2値化閾値により輝度階層別の2値画像を作成し、該輝度階層別の2値画像から領域を分割することができる。従って、画像中の輝度階層別の領域分割処理が可能な画像処理装置及びその方法を提供することができるという特有の作用効果が得られる。
【0017】
【実施例】
以下、本発明に係る一実施例について、図面を参照して詳細に説明する。
【0018】
図1は、本実施例における画像処理装置を含んだシステム構成を示すブロック図である。図1に示す各構成における動作の詳細については、後述する。
【0019】
図1において、1は本実施例における文書管理を行なう画像処理装置であり、2は画像を入力するスキャナ等の画像入力装置、3は処理後の画像を表示する画像表示装置である。
【0020】
画像処理装置1において、4は画像入力装置2とのインターフェースとなる入力部、5は処理中のデータを記憶するメモリ等の記憶部、6は入力画像の輝度頻度(ヒストグラム)を累計する輝度頻度累計部である。7は入力画像の輝度階層別の2値化閾値を算出する2値化閾値算出部であり、8は2値化閾値算出部7において算出された閾値を用いて輝度階層別の2値画像を作成する2値化部である。9は画像を属性毎の領域に分割する領域分割部であり、10は領域分割により文字領域として抽出された領域に対する文字認識処理を行う文字認識部、11は文字領域以外に分割された領域に対する各種画像処理を行う画像処理部、12は画像表示装置3とのインターフェースとなる出力部である。これら各構成は、不図示のCPUにより統括的に制御されている。
【0021】
以下、画像処理装置1における画像処理を図2のフローチャートに示し、説明する。
【0022】
まずステップS21で、画像入力装置2により原稿となる画像を入力部4を介して画像処理装置1に入力する。尚、この入力は8ビットの多値画像データとして行い、入力画像は不図示の作業用メモリに記憶される。そしてステップS22では、画像入力時に発生する画像入力装置2の電気的ノイズの除去や、原稿画像の劣化、原稿の傾き等、入力画像に対する補正を行う。次にステップS23に進み、輝度頻度累計部6,2値化閾値算出部7,及び2値化部8による輝度階層別の2値化処理と、領域分割部9による領域分割処理を行なう。ステップS23における輝度階層別領域分割処理の詳細については、後述する。
【0023】
次にステップS24に進み、ステップS23における輝度階層別の領域分割結果に応じて、文字領域に対しては文字認識部10でOCR処理を、文字領域以外に対しては画像処理部11で誤差拡散法やディザ法等の擬似中間調処理等の画像処理を行なう。そしてステップS25に進み、輝度階層別に画像処理された各領域を1枚の画像に合成し、合成された画像をステップS26で出力部12を介して画像表示装置3に表示する。
【0024】
<輝度階層別領域分割処理>
次に、図2のステップS23に示す輝度階層別領域分割処理について、詳細に説明する。
【0025】
本実施例においては、白地に黒色文字と灰色文字による文字が描かれている画像を処理する場合を例として、以下説明する。
【0026】
図4に、本実施例において処理される文字領域を含む画像の輝度頻度(ヒストグラム)の例を示す。
【0027】
図4に示すヒストグラムにおいて、横軸は左端が「0」、右端が「255」を表す輝度値であり、この値はデジタル値である。即ち、横軸の左端が「黒」、右端が「白」に相当する。また、縦軸は、夫々のデジタル値の頻度を表している。従って図4において、処理対象となる画像の白地部分は高輝度であるため右側の山に相当し、黒色文字部分は低輝度であるため左側の山に相当し、また、灰色文字は中輝度であるため、中央の山に相当する。
【0028】
以下、本実施例における輝度階層別領域分割処理を図3のフローチャートに示し、説明する。
【0029】
まず、ステップS31で輝度階層番号を「1」にセットする。ここで、輝度階層番号とは画像内の輝度頻度の特徴(山の数)に基づいて設定されるものであり、図4に示した例の場合、黒色文字の輝度階層番号が「1」、灰色文字の輝度階層番号が「2」、白地の輝度階層番号が「3」である。輝度階層番号は最終的に文字認識を行いたい輝度レベル毎に付与される。
【0030】
続いてステップS32において、領域分割の前処理として領域分割に最も適した閾値による単純2値化を行なう。その後ステップS33において、2値化された画像から黒画素領域を抽出して、その特徴等により文字領域、写真領域、図形領域等に分割する領域分割処理を行い、後述する領域データを出力する。そしてステップS34に進み、領域分割の後処理として領域誤りを除去する。ステップS34の領域誤り除去処理については、詳細を後述する。次にステップS35では、輝度階層番号が「1」以下であるか否かを判断する。輝度階層番号が「1」以下である、即ち「1」であれば処理はステップS36へ進み、「1」以下でない、即ち「2」以上であれば処理を終了する。
【0031】
尚、ステップS35においては輝度階層番号が「1」以下であるか否かの判定を行うが、この値は輝度階層番号の最大値「3」から固定値「2」を減じることにより設定する。これにより、本実施例は輝度階層数の増減にも対応することができる。
【0032】
ステップS36では、輝度階層番号が「1」、即ち黒色文字として分割された黒画素領域を、分割済み領域として入力画像から削除して記憶部5に格納しておく。この削除を行うことにより、輝度階層番号が「2」である領域、即ち灰色文字領域の分割処理を行なう際に、輝度階層番号が「1」である黒色文字領域を除いた領域のみに注目して処理することができる。そしてステップS37では、輝度階層番号に「1」を加算し、ステップS32の領域分割前処理へ戻る。
【0033】
以上説明したように本実施例の輝度階層別領域分割処理においては、まず輝度階層番号が「1」、即ち黒色文字領域である場合について2値化を行い、領域分割の後に領域誤りが除去され、該分割された黒画素領域が削除された後に、今度は輝度階層番号が「2」、即ち灰色文字領域である場合について2値化を行い、領域分割、領域誤り除去が行われる。
【0034】
<<領域分割前処理(2値化処理)>>
次に、図3のステップS32における領域分割前処理としての2値化処理について、図5のフローチャートを参照して詳細に説明する。ステップS32の領域分割前処理は、輝度階層番号が「1」である場合と「2」である場合との2回実行される。従って、それぞれに対応する2値化閾値としてTH1,TH2をパラメータとして使用するが、図5においてはこれをTHで一括して表記することとする。
【0035】
まず、輝度階層番号が「1」である場合について説明する。
【0036】
図5のステップS51においては、入力画像のヒストグラムを算出する。ここでは、画像中の全画素を用い、8ビット、即ち「0」から「255」までの各デジタル値に対する頻度を計算する。これにより、例えば図4に示したヒストグラムが得られる。
【0037】
次にステップS52において、パラメータSTART,ENDにそれぞれ「0」、「255」をセットする。START,ENDはそれぞれ、後段のステップS53やステップS54で求める輝度値の統計量の始点及び終点に対応する。
【0038】
ステップS53では、STARTからENDまでのデジタル値に対応する画素の平均値AVを算出する。例えば、START=0,END=255であれば「0」から「255」の値を持つ画素(この場合、全画素)の平均値AVを算出し、START=0,END=177であれば「0」から「177」の値を持つ画素の平均値AVを算出する。
【0039】
ステップS54では、STARTからENDまでの輝度値に対応する画素のスキュー値SKを算出する。スキュー値とは、ヒストグラム分布の偏りを示す統計量である。スキュー値の算出には、以下に示す(1)式を用いる。
【0040】
SK=(Σ(Xi−AV)^3)/D ・・・(1)
(尚、R^3 の表記によってRの3乗を示すものとする。)
ここで、Xiは画素の輝度値である。また、Dは画像全体の分散値であり、(2)式により算出される。
【0041】
D=Σ(Xi−AV)^2 ・・・(2)
(尚、R^2 の表記によってRの2乗を示すものとする。)
続いてステップS55、S56では、ヒストグラムの偏りの方向を判断する。まずステップS55では、以下に示す(3)式によりヒストグラムの偏りの方向を判断する。これは、ヒストグラムの偏りが左方向であるか否かの判断となる。
【0042】
SK<−1.0 ・・・(3)
ステップS55において(3)式が真ならばステップS59へ進み、偽ならばステップS56へ進む。ステップS59では、STARTは変化させず、ENDに平均値AVをセットする。そしてステップS53に戻り、再びSTART値からEND値までの平均値AVを算出する。
【0043】
一方、ステップS56では以下に示す(4)式によりヒストグラムの偏りの方向を判断する。これは、ヒストグラムの偏りが右方向であるか否かの判断となる。
【0044】
SK>1.0 ・・・(4)
ステップS56において(4)式が真ならばステップS510へ進み、偽ならばステップS57へ進む。ステップS510では、STARTに平均値AVをセットし、ENDは変化させない。そしてステップS53に戻り、再びSTART値からEND値までの平均値AVを算出する。
【0045】
一方、ステップS57ではステップS55,S56における条件が共に偽である場合の平均値AVを、2値化閾値TH1として設定する。そして、ステップS58で2値化閾値TH1を用いた単純2値化処理を行なう。
【0046】
以上説明したようにして、本実施例では輝度階層番号が「1」である場合の2値化処理が行われる。この処理により、黒色文字が描かれた領域についての適切な2値化閾値が設定され、単純2値化処理が行われる。言い換えれば、黒色文字領域において適切な2値化が行われる。
【0047】
次に、図4に示すヒストグラムの例を用いて、上述した2値化閾値TH1の決定処理について、更に詳細に説明する。
【0048】
図6は、図4に示す様なヒストグラムを有する画像に対して、上述した図5で示す領域分割前処理を行った際の、各パラメータの値の変化を示す図である。図6において示される各パラメータ値は、図5のフローチャートにおいてステップS53及びS54を通過する回数によって、それぞれ示されている。
【0049】
まず、ステップS53及びS54を通過する1回目の処理では、START=0,END=255で平均値AV,統計量SKを計算し、それぞれ「185」,「−102.5」という値を得る。この場合、統計量SKが「−1.0」未満であるため、ステップS59においてSTART=0,END=185が設定される。
【0050】
続いて2回目の処理ではSTART=0,END=185における平均値AV,統計量SKを計算し、それぞれ「98」,「−14.6」という値を得る。これも、統計量SKが「−1.0」未満であるため、ステップS59においてSTART=0,END=98が設定される。
【0051】
続いて3回目の処理では、START=0,END=98における平均値AV,統計量SKを計算し、それぞれ「45」,「10.7」という値を得る。この場合は、統計量SKが「1.0」を超えるため、ステップS510においてSTART=45,END=98が設定される。
【0052】
続いて4回目の処理では、START=45,END=98における平均値AV,統計量SKを計算し、それぞれ「77」,「−8.2」という値を得る。これも、統計量SKが「−1.0」未満であるため、ステップS59においてSTART=45,END=77が設定される。
【0053】
続いて5回目の処理では、START=45,END=77における平均値AV,統計量SKを計算し、それぞれ「63」,「−3.0」という値を得る。これも、統計量SKが「−1.0」未満であるため、ステップS59においてSTART=45,END=63が設定される。
【0054】
そして6回目の処理では、START=45,END=63における平均値AV,統計量SKを計算し、それぞれ「54」,「−0.9」という値を得る。ここで、統計量SKが「−1.0」以上かつ「1.0」以下であるため、ステップS55,S56の条件を満たさず、ステップS57へ進んで2値化閾値TH1として、「54」が設定される。そしてステップS58において、2値化閾値TH1を用いた単純2値化処理が行われる。
【0055】
以上説明したように、スキュー値が所定値まで収束するように、2値化閾値を決定する。
【0056】
以上、輝度階層番号が「1」である場合の2値化処理について説明したが、次に、輝度階層番号が「2」である中輝度文字の2値化処理について、上述した図5のフローチャートを参照して同様に説明する。
【0057】
まずステップS51において、対象画像のヒストグラムを算出する。この場合、上述した図3におけるステップS36で、輝度階層番号が「1」である分割済み領域(黒色文字領域)を削除し、ステップS37で輝度階層番号を「2」にセットしてあるため、ステップS51では画像中の輝度階層番号が「1」である分割済み領域以外の画素を用いて、輝度階層番号「2」に対応する輝度値に対する頻度を算出することができる。
【0058】
その結果、ステップS51において得られるヒストグラムは、図7に示すような形状を呈する。尚、図4と図7においては、縦軸のスケールは異なっている。そして、ステップS52からステップS58までの処理は上述した輝度階層番号が「1」である場合と同様であるが、もちろん決定される2値化閾値TH2は、上述した2値化閾値TH1とは異なっている。
【0059】
以下、図7に示すヒストグラムの例を用いて、上述した2値化閾値TH2の決定処理について、更に詳細に説明する。
【0060】
図8は、図7に示す様なヒストグラムを有する画像に対して、上述した図5で示す領域分割前処理を行った際の、各パラメータの値の変化を示す図である。図8において示される各パラメータ値は、図5のフローチャートにおいてステップS53及びS54を通過する回数によって、それぞれ示されている。
【0061】
まず、ステップS53及びS54を通過する1回目の処理では、START=0,END=255で平均値AV,統計量SKを計算し、それぞれ「186」,「−53.4」という値を得る。この場合、統計量SKが「−1.0」未満であるため、ステップS59においてSTART=0,END=186が設定される。
【0062】
続いて2回目の処理では、START=0,END=186における平均値AV,統計量SKを計算し、それぞれ「122」,「4.2」という値を得る。この場合、統計量SKが「1.0」を超えるため、ステップS510においてSTART=122,END=186が設定される。
【0063】
続いて3回目の処理では、START=122,END=186における平均値AV,統計量SKを計算し、それぞれ「149」,「5.8」という値を得る。この場合は、統計量SKが「1.0」を超えるため、ステップS510においてSTART=149,END=186が設定される。
【0064】
そして4回目の処理では、START=149,END=186における平均値AV,統計量SKを計算し、それぞれ「167」,「−0.5」という値を得る。ここで、統計量SKが「−1.0」以上かつ「1.0」以下となるため、ステップS55,S56で示される条件を満たさないため、ステップS57へ進んで2値化閾値TH2=167が設定される。そしてステップS58において、2値化閾値TH2を用いて単純2値化処理が行われる。
【0065】
以上説明したようにして、輝度階層番号が「2」である領域について2値化処理が行われる。
【0066】
以上説明した、輝度階層番号が「1」である場合の2値化閾値TH1と、輝度階層番号が「2」である場合の2値化閾値TH2とは、図9の示すような関係にになる。図9に示すのヒストグラムは図4のそれと同一であり、全画素による輝度頻度を表わしている。即ち、まず輝度階層番号が「1」について2値化閾値TH1=54で2値化され、「黒」となる領域Aが「白」となる領域Bから分割される。また、輝度階層番号が「2」について、全画素から領域Aを削除した領域、即ち領域Bの画像が2値化閾値TH2=167で2値化され、「黒」となる領域Cが「白」となる領域Dから分割される。
【0067】
以上説明したように図9によれば、本実施例において全画素は輝度値が「0〜54」(領域A),「54〜167」(領域C),「167〜255」(領域D)の3領域に分割されることが分かる。
【0068】
<<領域分割処理>>
次に、上述した図3のステップS33で示した領域分割処理について、図10のフローチャートを参照して詳細に説明する。
【0069】
まず、ステップS101において、入力部4を介して入力した2値画像を作業用メモリに入力する。そしてステップS102ではm×n画素が1画素となるように入力画像を間引き、領域分割用の画像を生成する。この時、m×n画素中に1つでも黒色画素が存在していれば、該m×n画素を黒の1画素とする。
【0070】
そしてステップS103では、領域分割用画像の全画素について、黒画素が上下、左右、斜めの方向に所定数連続している領域を一つの領域として、領域分割を行なう。その際、領域の検出順に番号を付すことにより、各領域に対するラベル付けを行なう。次にステップS104において、各領域の幅、高さ、面積、領域内の黒画素密度により領域を分類し、属性のラベル付けを行なう。領域の属性としては、詳細は後述するが、「テーブル」,「外枠領域」,「テキスト」等がある。
【0071】
そしてステップS105では、「テキスト」とラベル付けされた全ての領域の幅と高さの平均を算出し、得られた平均幅が平均高さより大きい場合には処理画像は横書きの文書であるとみなし、逆の場合は縦書きの文書であるとみなすことにより、文字組みを判断する。同時に、横書きならば平均高さを、縦書きならば平均幅をもって、一文字の文字サイズとする。
【0072】
また、領域分割用画像上の縦方向(横書き時)または横方向(縦書き時)の「テキスト」領域全てのヒストグラムから、文章の段組、行間隔、が検出される。ステップS106では、「テキスト」領域において文字サイズが大きい領域については、「タイトル」とする。そしてステップS107では、何の関連もなくばらばらに存在したままの「タイトル」領域、「テキスト」領域を、周りの領域との間隔に応じて併合し、一つのまとまった領域とする。次にステップS108において、各領域毎に属性、原画像における座標や大きさ等の領域データを記憶部5に出力し、記憶する。
【0073】
以上の処理を行なうことにより、本実施例では2値画像の領域分割処理を行い、各領域データが得られる。
【0074】
図11に、上述した領域データの例を示す。図11に示す各領域データ項目について、以下説明する。
・「番号」:領域の検出順序を示す。
・「属性」:領域の属性情報を示し、以下に示す8通りが用意されている。
【0075】
「ルート」 入力画像そのものであることを示す。
【0076】
「テキスト」 文字領域であることを示す。
【0077】
「タイトル」 見出し領域であることを示す。
【0078】
「テーブル」 表領域であることを示す。
【0079】
「ノイズ」 文字領域とも画像領域とも判断できなかった領域であることを示す。
【0080】
「外枠」 罫線等の領域であることを示す。
【0081】
「写真画像」 写真領域であることを示す。
【0082】
「線画像」 線画像領域であることを示す。
・「始点座標」:原画像における領域開始のX,Y座標を示す。
・「終点座標」:原画像における領域終了のX,Y座標を示す。
・「画素数」:領域内の全画素数を示す。
・「文字組情報」:縦書き,横書き,不明の3通りの文字組情報を示す。
【0083】
図11に示す領域データについて、「属性」が「テキスト」で示される領域のみ、図10に示すステップS107における併合前の、行に関する領域データ(行領域データ)を階層的に保持している。
【0084】
以上説明したようにして、本実施例では領域分割処理が行われる。尚、図11に示した領域データは本実施例を適用した一例にすぎず、画像処理装置に応じて例えば他の情報を適宜追加しても良いし、または減らしても良い。
【0085】
<<領域分割後処理(領域除去処理)>>
次に、図3のステップS34に示す領域分割後処理について、図12のフローチャートを参照して詳細に説明する。本実施例における領域分割後処理は、領域分割された各領域のうち、領域分割誤りの領域を除去する処理であり、以下、レイアウトノイズリダクション(LNR)と称する。
【0086】
まずステップS121で、領域分割後の各領域データはルート領域であるか否かが判断される。ルート領域とは画像全体を囲む領域、即ち全体領域のことであり、ルート領域であればステップS126に進み、LNR処理は施さない。ルート領域でなければステップS122に進み、テキスト領域(文字領域)であるか、またはノイズ領域であるかが判断される。テキスト領域またはノイズ領域である場合には処理はステップS123へ、いずれでもない場合はステップS125へ進む。
【0087】
ステップS123では、領域の大きさに応じて領域データが領域分割誤りとして除去されるLNR処理1を行い、次にステップS124で、領域内の黒比率に応じて領域データが領域分割誤りとして除去されるLNR処理3を行う。一方、ステップS125では、テキスト領域でなく、かつノイズ領域でもない領域データが、領域の大きさに応じて領域分割誤りとして除去されるLNR処理2が行われる。尚、ステップS123,S124,S125におけるLNR処理1,3,2については、それぞれ以下に詳述する。
【0088】
そしてステップS126において、全ての領域に対する処理が終了したか否かが判断され、終了していなければステップS121へ戻り、終了していればLNR処理を終了する。
【0089】
以上説明したようにして、本実施例においては領域分割により黒画素領域として分割された領域データから、領域分割誤りとなる領域を除去する。
【0090】
以下、まずステップS123に示すLNR処理1について詳細に説明する。図13は、LNR処理1を示すフローチャートである。まずステップS131で、処理対象領域の領域データから高さH1,幅W1を参照する。そして、領域の大きさの判断に用いる高さの閾値HT1,幅の閾値WT1を算出するために、ステップS132において、スキャナ等の画像入力装置2の読み取り解像度SRと、画像中の除去しない最小文字のポイント数MP1をそれぞれ高さ,幅についてMP1h,MP1wとして設定する。
【0091】
本実施例において、閾値HT1,WT1は以下に示す(5),(6)式により算出される。
【0092】
HT1=(SR/72.0)×MP1h ・・・(5)
WT1=(SR/72.0)×MP1w ・・・(6)
ステップS133では、(5)式により高さの閾値HT1を算出する。例えば、画像入力装置2の解像度SRが400dpiで、画像中の最小文字の高さポイント数MP1hが4ポイントである場合、高さの閾値HT1は「22」として算出される。そしてステップS134で、領域データの高さH1とステップS133で算出した高さの閾値HT1との比較を行なう。領域データの高さH1が閾値HT1より大きい場合はステップS135へ進み、閾値HT1より小さい場合はステップS138へ進む。
【0093】
ステップS135では、(6)式により幅の閾値WT1を算出する。続いてステップS136で、領域データの幅W1とステップS135で算出した幅の閾値WT1との比較を行なう。領域データの幅W1が閾値WT1よりも大きい場合には、LNR処理1は終了する。一方、領域データの幅W1が閾値WT1よりも小さい場合はステップS137に進み、領域データの高さH1と幅W1との比H1/W1の判断を行なう。この比が「2」以下である場合には、LNR処理1は終了する。一方、比が「2」を超える場合には処理中の領域が領域分割誤りであると判断されるため、ステップS138へ進んで、該領域が除去される。
【0094】
次に、図12のステップS124に示すLNR処理3について、図14のフローチャートを参照して詳細に説明する。まずステップS141において、領域中の黒画素数BCを累計する。そしてステップS142で、領域中の黒比率BR1を以下に示す(7)式により計算する。
【0095】
BR1=BC/(W1×H1)×100 ・・・(7)
次にステップS143において、最小黒比率BRT1と、最大黒比率BRT2とを設定する。BRT1とBRT2は、文字の黒比率特性により予め設定されており、例えばBRT1=5,BRT2=52である。
【0096】
ステップS144では、領域中の黒比率BR1と、最小黒比率BRT1及び最大黒比率BRT2との比較を行なう。黒比率BR1が最小黒比率BRT1より小さい、又は最大黒比率BRT2より大きい場合には、処理中の領域が領域分割誤りであると判断され、ステップS145に進んで該領域が除去される。その他の場合は、LNR処理3は終了する。
【0097】
次に、図12のステップS125に示すLNR処理2について、図15のフローチャートを参照して詳細に説明する。まずステップS151において、処理対象領域の領域データから高さH2,幅W2を参照する。そして、領域の大きさの判断に用いる高さの閾値HT2,幅の閾値WT2を算出するために、ステップS152において、画像入力装置2の解像度SRを設定する。そして、ステップS153において、処理中の領域の属性が外枠領域であるか否かが判断される。そして、外枠領域であればステップS154へ、外枠領域でなければステップS157へ進む。
【0098】
ステップS154においては、最小ポイント数MP21をそれぞれ高さ,幅についてMP21h,MP21wとして設定する。また、ステップS157でも同様に、最小ポイント数MP22をそれぞれ高さ,幅についてMP22h,MP22wとして設定する。ここで最小ポイント数MP21,MP22とは、LNR処理2において外枠領域であるか否かに応じて、除去しない領域の最小サイズを文字のポイント数により表わしたものである。
【0099】
そして、ステップS155およびS158においては、上述した(5),(6)式により、高さの閾値HT21,HT22と幅の閾値WT21,WT22を算出する。例えば、画像入力装置2の解像度SRが400dpiで、最小ポイント数MP22が高さ、幅共に4ポイントである場合、各閾値HT22,WT22は「22」として算出される。そして、ステップS156およびS159において、それぞれ高さの閾値HT2と幅の閾値WT2を設定する。
【0100】
続いてステップS1510では、領域データの高さH2と、ステップS156およびS159で設定した高さの閾値HT2との比較、及び領域データの幅W2と同じく幅の閾値WT2との比較を行なう。領域データの高さH2が閾値HT2より小さい、または幅W2が閾値WT2より小さい場合、処理中の領域が領域分割誤りであると判断され、ステップS1511において該領域が除去される。その他の場合は、LNR処理2を終了する。
【0101】
以上説明したように本実施例のLNR処理は、3種類の処理によって領域分割誤りと判断される領域を除去する。
【0102】
<輝度階層別画像処理>
次に、上述した図2のステップS24に示す輝度階層別画像処理について、図16のフローチャートを参照して詳細に説明する。
【0103】
まずステップS161において、上述した図3のステップS36において入力画像から削除され、記憶部5に格納された輝度階層番号が「1」である領域データを読み込む。そしてステップS162では、該領域データの属性により、文字領域であるか否かの判断を行なう。文字領域である場合にはステップS163に進み、詳細は後述するが、後段のOCRによる文書認識処理に最も適した閾値で単純2値化を行う。そしてステップS164でOCR処理を行なう。一方、文字領域でない場合には画像領域であると見なし、ステップS165に進んで誤差拡散法やディザ法等の擬似中間調処理を行って2値化する。
【0104】
次にステップS166において、未処理の領域が残っているかを判断し、残っている場合はステップS162へ、残っていない場合はステップS167へ進む。ステップS167では、処理中の領域データの輝度階層番号が「1」であるか否かの判断を行い、「1」であればステップS168へ、「1」でなければ輝度階層別画像処理を終了する。ステップS168では、輝度階層番号が「2」である領域データを読み込み、ステップS162へ戻る。
【0105】
即ち本実施例においては、輝度階層別に、文字領域に対してそれぞれ独立して文字認識処理を行う。
【0106】
以上説明したように本実施例によれば、3つ以上の輝度レベル(白,灰色,黒)が混在した画像を処理する場合においても、灰色文字に対しても高精度の2値化処理が行えるため、複数の輝度階層にわたって正確な領域分割処理を行うことができる。
【0107】
【他の実施例】
上述した実施例においては、輝度階層を3つとして説明を行ったが、本発明はこの例に限定されるものではなく、実際の画像に応じて輝度階層数を決定すれば良い。
【0108】
また、実施例において入力される画像は8ビットの多値画像データとしたが、これに限定する必要はなく、例えばカラー画像等、即ち、2値化するために画像情報として複数ビットの情報があれば良い。
【0109】
また、ヒストグラムを算出する際の画像におけるサンプリングについて、全画素でも、数画素おきでもよく限定しない。さらに、平均AVや統計量SK等の計算は、必ずしも8ビットで行う必要はなく、高速化、メモリの削減等のため、少ないビット数で演算するようにしてもよい。
【0110】
また、統計量であるスキュー値SKの収束条件を±1.0としたが、これに限定されるものではない。スキュー値SKを用いて2値化の閾値を決定するように構成されていれば良い。
【0111】
また、更に領域データに輝度階層情報を設けることにより、灰色文字領域と黒色文字領域とを区別して文字認識を行うことも可能となる。
【0112】
尚、本発明は、イメージスキャナ、プリンタコントローラ、プリンタ等の複数の機器から構成されるシステムに適用しても、カラー複写機のような1つの機器から成る装置に適用しても良い。また、本発明は上述のように画像処理装置にハードウェアを設けるものに限らず、システム或は装置に磁気ディスク等の媒体に記憶されたプログラムを供給することによって達成される場合にも適用できることはいうまでもない。
【0113】
【発明の効果】
以上説明したように本発明によれば、輝度階層別に2値化閾値を算出して2値化を行ってから、輝度階層別に領域分割を行うことにより、3つ以上の輝度レベル対象が混在した画像を処理する場合においても、それぞれの輝度レベルに対して高精度の2値化結果が得られるため、複数の輝度階層にわたって正確な領域分割処理を行なうことができる。
【0114】
更に、各領域を複数の輝度階層毎に区別することができるため、灰色文字領域と黒色文字領域とを区別して領域分割処理を行なうことも可能となる。
【0115】
【図面の簡単な説明】
【図1】本発明に係る一実施例における画像処理装置のシステム構成を示すブロック図である。
【図2】本実施例における文字を含んだ画像処理を示すフローチャートである。
【図3】本実施例における輝度階層別領域分割処理を示すフローチャートである。
【図4】本実施例における原稿画像のヒストグラムの例を示す図である。
【図5】本実施例における領域分割前処理を示すフローチャートである。
【図6】本実施例の領域分割前処理における各変数値の例を示す図である。
【図7】本実施例における原稿画像の輝度階層番号が「2」である領域のヒストグラムの例を示す図である。
【図8】本実施例の領域分割前処理における各変数値の例を示す図である。
【図9】本実施例における領域分割前処理における輝度階層毎の2値化結果を示す図である。
【図10】本実施例における領域分割処理を示すフローチャートである。
【図11】本実施例における領域分割処理により得られる領域データ例を示す図である。
【図12】本実施例における領域分割後処理を示すフローチャートである。
【図13】本実施例における領域の大きさによる領域除去処理1を示すフローチャートである。
【図14】本実施例における黒比率による領域除去処理2を示すフローチャートである。
【図15】本実施例における領域の大きさによる領域除去処理3を示すフローチャートである。
【図16】本実施例における輝度階層別画像処理を示すフローチャートである。
【図17】従来の画像処理装置における文字を含んだ画像処理を示すフローチャートである。
【符号の説明】
1 画像処理装置
2 画像入力装置
3 画像表示装置
4 入力部
5 記憶部
6 輝度頻度累計部
7 2値化閾値算出部
8 2値化部
9 領域分割部
10 文字認識部
11 画像処理部
12 出力部[0001]
[Industrial application fields]
The present invention relates to an image processing apparatus and method, and more particularly, to an image processing apparatus and method for performing image region division processing for character recognition processing in an image.
[0002]
[Prior art]
With the recent progress of image processing technology, an image processing apparatus such as a computer has increased to process an image in which characters, photographs, graphs and the like are mixed. As a processing procedure in this case, first, an image to be processed is read by an image input device such as a scanner and input to the image processing device. The image processing apparatus performs region division processing for extracting a black pixel region, optical character recognition processing (hereinafter referred to as OCR processing), and the like for the input image, performs document management, and obtains the obtained image or character. Was used. The area dividing process is a process of dividing and extracting black pixels in an image to separate areas such as characters / photos / graphs / tables in the image according to their respective characteristics and extracting each area information. is there. The OCR process is a character recognition process for converting a bitmap that forms a character image into a character code for a character region in an image.
[0003]
Next, image processing including characters in the above-described conventional image processing apparatus will be described with reference to the flowchart of FIG.
[0004]
First, in step S221, an image to be a document is input by an image processing apparatus such as a scanner. This input is performed as, for example, 8-bit multi-value image data. Next, in step S222, the deterioration of the input original image, the inclination of the original, and the like are corrected, including the removal of the electrical noise of the scanner that occurs during image input. Next, in step S223, the input image is subjected to simple binarization with a predetermined fixed threshold value to perform region division processing, and each region data is output to extract a character region. The simple binarization process at this time may be a binarization process corresponding to the density of the input image, for example. In step S224, character recognition is performed by performing desired image processing such as OCR processing or pseudo-halftone processing for each extracted character region. Finally, in step S225, the processing result of the recognized character or the like is displayed.
[0005]
As described above, in the conventional image processing apparatus, the input image is simply binarized with a fixed threshold value or simply binarized according to the density of the original image, and then the region division process is performed, thereby performing image segmentation in the image. The document area was extracted and character recognition processing was performed.
[0006]
[Problems to be solved by the invention]
However, the conventional image processing apparatus has the following problems.
[0007]
For example, consider a case where the background of a document image is white and characters are drawn in black or gray. In this case, that is, when three or more luminance level targets are mixed in the original image, and simple binarization with a fixed threshold is performed on such an image, the gray character region is set to 2 as “white”. An area to be binarized and an area binarized as “black” are generated. Since these two regions occur irregularly, gray characters are crushed or blurred, and a highly accurate binarization result cannot be obtained. Therefore, accurate area division processing cannot be performed.
[0008]
Further, even when performing simple binarization according to the density of the original image, for example, the background is not purely “white”, so that the background is binarized with “white” and black and gray characters as “black”. Or, the base and gray letters are binarized as “white” and black letters as “black”. Accordingly, since it is impossible to binarize gray characters with high accuracy, accurate area division processing cannot be performed.
[0009]
Furthermore, the gray character region cannot be divided so as to be distinguished from the black character region, in particular, as a gray character region.
[0010]
The present invention has been made to solve the above-described problems. Even when an image having three or more luminance level objects is processed, binarization is performed with high accuracy for each luminance hierarchy. It is an object of the present invention to provide an image processing apparatus and method capable of performing accurate area division processing.
[0011]
[Means for Solving the Problems]
In order to achieve the above-described object, the present invention has the following configuration.
[0012]
That is, An image processing apparatus according to an aspect of the present invention includes a histogram calculation unit that calculates a histogram of a first input image, and a statistic that indicates a bias in the distribution of the histogram within a predetermined range. Threshold setting means for setting a binarization threshold, and the threshold setting means 2 According to the threshold value First Binarize the
[0016]
[Action]
With the above configuration, a binarization threshold value is calculated for each luminance layer, a binary image for each luminance layer is created using the binarization threshold value for each luminance layer, and an area is divided from the binary image for each luminance layer. be able to. Therefore, it is possible to provide an image processing apparatus and method capable of performing an area division process for each luminance hierarchy in an image and a method for the same.
[0017]
【Example】
Hereinafter, an embodiment according to the present invention will be described in detail with reference to the drawings.
[0018]
FIG. 1 is a block diagram showing a system configuration including an image processing apparatus in this embodiment. Details of the operation in each configuration shown in FIG. 1 will be described later.
[0019]
In FIG. 1, 1 is an image processing apparatus that performs document management in this embodiment, 2 is an image input apparatus such as a scanner that inputs an image, and 3 is an image display apparatus that displays the processed image.
[0020]
In the
[0021]
Hereinafter, the image processing in the
[0022]
First, in step S <b> 21, an image to be a document is input to the
[0023]
In step S24, the
[0024]
<Brightness layer-specific region division processing>
Next, the luminance layer-specific region dividing process shown in step S23 of FIG. 2 will be described in detail.
[0025]
In the present embodiment, a case where an image in which black characters and gray characters are drawn on a white background is processed will be described as an example.
[0026]
FIG. 4 shows an example of the luminance frequency (histogram) of an image including a character area processed in this embodiment.
[0027]
In the histogram shown in FIG. 4, the horizontal axis is a luminance value representing “0” on the left end and “255” on the right end, and this value is a digital value. That is, the left end of the horizontal axis corresponds to “black” and the right end corresponds to “white”. The vertical axis represents the frequency of each digital value. Therefore, in FIG. 4, the white background portion of the image to be processed has high luminance and therefore corresponds to the right mountain, the black character portion has low luminance and corresponds to the left mountain, and the gray character has medium luminance. Because there is, it corresponds to the central mountain.
[0028]
Hereinafter, the luminance layer-specific region division processing in this embodiment will be described with reference to the flowchart of FIG.
[0029]
First, in step S31, the luminance layer number is set to “1”. Here, the luminance hierarchy number is set based on the characteristic (number of peaks) of the luminance frequency in the image. In the example shown in FIG. 4, the luminance hierarchy number of black characters is “1”, The gray color luminance layer number is “2”, and the white luminance layer number is “3”. The luminance hierarchy number is assigned for each luminance level at which character recognition is finally desired.
[0030]
Subsequently, in step S32, simple binarization with a threshold most suitable for region division is performed as preprocessing for region division. Thereafter, in step S33, a black pixel region is extracted from the binarized image, divided into a character region, a photographic region, a graphic region, and the like based on the characteristics and the like, and region data described later is output. Then, the process proceeds to step S34, where area errors are removed as post-processing of area division. Details of the region error removal processing in step S34 will be described later. Next, in step S35, it is determined whether or not the luminance hierarchy number is “1” or less. If the luminance hierarchy number is “1” or less, that is, “1”, the process proceeds to step S36, and if it is not “1” or less, that is, “2” or more, the process ends.
[0031]
In step S35, it is determined whether or not the luminance layer number is “1” or less. This value is set by subtracting the fixed value “2” from the maximum value “3” of the luminance layer number. As a result, this embodiment can cope with an increase or decrease in the number of luminance layers.
[0032]
In step S <b> 36, the luminance pixel number is “1”, that is, the black pixel area divided as a black character is deleted from the input image as a divided area and stored in the
[0033]
As described above, in the luminance layer-specific region division processing according to the present embodiment, binarization is first performed when the luminance layer number is “1”, that is, a black character region, and region errors are removed after region division. After the divided black pixel region is deleted, binarization is performed for the case where the luminance layer number is “2”, that is, a gray character region, and region division and region error removal are performed.
[0034]
<< Regional region pre-processing (binarization processing) >>
Next, the binarization process as the area division pre-process in step S32 of FIG. 3 will be described in detail with reference to the flowchart of FIG. The area division pre-processing in step S32 is executed twice, when the luminance layer number is “1” and when it is “2”. Therefore, TH1 and TH2 are used as parameters as the binarization threshold values corresponding to each, but in FIG. 5, these are collectively expressed as TH.
[0035]
First, a case where the luminance hierarchy number is “1” will be described.
[0036]
In step S51 in FIG. 5, a histogram of the input image is calculated. Here, using all the pixels in the image, the frequency for each digital value from 8 bits, that is, “0” to “255” is calculated. Thereby, for example, the histogram shown in FIG. 4 is obtained.
[0037]
In step S52, "0" and "255" are set in the parameters START and END, respectively. START and END correspond to the start point and end point of the statistical value of the brightness value obtained in the subsequent steps S53 and S54, respectively.
[0038]
In step S53, the average value AV of the pixels corresponding to the digital values from START to END is calculated. For example, if START = 0 and END = 255, an average value AV of pixels having values of “0” to “255” (in this case, all pixels) is calculated. If START = 0 and END = 177, “ An average value AV of pixels having values from “0” to “177” is calculated.
[0039]
In step S54, the skew value SK of the pixel corresponding to the luminance value from START to END is calculated. The skew value is a statistic indicating the bias of the histogram distribution. For calculating the skew value, the following equation (1) is used.
[0040]
SK = (Σ (Xi−AV) ^ 3) / D (1)
(Note that R ^ 3 indicates the third power of R.)
Here, Xi is the luminance value of the pixel. D is a dispersion value of the entire image, and is calculated by the equation (2).
[0041]
D = Σ (Xi-AV) ^ 2 (2)
(Note that R ^ 2 indicates the square of R.)
Subsequently, in steps S55 and S56, the direction of bias of the histogram is determined. First, in step S55, the direction of the histogram bias is determined by the following equation (3). This is a determination as to whether or not the histogram bias is in the left direction.
[0042]
SK <−1.0 (3)
If the expression (3) is true in step S55, the process proceeds to step S59, and if false, the process proceeds to step S56. In step S59, START is not changed, and average value AV is set to END. Then, returning to step S53, the average value AV from the START value to the END value is calculated again.
[0043]
On the other hand, in step S56, the bias direction of the histogram is determined by the following equation (4). This is a determination as to whether or not the histogram bias is in the right direction.
[0044]
SK> 1.0 (4)
If the expression (4) is true in step S56, the process proceeds to step S510, and if false, the process proceeds to step S57. In step S510, the average value AV is set to START, and END is not changed. Then, returning to step S53, the average value AV from the START value to the END value is calculated again.
[0045]
On the other hand, in step S57, the average value AV when the conditions in steps S55 and S56 are both false is set as the binarization threshold TH1. In step S58, a simple binarization process using the binarization threshold TH1 is performed.
[0046]
As described above, in this embodiment, the binarization process when the luminance hierarchy number is “1” is performed. By this process, an appropriate binarization threshold is set for the area in which black characters are drawn, and a simple binarization process is performed. In other words, appropriate binarization is performed in the black character region.
[0047]
Next, using the example of the histogram shown in FIG. 4, the above-described determination process of the binarization threshold TH1 will be described in more detail.
[0048]
FIG. 6 is a diagram showing changes in the values of parameters when the above-described region division preprocessing shown in FIG. 5 is performed on an image having a histogram as shown in FIG. Each parameter value shown in FIG. 6 is indicated by the number of times of passing through steps S53 and S54 in the flowchart of FIG.
[0049]
First, in the first process that passes through steps S53 and S54, the average value AV and the statistic SK are calculated with START = 0 and END = 255, and values of “185” and “−102.5” are obtained, respectively. In this case, since the statistic SK is less than “−1.0”, START = 0 and END = 185 are set in step S59.
[0050]
Subsequently, in the second processing, the average value AV and the statistic SK at START = 0 and END = 185 are calculated, and values of “98” and “−14.6” are obtained, respectively. Again, since the statistic SK is less than “−1.0”, START = 0 and END = 98 are set in step S59.
[0051]
Subsequently, in the third processing, the average value AV and the statistic SK at START = 0 and END = 98 are calculated, and values of “45” and “10.7” are obtained, respectively. In this case, since the statistic SK exceeds “1.0”, START = 45 and END = 98 are set in step S510.
[0052]
Subsequently, in the fourth processing, the average value AV and the statistic SK at START = 45 and END = 98 are calculated, and values of “77” and “−8.2” are obtained, respectively. Again, since the statistic SK is less than “−1.0”, START = 45 and END = 77 are set in step S59.
[0053]
Subsequently, in the fifth processing, the average value AV and the statistic SK at START = 45 and END = 77 are calculated, and the values “63” and “−3.0” are obtained, respectively. Again, since the statistical quantity SK is less than “−1.0”, START = 45 and END = 63 are set in step S59.
[0054]
In the sixth processing, the average value AV and the statistical quantity SK at START = 45 and END = 63 are calculated, and values of “54” and “−0.9” are obtained, respectively. Here, since the statistic SK is not less than “−1.0” and not more than “1.0”, the condition of Steps S55 and S56 is not satisfied, and the process proceeds to Step S57 to set “54” as the binarization threshold TH1. Is set. In step S58, a simple binarization process using the binarization threshold TH1 is performed.
[0055]
As described above, the binarization threshold is determined so that the skew value converges to a predetermined value.
[0056]
The binarization process when the luminance hierarchy number is “1” has been described above. Next, the above-described flowchart of FIG. 5 illustrates the binarization process for medium luminance characters whose luminance hierarchy number is “2”. The same is described with reference to FIG.
[0057]
First, in step S51, a histogram of the target image is calculated. In this case, the divided area (black character area) having the luminance layer number “1” is deleted in step S36 in FIG. 3 described above, and the luminance layer number is set to “2” in step S37. In step S51, the frequency with respect to the luminance value corresponding to the luminance layer number “2” can be calculated using pixels other than the divided region whose luminance layer number is “1” in the image.
[0058]
As a result, the histogram obtained in step S51 has a shape as shown in FIG. In FIG. 4 and FIG. 7, the scale of the vertical axis is different. The processing from step S52 to step S58 is the same as that in the case where the above-described luminance hierarchy number is “1”. Of course, the binarization threshold TH2 determined is different from the binarization threshold TH1 described above. ing.
[0059]
Hereinafter, the binarization threshold value TH2 determination process described above will be described in more detail using the example of the histogram shown in FIG.
[0060]
FIG. 8 is a diagram showing changes in the values of the parameters when the above-described region division preprocessing shown in FIG. 5 is performed on an image having a histogram as shown in FIG. Each parameter value shown in FIG. 8 is indicated by the number of times of passing through steps S53 and S54 in the flowchart of FIG.
[0061]
First, in the first process that passes through steps S53 and S54, the average value AV and the statistic SK are calculated with START = 0 and END = 255, and values of “186” and “−53.4” are obtained, respectively. In this case, since the statistic SK is less than “−1.0”, START = 0 and END = 186 are set in step S59.
[0062]
Subsequently, in the second process, the average value AV and the statistic SK at START = 0 and END = 186 are calculated, and values of “122” and “4.2” are obtained, respectively. In this case, since the statistic SK exceeds “1.0”, START = 122 and END = 186 are set in step S510.
[0063]
Subsequently, in the third processing, the average value AV and the statistic SK at START = 122 and END = 186 are calculated, and values of “149” and “5.8” are obtained, respectively. In this case, since the statistic SK exceeds “1.0”, START = 149 and END = 186 are set in step S510.
[0064]
In the fourth process, the average value AV and the statistical quantity SK at START = 149 and END = 186 are calculated, and values of “167” and “−0.5” are obtained, respectively. Here, since the statistic SK is not less than “−1.0” and not more than “1.0”, the condition shown in Steps S55 and S56 is not satisfied, so the process proceeds to Step S57 and the binarization threshold TH2 = 167. Is set. In step S58, simple binarization processing is performed using the binarization threshold TH2.
[0065]
As described above, the binarization process is performed on the area having the luminance hierarchy number “2”.
[0066]
As described above, the binarization threshold TH1 when the luminance hierarchy number is “1” and the binarization threshold TH2 when the luminance hierarchy number is “2” are in a relationship as shown in FIG. Become. The histogram shown in FIG. 9 is the same as that of FIG. 4, and represents the luminance frequency of all pixels. That is, first, the luminance hierarchy number “1” is binarized with the binarization threshold TH1 = 54, and the region A that becomes “black” is divided from the region B that becomes “white”. For the luminance layer number “2”, the region A is deleted from all pixels, that is, the image of the region B is binarized with the binarization threshold TH2 = 167, and the region C that becomes “black” is “white”. Is divided from the region D which becomes “.
[0067]
As described above, according to FIG. 9, the luminance values of all the pixels in this embodiment are “0 to 54” (region A), “54 to 167” (region C), and “167 to 255” (region D). It can be seen that it is divided into three regions.
[0068]
<< area division processing >>
Next, the region dividing process shown in step S33 of FIG. 3 will be described in detail with reference to the flowchart of FIG.
[0069]
First, in step S101, a binary image input via the
[0070]
In step S103, for all the pixels of the region dividing image, region division is performed with a predetermined number of regions where black pixels are continuous in the up, down, left, and right directions as one region. At that time, each area is labeled by assigning a number in the order of detection of the area. Next, in step S104, the regions are classified by the width, height, area, and black pixel density in each region, and attributes are labeled. The area attributes include “table”, “outer frame area”, “text”, etc., as will be described in detail later.
[0071]
In step S105, the average of the width and height of all areas labeled “text” is calculated. If the obtained average width is larger than the average height, the processed image is regarded as a horizontally written document. In the opposite case, the character set is determined by regarding the document as vertically written. At the same time, the character size is set to one character with the average height for horizontal writing and the average width for vertical writing.
[0072]
In addition, the text column and line spacing are detected from the histograms of all the “text” areas in the vertical direction (horizontal writing) or horizontal direction (vertical writing) on the image for region division. In step S106, an area having a large character size in the “text” area is set to “title”. In step S107, the “title” area and the “text” area that remain apart without any relation are merged according to the distance from the surrounding areas to form a single area. Next, in step S108, region data such as attributes and coordinates and size in the original image are output to the
[0073]
By performing the above processing, in this embodiment, the region division processing of the binary image is performed, and each region data is obtained.
[0074]
FIG. 11 shows an example of the area data described above. Each area data item shown in FIG. 11 will be described below.
“No.”: Indicates the detection order of areas.
“Attribute”: indicates attribute information of the area, and the following eight types are prepared.
[0075]
“Root” Indicates the input image itself.
[0076]
“Text” Indicates a character area.
[0077]
“Title” Indicates a heading area.
[0078]
“Table” Indicates a table area.
[0079]
“Noise” Indicates an area that cannot be determined as a character area or an image area.
[0080]
“Outer frame” Indicates an area such as a ruled line.
[0081]
“Photo image” Indicates a photo area.
[0082]
“Line image” Indicates a line image area.
“Start point coordinates”: X and Y coordinates at the start of the area in the original image.
“End point coordinates”: X and Y coordinates at the end of the region in the original image.
“Number of pixels”: indicates the total number of pixels in the region.
"Character set information": Indicates three types of character set information: vertical writing, horizontal writing, and unknown.
[0083]
In the area data shown in FIG. 11, only the area where “attribute” is indicated by “text” holds the area data (row area data) related to the line before merging in step S107 shown in FIG.
[0084]
As described above, the region division processing is performed in this embodiment. The area data shown in FIG. 11 is merely an example to which the present embodiment is applied, and other information may be added or reduced as appropriate depending on the image processing apparatus.
[0085]
<< Process after region division (region removal processing) >>
Next, the post-region division processing shown in step S34 of FIG. 3 will be described in detail with reference to the flowchart of FIG. The post-region division processing in the present embodiment is processing for removing a region having a region division error among the regions divided into regions, and is hereinafter referred to as layout noise reduction (LNR).
[0086]
First, in step S121, it is determined whether each area data after the area division is a root area. The root area is an area surrounding the entire image, that is, the entire area. If it is the root area, the process proceeds to step S126, and the LNR process is not performed. If it is not the root area, the process advances to step S122 to determine whether the area is a text area (character area) or a noise area. If it is a text area or a noise area, the process proceeds to step S123, and if not, the process proceeds to step S125.
[0087]
In step S123,
[0088]
In step S126, it is determined whether or not the processing for all the regions has been completed. If not completed, the process returns to step S121, and if completed, the LNR process is terminated.
[0089]
As described above, in this embodiment, a region that causes a region division error is removed from region data divided as a black pixel region by region division.
[0090]
Hereinafter, the
[0091]
In this embodiment, the threshold values HT1 and WT1 are calculated by the following equations (5) and (6).
[0092]
HT1 = (SR / 72.0) × MP1h (5)
WT1 = (SR / 72.0) × MP1w (6)
In step S133, the height threshold value HT1 is calculated using equation (5). For example, when the resolution SR of the
[0093]
In step S135, the width threshold value WT1 is calculated using equation (6). In step S136, the width W1 of the area data is compared with the threshold value WT1 of the width calculated in step S135. If the width W1 of the area data is larger than the threshold value WT1, the
[0094]
Next, the
[0095]
BR1 = BC / (W1 × H1) × 100 (7)
In step S143, a minimum black ratio BRT1 and a maximum black ratio BRT2 are set. BRT1 and BRT2 are set in advance according to the black ratio characteristic of the character, for example, BRT1 = 5 and BRT2 = 52.
[0096]
In step S144, the black ratio BR1 in the region is compared with the minimum black ratio BRT1 and the maximum black ratio BRT2. If the black ratio BR1 is smaller than the minimum black ratio BRT1 or larger than the maximum black ratio BRT2, it is determined that the area being processed is an area division error, and the process proceeds to step S145 to remove the area. In other cases, the
[0097]
Next, the
[0098]
In step S154, the minimum number of points MP21 is set as MP21h and MP21w for the height and width, respectively. Similarly, in step S157, the minimum number of points MP22 is set as MP22h and MP22w for the height and width, respectively. Here, the minimum number of points MP21 and MP22 represents the minimum size of the area not to be removed by the number of character points depending on whether or not it is an outer frame area in the
[0099]
In steps S155 and S158, height threshold values HT21 and HT22 and width threshold values WT21 and WT22 are calculated by the above-described equations (5) and (6). For example, when the resolution SR of the
[0100]
In step S1510, the height H2 of the area data is compared with the threshold value HT2 of the height set in steps S156 and S159, and the width threshold value WT2 is compared with the width W2 of the area data. If the height H2 of the area data is smaller than the threshold value HT2 or the width W2 is smaller than the threshold value WT2, it is determined that the area being processed is an area division error, and the area is removed in step S1511. In other cases, the
[0101]
As described above, the LNR process of this embodiment removes an area determined to be an area division error by three types of processes.
[0102]
<Image processing by brightness layer>
Next, the luminance layer-specific image processing shown in step S24 of FIG. 2 will be described in detail with reference to the flowchart of FIG.
[0103]
First, in step S161, the area data which is deleted from the input image in step S36 of FIG. 3 and stored in the
[0104]
Next, in step S166, it is determined whether an unprocessed area remains. If it remains, the process proceeds to step S162, and if not, the process proceeds to step S167. In step S167, it is determined whether or not the luminance layer number of the area data being processed is “1”. If “1”, the process proceeds to step S168. To do. In step S168, the area data whose luminance hierarchy number is “2” is read, and the process returns to step S162.
[0105]
That is, in the present embodiment, character recognition processing is performed independently for each character region for each luminance layer.
[0106]
As described above, according to the present embodiment, even when processing an image in which three or more luminance levels (white, gray, black) are mixed, high-precision binarization processing is performed even for gray characters. Therefore, accurate area division processing can be performed over a plurality of luminance hierarchies.
[0107]
[Other embodiments]
In the above-described embodiment, the description has been given assuming that there are three luminance layers. However, the present invention is not limited to this example, and the number of luminance layers may be determined according to an actual image.
[0108]
In the embodiment, the input image is 8-bit multi-value image data. However, the present invention is not limited to this. For example, a color image or the like, that is, multi-bit information is used as image information for binarization. I just need it.
[0109]
Further, the sampling in the image when calculating the histogram may be all pixels or every few pixels, and is not limited. Further, the calculation of the average AV, the statistic SK, and the like is not necessarily performed with 8 bits, and may be performed with a small number of bits in order to increase the speed and reduce the memory.
[0110]
Further, although the convergence condition of the skew value SK, which is a statistic, is set to ± 1.0, it is not limited to this. What is necessary is just to be comprised so that the threshold value of binarization may be determined using skew value SK.
[0111]
Further, by providing luminance hierarchy information in the area data, it is possible to perform character recognition by distinguishing between the gray character area and the black character area.
[0112]
Note that the present invention may be applied to a system composed of a plurality of devices such as an image scanner, a printer controller, and a printer, or to an apparatus composed of a single device such as a color copying machine. Further, the present invention is not limited to the hardware provided in the image processing apparatus as described above, and can be applied to a case where the image processing apparatus is achieved by supplying a program stored in a medium such as a magnetic disk to the system or apparatus. Needless to say.
[0113]
【The invention's effect】
As described above, according to the present invention, binarization threshold values are calculated for each luminance layer, binarization is performed, and then region division is performed for each luminance layer, thereby mixing three or more luminance level targets. Even when an image is processed, a highly accurate binarization result can be obtained for each luminance level, so that accurate region division processing can be performed across a plurality of luminance layers.
[0114]
Furthermore, since each region can be distinguished for each of a plurality of luminance layers, it is possible to perform region division processing by distinguishing a gray character region from a black character region.
[0115]
[Brief description of the drawings]
FIG. 1 is a block diagram illustrating a system configuration of an image processing apparatus according to an embodiment of the present invention.
FIG. 2 is a flowchart illustrating image processing including characters according to the present exemplary embodiment.
FIG. 3 is a flowchart showing a luminance layer-specific region dividing process in the present embodiment.
FIG. 4 is a diagram illustrating an example of a histogram of a document image in the present embodiment.
FIG. 5 is a flowchart showing region division pre-processing in the present embodiment.
FIG. 6 is a diagram illustrating an example of each variable value in the region division pre-processing according to the present embodiment.
FIG. 7 is a diagram illustrating an example of a histogram of an area where the luminance hierarchy number of the document image is “2” in the present embodiment.
FIG. 8 is a diagram illustrating an example of each variable value in the region division pre-processing according to the present embodiment.
FIG. 9 is a diagram illustrating a binarization result for each luminance layer in the region division pre-processing in the present embodiment.
FIG. 10 is a flowchart showing area division processing in the present embodiment.
FIG. 11 is a diagram illustrating an example of region data obtained by region division processing in the present embodiment.
FIG. 12 is a flowchart illustrating post-region division processing according to the present exemplary embodiment.
FIG. 13 is a flowchart showing
FIG. 14 is a flowchart showing
FIG. 15 is a flowchart showing
FIG. 16 is a flowchart showing image processing by brightness hierarchy in the present embodiment.
FIG. 17 is a flowchart showing image processing including characters in a conventional image processing apparatus.
[Explanation of symbols]
1 Image processing device
2 Image input device
3 Image display device
4 Input section
5 storage unit
6 Luminance frequency accumulation section
7 Binarization threshold value calculation part
8 Binarization part
9 Area division part
10 Character recognition part
11 Image processing unit
12 Output section
Claims (10)
前記ヒストグラムの分布の偏りを示す統計量が所定の範囲内に収まるように2値化閾値を設定する閾値設定手段と、
前記閾値設定手段により設定された2値化閾値により前記第1入力画像を2値化して2値画像を生成する2値化手段と、
前記2値化手段で生成された2値画像から領域を分割する領域分割手段と、
前記分割された領域を前記第1入力画像から削除することによって第2入力画像を生成し、当該生成された第2入力画像を前記第1入力画像の代わりに用いて前記ヒストグラム算出手段と前記閾値設定手段と前記領域分割手段とによる処理を繰り返すことによって、輝度階層別に分割された領域を取得する繰り返し手段と、
を有することを特徴とする画像処理装置。 Histogram calculating means for calculating a histogram of the first input image;
Threshold setting means for setting a binarization threshold so that a statistic indicating the bias of the histogram distribution falls within a predetermined range ;
And binarizing means for generating a binary image by binarizing the first input image by the binarization threshold value set by the threshold value setting means,
Area dividing means for dividing an area from the binary image generated by the binarizing means ;
A second input image is generated by deleting the divided area from the first input image, and the generated second input image is used instead of the first input image, and the histogram calculation means and the threshold value are used. Repetitive means for acquiring regions divided by luminance hierarchy by repeating the processing by the setting means and the region dividing means;
An image processing apparatus comprising:
前記繰り返し手段は、前記除去手段で除去された領域以外の前記分割された領域を、前記第1入力画像から削除することによって第2入力画像を生成し、当該生成された第2入力画像を前記第1入力画像の代わりに用いて前記ヒストグラム算出手段と前記閾値設定手段と前記領域分割手段とによる処理を繰り返すことによって、輝度階層別に分割された領域を取得することを特徴とする請求項1に記載の画像処理装置。The repeating means generates a second input image by deleting the divided area other than the area removed by the removing means from the first input image, and generates the generated second input image as the second input image. The area divided according to the luminance hierarchy is obtained by repeating the processing by the histogram calculating unit, the threshold setting unit, and the region dividing unit using the first input image instead of the first input image. The image processing apparatus described.
前記ヒストグラムの分布の偏りを示す統計量が所定の範囲内に収まるように2値化閾値を設定する閾値設定工程と、
前記閾値設定工程により設定された2値化閾値により前記第1入力画像を2値化して2値画像を生成する2値化工程と、
前記2値化工程で生成された2値画像から領域を分割する領域分割工程と、
前記分割された領域を前記第1入力画像から削除することによって第2入力画像を生成し、当該生成された第2入力画像を前記第1入力画像の代わりに用いて前記ヒストグラム算出工程と前記閾値設定工程と前記領域分割工程とによる処理を繰り返すことによって、輝度階層別に分割された領域を取得する繰り返し工程と、
を有することを特徴とする画像処理方法。 A histogram calculation step of calculating a histogram of the first input image;
A threshold setting step for setting a binarization threshold so that a statistic indicating a bias in the distribution of the histogram falls within a predetermined range ;
And binarization to produce a binary image by binarizing the first input image by the binarization threshold value set by the threshold setting step,
A region dividing step of dividing a region from the binary image generated in the binarization step ;
A second input image is generated by deleting the divided area from the first input image, and the generated second input image is used instead of the first input image, and the histogram calculation step and the threshold value By repeating the process by the setting step and the region dividing step, a repeating step of acquiring the region divided by luminance hierarchy,
An image processing method comprising:
前記繰り返し工程では、前記除去工程で除去された領域以外の前記分割された領域を、前記第1入力画像から削除することによって第2入力画像を生成し、当該生成された第2入力画像を前記第1入力画像の代わりに用いて前記ヒストグラム算出工程と前記閾値設定工程と前記領域分割工程とによる処理を繰り返すことによって、輝度階層別に分割された領域を取得することを特徴とする請求項6に記載の画像処理方法。In the repetition step, a second input image is generated by deleting the divided region other than the region removed in the removal step from the first input image, and the generated second input image is The area divided according to the luminance hierarchy is obtained by repeating the process of the histogram calculation step, the threshold setting step, and the region dividing step using the first input image instead of the first input image. The image processing method as described.
Priority Applications (4)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP02290095A JP3733155B2 (en) | 1995-02-10 | 1995-02-10 | Image processing apparatus and method |
| US08/597,871 US5920655A (en) | 1995-02-10 | 1996-02-07 | Binarization image processing for multi-level image data |
| DE69618262T DE69618262T2 (en) | 1995-02-10 | 1996-02-09 | Image processing device and method |
| EP96300909A EP0731599B1 (en) | 1995-02-10 | 1996-02-09 | Image processing apparatus and method therefor |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP02290095A JP3733155B2 (en) | 1995-02-10 | 1995-02-10 | Image processing apparatus and method |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPH08221514A JPH08221514A (en) | 1996-08-30 |
| JP3733155B2 true JP3733155B2 (en) | 2006-01-11 |
Family
ID=12095531
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP02290095A Expired - Fee Related JP3733155B2 (en) | 1995-02-10 | 1995-02-10 | Image processing apparatus and method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP3733155B2 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP5262493B2 (en) * | 2008-09-17 | 2013-08-14 | 株式会社リコー | Image processing apparatus, image processing method, program, and computer-readable storage medium |
-
1995
- 1995-02-10 JP JP02290095A patent/JP3733155B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JPH08221514A (en) | 1996-08-30 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP0731599B1 (en) | Image processing apparatus and method therefor | |
| US6298151B1 (en) | Method and apparatus for automatic image segmentation using template matching filters | |
| US8385643B2 (en) | Determination of inputted image to be document or non-document | |
| US6813367B1 (en) | Method and apparatus for site selection for data embedding | |
| CN117392013A (en) | Vignetting elimination method, device, equipment and computer readable storage medium | |
| JP3733154B2 (en) | Image processing apparatus and method | |
| JP3733155B2 (en) | Image processing apparatus and method | |
| CN115330637A (en) | An image sharpening method, device, computing device and storage medium | |
| CN112529923B (en) | Control identification method and device | |
| JP2005275854A (en) | Image processing apparatus, image processing method, image processing program, and recording medium storing the program | |
| JPH08221512A (en) | Image processing apparatus and method thereof | |
| JP2871601B2 (en) | Character string detecting apparatus and method | |
| CN112132141B (en) | Character merging method, device, electronic device and storage medium | |
| CN102647540A (en) | Image processing device and image processing method | |
| JP2786355B2 (en) | How to determine the attributes of text images | |
| JP3966448B2 (en) | Image processing apparatus, image processing method, program for executing the method, and recording medium storing the program | |
| JP3106080B2 (en) | Image processing apparatus and method | |
| KR100254736B1 (en) | Apparatus and method for 1-dimension local adaptive image binarization | |
| JP3025365B2 (en) | Image binarization processing device | |
| JP2881066B2 (en) | How to determine the attributes of text images | |
| JP2910926B2 (en) | Optimal binarization method | |
| KR100484170B1 (en) | Method and apparatus for improvement of digital image quality | |
| JPH08221511A (en) | Image processing apparatus and method thereof | |
| JP4854398B2 (en) | Image processing apparatus, image processing method, and program | |
| JP2001312723A (en) | Image processor and image processing method |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20041209 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20050225 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20050426 |
|
| 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: 20050930 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20051017 |
|
| 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: 20091021 Year of fee payment: 4 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20091021 Year of fee payment: 4 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20101021 Year of fee payment: 5 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20101021 Year of fee payment: 5 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20111021 Year of fee payment: 6 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20111021 Year of fee payment: 6 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20121021 Year of fee payment: 7 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20131021 Year of fee payment: 8 |
|
| LAPS | Cancellation because of no payment of annual fees |