JP3673598B2 - Image processing method and image processing apparatus - Google Patents
Image processing method and image processing apparatus Download PDFInfo
- Publication number
- JP3673598B2 JP3673598B2 JP12334196A JP12334196A JP3673598B2 JP 3673598 B2 JP3673598 B2 JP 3673598B2 JP 12334196 A JP12334196 A JP 12334196A JP 12334196 A JP12334196 A JP 12334196A JP 3673598 B2 JP3673598 B2 JP 3673598B2
- Authority
- JP
- Japan
- Prior art keywords
- value
- binarization
- processing
- luminance
- image
- 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)
- Image Processing (AREA)
- Facsimile Image Signal Circuits (AREA)
Description
【0001】
【発明の属する技術分野】
本発明は画像処理方法及び画像処理装置に関し、例えば、多値画像から2値化閾値を決定して2値化を行う画像処理方法及び画像処理装置に関する。
【0002】
【従来の技術】
近年の画像処理技術の発展はめざましく、フルカラー画像等の多値画像の処理や、多値画像内の文字認識処理等が可能な画像処理装置も普及してきている。
【0003】
このような画像処理技術において、多値画像の2値化処理は不可欠の技術となっている。従来の2値化方法としては、予め設定してある固定閾値による単純2値化法をはじめとして、ある閾値でヒストグラムを2クラスに分割した場合のクラス間分散が最大になる時の閾値を2値化閾値とする大津法(大津、“判別および最小2乗基準に基づく自動しきい値選定方”、電子通信学会論文誌、vol.J63−D,no.4,pp.349−356,1980)や、また、階調をもつ画像に対して、局所的濃度に応じて閾値を設定する2値化方法等があった。
【0004】
【発明が解決しようとする課題】
しかしながら、上述したような従来の画像処理装置における2値化方法においては、以下のような問題点があった。
【0005】
固定閾値による単純2値化方法では、画像内の対象物濃度と背景濃度との間に適切な閾値を設定することが難しく、その結果、画像一面が黒く潰れてしまったり、逆に白くなってしまっていた。また、大津法では、2クラスの分布が極端に異なる場合においては、大きい方のクラスに閾値が寄ってしまうという性質があり、従ってノイズの多い2値画像が生成されてしまっていた。
【0006】
そこで、画像内の対象物濃度と背景濃度との間に適切な2値化閾値を自動的に設定可能な方法を、本出願人は特願平7−22895号公報で出願している。
【0007】
前記出願における閾値決定の流れを以下に説明する。
【0008】
図20において、まずステップS1で8ビットの多値画像を入力する。尚、該多値画像は、スキャナ等の画像入力装置により、入力される。そして、ステップS2において、入力画像全体のヒストグラムを算出する。ここでは、画像中の全画素を用い、8ビット、即ち「0」から「255」までの各デジタル値に対する頻度を計算する。これにより、例えば図21に示すヒストグラムが得られる。
【0009】
次にステップS3において、パラメータSTART,ENDにそれぞれ「0」、「255」をセットする。START,ENDはそれぞれ、後段のステップS4やステップS5で求める輝度値の統計量の始点及び終点に対応する。
【0010】
ステップS4では、STARTからENDまでのデジタル値に対応する画素の平均値AVを算出する。例えば、START=0,END=255であれば「0」から「255」の値を持つ画素(この場合、全画素)の平均値AVを算出し、START=0,END=177であれば「0」から「177」の値を持つ画素の平均値AVを算出する。
【0011】
ステップS5では、STARTからENDまでの輝度値に対応する画素のスキュー値SKを算出する。スキュー値とは、ヒストグラム分布の偏りを示す統計量である。スキュー値の算出には、以下に示す式を用いる。
【0012】
SK=(Σ(Xi−AV)^3)/D
(尚、R^3の表記によってRの3乗を示すものとする。)
【0013】
ここで、Xiは画素の輝度値である。また、Dは画像全体の分散値であり、下記式により算出される。
【0014】
D=Σ(Xi−AV)^2
(尚、R^2の表記によってRの2乗を示すものとする。)
【0015】
上述した式において、スキュー値は各画素の輝度値と、その平均値との差分を3乗することにより算出されるが、奇数乗であれば3乗に限定されるものではない。
【0016】
続いてステップS6、S7では、ヒストグラムの偏りの方向を判断する。まずステップS6では、以下に示す式によりヒストグラムの偏りの方向を判断する。これは、ヒストグラムの偏りが平均値AVよりも小さい値の範囲にあるか否かの判断となる。
【0017】
SK<−1.0
【0018】
ステップS6において上記式が真ならばステップS10へ進み、偽ならばステップS7へ進む。ステップS10では、STARTは変化させず、ENDに平均値AVをセットする。そしてステップS4に戻り、再びSTART値からEND値までの平均値AVを算出する。
【0019】
一方、ステップS7では以下に示す式によりヒストグラムの偏りの方向を判断する。これは、ヒストグラムの偏りが平均値AVより大きい値の範囲にあるか否かの判断となる。
【0020】
SK>1.0
【0021】
ステップS7において上記式が真ならばステップS11へ進み、偽ならばステップS8へ進む。ステップS11では、STARTに平均値AVをセットし、ENDは変化させない。そしてステップS4に戻り、再びSTART値からEND値までの平均値AVを算出する。
【0022】
一方、ステップS8ではステップS6,S7における条件が共に偽である場合の平均値AVを、2値化閾値THとして設定する。そして、ステップS9で2値化閾値THを用いた単純2値化処理を行う。
【0023】
以下、具体的な画像の例を参照して、特願平7−22895号公報における2値化処理について更に詳細に説明する。
【0024】
上述した図21に示すヒストグラムの例を用いて、2値化閾値THの決定処理について説明する。
【0025】
図21は、ある画像(8ビット入力)のヒストグラムを示したものである。図21において、横軸は左端が「0」即ち黒、右端が「255」即ち白を表す輝度のデジタル値であり、縦軸は各デジタル値の頻度を表している。図22は、図21に示す様なヒストグラムを有する画像に対して、上述した図20で示す2値化処理においてステップS4及びS5で示した処理の際の、各パラメータの値の変化を示す図である。尚、図22において示される各パラメータ値は、ステップS4及びS5を通過する回数によって、それぞれ示されている。
【0026】
まず、ステップS4及びS5を通過する1回目の処理では、START=0,END=255で平均値AV,統計量SKを計算し、それぞれ「177」,「−78.9」という値を得る。の場合、統計量SKが「−1.0」未満であるため、ステップS10においてSTART=0,END=177が設定される。
【0027】
続いて2回目の処理ではSTART=0,END=177における平均値AV,統計量SKを計算し、それぞれ「91」,「−8.6」という値を得る。これも、統計量SKが「−1.0」未満であるため、ステップS10においてSTART=0,END=91が設定される。
【0028】
続いて3回目の処理では、START=0,END=91における平均値AV,統計量SKを計算し、それぞれ「43」,「9.6」という値を得る。この場合は、統計量SKが「1.0」を超えるため、ステップS11においてSTART=43,END=91が設定される。
【0029】
続いて4回目の処理では、START=43,END=91における平均値AV,統計量SKを計算し、それぞれ「72」,「−7.0」という値を得る。これも、統計量SKが「−1.0」未満であるため、ステップS10においてSTART=43,END=72が設定される。
【0030】
続いて5回目の処理では、START=43,END=72における平均値AV,統計量SKを計算し、それぞれ「58」,「−2.2」という値を得る。これも、統計量SKが「−1.0」未満であるため、ステップS10においてSTART=43,END=58が設定される。
【0031】
そして6回目の処理では、START=43,END=58における平均値AV,統計量SKを計算し、それぞれ「50」,「−0.4」という値を得る。ここで、統計量SKが「−1.0」以上かつ「1.0」以下であるため、ステップS6,S7の条件を満たさず、ステップS8へ進んで2値化閾値THとして、「50」が設定される。そしてステップS9において2値化閾値THを用いた単純2値化処理が行われる。
【0032】
この様に、スキュー値が所定値まで収束するようにして2値化閾値を決定し、2値化を行う。即ち、入力された多値画像において、輝度頻度とその偏りに基づいて、画像内の背景と対象物とを分離するために最も適した閾値が存在する領域を特定した後、該特定領域の平均輝度値をもって閾値とする。
【0033】
特願平7−22895号公報の閾値決定方法によれば、対象物濃度と背景濃度との間に適切な閾値を設定できるが、図20の処理フローをそのまま実行する場合、輝度頻度情報の演算範囲の収束の仕方が入力画像によって異なるため閾値算出のための演算量が最小の場合と最大の場合で大きく異なる。そのため所定の時間でこの演算を行うためには処理周波数を高くしなければならないので高速化のボトルネックになっていた。
【0034】
また、従来からコンピュータ上の数値演算方法には整数演算と浮動小数点演算がある。整数演算はコンピュータの扱える整数有効数値(16bit整数で32767〜−32768)内で高速に演算され、さらにコンピュータ内部の整数有効数値(CPUやシステムなどの処理環境に依存する)内では、より高速に演算される。浮動小数点演算は数値部と指数部を持った型の数値で行われるので、大きな数値から、小数点以下の数値まで表現できる。
【0035】
またコンピュータプログラムによる計算ではなく演算器により演算するブロックを構成するにあたって浮動小数点演算器を用いて構成する方法と整数演算器を用いて構成する方法があった。
【0036】
しかしながら、上述したような画像処理の数値演算装置における2値化閾値決定の演算方法においては、以下のような問題があった。
【0037】
整数演算で画像処理の数値演算を行っている場合、浮動小数点演算に比べ圧倒的に高速であるが、割り算などで少数部が切り捨てられることによる誤差が発生し、繰り返し演算に割り算が含まれている場合などには誤差が大きくなりやすく精度が保てない。また整数の幅に制限があり、制限を超えた大きな数値や、小数点以下の数値は扱えなかった。
【0038】
浮動小数点演算で画像処理の数値演算を行っている場合、高精度を保つことができるが、演算処理が遅く処理時間がかかってしまっていた。またCPUの中には浮動小数点演算ユニットを持たないのも少なからずあるため、その場合はさらに処理時間がかかることになる。
【0039】
ハードによる演算では、まず浮動小数点演算器で構成した場合において演算速度が遅く回路規模が大きくなり、整数演算器で構成した場合は切り捨てによる演算誤差が大きくなるという点があった。
【0040】
これは、浮動小数点演算の場合、必ず演算毎に仮数部を正規化して指数部の値を更新するという操作がはいる。この操作は乗除算ではそれほどではないが加減算ではかなりのクロック数を必要とし、これを少ないクロック数で実行しようとした場合にそのハード量が大きくなってしまうという欠点がある。対して整数演算または固定小数演算ではオーバーフローの危険と丸め誤差による演算精度の低下の恐れが生ずる。整数演算で浮動小数点演算の時と同等の演算精度を得るためには演算器の桁数を大きくするしかなく、この場合にはハード量の増大または動作可能周波数の低下が避けられない。
【0041】
本発明は上述した技術に鑑みなされたものであり、多値画像を2値化するための2値化閾値を決定して2値化処理を行う際に、処理を極めて高速化することができる画像処理方法の提供を目的とする。
【0042】
また、本発明は多値画像の画像処理の演算において、限られたコンピュータの扱える整数の有効数値内で一定の精度を保ち、特に、大きな数値から小さい数値まで収束させるような繰り返し演算の高速化ができる画像処理方法の提供を目的とする。
【0043】
【課題を解決するための手段】
上述した目的を達成するため、本発明の画像処理方法は、多値画像を2値化するための2値化閾値を決定して、2値化処理を行う画像処理方法において、複数画素からなる所定の大きさのブロック単位で2値化処理を行う際に、ライン順次での多値画像の入力と、前記ブロック順次での2値化閾値決定処理と、前記2値化閾値決定処理で決定された閾値を用いて、ライン順次での2値化処理とをパイプライン処理で行い、前記2値化閾値決定処理は、前記所定の大きさのブロック単位に、ブロック内の輝度毎の頻度を算出し、当該輝度頻度から輝度平均値及びスキュー値を演算することで2値化閾値を決定し、さらに各演算をパイプライン処理で同期させながら実行する。
【0044】
また、上述した目的を達成するため、本発明の画像処理装置は、多値画像を2値化するための2値化閾値を決定して、2値化処理を行う画像処理装置において、複数画素からなる所定の大きさのブロック単位で2値化処理を行う際に、ライン順次での多値画像を入力する入力手段と、前記ブロック順次で2値化閾値を決定する2値化閾値決定手段と、前記2値化閾値決定手段で決定された閾値を用いて、ライン順次での2値化処理を行う2値化手段と、前記入力手段による多値画像の入力と、前記2値化閾値決定手段による2値化閾値の決定と、前記2値化手段により2値化処理とをパイプライン処理で実行する制御手段と、を有し、前記2値化閾値決定手段は、前記所定の大きさのブロック単位に、ブロック内の輝度毎の頻度を算出し、当該輝度頻度から輝度平均値及びスキュー値を演算することで2値化閾値を決定し、さらに前記制御手段は前記輝度平均値及びスキュー値の演算をパイプライン処理で同期させながら実行する。
【0045】
【発明の実施の形態】
図1は、本実施の形態における2値化処理を実行するシステム構成を示すブロック図である。図1において、1は画像の2値化処理、文字認識処理などを行う画像処理装置であり、2は画像を入力するスキャナ等の画像入力装置、3は処理後の画像を表示する画像表示装置である。
【0046】
画像処理装置1において、4は画像入力装置2とのインターフェースとなる入力インターフェース部、5は入力された多値画像からの二値化閾値を演算し、多値画像を二値化処理する閾値演算二値化部である。6は画像データを記憶する記憶部、7は画像処理装置全体を制御するCPU部で、CPU、ROM、RAM等からなる。8は文字領域として抽出された領域に対し、文字認識処理を行う文字認識部、9は文字領域以外の領域に分離された領域に対する各種画像処理や画像のレイアウト処理を行う画像処理部、10は画像表示装置3とのインターフェースとなる出力インターフェース部である(文字認識部8と画像処理部9の処理はCPU部7がプログラムによって実行されてもよい)。
【0047】
画像入力装置2から入力インターフェース部4を通じて入力された多値の画像データは閾値演算二値化部5に入力される。閾値演算二値化部5は所定領域(64×64画素)毎の二値化閾値を演算して64×64画素の多値画像データを二値画像に変換する。閾値演算二値化部内部5の詳細は後で説明する。変換された二値画像データは記憶部6に格納される。記憶部6に格納された画像のうち文字領域と識別された画像には文字認識処理がなされて文字コードに変換される。
【0048】
図2は閾値演算二値化部5の内部を表した図である。
【0049】
閾値演算二値化部5において、201は多値画像データを入力する入力部であり、207は入力部201からの画像データを所定領域のライン数分格納するバッファメモリである。206はバッファメモリ207のデータ入出力を制御するメモリ制御部であり、205は入力画像の所定領域毎の輝度頻度とそれに対する二値化閾値を算出する二値化閾値演算部である。204は二値化閾値演算部205が得られた閾値データを複数バンド分記憶することのできる結果記憶部であり、203は多値画像より二値画像の作成を行う画像変換処理部であり、202は変換された二値画像を出力する出力部である。208は制御部でありCPU部7から指示を受けて閾値演算二値化部5の全体の制御を行う。なお閾値演算二値化部5では多値画像を輝度で扱う。よって8ビット輝度データが意味するものは最も濃い黒が0で最も淡い白が255になる。画像入力装置2や画像表示装置3ではこの意味が異なることが考えられるが、この場合は入力部201と出力部202において反転処理を行う。
【0050】
図3は二値化閾値演算部205の詳細を示した図である。
【0051】
301は輝度頻度演算部、302は閾値演算部、303はマルチプレクサ、304、305は輝度頻度記憶RAMである。輝度頻度記憶RAM304、305は2ポートRAMで構成され1つのポートは読み出し専用、他ポートは書き込み専用でともにマルチプレクサ303に接続されている。RAM304、305はマルチプレクサ303を介して輝度頻度演算部301と閾値演算部302に交互に接続される。
【0052】
図4はこれらの動作タイミングを示した図である。まず図2において、入力部201を通してラスタ順次に入力された多値画像データはメモリ制御部206を介してバッファメモリ207に書き込まれる。64ライン分のデータが入力されると、その後順次64×64のブロックデータをバッファメモリ207から読み出し、メモリ制御部206を介して二値化閾値演算部205へ入力する。輝度頻度演算部301はメモリ制御部206から64×64画素のブロック内の輝度毎の頻度をカウントする。各輝度の頻度は輝度頻度記憶RAMの輝度値をアドレスとする箇所に計数される。最初のブロックの輝度頻度は輝度頻度記憶RAM304に生成されるとすると次の輝度頻度は輝度頻度記憶RAM305に生成される。閾値演算部302は輝度頻度演算部301の処理に対して1ブロック遅れて動作する。即ち輝度頻度演算部301が第Nブロックを処理している時間には閾値演算部302は第N−1ブロックの処理をする。この輝度頻度演算部301と閾値演算部302の詳細は後で述べる。閾値演算部302で演算された閾値は結果記憶部204に格納される。二値化処理は多値画像入力に対して約128ライン遅れたところから開始される。
【0053】
図5はバッファメモリ207でのデータ入出力の流れである。入力部からバッファメモリへの流れ(多値画像入力)はライン順次であり、バッファメモリから二値化閾値演算部への出力は64画素×64ラインのブロック順次で、バッファメモリから画像変換処理部への多値画像はライン順次で流れる。従って、画像変換処理部203から二値画像出力もライン順次で出力される。
【0054】
図6は画像の入力に対するバッファメモリ207の入出力を示す図である。入力、演算、出力の各処理は小分割してアクセスされる。説明すると、32画素(32バイト)単位にアクセスする場合、多値画像の入力32画素分の画像入力クロックを処理の単位としてその時間内に入力32バイト、演算32バイト、出力32バイトの入出力を行う(3アクセスが競合した場合)。
【0055】
画像入力レートに対してバッファメモリの入出力レートは3倍であるが、バッファメモリのデータ幅が16ビットであるとすると1.5倍となる。この様にバッファメモリのデータ幅を調整すれば、メモリ速度に適した入出力レートにすることができる。メモリ制御部206には画像入力の速度とバッファメモリの入出力の速度の差を吸収する小バッファ(FIFOメモリ)が64バイト(32バイト×2)程度内部に持っている。また入力、演算、出力の各処理バッファをバンクに分割している場合は各バンクの処理が終わらないと切り換えできないが分離していないため各処理の開始を自由にできる。図6で説明すると入力、演算、出力の開始の間隔は等間隔でなければならないが、図から分かるように出力処理の開始を少し早めている。これにより、各ラインの入力に対する出力時間差を小さくすることを可能にしている。
【0056】
図7は輝度頻度演算部301の構成と輝度頻度記憶RAM304/305との関係を示した図で、図8は輝度頻度の演算処理タイミングを示した図である。
【0057】
501は同じ輝度データが連続して入力されたかどうかをチェックする値チェック部、502は入力された輝度値に対応する輝度頻度記憶RAM304、305の部分のデータを読み出すRAMリード部、503は502で読み出されたデータに+1を加算する+1加算部、504は+1加算されたデータを輝度頻度記憶RAM304、305に書き戻すRAMライト部、505はパイプライン処理の不整合を回避するデータマルチプレクサである。図8に示されているように輝度頻度演算部301は同一アドレス(輝度値)のチェック、メモリ読み出し、+1加算処理、書き込み処理をパイプランで処理する。しかし輝度頻度記憶RAMから読み出されたデータが+1加算処理されて書き戻される間に同じ輝度データが入力された場合、そのままでは+1加算する前のデータが処理されるため正しく輝度頻度を計数できない。そこで同一アドレスのチェック部501によってパイプラインの段数内に同一データがないかどうかチェックする。例えば、値チェック部501でN番目のデータを処理する場合、その値と前のN−1とN−2番目のデータの値を比較して同一の値がないかチェックする。もし同じ輝度データがあった場合マルチプレクサ505によってデータをフィードバックしてデータ読み出し手段によって輝度頻度記憶RAMからデータを無視するようにして正しく輝度頻度を計数できるようにしている。また同一アドレスに対し同時にリード動作とライト動作をするパターンになった場合はリード動作を禁止する。処理ブロックを64×64画素とすると輝度頻度は0から4096で13ビット幅のメモリが必要であるが、4095に制限する。その12ビットの他に1ビットを初期化フラグに使用する。初期化フラグは動作開始時に1に設定され、初期化フラグが1のデータは他の12ビットがいかなる値でも0として扱う。初期化フラグの設定は次の閾値演算部302で行う。
【0058】
図9は閾値演算部302の構成及び輝度頻度記憶RAM304/305との関係を示した図である。304/305は輝度頻度記憶RAMであり0から255の値をとる輝度をアドレス値としたRAMである。
【0059】
601はクリア処理部であり、輝度頻度記憶RAM304、305の初期化フラグの処理をする。602は指示された範囲の輝度頻度からその平均輝度を算出する平均値演算部であり、603は同じく指示された範囲の輝度頻度からそのスキューを算出するスキュー演算部である。輝度頻度記憶RAM304/305の出力はこの平均値演算部602とスキュー演算部603に接続され、読み出されたデータは並列に入力される。604は判定部であり平均値演算部602とスキュー演算部603の出力を受けて終了判定を行う。605は全体の制御を行う制御部であり主にレンジの管理を行う。606は閾値演算部であり、閾値の上限と下限の処理を行う。
【0060】
次に、本実施の形態における2値化の閾値決定処理の流れについて、図10〜図14のフローチャートを参照して詳細に説明する。
【0061】
ステップS701において、パラメータSTART、ENDにそれぞれ「0」、「255」をセットする。同時に後述する画像特徴判別、かすれ文字処理、つぶれ文字処理で使用するMF、KF、TFの各フラグを「OFF、ON、OFF」に初期化し、また、閾値決定処理ループ回数iに「1」をセットする。START、ENDはそれぞれ、後段のステップS702やステップS704で求める輝度値の統計量(平均値、スキュー値)の始点及び終点に対応する。
【0062】
ステップS702では、STARTからENDまでのデジタル値に対応する画素の平均値AVを算出する。例えば、START=0、END=255であれば、「0」から「255」までの値を持つ画素の平均値AVを算出し、START=0、END=109であれば「0」から「109」までの値を持つ画素の平均値AVを算出する。
【0063】
kを0から255の輝度値、PkまたはP(k)をその輝度値に対応した分布量とすると平均値AVは、
AV=Σ(k×P(k))÷ΣP(k) (k=START‥END)…(1)
となる。
【0064】
S703では、閾値決定処理ループ回数iの判断を行い、iが「10」ならばステップS718へ、「10」以外ならステップS704へ進む。
【0065】
ステップS704では、STARTからENDまでの輝度値に対応する画素のスキュー値SKを算出する。スキュー値とは、ヒストグラム分布の偏りを示す統計量である。スキュー値の算出には、以下に示す(2)式を用いる。
【0066】
スキュー値を求める(2)式において分母部分は画像全体の分散値であり、分子は各画素の輝度値と、その平均値との差分を3乗することにより算出されるが、奇数乗であれば3乗に限定されるものではない。
【0067】
ステップS705では、1つの処理ブロックにおける閾値決定処理ループ回数iの判断(i=1、つまり最初のループかどうかの判断)を行う。iが「1」であればステップS706へ、iが「1」以外であればステップS709へ進む。ステップS706では、処理中のブロックが「文字ブロック」かどうかの画像特徴判別を行い、ステップS718へ進む。画像特徴判別の詳細(S728〜S729、S707〜S708)は後述するが文字ブロックであると判断された場合はMFが「ON」に設定される。
【0068】
ステップS709では(3)式に示す様にヒストグラムの偏りの大きさを判断する。
【0069】
|SK|<0.125 …(3)
つまり、スキュー値SKの絶対値が「0.125」未満かの判断を行う。ステップS709が真ならばステップS719へ、偽ならばステップS710へ進む。
【0070】
ステップS710ではかすれ文字処理を行う。S710の条件が成立した場合はS719へ、成立しなかった場合はS711へ進む。かすれ文字処理の詳細(S710、S730〜S〜731、S712〜S713)は後述する。
【0071】
ステップS711では、閾値決定処理ループ回数iの判定を行い、iが「2」ならばステップS712へ、「2」以外ならステップS716へ進む。iが「2」の場合に進むステップS714では、処理中のブロックが「つぶれ文字ブロック」かどうの判断と処理を行いステップS716で合流する。つぶれ文字処理の詳細(S714、S732〜S733、S715)は後述するがつぶれ文字ブロックであると判断された場合はつぶれ文字フラグTFが「ON」に設定される。
【0072】
ステップS716では、以下に示す(4)式によりヒストグラムの偏りの方向を判断する。
【0073】
SK>=0 …(4)
【0074】
ステップS716において(4)式が真(ヒストグラムの偏りが平均値AVよりも大きい値の範囲にある事を意味する)ならばステップS717へ進み、偽(ヒストグラムの偏りが平均値AVよりも小さい値の範囲にある事を意味する)ならばステップS718へ進む。
【0075】
ステップS717では、STARTに平均値AVをセットし、ENDは変化させない。そして、ステップS734へ進む。ステップS718では、STARTは変化させず、ENDに平均値AVをセットする。そして、ステップS734へ進む。ステップS734では、閾値決定処理ループ回数iに「1」を加え、そしてステップS702に戻り、再びSTART値からEND値までの平均値AVを算出する。この様にスキュー値SKが所定値まで収束する様にして2値化閾値を設定することで、下地を除去し、鮮明な2値画像を得ることができる。
【0076】
ステップS719では平均値AVを、2値化閾値THとして設定する。ステップS720からS727は得られた二値化閾値THの制限処理であり、詳細は後述する。この閾値制限の処理を行うと閾値決定処理が終了する。
【0077】
以上説明したようにして本実施例における2値化処理が行われるが、式(3)、(4)で示した範囲は、これに限定されるものではない。
【0078】
このフローチャートにより説明した二値化閾値決定処理を図9における回路で実行するのであるが、演算精度を確保するために以下の様に変形する。
【0079】
輝度値kの範囲は0から255であるため平均値AVも0から255の範囲の値となる。しかしスキューSKを演算する場合、輝度kは平均値AVの差分(k−AV)の値が基本となっている。10回の演算の繰り返しにおいて演算領域であるSTART、END間が狭くなるため、その差分の値が次第に小さくなり、またΣPiも同様に小さくなる。よって(2)式における分母および分子部分の値が小さくなっていくためスキューSKの有効桁数を1回目のループと同程度確保する場合に分母/分子の演算桁を大きくすることが必要となる。即ち小数点以下の桁数を増やしていくしかない。
【0080】
(1)式においてXを(14−((END−START)のビット数))とすると、
となり、本来の平均値AVとの関係は、
AV=AV′÷2X +START (4)
となる。
【0081】
初回のループのSTART=0、END=255の時(END−STARTが8ビット範囲で収まる)に平均値AVを整数部分8ビット、小数部分を7ビットで求められるとすると、2回目以降において(END−START)が7ビット範囲であれば整数部分は7ビットであるため小数点部分を8ビットまで求めても同じ演算器で処理が可能になる。説明すると(3)式において(k−START)によってオフセット処理してXによってスケーリングを行っているために同じ除算部分は27ビット割る13ビットで演算されても小数点以下の桁数が7から14まで変化する。小数点以下の桁数が大きくなるのは(2)の分母/分子の値が小さくなるのと歩調があっている。
【0082】
同じようにYを(12−(Σp(i)のビット数))(ただしYがマイナス値の場合は0)として(2)式は
tmpA=(k−START)×2X −AV′ (5)
tmpB=((tmpA×tmpA)÷27 )×(p(k)×2Y ) (6)
tmpC=Σ(tmpA×(tmpB÷23 )) (7)
D=(ΣtmpB)÷27 (8)
E=|tmpC|÷2X+5 (9)
S…tmpCの符号 (10)
SK′=E÷D (11)
と変形される。ここでSK′は|SK|に等しい。
【0083】
図9の各部の内部構成を説明する前に図10〜14の閾値算出の処理フローを図15に示す。大きく分けて平均値演算部602とスキュー演算部603と判定部604の動作の流れを示しているが、同時に動作する部分は横並びで表し、時間経過を上下で図示している。
【0084】
最初にn回目の平均値、スキューをそれぞれAVn、SKn(その前段階がDn、En、Sn)として説明を行う。まずフェーズP801としてSTART=0、END=255と初期化される。フェーズP802としてEND〜STARTの範囲のデータが輝度頻度記憶RAM304/305から読み出されて平均値演算部602に入力される。これにより輝度255から0までの輝度の平均値AV′1が算出される。次にフェーズP803でやはり255から0の範囲のデータが輝度頻度記憶RAM304/305から読み出されてスキュー演算部603に入力されてD1、E1、S1が演算される。この時同時に0からAV1の範囲の平均輝度AV′2が平均演算部602によって演算される。次のフェーズP804でENDをAV1に設定し、フェーズP805においてAV2−END間の平均値AV′3bとSTART−AV2間の平均値AV′3aが平均値演算部602によって演算され、END−START間のスキューD2、E2、S2がスキュー演算部603によって算出される。このフェーズP804からP805の間に同時に判定部604によってD1/E1の演算を行って得られたSK′1を用いて画像特徴判別が行われる。
【0085】
フェーズP805ではAV3としてAV3aとAV3bの二つが求められるが、続くフェーズP806で次の演算範囲を決定するのにSK2の符号すなわちS2が正であればAV3aがAV3となり負であればAV3bがAV3となる。本来であればS2すなわちSK2の演算が終了するまでAV3を求めるための領域がSTART−AV2間であるかAV2−END間であるかが決定されていないが、SK2(D2、E2、S2)の演算にSTART−AV2−END間のデータをアクセスするため、平均値演算部602においてSTART−AV2間の平均値AV3aとAV2−END間の平均値AV3bの二つの値を求めておく。輝度頻度記憶RAM304/305のデータはSTART−AV2、AV2−ENDのように時間的にずれて入力されるため平均値演算部602を複数持つ必要はない。このAV′3a、AV′3b、D2、E2、S2が判定部604に入力され、S2の符号によりAV3を決定して制御部に出力する。制御部605は受けた平均値によりSTARTとENDの再設定を行って次の演算範囲を決定し次の平均値とスキュー(AV4、D3、E3、S3)の演算を行わせる。それと平行して判定部604ではD2/E2の演算がなされ、|SK2|<0.1の終了判定やつぶれ文字処理またはかすれ文字処理が行われる。詳しくは後述するがつぶれ文字とかすれ文字は相対する性質であるためどちらか一方の処理が行われる。これらの処理により終了条件が成立した場合はAV2を閾値THとして出力し、制御部605は演算中の平均値演算部602とスキュー演算部603の動作を停止させて全処理を終了する。
【0086】
終了条件が成立しなかった場合は同様の処理を続行していき、最後に10回目の平均値AV10の演算が終わってSK9に対する終了判定をして終了条件が成立した場合はAV9を閾値THとして成立しなかった場合はAV10を閾値THとして終わる。
【0087】
このように平均値演算部602、スキュー演算部603、判定部604が同時に動作して演算を行っており、判定部604がn回目の演算を行っているとするとスキュー演算部603は(n+1)回目の演算であり、平均値演算部602は(n+2)回目の演算をパイプラインで行っていることになる。しかし単純なパイプライン動作ではなく、平均値演算部602とスキュー演算部603の演算は同期を取って行われるため輝度頻度記憶RAM304/305は一つで処理することができる。
【0088】
ところで平均値演算部602においてSTART、AVn、ENDの三つの値が与えられた場合、START−AVn間とAVn−END間の平均値を求めるためにAVnに該当する箇所の輝度データを2度アクセスしなければならないが、例として図16に示すような構成にすれば1回のアクセスですむ。
【0089】
図16は平均値演算部602の詳細な構成を示したブロック図である。
【0090】
輝度頻度記憶RAM304/305のデータは255から0へアクセスされる。901は入力されたSTARTとENDの値からEND−STARTとXの値を求める演算器である。この平均値演算部602では平均値を2つ演算するため、入力AとBにはSTART、AVn、ENDの値が実際には入力される。
【0091】
902はEND−STARTの値を入力して0までダウンカウントするカウンタ、903は入力A、Bの乗算を行う乗算器であり、乗算器903の入力Aには輝度すなわち輝度頻度記憶RAM304/305のデータを読み出す時のアドレスの値−STARTの値即ちカウンタ902の出力が入力され、入力Bにはその読み出された頻度データが入力される。この乗算器903によって(k−START)×P(k)の演算が行われる。904は加算器でありΣ(k−START)×P(k)の演算を行う。905はレジスタであり、加算器904の出力を2つ分保持する。906はシフタであり、演算器901によって得られたXの値によってレジスタ905の出力をシフトさせる。このシフト量によってAV′nの小数点以下の桁数が決定される。907はテンポラリのレジスタであり、輝度がAVnに相当する箇所のデータを一時的に保持するものである。908はマルチプレクサであり、909は加算器である。マルチプレクサ908は加算器909への入力をレジスタ907のデータにするか加算器909の出力をフィードバックさせるかを選択するもので、通常は出力をフィードバックさせるように選択されている。加算器909によりΣP(k)が演算される。
【0092】
910はレジスタであり、加算器909のデータが確定したところでその値を保持するものである。平均値は二つ求めなければならないためその出力を2つ分記憶する容量を持つ。911は除算器でありレジスタ905、910からデータを入力し、平均値を求める。
【0093】
レジスタ907はP(k)のデータをディレイさせるものである。最初に加算器904と909は初期化され0に設定されk=ENDから演算を開始し、k=AVnのデータを演算したところで加算器904と909の出力をレジスタ905、910にセーブする。k=AVn+1の演算時にマルチプレクサ908はレジスタ907のデータを選択することにより、加算器507ではP(AVn)+P(AVn+1)の演算を行う。加算器904においては重複するデータの値は入力A側が0であるためディレイ目的のテンポラリのレジスタは必要ない。その後k=STARTまでの演算が終わるとその結果をまたレジスタ905、910に出力する。
【0094】
このようにすることによってデータに読み出しが各1回になるので平均値演算部602とスキュー演算部603が動作を始めてから、同期をとるためにスキュー演算部603を止める必要はなくなる。
【0095】
図17はスキュー演算部603の構成図である。
【0096】
1001はカウンタであり、END−STARTの値をロードして0までカウントダウンを行う。1002はシフタであり、平均値演算部602で演算されたXを受けて(k−START)×2Xの演算を行う。1003は減算器であり、(k−START)×2X−AV′すなわちtmpAの演算を行う。1004は乗算器でありtmpA×tmpAの演算を行う。1005は演算器であり平均値演算部602で演算されたΣP(k)の値からYを求める。1006はシフタでありYの値で輝度分布量P(k)から(P(k)×2Y )の演算を行う。1007は乗算器であり、(tmpA×tmpA÷27 )×(P(k)×2Y )即ちtmpBの演算を行う。1008はディレイであり、減算器1003の出力を乗算器1004と1007の演算クロック数分遅れさせる。1009は乗算器であり、tmpA×(tmpB÷22 )の演算を行う。1010は加算器であり、ΣtmpBの演算をしてDの結果を出力する。1011は加算器であり、ΣtmpA×(tmpB÷22 )の演算を行う。1012は演算器であり、|ΣtmpA×(tmpB÷22 )|÷2X+5 の演算をしてEとその符号Sの出力を行う。
【0097】
図18は閾値算出の終了条件を判定する判定部604の詳細を示したブロック図である。
【0098】
1101は比較器であり、スキュー演算部603で得られたD、Eの値からE×8<D即ち|SK|<0.125の判定を行う。1102は除算器であり、同じくD<Eの値からE÷Dを演算してSK′n即ち|SKn|の値を求める。1103は画像特徴判定部であり、1104はかすれ文字処理部であり、1105はつぶれ文字処理部である。1103、1104、1105内には図10〜図14のMF、KF、TF、SK1があって共通に管理されている。
【0099】
では、画像特徴判別部1103について、図10、図12に戻って説明する。ステップS701では、動作開始時に処理中のブロックが「文字ブロック」かどうかを示す、文字フラグMFに「0」をセットし、ステップS704にて一回目のスキュー値の演算がなされるのを待つ。一回目のスキュー値(この段階ではD1、E1)が演算されると画像特徴判別S706に入り、そのスキュー値の符号Sが負である場合(S728)、ステップS729へ進み符号Sが負でない場合ステップS718へ進み画像特徴判別を終了する。ステップS729では除算器1102によって演算されるスキュー値SK′1を用い、処理中のブロックが「文字ブロック」かどうかの判断を(12)式により行う。
【0100】
SK′>MH …(12)
ここで、MHは処理中のブロックが「文字ブロック」かどうかを示す値であり、制御部208にCPU部7が設定した値である。ここでは、「MH=20」とする。ステップS729において(12)式が真ならばステップS707へ、偽ならばこの画像特徴判別処理を終える。ステップS707では、処理中のブロックが「文字ブロック」であることを示す、文字フラグMFに「1」をセットし、次のステップS708で得られたスキュー値をSK1に保持してこの画像特徴判別処理を終える。
【0101】
以上説明したようにして本実施の形態における画像特徴判別処理が行われるが、式(12)で示した条件は、これに限定されるものではない。
【0102】
次に、つぶれ文字処理部について、同じく図10、図14を用い詳細に説明する。
【0103】
ここで、つぶれ文字とは、1文字の画数が多い等のため、つぶれている文字のことであり、つぶれ文字と判断されるとそれを良好に再現できる閾値を割り当てる。
【0104】
ステップS701では、処理中のブロックが「つぶれ文字ブロック」かどうかを示す、つぶれ文字フラグTFに「OFF」をセットする。2回目のスキュー演算(D2、E2)が終わるとステップS714に進み、文字フラグMFが「ON」であり符号Sが正である場合、ステップS708で保持されたSK1と除算器1102によって演算されるスキュー値SK′2を用い、ステップS733では、処理中のブロックが「つぶれ文字ブロック」かどうかの判断を(13)式により行う。
【0105】
SK1>=SR×SK′2 …(13)
ここで、SRは処理中のブロックが「つぶれ文字ブロック」かどうかを示す値であり、ここでは、「SR=3.0」とする。ステップS733において(13)式が真ならばステップS715へ、偽ならばこのつぶれ文字処理を終える。ステップS715では、処理中のブロックが「つぶれ文字ブロック」であることを示す、つぶれ文字フラグTFに「ON」をセットし、このつぶれ文字処理を終える。
【0106】
以上説明したようにして本実施の形態における、つぶれ文字処理が行われるが、式(13)で示した条件は、これに限定されるものではない。
【0107】
さらに、かすれ文字処理について、図10、図13を用い詳細に説明する。かすれ文字とはうすくなってしまった文字のことであるが、本例ではこのうすれ文字にも最適な閾値を割り当てる。ステップS701では、処理中のブロックが「かすれ文字ブロック」かどうかを示す、かすれ文字フラグKFに「OFF」をセットする。2回目以降のスキュー値に対して文字フラグMFが「ON」で符号Sが負である場合、ステップS708で保持されたSK1と除算器1102によって演算されるスキュー値SK′nを用い、ステップS731では、処理中のブロックが「かすれ文字ブロック」かどうかの判断を(13)式により行う。ここで、SRは処理中のブロックが「かすれ文字ブロック」かどうかを示す値であり、ここでは、「SR=3.0」とする。ステップS710において(13)式が真ならばステップS719へ進む。偽ならばステップS711へ進み、ループ回数が2の場合のみS712へ進む。ステップS712において符号Sが正の場合はかすれ文字フラグKFを「OFF」にする。
【0108】
SRは処理中のブロックが「かすれ文字ブロック」かどうかを示す値であり、ここでは、「SR=3.0」とする。
【0109】
以上説明したようにして本実施の形態における、かすれ文字処理が行われるが、式(6)で示した条件は、これに限定されるものではない。
【0110】
図10の2回目のループにおいて、かすれ文字処理とつぶれ文字処理が重なるが処理の本体であるS731とS733は同じ処理であり、S730とS732から分かるように2回目のスキューの符号によってどちらが実行されるか決まる。よって2つの処理は排他的でありかつ同一処理であるため回路規模や実行時間に対する影響は小さい。
【0111】
終了判定が行われると判定部604から閾値制限部606に平均値AVが出力され、閾値制限部606ではその時の平均値AVを閾値THに設定してS720に進む。処理ブロックが文字ブロックでない場合すなわち文字フラグMFが「OFF」の時は閾値THを下限値Lと上限値Hによる制限を行う。つまり、ステップS719で決定された閾値THが、下限値Lよりも小さいときは閾値THをLで代表させ、上限値Hよりも大きいときは閾値THをHで代表させるような制限処理を行う。尚、この下限値Lと上限値Hは、画像入力装置2の特性により決定される値である。文字ブロックである場合、ステップS725へ進んでつぶれ文字フラグTFが「ON」かどうかの判断(処理中のブロックがつぶれ文字ブロックかどうかの判断)をする。その結果が、つぶれ文字ブロックであればステップS726へ行く。ステップS726において閾値THが上限値Hに達しない場合はS727へ進み閾値THに文字つぶれ防止用の定数TPをかけるような制限処理を行う。定数TPは0.875としているが画像入力装置2の特性により決定される値である。
【0112】
図19は図2の結果記憶部204と画像変換処理部203の詳細を示したブロック図である。
【0113】
結果記憶部204は二値化閾値演算部205で決定された各ブロックの閾値とそのブロックが文字ブロックであるかどうかを示す文字フラグMFを受け取り内部に格納する。二値化閾値演算部205からは64×64=4096画素入力の時間間隔で閾値が入力される。内部のメモリ容量は扱う画像の1ラインの最大画素数を8192画素とすると128×2×9ビット(8192÷64=128)である。メモリ制御部206からは二値化する画像がライン順次で入力されるため結果記憶部204から画像変換処理部203(後述の1201から1211)への出力は64画素分の時間間隔があり入出力の競合を調停する。画像変換処理部203の内部は1201から1211である。1201は16ビットレジスタであり、メモリ制御部206より読み出された2画素分のデータを一時的に記憶する。1202、1203は比較器であり、2画素データを同時に閾値と大小比較を行い出力する。1204は2ビット→4ビット変換レジスタであり、1205は4ビット幅のFIFOメモリである。レジスタ1204は比較器1202、1203からの2画素分の二値化データ(2ビット)を2回受け取り4ビットそろったところでFIFOメモリ1205へ出力する。1201から1204は内部動作クロックに同期し1206から1211は画像の入出力クロックに同期して動作するのであるがFIFOメモリ1205はこのクロック速度の違いを吸収するものである。1206は二値画像を2ライン分ディレイさせるメモリで2k×8bitの容量を持つ。働きは8k×2bitのFIFOメモリと等価であるがバス幅を4倍の8ビット幅にしていることにより1ポートRAMで処理している。画像のクロックにして2クロックに1回アクセスされる。1207、1208、1209はシフトレジスタであり、3画素×3画素のウインドウを作る。1210は文字フラグのディレイメモリであり、128+αビットの容量を持つ。1211は孤立点除去部であり、シフトレジスタ1208の注目画素即ち3×3画素の中心画素のまわりの画素を調べて、孤立点であれば白画素「1」に変換して出力する。ディレイメモリ1210から孤立点除去部1211への出力はこの注目画素が含まれたブロックの文字フラグMFの値であり、文字フラグが「1」であれば孤立点除去を働かせ、「0」であれば休止させて注目画素をスルー出力させる。
【0114】
尚、64×64の処理ブロックからはずれる部分の二値化閾値はその近傍の64×64のブロックの二値化閾値を用いる。
【0115】
前述の実施の形態ではブロックのサイズを64×64としたが、画像の解像度が倍になった場合は128×128であり、1/2の場合は32×32とする。ブロックサイズが小さくなった場合でも(5)式から(11)式にある全画素数によって変化するYによって同じハードで演算精度を確保できる。ブロックサイズを大きくする場合は、輝度頻度記憶RAMのビット幅(容量)を大きくしてかつ閾値を演算する平均値演算部とスキュー演算部の演算器のビット数も大きくする。即ち、演算系は処理する画像の解像度の最大値によって設計される。
【0116】
しかし、十分なサンプリング数(輝度頻度を構成する画素数)が必要であれば、データを間引いて処理できる。例えば4096画素で十分であれば、128×128の領域から輝度頻度は飛び飛びに4096画素でとるのである。この場合は閾値演算部の構成は変わらない。また、輝度頻度記憶RAMのビット幅を2ビット増やして、閾値を演算する平均値演算部とスキュー演算部には輝度頻度記憶RAMの下位2ビットを除いて入力しても閾値演算部の構成は変わらない。
【0117】
この必要とするサンプリング数は画像入力装置の特性等によって決定される。
【0118】
また、前記実施の形態ではブロックの大きさを縦横同じにしたが長方形でもよい。
【0119】
また、前記実施の形態ではブロックと判定されたブロックのみ孤立点除去を行うとしたが、全ブロックに行ってもよく、全ブロックに対して処理をスルーさせてもよい。
【0120】
また、動作周波数に余裕がある場合は輝度頻度記憶RAMを1ポートRAMで構成してもよい。輝度値に対応するメモリデータの読み出し、+1加算、メモリデータの書き込みの一連の動作をすることになるので処理クロック数が3倍程度になるが、パイプラインの不整合を監視する回路が不要になる。
【0121】
また、同じく輝度頻度を記憶するものをカウンタで構成してもよい。回路規模は大きくなるが1画素を1クロックで処理できるので動作周波数を高くできる。
【0122】
以上説明したように、本実施の形態によれば、各処理ごとに必要であったバンドメモリが1ブロックに統一されるため、メモリ制御信号が1組ですみ信号の数を少なくできるためIC化しやすい。また各処理バッファが物理的に分離されていないため各処理の開始のタイミングを自由に設定できる。
【0123】
また、輝度頻度記憶メモリを多ポートRAMで構成することによって輝度頻度累計のための周波数を低減することができ、より高速動作が可能になる。
【0124】
また、二値化閾値を演算する平均値演算部とスキュー演算部の演算の同期をとってパイプライン化されているため、本来であればシーケンシャルに実行するか、平均値演算部とスキュー演算部のそれぞれに必要な輝度頻度記憶RAMが1個ですむため、処理の高速化と回路規模増加の回避を同時に実現できる。
【0125】
また、画像の文字及び線画部分の孤立点が除去されるため見やすくなり、かつ文字認識の認識率が向上する。また、圧縮効率も向上するので画像の格納スペースとFAX等の転送速度の向上がなされる。
【0126】
また、本実施の形態によれば、数値演算の演算式と演算に用いる数値データにより演算値のとり得る値の予測から、演算の小数点位置を決定して演算値の桁数を切り捨て及び繰り上げを行い、最終演算値を予め設定した有効桁数内に収めることを特徴とする。
【0127】
更に、演算の小数点位置は、処理単位ごとに決定することを特徴とする。
【0128】
更に、前記決定処理単位は、前記画像の輝度頻度の平均値を求め、前記画像の輝度頻度の偏りを求める単位を処理単位とする決定手段を有することを特徴とする。
【0129】
例えば、有効桁数は演算値の必要精度によって決定されることを特徴とする。
【0130】
以上の構成により、多値画像の画像処理の演算において、限られたコンピュータの扱える整数の有効数値内で一定の精度を保ち、特に、大きな数値から小さい数値まで収束させるような繰り返し演算の高速化ができるという特有の作用効果が得られる。
【0131】
即ち全計算を複数に分割してそれを処理単位とし、演算処理単位毎にデータ範囲を調べて必要とする演算精度を得られる桁数を決定する。この決定した桁数によって整数演算の小数点位置を移動させて演算するのである。このことにより各処理範囲中は整数演算で行うためハード演算の場合はハード量を少なくできる。かつ処理単位毎に最適な小数点位置にするため桁数を少なくして精度を高めることができる。
【0132】
【発明の効果】
以上説明した如く本発明によれば、多値画像を2値化するための2値化閾値を決定して2値化処理を行う際に、処理を極めて高速化することができる。
【0133】
また、多値画像の画像処理の演算において、限られたコンピュータの扱える整数の有効数値内で一定の精度を保ち、特に、大きな数値から小さい数値まで収束させるような繰り返し演算を高速化ができる。
【図面の簡単な説明】
【図1】本実施の形態における画像処理装置の全体構成を示した図である。
【図2】閾値演算二値化部の構成を示したブロック図である。
【図3】二値化閾値演算部205の内部構成を示した図である。
【図4】二値化閾値演算部におけるパイプライン処理を説明するための図である。
【図5】二値化閾値演算部におけるパイプライン処理を説明するための図である。
【図6】画像入力に対するバッファメモリの入出力を示す図である。
【図7】輝度頻度演算部の構成を示した図である。
【図8】輝度頻度演算部における処理タイミングを示した図である。
【図9】閾値演算部の構成を示したブロック図である。
【図10】閾値演算処理を示したフローチャート図である。
【図11】閾値演算処理を示したフローチャート図である。
【図12】閾値演算処理を示したフローチャート図である。
【図13】閾値演算処理を示したフローチャート図である。
【図14】閾値演算処理を示したフローチャート図である。
【図15】閾値演算部におけるタイミングチャート図である。
【図16】平均値演算部の構成を示したブロック図である。
【図17】スキュー演算部の構成を示したブロック図である。
【図18】判定部の構成を示したブロック図である。
【図19】結果記憶部と画像変換処理部の構成を示したブロック図である。
【図20】閾値決定処理を説明するための図である。
【図21】閾値決定処理を説明するための図である。
【図22】閾値決定処理を説明するための図である。
【符号の説明】
1 画像処理装置
2 画像入力装置
3 画像表示装置
4 入力I/F部
5 閾値演算二値化部
6 記憶部
7 CPU部
8 文字認識部
9 画像処理部
10 出力I/F部[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an image processing method and an image processing apparatus, for example, an image processing method and an image processing apparatus that perform binarization by determining a binarization threshold value from a multi-valued image.
[0002]
[Prior art]
The development of image processing technology in recent years is remarkable, and image processing apparatuses capable of processing multi-value images such as full-color images, character recognition processing in multi-value images, and the like have become widespread.
[0003]
In such an image processing technique, binarization processing of a multi-valued image has become an indispensable technique. Conventional binarization methods include a simple binarization method using a preset fixed threshold, and a threshold when the inter-class variance is maximum when the histogram is divided into two classes with a certain threshold. Otsu method as a threshold value (Otsu, “Automatic threshold selection method based on discrimination and least square criterion”, IEICE Transactions, vol. J63-D, no. 4, pp. 349-356, 1980 In addition, there is a binarization method for setting a threshold according to a local density for an image having gradation.
[0004]
[Problems to be solved by the invention]
However, the binarization method in the conventional image processing apparatus as described above has the following problems.
[0005]
In the simple binarization method using the fixed threshold value, it is difficult to set an appropriate threshold value between the object density and the background density in the image, and as a result, the entire image is crushed in black or on the contrary white. I was sorry. In the Otsu method, when the distributions of the two classes are extremely different, there is a property that the threshold is shifted to the larger class, and therefore a noisy binary image is generated.
[0006]
Therefore, the present applicant has filed an application in Japanese Patent Application No. 7-22895 for a method capable of automatically setting an appropriate binarization threshold between the object density and the background density in the image.
[0007]
The flow of threshold determination in the application will be described below.
[0008]
In FIG. 20, first, in step S1, an 8-bit multi-value image is input. The multivalued image is input by an image input device such as a scanner. In step S2, a histogram of the entire 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, a histogram shown in FIG. 21 is obtained.
[0009]
In step S3, “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 luminance value obtained in the subsequent steps S4 and S5, respectively.
[0010]
In step S4, 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, the average value AV of pixels having values from “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.
[0011]
In step S5, 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. The following formula is used for calculating the skew value.
[0012]
SK = (Σ (Xi−AV) ^ 3) / D
(Note that R ^ 3 indicates the third power of R.)
[0013]
Here, Xi is the luminance value of the pixel. D is a dispersion value of the entire image, and is calculated by the following equation.
[0014]
D = Σ (Xi-AV) ^ 2
(Note that the square of R is indicated by the notation of R ^ 2.)
[0015]
In the above formula, the skew value is calculated by raising the difference between the luminance value of each pixel and the average value to the third power. However, the skew value is not limited to the third power as long as it is an odd power.
[0016]
Subsequently, in steps S6 and S7, the direction of histogram bias is determined. First, in step S6, the bias direction of the histogram is determined by the following equation. This is a determination as to whether or not the histogram bias is in the range of values smaller than the average value AV.
[0017]
SK <−1.0
[0018]
If the above formula is true in step S6, the process proceeds to step S10, and if false, the process proceeds to step S7. In step S10, START is not changed, and average value AV is set to END. Then, returning to step S4, the average value AV from the START value to the END value is calculated again.
[0019]
On the other hand, in step S7, the direction of bias of the histogram is determined by the following equation. This is a determination as to whether or not the histogram bias is in the range of values greater than the average value AV.
[0020]
SK> 1.0
[0021]
If the above formula is true in step S7, the process proceeds to step S11, and if false, the process proceeds to step S8. In step S11, the average value AV is set to START, and END is not changed. Then, returning to step S4, the average value AV from the START value to the END value is calculated again.
[0022]
On the other hand, in step S8, the average value AV when the conditions in steps S6 and S7 are both false is set as the binarization threshold TH. In step S9, simple binarization processing using the binarization threshold TH is performed.
[0023]
Hereinafter, the binarization processing in Japanese Patent Application No. 7-22895 will be described in more detail with reference to specific image examples.
[0024]
The binarization threshold value TH determination process will be described using the example of the histogram shown in FIG.
[0025]
FIG. 21 shows a histogram of an image (8-bit input). In FIG. 21, the horizontal axis represents the digital value of luminance representing “0”, that is, black, and the right end represents “255”, that is, white, and the vertical axis represents the frequency of each digital value. FIG. 22 is a diagram showing changes in the values of parameters in the process shown in steps S4 and S5 in the binarization process shown in FIG. 20 described above for an image having a histogram as shown in FIG. It is. In addition, each parameter value shown in FIG. 22 is each shown by the frequency | count of passing through step S4 and S5.
[0026]
First, in the first process that passes through steps S4 and S5, the average value AV and the statistic SK are calculated with START = 0 and END = 255, and values of “177” and “−78.9” are obtained, respectively. In this case, since the statistic SK is less than “−1.0”, START = 0 and END = 177 are set in step S10.
[0027]
Subsequently, in the second process, the average value AV and the statistic SK at START = 0 and END = 177 are calculated to obtain values “91” and “−8.6”, respectively. Again, since the statistic SK is less than “−1.0”, START = 0 and END = 91 are set in step S10.
[0028]
Subsequently, in the third processing, the average value AV and the statistic SK at START = 0 and END = 91 are calculated, and the values “43” and “9.6” are obtained, respectively. In this case, since the statistic SK exceeds “1.0”, START = 43 and END = 91 are set in step S11.
[0029]
Subsequently, in the fourth processing, the average value AV and the statistic SK at START = 43 and END = 91 are calculated, and the values “72” and “−7.0” are obtained, respectively. Again, since the statistic SK is less than “−1.0”, START = 43 and END = 72 are set in step S10.
[0030]
Subsequently, in the fifth processing, the average value AV and the statistic SK at START = 43 and END = 72 are calculated, and values of “58” and “−2.2” are obtained, respectively. Again, since the statistic SK is less than “−1.0”, START = 43 and END = 58 are set in step S10.
[0031]
In the sixth processing, the average value AV and the statistical quantity SK at START = 43 and END = 58 are calculated, and values of “50” and “−0.4” are obtained, respectively. Here, since the statistic SK is not less than “−1.0” and not more than “1.0”, the condition of Steps S6 and S7 is not satisfied, and the process proceeds to Step S8 to set the binarization threshold TH as “50”. Is set. In step S9, simple binarization processing using the binarization threshold TH is performed.
[0032]
In this way, the binarization threshold is determined so that the skew value converges to a predetermined value, and binarization is performed. That is, in the input multi-valued image, an area having a threshold most suitable for separating the background and the object in the image is identified based on the luminance frequency and its bias, and then the average of the specific area The luminance value is used as a threshold value.
[0033]
According to the threshold value determination method of Japanese Patent Application No. 7-22895, an appropriate threshold value can be set between the object density and the background density. However, when the processing flow of FIG. Since the method of convergence of the range varies depending on the input image, the range of calculation for the threshold value calculation differs greatly between the minimum and maximum cases. Therefore, in order to perform this calculation in a predetermined time, the processing frequency has to be increased, which has been a bottleneck for speeding up.
[0034]
Conventional numerical computation methods on computers include integer arithmetic and floating point arithmetic. Integer operations are performed at high speed within integer valid values that can be handled by computers (32767 to -32768 with 16-bit integers), and even faster within integer valid values inside computers (depending on the processing environment such as the CPU and system). Calculated. Floating-point operations are performed with numbers that have a numeric part and an exponent part, so it can be expressed from large numbers to numbers below the decimal point.
[0035]
There are a method of using a floating point arithmetic unit and a method of using an integer arithmetic unit in constructing a block to be calculated by an arithmetic unit, not by a computer program.
[0036]
However, the binarization threshold value determination method in the image processing numerical calculation device as described above has the following problems.
[0037]
When performing numerical processing of image processing with integer arithmetic, it is overwhelmingly faster than floating-point arithmetic, but errors occur due to truncation of the decimal part due to division, etc., and division is included in repetitive arithmetic In some cases, the error tends to increase and the accuracy cannot be maintained. In addition, there was a limit on the width of integers, and it was not possible to handle large numbers exceeding the limit or numbers after the decimal point.
[0038]
When performing numerical processing of image processing by floating point arithmetic, high accuracy can be maintained, but arithmetic processing is slow and processing time is long. In addition, there are not a few CPUs that do not have a floating-point arithmetic unit, and in this case, further processing time is required.
[0039]
In the calculation by hardware, the calculation speed is slow and the circuit scale is large when it is configured with a floating point arithmetic unit, and the calculation error due to truncation increases when it is configured with an integer arithmetic unit.
[0040]
In the case of floating-point arithmetic, there is always an operation for updating the value of the exponent part by normalizing the mantissa part for each arithmetic operation. Although this operation is not so much in multiplication and division, it requires a considerable number of clocks in addition and subtraction, and there is a disadvantage that the amount of hardware becomes large when trying to execute this with a small number of clocks. On the other hand, in integer arithmetic or fixed decimal arithmetic, there is a risk of overflow and a risk of deterioration in arithmetic accuracy due to rounding error. In order to obtain an arithmetic accuracy equivalent to that of floating point arithmetic in integer arithmetic, the number of digits of the arithmetic unit must be increased. In this case, an increase in hardware amount or a decrease in operable frequency is inevitable.
[0041]
The present invention has been made in view of the above-described technology, and when performing a binarization process by determining a binarization threshold value for binarizing a multilevel image, the process can be extremely speeded up. An object is to provide an image processing method.
[0042]
In addition, the present invention provides a high-speed repetitive operation that maintains a certain precision within a limited number of effective integer values that can be handled by a limited number of computers in image processing operations for multi-valued images, and in particular, converges from a large numerical value to a small numerical value. An object of the present invention is to provide an image processing method.
[0043]
[Means for Solving the Problems]
In order to achieve the above-described object, an image processing method according to the present invention includes a plurality of pixels in an image processing method for performing binarization processing by determining a binarization threshold value for binarizing a multilevel image. When performing binarization processing in units of blocks of a predetermined size, it is determined by input of multi-valued images in line sequential, binarization threshold determination processing in block sequential, and binarization threshold determination processing The binarization processing in line sequential is performed by pipeline processing using the threshold value, and the binarization threshold determination processing calculates the frequency for each luminance in the block in units of the predetermined size. The binarization threshold value is determined by calculating and calculating the luminance average value and the skew value from the luminance frequency, and each calculation is executed while being synchronized by pipeline processing.
[0044]
In order to achieve the above-described object, an image processing apparatus according to the present invention determines a binarization threshold value for binarizing a multi-valued image and performs binarization processing. An input means for inputting a multi-valued image in a line sequence and a binarization threshold value determining means for determining a binarization threshold value in the block order. And binarization means for performing binarization processing in line order using the threshold value determined by the binarization threshold value determination means, input of a multi-valued image by the input means, and the binarization threshold value Determining means for determining a binarization threshold value, and control means for executing binarization processing by the binarization means in a pipeline process, wherein the binarization threshold value determining means has the predetermined magnitude. For each block, calculate the frequency for each luminance in the block, and Determining the binarization threshold value by calculating an average luminance value and the skew value from the luminance frequency, further said control means executes while synchronizing the operation of the brightness average value and the skew value in the pipeline processing.
[0045]
DETAILED DESCRIPTION OF THE INVENTION
FIG. 1 is a block diagram showing a system configuration for executing binarization processing in the present embodiment. In FIG. 1, 1 is an image processing apparatus that performs binarization processing, character recognition processing, and the like, 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. It is.
[0046]
In the
[0047]
Multi-valued image data input from the
[0048]
FIG. 2 is a diagram showing the inside of the threshold
[0049]
In the threshold
[0050]
FIG. 3 is a diagram showing details of the binarization threshold
[0051]
[0052]
FIG. 4 is a diagram showing these operation timings. First, in FIG. 2, multivalued image data input in raster order through the
[0053]
FIG. 5 shows a flow of data input / output in the
[0054]
FIG. 6 is a diagram showing input / output of the
[0055]
The input / output rate of the buffer memory is 3 times the image input rate, but if the data width of the buffer memory is 16 bits, it becomes 1.5 times. By adjusting the data width of the buffer memory in this way, an input / output rate suitable for the memory speed can be obtained. The
[0056]
FIG. 7 is a diagram showing the relationship between the configuration of the luminance
[0057]
[0058]
FIG. 9 is a diagram showing the configuration of the threshold
[0059]
[0060]
Next, the flow of binarization threshold value determination processing in the present embodiment will be described in detail with reference to the flowcharts of FIGS.
[0061]
In step S701, “0” and “255” are set in the parameters START and END, respectively. At the same time, the MF, KF, and TF flags used in image feature discrimination, blurred character processing, and collapsed character processing, which will be described later, are initialized to “OFF, ON, OFF”, and “1” is set to the threshold determination processing loop count i. set. START and END correspond to the start point and end point of the statistics (average value and skew value) of the luminance values obtained in steps S702 and S704 in the subsequent stage, respectively.
[0062]
In step S702, an average value AV of pixels corresponding to digital values from START to END is calculated. For example, if START = 0 and END = 255, an average value AV of pixels having values from “0” to “255” is calculated. If START = 0 and END = 109, “0” to “109” are calculated. An average value AV of pixels having values up to “is calculated.
[0063]
When k is a luminance value from 0 to 255 and Pk or P (k) is a distribution amount corresponding to the luminance value, the average value AV is
AV = Σ (k × P (k)) ÷ ΣP (k) (k = START... END) (1)
It becomes.
[0064]
In S703, the threshold determination processing loop count i is determined. If i is "10", the process proceeds to step S718, and if other than "10", the process proceeds to step S704.
[0065]
In step S704, 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. The following equation (2) is used to calculate the skew value.
[0066]
In equation (2) for obtaining the skew value, the denominator is the variance value of the entire image, and the numerator is calculated by raising the difference between the luminance value of each pixel and its average value to the third power. It is not limited to the third power.
[0067]
In step S705, a determination is made of the number i of threshold value determination processing loops in one processing block (i = 1, that is, whether the first loop). If i is “1”, the process proceeds to step S706. If i is other than “1”, the process proceeds to step S709. In step S706, image feature determination is performed to determine whether the block being processed is a “character block”, and the process advances to step S718. Details of the image feature determination (S728 to S729, S707 to S708) will be described later, but if it is determined to be a character block, MF is set to “ON”.
[0068]
In step S709, the magnitude of the histogram bias is determined as shown in equation (3).
[0069]
| SK | <0.125 (3)
That is, it is determined whether the absolute value of the skew value SK is less than “0.125”. If step S709 is true, the process proceeds to step S719, and if false, the process proceeds to step S710.
[0070]
In step S710, blurred character processing is performed. If the condition of S710 is satisfied, the process proceeds to S719, and if not, the process proceeds to S711. Details of the blurred character processing (S710, S730 to S731, and S712 to S713) will be described later.
[0071]
In step S711, the threshold determination process loop count i is determined. If i is "2", the process proceeds to step S712, and if other than "2", the process proceeds to step S716. In step S714 that proceeds when i is “2”, it is determined whether or not the block being processed is a “collapsed character block”, and merges in step S716. Although details of the collapsed character processing (S714, S732 to S733, S715) will be described later, if it is determined that the block is a collapsed character block, the collapsed character flag TF is set to “ON”.
[0072]
In step S716, the direction of the histogram bias is determined by the following equation (4).
[0073]
SK> = 0 (4)
[0074]
In step S716, if the expression (4) is true (means that the histogram bias is in a range of values larger than the average value AV), the process proceeds to step S717, and false (a value in which the histogram bias is smaller than the average value AV). If it is within the range, the process proceeds to step S718.
[0075]
In step S717, the average value AV is set in START, and END is not changed. Then, the process proceeds to step S734. In step S718, START is not changed, and average value AV is set in END. Then, the process proceeds to step S734. In step S734, “1” is added to the threshold value determination processing loop count i, and the process returns to step S702 to calculate the average value AV from the START value to the END value again. Thus, by setting the binarization threshold value so that the skew value SK converges to a predetermined value, the background can be removed and a clear binary image can be obtained.
[0076]
In step S719, the average value AV is set as the binarization threshold TH. Steps S720 to S727 are the obtained binarization threshold TH limiting process, and details will be described later. When this threshold value limiting process is performed, the threshold value determining process ends.
[0077]
As described above, the binarization processing in the present embodiment is performed, but the ranges shown by the equations (3) and (4) are not limited to this.
[0078]
The binarization threshold value determination process described with reference to this flowchart is executed by the circuit in FIG. 9 but is modified as follows in order to ensure calculation accuracy.
[0079]
Since the range of the luminance value k is 0 to 255, the average value AV is also a value in the range of 0 to 255. However, when calculating the skew SK, the luminance k is basically based on the difference value (k−AV) of the average value AV. Since the area between START and END, which are the operation areas, becomes narrower after 10 repetitions, the difference value gradually decreases, and ΣPi similarly decreases. Therefore, since the values of the denominator and the numerator part in the expression (2) become smaller, it is necessary to increase the denominator / numerator arithmetic digit when the number of significant digits of the skew SK is secured to the same extent as the first loop. . In other words, there is no choice but to increase the number of digits after the decimal point.
[0080]
In the equation (1), if X is (14− (number of bits of (END-START))),
The relationship with the original average value AV is
AV = AV ′ ÷ 2 X + START (4)
It becomes.
[0081]
When the initial loop START = 0 and END = 255 (END-START fits within the 8-bit range), if the average value AV is obtained with an integer part of 8 bits and a decimal part of 7 bits, the second and subsequent times ( If (END-START) is in the 7-bit range, the integer part is 7 bits, so that even if the decimal part is obtained up to 8 bits, processing can be performed by the same arithmetic unit. To explain, since the offset processing is performed by (k-START) in equation (3) and scaling is performed by X, even if the same division part is calculated by 13 bits divided by 27 bits, the number of digits after the decimal point is from 7 to 14 Change. The increase in the number of digits after the decimal point is in step with the decrease in the denominator / numerator value in (2).
[0082]
Similarly, assuming that Y is (12− (the number of bits of Σp (i))) (however, if Y is a negative value, 0), equation (2) is
tmpA = (k-START) × 2 X -AV '(5)
tmpB = ((tmpA × tmpA) / 2 7 ) × (p (k) × 2 Y (6)
tmpC = Σ (tmpA × (tmpB ÷ 2 Three )) (7)
D = (ΣtmpB) ÷ 2 7 (8)
E = | tmpC | ÷ 2 X + 5 (9)
S: Symbol of tmpC (10)
SK ′ = E ÷ D (11)
And transformed. Here, SK ′ is equal to | SK |.
[0083]
Before explaining the internal configuration of each part in FIG. 9, the processing flow of the threshold calculation in FIGS. The operation flow of the average
[0084]
First, description will be made assuming that the n-th average value and the skew are AVn and SKn (the previous stage is Dn, En, and Sn). First, as phase P801, START = 0 and END = 255 are initialized. As phase P 802, data in the range of END to START is read from the luminance
[0085]
In phase P805, two AV3a and AV3b are obtained as AV3. In the following phase P806, the next calculation range is determined. That is, if the sign of SK2, that is, S2 is positive, AV3a is AV3. Become. Originally, it is not determined whether the area for obtaining AV3 is between START-AV2 or AV2-END until the calculation of S2, that is, SK2, is completed, but SK2 (D2, E2, S2) In order to access data between START-AV2 and END for the calculation, the average
[0086]
If the end condition is not satisfied, the same process is continued. Finally, when the calculation of the average value AV10 for the tenth time is completed and the end determination is made for SK9, AV9 is set as the threshold value TH. If not established, AV10 ends with the threshold value TH.
[0087]
As described above, when the average
[0088]
By the way, when three values of START, AVn, and END are given in the average
[0089]
FIG. 16 is a block diagram showing a detailed configuration of the average
[0090]
Data in the luminance
[0091]
[0092]
[0093]
The
[0094]
By doing so, data is read once, so that it is not necessary to stop the
[0095]
FIG. 17 is a configuration diagram of the
[0096]
A
[0097]
FIG. 18 is a block diagram illustrating details of the
[0098]
[0099]
Now, the image
[0100]
SK ′> MH (12)
Here, MH is a value indicating whether the block being processed is a “character block”, and is a value set by the CPU unit 7 in the
[0101]
As described above, the image feature determination processing according to the present embodiment is performed, but the condition shown in Expression (12) is not limited to this.
[0102]
Next, the collapsed character processing unit will be described in detail with reference to FIGS. 10 and 14.
[0103]
Here, the collapsed character is a collapsed character because of the large number of strokes of one character, and a threshold value that can be favorably reproduced when it is determined to be a collapsed character is assigned.
[0104]
In step S <b> 701, “OFF” is set in the collapsed character flag TF indicating whether the block being processed is a “collapsed character block”. When the second skew calculation (D2, E2) is completed, the process proceeds to step S714. When the character flag MF is “ON” and the sign S is positive, the calculation is performed by the SK1 and the
[0105]
SK1> = SR × SK′2 (13)
Here, SR is a value indicating whether the block being processed is a “collapsed character block”, and here, “SR = 3.0”. In step S733, if the expression (13) is true, the process proceeds to step S715. In step S715, “ON” is set in the collapsing character flag TF indicating that the block being processed is a “collapsed character block”, and the collapsing character processing ends.
[0106]
As described above, the collapsed character processing in the present embodiment is performed, but the condition shown in Expression (13) is not limited to this.
[0107]
Further, the blurred character processing will be described in detail with reference to FIGS. A faint character is a faint character, but in this example, an optimum threshold is assigned to the faint character. In step S701, “OFF” is set in the blurred character flag KF indicating whether the block being processed is a “blurred character block”. When the character flag MF is “ON” and the sign S is negative for the second and subsequent skew values, the SK1 held in step S708 and the skew value SK′n calculated by the
[0108]
SR is a value indicating whether the block being processed is a “blurred character block”, and here, “SR = 3.0”.
[0109]
As described above, the blurred character processing in the present embodiment is performed, but the condition shown in the equation (6) is not limited to this.
[0110]
In the second loop of FIG. 10, the blurred character processing and the collapsed character processing overlap, but S731 and S733, which are the main bodies of the processing, are the same processing, and as can be seen from S730 and S732, which is executed depending on the sign of the second skew. It will be decided. Therefore, since the two processes are exclusive and the same process, the influence on the circuit scale and execution time is small.
[0111]
When the end determination is made, the
[0112]
FIG. 19 is a block diagram showing details of the
[0113]
The
[0114]
It should be noted that the binarization threshold value of the 64 × 64 block in the vicinity thereof is used as the binarization threshold value of the portion deviating from the 64 × 64 processing block.
[0115]
In the above-described embodiment, the block size is 64 × 64, but is 128 × 128 when the image resolution is doubled, and 32 × 32 when the resolution is ½. Even when the block size is reduced, the calculation accuracy can be secured with the same hardware by Y that changes depending on the total number of pixels in the equations (5) to (11). When the block size is increased, the bit width (capacity) of the luminance frequency storage RAM is increased and the number of bits of the arithmetic unit of the average value calculation unit and the skew calculation unit for calculating the threshold value is also increased. That is, the arithmetic system is designed with the maximum value of the resolution of the image to be processed.
[0116]
However, if a sufficient number of samplings (the number of pixels constituting the luminance frequency) is necessary, data can be thinned out and processed. For example, if 4096 pixels are sufficient, the luminance frequency jumps from the 128 × 128 region to 4096 pixels. In this case, the configuration of the threshold calculation unit does not change. Even if the bit width of the luminance frequency storage RAM is increased by 2 bits and the low-
[0117]
The required number of samplings is determined by the characteristics of the image input device.
[0118]
In the above embodiment, the size of the block is the same in the vertical and horizontal directions, but it may be rectangular.
[0119]
In the above-described embodiment, isolated points are removed only for blocks determined to be blocks, but may be performed for all blocks, or processing may be performed for all blocks.
[0120]
Further, when there is a margin in the operating frequency, the luminance frequency storage RAM may be configured with a 1-port RAM. A series of operations of reading out memory data corresponding to the luminance value, adding +1, and writing in the memory data is performed, so the number of processing clocks is about three times, but a circuit for monitoring pipeline mismatch is unnecessary. Become.
[0121]
Similarly, a device that stores the luminance frequency may be constituted by a counter. Although the circuit scale is large, one pixel can be processed with one clock, so that the operating frequency can be increased.
[0122]
As described above, according to the present embodiment, the band memory required for each process is unified into one block, so that only one set of memory control signals is required, and the number of signals can be reduced. Cheap. In addition, since each processing buffer is not physically separated, the start timing of each processing can be freely set.
[0123]
In addition, by configuring the luminance frequency storage memory with a multi-port RAM, the frequency for the luminance frequency accumulation can be reduced, and higher-speed operation becomes possible.
[0124]
In addition, since the calculation of the average value calculation unit for calculating the binarization threshold and the calculation of the skew calculation unit are synchronized with each other, it is pipelined so that it is originally executed sequentially or the average value calculation unit and the skew calculation unit Since only one luminance frequency storage RAM is required for each of these, it is possible to simultaneously realize high-speed processing and avoiding an increase in circuit scale.
[0125]
Further, since the isolated points of the characters and line drawing parts of the image are removed, it is easy to see and the recognition rate of character recognition is improved. Further, since the compression efficiency is also improved, the storage space for images and the transfer speed such as FAX are improved.
[0126]
Further, according to the present embodiment, the decimal point position of the calculation is determined, and the number of digits of the calculation value is rounded down and raised from the prediction of the value that the calculation value can take based on the numerical expression and the numerical data used for the calculation. And the final calculated value is stored within a preset effective number of digits.
[0127]
Furthermore, the decimal point position of the operation is determined for each processing unit.
[0128]
Further, the determination processing unit includes a determination unit that obtains an average value of luminance frequencies of the image and uses a unit for obtaining a bias of luminance frequency of the image as a processing unit.
[0129]
For example, the number of significant digits is determined by the required accuracy of the calculated value.
[0130]
With the above configuration, in multi-valued image processing operations, it is possible to maintain constant accuracy within a limited number of integers that can be handled by a limited number of computers, especially speeding up repeated operations that converge from large numbers to small numbers. It is possible to obtain a unique effect of being able to
[0131]
That is, all the calculations are divided into a plurality of processing units, and the number of digits that can obtain the required calculation accuracy is determined by examining the data range for each processing unit. The calculation is performed by moving the decimal point position of the integer operation according to the determined number of digits. As a result, integer processing is performed during each processing range, so that the amount of hardware can be reduced in the case of hardware calculations. In addition, since the decimal point position is optimal for each processing unit, the number of digits can be reduced to increase the accuracy.
[0132]
【The invention's effect】
As described above, according to the present invention, when performing a binarization process by determining a binarization threshold value for binarizing a multi-valued image, the process can be extremely speeded up.
[0133]
Further, in the calculation of image processing of multi-valued images, it is possible to maintain a certain accuracy within a limited number of effective numerical values that can be handled by a limited computer, and in particular, it is possible to speed up repeated operations that converge from a large numerical value to a small numerical value.
[Brief description of the drawings]
FIG. 1 is a diagram illustrating an overall configuration of an image processing apparatus according to an embodiment.
FIG. 2 is a block diagram showing a configuration of a threshold calculation binarization unit.
FIG. 3 is a diagram illustrating an internal configuration of a binarization threshold
FIG. 4 is a diagram for explaining pipeline processing in a binarization threshold value calculation unit;
FIG. 5 is a diagram for explaining pipeline processing in a binarization threshold value calculation unit;
FIG. 6 is a diagram illustrating input / output of a buffer memory for image input.
FIG. 7 is a diagram illustrating a configuration of a luminance frequency calculation unit.
FIG. 8 is a diagram showing processing timing in a luminance frequency calculation unit.
FIG. 9 is a block diagram showing a configuration of a threshold value calculation unit.
FIG. 10 is a flowchart showing threshold value calculation processing.
FIG. 11 is a flowchart showing threshold value calculation processing;
FIG. 12 is a flowchart showing threshold value calculation processing.
FIG. 13 is a flowchart showing threshold calculation processing.
FIG. 14 is a flowchart showing threshold value calculation processing.
FIG. 15 is a timing chart in the threshold value calculation unit.
FIG. 16 is a block diagram showing a configuration of an average value calculation unit.
FIG. 17 is a block diagram illustrating a configuration of a skew calculation unit.
FIG. 18 is a block diagram illustrating a configuration of a determination unit.
FIG. 19 is a block diagram illustrating a configuration of a result storage unit and an image conversion processing unit.
FIG. 20 is a diagram for explaining threshold determination processing;
FIG. 21 is a diagram for explaining threshold determination processing;
FIG. 22 is a diagram for explaining threshold determination processing;
[Explanation of symbols]
1 Image processing device
2 Image input device
3 Image display device
4 Input I / F section
5 threshold calculation binarization unit
6 storage unit
7 CPU part
8 Character recognition part
9 Image processing unit
10 Output I / F section
Claims (8)
複数画素からなる所定の大きさのブロック単位で2値化処理を行う際に、ライン順次での多値画像の入力と、前記ブロック順次での2値化閾値決定処理と、前記2値化閾値決定処理で決定された閾値を用いて、ライン順次での2値化処理とをパイプライン処理で行い、
前記2値化閾値決定処理は、前記所定の大きさのブロック単位に、ブロック内の輝度毎の頻度を算出し、当該輝度頻度から輝度平均値及びスキュー値を演算することで2値化閾値を決定し、さらに各演算をパイプライン処理で同期させながら実行することを特徴とする画像処理方法。In an image processing method for determining a binarization threshold for binarizing a multi-valued image and performing binarization processing,
When performing binarization processing in units of a block having a predetermined size composed of a plurality of pixels, input of a multi-valued image in line sequence, binarization threshold value determination processing in block sequence, and binarization threshold value Using the threshold value determined in the determination process, the binarization process in line sequential is performed in the pipeline process,
The binarization threshold value determination process calculates a frequency for each luminance in the block for each block of the predetermined size, and calculates a luminance average value and a skew value from the luminance frequency to obtain a binarization threshold value. An image processing method characterized by determining and executing each operation while synchronizing with pipeline processing.
複数画素からなる所定の大きさのブロック単位で2値化処理を行う際に、ライン順次での多値画像を入力する入力手段と、
前記ブロック順次で2値化閾値を決定する2値化閾値決定手段と、
前記2値化閾値決定手段で決定された閾値を用いて、ライン順次での2値化処理を行う2値化手段と、
前記入力手段による多値画像の入力と、前記2値化閾値決定手段による2値化閾値の決定と、前記2値化手段により2値化処理とをパイプライン処理で実行する制御手段と、
を有し、
前記2値化閾値決定手段は、前記所定の大きさのブロック単位に、ブロック内の輝度毎の頻度を算出し、当該輝度頻度から輝度平均値及びスキュー値を演算することで2値化閾値を決定し、さらに前記制御手段は前記輝度平均値及びスキュー値の演算をパイプライン処理で同期させながら実行することを特徴とする画像処理装置。In an image processing apparatus that performs a binarization process by determining a binarization threshold for binarizing a multi-valued image,
An input means for inputting a multi-valued image in a line sequence when performing binarization processing in units of a block of a predetermined size composed of a plurality of pixels;
Binarization threshold value determining means for determining the binarization threshold value in block order;
Binarization means for performing binarization processing in line order using the threshold value determined by the binarization threshold value determination means;
Control means for executing multi-level image input by the input means, determination of a binarization threshold by the binarization threshold determination means, and binarization processing by the binarization means by pipeline processing;
Have
The binarization threshold value determining means calculates a frequency for each luminance in the block for each block of the predetermined size, and calculates a luminance average value and a skew value from the luminance frequency to obtain a binarization threshold value. Further, the control means executes the calculation of the luminance average value and the skew value while synchronizing with the pipeline processing.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP12334196A JP3673598B2 (en) | 1996-05-17 | 1996-05-17 | Image processing method and image processing apparatus |
US08/807,605 US5956421A (en) | 1996-02-28 | 1997-02-27 | Image processing method and apparatus for determining a binarization threshold value used for binarizing a multi-valued image and performing binarization processing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP12334196A JP3673598B2 (en) | 1996-05-17 | 1996-05-17 | Image processing method and image processing apparatus |
Publications (2)
Publication Number | Publication Date |
---|---|
JPH09305754A JPH09305754A (en) | 1997-11-28 |
JP3673598B2 true JP3673598B2 (en) | 2005-07-20 |
Family
ID=14858175
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP12334196A Expired - Fee Related JP3673598B2 (en) | 1996-02-28 | 1996-05-17 | Image processing method and image processing apparatus |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3673598B2 (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7584148B2 (en) | 2001-11-16 | 2009-09-01 | Seiko Epson Corporation | Apparatus and method for processing a check, and a computer-readable recording medium storing a check processing control program |
JP4250483B2 (en) | 2003-08-25 | 2009-04-08 | キヤノン株式会社 | Image processing apparatus, image processing method, program, and storage medium |
FR3002354A1 (en) * | 2013-02-18 | 2014-08-22 | Sagemcom Documents Sas | Method for assigning values of pixels of e.g. binary images, of paper document, involves assigning one value to pixel according to comparison of value of pixel with determined threshold |
FR3002352B1 (en) * | 2013-02-18 | 2018-04-06 | Sagemcom Documents Sas | METHOD FOR ASSIGNING TO PIXELS AN IMAGE OF A FIRST VALUE OR SECOND VALUE |
JP2018029289A (en) | 2016-08-18 | 2018-02-22 | ブラザー工業株式会社 | Image processing apparatus and image processing method |
-
1996
- 1996-05-17 JP JP12334196A patent/JP3673598B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JPH09305754A (en) | 1997-11-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5956421A (en) | Image processing method and apparatus for determining a binarization threshold value used for binarizing a multi-valued image and performing binarization processing | |
CN111160550A (en) | Training method, information processing apparatus, and non-transitory computer-readable storage medium | |
CA2036974C (en) | Pattern recognition data processing device using an associative matching method | |
JP3673598B2 (en) | Image processing method and image processing apparatus | |
JPS5853781B2 (en) | Image scaling device | |
JP2020135549A (en) | Arithmetic processing device, information processing device and arithmetic processing method | |
JP7354736B2 (en) | Information processing device, information processing method, information processing program | |
US20200311545A1 (en) | Information processor, information processing method, and storage medium | |
US7756363B2 (en) | System and method for image processing | |
JP7243498B2 (en) | Arithmetic processing device, control program, and control method | |
US5438682A (en) | Data processing system for rewriting parallel processor output data using a sequential processor | |
CN113468469A (en) | Convolution processing method and device of feature graph executed by computer and electronic equipment | |
JP2002015327A (en) | Image type discrimination device, image processor using the same, and image type discrimination method | |
CN112882835A (en) | Machine node parallel processing method and device, computer equipment and storage medium | |
JPH0698157A (en) | Halftone image forming device | |
JP6757141B2 (en) | Image processing device, its control method, and program | |
US6594396B1 (en) | Adaptive difference computing element and motion estimation apparatus dynamically adapting to input data | |
JP2846173B2 (en) | Image processing device | |
CN116563156A (en) | Image noise reduction method and device based on non-local mean filtering algorithm | |
EP0447751A2 (en) | Size-normalisation system | |
US20050105816A1 (en) | Data processing device | |
JP4074172B2 (en) | Image processing device | |
JP3080937B2 (en) | JBIG encoding method and recording medium recording JBIG program | |
CN117830337A (en) | Image segmentation method, device, equipment and medium based on genetic algorithm | |
JPH05127980A (en) | Picture processor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20040806 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20040817 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20041015 |
|
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: 20050412 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20050425 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |