JPS63145579A - Method for extracting hole - Google Patents

Method for extracting hole

Info

Publication number
JPS63145579A
JPS63145579A JP61295025A JP29502586A JPS63145579A JP S63145579 A JPS63145579 A JP S63145579A JP 61295025 A JP61295025 A JP 61295025A JP 29502586 A JP29502586 A JP 29502586A JP S63145579 A JPS63145579 A JP S63145579A
Authority
JP
Japan
Prior art keywords
raster
state
coordinate
pixel
white pixel
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.)
Pending
Application number
JP61295025A
Other languages
Japanese (ja)
Inventor
Keiji Kojima
啓嗣 小島
Hajime Sato
元 佐藤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ricoh Co Ltd
Original Assignee
Ricoh Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ricoh Co Ltd filed Critical Ricoh Co Ltd
Publication of JPS63145579A publication Critical patent/JPS63145579A/en
Pending legal-status Critical Current

Links

Landscapes

  • Character Discrimination (AREA)

Abstract

PURPOSE:To efficiently extract a hole of a picture with a simple method, in a short processing time by obtaining X-coordinate of black and white picture elements in one line of a raster scan. CONSTITUTION:When X-coordinate of the black picture element at the left end in applying raster scan to a binary image is Bs, the X-coordinate of the black picture element at the right end is Be, the X-coordinate of the white picture element between he coordinates Bs and Be in the transition from the black picture element to the white picture element is Ws, and the X-coordinate of the white picture element in moving from the white picture element to the black picture element is We, when the state is transited from a 1st state where no white picture element exists between the coordinates Bs and Be in one line of the raster scan into a 2nd state where a white picture element exists between the coordinates Bs and Be through the consecutive raster scanning, a flag 1 is set. In a picture shown in figure, the flag 1 is set by a raster 3 and the coordinates Ws, We and the coordinates Bs, Be at one preceding raster 2 are checked. When the conditions of Bs2<Ws3 and We3<Be2 are satisfied, it is considered that there exists a hole.

Description

【発明の詳細な説明】 (技術分野) 本発明は、0CR(光学的文字認識装置)における画像
のホール抽出方法に関するものである。
DETAILED DESCRIPTION OF THE INVENTION (Technical Field) The present invention relates to a method for extracting holes in an image in an OCR (optical character recognition device).

(従来技術) ホール抽出の従来法として、画像にラベル付けを行ない
、黒画素領域に包囲された白画素領域が黒画素領域の外
側と連結されているが否かを最終的にチェックし、連結
されていないことが確認されたときそれをホールとして
抽出する方法がある。
(Prior art) As a conventional method for hole extraction, an image is labeled, and a final check is made to determine whether or not a white pixel area surrounded by a black pixel area is connected to the outside of the black pixel area. There is a way to extract it as a hole when it is confirmed that it is not.

しかしこの方法は処理が複雑であり、かつ多くの処理時
間がかかるという問題があった。
However, this method has the problem that processing is complicated and takes a lot of processing time.

(発明の目的) 本発明は、簡単な処理により画像のホールを抽出する方
法を提供するものである。
(Object of the Invention) The present invention provides a method for extracting holes in an image through simple processing.

(発明の構成) 文字等の2値画像をラスタースキャンしたときの左端の
黒画素のX座標をBs、右端の黒画素のX座標をBe、
BsとBeの間で黒画素から白画素に移るときの白画素
のX座標をWs、白画素から黒画素に移るときの白画素
のX座標をWeとし、ラスタースキャンの1ライン中の
BsとBeの間に白画素がない第1の状態から白画素が
ある第2の状態に変化したときのラスターにおけるBs
、 Be。
(Structure of the Invention) When a binary image such as a character is raster scanned, the X coordinate of the leftmost black pixel is Bs, the X coordinate of the rightmost black pixel is Be,
The X coordinate of the white pixel when moving from a black pixel to a white pixel between Bs and Be is Ws, the X coordinate of the white pixel when moving from a white pixel to a black pixel is We, and Bs in one line of raster scan. Bs in the raster when changing from the first state where there are no white pixels between Be to the second state where there are white pixels
, Be.

Ws、We、又は第2の状態からさらに第1の状態に変
化したときのラスターにおけるBs、 Be。
Ws, We, or Bs, Be in the raster when changing from the second state to the first state.

Ws、Weを用いてホールを抽出するものである。Holes are extracted using Ws and We.

(実施例) 以下、図面に基づいて実施例を詳細に説明する。(Example) Hereinafter, embodiments will be described in detail based on the drawings.

第1図ないし第4図は、それぞれ本発明の実施例の動作
フローを示したものであり、また第8図は。
1 to 4 each show the operational flow of an embodiment of the present invention, and FIG. 8 shows the operation flow of the embodiment of the present invention.

本発明のハードの構成を示したものである。This figure shows the hardware configuration of the present invention.

犬1班上 まず、第5図(a)は、2値画像を示している。Dog class 1 First, FIG. 5(a) shows a binary image.

この画像をラスタースキャンしたときの左端の黒画素の
X座標をBs、右端の黒画素のX座標をBe、BsとB
eの間で黒画素から白画素に移るときの白画素のX座標
をWs、白画素から黒画素に移るときの白画素のX座標
をWeとすれば、各ラスター■、■、■、・・・のスキ
ャンにおいてそれぞれB s HB e +W s 、
 W eに対応する画素が、第5図(b)に示したよう
に存在することになる。そこで、ラスタースキャンの1
ライン中のBsとBeの間に白画素がない第1の状態か
ら、さらにラスタースキャンを続けてBsとBeの間に
白画素がある第2の状態に変化したとき、フラグ1をた
てる。第5図の画像においては、ラスター■でフラグ1
となり、このときのWs、Weと、1つ前のラスター■
におけるBs。
When this image is raster scanned, the X coordinate of the leftmost black pixel is Bs, the X coordinate of the rightmost black pixel is Be, and Bs and B
Let Ws be the X coordinate of a white pixel when moving from a black pixel to a white pixel between e, and We be the X coordinate of a white pixel when moving from a white pixel to a black pixel, then each raster ■, ■, ■, ・In the scan of . . . , B s HB e +W s , respectively.
A pixel corresponding to W e exists as shown in FIG. 5(b). Therefore, one of the raster scans
When the first state in which there are no white pixels between Bs and Be in the line changes to the second state in which there are white pixels between Bs and Be by further raster scanning, a flag 1 is set. In the image in Figure 5, flag 1 is shown in raster ■.
At this time, Ws, We, and the previous raster ■
Bs in

Beをチェックする。そして。Check Be. and.

Bs■< W s■、 We■<Be■  ・(1)の
条件を満足するとき、そこにホールがあると考えられる
。さらにラスタースキャンを続けてラスタースキャンの
1ライン中のBsとBeの間に白画素がない第1の状態
に変化したら、それをホールとして抽出する。ラスター
■、■の部分においても同様のチェックを行ない、ホー
ルを抽出する。
Bs■<Ws■, We■<Be■ When the condition (1) is satisfied, it is considered that there is a hole there. When the raster scan continues and the state changes to a first state in which there are no white pixels between Bs and Be in one line of the raster scan, this is extracted as a hole. A similar check is performed on the raster parts ■ and ■, and holes are extracted.

以上のホール抽出法の手順を示したのが第1図の動作フ
ローである。ここでWsk、 Wekとkを付したもの
は、状態1から状態2に変化したときのラスターkにお
けるWs、Wsを意味し、B 5k−1゜Beh−0の
に−1は、ラスターにの1つ前のラスターにおけるBs
、Beを表わしている。
The operation flow of FIG. 1 shows the procedure of the hole extraction method described above. Here, Wsk, Wek and k mean Ws and Ws in raster k when changing from state 1 to state 2, and -1 in B5k-1°Beh-0 means the change in raster. Bs in previous raster
, represents Be.

叉直銖主 上記実施例1における条件(1)を満足しても、第6図
に示す画像の場合はホールではない。そこで、次の条件
を用いる。
Even if condition (1) in Example 1 is satisfied, the image shown in FIG. 6 is not a hole. Therefore, the following conditions are used.

1IBe■−Bs■1−IBe■−Bs■II<TH−
(2)二こで、THは予め定められたしきい値である。
1IBe■-Bs■1-IBe■-Bs■II<TH-
(2) where TH is a predetermined threshold;

要するに、実施例1と同様な手順でラスタースキャンを
行ないながら状態の変化を捉え、ラスター■におけるB
s、Be間の距離と、その1つ前のラスター■における
Bs、Be間の距離とを比較し、その同距離の間に、第
6図のような大きな差があるときは、ホールでないと考
えられる。従ってその差が小さい場合、即ち予め定めら
れたしきい値THより小さい場合に、ホールとして抽出
する。
In short, by performing a raster scan using the same procedure as in Example 1, we captured changes in the state, and
Compare the distance between s and Be with the distance between Bs and Be in the previous raster ■, and if there is a large difference between the same distances as shown in Figure 6, it must be a hole. Conceivable. Therefore, if the difference is small, that is, if it is smaller than a predetermined threshold TH, it is extracted as a hole.

実施例2におけるホール抽出法の手順を示したのが第2
図の動作フローである。
The second example shows the procedure of the hole extraction method in Example 2.
It is an operation flow of the figure.

夫1匠1 実施例1,2の方法では、第7図のような画像の場合、
「6」の上の部分がホールとして抽出される。そこで本
実施例では、さらに確度の高いホール抽出法を述べる。
Husband 1 Artisan 1 In the method of Examples 1 and 2, in the case of an image like that shown in Fig. 7,
The part above "6" is extracted as a hole. Therefore, in this embodiment, a more accurate hole extraction method will be described.

即ち、ラスタースキャンの1ライン中のBsとBeの間
に白画素がない第1の状態からラスタースキャンを行な
って白画素がある第2の状態に変化し、さらに第2の状
態からラスタースキャンを行なって第1の状態に変化し
たとき、そのラスター(第7図ではラスター■)におけ
るBs、Beと、1つ前のラスター(同ラスター■)に
おけるWs、Weとを比較する。そして、次の条件を満
足するときホールとして抽出する。
That is, from a first state in which there are no white pixels between Bs and Be in one line of raster scanning, a raster scan is performed to change to a second state in which there are white pixels, and then raster scanning is performed from the second state. When the state changes to the first state, Bs and Be in that raster (raster ■ in FIG. 7) are compared with Ws and We in the previous raster (raster ■ in FIG. 7). Then, when the following conditions are satisfied, it is extracted as a hole.

Bs■<Ws■、 We■(Be■  −(3)第7図
(b)において、フラグ1となるラスター■においてホ
ールと考えられても、ラスター■、■におけるチェック
によりホールでないと判定される。実施例3におけるホ
ール抽出法の手順を示したのが第3図の動作フローであ
る。ここでB sn。
Bs■<Ws■, We■(Be■ - (3) In Figure 7 (b), even if raster ■, which is flag 1, is considered to be a hole, it is determined that it is not a hole by checking raster ■ and ■. The operation flow of FIG. 3 shows the procedure of the hole extraction method in Example 3. Here, B sn.

Be1lとnを付したものは、状態2から状態1に変化
したときのラスターnにおけるBs、Beを意味し、W
 8n−i 、 Well−□のn−1は、ラスターn
の1つ前のラスターにおけるWs、Weを表わしている
Those with Be1l and n mean Bs and Be in raster n when changing from state 2 to state 1, and W
8n-i, n-1 of Well-□ is raster n
represents Ws and We in the previous raster.

大適孤土 第7図の場合、別のチェック処理を行なってもよい。即
ち、第1の状態からラスタースキャンを行なって第2の
状態に変化し、さらにラスタースキャンを行なって第1
の状態に変化したときのラスター及びその1つ前のラス
ターにおけるBs。
In the case of the large-scale isolated area shown in FIG. 7, another checking process may be performed. That is, a raster scan is performed from the first state to change to the second state, and then a raster scan is performed to change to the first state.
Bs in the raster and the previous raster when the state changes to .

Beから、 11Be■−Bs■l−1Be■−Bs■II<TH−
(4)の条件を満足したときホールとして抽出する。こ
の場合も実施例2と同様に、ラスター■におけるBs、
Be間の距離と、その1つ前のラスター■におけるBs
、Be間の距離とに大きな差がないことが条件となる。
From Be, 11Be■-Bs■l-1Be■-Bs■II<TH-
When the condition (4) is satisfied, it is extracted as a hole. In this case, as in Example 2, Bs in raster ■,
The distance between Be and Bs in the previous raster ■
The condition is that there is no large difference between the distances between Be and Be.

第4図は、本実施例のホール抽出法の動作フローを示し
たものである。
FIG. 4 shows the operational flow of the hole extraction method of this embodiment.

(発明の効果) 以上説明したように、本発明によれば、簡単な方法で、
しかも短い処理時間で効率よく、画像のホールを抽出す
ることができる。
(Effects of the Invention) As explained above, according to the present invention, by a simple method,
Furthermore, holes in images can be extracted efficiently with a short processing time.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図ないし第4図は、それぞれ本発明の実施例の動作
フローを示す図、第5図ないし第7図は、それぞれ本発
明の実施例の具体例を示す図、第8図は、ハードの構成
図である。 IIBe=−BSkl−1日eh−I−ask−dl<
TH第5図 第6図 第7図
1 to 4 are diagrams each showing an operational flow of an embodiment of the present invention, FIGS. 5 to 7 are diagrams each showing a specific example of an embodiment of the present invention, and FIG. 8 is a diagram showing a hardware FIG. IIBe=-BSkl-1 day eh-I-ask-dl<
THFigure 5Figure 6Figure 7

Claims (2)

【特許請求の範囲】[Claims] (1)文字等の2値画像のラスタースキャンにおいて、
左端の黒画素のX座標をBs、右端の黒画素のX座標を
Be、BsとBeの間で黒画素から白画素に移るときの
白画素のX座標をWs、白画素から黒画素に移るときの
白画素のX座標をWeとし、ラスタースキャンの1ライ
ン中のBsとBeの間に白画素がない第1の状態から白
画素がある第2の状態に変化したとき、次の条件の少な
くとも1つを満足する場合、ホールとして抽出すること
を特徴とするホールの抽出方法。 条件1; 第1の状態からラスターkで第2の状態に変化したとき
、 Bs_k_−_1<Ws_k、We_k<Be_k_−
_1を満足する場合。 条件2; 第1の状態からラスターkで第2の状態に変化したとき
、 ||Be_k−Bs_k|−|Be_k_−_1−Bs
_k_−_1||<THを満足する場合。 ただし、kを付したものはラスターkにおけるBs、B
e、Ws、We、k−1を付したものはラスターにの1
つ前のラスターにおけるBs、Be、THは予め定めら
れたしきい値。
(1) In raster scanning of binary images such as characters,
Bs is the X coordinate of the leftmost black pixel, Be is the X coordinate of the rightmost black pixel, Ws is the X coordinate of the white pixel when moving from a black pixel to a white pixel between Bs and Be, and is the X coordinate of the white pixel when moving from a white pixel to a black pixel. Let We be the X coordinate of the white pixel at the time, and when the first state in which there is no white pixel between Bs and Be in one line of raster scan changes to the second state in which there is a white pixel, the following condition is satisfied. A hole extraction method characterized in that when at least one condition is satisfied, the hole is extracted as a hole. Condition 1: When changing from the first state to the second state at raster k, Bs_k_-_1<Ws_k, We_k<Be_k_-
If _1 is satisfied. Condition 2: When changing from the first state to the second state at raster k, ||Be_k−Bs_k|−|Be_k_−_1−Bs
_k_−_1||<TH is satisfied. However, those with k are Bs and B in raster k.
Those with e, Ws, We, and k-1 are 1 in the raster.
Bs, Be, and TH in the previous raster are predetermined thresholds.
(2)文字等の2値画像のラスタースキャンにおいて、
左端の黒画素のX座標をBs、右端の黒画素のX座標を
Be、BsとBeの間で黒画素から白画素に移るときの
白画素のX座標をWs、白画素から黒画素に移るときの
白画素のX座標をWeとし、ラスタースキャンの1ライ
ン中のBsとBeの間に白画素がない第1の状態から白
画素がある第2の状態に変化し、さらに第2の状態から
第1の状態に変化したとき、次の条件の少なくとも1つ
を満足する場合、ホールとして抽出することを特徴とす
るホールの抽出方法。 条件1; 第2の状態からラスターnで第1の状態に変化したとき
、 Bs_n<Ws_n_−_1、We_n_−_1<Be
_nを満足する場合。 条件2; 第2の状態からラスターnで第1の状態に変化したとき
、 ||Be_n_−_1−Bs_n_−_1|−|Be_
n−Bs_n||<THを満足する場合。 ただし、nを付したものはラスターnにおけるBs、B
e、n−1を付したものはラスターnの1つ前のラスタ
ーにおけるBs、Be、Ws、We、THは予め定めら
れたしきい値。
(2) In raster scanning of binary images such as characters,
Bs is the X coordinate of the leftmost black pixel, Be is the X coordinate of the rightmost black pixel, Ws is the X coordinate of the white pixel when moving from a black pixel to a white pixel between Bs and Be, and is the X coordinate of the white pixel when moving from a white pixel to a black pixel. When the X coordinate of the white pixel is We, the first state in which there is no white pixel between Bs and Be in one line of the raster scan changes to the second state in which there is a white pixel, and then the second state 1. A hole extraction method, characterized in that when at least one of the following conditions is satisfied when the state changes from a state to a first state, the hole is extracted as a hole. Condition 1: When changing from the second state to the first state at raster n, Bs_n<Ws_n_-_1, We_n_-_1<Be
If __n is satisfied. Condition 2: When changing from the second state to the first state at raster n, ||Be_n_−_1−Bs_n_−_1|−|Be_
When n-Bs_n||<TH is satisfied. However, those with n are Bs and B in raster n.
Those with e and n-1 are predetermined threshold values for Bs, Be, Ws, We, and TH in the raster immediately before raster n.
JP61295025A 1986-07-18 1986-12-12 Method for extracting hole Pending JPS63145579A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP61-168136 1986-07-18
JP16813686 1986-07-18

Publications (1)

Publication Number Publication Date
JPS63145579A true JPS63145579A (en) 1988-06-17

Family

ID=15862500

Family Applications (1)

Application Number Title Priority Date Filing Date
JP61295025A Pending JPS63145579A (en) 1986-07-18 1986-12-12 Method for extracting hole

Country Status (1)

Country Link
JP (1) JPS63145579A (en)

Similar Documents

Publication Publication Date Title
US6526161B1 (en) System and method for biometrics-based facial feature extraction
US5075895A (en) Method and apparatus for recognizing table area formed in binary image of document
JP2000207489A (en) Character extracting method and device and record medium
JPS63145579A (en) Method for extracting hole
AU2018229526B2 (en) Recursive contour merging based detection of text area in an image
JPH0718812B2 (en) Foreign object detection method
JPS63145580A (en) Method for extracting hole
JP3162414B2 (en) Ruled line recognition method and table processing method
JP2956151B2 (en) Image processing method and apparatus
JP3585143B2 (en) Character string extraction method and device
JPH02156383A (en) Method for pattern matching
JP2001043312A (en) Document picture processor
JPH02166583A (en) Character recognizing device
JP3100619B2 (en) Photo region extraction device
JP2674475B2 (en) Character reader
JPS60101676A (en) Picture processing method
JPH1011589A (en) Picture processing method
JPH04372085A (en) Character reading method
JPS62208181A (en) Graphic extracting system
JPH05128305A (en) Area dividing method
JPH0816777A (en) Method and device for processing image
JPS62247473A (en) Picture processor
JP2000134609A (en) Image processing method and method for searching number plate while using the same
JPH09147049A (en) Number plate position detector
JPH02231690A (en) Linear picture recognizing method