JPH0277887A - Contour extraction system for binary graphic form with direction code - Google Patents

Contour extraction system for binary graphic form with direction code

Info

Publication number
JPH0277887A
JPH0277887A JP63228429A JP22842988A JPH0277887A JP H0277887 A JPH0277887 A JP H0277887A JP 63228429 A JP63228429 A JP 63228429A JP 22842988 A JP22842988 A JP 22842988A JP H0277887 A JPH0277887 A JP H0277887A
Authority
JP
Japan
Prior art keywords
contour
direction code
point
binary
black
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
JP63228429A
Other languages
Japanese (ja)
Inventor
Tatsuo Kasahara
笠原 龍夫
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
Priority to JP63228429A priority Critical patent/JPH0277887A/en
Publication of JPH0277887A publication Critical patent/JPH0277887A/en
Pending legal-status Critical Current

Links

Landscapes

  • Image Analysis (AREA)

Abstract

PURPOSE:To extract all contours in a graphic figure whatever shape the binary graphic form is in by checking the marking state of a pair of white and black picture elements and extracting even a black picture element which is retrieved once as the extraction start point of a next contour. CONSTITUTION:When the extraction start point (SX,YX) of a contour Ei is determined for contour extraction, the direction codes of respective black picture element points are extracted in order while a mask is setting at respective black picture element points constituting contour points. Consequently, the direction code point sequence (shown in figure) of connecting contours Ei is extracted automatically and eventually. Thus, the extraction of the direction code point sequence of the contours Ei is finished, the contour lines are decided from a decision making table with a tail direction code iD=7 and the extracting operation for contours E0 and Ei of the binary graphic pattern is finished.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、2値図形の輪郭を8連結の方向コードにより
抽出するための2値図形の輪郭抽出方式〔従来の技術〕 2値図形の形状を抽出したり、その重心や周囲長などの
特徴量を算出する場合、扱いの容易さから2値図形を輪
郭情報に変換して処理を行うことがある。このような2
値図形の輪郭の記述の方法に、第11図に示すような上
下左右・斜めの8方向からなるいわゆる8連結の方向コ
ードiDを用い、この方向コードの点列により記述する
方法がある。例えば、第12図に示す形状の2値図形P
の場合、その−周する輪郭は方向コード点列(6゜5、
4.6.0,7,6.0.2.2,2,2,2.4)と
して表される。
[Detailed Description of the Invention] [Industrial Application Field] The present invention relates to a binary figure outline extraction method for extracting the outline of a binary figure using an 8-connected direction code [Prior art] When extracting a shape or calculating its feature values such as its center of gravity and perimeter, a binary figure is sometimes converted into contour information for ease of handling. 2 like this
One method of describing the contour of a value figure is to use a so-called 8-connected direction code iD consisting of eight directions (up, down, left, right, and diagonal) as shown in FIG. 11, and to describe it by a sequence of points of this direction code. For example, a binary figure P having the shape shown in FIG.
In the case of , the circumferential contour is the direction code point sequence (6°5,
4.6.0,7,6.0.2.2,2,2,2.4).

このように2値図形の輪郭を8連結の方向コードとして
抽出するには、第13図に示す3×3画素ザイズの9個
のます目からなるマスクMを用意し、このマスクMを第
14図に示すように2値図形上に設定し、該中心まず目
の周囲の8個のます目M。−M7に位置する各画素の白
黒を左廻り(反時計方向)に検索することにより次の輪
郭点を与える黒画素(第14図の場合は真下の黒画素)
を検知し、この黒画素点への移動方向を与える方向コー
ドiD(第14図の場合は1D=6)求めて、該黒画素
点へマスクMを移動し、同様の処理を繰り返すことによ
り第12図のごとく一連の方向コード点列からなる輪郭
情報を抽出していた。
In order to extract the outline of a binary figure as an 8-connected direction code in this way, prepare a mask M consisting of 9 squares of 3 x 3 pixel size as shown in FIG. As shown in the figure, it is set on a binary figure, and eight squares M around the eyes are set at the center. - The black pixel that provides the next contour point by searching the black and white of each pixel located at M7 counterclockwise (in the case of Figure 14, the black pixel directly below)
is detected, the direction code iD (in the case of FIG. 14, 1D=6) giving the direction of movement to this black pixel point is obtained, the mask M is moved to the black pixel point, and the same process is repeated. As shown in Figure 12, contour information consisting of a series of direction code points was extracted.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

2値図形の輪郭を抽出するに際しては図形の鋭角点や幅
1画素の線、さらには図形の内形線や外形線などを余す
ところなく忠実がっ高速に抽出する必要がある。しかし
、従来の方法は処理速度の点で未だ満足できるものでは
なく、また−度輪郭点として抽出した黒画素点は別の輪
郭の抽出開始点として使用することができず、図形形状
によっては全ての輪郭を抽出することが困難となる場合
があった。さらに、抽出した輪郭が2値図形の内形線で
あるのか、あるいは外形線の輪郭であるのかを知ること
が容易でな(、また8連結の方向コードを用いて2値図
形の輪郭を抽出した場合には、例えば第12図に示す2
値図形中の凹状の直角箇所でその方向コードが(6,5
,4,・・・0,7,6.・・・)のごとく8連結状態
となり、直角箇所を忠実に抽出できないという欠点があ
った。
When extracting the outline of a binary figure, it is necessary to extract all the sharp points of the figure, lines with a width of 1 pixel, as well as the internal and external lines of the figure, faithfully and at high speed. However, the conventional method is still not satisfactory in terms of processing speed, and black pixel points extracted as contour points cannot be used as starting points for extraction of another contour, and depending on the figure shape, all In some cases, it was difficult to extract the contour of the image. Furthermore, it is difficult to know whether the extracted contour is the inner line or the outer line of the binary figure (also, the contour of the binary figure is extracted using an 8-connected direction code). In this case, for example, 2 shown in FIG.
At a concave right angle point in the value shape, its direction code is (6, 5
,4,...0,7,6. ...), resulting in an 8-connected state, which had the disadvantage that right angle points could not be extracted faithfully.

本発明は上記事情に鑑み発明されたもので、2値図形の
すべての輪郭を高速かつ正確に抽出することのできる輪
郭抽出方式を提供することを目的とする。
The present invention was invented in view of the above circumstances, and an object of the present invention is to provide a contour extraction method that can extract all contours of a binary figure quickly and accurately.

〔課題を解決するだめの手段〕[Failure to solve the problem]

上記目的を達成するために、請求項(1)記載の発明は
、マスクの中心まず目周囲の8個の画素の白黒状態を左
廻りに順次検索する際に、検索の終了した白画素点と黒
画素点をマーキングし、隣接する白画素と黒画素のベア
を単位として該マーキング情報を参照しながら次の輪郭
の抽出開始点を求めるようにした。
In order to achieve the above object, the invention described in claim (1) first searches for the black and white state of eight pixels around the eye in a counterclockwise direction from the center of the mask, and A black pixel point is marked, and the next contour extraction start point is determined by referring to the marking information in units of adjacent white and black pixels.

また、請求項(2)記載の発明は、1つ前の方向コード
に対する次の輪郭点を与える黒画素点の最適検索開始方
向を定めた対照テーブルを用意し、該対照テーブルを参
照することにより1つ前の方向コードから次の輪郭点を
与える黒画素点の最適検索開始方向を求め、該最適検索
開始方向位置の画素を基点として画素の白黒状態を左回
りに順次検索するようにした。
Furthermore, the invention described in claim (2) provides a comparison table that determines the optimum search start direction for a black pixel point that provides the next contour point for the previous direction code, and by referring to the comparison table. The optimal search start direction of a black pixel point that gives the next contour point is determined from the previous direction code, and the black and white state of the pixel is sequentially searched counterclockwise from the pixel at the position of the optimal search start direction.

また、請求項(3)記載の発明は、輪郭の最終方向コー
ドから当該輪郭が内形線あるいは外形線のいづれである
かを判定する判定テーブルを用意し、該判定テーブルを
参照することにより輪郭の最終方向コードから当該輪郭
が内形線であるかあるいは外形線であるかを判定するよ
うにした。
Further, the invention described in claim (3) provides a determination table for determining whether the contour is an internal line or an external line from the final direction code of the contour, and by referring to the determination table, the contour is Whether the contour is an internal line or an external line is determined from the final direction code.

また、請求項(4)記載の発明は、8連結の方向コ−ド
を4連結の方向コードに変換する変換テーブルを用意し
、該変換テーブルを参照することにより8連結の方向コ
ードを4連結の方向コードに変換するようにしたもので
ある。
Further, the invention described in claim (4) provides a conversion table for converting an 8-connection direction code into a 4-connection direction code, and by referring to the conversion table, the 8-connection direction code is converted into a 4-connection direction code. The direction code is converted to the following direction code.

〔作 用〕[For production]

請求項(1)記載の発明の場合、隣接する白黒画素をペ
アとしてそのマーキング状態を参照しながら次の輪郭の
抽出開始点の黒画素を検出する。したがって、このペア
を組む白黒画素のマーキング状態、特に白画素のマーキ
ング状態を見ることによって、−度輪郭点として検索さ
れた黒画素点であっても再び次の輪郭の抽出開始点とし
てピックアップすることができる。
In the case of the invention described in claim (1), the black pixel at the extraction start point of the next contour is detected while referring to the marking state of adjacent black and white pixels as a pair. Therefore, by looking at the marking state of the black and white pixels forming this pair, especially the marking state of the white pixel, even a black pixel point that was searched as a -degree contour point can be picked up again as a starting point for extraction of the next contour. Can be done.

請求項(2)の発明の場合、対照テーブルを参照して得
られた最適検索開始方向位置の画素を基点として次の輪
郭点を与える黒画素点を順次検索する。
In the case of the invention according to claim (2), a black pixel point that provides the next contour point is sequentially searched using the pixel at the optimum search start direction position obtained by referring to the comparison table as a base point.

したがって、次の輪郭を与える黒画素点の検索が早くな
る。
Therefore, the search for a black pixel point that gives the next contour becomes faster.

請求項(3)記載の発明の場合、判定テーブルを参照し
て輪郭の最終方向コードから当該輪郭が2値図形の内形
線であるかまたは外形線であるかを判定する。したがっ
て、輪郭の抽出と同時に当該輪郭が2値図形の内形線で
あるか、あるいは外形線であるかを自動的に知ることが
できる。
In the case of the invention described in claim (3), it is determined whether the contour is an inner line or an outer line of a binary figure based on the final direction code of the contour with reference to the determination table. Therefore, at the same time as the contour is extracted, it is possible to automatically know whether the contour is an internal line or an external line of a binary figure.

請求項(4)記載の発明の場合、変換テーブルを参照し
て8連結の方向コードを4連結の方向コードに変換する
ことができる。したがって、方向コードの連結の性格(
8連結/4連結)を指示して2値図形の輪郭情報を収集
でき、輪郭を忠実に抽出することが可能となる。
In the case of the invention described in claim (4), an 8-connection direction code can be converted into a 4-connection direction code by referring to a conversion table. Therefore, the nature of the direction code concatenation (
8-connection/4-connection) can be used to collect contour information of a binary figure, making it possible to extract the contour faithfully.

〔実施例〕〔Example〕

以下、本発明の実施例につき図面を参照して説明する。 Embodiments of the present invention will be described below with reference to the drawings.

第2図は本発明方式を適用した輪郭抽出装置の1実施例
を示すブロック図、第1図はその動作のフローチャート
である。
FIG. 2 is a block diagram showing one embodiment of a contour extraction device to which the method of the present invention is applied, and FIG. 1 is a flowchart of its operation.

第2図中、符号1は任意の形状からなる2値図形Pをド
ツト・イメージの画像データとして取り込むスキャナー
、2はスキャナー1から取り込んだ2値図形の画像デー
タを記憶するRAMからなる図形メモリ、3は方向コー
ドや後述する各種の参照テーブルを格納したROMから
なるテーブルメモリ、5は輪郭抽出された2値図形の方
向コード点列を格納するRAMからなる輪郭点列メモリ
、6は装置の動作を制御するCPUなどからなる制御部
である。
In FIG. 2, reference numeral 1 denotes a scanner that captures a binary figure P having an arbitrary shape as image data of a dot image; 2 a figure memory consisting of a RAM that stores the image data of the binary figure captured from the scanner 1; 3 is a table memory consisting of a ROM that stores direction codes and various reference tables to be described later; 5 is a contour point string memory consisting of a RAM that stores a direction code point string of a binary figure whose contours have been extracted; and 6 is an operation of the device. This is a control unit consisting of a CPU and the like.

上記テーブルメモリ3には、第3図に示す1つ前の方向
コードiDに対する次の輪郭点を与える黒画素点の最適
検索開始方向を定めた対照テーブルと、第4図に示す輪
郭の最終方向コードiDから当該輪郭が内形線あるいは
外形線のいづれであるかを判定する判定テーブルと、第
5図に示す8連結の方向コードiDを4連結の方向コー
ドF4(iD)に変換する変換テーブルと、さらには第
11図の8連結の方向コードiDなどが予め格納されて
いる。
The table memory 3 includes a comparison table that determines the optimal search start direction for a black pixel point that provides the next contour point for the previous direction code iD shown in FIG. 3, and a final direction of the contour shown in FIG. A determination table that determines whether the contour is an internal line or an external line based on the code iD, and a conversion table that converts the 8-connected direction code iD shown in FIG. 5 into a 4-connected direction code F4 (iD). Furthermore, the 8-connection direction code iD shown in FIG. 11 is stored in advance.

進んで、第1図のフローチャートを参照し、第6図に示
す2値図形Pの輪郭E。とE、とを方向コードとして抽
出する場合を例に採ってその動作を説明する。
Proceeding, with reference to the flowchart of FIG. 1, the outline E of the binary figure P shown in FIG. The operation will be explained by taking as an example the case where and E are extracted as direction codes.

なお、以下の説明においては、検索が終了していない白
画素を「口」、検索が終了してマーキングを施された白
画素を「・」で示し、また、検索が終了していない黒画
素を「■」、検索が終了してマーキングを施された黒画
素を「謹」で示すものする。。但し、図面では、隣同士
の黒画素の区別がつかなくなることを防ぐために、検索
が終了していない黒画素については上記「■」に代えて
左右斜めの線でクロスハツチングして示した。
In the following explanation, white pixels for which the search has not been completed are indicated by "mouth", white pixels for which the search has been completed and marked are indicated by "・", and black pixels for which the search has not been completed are indicated by ".". A black pixel that has been marked after the search is indicated by a "■" mark, and a marked black pixel after the search is completed is indicated by a "Congratulations" mark. . However, in the drawings, in order to prevent adjacent black pixels from becoming indistinguishable, black pixels for which the search has not been completed are indicated by cross-hatching with diagonal lines on the left and right instead of the above-mentioned "■".

図形メモリ2内に記憶されている2値図形をラスクスキ
ャンし、スキャンラインと最初にぶつかる白黒画素ペア
「口■」、「四箇」あるいは「・■」のいずれかを探す
。そして、該スキャンラインと最初にぶつかる白黒画素
ペアの黒画素点をこれから抽出する輪郭の抽出開始点(
sx 、yx)として決定する。第6図の場合、スキャ
ンラインと最初にぶつかる白黒画素ペアは左外側面最上
部に位置する白黒画素ペア「口■」であるから、この白
黒画素ベアの黒画素点を輪郭E。の抽出開始点(SX、
YX)として決定する(ステップ[1][2])。
A binary figure stored in the figure memory 2 is scanned to find one of the black and white pixel pairs ``mouth ■'', ``four places'', or ``•■'' that first collides with the scan line. Then, the outline extraction starting point (
sx, yx). In the case of FIG. 6, the black and white pixel pair that first collides with the scan line is the black and white pixel pair "mouth ■" located at the top of the left outer surface, so the black pixel point of this black and white pixel bare is contour E. extraction starting point (SX,
YX) (steps [1] [2]).

上記のようにして輪郭E。の抽出開始点(SX。Contour E as described above. extraction starting point (SX.

YX)が決定されると、検索開始方向コードFNが初期
値たるFN=5Nに設定されるとともに、この抽出開始
点(SX 、YX)を与える黒画素点をマーキングし、
検索終了を示す「厘」に変える(ステップ[3])。
When YX) is determined, the search start direction code FN is set to the initial value FN=5N, and the black pixel point that gives this extraction start point (SX, YX) is marked,
Change it to "厘" indicating the end of the search (step [3]).

次いで、第7図(a)に示すように、上記抽出開始点を
与える黒画素点に3×3画素サイズのマスクM(第11
図)の中心まず目を一致させて設定し、検索開始方向F
N=5、すなわちマスクMの方向コード1D=5に対応
するまず目M、の位置を基点として、中心ます目周囲の
8個のます目で覆われた各画素の白黒状態を左廻り(反
時計方向)に順次検索する(ステップ[5]  [6]
)。このとき、検索を終了した白画素点は検索終了を示
すマーキングを施し、「口」から「・」に変える。
Next, as shown in FIG. 7(a), a mask M (11th
First, match the eyes and set the search start direction F.
Starting from the position of the eye M, which corresponds to N=5, that is, the direction code 1D=5 of the mask M, the black and white state of each pixel covered by the eight squares around the center square is rotated counterclockwise (reversely). (clockwise) (steps [5] [6]
). At this time, the white pixel point for which the search has been completed is marked to indicate the end of the search, changing from "mouth" to ".".

第7図(a)の場合、最初の黒画素はます目M6の位置
で検出される。この黒画素が検出されると、該検出黒画
素点が抽出開始点(sx 、yx)と−致していないこ
とを確認した後(ステップ「8J)、該黒画素点を次の
輪郭点を与える画素位置として決定し、マスクMの中心
まず目を基点としてみた当該黒画素点の方向コード1D
=6を輪郭E。の最初の方向コードとして輪郭点列メモ
リ5に記憶する(ステップ[91)。そして、第3図の
対照テーブルから上記方向コードi D−6のときの次
の黒画素点の最適検索開始方向FN=3を求めるととも
に、該検索された黒画素点をマーキングして「籠」に変
える(ステップ[101[11] )。
In the case of FIG. 7(a), the first black pixel is detected at the position of square M6. When this black pixel is detected, after confirming that the detected black pixel point does not match the extraction start point (sx, yx) (step "8J"), the black pixel point is assigned to the next contour point. The direction code 1D of the black pixel point is determined as the pixel position, and the center of the mask M is viewed from the eye as the reference point.
=6 is contour E. is stored in the contour point sequence memory 5 as the first direction code (step [91). Then, from the comparison table in FIG. 3, the optimum search start direction FN=3 for the next black pixel point when the direction code iD-6 is determined, and the searched black pixel point is marked and placed in a "cage". (step [101[11]).

ついで、第7図(b)に示すように、マスクMを上記検
出された方向コード1D=6の黒画素点の位置に移動せ
しめ、上記対照テーブルから得られた最適検索開始方向
FN=3、すなわちマスクMの方向コード1D=3に対
応するます目M3の位置を基点として上記したと同様に
左回りに次の黒画素点を検索する。
Next, as shown in FIG. 7(b), the mask M is moved to the position of the black pixel point with the detected direction code 1D=6, and the optimum search start direction FN=3, obtained from the comparison table, is set. That is, using the position of the square M3 corresponding to the direction code 1D=3 of the mask M as a base point, the next black pixel point is searched counterclockwise in the same manner as described above.

上記処理を輪郭を構成する各黒画素点について次々と実
行していくことにより、最終的に第6図中に示すひと続
きの一周する輪郭E。についての方向コード点列(6,
6,5,6,6,6,6,2,1,0,0,0,0,0
,0゜0.2.2,2.2,2,2.2,4,4,4,
4,4,4.4)が自動的に抽出される(ステップ[1
2]  [13] )。
By performing the above processing one after another for each black pixel point composing the contour, the final contour E shown in FIG. 6 is formed. The direction code point sequence for (6,
6,5,6,6,6,6,2,1,0,0,0,0,0
,0゜0.2.2,2.2,2,2.2,4,4,4,
4, 4, 4.4) are automatically extracted (step [1
2] [13]).

そして、輪郭E0の方向コード点列の抽出が終了すると
、その最終方向コード1D=4により第4図の判定テー
ブルからこの輪郭E0が2値図形の外形線を与える輪郭
線であることが判定される(ステップ[14])。
When the extraction of the direction code point sequence of the contour E0 is completed, the final direction code 1D=4 determines from the determination table in FIG. (Step [14]).

すなわち、二次元の2値図形の場合、抽出された輪郭は
抽出開始点から出発して再び抽出開始点に戻るひと続き
の一周する点列によって記述されるが、本発明のように
8連結の方向コードによって輪郭を表現した場合、2値
図形の性質から抽出開始点に戻る最終の方向コードは1
D=2 、3 。
That is, in the case of a two-dimensional binary figure, the extracted contour is described by a series of points starting from the extraction starting point and returning to the extraction starting point again. When expressing a contour using a direction code, the final direction code returning to the extraction starting point is 1 due to the nature of binary figures.
D=2,3.

4.7の4つの方向しかあり得す、しかも1D=2.3
.4のときは当該輪郭は図形の外形線であり、また1D
=7のときは当該輪郭は図形の内形線を示すことが一義
的に決まってしまう。したがって、この最終の方向コー
ドiDとこれに対する内外影線の別を第4図に示す判定
テーブルとして予め用意しておくことにより、輪郭の抽
出終了と同時に、当該輪郭が内形線であるがあるいは外
形線であるかを自動的に判定することができるものであ
る。
There are only 4 possible directions of 4.7, and 1D=2.3
.. 4, the contour is the outer line of the figure, and is 1D
When =7, the contour is uniquely determined to represent the internal line of the figure. Therefore, by preparing in advance the final direction code iD and the distinction between internal and external shadow lines as shown in FIG. It is possible to automatically determine whether it is an outline line.

上記のようにして外形線を示す輪郭E。の抽出が終了す
ると、内形線を構成する輪郭E、の抽出に移る。
Contour E showing the external line as described above. When the extraction of E is completed, the process moves on to extracting the contour E that constitutes the inner shape line.

この場合も、前述の場合と同様に図形メモリ2内の2値
図形をラスタスキャンし、スキャンラインと最初にぶつ
かる白黒画素ベア10■」、「口筒」あるいは「・■」
のいずれかを探す。この場合、2値図形Pの内部空間の
右側最上部に位置する白黒画素ベア「ロー」が選択され
、該ペアの黒画素点が輪郭E、の抽出開始点(SX、Y
X)として設定される。なお、このとき上記抽出終了し
た輪郭E。の輪郭線上に位置する白黒画素ベアも次々に
ラスタスキャンラインとぶつかるが、これらの白黒画素
ベアはいずれもその白黒画素の両者が上記輪郭E。の抽
出時にマーキングされ、「・箇」の組み合わせとなって
いる。したがって、これらの白黒画素ペアが輪郭E8の
抽出開始点として選択されることはない。
In this case, as in the case described above, the binary figure in the figure memory 2 is raster-scanned, and the black and white pixel bear 10 that first collides with the scan line is
Find one. In this case, the black and white pixel bear "low" located at the top right side of the internal space of the binary figure P is selected, and the black pixel point of this pair is the extraction start point (SX, Y
X). Note that at this time, the above-mentioned contour E has been extracted. The black and white pixel bears located on the contour line also collide with the raster scan line one after another, but both of the black and white pixels of these black and white pixel bears fall on the contour line E. It is marked at the time of extraction, and is a combination of "-". Therefore, these black and white pixel pairs are never selected as the starting point for extraction of the contour E8.

上記のようにして輪郭E、の抽出開始点(SX。As described above, the extraction start point (SX) of the contour E.

YX)が決定されると、以後は上述した輪郭E。Once YX) is determined, the contour E described above is determined.

の抽出の場合と同様にマスクMを輪郭点を構成する各黒
画素点に設定しなから各黒画素点の方向コードを順次抽
出していく。これにより、最終的にひと続きの一周する
輪郭E、についての方向コード点列(6,6,6,6,
5,4,4,4,3,2,2,2,l、 0.0,0.
7)が自動的に抽出される。なお、この内形線を与える
輪郭E、の回転方向は、外形線を与える輪郭E。
As in the case of extraction, a mask M is set at each black pixel point constituting the contour point, and the direction code of each black pixel point is sequentially extracted. As a result, the direction code point sequence (6, 6, 6, 6,
5,4,4,4,3,2,2,2,l, 0.0,0.
7) is automatically extracted. Note that the rotation direction of the contour E that provides the inner line is the contour E that provides the outer line.

とは逆回りとなる。It goes in the opposite direction.

そして、輪郭E、の方向コード点列の抽出が終了すると
、その最終方向コード1D=7により第4図の判定テー
ブルからこの輪郭E、が2値図形の内形線を与える輪郭
線であることが判定され(ステップ[14]L第6図に
示す2値図形Pの輪郭E。、Eiの抽出動作がすべて終
了する。
When the extraction of the direction code point sequence of the contour E is completed, the final direction code 1D=7 indicates that the contour E is a contour line that provides the inner line of the binary figure from the determination table in FIG. is determined (step [14] L). The outline E of the binary figure P shown in FIG. 6 is determined. Then, all extraction operations of Ei are completed.

第8図に輪郭抽出の他の例を示す。この例は、同図(a
)に示されるように、2値図形が独立した2つの図形部
分「口」と「I」によって構成されている場合の例であ
る。輪郭抽出の処理は同図う)。
FIG. 8 shows another example of contour extraction. This example is shown in the same figure (a
), this is an example in which a binary figure is composed of two independent figure parts "mouth" and "I". The contour extraction process is shown in the same figure).

(C) 、 (d)の順に行われ、輪郭E。、−(6,
6,6,0,0,0゜0.0,2,2.2,4,4,4
,4.4)、輪郭E。2= (6,6,6,2,2゜2
)、輪郭Eニー(6,5,4,4,3,2,1,0,0
,7)となる。
Contour E is performed in the order of (C) and (d). , -(6,
6,6,0,0,0゜0.0,2,2.2,4,4,4
,4.4),Contour E. 2 = (6, 6, 6, 2, 2゜2
), contour E knee (6, 5, 4, 4, 3, 2, 1, 0, 0
,7).

ところで、上記した8連結の方向コードiD(第11図
)を用いて2値図形の輪郭抽出を行った場合、直角に折
れて凹となっている輪郭箇所のところでは方向コードが
直角に折れ曲がって進まずに斜めの方向コードとして抽
出されてしまい、いわゆる8連結と呼ばれる状態になっ
てしまう。
By the way, when extracting the outline of a binary figure using the above-mentioned 8-connected direction code iD (Fig. 11), the direction code is bent at right angles at the contour parts where it is bent at right angles and becomes concave. Instead of progressing, it is extracted as a diagonal direction code, resulting in a condition called 8-concatenation.

例えば、上記第6図で抽出した輪郭E、の場合にはEi
 −(6,6,6,6,5,4,4,4,3,2,2,
21,0,0,0゜7)のようにアンダーラインを引い
た部分で8連結となり、凹状の直角箇所が忠実に抽出さ
れない。
For example, in the case of the contour E extracted in Fig. 6 above, Ei
-(6, 6, 6, 6, 5, 4, 4, 4, 3, 2, 2,
The underlined portions (21, 0, 0, 0°7) result in 8 connections, and the concave right angle portions cannot be extracted faithfully.

そこで、本発明ではこれを防ぐために、第5図に示すよ
うに8連結の方向コードを4連結の方向コードに変換す
るための変換テーブルを用意した。
Therefore, in the present invention, in order to prevent this, a conversion table for converting an 8-connection direction code into a 4-connection direction code is prepared as shown in FIG.

この変換テーブルに基づいて第1図中のステップ[9コ
および[12]のタイミング位置で必要に応じて8連結
の方向コードを4連結の方向コードF4(iD)に変換
すれば、凹状の直角箇所でいわゆる8連結状態が発生す
ることを防止できる。
Based on this conversion table, if the 8-connected direction code is converted to the 4-connected direction code F4 (iD) at the timing positions of steps [9 and 12] in FIG. 1, the concave right angle It is possible to prevent the so-called 8-connection state from occurring at some locations.

この第5図の変換操作は、第9図に示すように8連結の
方向コード中の点線で描いた斜めの方向コードiD =
L3+5+7を隣接する左右の水平垂直の方向コードi
 D−0,2+4+6のいずれかに置き換える処理であ
る。この変換を行うことにより、8連結の方向コードi
 D =O+1+2+3+4+5+6+7が4連結の方
向コードF 4 (i D) −0,2,4,6に変換
される。
This conversion operation in FIG. 5 is performed by converting the diagonal direction code iD =
Adjacent left and right horizontal and vertical direction codes i of L3+5+7
This is a process of replacing it with either D-0 or 2+4+6. By performing this conversion, the 8-connected direction code i
D = O+1+2+3+4+5+6+7 is converted into a 4-connected direction code F 4 (i D) -0, 2, 4, 6.

第10図は、上記変換テーブルを用い、8連結の方向コ
ードにより抽出した2値図形の輪郭を4連結の方向コー
ドの輪郭へ変換した場合の例を示す。図中の○は8連結
点を、また「・」は4連結点を示している。図示すると
ころから明らかなように、4連結に変換することによっ
て8連結状態がなくなり、凹状の直角箇所が忠実に抽出
される1に とが分かる。
FIG. 10 shows an example in which the contour of a binary figure extracted by an 8-connected direction code is converted into a contour of a 4-connected direction code using the conversion table. In the figure, ○ indicates 8 connection points, and "." indicates 4 connection points. As is clear from the figure, by converting to 4-connection, the 8-connection state is eliminated, and the concave right angle portion is faithfully extracted.

〔発明の効果〕〔Effect of the invention〕

請求項(1)記載の発明によるときは、ペアを組む白黒
画素のマーキング状態を見ることによって一度検索され
た黒画素でも再び次の輪郭の抽出開始点として抽出でき
るようになり、2値図形がどのような形状であっても図
形中のすべての輪郭を余すところなく抽出することがで
きる。
According to the invention described in claim (1), even a black pixel that has been once searched can be extracted again as a starting point for extraction of the next contour by looking at the marking state of the black and white pixels forming a pair, so that a binary figure can be extracted. It is possible to extract all contours in a figure, no matter what shape it is.

請求項(2)記載の発明によるときは、最適検索開始方
向を基点として次の輪郭点を与える黒画素点を順次検索
するようにしたので、次の輪郭点を与える黒画素点の抽
出時間が短縮され、処理の高速化を図ることができる。
According to the invention set forth in claim (2), since the black pixel points that give the next contour point are sequentially searched based on the optimal search start direction, the extraction time for the black pixel points that give the next contour point is shortened. This makes it possible to speed up the processing.

請求項(3)記載の発明によるときは、輪郭の最終方向
コードから当該輪郭が2値図形の内形線であるかあるい
は外形線であるかを判定するようにしたので、輪郭の抽
出終了と同時に輪郭の種類を自動的に知ることができる
According to the invention set forth in claim (3), since it is determined from the final direction code of the contour whether the contour is an inner line or an outer line of a binary figure, it is possible to determine whether the contour extraction is finished. At the same time, the type of contour can be automatically determined.

請求項(4)記載の発明によるときは、8連結の方向コ
ードを4連結の方向コードに変換するようにしたので、
方向コードの連結の性格(8連結/4連結)を指示して
2値図形の輪郭情報を収集できるようになり、2値図形
の形状を忠実に抽出することが可能となる。
According to the invention described in claim (4), since the 8-connected direction code is converted to the 4-connected direction code,
It becomes possible to collect contour information of a binary figure by specifying the nature of the connection of the direction code (8-connection/4-connection), and it becomes possible to faithfully extract the shape of the binary figure.

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

第1図は本発明方式の動作を説明するためのフローチャ
ート、 第2図は本発明方式の実施例を示すブロック図、第3図
は1つ前の方向コードから次の輪郭点を与える黒画素点
の最適検索開始方向を求める対照テーブルの例を示す図
、 第4図は最終の方向コードから輪郭が内形線あるいは外
形線のいづれであるかを判定する判定テーブルの例を示
す図、 第5図は8連結の方向コードを4連結の方向コードの変
換する変換テーブルの例を示す図、 第6図は本発明による2値図形の輪郭抽出の例を示す図
、 第7図は3×3画素サイズのマスクを設定して本発明に
より輪郭抽出する場合の第6図の処理説明図、 第8図は本発明による2値図形の輪郭抽出の他の例を示
す図、 第9図は8連結の方向コードから4連結の方向コードへ
の変換説明図、 第1O図は8連結の方向コードにより抽出した輪郭を4
連結の方向コードの輪郭へ変換した場合の例を示す図、 第11図は8連結の方向コードを示す図、第12図は8
連結の方向コードを用いた従来の2値図形の輪郭抽出の
説明図、 第13図は3×3画素サイズのマスクを示す図、第14
図は3×3画素サイズのマスクを用いた輪郭抽出の原理
説明図である。 P・・・2値図形、M・・・3×3画素サイズのマスク
、iD・・・8連結の方向コード、FN  (iD)・
・・最適検索開始方向、F4(iD)・・・4連結の方
向コード。 特許出願人   株式会社 リ コ −埼さ ゆト ω 区 寸 り
Figure 1 is a flowchart for explaining the operation of the method of the present invention, Figure 2 is a block diagram showing an embodiment of the method of the present invention, and Figure 3 is a black pixel that provides the next contour point from the previous direction code. Figure 4 is a diagram showing an example of a comparison table for determining the optimal search start direction for a point. Figure 5 is a diagram showing an example of a conversion table for converting an 8-connected direction code into a 4-connected direction code, Figure 6 is a diagram showing an example of outline extraction of a binary figure according to the present invention, and Figure 7 is a 3× FIG. 6 is a process explanatory diagram when contour extraction is performed according to the present invention by setting a 3-pixel size mask, FIG. 8 is a diagram showing another example of contour extraction of a binary figure according to the present invention, and FIG. 9 is a diagram showing another example of contour extraction of a binary figure according to the present invention An explanatory diagram of conversion from an 8-connected direction code to a 4-connected direction code, Figure 1O shows the contour extracted by the 8-connected direction code
A diagram showing an example of the case where the direction code of connection is converted to the outline. Figure 11 is a diagram showing the direction code of 8 connections, and Figure 12 is 8.
An explanatory diagram of the conventional outline extraction of binary figures using the direction code of connection. Figure 13 is a diagram showing a mask of 3 x 3 pixel size, Figure 14
The figure is an explanatory diagram of the principle of contour extraction using a mask of 3×3 pixel size. P... Binary figure, M... 3x3 pixel size mask, iD... 8-connected direction code, FN (iD).
... Optimal search start direction, F4 (iD) ... 4-linked direction code. Patent applicant Rico Co., Ltd.

Claims (4)

【特許請求の範囲】[Claims] (1)ラスタスキャンにより最初に白画素から黒画素に
変わる黒画素点を検出して輪郭抽出の開始点とし、輪郭
点を構成する黒画素点に3×3画素サイズのマスクを設
定して該マスクのます目で覆われた画素の白黒状態を左
廻りに順次検索していくことにより次の輪郭点を与える
黒画素点の方向コードを検出し、2値図形の輪郭を方向
コードの点列として表すようにした2値図形の方向コー
ドによる輪郭抽出方式において、検索の終了した白画素
点と黒画素点をマーキングし、隣接する白画素と黒画素
のペアを単位として該マーキング情報を参照しながら次
の輪郭の抽出開始点を求めることを特徴とする2値図形
の方向コードによる輪郭抽出方式。
(1) Using raster scanning, first detect the black pixel point that changes from a white pixel to a black pixel and use it as the starting point for contour extraction, and set a 3x3 pixel size mask on the black pixel points that make up the contour point. By sequentially searching the black and white states of pixels covered by the squares of the mask in a counterclockwise direction, the direction code of the black pixel point that gives the next contour point is detected, and the contour of the binary figure is determined by the point sequence of the direction code. In the contour extraction method using the direction code of a binary figure, which is expressed as A contour extraction method using a direction code of a binary figure, which is characterized in that the next contour extraction start point is determined while the extraction start point of the next contour is determined.
(2)1つ前の方向コードに対する次の輪郭点を与える
黒画素点の最適検索開始方向を定めた対照テーブルを用
意し、 該対照テーブルを参照することにより1つ前の方向コー
ドから次の輪郭点を与える黒画素点の最適検索開始方向
を求め、該最適検索開始方向位置の画素を基点として画
素の白黒状態を左回りに順次検索することを特徴とする
請求項(1)記載の2値図形の方向コードによる輪郭抽
出方式。
(2) Prepare a comparison table that determines the optimal search start direction for the black pixel point that gives the next contour point for the previous direction code, and by referring to the comparison table, search for the next contour point from the previous direction code. 2 according to claim (1), characterized in that an optimal search start direction of a black pixel point giving a contour point is determined, and the black and white state of the pixel is sequentially searched counterclockwise using the pixel at the position of the optimal search start direction as a base point. Contour extraction method using direction code of value figure.
(3)輪郭の最終方向コードから当該輪郭が内形線ある
いは外形線のいづれであるかを判定する判定テーブルを
用意し、 該判定テーブルを参照することにより輪郭の最終方向コ
ードから当該輪郭が内形線であるかあるいは外形線であ
るかを判定することを特徴とする請求項(1)記載の2
値図形の方向コードによる輪郭抽出方式。
(3) Prepare a judgment table that determines whether the contour is an internal line or an external line from the final direction code of the contour, and by referring to the judgment table, it is possible to determine whether the contour is an internal line based on the final direction code of the contour. 2 according to claim (1), characterized in that it is determined whether the line is a shape line or an outline line.
Contour extraction method using direction code of value figure.
(4)8連結の方向コードを4連結の方向コードに変換
する変換テーブルを用意し、該変換テーブルを参照する
ことにより8連結の方向コードを4連結の方向コードに
変換することを特徴とする請求項(1)記載の2値図形
の方向コードによる輪郭抽出方式。
(4) A conversion table for converting an 8-connection direction code to a 4-connection direction code is prepared, and the 8-connection direction code is converted to a 4-connection direction code by referring to the conversion table. A contour extraction method using a direction code of a binary figure according to claim (1).
JP63228429A 1988-09-14 1988-09-14 Contour extraction system for binary graphic form with direction code Pending JPH0277887A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63228429A JPH0277887A (en) 1988-09-14 1988-09-14 Contour extraction system for binary graphic form with direction code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63228429A JPH0277887A (en) 1988-09-14 1988-09-14 Contour extraction system for binary graphic form with direction code

Publications (1)

Publication Number Publication Date
JPH0277887A true JPH0277887A (en) 1990-03-16

Family

ID=16876345

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63228429A Pending JPH0277887A (en) 1988-09-14 1988-09-14 Contour extraction system for binary graphic form with direction code

Country Status (1)

Country Link
JP (1) JPH0277887A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02264951A (en) * 1989-04-05 1990-10-29 Toppan Printing Co Ltd Clipping device
JP2009131596A (en) * 2007-11-09 2009-06-18 Ricoh Co Ltd Information processor, image processor, information processing method, information processing program, and recording medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02264951A (en) * 1989-04-05 1990-10-29 Toppan Printing Co Ltd Clipping device
JP2009131596A (en) * 2007-11-09 2009-06-18 Ricoh Co Ltd Information processor, image processor, information processing method, information processing program, and recording medium

Similar Documents

Publication Publication Date Title
EP0456192B1 (en) Image processing method and apparatus therefor
JPH0277887A (en) Contour extraction system for binary graphic form with direction code
JP3627249B2 (en) Image processing device
JP2002133424A (en) Detecting method of inclination angle and boundary of document
JPH0664614B2 (en) Hierarchical structured template matching method
Yoda et al. Direction coding method and its application to scene analysis
JPS595387A (en) Linear pattern processor
JP2789622B2 (en) Character / graphic area determination device
JP2002230564A (en) Contour extraction device and method and contour extraction program
JPS62221783A (en) Area extracting system
JPH02156383A (en) Method for pattern matching
JPS5814709B2 (en) Shape recognition method for closed shapes
JP3552419B2 (en) Object recognition method
JPH05113315A (en) Detecting method for center position of circular image data
JPS6324482A (en) Extracting method for hole
JPH0410074A (en) Picture pattern inclination detecting method
JPS62175886A (en) Character pattern shaping system
CN113239929A (en) Method for identifying numbers in computer display screen
JPH06309437A (en) Pattern inspecting device
JPH0290374A (en) Positioning device and picture processing lsi circuit
JP2890507B2 (en) Separation device for character area and graphic area
JPS6391779A (en) Parts recognizing device
JPH06325156A (en) Method and device for character shape inspection
JPH11238135A (en) Method and device for image recognition
JPS6174079A (en) Pattern recognizing device