JPH10145611A - Thresholding method - Google Patents
Thresholding methodInfo
- Publication number
- JPH10145611A JPH10145611A JP8293886A JP29388696A JPH10145611A JP H10145611 A JPH10145611 A JP H10145611A JP 8293886 A JP8293886 A JP 8293886A JP 29388696 A JP29388696 A JP 29388696A JP H10145611 A JPH10145611 A JP H10145611A
- Authority
- JP
- Japan
- Prior art keywords
- output
- outputs
- value
- binarization
- pixel data
- 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.)
- Withdrawn
Links
Landscapes
- Character Input (AREA)
- Facsimile Image Signal Circuits (AREA)
Abstract
Description
【0001】[0001]
【発明の属する技術分野】本発明は多値画像を2値化す
る方法に関するものである。例えば多値画像をOCR処
理に利用する場合の2値化方法に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method for binarizing a multivalued image. For example, it relates to a binarization method when a multi-valued image is used for OCR processing.
【0002】[0002]
【従来の技術】オフィス文書の電子化により、文字認識
(OCR)技術が発達してきた。一方、近年の文書はカ
ラー化が進んでおり、スキャナもマルチレベルの濃度
(輝度)の読み込みが可能なものが主流となってきた。
その際、OCR処理は2値化された画像を対象としてお
り、マルチレベルの画像(以下、多値画像とする)を2
値化する処理が必要となる。2. Description of the Related Art The digitization of office documents has led to the development of character recognition (OCR) techniques. On the other hand, in recent years, colorization of documents has progressed, and scanners capable of reading multi-level densities (luminances) have become mainstream.
At this time, the OCR processing is performed on a binarized image, and a multi-level image (hereinafter, referred to as a multi-valued image) is
Processing to convert to a value is required.
【0003】従来OCRのための二値化処理としては、
マルチレベルの中間をしきい値としてそれ以上は1、そ
れ以下は0とする単純2値化が主流であった。Conventional binarization processing for OCR includes:
Simple binarization has been predominant, with the middle of the multi-level being a threshold value of 1 above and 0 below.
【0004】[0004]
【発明が解決しようとする課題】しかしながら、繰り返
しになるが、近年の文書はカラー化が進んでおり、色文
字が多発するようになってきた。このような文書におい
ては単純2値化(固定しきい値2値化)では文字認識す
るのに良好な画像が得られない。However, as described above, in recent years, the colorization of documents in recent years has progressed, and color characters have been frequently generated. In such a document, simple binarization (fixed threshold binarization) does not provide a good image for character recognition.
【0005】そこで本発明は文字、図形等の認識のため
の前処理に適した2値化方法を提供することを目的とす
る。Accordingly, an object of the present invention is to provide a binarization method suitable for preprocessing for recognition of characters, figures, and the like.
【0006】[0006]
【課題を解決するための手段】上記課題を解決するた
め、本願の2値化方法は、小領域単位で多値画素データ
の上位Mビットのヒストグラムをとり、隣り合うヒスト
グラム値を加算し、該加算結果とあらかじめ決められた
値とを比較し、該比較結果から2値化しきい値を演算
し、該2値化しきい値と前記多値画素データを比較して
2値化結果を出力することを特徴とする。In order to solve the above-mentioned problems, the binarization method of the present application takes a histogram of upper M bits of multi-valued pixel data in small area units, adds adjacent histogram values, Comparing the addition result with a predetermined value, calculating a binarization threshold value from the comparison result, and comparing the binarization threshold value with the multi-valued pixel data to output a binarization result; It is characterized by.
【0007】また、下地レベルを検出し、検出された下
地レベルにより2値化しきい値を演算し、該2値化しき
い値と前記多値画素データを比較して2値化結果を出力
し、下地の輝度が低いときは、前記2値化手段の出力を
反転することを特徴とする。In addition, a background level is detected, a binarization threshold is calculated based on the detected background level, and the binarization threshold is compared with the multi-valued pixel data to output a binarization result. When the luminance of the background is low, the output of the binarizing means is inverted.
【0008】[0008]
(第1の実施例)本発明の実施の例の構成図の一例を図
1に示す。101は2値化回路であり、図示しない入力
回路から入力された多値画素データ(例えば8ビット)
を入力し、多値画素を2値化し、2値データを出力す
る。102は2値メモリであり、2値化回路101によ
り2値化された2値データを格納する。103はCPU
であり、2値メモリ102に格納された2値画像データ
を読み出し、文字認識処理を行い文字認識結果を出力す
る。104はRAMであり、文字認識処理を行う上での
ワークメモリおよび文字認識結果を一時格納するバッフ
ァとなる。105はROMであり、文字認識プログラム
のコードを格納する。(First Embodiment) FIG. 1 shows an example of a configuration diagram of an embodiment of the present invention. Reference numeral 101 denotes a binarization circuit, which is multi-valued pixel data (for example, 8 bits) input from an input circuit (not shown).
And binarizes the multi-valued pixel to output binary data. Reference numeral 102 denotes a binary memory which stores binary data binarized by the binarization circuit 101. 103 is a CPU
And reads out the binary image data stored in the binary memory 102, performs a character recognition process, and outputs a character recognition result. Reference numeral 104 denotes a RAM, which serves as a work memory for performing character recognition processing and a buffer for temporarily storing character recognition results. A ROM 105 stores a code of a character recognition program.
【0009】図1の2値化回路101の構成の一例を図
2に示す。以下の説明の中で多値画素データpixel
〔7..0〕は輝度値であり、真白は255、真黒は0
となる。二値化するとき、文字部を1、下地を0にする
のが目的である。FIG. 2 shows an example of the configuration of the binarization circuit 101 shown in FIG. In the following description, multi-valued pixel data pixel
[7. . 0] is a luminance value, with pure white being 255 and pure black being 0
Becomes The purpose of binarization is to set the character portion to 1 and the background to 0.
【0010】201はデコーダ1であり、入力された多
値画素データにしたがって出力信号を出力する。デコー
ダ1(201)は入力が多値画素データpixel
〔7..0〕の上位3ビットpixel〔7..5〕で
あり、pixel〔7..5〕が0かつVEが0の時、
EN0*が0、EN1*〜EN7*は1、pixel
〔7..5〕が1かつVEが0の時、EN1*が0、E
N0*、EN2*〜EN7*は1、pixel〔7..
5〕が2かつVEが0の時、EN2*が0、EN0*、E
N1*、EN3*〜EN7*は1、pixel〔7..
5〕が3かつVEが0の時、EN3*が0、EN0*〜E
N2*、EN4*〜EN7*は1、pixel〔7..
5〕が4かつVEが0の時、EN4*が0、EN0*〜E
N3*、EN5*〜EN7*は1、pixel〔7..
5〕が5かつVEが0の時、EN5*が0、EN0*〜E
N4*、EN6*、EN7*は1、pixel〔7..
5〕が6かつVEが0の時、EN6*が0、EN0*〜E
N5*、EN7*は1、pixel〔7..5〕が7かつ
VEが0の時、EN7*が0、EN0*〜EN6*は1、
のように出力をデコードする。Reference numeral 201 denotes a decoder 1 which outputs an output signal in accordance with the input multi-valued pixel data. The input of the decoder 1 (201) is multi-valued pixel data pixel
[7. . 0] [3. . 5], and the pixel [7. . 5] is 0 and VE is 0,
EN0 * is 0, EN1 * to EN7 * is 1, pixel
[7. . 5] is 1 and VE is 0, EN1 * is 0, E
N0 * , EN2 * to EN7 * are 1, pixel [7. .
5] is 2 and VE is 0, EN2 * is 0, EN0 * , E
N1 * , EN3 * to EN7 * are 1, pixel [7. .
5] is 3 and VE is 0, EN3 * is 0, EN0 * to E
N2 * , EN4 * to EN7 * are 1, pixel [7. .
5] is 4 and VE is 0, EN4 * is 0, EN0 * to E
N3 * , EN5 * to EN7 * are 1, pixel [7. .
5] is 5 and VE is 0, EN5 * is 0, EN0 * to E
N4 *, EN6 *, EN7 * is 1, pixel [7. .
5] is 6 and VE is 0, EN6 * is 0, EN0 * to E
N5 * and EN7 * are 1, pixel [7. . 5] When is 7 and VE is 0, EN7 * is 0, EN0 * ~EN6 * 1,
Decode the output as follows.
【0011】202から206は12ビットのカウンタ
であり、デコーダ1(201)から出力されたEN信号
に従って、選択された(EN信号が0)カウンタがクロ
ックに従ってインクリメントされる。Reference numerals 202 to 206 denote 12-bit counters, and a selected counter (EN signal is 0) is incremented according to a clock according to an EN signal output from the decoder 1 (201).
【0012】207から210は加算器であり、加算器
207はカウンタ202とカウンタ203の出力を加算
して、加算結果を出力する。加算器208はカウンタ2
03とカウンタ204の出力を加算して、加算結果を出
力する。加算器209はカウンタ204とカウンタ20
5の出力を加算して、加算結果を出力する。加算器21
0はカウンタ205とカウンタ206の出力を加算し
て、加算結果を出力する。Reference numerals 207 to 210 denote adders. The adder 207 adds the outputs of the counter 202 and the counter 203 and outputs an addition result. The adder 208 is a counter 2
03 and the output of the counter 204, and outputs the addition result. The adder 209 includes a counter 204 and a counter 20.
5 are added, and the addition result is output. Adder 21
0 adds the outputs of the counter 205 and the counter 206 and outputs the addition result.
【0013】211はフリップフロップ1であり、CP
U103が計算した画像幅の75%の値W_DATAを
書き込みイネーブル信号W_ENに従って書き込みをす
る。212から215は比較器であり、比較器212は
加算器207とフリップフロップ1(211)に記憶さ
れている画像幅(1ラインの画素数)の75%の値を比
較して、加算器207の出力のほうが大きかったら1、
それ以外は0を出力する。比較器213は加算器208
とフリップフロップ1(211)に記憶されている画像
幅の75%の値を比較して、加算器208の出力のほう
が大きかったら1、それ以外は0を出力する。比較器2
14は加算器209とフリップフロップ1(211)に
記憶されている画像幅の75%の値を比較して、加算器
209の出力のほうが大きかったら1、それ以外は0を
出力する。比較器215は加算器210とフリップフロ
ップ1(211)に記憶されている画像幅の75%の値
を比較して、加算器215の出力のほうが大きかったら
1、それ以外は0を出力する。Reference numeral 211 denotes a flip-flop 1, which is a CP.
The value W_DATA of 75% of the image width calculated by U103 is written according to the write enable signal W_EN. Reference numerals 212 to 215 denote comparators. The comparator 212 compares the adder 207 with a value of 75% of the image width (the number of pixels in one line) stored in the flip-flop 1 (211). If the output of is larger, 1
Otherwise, 0 is output. The comparator 213 is an adder 208
Is compared with the value of 75% of the image width stored in the flip-flop 1 (211). If the output of the adder 208 is larger, 1 is output, otherwise 0 is output. Comparator 2
Numeral 14 compares the adder 209 with a value of 75% of the image width stored in the flip-flop 1 (211), and outputs 1 if the output of the adder 209 is larger, and outputs 0 otherwise. The comparator 215 compares the adder 210 with the value of 75% of the image width stored in the flip-flop 1 (211), and outputs 1 if the output of the adder 215 is larger, and outputs 0 otherwise.
【0014】216はデコーダ2であり、比較器212
から215の出力を入力し、2値化しきい値3ビットを
出力する。画像幅の75%の値を超えるカウンタ出力は
多くても1つしか存在しないのでデコーダ216に入力
される値は0000、1000、0100、0010、
0001のうちのどれかである。入力が1000の時出
力は100、入力が0100の時出力は101、入力が
0010の時出力は110、入力が0001の時出力は
111となる。入力が0000の時は後述するフリップ
フロップ2の書き込みイネーブル信号がイネーブルとな
らないので、いかなる値を出力しても構わない。Reference numeral 216 denotes a decoder 2 and a comparator 212
, And outputs the binary threshold value of 3 bits. Since there is at most one counter output exceeding the value of 75% of the image width, the values input to the decoder 216 are 0000, 1000, 0100, 0010,
0001. When the input is 1000, the output is 100, when the input is 0100, the output is 101, when the input is 0010, the output is 110, and when the input is 0001, the output is 111. When the input is 0000, a write enable signal for the flip-flop 2 described later is not enabled, so that any value may be output.
【0015】217は3ビットのフリップフロップ2で
あり、比較器212から215の出力のどれか一つでも
1で、かつHSYNC信号が0の時、デコーダ2(21
6)の出力をクロックに同期して記憶する。218は比
較器であり、多値画素データの上位4ビットpixel
〔7..4〕とフリップフロップ2(217)の出力を
入力して比較して、pixel〔7..4〕が大きい時
は0を、小さい時は1を出力する。この出力値が二値化
データとなる。Reference numeral 217 denotes a 3-bit flip-flop 2, which is 1 when at least one of the outputs of the comparators 212 to 215 is 1 and the HSYNC signal is 0.
The output of 6) is stored in synchronization with the clock. Reference numeral 218 denotes a comparator, which is an upper 4 bits pixel of multi-valued pixel data.
[7. . 4] and the output of flip-flop 2 (217) are input and compared, and pixel [7. . 4] is 0 when it is large, and 1 when it is small. This output value becomes binary data.
【0016】図2信号CLK、HSYNC、VE*、p
ixel〔7..1〕のタイミング関係を図4に示す。FIG. 2 signals CLK, HSYNC, VE * , p
pixel [7. . FIG. 4 shows the timing relationship of [1].
【0017】以上の概要は、1ライン分の画素データの
上位3ビット分のヒストグラムを取り、隣り合ったヒス
トグラムの合計値が1ラインの全画素数の75%以上あ
る時に、そのヒストグラムが指す輝度は原稿の下地であ
るとして、2値化しきい値BI_THREを決定する。
8ビット画素データは0が黒で255が白の輝度データ
とする。以上の3ビット、75%などの数値は好ましい
一例であり、必ずしもこの数値に限定されない。また、
加算器(207〜210)および比較器(212〜21
5)、フリップフロップ1(211)は最大ビット持つ
必要は必ずしもなく、上位何ビットかを加算して比較す
る形にしてもよい。そうすると、ハード規模を縮小でき
る。上記パーセントを75%以下にしたりビット数を削
減したりすることによって、デコーダ216に入力され
るデータが2つ“1”になったりすることもあるが、そ
の場合はそれも考慮して出力値thre〔6..4〕を
考えればよい。The outline above is to take a histogram of the upper three bits of pixel data for one line, and when the total value of adjacent histograms is 75% or more of the total number of pixels in one line, the luminance indicated by the histogram Is the background of the document, and determines the binarization threshold value BI_THRE.
The 8-bit pixel data is luminance data in which 0 is black and 255 is white. The above numerical values such as 3 bits and 75% are preferable examples, and are not necessarily limited to these numerical values. Also,
Adders (207-210) and comparators (212-21)
5) The flip-flop 1 (211) does not necessarily need to have the maximum bit, and may be configured to add and compare some upper bits. Then, the hardware scale can be reduced. When the percentage is reduced to 75% or less or the number of bits is reduced, two pieces of data input to the decoder 216 may become “1”. In this case, the output value is taken into consideration. thre [6. . 4).
【0018】二値化しきい値決定処理を図3にフローチ
ャートで示す。S301ではヒストグラムバッファhi
stgnd〔8〕を0にリセットする。S302では画
素数カウンタiを0にリセットする。S303では画素
image〔i〕を右に5ビットシフトして(そうする
と上位3ビットのみ残るので)その値のhistgnd
をインクリメントする。S304では画素数カウンタを
インクリメントする。S305では1ライン終了したか
どうかチェックして、終了していたら306に進み、終
了していなかったら303に戻る。以上S303からS
305の処理を繰り返すことによって、画素データ1ラ
イン分の上位3ビットのヒストグラムを取ることができ
る。S306ではヒストグラムの番号を示すkを3にリ
セットしている。ここで、0でなく、3なのは黒よりの
下地を検出しても、その下地上には文字がないことが比
較的多く、また文字であっても白抜き文字の可能性が高
いので、対象外とした。しかしながらこれに限らずkを
0として、白抜き文字処理(2値化の際、反転するな
ど)を行ってもよい。S307では隣り合ったヒストグ
ラムを足し合わせる。(例えば、histgnd〔3〕
+histgnd〔4〕。これは8ビットの画素値で9
6(2進01100000)から159(2進1001
1111)までの間に存在した画素数を示す。)S30
8では前記histaddが全画素数の75%を占めて
いるかどうかチェックして、75%以上だったらS30
9に進み、以下だったらS311に進む。S309では
二値化しきい値BI_THREに(k+1)を左4ビッ
トシフトした数を代入し、処理を終了する。一方、S3
11ではkをインクリメントする。S312でkが7以
下だったら307に戻る。一方、Kが7以上だったら終
了する。このようなしきい値決定回路を持ちBI_TH
REをライン単位で変動させることにより、色紙に印刷
された文字などの下地のある画像も良好な文字認識のた
めの二値化が可能となる。そして、変動させたしきい値
BI_THREを用いて次ラインの二値化を行う。FIG. 3 is a flowchart showing the binarization threshold value determination processing. In S301, the histogram buffer hi
stgnd [8] is reset to 0. In S302, the pixel number counter i is reset to 0. In step S303, the pixel image [i] is shifted right by 5 bits (in this case, only the upper 3 bits remain), and the value “histgnd”
Is incremented. In S304, the pixel number counter is incremented. In S305, it is checked whether or not one line has been completed. If it has been completed, the process proceeds to 306, and if not completed, the process returns to 303. S303 to S
By repeating the process of 305, a histogram of the upper 3 bits for one line of pixel data can be obtained. In S306, k indicating the number of the histogram is reset to 3. Here, the reason why the number 3 is not 0 is that even if a background is detected that is lower than black, there are relatively few characters on the background, and even if it is a character, it is highly possible that the character is a white character. Outside. However, the present invention is not limited to this, and k may be set to 0, and white character processing (eg, inversion in binarization) may be performed. In S307, adjacent histograms are added. (For example, histgnd [3]
+ Histgnd [4]. This is an 8-bit pixel value of 9
6 (binary 01100000) to 159 (binary 1001)
1111) indicates the number of pixels that existed up to this point. ) S30
In step 8, it is checked whether or not the histadd occupies 75% of the total number of pixels.
The process proceeds to step S9, and proceeds to step S311 if the following occurs. In step S309, the number obtained by shifting (k + 1) by 4 bits to the left is substituted for the binarization threshold value BI_THRE, and the process ends. On the other hand, S3
At 11, k is incremented. If k is 7 or less in S312, the process returns to 307. On the other hand, if K is 7 or more, the process ends. BI_TH having such a threshold value determination circuit
By varying the RE on a line-by-line basis, an image with a base such as a character printed on colored paper can be binarized for good character recognition. Then, the next line is binarized using the changed threshold value BI_THRE.
【0019】(第2の実施例)第1の実施例では文字部
が下地部より輝度が低いという前提で二値化処理を行っ
たが、本実施例では文字部が下地部より輝度が高い場合
も考える。第2の実施例の構成例を図5に示す。一般的
に「文字は読者に読ませる=目立っているもの」である
ので、下地部の輝度が低い場合、文字は逆に輝度が高い
ケースが多い。したがって、本例は検出された下地部の
輝度が低い場合、二値化結果を反転して、文字認識可能
な二値データを得るためのものである。(Second Embodiment) In the first embodiment, the binarization process is performed on the assumption that the character portion has lower luminance than the background portion. However, in the present embodiment, the character portion has higher luminance than the background portion. Think about it. FIG. 5 shows a configuration example of the second embodiment. In general, "letters are read by a reader = conspicuous", so in the case where the luminance of the background is low, the luminance of the characters is conversely high in many cases. Therefore, in this example, when the detected luminance of the base portion is low, the binarization result is inverted to obtain binary data that can be recognized as characters.
【0020】図5の説明をする。第1の実施例と同様に
以下の説明の中出多値画素データpixel〔7..
0〕は輝度値であり、真白は255、真黒は0となる。
二値化するとき、文字部を1、下地を0にするのが目的
である。Referring to FIG. Similarly to the first embodiment, the following multi-valued pixel data pixel [7. .
0] is a luminance value, which is 255 for pure white and 0 for pure black.
The purpose of binarization is to set the character portion to 1 and the background to 0.
【0021】501はデコーダ1であり、入力された多
値画素データにしたがって出力信号を出力する。デコー
ダ1(501)は入力が多値画素データ上位3ビットp
ixel〔7..5〕であり、pixel〔7..5〕
が0かつVEが0の時、EN0*が0、EN1*〜EN7
*は1、pixel〔7..5〕が1かつVEが0の
時、EN1*が0、EN0*、EN2*〜EN7*は1、p
ixel〔7..5〕が2かつVEが0の時、EN2*
が0、EN0*、EN1*、EN3*〜EN7*は1、pi
xel〔7..5〕が3かつVEが0の時、EN3*が
0、EN0*〜EN2*、EN4*〜EN7*は1、pix
el〔7..5〕が4かつVEが0の時、EN4*が
0、EN0*〜EN3*、EN5*〜EN7*は1、pix
el〔7..5〕が5かつVEが0の時、EN5*が
0、EN0*〜EN4*、EN6*、EN7*は1、pix
el〔7..5〕が6かつVEが0の時、EN6*が
0、EN0*〜EN5*、EN7*は1、pixel
〔7..5〕が7かつVEが0の時、EN7*が0、E
N0*〜EN6*は1、のように出力をデコードする。Reference numeral 501 denotes a decoder 1 which outputs an output signal in accordance with the input multi-valued pixel data. The input of the decoder 1 (501) is the upper 3 bits p of the multivalued pixel data.
pixel [7. . 5], and the pixel [7. . 5]
Is 0 and VE is 0, EN0 * is 0, EN1 * to EN7
* Is 1, pixel [7. . 5] is 1 and VE is 0, EN1 * is 0, EN0 * , EN2 * to EN7 * are 1, p
pixel [7. . 5] is 2 and VE is 0, EN2 *
Is 0, EN0 * , EN1 * , EN3 * to EN7 * are 1, pi
xel [7. . 5] is 3 and VE is 0, EN3 * is 0, EN0 * to EN2 * , EN4 * to EN7 * are 1, pix
el [7. . 5] is 4 and VE is 0, EN4 * is 0, EN0 * to EN3 * , EN5 * to EN7 * are 1, pix
el [7. . 5] is 5 and VE is 0, EN5 * is 0, EN0 * to EN4 * , EN6 * , EN7 * are 1, pix
el [7. . 5] is 6 and VE is 0, EN6 * is 0, EN0 * to EN5 * , EN7 * is 1, pixel
[7. . 5] is 7 and VE is 0, EN7 * is 0, E
N0 * to EN6 * decode the output like 1.
【0022】502から509は12ビットのカウンタ
であり、デコーダ1(501)から出力されたEN信号
に従って、選択された(EN信号が0)カウンタがクロ
ックに従ってインクリメントされる。Numerals 502 to 509 denote 12-bit counters, and the selected counter (EN signal is 0) is incremented according to the clock in accordance with the EN signal output from the decoder 1 (501).
【0023】510から516は加算器であり、加算器
510はカウンタ502とカウンタ503の出力を加算
して、加算結果を出力する。加算器511はカウンタ5
03とカウンタ504の出力を加算して、加算結果を出
力する。加算器512はカウンタ504とカウンタ50
5の出力を加算して、加算結果を出力する。加算器51
3はカウンタ505とカウンタ506の出力を加算し
て、加算結果を出力する。加算器514はカウンタ50
6とカウンタ507の出力を加算して、加算結果を出力
する。加算器515はカウンタ507とカウンタ508
の出力を加算して、加算結果を出力する。加算器516
はカウンタ508とカウンタ509の出力を加算して、
加算結果を出力する。517はフリップフロップ1であ
り、CPUが計算した画像幅の75%の値W_DATA
を書き込みイネーブル信号W_ENに従って書き込みを
する。Reference numerals 510 to 516 denote adders. The adder 510 adds the outputs of the counter 502 and the counter 503 and outputs an addition result. The adder 511 is a counter 5
03 and the output of the counter 504, and outputs the addition result. The adder 512 includes a counter 504 and a counter 50.
5 are added, and the addition result is output. Adder 51
3 adds the outputs of the counter 505 and the counter 506 and outputs the addition result. The adder 514 is a counter 50
6 and the output of the counter 507, and outputs the addition result. The adder 515 includes a counter 507 and a counter 508.
And outputs the addition result. Adder 516
Adds the outputs of counter 508 and counter 509,
Output the addition result. Reference numeral 517 denotes a flip-flop 1, which is a value W_DATA of 75% of the image width calculated by the CPU.
Is written according to the write enable signal W_EN.
【0024】518から524は比較器であり、比較器
518は加算器510とフリップフロップ1(517)
に記憶されている画像幅の75%の値を比較して、加算
器510の出力のほうが大きかったら1、それ以外は0
を出力する。比較器519は加算器511とフリップフ
ロップ1(517)に記憶されている画像幅の75%の
値を比較して、加算器511の出力のほうが大きかった
ら1、それ以外は0を出力する。比較器520は加算器
512とフリップフロップ1(517)に記憶されてい
る画像幅の75%の値を比較して、加算器512の出力
のほうが大きかったら1、それ以外は0を出力する。比
較器521は加算器513とフリップフロップ1(51
7)に記憶されている画像幅の75%の値を比較して、
加算器513の出力のほうが大きかったら1、それ以外
は0を出力する。比較器522は加算器514とフリッ
プフロップ1(517)に記憶されている画像幅の75
%の値を比較して、加算器514の出力のほうが大きか
ったら1、それ以外は0を出力する。比較器523は加
算器515とフリップフロップ1(517)に記憶され
ている画像幅の75%の値を比較して、加算器515の
出力のほうが大きかったら1、それ以外は0を出力す
る。比較器524は加算器516とフリップフロップ1
(517)に記憶されている画像幅の75%の値を比較
して、加算器516の出力のほうが大きかったら1、そ
れ以外は0を出力する。Reference numerals 518 to 524 denote comparators. The comparator 518 includes an adder 510 and a flip-flop 1 (517).
Are compared, the value of 75% of the image width is compared. If the output of the adder 510 is larger, 1 is set;
Is output. The comparator 519 compares the adder 511 with a value of 75% of the image width stored in the flip-flop 1 (517), and outputs 1 if the output of the adder 511 is larger and 0 otherwise. Comparator 520 compares the value of 75% of the image width stored in flip-flop 1 (517) with adder 512, and outputs 1 if the output of adder 512 is larger, and outputs 0 otherwise. The comparator 521 includes the adder 513 and the flip-flop 1 (51
By comparing the value of 75% of the image width stored in 7),
If the output of the adder 513 is larger, 1 is output, otherwise 0 is output. The comparator 522 has the image width of 75 stored in the adder 514 and the flip-flop 1 (517).
The values of% are compared, and 1 is output if the output of the adder 514 is larger, and 0 is output otherwise. The comparator 523 compares the value of 75% of the image width stored in the flip-flop 1 (517) with the adder 515, and outputs 1 if the output of the adder 515 is larger and 0 otherwise. Comparator 524 includes adder 516 and flip-flop 1
The value of 75% of the image width stored in (517) is compared, and 1 is output if the output of the adder 516 is larger, and 0 is output otherwise.
【0025】525はデコーダ2であり、比較器518
から524の出力を入力し、2値化しきい値4ビットと
セレクタデータ1ビットを出力する。画像幅の75%の
値を超えるカウンタ出力は多くても1つしか存在しない
のでデコーダ525に入力される値は0000000、
1000000、0100000、0010000、0
001000、0000100、0000010、00
00001のうちのどれかである。入力が100000
0の時出力は0110、入力が0100000の時出力
は1000と1、、入力が0010000の時出力は1
010と1、入力が0001000の時出力は0100
と0、入力が0000100の時出力は0101と0、
入力が0000010の時出力は0110と0、入力が
0000001の時出力は0111と0となる。入力が
0000000の時は後述するフリップフロップ2の書
き込みイネーブル信号がイネーブルとならないので、い
かなる値を出力しても構わない。Reference numeral 525 denotes a decoder 2, which is a comparator 518.
To 524, and outputs 4 bits of binarization threshold value and 1 bit of selector data. Since there is at most one counter output exceeding the value of 75% of the image width, the value input to the decoder 525 is 000000,
1,000,000, 0100000, 001000000, 0
001000, 0000100, 0000010, 00
00001. 100000 input
When 0, the output is 0110, when the input is 0100000, the output is 1000 and 1, and when the input is 0000000, the output is 1
010 and 1, output is 0100 when input is 0001000
When the input is 0000100, the output is 0101 and 0,
When the input is 0000010, the output is 0110 and 0, and when the input is 0000001, the output is 0111 and 0. When the input is 0000000, a write enable signal for the flip-flop 2 described later is not enabled, and therefore any value may be output.
【0026】526は1ビットのフリップフロップ2で
あり、比較器518から524の出力のどれか一つでも
1で、かつHSYNC信号が0の時、デコーダ2(52
5)の1ビットの出力をクロックに同期して記憶する。
527は4ビットのフリップフロップ3であり、比較器
518から524の出力のどれか一つでも1で、かつH
SYNC信号が0の時、デコーダ2(525)の4ビッ
トの出力をクロックに同期して記憶する。Reference numeral 526 denotes a 1-bit flip-flop 2, which outputs 1 when at least one of the outputs of the comparators 518 to 524 is 1 and the HSYNC signal is 0.
5) The 1-bit output is stored in synchronization with the clock.
Numeral 527 denotes a 4-bit flip-flop 3, in which any one of the outputs of the comparators 518 to 524 is 1 and H
When the SYNC signal is 0, the 4-bit output of the decoder 2 (525) is stored in synchronization with the clock.
【0027】528は比較器であり、多値画素データの
上位4ビットpixel〔7..4〕とフリップフロッ
プ3(527)の出力を入力して比較して、出力Aには
pixel〔7..4〕が大きい時は0を、小さい時は
1を、出力Bにはpixel〔7..4〕が大きい時は
1を、小さい時は0を出力する。Reference numeral 528 denotes a comparator, which is an upper 4 bits pixel [7. . 4] and the output of the flip-flop 3 (527) are input and compared. . 4] is large, 0 is small, 1 is small, and pixel [7. . 4] is 1 when it is large, and 0 when it is small.
【0028】529はセレクタであり、フリップフロッ
プ2(526)の1ビットの出力信号SELを制御信号
としてSELが0の時は比較器528の出力Aを、SE
Lが1の時は比較器528の出力Bを選択して出力す
る。このセレクタ529の出力が二値データBI_TH
REとなる。Reference numeral 529 denotes a selector, which uses the 1-bit output signal SEL of the flip-flop 2 (526) as a control signal and outputs the output A of the comparator 528 when SEL is 0,
When L is 1, the output B of the comparator 528 is selected and output. The output of the selector 529 is binary data BI_TH
RE.
【0029】図7はデコーダ2(525)への入力値
と、二値化しきい値BI_THRE(8ビットデータに
換算、画素データの輝度値と比較しやすいように)、セ
レクタ529の出力値BI_DATA、制御信号SEL
の関係を示す表である。二値化しきい値BI_THRE
の値およびセレクタの制御信号SELの境界線(この場
合0010000と0001000の間)は一例であ
り、この限りでない。FIG. 7 shows an input value to the decoder 2 (525), a binarization threshold value BI_THRE (converted to 8-bit data so as to be easily compared with the luminance value of pixel data), an output value BI_DATA of the selector 529, Control signal SEL
It is a table | surface which shows the relationship of. Binary threshold BI_THRE
And the boundary line between the control signal SEL of the selector (in this case, between 001000000 and 0001000) are an example, and are not limited thereto.
【0030】以上の概要は、1ライン分の画素データの
上位3ビット分のヒストグラムを取り、隣り合ったヒス
トグラムの合計値が全画素数の75%以上ある時に、そ
のヒストグラムが指す輝度は原稿の下地であるとして、
2値化しきい値BI_THREを決定する。8ビット画
素データは0が黒で255が白の輝度データとする。The above outline is that a histogram of the upper three bits of pixel data for one line is taken, and when the total value of adjacent histograms is 75% or more of the total number of pixels, the luminance indicated by the histogram indicates the luminance of the document. As the groundwork,
The binarization threshold value BI_THRE is determined. The 8-bit pixel data is luminance data in which 0 is black and 255 is white.
【0031】以上の3ビット、75%などの数値は好ま
しい一例であり、必ずしもこの数値に限定されない。ま
た、加算器(510〜516)および比較器(518〜
524)、フリップフロップ1(517)は最大ビット
持つ必要は必ずしもなく、上位何ビットかを加算して比
較する形にしてもよい。そうすると、ハード規模を縮小
できる。The above numerical values such as 3 bits and 75% are preferable examples, and are not necessarily limited to these numerical values. Further, an adder (510 to 516) and a comparator (518 to 518)
524), the flip-flop 1 (517) does not necessarily need to have the maximum bit, and may be configured to add and compare some upper bits. Then, the hardware scale can be reduced.
【0032】上記パーセントを75%以下にしたりビッ
ト数を削減したりすることによって、デコーダ525に
入力されるデータが2つ“1”になったりすることもあ
るが、その場合はそれも考慮して出力値thre
〔7..4〕を考えればよい。When the percentage is reduced to 75% or less or the number of bits is reduced, two pieces of data input to the decoder 525 may become "1". Output value thre
[7. . 4).
【0033】(第3の実施例)カウンタ(202から2
06および502から509)を複数の3ステートフリ
ップフロップと一つのカウントアップカウンタに分ける
ことにより、カウンタ部の回路規模を縮小することが可
能となる。しかし、その場合、カウント結果が接続され
ているので時系列に加算器を動作させるなり、工夫しな
ければならない。(Third Embodiment) A counter (202 to 2
06 and 502 to 509) into a plurality of three-state flip-flops and one count-up counter, it is possible to reduce the circuit scale of the counter section. However, in this case, since the count result is connected, the adder must be operated in chronological order, and the device must be devised.
【0034】(第4の実施例)第1および第2の実施例
では小領域(1ライン)内のヒストグラムより決定した
二値化しきい値を次の小領域内の多値データを二値化す
るために使用したが、その限りでなく、多値データを一
時格納するバッファを持ち小領域内で2値化しきい値を
決定し、その決められた二値化しきい値により同小領域
内の多値データを二値化することで、より文字認識のた
めに良好な二値化結果を得ることができる。さらに小領
域を2次元的にもつことにより、さらに文字認識のため
に良好な二値化結果を得ることができる。小領域の例を
図6に示す。(Fourth Embodiment) In the first and second embodiments, a binarization threshold determined from a histogram in a small area (one line) is used to convert multivalued data in the next small area into a binary value. However, the present invention is not limited to this, and a buffer for temporarily storing multi-valued data is provided, a binarization threshold value is determined in a small area, and the binarization threshold value in the same small area is determined by the determined binary threshold value. By binarizing the multi-valued data, it is possible to obtain a good binarization result for character recognition. Further, by having the small areas two-dimensionally, a good binarization result can be obtained for further character recognition. FIG. 6 shows an example of the small area.
【0035】以上説明したように、上述の実施例によれ
ば、小領域単位で多値画素データの上位Mビットのヒス
トグラムをとる手段と隣り合ったヒストグラム値を加算
する複数の加算手段と、前記加算手段の出力とあらかじ
め決められた値とを比較する複数の比較手段と、前記比
較手段の結果から2値化しきい値を演算する演算手段
と、前記2値化しきい値と前記多値画素データを比較し
て2値化結果を出力する2値化手段を持つ、或いは下地
レベルを検出する検出手段と、前記検出手段により検出
された下地レベルにより2値化しきい値を演算する演算
手段と、前記2値化しきい値と前記多値画素データを比
較して2値化結果を出力する2値化手段と、下地の輝度
が低いときは、前記2値化手段の出力を反転する反転手
段を持つことにより、簡単なアルゴリズムで、多値画像
からOCRするのに適した2値化画像が得られる。As described above, according to the above-described embodiment, a means for obtaining a histogram of the upper M bits of multi-valued pixel data in small area units, a plurality of adding means for adding adjacent histogram values, A plurality of comparing means for comparing the output of the adding means with a predetermined value; calculating means for calculating a binary threshold from the result of the comparing means; the binary threshold and the multi-valued pixel data A binarizing unit that outputs a binarization result by comparing the two, or a detecting unit that detects a ground level, and a calculating unit that calculates a binarization threshold based on the ground level detected by the detecting unit; A binarizing unit that compares the binarized threshold value with the multi-valued pixel data and outputs a binarized result; and an inverting unit that inverts the output of the binarizing unit when the luminance of the background is low. By having A simple algorithm, the binary image suitable for OCR from the multi-level image is obtained.
【0036】また、反転手段を持つことにより、従来文
字認識不能であった輝度の低い下地上の輝度の高い文字
も認識可能な2値化画像が得られる。Further, by providing the reversing means, it is possible to obtain a binary image capable of recognizing a high-luminance character on a low-luminance background, which has not been conventionally recognizable.
【0037】[0037]
【発明の効果】以上の様に本発明によれば、文字・図形
等の認識のための前処理に適した2値化を行うことがで
きる。As described above, according to the present invention, binarization suitable for preprocessing for recognition of characters, figures, and the like can be performed.
【図1】本発明を文字認識に応用した一例を説明するハ
ードブロック図である。FIG. 1 is a hardware block diagram illustrating an example in which the present invention is applied to character recognition.
【図2】図1の2値化回路101の構成の一例である。FIG. 2 is an example of a configuration of a binarization circuit 101 in FIG. 1;
【図3】図1の2値化処理101の一例を説明するフロ
ーチャートである。FIG. 3 is a flowchart illustrating an example of a binarization process 101 in FIG. 1;
【図4】図2の各信号のタイミングを説明する図であ
る。FIG. 4 is a diagram illustrating the timing of each signal in FIG. 2;
【図5】第2の実施例の2値化回路の構成の一例であ
る。FIG. 5 is an example of a configuration of a binarization circuit according to a second embodiment;
【図6】小領域の例である。FIG. 6 is an example of a small area.
【図7】図5の回路によって処理される各信号の対応表
である。FIG. 7 is a correspondence table of each signal processed by the circuit of FIG. 5;
Claims (2)
ットのヒストグラムをとり、 隣り合うヒストグラム値を加算し、 該加算結果とあらかじめ決められた値とを比較し、 該比較結果から2値化しきい値を演算し、 該2値化しきい値と前記多値画素データを比較して2値
化結果を出力することを特徴とする2値化方法。1. A histogram of high-order M bits of multi-valued pixel data is obtained in small area units, adjacent histogram values are added, the addition result is compared with a predetermined value, and a binary value is obtained from the comparison result. A binarization threshold value, and comparing the binarization threshold value with the multi-valued pixel data to output a binarization result.
化結果を出力し、下地の輝度が低いときは、前記2値化
手段の出力を反転することを特徴とする2値化方法。2. Detecting a background level, calculating a binary threshold based on the detected background level, comparing the binary threshold with the multi-valued pixel data, and outputting a binary result. A binarization method comprising inverting the output of the binarization means when the luminance of the background is low.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP8293886A JPH10145611A (en) | 1996-11-06 | 1996-11-06 | Thresholding method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP8293886A JPH10145611A (en) | 1996-11-06 | 1996-11-06 | Thresholding method |
Publications (1)
Publication Number | Publication Date |
---|---|
JPH10145611A true JPH10145611A (en) | 1998-05-29 |
Family
ID=17800432
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP8293886A Withdrawn JPH10145611A (en) | 1996-11-06 | 1996-11-06 | Thresholding method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPH10145611A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2019054362A (en) * | 2017-09-14 | 2019-04-04 | セイコーエプソン株式会社 | Image processing device, binary image production method, and image processing program |
-
1996
- 1996-11-06 JP JP8293886A patent/JPH10145611A/en not_active Withdrawn
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2019054362A (en) * | 2017-09-14 | 2019-04-04 | セイコーエプソン株式会社 | Image processing device, binary image production method, and image processing program |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP2967014B2 (en) | Image processing device | |
JPS62214481A (en) | Image quality judgment device | |
EP0685959B1 (en) | Image processing apparatus for identifying character, photo and dot images in the image area | |
JP3200931B2 (en) | Halftone dot area discrimination circuit | |
EP0501450A2 (en) | Apparatus for distinguishing between different areas of an image | |
US20030174904A1 (en) | Method and system for correcting direction or orientation of document image | |
JPH01295570A (en) | Picture processing device | |
JPH10145611A (en) | Thresholding method | |
KR970004630A (en) | Apparatus and method for binarizing image in image processing apparatus | |
JP2874592B2 (en) | Image processing device for distinguishing text / photo / dot area | |
JP3466655B2 (en) | Image processing device | |
JP2000011088A (en) | Method for exracting feature information of read image, image processor and mail address reader | |
KR100242298B1 (en) | Image data binarization method of text document | |
US8165412B2 (en) | Method for decoding binary image at high speed | |
JP3358133B2 (en) | Image processing device | |
JP2000261666A (en) | Image processing unit | |
JP3355656B2 (en) | Apparatus and method for extracting edges from digital image signal | |
JP3303990B2 (en) | Image signal processing device | |
JPH01243668A (en) | Picture processing device | |
JPH05284358A (en) | Picture processing unit | |
JP2936766B2 (en) | Image input device | |
JPH0722329B2 (en) | Image processing method and image processing circuit | |
JPH02228177A (en) | Binarizing circuit for image data | |
JPS62108380A (en) | Binarization processor | |
JPS6140683A (en) | Contour tracking device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A300 | Application deemed to be withdrawn because no request for examination was validly filed |
Free format text: JAPANESE INTERMEDIATE CODE: A300 Effective date: 20040106 |