JPH0130180B2 - - Google Patents

Info

Publication number
JPH0130180B2
JPH0130180B2 JP58009108A JP910883A JPH0130180B2 JP H0130180 B2 JPH0130180 B2 JP H0130180B2 JP 58009108 A JP58009108 A JP 58009108A JP 910883 A JP910883 A JP 910883A JP H0130180 B2 JPH0130180 B2 JP H0130180B2
Authority
JP
Japan
Prior art keywords
pixel
code
contour
value
pattern
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
Application number
JP58009108A
Other languages
Japanese (ja)
Other versions
JPS59135579A (en
Inventor
Masao Nito
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.)
Fuji Electric Co Ltd
Original Assignee
Fuji 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 Fuji Electric Co Ltd filed Critical Fuji Electric Co Ltd
Priority to JP58009108A priority Critical patent/JPS59135579A/en
Publication of JPS59135579A publication Critical patent/JPS59135579A/en
Publication of JPH0130180B2 publication Critical patent/JPH0130180B2/ja
Granted legal-status Critical Current

Links

Description

【発明の詳細な説明】 発明の属する技術分野 工業用テレビジヨンカメラ等によつて撮像され
た画像からパターンの形状を分離識別する方法と
して、パターンの輪郭を追跡する方法があるが、
本発明はこの輪郭追跡を高速に行うための方法に
関するものである。
[Detailed description of the invention] Technical field to which the invention pertains As a method for separating and identifying the shape of a pattern from an image captured by an industrial television camera or the like, there is a method of tracing the outline of a pattern.
The present invention relates to a method for performing this contour tracing at high speed.

従来技術とその問題点 従来パターンの形状認識にはいわゆるRun
Length Code法のようにパターン走査線相互の
重複部をチエツクして行く面積的な追跡方法もあ
るが、パターンの輪郭の持つ細部の特徴(例えば
円形、多角形、丸味部、角部、突出部その他の屈
曲部等)や周囲長を求めるには、直接にパターン
の輪郭を追跡することが効果的である。ここで従
来のこの種のパターンの輪郭を追跡する基本的な
方法を述べる。
Conventional technology and its problems Conventional pattern shape recognition uses the so-called Run
There are area-based tracking methods such as the Length Code method that check the overlapping parts of pattern scanning lines. In order to find other curved parts, etc.) and the perimeter, it is effective to directly trace the outline of the pattern. Here, a basic method for tracing the outline of this type of pattern will be described.

第1図は撮像デバイス(図示せず)により撮像
されたパターンSを含む2値画像Fを示す。この
画像Fは矢印ARのごとくX方向の走査をY方向
に繰り返すいわゆるラスター走査で得られた画像
信号を、2値化手段(図示せず)を介して各画素
PE毎に2値化した画素データからなり、該画素
データはここではパターンSの領域では“1”、
背景では“0”の値として計算処理装置(図示せ
ず)内の画像メモリ上の、各画素の座標(x,
y)で番地付けされた領域に入力される。以後こ
の画素データをF(x,y)で表わす。
FIG. 1 shows a binary image F including a pattern S captured by an imaging device (not shown). This image F is created by converting an image signal obtained by so-called raster scanning in which scanning in the X direction is repeated in the Y direction as shown by the arrow AR to each pixel through a binarization means (not shown).
Consists of binarized pixel data for each PE, and the pixel data is "1" in the area of pattern S,
In the background, the coordinates (x,
y). Hereinafter, this pixel data will be expressed as F(x,y).

次に前記画像メモリをもとに輪郭の追跡に入
る。まず座標(0,0)の画素POより前記のラ
スター走査のように走査を始めパターンSの領域
の先端面素BOを見付ける。この画素BOの座標
をパターンSの領域の輪郭追跡の起点としての輪
郭画素(第1)とし、また終点になるものとして
記憶する。追跡方向はパターンSを反時計(時
計)方向に廻るものとする。
Next, contour tracking is started based on the image memory. First, scanning is started from the pixel PO at coordinates (0, 0) as in the raster scanning described above, and the tip surface element BO in the area of the pattern S is found. The coordinates of this pixel BO are stored as the contour pixel (first) as the starting point for contour tracing of the area of the pattern S, and as the end point. The tracking direction is assumed to be around the pattern S in a counterclockwise (clockwise) direction.

次に追跡すべき方向を見付けるために画素BO
を一般的な意味で画素Pに置換え、第2図の如く
画素Pを中心とする3×3画素の局部領域を考え
該画素P(以後3×3画素の中心となる画素Pを
一般に着目画素と呼ぶ)を囲む隣接画素A1〜A
8の画素データを下記の座標(番地)により前記
画像メモリから読みとる。すなわち画素Pの座標
を(x,y)とすると、隣接画素A1〜A8の座
標は A1;(x+1,y)、A5;(x−1,y)、 A2;(x+1,y−1)、A6;(x−1,y+
1)、 A3;(x,y−1)、A7;(x,y+1)、 A4;(x−1,y−1)、A8;(x+1,y+1) で表される。
Pixel BO to find the direction to track next
is replaced with pixel P in a general sense, and considering a local region of 3 x 3 pixels centered on pixel P as shown in Fig. ) surrounding adjacent pixels A1 to A
8 pixel data is read from the image memory using the following coordinates (addresses). That is, if the coordinates of pixel P are (x, y), the coordinates of adjacent pixels A1 to A8 are A1; (x+1, y), A5; (x-1, y), A2; (x+1, y-1), A6; (x-1, y+
1), A3; (x, y-1), A7; (x, y+1), A4; (x-1, y-1), A8; (x+1, y+1).

またここで追跡の方向を表すための方向コード
(以下単に方向とも呼ぶ)の定義は第3図に示さ
れる。即ち45゜の間隔で1〜8の数値で表される。
Further, the definition of a direction code (hereinafter simply referred to as direction) for expressing the direction of tracking is shown in FIG. That is, it is expressed as a number from 1 to 8 at intervals of 45 degrees.

さて前記起点(画素BO)からの追跡方向を見
出す方法(初期追跡法と呼ぶ)を述べると、ラス
ター走査が行われて来た方向5にはパターンの存
在に無い訳であるからパターンを前記の様に反時
計(時計)方向に廻るとすると、方向5から反時
計(時計)方向に回転した隣接方向すなわち方向
6,4から順次反時計(時計)方向すなわち方向
7,3→8,2→1,1→…の順に隣接画素A1
〜A8の画素データを調べ始めて“1”に当つた
方向(次方向コード(第2))に進む。この時追
跡方向に隣接する輪郭画素(第2)の座標は第4
図のごとく着目画素としての画素BOの座標
(x,y)に対し、次方向コードによつて定まる
操作量を加えて求められる。
Now, to describe the method of finding the tracking direction from the starting point (pixel BO) (referred to as the initial tracking method), there is no pattern in the direction 5 where raster scanning has been performed, so the pattern is If it rotates in a counterclockwise (clockwise) direction as shown in FIG. Adjacent pixel A1 in the order of 1, 1 →...
- Start examining the pixel data of A8 and proceed in the direction in which "1" is found (next direction code (second)). At this time, the coordinates of the contour pixel (second) adjacent to the tracking direction are the fourth
As shown in the figure, the coordinates (x, y) of the pixel BO as the pixel of interest are determined by adding the operation amount determined by the next direction code.

なお、前記次方向コード(第2)の決定におい
て、決定のための手段面よりの理由から1ステツ
プ無駄とはなるが、方向6,4に代り方向5(−
X方向)より該画素データを調べ始めてもよい。
Note that in determining the next direction code (second), one step is wasted due to the method of determination, but direction 5 (-
The pixel data may be examined starting from the X direction).

次に第3の輪郭画素の追跡方法を述べると、前
記第2の輪郭画素を着目画素として前記と同様に
隣接画素A1〜A8の画素デーダを読みとる。以
後の追跡方向の決定の原則(正常追跡法と呼ぶ)
は、該着目画素に到つた前方向コード(この場合
前記の次方向コード(第2))の方向より時計
(反時計)方向に測つて直角をなす方向(走査開
始方向コードと呼ぶがこれは一般に背景方向に相
当する。)より順次反時計(時計)方向に前記と
同様に隣接画素A1〜A8の画素データを走査
し、始めて“1”に当つた方向(次方向コード
(第3))に進む。またこの時の隣接の第3の輪郭
画素も前記と同様にして求められる。なお第5図
は前記前方向コードと前記走査開始方向コードと
の関係を示す。以後は第2の輪郭画素および次方
向コード(第2)からそれぞれ第3の輪郭画素と
次方向コード(第3)を求めたのと同じ方法で輪
郭を追跡する。
Next, a third contour pixel tracing method will be described. The second contour pixel is set as the pixel of interest, and the pixel data of the adjacent pixels A1 to A8 are read in the same manner as described above. Principles for determining the subsequent tracking direction (referred to as normal tracking method)
is a direction perpendicular to the direction of the previous direction code (in this case, the above-mentioned next direction code (second)) that has arrived at the pixel of interest (this is called the scan start direction code). The pixel data of adjacent pixels A1 to A8 are scanned in the same way as above in the counterclockwise (clockwise) direction, and the direction in which "1" is hit for the first time (the next direction code (third)) Proceed to. Further, the adjacent third contour pixel at this time is also obtained in the same manner as described above. Note that FIG. 5 shows the relationship between the forward direction code and the scanning start direction code. Thereafter, the contour is traced in the same manner as the third contour pixel and the next direction code (third) are obtained from the second contour pixel and the next direction code (second), respectively.

以上の輪郭追跡はパターンを廻りつつ順次求め
られる輪郭画素の座標が前記起点に一致した時に
終了する。
The contour tracing described above ends when the coordinates of the contour pixels, which are sequentially obtained while going around the pattern, coincide with the starting point.

このようにして求められた各輪郭画素の座標や
それらの方向コードから前記のように、輪郭のも
つ細部の特徴や周囲長などが求められる。
From the coordinates of each contour pixel determined in this way and their direction codes, the detailed features and perimeter of the contour are determined as described above.

以上の方法の欠点は追跡すべき一輪郭画素を求
めるたび毎に着目画素とこれに隣接する8画素の
座標と画素データを読み出さねばならず、処理時
間がかかることである。また上記の処理を行うソ
フトウエアを単純にハードウエアで構成しようと
しても構成が複雑になりまた画像メモリへのアク
セス数も多く処理時間の短縮が難しい。
The disadvantage of the above method is that the coordinates and pixel data of the pixel of interest and eight pixels adjacent thereto must be read out each time one contour pixel to be tracked is determined, which takes processing time. Furthermore, even if the software for performing the above processing is attempted to be constructed simply by hardware, the construction will be complicated and the number of accesses to the image memory will be large, making it difficult to shorten the processing time.

本発明の目的と要点 本発明は前記の従来のパターンの輪郭追跡方法
の欠点を排除しハードウエア化の容易で高速処理
の可能なパターンの輪郭追跡方法を提供しようと
するものである。
Objects and Points of the Present Invention The present invention aims to eliminate the drawbacks of the conventional pattern contour tracing methods described above, and to provide a pattern contour tracing method that is easy to implement in hardware and capable of high-speed processing.

本発明の要点はパターンの輪郭追跡の基本原理
は従来と同様ではあるものの、ラスター走査で得
た画像信号を2値化の直列の画素データに変換し
たのち、この直列の画素データをさらに、着目画
素を中心とする3×3画素の局部領域の画素デー
タを該着目画素に対応しその隣接画素の画素デー
タによつて定まる多値画素データ(多値コード)
に変換する多値コード変換手段を介して、多値画
像の形で多値画像メモリに記憶すると共に、輪郭
画素の前記多値コードと該輪郭画素を追跡した前
方向コードとをアドレスとして次に追跡すべき隣
接の輪郭画素への次方向コードが検索可能なよう
にあらかじめ書込まれた次方向検索手段より次方
向コードを直ちに検索するようにした点にある。
The key point of the present invention is that, although the basic principle of pattern contour tracking is the same as the conventional one, after converting the image signal obtained by raster scanning into binarized serial pixel data, this serial pixel data is further processed. Multi-value pixel data (multi-value code) that corresponds to the pixel of interest in a local area of 3×3 pixels centered on the pixel and is determined by the pixel data of its adjacent pixels.
is stored in a multi-value image memory in the form of a multi-value image through a multi-value code conversion means that converts the multi-value code into a multi-value image, and the multi-value code of the contour pixel and the forward code that traced the contour pixel are used as addresses and then The next direction code is immediately searched by the next direction search means written in advance so that the next direction code to the adjacent contour pixel to be tracked can be searched.

本発明の実施例 第6図は本発明の主要部の構成を示すブロツク
図である。すなわち、601は多値コードエンコ
ーダ、602は多値画像メモリ、603はメモリ
走査部、604は終了監視部、605は次方向検
索手段、605aは次方向テーブル、605bは
前方向コードラツチである。次に第6図の動作を
第7〜9図を参照して述べると、多値コードエン
コーダ601は第1図に示す2値画像Fを次に述
べるように第7図にような該2値画素Fの各座標
点に対応した多値コードからなる多値画像FMに
変換する。
Embodiment of the present invention FIG. 6 is a block diagram showing the configuration of the main part of the present invention. That is, 601 is a multi-value code encoder, 602 is a multi-value image memory, 603 is a memory scanning section, 604 is an end monitoring section, 605 is a next direction search means, 605a is a next direction table, and 605b is a forward direction code latch. Next, the operation of FIG. 6 will be described with reference to FIGS. 7 to 9. The multilevel code encoder 601 converts the binary image F shown in FIG. 1 into the binary image F shown in FIG. The pixel F is converted into a multivalued image FM consisting of multivalued codes corresponding to each coordinate point.

ここで多値コードエンコーダ601の内部構成
は第8図のようになつている。第8図において8
01は局部レジスタとしての3ビツトシフトレジ
スタ、802はX,Y方向の走査画素数より該局
部レジスタ801のビツト数3だけ少いビツト長
を持つ、残部レジスタとしての多ビツトシフトレ
ジスタである。局部レジスタ801はラスター走
査によつて直列に連なつた2値画像Fが矢印AR
8の順に入力されてシフトして行くので、この3
つの局部レジスタの9つの画素データは図の都合
で上下左右を反転した形になつているが丁度、着
目画素Pを中心とする前記2値画像Fの中の3×
3画素の局部領域の画素データとなり、着目画素
Pがラスター走査によつて2値画像Fの各座標を
順次移動するので、あたかも3×3画素分の窓
で、2値画像Fの各座標点をラスター走査するよ
うな形になる。但し着目画素Pの座標が2値画像
Fの画面の縁端部2行または2列分に入る場合の
前記3×3画素分の画素データ従つてこの多値コ
ード(後述)は不正値が入るので無視し、この場
合“OOH”とする。
Here, the internal configuration of the multi-level code encoder 601 is as shown in FIG. 8 in Figure 8
01 is a 3-bit shift register as a local register, and 802 is a multi-bit shift register as a remaining register, which has a bit length smaller by 3 bits of the local register 801 than the number of scanning pixels in the X and Y directions. In the local register 801, the binary images F connected in series by raster scanning are shown by the arrow AR.
Since it is input in the order of 8 and shifted, these 3
The nine pixel data in the two local registers are inverted vertically and horizontally for convenience of illustration, but they correspond to the 3×
This is pixel data for a local area of 3 pixels, and since the pixel P of interest sequentially moves through each coordinate of the binary image F by raster scanning, it is as if each coordinate point of the binary image F is a window of 3 x 3 pixels. It will be shaped like raster scanning. However, if the coordinates of the pixel P of interest fall within two rows or two columns of the edge of the screen of the binary image F, the pixel data for the 3 x 3 pixels will therefore contain an incorrect value in this multi-value code (described later). Therefore, ignore it and write “OOH” in this case.

次にこのようにして得られる局部領域の画素デ
ータをどのように前記多値コードに変換するかを
述べると、着目画素Pに対する隣接画素はA1〜
A8の8つである。今着目画素P内の画素データ
が“O”(背景)の場合、第8図においてANDゲ
ート803によつて該画素データと隣接画素A1
〜A8内の各画素データとはAND条件がとられ
るので該各画素データの値の如何にかかわらず多
値コードラツチ804内の値b0〜b7は
“OOH”となつて出力される。着目画素P内の画
素データが“1”(パターン)の場合は隣接画素
A1〜A8内の各画素データが多値コードラツチ
804内の値b0〜b7に夫夫対応して8ビツト
の情報として出力される。これが前述の多値コー
ドであり、第6図における多値コードエンコーダ
601の出力となり該多値コードエンコーダ60
1の入力に同期して多値画素メモリ602に書込
まれ第7図多値画像FMの形で記憶される。今、
多値画像FM上の座標(x,y)における着目画
素(前者と呼ぶ)の多値コードをFM(x,y)
で表わすと該着目画素は第1図2値画像F上の座
標(x,y)における着目画素(後者と呼ぶ)に
対応しており後者の着目画素の隣接画素の画素デ
ータがFM(x,y)となつている。
Next, to describe how to convert the pixel data of the local area obtained in this way into the multi-level code, the adjacent pixels to the pixel of interest P are A1 to
It is 8 of A8. When the pixel data in the current pixel P is “O” (background), in FIG. 8, the pixel data and the adjacent pixel A1 are
Since an AND condition is applied to each pixel data in -A8, the values b0 to b7 in the multi-value code latch 804 are output as "OOH" regardless of the value of each pixel data. When the pixel data in the pixel of interest P is "1" (pattern), each pixel data in the adjacent pixels A1 to A8 corresponds to the values b0 to b7 in the multi-value code latch 804 and is output as 8-bit information. be done. This is the multi-value code mentioned above, and becomes the output of the multi-value code encoder 601 in FIG.
It is written into the multi-value pixel memory 602 in synchronization with the input of 1 and stored in the form of the multi-value image FM shown in FIG. now,
The multi-value code of the pixel of interest (referred to as the former) at the coordinates (x, y) on the multi-value image FM is expressed as FM(x, y)
The pixel of interest corresponds to the pixel of interest (referred to as the latter) at the coordinates (x, y) on the binary image F in FIG. y).

すなわち多値画像FMは2値画像Fと大きさが
等しく各座標点が対応しており後者の1ビツトの
画素データF(x,y)に代り8ビツトのFM
(x,y)を持つ。また以上の説明から明らかな
ように多値画像FM内の多値パターンSMの形は
2値画像F内のパターンSと全く等しい。なお第
7図では各座標点の多値コードFM(x,y)は
16進数表現で示されている。
In other words, the multi-valued image FM has the same size as the binary image F, and each coordinate point corresponds to the other, and instead of the 1-bit pixel data F(x,y) in the latter, 8-bit FM is used.
It has (x, y). Furthermore, as is clear from the above description, the shape of the multivalued pattern SM in the multivalued image FM is exactly the same as the pattern S in the binary image F. In addition, in Fig. 7, the multivalued code FM (x, y) of each coordinate point is
Shown in hexadecimal representation.

なおこの場合多値画像メモリ602の1画素へ
のアクセスは従来の2値の画像メモリの9画素分
へのアクセスに対応する。つまり隣接画素A1〜
A8の8画素分(8ビツト)と着目画素P自体
(“0”か“1”の1ビツト)の分である。
In this case, accessing one pixel of the multilevel image memory 602 corresponds to accessing nine pixels of the conventional binary image memory. In other words, adjacent pixels A1~
These are 8 pixels (8 bits) of A8 and the pixel P of interest itself (1 bit of "0" or "1").

ところで従来技術で説明したように着目画素で
ある輪郭画素から次の隣接の輪郭画素への追跡方
向(次方向コード)は、着目画素とその隣接画素
だけでは定まらず着目画素に到つた前方向コード
を知つて始めて定められる。すなわち第6図にお
いて次方向テーブル605aは多値画像メモリ6
02から得られる隣接画素の情報8ビツトと前方
向コードラツチ605bの出力である前方向コー
ド(8方向、3ビツト情報)の計11ビツトの入力
によつてアクセスされる、ROMまたはRAMか
らなる検索テーブルであり、内には前記11ビツト
の各値に対する次の追跡方向の次方向コードがあ
らかじめ書込まれており、該次方向コードが3ビ
ツトとして即座に出力される。ただしこの出力は
多値画像メモリ602をアクセスするアドレスを
発生するメモリ走査部603、および前方向コー
ドラツチ605bに入力され、多値画像メモリ6
02への書込み時と、パターンの輪郭を追跡する
追跡処理の際に共に利用されるようになつてい
る。従つて次方向テーブル605aは、多値画像
メモリ602への多値コードFM(x,y)の書
込みの際と、前記追跡処理においてFM(x,y)
の値が“OOH”(背景部)の際は走査をX,Y方
向に+1する方向コード“1”を出力するように
なつている。
By the way, as explained in the prior art, the tracking direction (next direction code) from a contour pixel that is a pixel of interest to the next adjacent contour pixel is not determined only by the pixel of interest and its adjacent pixels, but is determined by the forward direction code that reaches the pixel of interest. It can only be determined by knowing the That is, in FIG. 6, the next direction table 605a is the multilevel image memory 6.
A search table made of ROM or RAM that is accessed by a total of 11 bits of input, including 8 bits of adjacent pixel information obtained from 02 and the forward code (8 directions, 3 bit information) output from the forward code latch 605b. The next direction code for the next tracking direction for each of the 11-bit values is written in advance, and the next direction code is immediately output as 3 bits. However, this output is input to a memory scanning unit 603 that generates an address for accessing the multilevel image memory 602, and a forward code latch 605b.
It is designed to be used both when writing to 02 and during tracking processing to trace the outline of a pattern. Therefore, the next direction table 605a stores the FM (x, y) when writing the multi-value code FM (x, y) to the multi-value image memory 602 and during the tracking process.
When the value of is "OOH" (background part), a direction code "1" is output which increases the scanning by +1 in the X and Y directions.

第9図は次方向テーブル605aの内容の一部
分を示す。これは従来技術の項で述べた正常追跡
法を基にした内容である。すなわち5種のメモリ
の内容をもつ局部領域LAと、該局部領域LAに対
応する多値コードTA1と、3種の前方向コード
(1,5,6)TA2と、該多値コードTA1と該
前方向コードTA2の組合せの一部としてのテー
ブルアドレスTAにより、次方向テーブル605
aから検索されるテーブル出力としての8例の次
方向コードTOの対応関係が示される。ただしこ
の図はパターン輪郭を反時計方向に追跡する場合
の例である。なお第9図の適用例は後述する。
FIG. 9 shows part of the contents of the next direction table 605a. This is based on the normal tracking method described in the prior art section. That is, a local area LA having five types of memory contents, a multilevel code TA1 corresponding to the local area LA, three types of forward codes (1, 5, 6) TA2, and the multilevel code TA1 and the corresponding multilevel code TA1. Table address TA as part of the combination of forward code TA2 causes next direction table 605
The correspondence of eight examples of next direction codes TO as table outputs retrieved from a is shown. However, this figure is an example in which the pattern outline is tracked counterclockwise. An application example of FIG. 9 will be described later.

再び第6図において前記メモリ走査部603は
例えば次方向テーブル605aの次方向コードの
出力に対応して第4図に示したような操作量を得
るテーブルと、操作後のx座標およびy座標を得
るための加減算累計値を保持する累算器(図示せ
ず)とからなつている。従つてメモリ走査部60
3は前記のごとく多値画像FMを多値画像メモリ
602に記憶させるときは次方向テーブル605
aの出力によりx座標を+1づつ進め、X方向の
全画素数を越えるとy座標が+1され、X方向走
査は再び左端より開始されるように動作し、ラス
ター走査と等価なメモリ走査を行なう。このよう
にして2値画像F内の各座標点(x,y)上の2
値の画素データF(x,y)は多値画像FM内の
各座標点(x,y)上に、多値コードFM(x,
y)として変換される。
Again in FIG. 6, the memory scanning unit 603 generates a table for obtaining the operation amount as shown in FIG. 4 in response to the output of the next direction code of the next direction table 605a, and the x and y coordinates after the operation. It consists of an accumulator (not shown) that holds the accumulated value of additions and subtractions. Therefore, the memory scanning section 60
3 is the next direction table 605 when storing the multi-value image FM in the multi-value image memory 602 as described above.
The output of a advances the x coordinate by +1, and when the total number of pixels in the . In this way, 2 on each coordinate point (x, y) in the binary image F
The value pixel data F (x, y) is added to the multi-value code FM (x, y) on each coordinate point (x, y) in the multi-value image FM.
y).

次に多値画像メモリ602内の多値画像FMに
もとづいてパターンの追跡処理を行う場合のメモ
リ走査部603の動作を第7図を参照しつつ説明
する。この場合の多値画像メモリ602へのメモ
リ走査は記憶時と異なりランダムアクセスとな
る。すなわち追跡処理開始時、メモリ走査部60
3内のアクセス座標(x,y)に対応する前記累
算器の値は(0,0)にセツトされる。ついで多
値画像メモリ602内の番地、換言すれば第7図
PO点座標(0,0)のメモリ(多値コード)が
読み出される。該多値コードが次方向テーブル6
05aに入力され次方向テーブル605aから次
方向コードが出力される。前述のごとく座標
(x,y)点の多値コードFM(x,y)が
“OOH”の時は該出力値はX方向走査を+1する
ような方向コードとなり、またY方向の走査につ
いてもメモリ走査部603は多値画像メモリ60
2への書込みの場合と同じように動作する。従つ
て多値コードFM(x,y)が“OOH”でない座
標点第7図BOまではラスター走査によつて走査
追跡が行われる。該座標点BOは前述におけるパ
ターン輪郭追跡の起点であり以後輪郭に沿つたラ
ンダムアクセスが実行される。終了監視部604
は多値画像メモリ602の出力すなち多値コード
FM(x,y)を監視して、該多値コードが始め
て“OOH”でない値となつた前記起点BOの座標
を記憶し、以後輪郭の追跡処理実行中はメモリ走
査部603の出力座標を監視して、該出力座標が
起点BOの座標に一致すれば輪郭追跡を一周完了
したとして追跡処理を終了させる。また記点BO
では前記終了監視部604は前方向コードラツチ
605bに起点であることを知らせる起点信号を
送り、パターン輪郭追跡方向が反時計(時計)廻
りの場合便宜上仮想の前方向コードとして“8,
2”を出力させる。これは次方向テーブル605
aのメモリ内容が従来技術の項で述べた正常追跡
法に基づいて次方向コードを検索するようになつ
ているためで、このようにすれば起点における多
値コードと前記前方向コード“8,2”のアドレ
スにより次方向テーブル605aは従来技術の項
で述べた走査開始方向コードが“6,4”に等し
い形で動作、換言すれば追跡方向を“6,4”の
方向から反時計(時計)方向に走査して見出す形
の新方向コードを出力する。従つてこれは従来技
術の項で述べた起点(第1輪郭画素)から第2輪
郭画素を追跡する方法と等価になる。なおこの場
合も前記従来技術の項で附言したように、走査開
始方向コードを“5(−X方向)”に対応させる形
すなわち上記前方向コード“8,2”に代り
“7,3”としてもよい。
Next, the operation of the memory scanning section 603 when performing pattern tracking processing based on the multivalued image FM in the multivalued image memory 602 will be described with reference to FIG. In this case, memory scanning to the multivalued image memory 602 is a random access, unlike when storing data. That is, at the start of the tracking process, the memory scanning unit 60
The value of the accumulator corresponding to access coordinates (x,y) in 3 is set to (0,0). Next, the address in the multivalued image memory 602, in other words, the address in FIG.
The memory (multi-value code) of PO point coordinates (0, 0) is read out. The multi-value code is the next direction table 6
05a, and the next direction code is output from the next direction table 605a. As mentioned above, when the multi-value code FM (x, y) of the coordinate (x, y) point is "OOH", the output value becomes a direction code that increases the X direction scan by +1, and also for the Y direction scan. The memory scanning unit 603 is a multilevel image memory 60
It operates in the same way as writing to 2. Therefore, scanning and tracing is performed by raster scanning up to the coordinate point BO in FIG. 7 where the multivalued code FM (x, y) is not "OOH". The coordinate point BO is the starting point for tracing the pattern outline described above, and thereafter random access is performed along the outline. Termination monitoring unit 604
is the output of the multi-value image memory 602, that is, the multi-value code
FM (x, y) is monitored, the coordinates of the starting point BO where the multi-valued code first becomes a value other than "OOH" are stored, and the output coordinates of the memory scanning unit 603 are thereafter stored while the contour tracking process is being executed. If the output coordinates match the coordinates of the starting point BO, it is determined that one round of contour tracing has been completed and the tracing process is terminated. Also note BO
Then, the end monitoring unit 604 sends a starting point signal to the forward code latch 605b to inform it that it is the starting point, and when the pattern contour tracing direction is counterclockwise (clockwise), a virtual forward code is set as "8," for convenience.
2” is output. This is the next direction table 605.
This is because the memory contents of a are designed to search for the next direction code based on the normal tracking method described in the prior art section. 2'' address causes the next direction table 605a to operate in such a manner that the scanning start direction code described in the prior art section is equal to ``6,4'', in other words, the tracking direction is changed counterclockwise from the direction of ``6,4'' ( Outputs a new direction code that is found by scanning in the clockwise direction. Therefore, this method is equivalent to the method of tracing the second contour pixel from the starting point (first contour pixel) described in the prior art section. In this case as well, as mentioned in the prior art section, the scanning start direction code is made to correspond to "5 (-X direction)", that is, the forward direction code is "7,3" instead of "8,2". You can also use it as

また上記の方法とは全く別に次方向テーブル6
05aのメモリ量の増大や回路構成の若干の複雑
化を承知の上で、従来技術の項で述べた初期追跡
法に基づいて、起点からの次方向コード(第2)
のみを見出す専用のメモリ領域を、正常追跡法の
メモリ領域とは別に次方向テーブル605a内に
設け、次方向コード(第2)のみは前記終了監視
部604からの起点信号と起点BOの多値コード
とをアドレスとして、次方向テーーブル605a
の前記専用のメモリ領域から見出す方法を取つて
もよく、この思想も本発明に含まれる。
In addition, completely apart from the above method, the next direction table 6
05a, the next direction code (second) from the starting point is based on the initial tracking method described in the prior art section, while being aware that the memory amount of 05a is increased and the circuit configuration is slightly complicated.
A dedicated memory area for finding the code is provided in the next direction table 605a separately from the memory area for the normal tracking method, and only the next direction code (second) is based on the starting point signal from the end monitoring unit 604 and the multi-valued starting point BO. code and the next direction table 605a as an address.
A method may be adopted in which the information is found from the dedicated memory area, and this idea is also included in the present invention.

次方向コード(第2)の決定以後からは前方向
コードラツチ605bは次方向テーブル605a
の出力をラツチして次の輪郭画素の方向追跡のた
めの前方向コードとして出力する。
After the next direction code (second) is determined, the forward direction code latch 605b is set to the next direction table 605a.
The output of is latched and output as a forward code for direction tracking of the next contour pixel.

このようにして行つた輪郭追跡の例を第7図、
第9図および第1図で示す。すなわち、第7図の
多値パターンSM上の輪郭画素内の多値コードの
うち、TA11〜TA14は第9図の多値コード
TA1内の同符号と対応し、パターンの輪郭を反
時計方向に廻るとき、上記多値コードTA11〜
TA14に対応する各例示輪郭画素の部分の輪郭
追跡の方向は、第9図におけるそれぞれの前方向
コードTA2に対応した次方向コードTOの方向
に一致している。また第1図では上記例示輪郭画
素を中心とする局部領域第9図LA1〜LA4を同
符号で対応して示し、同時に上記の各例示輪郭画
素を中心とする輪郭追跡の方向を矢印で示してい
る。以上のような構成と機能により輪郭追跡の起
点から終点までの間メモリ走査部603および次
方向テーブル605aの出力を他のメモリ(図示
せず)に記憶すれば各輪郭点(画素)の位置(座
標)と方向のリスト情報が得られ、また起点から
終点までの追跡処理回数を数えることにより輪郭
部(境界点)画素数が得られる。なお特に高速に
これらの処理を行うことができる。
Figure 7 shows an example of contour tracking performed in this way.
This is shown in FIGS. 9 and 1. That is, among the multi-value codes in the contour pixels on the multi-value pattern SM in FIG. 7, TA11 to TA14 are the multi-value codes in FIG.
Corresponding to the same code in TA1, when going around the outline of the pattern in a counterclockwise direction, the above multivalued code TA11~
The direction of contour tracing of the portion of each example contour pixel corresponding to TA14 corresponds to the direction of the next direction code TO corresponding to the respective forward direction code TA2 in FIG. In addition, in FIG. 1, the local areas LA1 to LA4 in FIG. 9 centered on the above-mentioned exemplary contour pixels are indicated by the same reference numerals, and at the same time, the direction of contour tracking centered on each of the above-mentioned exemplary contour pixels is indicated by arrows. There is. With the above configuration and functions, if the outputs of the memory scanning unit 603 and the next direction table 605a are stored in another memory (not shown) from the start point to the end point of contour tracking, the position of each contour point (pixel) ( List information of coordinates) and directions is obtained, and the number of pixels of the contour part (boundary point) is obtained by counting the number of tracking processes from the starting point to the ending point. Note that these processes can be performed particularly at high speed.

本実施例では8隣接画素の場合を説明したが、
4隣接画素の場合でも同様なことが可能であり本
発明に含まれる。なおこの4隣接画素の場合は第
2図にて隣接画素A1,A3,A5,A7を用い
て多値コード化を行う形となる。
In this example, the case of 8 adjacent pixels was explained, but
The same thing is possible in the case of four adjacent pixels and is included in the present invention. In the case of four adjacent pixels, multi-level coding is performed using adjacent pixels A1, A3, A5, and A7 in FIG. 2.

以上の実施例ではパターンの輪郭を一周して完
了するものとしたが、例えば“一ふでがき”や文
字認識などでは途中で一旦追跡を区切りつつ進め
ることがある。すなわち入力画像を細線化した後
のパターンに対して線引きストロークの分離を行
なう時、前記実施例における起点を端点(多値コ
ードが特殊値となる)にとり細線の追跡を行な
い、終点として新たな端点または交差点を取ると
言うように行なうことにより効率的にストローク
の分離の実施ができる。
In the embodiments described above, the pattern is completed by going around the outline of the pattern once, but for example, in the case of "one-step writing" or character recognition, tracking may be temporarily interrupted and proceeded. In other words, when separating the drawing strokes for a pattern after thinning the input image, the starting point in the above embodiment is taken as the endpoint (the multi-value code becomes a special value), the thin line is traced, and a new endpoint is set as the end point. Alternatively, stroke separation can be efficiently performed by taking an intersection.

前記説明中パターン追跡を反時計廻りとするか
時計廻りとするかにより変化する語や数値は括弧
外が反時計廻りの場合、括弧内が時計廻りの場合
を示す。また水平,垂直、あるいはX方向、Y方
向の関係はそれぞれ互に入れ替つても本発明の思
想には無関係なことは自明であろう。
In the above description, words and numerical values that change depending on whether the pattern is traced counterclockwise or clockwise are shown outside the parentheses when the pattern is traced counterclockwise, and those inside the parentheses when the pattern is traced clockwise. Furthermore, it is obvious that even if the horizontal, vertical, or X-direction and Y-direction relationships are interchanged, they are irrelevant to the idea of the present invention.

発明の効果と応用分野 本発明によればパターンの輪郭追跡を行う前処
理として2値画像内の各画素の画素データを、該
画素を中心とする局部領域の画素データを表現す
る多値コードに変換する多値コード変換手段の適
用により、例えば8つの隣接画素の場合輪郭追跡
処理において画像メモリへの1アクセスが従来の
9アクセスと同等となると同時に、さらに着目の
輪郭画素に対する多値コードとその着目画素への
前方向コードとから次方向コードを検索する次方
向検索手段を利用することにより1画像毎に行う
べき輪郭追跡処理が極めて高速に実施できること
となり、従来の輪郭追跡処理における基本的な問
題点を排除することが可能となる。
Effects of the Invention and Field of Application According to the present invention, as a preprocessing for tracing the outline of a pattern, the pixel data of each pixel in a binary image is converted into a multi-value code representing the pixel data of a local area centered on the pixel. By applying the multi-value code conversion means, for example, in the case of eight adjacent pixels, one access to the image memory in contour tracking processing is equivalent to nine accesses in the past, and at the same time, the multi-value code for the contour pixel of interest and its By using the next direction search means that searches for the next direction code from the previous direction code for the pixel of interest, the contour tracking process that should be performed for each image can be performed at extremely high speed. It becomes possible to eliminate problems.

本発明は画像を使用した計測、検査、位置決め
制御、文字認識など、各種の分野に、基本的な方
式として広く適用することができる。
The present invention can be widely applied as a basic method to various fields such as measurement using images, inspection, positioning control, and character recognition.

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

第1図は従来の2値画像の例を示す図、第2図
は局部領域の説明図、第3図は方向コードの説明
図、第4図は次方向コードと着目画素の座標値へ
の操作量との関係を示す図、第5図は正常追跡法
において次方向コードを求めるために走査を開始
すべき開始方向を与える走査開始方向コードと前
方向コードとの関係を示す図、第6図は本発明の
主要部の構成を示すブロツク図、第7図は本発明
による第1図に対応した多値画像を示す図、第8
図は本発明における多値コード変換手段の内容を
示す図、第9図は本発明における次方向テーブル
の内容の一部を示す図である。 符号説明、601……多値コードエンコーダ、
602……多値画像メモリ、603……メモリ走
査部、604……終了監視部、605……次方向
検索手段、605a……次方向テーブル、605
b……前方向コードラツチ、F……2値画像、S
……パターン、BO……起点、P……着目画素、
A1〜A8……隣接画素、FM……多値画像、
SM……多値パターン。
Fig. 1 is a diagram showing an example of a conventional binary image, Fig. 2 is an explanatory diagram of a local area, Fig. 3 is an explanatory diagram of a direction code, and Fig. 4 is an illustration of the next direction code and the coordinate value of the pixel of interest. FIG. 5 is a diagram showing the relationship between the operation amount and the forward direction code, and FIG. The figure is a block diagram showing the configuration of the main part of the present invention, FIG. 7 is a diagram showing a multivalued image corresponding to FIG. 1 according to the present invention, and FIG.
9 is a diagram showing the contents of the multi-value code conversion means in the present invention, and FIG. 9 is a diagram showing part of the contents of the next direction table in the present invention. Code explanation, 601...Multi-value code encoder,
602...Multi-valued image memory, 603...Memory scanning section, 604...End monitoring section, 605...Next direction search means, 605a...Next direction table, 605
b...Forward code latch, F...Binary image, S
...Pattern, BO...Starting point, P...Pixel of interest,
A1 to A8...adjacent pixels, FM...multivalued image,
SM...Multi-value pattern.

Claims (1)

【特許請求の範囲】 1 水平(垂直)方向(X方向と呼ぶ)の走査を
垂直(水平)方向(Y方向と呼ぶ)に繰り返して
得られる画像信号を2値化の直列の画素データに
変換する2値化手段、着目画素の該画素データと
該着目画素を包囲する隣接画素の前記画素データ
を前記着目画素に対する多値画素データ(多値コ
ードと呼ぶ)に変換する多値コード変換手段、該
多値コードからなる多値画像を記憶する多値画像
記憶手段、およびパターンの任意の輪郭画素(甲
と呼ぶ)から隣接の輪郭画素への追跡方向を示す
次方向コードを出力する次方向検索手段を備え、
該次方向検索手段へのアドレスとして前記輪郭画
素(甲)の前記多値コードを入力すると共に、該
輪郭画素(甲)がパターン輪郭追跡の起点である
ときは該起点であることを識別するための起点信
号を入力し、前記輪郭画素(甲)が前記起点でな
いときは、前記甲の輪郭画素を追跡した隣接の輪
郭画素からの追跡方向を示す前方向コードを入力
することを特徴とするパターンの輪郭追跡方法。 2 特許請求の範囲第1項に記載のパターンの輪
郭追跡方法において、前記起点信号として、−X
(−Y)方向またはその隣接方向の方向コードが
走査開始方向コードの関係にある追跡方向による
仮想の前方向コードを入力することを特徴とする
パターンの輪郭追跡方法。
[Claims] 1. Converting an image signal obtained by repeating scanning in the horizontal (vertical) direction (referred to as the X direction) in the vertical (horizontal) direction (referred to as the Y direction) to binary serial pixel data. a binarization means for converting the pixel data of the pixel of interest and the pixel data of adjacent pixels surrounding the pixel of interest into multi-value pixel data (referred to as a multi-value code) for the pixel of interest; A multi-value image storage means for storing a multi-value image made up of the multi-value code, and a next direction search for outputting a next direction code indicating the tracking direction from an arbitrary contour pixel (referred to as A) of the pattern to an adjacent contour pixel. have the means,
Inputting the multivalued code of the contour pixel (A) as an address to the next direction search means, and identifying that the contour pixel (A) is the starting point when it is the starting point of pattern contour tracing. A pattern characterized in that a starting point signal is inputted, and when the contour pixel (A) is not the starting point, a forward direction code indicating a tracking direction from an adjacent contour pixel that traced the contour pixel of the instep is inputted. Contour tracking method. 2. In the pattern contour tracing method according to claim 1, the starting point signal is -X
1. A method for tracing contours of a pattern, comprising inputting a virtual forward code in a tracking direction in which a direction code in the (-Y) direction or an adjacent direction is in a relationship with a scan start direction code.
JP58009108A 1983-01-21 1983-01-21 Pattern contour tracing method Granted JPS59135579A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP58009108A JPS59135579A (en) 1983-01-21 1983-01-21 Pattern contour tracing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP58009108A JPS59135579A (en) 1983-01-21 1983-01-21 Pattern contour tracing method

Publications (2)

Publication Number Publication Date
JPS59135579A JPS59135579A (en) 1984-08-03
JPH0130180B2 true JPH0130180B2 (en) 1989-06-16

Family

ID=11711428

Family Applications (1)

Application Number Title Priority Date Filing Date
JP58009108A Granted JPS59135579A (en) 1983-01-21 1983-01-21 Pattern contour tracing method

Country Status (1)

Country Link
JP (1) JPS59135579A (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4538299A (en) * 1981-12-04 1985-08-27 International Remote Imaging Systems, Inc. Method and apparatus for locating the boundary of an object
JPS6170667A (en) * 1984-09-13 1986-04-11 Matsushita Electric Ind Co Ltd Line image forming device
JPS61143885A (en) * 1984-12-18 1986-07-01 Matsushita Electric Ind Co Ltd Linear picture producer
JPS61267880A (en) * 1985-05-22 1986-11-27 Tech Res & Dev Inst Of Japan Def Agency Measuring device for feature of picture
JPS63188286A (en) * 1987-01-30 1988-08-03 Ricoh Co Ltd Method for extracting feature of image contour part
JP2639412B2 (en) * 1987-06-01 1997-08-13 株式会社鷹山 Image processing method
JP2954218B2 (en) * 1988-04-19 1999-09-27 キヤノン株式会社 Image processing method and apparatus
JPH07104932B2 (en) * 1989-04-26 1995-11-13 シャープ株式会社 How to create character image data
US5265173A (en) * 1991-03-20 1993-11-23 Hughes Aircraft Company Rectilinear object image matcher

Also Published As

Publication number Publication date
JPS59135579A (en) 1984-08-03

Similar Documents

Publication Publication Date Title
US5048096A (en) Bi-tonal image non-text matter removal with run length and connected component analysis
JPH0436627B2 (en)
JPH0130180B2 (en)
WO2004084138A2 (en) A method for contour extraction for object representation
CN112419372A (en) Image processing method, image processing device, electronic equipment and storage medium
US5228097A (en) Method for registering image data
CN108876701B (en) Run-length-based single-scanning connected domain marking method and hardware structure thereof
JP2000242798A (en) Extraction of feature quantity of binarty image
JP2846486B2 (en) Image input device
JPH03177982A (en) Image processing method
JP2522511B2 (en) Image contour tracking unit
JP3008438B2 (en) Binary image coding device
KR100295245B1 (en) A parallel thinning method using weighted value
JPH04112276A (en) Binary picture contour line chain encoding device
JP3037504B2 (en) Image processing method and apparatus
JP2910295B2 (en) Contour information extraction device
Jianghong et al. An algorithm for eliminating the isolated regions based on connected area in image classification
CN113642588A (en) Method for analyzing crawler on outer edge of planar image object
JPH05143733A (en) Contour extracting device
JPS6140683A (en) Contour tracking device
JPH067389B2 (en) Image processing device
JPH03168889A (en) Character recognizing device
JPS6349982A (en) Coding processing system for three adjacent picture elements
JPH057751B2 (en)
JPH053627B2 (en)