Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JPH07104941B2 - Labeling method - Google Patents
[go: Go Back, main page]

JPH07104941B2 - Labeling method - Google Patents

Labeling method

Info

Publication number
JPH07104941B2
JPH07104941B2 JP63026390A JP2639088A JPH07104941B2 JP H07104941 B2 JPH07104941 B2 JP H07104941B2 JP 63026390 A JP63026390 A JP 63026390A JP 2639088 A JP2639088 A JP 2639088A JP H07104941 B2 JPH07104941 B2 JP H07104941B2
Authority
JP
Japan
Prior art keywords
point
pixel
connected component
detected
row
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
JP63026390A
Other languages
Japanese (ja)
Other versions
JPH01201783A (en
Inventor
伸治 林
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 JP63026390A priority Critical patent/JPH07104941B2/en
Publication of JPH01201783A publication Critical patent/JPH01201783A/en
Publication of JPH07104941B2 publication Critical patent/JPH07104941B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Image Analysis (AREA)

Description

【発明の詳細な説明】 (産業上の利用分野) 本発明はラベリング方法にかかり、詳しくは、2値画像
を用いた解析や計測等の前処理作業として、「1−画
素」(画素ありを示す論理“1"の画素)が複数連結され
てなる多数の連結成分に対して、それぞれ固有の連続し
たラベル値を高速で付与できるようにしたラベリング方
法に関する。
DETAILED DESCRIPTION OF THE INVENTION (Industrial field of application) The present invention relates to a labeling method, and more specifically, as a preprocessing operation such as analysis and measurement using a binary image, “1-pixel” The present invention relates to a labeling method capable of giving a unique continuous label value at high speed to a large number of connected components formed by connecting a plurality of logical "1" pixels shown in FIG.

(従来の技術) 従来、この種のラベリング方法としては、第4図に示す
ものが知られている。
(Prior Art) Conventionally, a labeling method shown in FIG. 4 has been known as this type of labeling method.

すなわち、同図において、100は「1−画素」及び「0
−画素」(背景を示す論理“0"の画素)からなる2値画
像であり、ラベリングに際しては、まず、2値画像100
を画面の左上から矢印201で示されるようにラスタ走査
していき、ラベルが付けられていない「1−画素」を検
出するとこの画素に未使用のラベル値、例えば「1」を
付ける。そして、この画素を中心として、上下左右の4
方向に連続している4連結または上下左右及び斜めの8
方向に連続している8連結の「1−画素」を、矢印202
で示される近傍走査により探索して同一のラベル値を付
ける。
That is, in the figure, 100 is "1-pixel" and "0."
-Pixel "(pixel of logical" 0 "indicating the background), and when labeling, first, the binary image 100
Is raster-scanned from the upper left of the screen as indicated by an arrow 201, and when an unlabeled "1-pixel" is detected, an unused label value, for example, "1" is attached to this pixel. Then, with this pixel as the center,
4 connections that are continuous in the direction or up and down, left and right and diagonal 8
The 8-connected “1-pixel” that is continuous in the direction is indicated by the arrow 202.
The same label value is given by searching by the neighborhood scan shown by.

更に、これらの連結画素を中心とした4連結または8連
結の「1−画素」にも同一のラベル値を付ける処理を繰
返し、連結されている「1−画素」がなくなったときに
1つの連結成分301に対するラベリングを終了する。
Further, the process of assigning the same label value to "1-pixels" of 4-connection or 8-connection centered on these connection pixels is repeated, and when there is no "1-pixel" connected, one connection is made. Finish labeling for component 301.

こうして連結成分301に対するラベリングが終了する
と、再び2値画像100のラスタ走査を続行し、まだラベ
ルの付いていない「1−画素」を検出したならば新たな
ラベル値「2」を付けて連結成分302につき前記同様の
処理を行う。以上の処理を残りの連結成分303について
も繰り返すことにより、2値画像100全体のラスタ走査
を終了した時点で一連のラベリング処理を完了するもの
である。
When the labeling of the connected component 301 is completed in this way, the raster scanning of the binary image 100 is continued again, and if "1-pixel" which is not yet labeled is detected, a new label value "2" is added and the connected component is added. For 302, the same processing as above is performed. By repeating the above processing for the remaining connected components 303, a series of labeling processing is completed when the raster scanning of the entire binary image 100 is completed.

しかるにこの方式では、「1−画素」を検出してから4
連結または8連結している別の「1−画素」を検出する
ために、1つの画素について4回または8回の画素値の
読み込みが必要になり、メモリへのアクセス数が多いこ
とから処理に多くの時間を必要としていた。
However, in this method, 4 is detected after "1-pixel" is detected.
In order to detect another "1-pixel" that is connected or 8-connected, it is necessary to read the pixel value four times or eight times for one pixel, and the number of accesses to the memory is large, so processing is possible. I needed a lot of time.

一方、2値画像の走査回数を減らすために、第5図に示
すようなラベリング方法が提案されている。この方式で
は、まず、2値画像100Aをラスタ走査してラベルの付い
ていない「1−画素」を検出すると、隣接点を調べる。
そして、すべての隣接点にまだラベルが付いていない場
合には新たなラベル値を付け、「0−画素」以外で同一
のラベル値が付いていればそれと同一のラベル値を付
け、2種類以上の異なったラベル値が付いていればその
中で一番若いラベル値を付けると共に、これらは同一の
連結成分のものであることを記憶しておく。
On the other hand, a labeling method as shown in FIG. 5 has been proposed in order to reduce the number of scanning of binary images. In this method, first, when the unlabeled "1-pixel" is detected by raster scanning the binary image 100A, adjacent points are examined.
If all adjacent points are not labeled yet, a new label value is assigned, and if the same label value is assigned other than "0-pixel", the same label value is assigned, and two or more types are assigned. If different label values are attached, the youngest label value among them is given, and it is memorized that these have the same connected component.

同様の処理を続けて2値画像100A全体の走査が終了した
ならば、再度ラスタ走査を行い、同一の連結成分である
ことを示すラベル値をその連結成分の中で最も若いラベ
ル値に変更することにより、ラベリング処理を完了する
ものである。
When the scanning of the entire binary image 100A is completed by continuing the same processing, raster scanning is performed again, and the label value indicating the same connected component is changed to the youngest label value among the connected components. This completes the labeling process.

なお、第5図において、301A,302A,303Aはそれぞれ同一
の連結成分を示しており、このうち連結成分301Aについ
ては、再度のラスタ走査の結果、一部のラベル値「2」
がこの連結成分301A内で最も若いラベル値「1」に変更
されている。
In FIG. 5, 301A, 302A, and 303A indicate the same connected component. Among these, the connected component 301A is part of the label value "2" as a result of raster scanning again.
Is changed to the youngest label value "1" in the connected component 301A.

(発明が解決しようとする課題) しかしながらこの方法にあっては、第5図の変更後にお
ける連結成分301A,302A,303Aから明らかなように、ラベ
ル値が飛び飛びになる場合があり、後の画像解析等の処
理に際してどのようなラベルが幾つあるかを認識しなく
てはならない制約を生じる。
(Problems to be solved by the invention) However, in this method, as is apparent from the connected components 301A, 302A, and 303A after the change in FIG. In processing such as analysis, there is a constraint that it is necessary to recognize what kind of label and how many labels there are.

また、走査の過程において、同一の連結成分に含まれる
にも拘らず複数のラベルを使用するため、ラベル値の絶
対数が少なくなり、ラベル付けする連結成分の個数、換
言すればラベリングの対象となる2値画像が制約されて
しまうという問題があり、かかる課題の解決が要請され
ていた。
Also, in the process of scanning, since a plurality of labels are used even though they are included in the same connected component, the absolute number of label values is reduced, and the number of connected components to be labeled, in other words, the target of labeling. There is a problem that the binary image is restricted, and there has been a demand for solving such a problem.

本発明は上記課題を解決するために提案されたもので、
その目的とするところは、少ない走査回数で多数の連結
成分に対し固有のラベル値を連続して付与できるように
し、上述したような種々の制約もなく、一連の画像処理
作業の効率を大幅に高めることができるラベリング方法
を提供することにある。
The present invention has been proposed to solve the above problems,
The purpose of this is to make it possible to continuously give unique label values to a large number of connected components with a small number of scans, and to greatly improve the efficiency of a series of image processing operations without the above-mentioned various restrictions. It is to provide a labeling method that can be enhanced.

(課題を解決するための手段) 上記目的を達成するため、本発明は、画像用メモリ内の
画素の有無に応じた「1−画素」及び「0−画素」から
なる2値画像データを前記画像用メモリの最上位ビット
に配し、画面のラスタ走査により前記最上位ビットに基
づいて「1−画素」と検出された点を始点として記憶す
ると共に、この始点を含みかつこの始点に連続する「1
−画素」からなる現走査行の連結成分を検出し、前記画
像用メモリの残りの下位ビットを使用して前記連結成分
に同一のラベル値を付与して各点の最上位ビットをゼロ
クリアし、次いで、現走査行の上段の行及び下段の行の
それぞれにつきラスタ走査を行ない、前記連結成分と同
一の水平方向のポインタにより示される範囲内で「1−
画素」と検出された点を始点として記憶し、この始点を
含みかつこの始点に連続する「1−画素」からなる各行
の連結成分を検出して前記ラベル値と同一のラベル値を
付与すると共に各点の最上位ビットをゼロクリアし、上
記の処理を始点がなくなるまで実行して一群の連結成分
のラベル付けを行ない、この一群の連結成分のラベル付
けが終了するたびにラベル値を順次連続する値に更新し
ていくものである。
(Means for Solving the Problems) In order to achieve the above object, the present invention provides binary image data including “1-pixel” and “0-pixel” according to the presence or absence of a pixel in an image memory. It is arranged in the most significant bit of the image memory, and the point detected as "1-pixel" based on the most significant bit by the raster scanning of the screen is stored as a starting point, and includes this starting point and is continuous with this starting point. "1
A connected component of the current scan row consisting of `` pixels '' is detected, the same label value is given to the connected component using the remaining lower bits of the image memory, and the most significant bit of each point is cleared to zero; Next, raster scanning is performed for each of the upper row and the lower row of the current scan row, and "1-" is set within the range indicated by the same horizontal pointer as the connected component.
The point detected as "pixel" is stored as a start point, and the connected component of each row including "1-pixel" including this start point and continuous to this start point is detected and the same label value as the label value is given. The most significant bit of each point is cleared to zero, the above processing is executed until there are no starting points, and a group of connected components is labeled. When the labeling of this group of connected components is completed, the label values are consecutively set. The value is updated.

(作用) まず、画像用メモリの最上位ビットに基づいてラスタ走
査により「1−画素」と検出された点を連結成分の始点
として記憶しておく。次に、この始点を含みかつこの始
点に連続する「1−画素」からなる現走査行の連結成分
を検出し、画像用メモリの残りの下位ビットを使用して
これらの連結成分に同一のラベル値を付与して各点の最
上位ビットをゼロクリアする。このゼロクリアにより、
一度「1−画素」として検出された点が再度検出されな
いようにする。次いで、現走査行の上段の行及び下段の
行のそれぞれにつきラスタ走査を行ない、前記連結成分
と同一の水平方向のポインタにより示される範囲内で
「1−画素」と検出された点を始点として記憶する。そ
して、この始点を含みかつこの始点に連続する「1−画
素」からなる各行の連結成分を検出して前記ラベル値と
同一のラベル値を付与すると共に各点の最上位ビットを
ゼロクリアする。
(Operation) First, the point detected as "1-pixel" by raster scanning based on the most significant bit of the image memory is stored as the starting point of the connected component. Next, the connected components of the current scan line, which is composed of "1-pixels" including this start point and continuous to this start point, are detected, and the same lower label is used for these connected components using the remaining lower bits of the image memory. Give a value and clear the most significant bit of each point to zero. By this zero clear,
The point once detected as "1-pixel" is prevented from being detected again. Next, raster scanning is performed for each of the upper row and the lower row of the current scan row, and the point detected as "1-pixel" within the range indicated by the same horizontal pointer as the connected component is used as the starting point. Remember. Then, the connected component of each row consisting of "1-pixels" including this start point and continuous to this start point is detected, the same label value as the label value is given, and the most significant bit of each point is cleared to zero.

以上の処理を始点がなくなるまで実行して一群の連結成
分のラベル付けを行ない、この一群の連結成分のラベル
付けが終了するたびにラベル値を順次連続する値に更新
していく。
The above processing is executed until there is no starting point to label a group of connected components, and each time the labeling of the group of connected components is completed, the label value is sequentially updated to a continuous value.

すなわち本発明では、画面の1回のラスタ走査の過程で
始点が検出されると、その始点を含む連結成分を検出し
て当該連結成分に同一のラベル値を付与し、その後、ラ
ベル値を連続する値に更新したうえ画面のラスタ走査を
続行していくことにより他の連結成分を検出し、前記同
様の要領でラベル付けを行なっていく。
That is, in the present invention, when the start point is detected in the process of one raster scan of the screen, the connected component including the start point is detected, the same label value is given to the connected component, and then the label value is continuously added. The other connected components are detected by updating the value to the value that is set and continuing the raster scanning of the screen, and labeling is performed in the same manner as described above.

これにより、各連結成分には連続かつ固有のラベル値が
それぞれ付与されることになる。
As a result, continuous and unique label values are given to each connected component.

(実施例) 以下、図に沿って本発明の一実施例を説明する。(Example) An example of the present invention will be described below with reference to the drawings.

まず、第1図に示すように、ラベリングの対象となる2
値画像10が複数の連結成分31A,31B,31Cを有しているも
のとして、この2値画像10に対するラベリング処理を第
2図及び第3図を参照しつつ以下に詳述する。
First, as shown in FIG.
Assuming that the value image 10 has a plurality of connected components 31A, 31B, 31C, the labeling process for the binary image 10 will be described in detail below with reference to FIGS. 2 and 3.

始めに、例えば16ビットの画像用メモリに格納された
「1−画素」及び「0−画素」からなる2値画像10のデ
ータを、同一のメモリの最上位ビットに転送する(第3
図ステップS1)。次に、第1図の矢印21で示す如く、画
面の左上からラスタ走査を開始して画素値を順次読み込
んでいき、「1−画素」の点、すなわち最上位ビットが
“0"でない点を見つける(同S2,S3)。この間、最上位
ビットが“0"である「0−画素」の点が検出される限り
は、後述するように水平方向ないし垂直方向のポインタ
を更新し(同S12)、かつ画面全体を終了したか否かの
判断を行う(同S13)。
First, for example, the data of the binary image 10 consisting of "1-pixel" and "0-pixel" stored in the 16-bit image memory is transferred to the most significant bit of the same memory (third bit).
Figure step S1). Next, as shown by the arrow 21 in FIG. 1, raster scanning is started from the upper left of the screen and pixel values are sequentially read, and the point of "1-pixel", that is, the point where the most significant bit is not "0" is determined. Find (S2, S3). During this time, as long as the point of "0-pixel" with the most significant bit being "0" is detected, the pointer in the horizontal direction or the vertical direction is updated as described later (at step S12), and the entire screen is terminated. It is determined whether or not (at step S13).

第2図において、先のステップS3により現走査行L1にお
いて「1−画素」の点P1Sが検出されたならば、この点
を始点として記憶しておき(同S4)、この始点を取り出
すと共に(同S5)、そこから第1図の矢印22で示す如
く、右方向に「0−画素」の点が現れるまで走査を行
い、現走査行L1で最後に見つけた「1−画素」の点P1E
を終点とする(同S7)。このとき、前記始点P1Sは初め
て見つかった始点であるため、ステップS6に示される判
断は省略されるか、あるいは、現走査行L1の上下の行に
他の始点がある可能性があるため、判断結果は否とな
る。
In FIG. 2, if the point P 1S of “1-pixel” is detected in the current scanning line L 1 in the previous step S3, this point is stored as a starting point (at step S4) and this starting point is taken out. At the same time (S5), as shown by arrow 22 in FIG. 1, scanning is performed until a point of “0-pixel” appears in the right direction, and the last “1-pixel” found in the current scan row L 1 is displayed. Point P 1E
Is the end point (at the same S7). At this time, since the starting point P 1S is the starting point found for the first time, the determination shown in step S6 may be omitted, or there may be other starting points in the rows above and below the current scan row L 1. , The judgment result is no.

次に、始点P1Sから終点P1Eまでに同一のラベル値、例え
ば「1」を付ける(同S8)。このとき、ラベル値は15ビ
ットにて表現されるが、書き込みは16ビットで行い、最
上位ビットをゼロクリアする。すなわち、一度ラベル付
けをした点の最上位ビットは常に“0"となるようにし、
この点が再び「1−画素」として検出されないようにし
ている。
Then, the same label value, for example, "1" is added from the start point P 1S to the end point P 1E (at step S8). At this time, the label value is expressed with 15 bits, but writing is performed with 16 bits and the most significant bit is cleared to zero. That is, the most significant bit of the point once labeled is always "0",
This point is prevented from being detected again as "1-pixel".

次いで、今回走査した現走査行L1の上段の行L2につい
て、同一の水平方向のポインタにて示される始点P2S
から終点P2E′まで(8連結画素を探索する場合には始
点P2S′の1つ左から終点P2E′の1つ右まで)の画素値
を読み込み、最初に「0−画素」から変化した「1−画
素」の点P21Sを次の始点として記憶する(同S9)。
Then, for the upper row L 2 of the current scan row L 1 scanned this time, the start point P 2S ′ indicated by the same horizontal pointer
To the end point P 2E ′ (from the left of the start point P 2S ′ to the right of the end point P 2E ′ when searching for 8 connected pixels), the pixel value is changed from “0-pixel” first. The point P21S of "1-pixel" is stored as the next starting point (at step S9).

ここで、前回ラベル付けした行L1につき、その始点をf
(iS,j)、終点をf(iE,j)(i:水平方向のポインタ,
j:垂直方向のポインタであり、iS≦iE)とすると、上段
の行L2における探索の始点はf(iS,j−1)、終点はf
(iE,j−1)、(8連結画素を探索する場合には、始点
はf(iS−1,j−1)、終点はf(iE+1,j−1))とな
る。そして、上段の行L2における次の始点f(i,j−
1)としては、f(i−1,j−1)が“0"であり、かつ
f(i,j−1)が“1"である点(なお、iS≦i≦iE)と
なる。すなわち、行L2において、始点P2S′から終点
P2E′までの間の「1−画素」の点のうち、隣合う左の
点が「0−画素」である点P21Sが次の始点となる。
Here, for the previously labeled line L 1 , its starting point is f
(I S , j), end point is f (i E , j) (i: horizontal pointer,
j: a pointer in the vertical direction, where i S ≦ i E ), the starting point of the search in the upper row L 2 is f (i S , j−1) and the ending point is f
(I E, j-1) , ( in the case of searching the 8-connected pixels, the starting point f (i S -1, j- 1), the end point f (i E + 1, j -1)) becomes. Then, the next starting point f (i, j− in the upper row L 2 is
As 1), the point that f (i−1, j−1) is “0” and f (i, j−1) is “1” (note that i S ≦ i ≦ i E ). Become. That is, in row L 2 , from start point P 2S ′ to end point
Among the points of "1-pixel" in until P 2E ', of adjacent left point "0 pixels" a is a point P 21S is next starting point.

また、第2図のように上段の行L2における探索の始点P
2S′が「1−画素」の点である場合には、この点P2S
の左側に「1−画素」の点が連続している可能性がある
ため、点P2S′から左方向に走査を行うことにより「1
−画素」の点を順次始点候補点P22S″とし、最後に見つ
けた「1−画素」の点(「0−画素」に隣接している
点)P22Sを更にその次の始点として記憶する(同S9)。
In addition, as shown in FIG. 2, the search start point P in the upper row L 2 is
If 2S ′ is a “1-pixel” point, then this point P 2S
Since there is a possibility that "1-pixel" points are continuous on the left side of, the scan from point P 2S ′ to the left causes “1
-The point of "pixel" is sequentially set as a starting point candidate point P22S ", and the last found point of" 1-pixel "(point adjacent to" 0-pixel ") P22S is further stored as the next starting point. (Same as S9).

同様の方法により、下段の行L3についても始点P31S,P
32Sを見つけ、これらを記憶しておく(同S10)。
By the same method, starting also lower row L 3 P 31S, P
Find 32S and memorize these (S10 of the same).

次に、上述のようにして記憶した始点を一つづつ取り出
し(同S5)、始点がなくなったかの判断(同S6)を行っ
た後、行L1について行ったのと同様に、右方向に「0−
画素」の点が現れるまで走査を行って終点を見つけると
共に、これらの始点−終点間の複数の「1−画素」の点
に行L1と同一のラベルを付ける(同S7,S8)。
Next, the start points stored as described above are taken out one by one (at step S5), and after determining whether or not there are no more start points (at step S6), in the same way as in the case of row L 1 , to the right, " 0-
With finding an end point by performing a scan to emerge in terms of pixel "is, these starting - put the same label and row L 1 to a point" 1 pixel "multiple between end points (same S7, S8).

そして、例えば行L2についてのラベル付けが終わったな
らば、この行L2の上下の行に対して新たに始点の探索を
行う(同S9,S10)わけであるが、行L2の下段の行、すわ
なち行L1については先にラベル付けが行われていて最上
位ビットが“0"であるから、始点の探索は実質的に行L2
の上段の行についてのみ実行される。同様にして、行L3
における始点の探索は行L3の下段の行に対してのみ実行
される。
Then, for example, if the label in the row L 2 is finished, perform a new search for the start point to the upper and lower rows of the row L 2 although (same S9, S10) why the lower row L 2 , That is, row L 1 is labeled first and the most significant bit is “0”, so the search for the start point is effectively row L 2
It is executed only for the upper row of. Similarly, row L 3
The search for the starting point in is performed only on the lower row of row L 3 .

こうして、残っている始点がなくなったら、1つの連結
成分、例えば、第1図における連結成分31Aに対するラ
ベル付けが終了したことになる(同S6)。
Thus, when there are no remaining starting points, labeling of one connected component, for example, the connected component 31A in FIG. 1 is completed (S6).

その後、ラベル値を、「1」に連続する値である「2」
に更新し、かつ水平方向及び垂直方向のポインタを更新
して(同S11,S12)ラスタ走査を続行し、別の連結成分
を構成する「1−画素」の点を見つけたならば再び前述
の方法でその連結成分に対してラベル付けを行う(同S2
〜S12)。以上の処理を繰返しながら、画面ラスタ走査
が画面の右下に達した時点で、連結成分31A,31B,31Cを
有する一画面のラベル処理が完了するものである(同S1
3)。
After that, the label value is "2", which is a value consecutive to "1".
, And the horizontal and vertical pointers are updated (S11 and S12 in the same figure), the raster scanning is continued, and if a "1-pixel" point forming another connected component is found, The connected component is labeled by the method (S2
~ S12). While repeating the above processing, when the screen raster scan reaches the lower right of the screen, the label processing of one screen having the connected components 31A, 31B, 31C is completed (S1).
3).

この実施例によれば、16ビットの画像用メモリのうち15
ビットを使用して各連結成分にラベ付けを行うため、ラ
ベル値「0」を除外すれば、215−1=32767個のラベル
値を同数の連結成分に付与することができる。勿論、画
像用メモリのビット数をより多くすれば、更に多数の連
結成分に対して、それぞれ固有の連続したラベル値を付
与することが可能となる。
According to this embodiment, 15 of the 16-bit image memory
Since each connected component is labeled using bits, if the label value “0” is excluded, 2 15 −1 = 32767 label values can be given to the same number of connected components. Of course, if the number of bits of the image memory is increased, it becomes possible to give unique continuous label values to a larger number of connected components.

(発明の効果) 以上のように本発明によれば、画像用メモリの最上位ビ
ットに2値画像データを配し、前記メモリの残りのビッ
トをラベル値に使用すると共に、画面のラスタ走査及び
連結成分内の走査を組み合わせて各連結成分に連続した
異なるラベル値を付与していくものであるため、2値画
像を構成する多数の連結成分に対して、ラベル値が飛び
飛びになったり不連続になることなくラベリングを行な
える利点がある。
(Effects of the Invention) As described above, according to the present invention, binary image data is arranged in the most significant bit of the image memory, the remaining bits of the memory are used for the label value, and the screen raster scan and Since the continuous different label values are given to each connected component by combining the scans in the connected components, the label values are discontinuous or discontinuous with respect to many connected components forming the binary image. There is an advantage that labeling can be performed without becoming.

更に、各連結成分において、ラベル付けを終えた各点の
最上位ビットをゼロクリアすることにより、ラベル付け
を終えた行の上下にある行について始点を探索する際
に、ラベル付けが済んでいる行を重複して探索する無駄
を省くことができ、ラベリング処理の高速化を図ること
ができる。
Further, in each connected component, by clearing the most significant bit of each labeled point to zero, when searching for the starting point of the lines above and below the labeled line, the labeled line is searched. It is possible to eliminate the waste of redundantly searching for and to speed up the labeling process.

加えて、本発明では画面の1回のラスタ走査の過程にお
ける連結成分の走査の際にラベル値が付けられ、同一連
結成分内のラベル値が異なることはない。従って、第5
図に示した従来技術のように、1回のラスタ走査時に付
与された同一連結成分内の異なるラベル値を同一値に統
一するために、再度ラスタ走査を行なう必要がない。こ
のため、2値画像による計測や解析等に先立ち、ラベリ
ングによる連結成分の分類等の前処理作業を容易かつ高
速に行うことができ、2値画像を用いた一連の計測、解
析作業の負担を軽減して作業能率の大幅な向上を図るこ
とができる等の効果を有する。
In addition, according to the present invention, a label value is added when the connected components are scanned in the process of one raster scan of the screen, and the label values in the same connected component are not different. Therefore, the fifth
Unlike the prior art shown in the figure, in order to unify different label values in the same connected component given at one raster scan into the same value, it is not necessary to perform raster scan again. Therefore, prior to measurement and analysis using a binary image, preprocessing work such as classification of connected components by labeling can be performed easily and at high speed, and a series of measurement and analysis work using a binary image can be performed. It has an effect that it can be reduced and the work efficiency can be greatly improved.

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

第1図ないし第3図は本発明の一実施例を示すもので、
第1図はラベリングの対象となる2値画像の説明図、第
2図は現走査行及び上下の走査行における始点、終点等
の説明図、第3図はこの実施例の作用を説明するための
フローチヤート、第4図及び第5図は従来例を説明する
ための2値画像の説明図である。 10……2値画像、31A,31B,31C……連結成分 L1,L2,L3……走査行 P1S,P21S,P22S,P31S,P32S……始点 P1E……終点
1 to 3 show an embodiment of the present invention,
FIG. 1 is an explanatory diagram of a binary image to be labeled, FIG. 2 is an explanatory diagram of start points and end points of the current scanning line and upper and lower scanning lines, and FIG. 3 is for explaining the operation of this embodiment. FIG. 4, FIG. 4 and FIG. 5 are explanatory diagrams of a binary image for explaining a conventional example. 10 …… Binary image, 31A, 31B, 31C …… Connected component L 1 , L 2 , L 3 …… Scan line P 1S , P 21S , P 22S , P 31S , P 32S …… Start point P 1E …… End point

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】画像用メモリ内の画素の有無に応じた「1
−画素」及び「0−画素」からなる2値画像データを前
記画像用メモリの最上位ビットに配し、画面のラスタ走
査により前記最上位ビットに基づいて「1−画素」と検
出された点を始点として記憶すると共に、この始点を含
みかつこの始点に連続する「1−画素」からなる現走査
行の連結成分を検出し、前記画像用メモリの残りの下位
ビットを使用して前記連結成分に同一のラベル値を付与
して各点の最上位ビットをゼロクリアし、次いで、現走
査行の上段の行及び下段の行のそれぞれにつきラスタ走
査を行ない、前記連結成分と同一の水平方向のポインタ
により示される範囲内で「1−画素」と検出された点を
始点として記憶し、この始点を含みかつこの始点に連続
する「1−画素」からなる各行の連結成分を検出して前
記ラベル値と同一のラベル値を付与すると共に各点の最
上位ビットをゼロクリアし、上記の処理を始点がなくな
るまで実行して一群の連結成分のラベル付けを行ない、
この一群の連結成分のラベル付けが終了するたびにラベ
ル値を順次連続する値に更新していくことを特徴とする
ラベリング方法。
1. "1" depending on the presence or absence of a pixel in the image memory
-The binary image data composed of "pixels" and "0-pixels" is arranged in the most significant bit of the image memory, and "1-pixel" is detected by raster scanning of the screen based on the most significant bit. Is stored as a starting point, and the connected component of the current scan line that includes this starting point and that is continuous with this starting point and consists of "1-pixels" is detected, and the connected component is stored using the remaining lower bits of the image memory. To the same label value to zero-clear the most significant bit of each point, and then perform raster scanning for each of the upper row and the lower row of the current scan row, and the same horizontal pointer as the connected component. The point detected as "1-pixel" within the range indicated by is stored as a start point, and the label value is detected by detecting the connected component of each row consisting of "1-pixel" including this start point and continuous to this start point. Same as Is cleared to zero the most significant bit of each point while applying the label values, performs labeling of a group connected component by performing the above processing until the start point is eliminated,
A labeling method characterized in that the label values are updated to successive values each time labeling of this group of connected components is completed.
JP63026390A 1988-02-06 1988-02-06 Labeling method Expired - Lifetime JPH07104941B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63026390A JPH07104941B2 (en) 1988-02-06 1988-02-06 Labeling method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63026390A JPH07104941B2 (en) 1988-02-06 1988-02-06 Labeling method

Publications (2)

Publication Number Publication Date
JPH01201783A JPH01201783A (en) 1989-08-14
JPH07104941B2 true JPH07104941B2 (en) 1995-11-13

Family

ID=12192211

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63026390A Expired - Lifetime JPH07104941B2 (en) 1988-02-06 1988-02-06 Labeling method

Country Status (1)

Country Link
JP (1) JPH07104941B2 (en)

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6242315A (en) * 1985-08-19 1987-02-24 Tdk Corp Magnetic recording medium

Also Published As

Publication number Publication date
JPH01201783A (en) 1989-08-14

Similar Documents

Publication Publication Date Title
Clowes Finding picture edges through collinearity of feature points
JP2951814B2 (en) Image extraction method
US7277191B2 (en) Fast efficient window region coalescing in a two-pass auto-windowing environment
JPH0196771A (en) Recognizing system for circular arc part
JP2891616B2 (en) Temporary label allocation processing method and actual label allocation processing method
US5220647A (en) Image processing method
US4783831A (en) Method for producing a standard pattern for pattern matching
JPH07104941B2 (en) Labeling method
EP0510694A2 (en) Method of and apparatus for extracting image data
EP1010128B1 (en) Method for performing character recognition on a pixel matrix
JPH0130180B2 (en)
KR100257786B1 (en) Image processing unit
KR20000051928A (en) A method for extracting external boundaries from binary image
JPH0221026B2 (en)
JPH07113971B2 (en) Labeled circuit for image processing
JPH0269878A (en) Image data labeling method
JPH0139153B2 (en)
JP2617135B2 (en) Labeling device for connected areas
JPH0146912B2 (en)
JPH053627B2 (en)
KR0126088B1 (en) How to label blobs
JPH1031738A (en) Grayscale image data storage / readout method, grayscale image data binarization method, and grayscale image data processing apparatus
JPH05197806A (en) Image coupling component extracting device
JPH0727567B2 (en) Area detection method of connected figure
JPH0512444A (en) One-picture/one-scan type feature amount measuring device