JPH057751B2 - - Google Patents

Info

Publication number
JPH057751B2
JPH057751B2 JP59120140A JP12014084A JPH057751B2 JP H057751 B2 JPH057751 B2 JP H057751B2 JP 59120140 A JP59120140 A JP 59120140A JP 12014084 A JP12014084 A JP 12014084A JP H057751 B2 JPH057751 B2 JP H057751B2
Authority
JP
Japan
Prior art keywords
pixel
point
contour
value
numerical value
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 - Lifetime
Application number
JP59120140A
Other languages
Japanese (ja)
Other versions
JPS60263276A (en
Inventor
Mutsuko Takahashi
Yasumasa Murai
Hideya Yamaki
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.)
NEC Corp
Original Assignee
Nippon Electric 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 Nippon Electric Co Ltd filed Critical Nippon Electric Co Ltd
Priority to JP59120140A priority Critical patent/JPS60263276A/en
Publication of JPS60263276A publication Critical patent/JPS60263276A/en
Publication of JPH057751B2 publication Critical patent/JPH057751B2/ja
Granted legal-status Critical Current

Links

Landscapes

  • Image Analysis (AREA)

Description

【発明の詳細な説明】 (産業上の利用分野) 本発明は、文字や図形などの二次元パターンの
認識を行うための輪郭追跡方法に関する。
DETAILED DESCRIPTION OF THE INVENTION (Field of Industrial Application) The present invention relates to a contour tracing method for recognizing two-dimensional patterns such as characters and figures.

(従来技術) 従来、この種の方法にはフライングスポツトス
キヤナを使用して紙面上に書かれた文字や図形の
輪郭を追跡する方式が採用されていた。この方式
を用いて装置を構成した場合には、高価格で大形
のフライングスポツトスキヤナを利用するため、
装置が高価格で大形化していた。
(Prior Art) Conventionally, this type of method employs a method in which a flying spot scanner is used to trace the contours of characters and figures written on paper. When configuring a device using this method, an expensive and large flying spot scanner is used.
The equipment was expensive and large.

また、2値図形の輪郭を追跡する方式も従来か
ら提案されているが、従来の方式では1画素より
成る線幅であるためにループ図形の内側の輪郭を
追跡できなかつたり、あるいは図形そのものでは
なく輪郭線に注目していたために3画素分の輪郭
線を追跡するのに4画素分の記憶エレメントに拡
大して追跡するという複雑で時間のかかる追跡方
法を採用しなければならなつた。
Additionally, methods for tracing the contours of binary figures have been proposed in the past, but in conventional methods, the line width is one pixel, so it is not possible to trace the inner contours of loop figures, or the figure itself cannot be traced. Because the focus was on the contour line instead of the contour line, a complicated and time-consuming tracing method had to be used to trace a three-pixel contour line by expanding it into a four-pixel memory element.

一方、上記において文字や図形に含まれる内部
のループ部の検出や複数のブロツクから成る図形
の検出は、輪郭の追跡とは異なる手段により行う
必要があつた。
On the other hand, in the above method, it is necessary to detect an internal loop portion included in a character or figure, or to detect a figure consisting of a plurality of blocks, by a means different from tracing the outline.

なお、ここでいうブロツクは有意画素で外側輪
郭部が形成され周囲から独立しているものすべて
を含み、ループはその中で閉じた内側輪郭のある
ループ状のものをいう(以下同様とする)。
Note that the block here includes all significant pixels that form an outer contour and is independent from the surroundings, and the loop refers to a loop-shaped block that has a closed inner contour (the same shall apply hereinafter). .

次に、これらの問題点を図面に参照して詳細に
説明する。
Next, these problems will be explained in detail with reference to the drawings.

従来技術による形状追跡方法を第1図〜第5図
により説明する。
A shape tracking method according to the prior art will be explained with reference to FIGS. 1 to 5.

第1図は線幅が1画素の2値化されたループの
図形の二次元パターンの実例であり、第1図にお
いて論理“1”は図形部、論理“0”は背景部を
表わす。したがつて、この場合“1”は有意画素
に“0”は無意画素に対応する。
FIG. 1 is an example of a two-dimensional pattern of a binarized loop figure with a line width of 1 pixel. In FIG. 1, a logic "1" indicates a figure part and a logic "0" indicates a background part. Therefore, in this case, "1" corresponds to a significant pixel and "0" corresponds to a meaningless pixel.

第2図は第1図と等価な追跡すべき輪郭線を表
しており、第2図における“a”は外側の輪郭線
を表わし、“b”は内側の輪郭線を表わし、斜線
部は図形部を表わしている。第1図は線幅が1画
素であるようなループ図形を表わしているので、
論理“1”の画素のうちのほとんどのものは外側
の輪郭点と内側の輪郭点とを兼ねている。
Figure 2 shows the contour line to be traced equivalent to Figure 1. In Figure 2, "a" represents the outer contour line, "b" represents the inner contour line, and the shaded area represents the shape of the figure. It represents the department. Figure 1 shows a loop shape with a line width of 1 pixel, so
Most of the logic "1" pixels serve as both outer and inner contour points.

第3図は、第1図の図形を記憶した記憶装置の
状態を示し、記憶エレメントには第1図の各画素
に対応して“1”または“0”の値が記憶されて
いる。したがつて、第3図は第2図において示さ
れた輪郭が記憶されている。また、この記憶装置
にはサイズm×nの二次元パターンに対して(m
+2)×(n+2)個の画素が備えてある。第3図
において“c”は外側輪郭における最初の追跡点
(始点)を示す記号であり、“d”は第2番目の追
跡点を示す記号である。
FIG. 3 shows the state of a storage device that has stored the figure shown in FIG. 1, and a value of "1" or "0" is stored in the storage element corresponding to each pixel in FIG. 1. Therefore, in FIG. 3, the contour shown in FIG. 2 is stored. In addition, this storage device stores (m
+2)×(n+2) pixels. In FIG. 3, "c" is a symbol indicating the first tracking point (starting point) on the outer contour, and "d" is a symbol indicating the second tracking point.

第4図は、第2図における外側の輪郭を追跡し
た後の記憶装置の状態を示し、追跡完了時の各輪
郭点に対応する記憶エレメントの内容は“1”か
ら“2”に置換されている。
FIG. 4 shows the state of the storage device after tracking the outer contour in FIG. There is.

第5図は、追跡中の輪郭点から次の輪郭点を探
す順序の一例を示す図である。第5図において、
*は追跡中の輪郭点の位置である。直前に追跡し
た輪郭点が番号8の位置にあると仮定した時、番
号1〜7は番号8を基準にして反時計方向に付け
られている。そこで、番号1〜8の順に各画素に
対応する記憶エレメントの値を調べる。
FIG. 5 is a diagram showing an example of the order in which the next contour point is searched from the contour point being tracked. In Figure 5,
* is the position of the contour point being tracked. Assuming that the contour point tracked immediately before is located at number 8, numbers 1 to 7 are assigned in a counterclockwise direction with reference to number 8. Therefore, the values of the storage elements corresponding to each pixel are checked in the order of numbers 1 to 8.

輪郭追跡は次のように行われる。 Contour tracking is performed as follows.

まず、追跡の始点を探すため、第3図に示す記
憶装置の状態において、第1図の左上隅の画素に
対応する記憶エレメントから順次、右に向かつて
次々に各画素に対応する記憶エレメントの値を調
べてゆき、記憶エレメントの内容が最初に“0”
から“1”に変化する位置の画素を始点(第3図
c点)として、第5図に示すような番号の順序に
従つて記憶エレメントの内容が“0”ではない点
を捜し、その記憶エレメントの画素に追跡点を移
すと共に、追跡済みの画素に対応する記憶エレメ
ントの内容を“1”から“2”に置換する。これ
を繰り返して追跡点が始点に戻れば追跡は終了す
る。
First, in order to find the starting point of tracking, in the state of the storage device shown in FIG. 3, start with the storage element corresponding to the pixel in the upper left corner of FIG. As the value is examined, the contents of the storage element are initially “0”.
Starting from the pixel at the position where the value changes from "1" to "1" (point c in Figure 3), search for a point where the content of the storage element is not "0" according to the order of numbers shown in Figure 5, and store that memory. The tracking point is moved to the pixel of the element, and the contents of the storage element corresponding to the tracked pixel are replaced from "1" to "2". When this is repeated and the tracking point returns to the starting point, tracking ends.

次に、外側の輪郭を追跡した後の第4図の記憶
装置の状態に対応して、第2図における“b”に
従つて内側の輪郭追跡を開始する。しかし、この
場合には、記憶エレメントの内容が“0”から
“1”に変化する点が検出されず、内側の輪郭追
跡は不可能である。
Next, in accordance with the state of the storage device in FIG. 4 after tracing the outer contour, inner contour tracing is started according to "b" in FIG. However, in this case, the point where the content of the storage element changes from "0" to "1" is not detected, and inner contour tracing is impossible.

このように、従来の輪郭追跡方法では第1図に
示すような、線幅が1画素のループ図形におい
て、内側の輪郭を追跡できないという欠点があつ
た。
As described above, the conventional contour tracing method has the disadvantage that it is not possible to trace the inner contour of a loop figure with a line width of one pixel as shown in FIG.

さらに、従来技術による輪郭追跡では、輪郭を
追跡することのみを目的としていたので、図形ま
たは文字の形状を追跡する場合には、一つの輪郭
の追跡結果を図形または文字の内部に含まれたル
ープ部の輪郭追跡に利用できず、改めて別の手段
によつてループ部の有無を検出しなければならな
いという欠点があつた。
Furthermore, in contour tracking according to the conventional technology, the purpose was only to trace the contour, so when tracing the shape of a figure or character, the tracing result of one contour is transferred to a loop included inside the figure or character. This method has the disadvantage that it cannot be used to trace the contour of a loop portion, and the presence or absence of a loop portion must be detected by another means.

(発明の目的) 本発明の目的は、追跡した輪郭点に図形または
文字を表わす数値を付加し、前記数値を付された
図形または文字の形状に無関係に、輪郭追跡とは
別に、対象とする二次元全領域の順次走査を実施
することによつて上記欠点を除去し、輪郭点の位
置情報ばかりでなく、図形または文字を表わす数
値が付与された部分と未だ追跡されていない図形
または文字のパターンとの位置関係により、この
領域の内部で図形または文字を構成する未追跡の
独立線素を成すブロツクの有無、および既に追跡
が終了した図形または文字の内部に存在するルー
プ部が有無を検出することができるようにした形
状追跡方法を提供することにある。
(Objective of the Invention) The object of the present invention is to add numerical values representing figures or characters to tracked contour points, and to target the contour points independently of the shape of the figures or characters to which the numerical values are attached. By performing sequential scanning of the entire two-dimensional area, the above drawbacks are removed, and not only the position information of the contour points but also the parts assigned numerical values representing figures or characters and the parts of figures or characters that have not yet been tracked can be obtained. Based on the positional relationship with the pattern, detects whether there are blocks that form untraced independent line elements that make up a figure or character within this area, and whether there are loops that exist inside a figure or character that has already been traced. The object of the present invention is to provide a shape tracking method that enables the following.

(発明の構成) 本発明による形状追跡方法は複数のプロセスか
ら成り立つものである。
(Structure of the Invention) The shape tracking method according to the present invention consists of a plurality of processes.

第1のプロセスは、一定の二次元領域内に存在
し、第1の数値を有する有意画素により構成され
る二次元図形、または文字の輪郭を追跡する形状
追跡方法において、前記二次元領域全域を、画素
の数値の変化を検出しつつ第1の方向に走査する
ものである。
The first process is a shape tracking method that traces the outline of a two-dimensional figure or character that exists within a certain two-dimensional area and is composed of significant pixels having a first numerical value. , which scans in the first direction while detecting changes in pixel values.

第2のプロセスは、前記第1のプロセスで検出
した前記画素の数値の変化が、無意画素から前記
第1の数値を有する有意画素、または無意画素か
ら(前記第1の数値+第2の数値)の数値を有す
る有意画素への変化である場合に、この変化した
画素を輪郭点の始点とするものである。
The second process is such that the change in the numerical value of the pixel detected in the first process is from the non-significant pixel to the significant pixel having the first numerical value, or from the non-significant pixel to (the first numerical value + the second numerical value). ), this changed pixel is set as the starting point of the contour point.

第3のプロセスは、前記第2のプロセスで輪郭
点の始点とした画素の周囲の画素を、定められた
第1の回転方向に沿つて、前記第2のプロセスに
おいて前記輪郭点の始点の直前に走査した画素か
ら、有意画素を発見するまで順次調査し、この調
査の過程で、この調査の中心となる中心輪郭点の
前記第1の方向の反対側で無意画素を発見した場
合はこの中心輪郭点の画素の値に前記第2の数値
を加えてこの中心輪郭点の画素の値を変更し、ま
たこの中心輪郭点の前記第1の方向側で無意画素
を発見した場合はこの中心輪郭点の画素の値に第
3の値(≠第2の数値、かつ≠第1の数値+第2
の数値)を加えてこの中心輪郭点の画素の値を変
更する値変更を行ない、前記有意画素が発見され
ると、その有意画素を新たな輪郭点とするもので
ある。
In the third process, pixels around the pixel that was the starting point of the contour point in the second process are rotated along a predetermined first rotation direction immediately before the starting point of the contour point in the second process. The pixels scanned at The value of the pixel at the center contour point is changed by adding the second numerical value to the pixel value at the contour point, and if an invalid pixel is found on the side of the center contour point in the first direction, the value of the pixel at the center contour point is changed. The third value (≠ second numerical value, and ≠ first numerical value + second numerical value) is added to the pixel value of the point.
When a significant pixel is found, the significant pixel is set as a new contour point.

第4のプロセスは、前記第3のプロセスで発見
された新たな輪郭点の周囲の画素を、前記第1の
回転方向に沿つて、直前に追跡された輪郭点の次
の画素から、前記値変更を行ないながら、有意画
素を発見するまで順次調査し、有意画素が発見さ
れると、その有意画素を新たな輪郭点として、同
様にこの新たな輪郭点についても周囲の調査を行
ない、次々と輪郭点の追跡を前記輪郭点の始点を
発見するまで行なう輪郭追跡プロセスである。
A fourth process converts pixels around the new contour point found in the third process from the pixel next to the contour point tracked immediately before, along the first rotation direction, to the value of the contour point. While making changes, the search is performed sequentially until a significant pixel is found. When a significant pixel is found, that significant pixel is set as a new contour point, and the surroundings of this new contour point are similarly investigated, one after another. This is a contour tracing process in which a contour point is tracked until the starting point of the contour point is found.

第5のプロセスはこの輪郭追跡プロセスにおい
て、前記輪郭点の始点が発見された場合に前記第
1のプロセスに戻り、前記走査を再開するための
ものである。
A fifth process is for returning to the first process and restarting the scanning when the starting point of the contour point is found in this contour tracing process.

(実施例) 次に、本発明について図面を参照して詳細に説
明する。
(Example) Next, the present invention will be described in detail with reference to the drawings.

第6図は、第3図に示す外側輪郭の追跡に対応
し、本発明によつて外側輪郭を追跡した後の記憶
エレメントの状態を示す図である。第6図におい
て、“e”は外側輪郭追跡の始点を示す記号であ
る。第7図は、第6図において本発明によつて内
側輪郭を追跡した後の記憶エレメントの状態を示
す図である。第7図において、“h”は内側輪郭
の追跡の始点を示す記号である。第8図および第
9図は、本発明により追跡を実行する順序、追跡
点との関係位置を示す記号、およびその記号に対
応した値を示す図である。第8図においてaは追
跡の順序、bはその追跡中の画素の周辺の画素
に、以下の説明のために仮につけた記号を示し、
第9図はその記号に対応した位置の画素に対応す
る記憶エレメントの値が“0”の場合に、その時
点で追跡中の画素(図中*印にある画素)に既に
付加されている数値を加算されるべき数値を示し
たものである。第10図は、本発明による追跡の
概略を示すフローチヤートの一例である。
FIG. 6 corresponds to the tracking of the outer contour shown in FIG. 3 and shows the state of the storage element after the outer contour has been tracked according to the invention. In FIG. 6, "e" is a symbol indicating the starting point of outer contour tracing. FIG. 7 shows the state of the storage element after the inner contour has been tracked according to the invention in FIG. In FIG. 7, "h" is a symbol indicating the starting point of tracing the inner contour. FIGS. 8 and 9 are diagrams showing the order in which tracking is performed according to the present invention, symbols indicating positions relative to the tracking points, and values corresponding to the symbols. In FIG. 8, a indicates the tracking order, b indicates a symbol temporarily attached to pixels surrounding the pixel being tracked for the purpose of the following explanation,
Figure 9 shows the value that has already been added to the pixel being tracked (the pixel marked with * in the figure) when the value of the storage element corresponding to the pixel at the position corresponding to that symbol is "0". It shows the numerical value to be added. FIG. 10 is an example of a flowchart showing an outline of tracking according to the present invention.

本発明に使用するプロセスには第1から第5ま
でのプロセスがある。
The processes used in the present invention include the first to fifth processes.

第1および第2のプロセスでは、二次元の一定
領域内(例えば第3図に示す)を全面走査して二
次元図形または文字の輪郭(外側輪郭線または内
側輪郭線)の始点を検出することができる。
In the first and second processes, the entire surface of a two-dimensional fixed area (for example, as shown in FIG. 3) is scanned to detect the starting point of the outline (outer outline or inner outline) of a two-dimensional figure or character. I can do it.

第1および第2のプロセスは形状追跡の始点を
捜す動作である。この動作は、いわゆるラスタス
キヤン方式等で記憶エレメントの値を順に調べて
ゆき、値が“0”から“1”または“0”から
“5”(従来技術では“0”から“1”)に変化し
たところで、この“1”の画素を始点とする動作
である(第10図ステツプS1およびS2参照)。
The first and second processes are operations for searching for a starting point for shape tracking. This operation uses a so-called raster scan method to sequentially check the values of storage elements, and the values change from "0" to "1" or from "0" to "5" (from "0" to "1" in the conventional technology). When the pixel changes, the operation starts from this "1" pixel (see steps S1 and S2 in FIG. 10).

第3、第4および第5のプロセスは第1および
第2のプロセスにより発見された始点から輪郭を
追跡する動作である。すなわち追跡点(追跡中の
画素)の周囲の画素の値を定められた方向で順に
調べ、最初に発見された“1”以上(従来技術で
は“1”)の画素に追跡点を移動するようにして
次々と画素上を移動し、輪郭を追跡する動作であ
る(第10図ステツプS3参照)。そして始点に戻
つた時点で動作を終了する(第10図ステツプS4
参照)。輪郭点の周囲の画素の捜索は、直前の輪
郭点の画素を最後に調べるように、直前の輪郭点
の画素の隣の画素から始める。
The third, fourth, and fifth processes are operations that trace the contour from the starting point found by the first and second processes. In other words, the values of pixels around the tracking point (the pixel being tracked) are sequentially checked in a predetermined direction, and the tracking point is moved to the first pixel found that is "1" or more ("1" in the conventional technology). This is an operation of moving over pixels one after another and tracing the contour (see step S3 in Figure 10). The operation ends when it returns to the starting point (Step S 4 in Figure 10).
reference). The search for pixels around a contour point starts from the pixel next to the pixel of the immediately preceding contour point, so that the pixel of the immediately preceding contour point is examined last.

第8図aは追跡中の輪郭点から次の輪郭点を捜
す順序の一例を示している。第8図aにおける*
は追跡中の輪郭点の位置であり、直前に追跡した
輪郭点を番号8としたものである。例えば、図示
したように左上の位置が番号8であり、番号1〜
7は番号8を基準として反時計方向に付けられて
いる。番号1〜8の順に各画素に対する記憶エレ
メントの値を調べる。
FIG. 8a shows an example of the order in which the next contour point is searched from the contour point being tracked. * in Figure 8a
is the position of the contour point being tracked, and the contour point tracked immediately before is numbered 8. For example, as shown in the figure, the upper left position is number 8, and numbers 1-
Number 7 is numbered counterclockwise with reference to number 8. Examine the value of the storage element for each pixel in the order of numbers 1-8.

この第3、第4および第5のプロセスにおいて
従来技術と異なる点が2つある。
There are two differences from the prior art in the third, fourth, and fifth processes.

その1つは、始点における輪郭点の探索であ
る。始点の場合は前述の直前の輪郭点がないた
め、周囲のどの画素から始めるかを予め定める必
要がある。従来技術では第5図に示す順序である
が、本実施例では第8図aの順序である。
One of them is the search for contour points at the starting point. In the case of a starting point, there is no preceding contour point, so it is necessary to determine in advance which surrounding pixel to start from. In the prior art, the order is shown in FIG. 5, but in this embodiment, the order is shown in FIG. 8a.

他の1つの相違点は、記憶エレメントの値(有
意画素に付与される数値)である。従来技術では
追跡点の移動後に画素の値(前記数値)を“1”
から“2”に更新するが、本実施例では、この値
の更新に特徴がある。
Another difference is the value of the storage element (the numerical value assigned to the significant pixel). In the conventional technology, the pixel value (the above numerical value) is set to "1" after the tracking point moves.
This value is updated from "2" to "2", but this embodiment is characterized by updating this value.

第9図は、第8図中*における追跡中の各点に
対応して該当する画素の記憶エレメントの値が
“0”である時に、追跡中の画素に対応する記憶
エレメントの値に加算されるべき値を示した図で
ある。
Figure 9 shows that when the value of the memory element of the corresponding pixel corresponding to each point being tracked in * in Figure 8 is "0", the value of the memory element corresponding to the pixel being tracked is added. FIG.

すなわち前述の第2の動作で追跡点の周囲の画
素の捜索時に、捜索対象画素が“0”であつた場
合に第9図に示す値を追跡点の画素に加えるよう
に動作する。したがつて捜索対象画素が追跡点の
左であり、これが“0”であつた場合は、追跡点
(図中*印)の画素に“2”が加えられる。しか
し仮に追跡点の右が“0”であつたとしてもこれ
が捜索対象となる前に追跡点が移動することによ
つて捜索対象画像でなくなれば“4”は加算され
ない。
That is, when searching pixels around the tracking point in the second operation described above, if the search target pixel is "0", the value shown in FIG. 9 is added to the pixel at the tracking point. Therefore, if the search target pixel is to the left of the tracking point and is "0", "2" is added to the pixel at the tracking point (marked with * in the figure). However, even if the right side of the tracking point is "0", if the tracking point moves and the image is no longer the search target before it becomes the search target, "4" will not be added.

第6図は、第2図における“a”に対し外側輪
郭を追跡した後の記憶装置の状態を示している。
すなわち、1画素左の画素に対応する記憶エレメ
ントの値が“0”であるならば、追跡完了時は追
跡中の画素に対応する記憶エレメントの値“1”
に“2”が加算されて“3”に置換され、1画素
右の画素に対応する記憶エレメントの値が“0”
であるならば、追跡中の画素に対応する記憶エレ
メントの値は“4”が該当する値“1”に加算さ
れて“5”に置換されている。
FIG. 6 shows the state of the storage device after tracing the outer contour for "a" in FIG.
In other words, if the value of the storage element corresponding to the pixel one pixel to the left is "0", when tracking is completed, the value of the storage element corresponding to the pixel being tracked will be "1".
"2" is added to "3" and replaced with "3", and the value of the storage element corresponding to the pixel one pixel to the right becomes "0".
If so, the value of the storage element corresponding to the pixel being tracked is replaced by "5" by adding "4" to the corresponding value "1".

第7図において、“h”を含む列は第6図の記
憶装置の状態に対応して第2図における“b”を
表わし、内側の輪郭を追跡した後の記憶装置の状
態を示す。したがつて、1画素左の画素に対応す
る記憶エレメントの値が“0”であるならば、追
跡時の記憶エレメントの値は追跡中の画素に対応
する記憶エレメントの値に“2”が加算されて
“7”に置換され、1画素右の画素に対応する記
憶エレメントの値が“0”であるならば、追跡中
の画素に対応する記憶エレメントの値には“5”
に“2”が加算されて“7”に置換される。
In FIG. 7, the column containing "h" represents "b" in FIG. 2, corresponding to the state of the storage device in FIG. 6, and indicates the state of the storage device after tracing the inner contour. Therefore, if the value of the storage element corresponding to the pixel one pixel to the left is "0", the value of the storage element during tracking will be "2" added to the value of the storage element corresponding to the pixel being tracked. If the value of the storage element corresponding to the pixel one pixel to the right is "0", the value of the storage element corresponding to the pixel being tracked will be "5".
"2" is added to and replaced with "7".

これらの状況を第8図bの追跡中の輪郭点(*
印)とその周辺の探索点の関係位置を示す記号A
〜Hを使つてさらに詳しく説明する。
These situations can be seen at the contour points being tracked in Figure 8b (*
Symbol A indicating the relative position of the search point around it
This will be explained in more detail using ~H.

第3図において、始点に続く輪郭点を検出する
には、第8図aの順序に従つて始点を中心に反時
計方向に調べてゆき、最初に“1”が存在してい
る点を見出し、これを輪郭点として位置情報を座
標より抽出する。この“1”が検出されるまで、
第8図bの各記号に対応した第9図に示す値を、
追跡点の画素に対応する記憶エレメントの値に順
次に加算してゆく。次の輪郭点が検出されたなら
ば、その輪郭点の画素を次の追跡点として第8図
aのような順序で調べてゆく。ここで始点以降の
追跡点については、直前の追跡点の番号に続く次
の位置から調べ始める。
In Figure 3, to detect the contour point following the starting point, search counterclockwise around the starting point in the order shown in Figure 8a, and find the point where "1" exists first. , position information is extracted from the coordinates using this as a contour point. Until this “1” is detected,
The values shown in FIG. 9 corresponding to each symbol in FIG. 8b are
The values of the storage elements corresponding to the pixels of the tracking point are sequentially added. When the next contour point is detected, the pixels of that contour point are examined as the next tracking point in the order shown in FIG. 8a. For tracking points after the starting point, the search starts from the next position following the number of the previous tracking point.

例えば、第3図のパターンでは始点(第3図
c)からみて直前の輪郭点が記号Hの位置にある
ものとして記号Aの位置から調査を始める。第2
番目の追跡点(第3図d)は、始点からみて記号
Bの位置にある。ここで、記号Aの位置の画素に
対応する記憶エレメントの値は“0”であるか
ら、加算基準に従つて記号Aに対応する値、すな
わち“2”を加算し、始点に対応した画素での記
憶エレメントの値は“3”となる。次に、第2番
目の追跡点からみて始点は記号Fの位置にあるた
め、記号Gの位置から反時計方向に調べ始める。
順次調べると、第3番目の追跡点は第2番目の追
跡点からみて記号Dの位置にあるため、第2番目
の追跡点に対応する記憶エレメントの値は記号G
に対応する値“0”と、記号Hに対応する値
“0”と、記号Aに対応する値“2”と、記号B
に対応する値“C”と、記号Cに対応する値
“0”とが加算されたものとなり、結果は“3”
となる。次に、第3番目の追跡点からみて第2番
目の追跡点は記号Hの位置にあるため、記号Aの
位値から反時計方向に調べ始める。このようにし
て追跡を繰り返して実行し、追跡点が始点に戻つ
た時点で記号Hに対応する値が加算された場合に
は、追跡は終了する。ここで、ブロツクが一つ検
出されたことになつて再び走査が開始される。こ
のとき、“0”から“1”への変化点を検出した
ならば、他に独立したブロツクが存在することに
なる。この実施例では、1ブロツクに1ループが
対応した図形を取り扱つているので、次は内側輪
郭の追跡を行う。
For example, in the pattern of FIG. 3, it is assumed that the immediately preceding contour point is at the position of symbol H when viewed from the starting point (c of FIG. 3), and the investigation starts from the position of symbol A. Second
The th tracking point (FIG. 3d) is located at the position of symbol B when viewed from the starting point. Here, since the value of the storage element corresponding to the pixel at the position of symbol A is "0", the value corresponding to symbol A, that is, "2" is added according to the addition standard, and the value of the storage element corresponding to the pixel at the position of the starting point is The value of the storage element becomes "3". Next, since the starting point is at the position of symbol F when viewed from the second tracking point, the search starts from the position of symbol G in a counterclockwise direction.
When examined sequentially, the third tracking point is at the position of symbol D from the second tracking point, so the value of the storage element corresponding to the second tracking point is symbol G.
The value "0" corresponding to the symbol H, the value "0" corresponding to the symbol H, the value "2" corresponding to the symbol A, and the symbol B
The value "C" corresponding to the symbol C and the value "0" corresponding to the symbol C are added, and the result is "3".
becomes. Next, since the second tracking point is located at the position of symbol H when viewed from the third tracking point, the search begins counterclockwise from the position value of symbol A. Tracking is repeated in this manner, and if the value corresponding to the symbol H is added when the tracking point returns to the starting point, the tracking ends. At this point, one block is detected and scanning is started again. At this time, if a change point from "0" to "1" is detected, it means that another independent block exists. In this embodiment, since we are dealing with a figure in which one loop corresponds to one block, the inner contour will be tracked next.

内側輪郭の追跡は外側輪郭の追跡と同様に行わ
れる。なお、前記の他に独立したブロツクについ
てはその動作の主要部分は前記の動作同様である
ので説明は省略する。
Tracking of the inner contour is performed in the same way as tracking of the outer contour. It should be noted that the main parts of the operations of the independent blocks other than those described above are the same as those described above, so a description thereof will be omitted.

ここで、外側の輪郭を追跡した後の第6図の記
憶装置の状態において、内側の輪郭の追跡を行う
ことになる。今度は、外側の輪郭終了点から右へ
向かつて内側の輪郭追跡の始点を検出するため、
順次画素に対応する記憶エレメントの値を調べて
ゆく。ここで、“0”から“1”、あるいは“0”
から“5”に変化する点があれば、この点を内側
輪郭追跡の始点とする。
Here, in the state of the storage device shown in FIG. 6 after tracing the outer contour, the inner contour will be traced. This time, in order to detect the starting point of the inner contour tracing from the outer contour end point to the right,
The values of the storage elements corresponding to the pixels are sequentially checked. Here, from “0” to “1” or “0”
If there is a point that changes from "5" to "5", this point is set as the starting point of inner contour tracking.

第6図の場合は“0”から“5”に変化する点
gがこれに該当する。
In the case of FIG. 6, this corresponds to the point g that changes from "0" to "5".

内側のループ部の輪郭の追跡は、外側の輪郭部
の追跡と同様の方法によつて行う。第8図におい
て記号Hに対応する画素の記憶エレメントの値か
ら順次、第8図に示す順序に従つて反時計方向に
調べ始め、画素の記憶エレメントが“0”以外の
値を有する点が見つかるまで“0”の記号に対応
する画素の記憶エレメントの値を加算してゆく。
第6図において、始点からみて第2番目の追跡点
は記号Bの位置にある。したがつて、始点の画素
に対応した記憶エレメントの値はすでに外側輪郭
の追跡の結果として置換された値、すなわち、
“5”に対して記号Aに対応する値、すなわち
“2”を加算して得られた値となり、結果的に
“7”となる。第2番目の追跡点からみて始点は
記号Fの値にあるため、記号Gの位置から始めて
その画素に対応する記憶エレメントの値を調べ
る。第3番目の追跡点は記号Aの位置にあるた
め、記号Gに対応する値、すなわち“0”と、記
号Hに対応する値、すなわち“0”とを記号Aに
対応する値に加算して“5”となる。第2番目の
追跡点は、第3番目の追跡点からみて記号Eの位
置にある。したがつて、記号Fの位置からその画
素に対応する記憶エレメントの値を調べ始める。
このようにして、追跡を繰り返して実行し、追跡
点が始点に戻つた時点で記号Hに対応する画素の
記憶エレメントの値が加算されたならば、追跡は
終了する。
The contour of the inner loop portion is traced in the same manner as the outer contour portion. In FIG. 8, starting from the value of the storage element of the pixel corresponding to the symbol H, the search starts counterclockwise in the order shown in FIG. 8, and points where the storage element of the pixel has a value other than "0" are found. The values of the storage elements of the pixels corresponding to the "0" symbol are added up to the "0" symbol.
In FIG. 6, the second tracking point is located at symbol B when viewed from the starting point. Therefore, the value of the storage element corresponding to the pixel of the starting point has already been replaced as a result of tracing the outer contour, i.e.
The value is obtained by adding the value corresponding to the symbol A, that is, "2" to "5", resulting in "7". As seen from the second tracking point, the starting point is at the value of the symbol F, so starting from the position of the symbol G, the value of the storage element corresponding to that pixel is examined. Since the third tracking point is at the position of symbol A, the value corresponding to symbol G, that is, "0", and the value that corresponds to symbol H, that is, "0" are added to the value corresponding to symbol A. becomes “5”. The second tracking point is located at symbol E as viewed from the third tracking point. Therefore, starting from the position of the symbol F, the value of the storage element corresponding to that pixel is examined.
In this way, tracking is repeatedly performed, and when the tracking point returns to the starting point and the value of the storage element of the pixel corresponding to the symbol H is added, the tracking ends.

なお、本発明では、前述の動作により置換され
た画素の値でその画素が図形上でどのような部分
を形成しているかを判断することができる。その
代表的なものがループの検出である。(第10図
のステツプS1およびS2参照)。
Note that in the present invention, it is possible to determine what part of a figure the pixel forms based on the value of the pixel replaced by the above-described operation. A typical example is loop detection. (See steps S 1 and S 2 in Figure 10).

これは前述と同様の全面走査“3”から“1”
または“1”から“0”への変化点を捜すことで
検出することができる。
This is the same full-scale scan “3” to “1” as described above.
Alternatively, it can be detected by searching for a point of change from "1" to "0".

例えば外側輪郭の追跡が終わつた後の二次元全
面走査において、第3図の“d”に対応する第6
図の“f”の位置の記憶エレメントは“3”の数
値が付与されておりその右が“0”であるので左
から右への走査によつて“3”から“0”の変化
を検出し、第3図の“d”を含む図形がループ状
であることが分かる。ここでもし、この図形の一
部に途切れた個所があつてループ状となつていな
い場合は、第8図、第9図に示されるルールに従
つて輪郭を追跡すればループの切れた端部から輪
郭に沿つて始点の方向に戻ることになり、この戻
る過程で第6図の“f”の位置に付与されている
数値“3”に、第9図に示す“4”が加算され
て、“f”の位置での左から右への走査によつて
は“3”から“0”とはならず“7”から“0”
となり、ループとして検出されなくなる。他の画
素についても同様であるので、このように各有意
画素に付与された数値を走査して調べることによ
り、ループ部の検出(第10図のステツプS5
照)やブロツクの数(第10図のステツプS2に関
連して出力可能)を知ることができる。
For example, in a two-dimensional full-surface scan after tracking the outer contour, the sixth point corresponding to "d" in FIG.
The memory element at position "f" in the figure is given the numerical value "3" and the right side is "0", so a change from "3" to "0" is detected by scanning from left to right. However, it can be seen that the figure including "d" in FIG. 3 is loop-shaped. Here, if there is a broken part in this figure and it does not form a loop, if you trace the outline according to the rules shown in Figures 8 and 9, you can find the broken end of the loop. From there, it returns along the contour in the direction of the starting point, and in the process of returning, "4" shown in Figure 9 is added to the number "3" given to the position of "f" in Figure 6. , depending on the scan from left to right at the position of "f", it does not go from "3" to "0" but from "7" to "0".
Therefore, it is no longer detected as a loop. The same goes for other pixels, so by scanning and examining the numerical values assigned to each significant pixel, you can detect loops (see step S5 in Figure 10) and detect the number of blocks (see step S5 in Figure 10). (output possible in relation to step S2 in the figure).

そこで第3図(第6図)の場合は、ループ数は
1となる。なお、この追跡方法では、m×n画素
の二次元パターンに対して(m+2)×(n+2)
の記憶エレメントがあり、座標(i、j)(i=
1、2、……m+2:j=1、2、……n+2)
の記憶番地に対して座標(1、j)、(i、1)、
(m+2、j)、(i、n+2)に対応する記憶エ
レメントはすべて“0”とする。すなわち、m×
nの二次元パターンのまわりの1画素はすべて論
理“0”とする。また、追跡点を中心に8連結の
3×3画素において反時計方向に調べ、始点にお
いて記号Aの位置から調べたならば終了点におい
て必ず記号Hの位置まで調べる。
Therefore, in the case of FIG. 3 (FIG. 6), the number of loops is one. In addition, in this tracking method, for a two-dimensional pattern of m × n pixels, (m + 2) × (n + 2)
There are storage elements with coordinates (i, j) (i=
1, 2, ... m + 2: j = 1, 2, ... n + 2)
Coordinates (1, j), (i, 1),
All storage elements corresponding to (m+2, j) and (i, n+2) are set to "0". That is, m×
One pixel around the n two-dimensional pattern is all set to logic "0". In addition, the 8-connected 3×3 pixels are checked in a counterclockwise direction around the tracking point, and if the search starts from the position of symbol A at the starting point, it is always checked up to the position of symbol H at the end point.

(発明の効果) 以上説明したように本発明においては、追跡し
た輪郭点に図形または文字を表わす数値を付加
し、図形または文字の形状に無関係な輪郭追跡と
は異なる二次元領域の順次走査を実施することに
より、複雑な図形、あるいは1画素の線幅のルー
プ図形に対して外側輪郭はもとより、内側輪郭も
含めて簡単な動作で追跡することができるという
効果がある。
(Effects of the Invention) As explained above, in the present invention, numerical values representing figures or characters are added to tracked contour points, and sequential scanning of a two-dimensional area is performed, which is different from contour tracing which is unrelated to the shape of figures or characters. By implementing this method, it is possible to trace not only the outer contour but also the inner contour of a complex figure or a loop figure with a line width of 1 pixel with a simple operation.

さらに、輪郭点の位置情報だけではなくループ
の検出、およびブロツクの検出のような認識分野
における特徴抽出にも利用できるので、簡単な装
置で輪郭の追跡を完全に、すばやく行うことがで
きる安価な形状追跡方法を形成できるという効果
もある。
Furthermore, it can be used not only for contour point position information but also for feature extraction in recognition fields such as loop detection and block detection. Another advantage is that a shape tracking method can be formed.

上記においてブロツクの検出は文字や図形のブ
ロツク数を調べることであり、ブロツク数は外側
輪郭の数に等しい。
In the above, block detection means checking the number of blocks of characters or figures, and the number of blocks is equal to the number of outer contours.

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

第1図は1画素の線幅を有するループ図形図で
あり、文字や図形などの2値化された二次元パタ
ーンの実例を示す図である。第2図は第1図にお
いて追跡すべき輪郭線を示す図である。第3図は
数値に置換して書込まれた記憶エレメントの状態
を示す図である。第4図は従来技術による外側輪
郭追跡終了後の記憶エレメントの状態を示す図で
ある。第5図は従来技術による追跡先探索の順序
を示す図である。第6図は本発明により外側輪郭
を追跡した後の記憶エレメントの状態を示す図で
ある。第7図は本発明により内側輪郭を追跡した
後の記憶エレメントの状態を示す図である。第8
図ならびに第9図は本発明による追跡先探索の順
序、関係位置の記号、および記号の対応値を示す
図である。第10図は本発明による追跡の流れの
一例を示すフローチヤートである。 a,b……輪郭線。
FIG. 1 is a diagram of a loop figure having a line width of one pixel, and is a diagram showing an example of a binary two-dimensional pattern such as a character or a figure. FIG. 2 is a diagram showing the contour line to be traced in FIG. 1. FIG. 3 is a diagram showing the state of a storage element in which numerical values have been replaced and written. FIG. 4 is a diagram showing the state of the storage element after the outer contour tracing according to the prior art is completed. FIG. 5 is a diagram showing the order of tracking destination search according to the prior art. FIG. 6 shows the state of the storage element after tracking the outer contour according to the invention. FIG. 7 shows the state of the storage element after tracking the inner contour according to the invention. 8th
9 and 9 are diagrams showing the order of tracking destination search, symbols of related positions, and corresponding values of the symbols according to the present invention. FIG. 10 is a flowchart showing an example of the flow of tracking according to the present invention. a, b...contour line.

Claims (1)

【特許請求の範囲】 1 一定の二次元領域内に存在し、第1の数値を
有する有意画素により構成される二次元図形、ま
たは文字の輪郭を追跡する形状追跡方法におい
て、 前記二次元領域全域を、画素の数値の変化を検
出しつつ第1の方向に走査する第1のプロセス
と、 前記第1のプロセスで検出した前記画素の数値
の変化が、無意画素から前記第1の数値を有する
有意画素、または無意画素から(前記第1の数値
+第2の数値)の数値を有する有意画素への変化
である場合に、この変化した画素を輪郭点の始点
とする第2のプロセスと、 前記第2のプロセスで前記輪郭点の始点とした
画素の周囲の画素を、定められた第1の回転方向
に沿つて、前記第2のプロセスにおいて前記輪郭
点の始点である画素の直前に走査した画素から、
有意画素を発見するまで順次調査し、この調査の
過程で、この調査の中心となる中心輪郭点の前記
第1の方向の反対側で無意画素を発見した場合は
この中心輪郭点の画素の値に前記第2の数値を加
えてこの中心輪郭点の画素の値を変更し、またこ
の中心輪郭点の前記第1の方向側で無意画素を発
見した場合はこの中心輪郭点の画素の値に第3の
値(≠第2の数値、かつ≠第1の数値+第2の数
値)を加えてこ中心輪郭点の画素の値を変更する
値変更を行ない、前記有意画素が発見されると、
その有意画素を新たな輪郭点とする第3のプロセ
スと、 前記第3のプロセスで発見された新たな輪郭点
の周囲の画素を、前記第1の回転方向に沿つて、
直前に追跡された輪郭点の次の画素から、前記値
変更を行ないながら、有意画素を発見するまで順
次調査し、有意画素が発見されると、その有意画
素を新たな輪郭点として、同様にこの新たな輪郭
点についても周囲の調査を行ない、次々と輪郭点
の追跡を前記輪郭点の始点を発見するまで行なう
輪郭追跡プロセスである第4のプロセスと、 前記輪郭追跡プロセスにおいて、前記輪郭点の
始点が発見された場合に前記第1のプロセスに戻
り、前記走査を再開する第5のプロセスとを有す
ることを特徴とする形状追跡方法。
[Scope of Claims] 1. A shape tracking method for tracing the outline of a two-dimensional figure or a character existing in a certain two-dimensional area and constituted by significant pixels having a first numerical value, comprising: a first process of scanning in a first direction while detecting a change in the numerical value of the pixel; and a change in the numerical value of the pixel detected in the first process has the first numerical value from the non-significant pixel. a second process in which, in the case of a change from a significant pixel or an insignificant pixel to a significant pixel having a numerical value of (the first numerical value + the second numerical value), the changed pixel is set as the starting point of the contour point; Scanning pixels around the pixel that is the starting point of the contour point in the second process, along a determined first rotation direction, immediately before the pixel that is the starting point of the contour point in the second process. From the pixel that
The investigation is performed sequentially until a significant pixel is found, and in the process of this investigation, if an insignificant pixel is found on the opposite side of the first direction from the central contour point that is the center of this investigation, the value of the pixel at this central contour point is The value of the pixel at this central contour point is changed by adding the second numerical value to When the value of the pixel at the center contour point is changed by adding a third value (≠ second numerical value and ≠ first numerical value + second numerical value), and the significant pixel is found,
a third process in which the significant pixel becomes a new contour point, and pixels around the new contour point discovered in the third process are converted along the first rotation direction,
Starting from the next pixel of the contour point tracked just before, the above values are changed while sequentially investigating until a significant pixel is found. When a significant pixel is found, that significant pixel is set as a new contour point and the same process is performed. A fourth process is a contour tracing process in which the surroundings of this new contour point are investigated and the contour points are tracked one after another until the starting point of the contour point is found, and in the contour tracing process, the contour point a fifth process of returning to the first process and restarting the scanning when a starting point of the shape is found.
JP59120140A 1984-06-12 1984-06-12 Shape tracking system Granted JPS60263276A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP59120140A JPS60263276A (en) 1984-06-12 1984-06-12 Shape tracking system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP59120140A JPS60263276A (en) 1984-06-12 1984-06-12 Shape tracking system

Publications (2)

Publication Number Publication Date
JPS60263276A JPS60263276A (en) 1985-12-26
JPH057751B2 true JPH057751B2 (en) 1993-01-29

Family

ID=14778954

Family Applications (1)

Application Number Title Priority Date Filing Date
JP59120140A Granted JPS60263276A (en) 1984-06-12 1984-06-12 Shape tracking system

Country Status (1)

Country Link
JP (1) JPS60263276A (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH067389B2 (en) * 1984-09-20 1994-01-26 オムロン株式会社 Image processing device

Also Published As

Publication number Publication date
JPS60263276A (en) 1985-12-26

Similar Documents

Publication Publication Date Title
US4769849A (en) Method and apparatus for separating overlapping patterns
JPH057751B2 (en)
JP3149221B2 (en) Image processing device
JPH11134509A (en) Drawing recognition processing method and architectural drawing recognition processing method
JPH0130180B2 (en)
JP2846486B2 (en) Image input device
US5894525A (en) Method and system for simultaneously recognizing contextually related input fields for a mutually consistent interpretation
JP3037504B2 (en) Image processing method and apparatus
JPH0510709B2 (en)
JPH08212292A (en) Frame recognition device
JPH0535872A (en) Contour tracing system for binary image
JPH04112276A (en) Binary picture contour line chain encoding device
JPS589471B2 (en) link link
JPH05143733A (en) Contour extracting device
JPS6324482A (en) Hole extraction method
JPH02101588A (en) Picture processor
Sumi et al. Automated inspection vision using gray-level image
JPH04236678A (en) Method for shaping area
JPH01128171A (en) Image processor
JPH06274692A (en) Character extractor
JPS63128490A (en) Character image extraction possessing system
JPH07287751A (en) How to recognize a house figure from map line segment data
JPH0434670A (en) Image processor
JPS5845746B2 (en) Contour tracking method
JPH067389B2 (en) Image processing device