JP6681077B2 - Labeling processor - Google Patents

Labeling processor Download PDF

Info

Publication number
JP6681077B2
JP6681077B2 JP2017118442A JP2017118442A JP6681077B2 JP 6681077 B2 JP6681077 B2 JP 6681077B2 JP 2017118442 A JP2017118442 A JP 2017118442A JP 2017118442 A JP2017118442 A JP 2017118442A JP 6681077 B2 JP6681077 B2 JP 6681077B2
Authority
JP
Japan
Prior art keywords
labeling
storage unit
information storage
label
labels
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.)
Active
Application number
JP2017118442A
Other languages
Japanese (ja)
Other versions
JP2019003469A (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.)
Axell Corp
Original Assignee
Axell Corp
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 Axell Corp filed Critical Axell Corp
Priority to JP2017118442A priority Critical patent/JP6681077B2/en
Publication of JP2019003469A publication Critical patent/JP2019003469A/en
Application granted granted Critical
Publication of JP6681077B2 publication Critical patent/JP6681077B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Analysis (AREA)

Description

本発明は、画像データ中の連続する各画素に同一のラベルを付与するラベリング処理装置に関し、特に、処理の高速化と処理回路の低コスト化を可能としたラベリング処理装置に関する。   The present invention relates to a labeling processing device that gives the same label to each successive pixel in image data, and more particularly to a labeling processing device that enables high-speed processing and low cost of a processing circuit.

二値画像中の連結した画素の領域を他の連結した画素の領域と区別するために、各連結領域に異なるラベルを付すラベリング処理が行われる。ラベリング処理を行うことにより、各連結領域について面積や重心等の特徴量を求めることができる。このような画像処理技術は、各種の製造工場における製品の欠陥検査に利用されている。
ラベリング処理の一例としては、注目画素の左上、上、右上、左の画素に付されたラベルを調べる走査マスク(参照範囲、図7等)を設定し、ラスタスキャンにより画像データの左上の画素から順にラベリング処理するものがある。このラベリングアルゴリズムの場合、参照範囲内に複数の異なるラベルが付された画素が存在した場合に、注目画素に付すラベルどのようにするか優先順位を定めておく必要がある。設定された優先順位によっては同一の連結領域内に存在する画素であるにも関わらず異なるラベルが付与される場合があるので、ラベリング処理時にラベル同士の接続関係を示す接続情報を生成する。そして、ラスタスキャン終了後に接続情報を用いてラベルを連結する必要がある(特許文献1)。
監視カメラや製造ライン上での検品にカメラから取り込んだ画像を利用する場合、ラベリング処理を実行する画像処理装置にはリアルタイムでの高速なデータ処理が求められる。特許文献2においては、連結領域の境界周囲長を判定し、所定周囲長以上の領域または所定周囲長以下の連結領域を除去することで、一度のラスタスキャンでラベリング処理を完了できるようにし、リアルタイムでのデータ処理を実現している。
In order to distinguish the area of connected pixels in the binary image from the area of other connected pixels, a labeling process is performed to attach different labels to each connected area. By performing the labeling process, it is possible to obtain the feature amount such as the area and the center of gravity of each connected region. Such image processing technology is used for defect inspection of products in various manufacturing plants.
As an example of the labeling process, a scan mask (reference range, FIG. 7, etc.) for checking the labels attached to the upper left, upper, upper right, and left pixels of the pixel of interest is set, and raster scanning starts from the upper left pixel of the image data. There is a labeling process in order. In the case of this labeling algorithm, when there are a plurality of pixels to which different labels are attached within the reference range, it is necessary to determine the priority order of how to label the pixel of interest. Depending on the set priority order, different labels may be given to pixels that are in the same connected area, so connection information indicating the connection relationship between the labels is generated during the labeling process. Then, it is necessary to connect the labels using the connection information after the raster scan is completed (Patent Document 1).
When utilizing an image captured from a camera for inspection on a surveillance camera or a manufacturing line, an image processing apparatus that executes a labeling process is required to perform high-speed data processing in real time. In Patent Document 2, by determining the boundary perimeter of a connected area and removing an area having a predetermined peripheral length or more or a connected area having a predetermined peripheral length or less, the labeling process can be completed by one raster scan, and real time is realized. The data processing in is realized.

特開平3−184185号公報JP-A-3-184185 特開平3−206573号公報JP-A-3-206573

特許文献1に記載の発明によれば、ラベル付けされた連結領域の接続関係を常に更新することで、接続情報を保持するメモリ容量を低く抑えることができ、また特許文献2に記載の発明によれば、一度のラスタスキャンでラベリング処理を完了させることができる。
しかしながら、特許文献1では画素に付与した一次ラベルの番号が最大一次ラベル番号を超える場合には処理終了となる。様々な画像に対応するためには画素に付与できるラベル数を十分に確保する必要があり、そのため、処理結果を保存するRAMのメモリ容量を大きく確保しなければならないという問題点があった。また、特許文献2記載の方法では連結領域の周囲長が所定値以上または所定値以下の領域を除去することでラベリング処理を高速化しているので、処理できる画像の種類に制限があるという問題点があった。
本発明は、上記のような従来のラベリング処理における問題点を解決するものであり、様々な画像のラベリング処理を行うに際し、ラベリング処理を高速に実行することができ、且つ、ラベリングの処理結果を保存するメモリの容量を小さくできるラベリング処理装置を提供することを目的とする。
According to the invention described in Patent Document 1, the memory capacity for holding the connection information can be suppressed to a low level by constantly updating the connection relationship of the labeled connected areas. According to this, the labeling process can be completed with one raster scan.
However, in Patent Document 1, when the number of the primary label assigned to the pixel exceeds the maximum primary label number, the processing ends. In order to deal with various images, it is necessary to secure a sufficient number of labels that can be given to pixels, and thus there is a problem that a large memory capacity of the RAM for storing the processing result must be secured. Further, in the method described in Patent Document 2, since the labeling process is speeded up by removing the region in which the perimeter of the connected region is equal to or larger than the predetermined value or smaller than the predetermined value, there is a problem that the types of images that can be processed are limited. was there.
The present invention is to solve the problems in the conventional labeling processing as described above, when performing the labeling processing of various images, the labeling processing can be executed at high speed, and the labeling processing results can be obtained. An object of the present invention is to provide a labeling processing device capable of reducing the capacity of a memory to be stored.

上記の課題を解決するために、請求項1に記載の発明は、画像データの注目画素に隣接する参照画素に付与されたラベルを参照して、注目画素にラベルを付与するラベリング処理部と、ラベリング処理部によって付与されたラベルに係るラベリング情報を記憶する第一ラベリング情報格納部と、第一ラベリング情報格納部から転送されたラベリング情報を記憶する第二ラベリング情報格納部と、ラベリング処理部によって付与されたラベルに係るラベル数がフラッシュラベル数に到達した場合に、第一ラベリング情報格納部に記憶されているラベリング情報を第二ラベリング情報格納部へ転送させると共に第一ラベリング情報格納部をフラッシュするフラッシュ制御部と、を備えることを特徴とする。
請求項2に記載の発明は、前記ラベリング処理部は、前記第一ラベリング情報格納部がフラッシュされた場合に、フラッシュ前に付与されたラベルと、フラッシュ後に付与されたラベルとの接続関係を示す前処理接続情報を前記第一ラベリング情報格納部に記憶させることを特徴とする。
In order to solve the above-mentioned problem, the invention according to claim 1 refers to a label given to a reference pixel adjacent to a pixel of interest of image data, and gives a labeling processing unit for giving a label to the pixel of interest, By the labeling processing unit, the first labeling information storage unit that stores the labeling information related to the label assigned by the labeling processing unit, the second labeling information storage unit that stores the labeling information transferred from the first labeling information storage unit, and the labeling processing unit. When the number of labels related to the assigned label reaches the number of flash labels, the labeling information stored in the first labeling information storage unit is transferred to the second labeling information storage unit and the first labeling information storage unit is flushed. And a flash control unit for controlling the flash.
In the invention according to claim 2, when the first labeling information storage unit is flushed, the labeling processing unit shows a connection relationship between a label given before the flushing and a label given after the flushing. The preprocessing connection information is stored in the first labeling information storage unit.

請求項3に記載の発明は、前記フラッシュ制御部は、前記ラベリング処理部によって付与されたラベルに係るラベル数が前記画像データのライン途中で前記フラッシュラベル数となった場合に、前記ラベリング処理部による該ラインの処理が終了したときに前記第一ラベリング情報格納部をフラッシュすることを特徴とする。
請求項4に記載の発明は、前記第一ラベリング情報格納部のアクセス速度が、前記第二ラベリング情報格納部のアクセス速度よりも速いことを特徴とする。
請求項5に記載の発明は、前記第一ラベリング情報格納部の記憶容量が、前記第二ラベリング情報格納部の記憶容量よりも少ないことを特徴とする。
According to a third aspect of the present invention, in the flash control unit, when the label number related to the label given by the labeling processing unit becomes the flash label number in the middle of the line of the image data, the labeling processing unit. The first labeling information storage unit is flushed when the processing of the line is completed.
The invention according to claim 4 is characterized in that an access speed of the first labeling information storage unit is faster than an access speed of the second labeling information storage unit.
The invention according to claim 5 is characterized in that the storage capacity of the first labeling information storage unit is smaller than the storage capacity of the second labeling information storage unit.

請求項6に記載の発明は、前記フラッシュラベル数は、該フラッシュラベル数に対応したラベリング情報に係る記憶容量と、前記ラベリング処理部によって付与されたラベルの個数がライン途中で前記フラッシュラベル数となった後、該ラインの残部について新規に付与されるラベル数の予測値に対応したラベリング情報に係る記憶容量と、を加算した容量が、前記第一ラベリング情報格納部の記憶容量を越えないように設定されることを特徴とする。
請求項7に記載の発明は、前記ラベリング処理部は、ラベリング処理結果として、ラベル同士の接続関係を表す接続情報と、ラベルを付与された画素の数及び存在範囲をラベル毎に示す付加情報とを生成して前記第一ラベリング情報格納部に記憶させ、前記画像データ中の各画素と該各画素に付与されたラベルとの対応関係を示す画素・ラベル情報を生成して前記第二ラベリング情報格納部に記憶させることを特徴とする。
In the invention according to claim 6, the flash label number is a storage capacity relating to labeling information corresponding to the flash label number, and the number of labels given by the labeling processing unit is the flash label number in the middle of a line. After that, the capacity obtained by adding the storage capacity of the labeling information corresponding to the predicted value of the number of labels newly assigned to the remaining part of the line does not exceed the storage capacity of the first labeling information storage section. It is set to.
In the invention according to claim 7, the labeling processing unit, as the labeling processing result, connection information indicating a connection relationship between labels, and additional information indicating the number and existence range of labeled pixels for each label. And storing it in the first labeling information storage unit, and generating pixel / label information indicating a correspondence relationship between each pixel in the image data and a label assigned to each pixel to generate the second labeling information. It is characterized in that it is stored in the storage unit.

本発明によれば、様々な画像のラベリング処理を行うに際し、ラベリング処理を高速に実行することができ、且つ、ラベリングの処理結果を保存するメモリの容量を小さくできる。   According to the present invention, when performing labeling processing of various images, the labeling processing can be executed at high speed, and the capacity of the memory for storing the labeling processing result can be reduced.

本発明の一実施形態に係る画像処理装置のハードウェア構成図である。It is a hardware block diagram of the image processing apparatus which concerns on one Embodiment of this invention. 本発明の一実施形態に係るラベリング演算処理部の概略構成を示す機能ブロック図である。It is a functional block diagram which shows the schematic structure of the labeling calculation process part which concerns on one Embodiment of this invention. 本発明の一実施形態に係る画像処理装置のラベリング機能に係る構成を示した機能ブロック図である。FIG. 3 is a functional block diagram showing a configuration related to a labeling function of the image processing apparatus according to the embodiment of the present invention. 接続情報の一例を示す図である。It is a figure which shows an example of connection information. 付加情報の一例を示す図である。It is a figure which shows an example of additional information. ラベリング処理の対象となる二値画像データの一例を示す図である。It is a figure which shows an example of the binary image data used as the target of a labeling process. ラベリング処理に用いる走査マスクの一例を示す図である。It is a figure which shows an example of the scanning mask used for a labeling process. ラベリング処理の一例を示す図であり、(a)は処理画像を示す図であり、(b)は付加情報を示す図であり、(c)は接続情報を示す図である。It is a figure which shows an example of a labeling process, (a) is a figure which shows a process image, (b) is a figure which shows additional information, (c) is a figure which shows connection information. ラベリング処理を説明する図であり、(a)は処理画像を示す図であり、(b)は付加情報を示す図であり、(c)は現在処理接続情報を示す図であり、(d)は前処理接続情報を示す図である。It is a figure explaining labeling processing, (a) is a figure which shows a processed image, (b) is a figure which shows additional information, (c) is a figure which shows the present process connection information, (d). FIG. 4 is a diagram showing preprocessing connection information. フラッシュ後のラベリング処理を説明する図であり、(a)は処理画像を示す図であり、(b)は付加情報を示す図であり、(c)は現在処理接続情報を示す図であり、(d)は前処理接続情報を示す図である。It is a figure explaining the labeling process after flash, (a) is a figure which shows a process image, (b) is a figure which shows additional information, (c) is a figure which shows the present process connection information, (D) is a figure which shows pre-processing connection information. 現ライン処理部によるラベリング処理が完了した後の処理画像の一例を示す図である。It is a figure which shows an example of the process image after the labeling process by the present line process part is completed. (a)〜(c)は、第二ラベリング情報格納部の全接続情報格納部と付加情報格納部に格納されるデータの一例を示す図である。(A)-(c) is a figure which shows an example of the data stored in the all connection information storage part of a 2nd labeling information storage part, and an additional information storage part. 第二ラベリング情報格納部のアドレスマップの概要を示す図である。It is a figure which shows the outline of the address map of a 2nd labeling information storage part. ラベル連結処理後の処理画像の一例を示す図である。It is a figure which shows an example of the processed image after label connection processing.

以下、本発明を図に示した実施形態を用いて詳細に説明する。但し、この実施形態に記載される構成要素、種類、組み合わせ、形状、その相対配置などは特定的な記載がない限り、この発明の範囲をそれのみに限定する主旨ではなく単なる説明例に過ぎない。   Hereinafter, the present invention will be described in detail with reference to the embodiments shown in the drawings. However, the constituent elements, types, combinations, shapes, relative arrangements, and the like described in this embodiment are merely explanatory examples, not the gist of limiting the scope of the present invention thereto, unless specifically stated. .

〔ハードウェア構成〕
図1は、本発明の一実施形態に係る画像処理装置のハードウェア構成図である。
画像処理装置(ラベリング処理装置)1は、CPU(Central Processing Unit)11、ラベリング演算処理部13、メモリ15、及びI/F部16を備える。
CPU11はレジスタ12を有しており、画像処理装置1の全体を制御する。
ラベリング演算処理部13は、CPU11の命令に従ってラベリングに係わる各種の処理を実行する集積回路(IC:Integrated Circuit)である。ラベリング演算処理部13は、入力された画像データの連結画素領域に仮のラベル(インデックス)を付与する。ラベリング演算処理部13は、記憶手段として例えば揮発性記憶手段であるSRAM(Static Random Access Memory)14を備えており、ラベリング処理により得られるラベリング情報をSRAM14に一時的に格納する。
メモリ15は、ラベリング演算処理部13に設けた記憶手段(SRAM14)よりも大きな記憶容量を有するがアクセス速度が比較的低速の記憶手段である。メモリ15は、例えばDRAM(Dynamic Random Access Memory)等の揮発性記憶手段から構成される。
I/F部16は、外部装置と接続するインターフェースである。I/F部16には、処理対象となる画像データを供給する監視カメラや、ラベリング演算処理部13によって処理された画像データを処理する他の装置等が接続される。
[Hardware configuration]
FIG. 1 is a hardware configuration diagram of an image processing apparatus according to an embodiment of the present invention.
The image processing apparatus (labeling processing apparatus) 1 includes a CPU (Central Processing Unit) 11, a labeling calculation processing unit 13, a memory 15, and an I / F unit 16.
The CPU 11 has a register 12 and controls the entire image processing apparatus 1.
The labeling calculation processing unit 13 is an integrated circuit (IC) that executes various types of labeling-related processing according to instructions from the CPU 11. The labeling calculation processing unit 13 gives a temporary label (index) to the connected pixel area of the input image data. The labeling calculation processing unit 13 includes, for example, an SRAM (Static Random Access Memory) 14 that is a volatile storage unit as a storage unit, and temporarily stores the labeling information obtained by the labeling process in the SRAM 14.
The memory 15 has a storage capacity larger than that of the storage unit (SRAM 14) provided in the labeling calculation processing unit 13, but has a relatively low access speed. The memory 15 is composed of a volatile storage unit such as a DRAM (Dynamic Random Access Memory).
The I / F unit 16 is an interface connected to an external device. The I / F unit 16 is connected to a surveillance camera that supplies image data to be processed, another device that processes the image data processed by the labeling calculation processing unit 13, and the like.

〔ラベリング演算処理部の概略構成〕
図2は、本発明の一実施形態に係るラベリング演算処理部の概略構成を示す機能ブロック図である。
ラベリング演算処理部13は、二値化処理部17と、ノイズ除去部18と、ラベリング処理部20とを備える。
二値化処理部17は、外部装置である監視カメラ等から入力されたビデオ信号(多値の画像データ)を二値化する処理を実行する。ノイズ除去部18は、二値化された画像データに対する平滑化処理等を行って画像データからノイズを除去する。ラベリング処理部20は、ノイズ除去後の画像データ中の各画素の連結成分に同一のラベル(インデックス)を仮付与し、ラベリング処理の結果を出力する。
[Schematic Configuration of Labeling Arithmetic Processing Unit]
FIG. 2 is a functional block diagram showing a schematic configuration of the labeling calculation processing unit according to the embodiment of the present invention.
The labeling calculation processing unit 13 includes a binarization processing unit 17, a noise removal unit 18, and a labeling processing unit 20.
The binarization processing unit 17 executes a process of binarizing a video signal (multi-valued image data) input from an external device such as a surveillance camera. The noise removing unit 18 removes noise from the image data by performing smoothing processing on the binarized image data. The labeling processing unit 20 temporarily assigns the same label (index) to the connected component of each pixel in the image data after noise removal, and outputs the result of the labeling processing.

〔機能構成〕
図3は、本発明の一実施形態に係る画像処理装置のラベリング機能に係る構成を示した機能ブロック図である。
画像処理装置1は、制御部19、ラベリング演算処理部13、第二ラベリング情報格納部50、及びラベル連結処理部60を備える。
[Functional configuration]
FIG. 3 is a functional block diagram showing the configuration related to the labeling function of the image processing apparatus according to the embodiment of the present invention.
The image processing apparatus 1 includes a control unit 19, a labeling calculation processing unit 13, a second labeling information storage unit 50, and a label concatenation processing unit 60.

制御部19は、図1に示すCPU11により実現され、ラベリング演算処理部13に対してラベリング処理の開始を命令する制御信号や、ラベル数の設定値等を出力する。
ラベリング演算処理部13は、ラベリング処理部20、第一ラベリング情報格納部30、及びフラッシュ制御部40を備える。ラベリング処理部20は、図2に示すノイズ除去部18から入力されたノイズ除去後の二値画像データ中の各画素に対して仮のラベルを付与するラベリング処理を実行する。
ラベリング処理部20は、画像データの注目画素に隣接する参照画素に付与されたラベルを参照して、注目画素にラベルを付与する処理を実行する。ラベリング処理部20は、現ライン処理部21と1ライン前処理結果保持部22とを有する。
現ライン処理部21は、注目画素と、注目画素の周囲に位置する他の画素との接続関係を検出する。より詳しくは、現ライン処理部21は、画像データ中の注目画素に対して4連結(4近傍)又は8連結(8近傍)に位置する画素と同一のインデックス(ラベル)を付与するラベリング処理を実行する。現ライン処理部21は、ラベリング処理の結果として、ラベル同士の接続関係を表す接続情報と、ラベルを付与された画素の数及び存在範囲をラベル毎に示す付加情報とを含むラベリング情報を生成して第一ラベリング情報格納部30に記憶させる。また、現ライン処理部21は、ラベリング処理の結果として、画像データ中の各画素と各画素に付与されたラベルとの対応関係を示す画素・ラベル情報を生成して第二ラベリング情報格納部50に記憶させる。
1ライン前処理結果保持部22は、現ライン処理部21によるラベリング処理の結果生成される画素・ラベル情報を1ライン分保持する手段である。画素・ラベル情報は、どの画素に対してどのラベルが付与されているかを示す情報である。1ライン前処理結果保持部22はラインバッファにより構成されており、ラインバッファの各画素に対応する領域には夫々複数ビットが割り当てられている。各画素には、割り当てられたビット数を上限として順次ラベルを付与することが可能である。
The control unit 19 is realized by the CPU 11 shown in FIG. 1, and outputs a control signal for instructing the labeling calculation processing unit 13 to start the labeling process, a set value of the number of labels, and the like.
The labeling calculation processing unit 13 includes a labeling processing unit 20, a first labeling information storage unit 30, and a flash control unit 40. The labeling processing unit 20 executes a labeling process of giving a temporary label to each pixel in the binary image data after noise removal input from the noise removal unit 18 illustrated in FIG. 2.
The labeling processing unit 20 refers to the label attached to the reference pixel adjacent to the pixel of interest of the image data, and executes the process of attaching a label to the pixel of interest. The labeling processing unit 20 has a current line processing unit 21 and a 1-line preprocessing result holding unit 22.
The current line processing unit 21 detects the connection relationship between the pixel of interest and other pixels located around the pixel of interest. More specifically, the current line processing unit 21 performs a labeling process for assigning the same index (label) as a pixel located in 4-connected (4 vicinity) or 8-connected (8 vicinity) to a pixel of interest in image data. Run. The current line processing unit 21 generates labeling information including, as a result of the labeling process, connection information indicating a connection relationship between labels and additional information indicating the number and existence range of labeled pixels for each label. The first labeling information storage unit 30 is stored. The current line processing unit 21 also generates pixel / label information indicating the correspondence between each pixel in the image data and the label assigned to each pixel as a result of the labeling process, and the second labeling information storage unit 50. To memorize.
The one-line pre-processing result holding unit 22 is a unit that holds one line of pixel / label information generated as a result of the labeling process by the current line processing unit 21. The pixel / label information is information indicating which label is given to which pixel. The 1-line pre-processing result holding unit 22 is composed of a line buffer, and a plurality of bits are assigned to the area corresponding to each pixel of the line buffer. It is possible to sequentially label each pixel with the allocated number of bits as an upper limit.

第一ラベリング情報格納部30は、図1にSRAM14として示されているように、高速アクセスが可能な記憶手段により構成される。第一ラベリング情報格納部30は、ラベリング処理部20によって付与されたラベルに係るラベリング情報を記憶する。ラベリング処理部20が生成するラベリング情報は、接続情報と付加情報とを含む。なお、接続情報と付加情報の詳細については後述する。第一ラベリング情報格納部30は、ラベリング処理部20によって付与されたラベルが所定数となる度にフラッシュ(初期化)される。そのため、第一ラベリング情報格納部30は、接続情報(図4)を格納する手段として、現在処理接続情報格納部31と前処理接続情報格納部32とを有する。現在処理接続情報格納部31は、現在のラベリング処理において付与されるラベル同士の接続関係を示す接続情報を格納する。前処理接続情報格納部32は、現在のラベリング処理において付与されるラベルと、前回のラベリング処理(第一ラベリング情報格納部30をフラッシュする直前のラベリング処理)において付与されたラベルとの接続関係を示す接続情報を格納する。また、第一ラベリング情報格納部30は付加情報(図5)を格納する手段として、第一付加情報格納部33を有する。   The first labeling information storage unit 30, as shown as the SRAM 14 in FIG. 1, is composed of a storage unit capable of high speed access. The first labeling information storage unit 30 stores labeling information related to the label given by the labeling processing unit 20. The labeling information generated by the labeling processing unit 20 includes connection information and additional information. The details of the connection information and the additional information will be described later. The first labeling information storage unit 30 is flushed (initialized) every time the number of labels given by the labeling processing unit 20 reaches a predetermined number. Therefore, the first labeling information storage unit 30 has a current processing connection information storage unit 31 and a preprocessing connection information storage unit 32 as means for storing the connection information (FIG. 4). The current processing connection information storage unit 31 stores connection information indicating a connection relationship between labels provided in the current labeling process. The preprocessing connection information storage unit 32 shows the connection relationship between the label given in the current labeling process and the label given in the previous labeling process (the labeling process immediately before flushing the first labeling information storage unit 30). Stores the connection information shown. Further, the first labeling information storage unit 30 has a first additional information storage unit 33 as a means for storing the additional information (FIG. 5).

フラッシュ制御部40は、現ライン処理部21が付与したラベル数が所定のラベル数(フラッシュラベル数)に到達した場合に、第一ラベリング情報格納部30に記憶されているラベリング情報を第二ラベリング情報格納部50へ転送させると共に、第一ラベリング情報格納部30をフラッシュする処理を実行する。フラッシュ制御部40は、ラベル数判定部41とコントローラ42を備える。
ラベル数判定部41は、現ライン処理部21が付与したラベル数を入力し、ラベル数が所定のフラッシュラベル数に達した場合にコントローラ42に対して第一ラベリング情報格納部30をフラッシュするフラッシュ要求を出力する。フラッシュ要求の基準となるフラッシュラベル数は、制御部19がラベル数判定部41に対して設定する。制御部19はフラッシュラベル数を、第一ラベリング情報格納部30の記憶容量に基づいて設定してもよいし、図1に示すI/F部16を介して外部から入力された数値に基づいて設定してもよい。
ここで、接続情報及び付加情報の記憶には、ラベリング処理部が付与したラベル数に応じた容量が必要である。制御部19は、第一ラベリング情報格納部30に格納可能なラベリング情報の最大ラベル数よりも少ないラベル数をフラッシュラベル数としてラベル数判定部41に設定する。
When the number of labels provided by the current line processing unit 21 reaches a predetermined number of labels (the number of flash labels), the flash control unit 40 uses the labeling information stored in the first labeling information storage unit 30 as the second labeling information. A process for flushing the first labeling information storage unit 30 is executed while the data is transferred to the information storage unit 50. The flash control unit 40 includes a label number determination unit 41 and a controller 42.
The label number determination unit 41 inputs the number of labels assigned by the current line processing unit 21, and flashes the first labeling information storage unit 30 to the controller 42 when the number of labels reaches a predetermined flash label number. Output the request. The control unit 19 sets the number of flash labels, which is the standard of the flash request, in the label number determination unit 41. The control unit 19 may set the number of flash labels based on the storage capacity of the first labeling information storage unit 30, or based on the numerical value input from the outside via the I / F unit 16 shown in FIG. You may set it.
Here, the storage of the connection information and the additional information requires a capacity corresponding to the number of labels given by the labeling processing unit. The control unit 19 sets the number of labels smaller than the maximum number of labels of the labeling information that can be stored in the first labeling information storage unit 30 as the number of flash labels in the label number determination unit 41.

コントローラ42は、ラベル数判定部41からフラッシュ要求を入力した場合に、第一ラベリング情報格納部30の各部に記憶されているラベリング情報を読み出して、第二ラベリング情報格納部50の対応する各部に転送する。また、コントローラ42は、第一ラベリング情報格納部30に順次ゼロを書き込むことにより、第一ラベリング情報格納部30のデータをクリア(フラッシュ)する。   When the flush request is input from the label number determination unit 41, the controller 42 reads the labeling information stored in each unit of the first labeling information storage unit 30 and writes it to the corresponding units of the second labeling information storage unit 50. Forward. Further, the controller 42 clears (flashes) the data in the first labeling information storage unit 30 by sequentially writing zero into the first labeling information storage unit 30.

第二ラベリング情報格納部50は、図1に示すメモリ15により実現される。第二ラベリング情報格納部50は、第一ラベリング情報格納部40から転送されたラベリング情報を記憶する。即ち、第二ラベリング情報格納部50は、第一ラベリング情報格納部30をフラッシュする前、及び一のフレーム画像についてのラベリング処理終了後に、第一ラベリング情報格納部30から読み出された接続情報及び付加情報を格納、蓄積する手段である。
具体的には、第二ラベリング情報格納部50は、第一ラベリング情報格納部30の現在処理接続情報格納部31及び前処理接続情報格納部32から読み出された各接続情報を格納する全接続情報格納部51と、第一付加情報格納部33から読み出された付加情報を格納する第二付加情報格納部52とを備える。また、第二ラベリング情報格納部50は、ラベリング処理部20から出力された画素・ラベル情報を保持する画素・ラベル情報保持部53を備える。第二ラベリング情報格納部50は、第一ラベリング情報格納部30に比べてアクセス速度は低速であるが、第一ラベリング情報格納部30よりも安価、且つ大容量の記憶手段により構成される。例えば、第一ラベリング情報格納部30をSRAMから構成し、第二ラベリング情報格納部50をDRAMから構成することができる。
第一ラベリング情報格納部30に加えて第二ラベリング情報格納部50を設けることにより、1フレームの画像データから生成されるラベリング情報の格納に必要な記憶容量を確保しつつ、現ライン処理部21が生成するラベリング情報をリアルタイムで高速に記憶する第一ラベリング情報格納部30の容量を小さくすることができ、画像処理装置1を低コスト化することができる。
The second labeling information storage unit 50 is realized by the memory 15 shown in FIG. The second labeling information storage unit 50 stores the labeling information transferred from the first labeling information storage unit 40. That is, the second labeling information storage unit 50 stores the connection information and the connection information read from the first labeling information storage unit 30 before the first labeling information storage unit 30 is flushed and after the labeling process for one frame image is completed. It is a means for storing and accumulating additional information.
Specifically, the second labeling information storage unit 50 stores all connections that store the respective connection information read from the current processing connection information storage unit 31 and the preprocessing connection information storage unit 32 of the first labeling information storage unit 30. The information storage unit 51 and the second additional information storage unit 52 that stores the additional information read from the first additional information storage unit 33 are provided. The second labeling information storage unit 50 also includes a pixel / label information holding unit 53 that holds the pixel / label information output from the labeling processing unit 20. The second labeling information storage unit 50 has an access speed lower than that of the first labeling information storage unit 30, but is cheaper than the first labeling information storage unit 30 and has a large capacity storage means. For example, the first labeling information storage unit 30 can be composed of SRAM, and the second labeling information storage unit 50 can be composed of DRAM.
By providing the second labeling information storage unit 50 in addition to the first labeling information storage unit 30, the current line processing unit 21 is secured while securing the storage capacity required for storing the labeling information generated from the image data of one frame. It is possible to reduce the capacity of the first labeling information storage unit 30 that stores the labeling information generated by the device in real time at high speed, and to reduce the cost of the image processing apparatus 1.

ラベル連結処理部60は、第二ラベリング情報格納部50に格納された全ての接続情報、付加情報、及び画素・ラベル情報からラベル連結処理を行う手段である。ラベル連結処理部60は、異なるラベルが付与された画素同士が連結している場合に、一の連結領域を構成する各画素に同一のラベルを振り直す処理を実行する。なお、ラベル連結処理部60が利用するラベル連結アルゴリズムには特に制限はない。ラベル連結処理部60は、バスを介してCPU11と接続する回路でもよいし、I/F部16を介して接続する外部装置でもよい。   The label connection processing unit 60 is means for performing label connection processing from all connection information, additional information, and pixel / label information stored in the second labeling information storage unit 50. When the pixels to which different labels are attached are connected to each other, the label connection processing unit 60 executes a process of reassigning the same label to each pixel forming one connection area. The label connection algorithm used by the label connection processing unit 60 is not particularly limited. The label concatenation processing unit 60 may be a circuit connected to the CPU 11 via a bus or an external device connected to the I / F unit 16.

〔接続情報〕
図4は、接続情報の一例を示す図である。
接続情報は、ラベル同士の接続関係を示す情報である。異なるラベル同士が接続している場合、当該ラベルの付された複数の画素は一つの連結領域を形成する。縦軸と横軸の数字1〜16は、ラベルを表している。図示する例では、縦軸が注目画素のラベルを表しており、横軸が参照画素のラベルを表している。図示した例は、接続情報の初期状態を示しており、接続情報が発生しない、すなわち、注目画素のラベルと参照画素のラベルが同一である部分にのみ着色している。
[Connection information]
FIG. 4 is a diagram showing an example of connection information.
The connection information is information indicating the connection relationship between the labels. When different labels are connected to each other, a plurality of pixels with the labels form one connection region. The numbers 1 to 16 on the vertical axis and the horizontal axis represent the labels. In the illustrated example, the vertical axis represents the label of the pixel of interest, and the horizontal axis represents the label of the reference pixel. The illustrated example shows the initial state of the connection information, and only the portion where the connection information does not occur, that is, the label of the pixel of interest and the label of the reference pixel are the same is colored.

〔付加情報〕
図5は、付加情報の一例を示す図である。付加情報は、あるラベルの付された画素の集合が画像データ中のどの範囲にどの程度の大きさで存在するかを示す情報であり、テーブルの形式にて表現される。付加情報は、第一ラベリング情報格納部30がフラッシュされる毎に新規に作成される。各タイトルの意味は、以下の通りである。
ID:フラッシュ毎に作成される夫々の付加情報を識別する識別情報。例えば、ラベリング処理の開始時にID「0」が付与された場合、IDは第一ラベリング情報格納部30がフラッシュされる毎にカウントアップされる。
domain:IDに対応する付加情報が示す画像データの範囲を示す情報。第一ラベリング情報格納部30のフラッシュが画像データのライン単位で実行される場合は、画像データの処理ラインを特定する情報となる。
index:ラベリング処理によって付与されたラベル。
area:indexに示されるラベルが付与された画素数。
Xmin:indexに示されるラベルが付与された画素領域のX座標最小値。
Ymin:indexに示されるラベルが付与された画素領域のY座標最小値。
Xmax:indexに示されるラベルが付与された画素領域のX座標最大値。
Ymax:indexに示されるラベルが付与された画素領域のY座標最大値。
〔Additional information〕
FIG. 5 is a diagram showing an example of additional information. The additional information is information indicating in what range and in what size a set of pixels with a certain label exists in the image data, and is represented in a table format. The additional information is newly created every time the first labeling information storage unit 30 is flushed. The meaning of each title is as follows.
ID: identification information for identifying each additional information created for each flash. For example, when the ID “0” is added at the start of the labeling process, the ID is incremented every time the first labeling information storage unit 30 is flushed.
domain: information indicating the range of image data indicated by the additional information corresponding to the ID. When the flashing of the first labeling information storage unit 30 is executed in line units of image data, the information is information for specifying a processing line of image data.
index: A label given by the labeling process.
area: The number of pixels to which the label shown in the index is attached.
Xmin: X coordinate minimum value of the pixel area to which the label shown in index is attached.
Ymin: Y coordinate minimum value of the pixel area to which the label shown in index is attached.
Xmax: The maximum X coordinate value of the pixel area to which the label shown in index is attached.
Ymax: The maximum Y coordinate value of the pixel area to which the label shown in index is attached.

〔画像例〕
図6は、ラベリング処理の対象となる二値画像データの一例を示す図である。本図においては、各画素のX方向、Y方向における位置を把握しやすくするため、各画素間に罫線を記載している。ラベリング処理部20は、このような1フレームの画像の左上から図中右方向に処理対象である注目画素を移動しながら注目画素に対してラベルを付与する。
[Image example]
FIG. 6 is a diagram showing an example of the binary image data that is the target of the labeling process. In this figure, ruled lines are shown between the pixels in order to facilitate understanding of the positions of the pixels in the X and Y directions. The labeling processing unit 20 gives a label to a pixel of interest while moving the pixel of interest to be processed from the upper left of the image of one frame to the right in the drawing.

〔走査マスク〕
図7は、ラベリング処理に用いる走査マスクの一例を示す図である。
この走査マスク70は、所謂8連結(8近傍)用の走査マスクであり、ラベリング処理部20(図3)が注目画素71の左上、上、右上、左に位置する4つの参照画素72a〜72dに付されたラベルを参照して、注目画素71に対してラベルを付与することを示している。以下では、参照画素72a〜72dをまとめて「参照範囲」と表現することがある。なお、各参照画素72a〜72dに付された数字1〜4は、走査マスク70内にラベルが割り当てられた複数の画素が存在する場合に、注目画素71に割り当てるラベルの優先順位を示している。
[Scan mask]
FIG. 7 is a diagram showing an example of a scanning mask used in the labeling process.
The scanning mask 70 is a scanning mask for so-called 8-connection (near 8), and the labeling processing unit 20 (FIG. 3) has four reference pixels 72a to 72d located on the upper left, upper, upper right, and left of the target pixel 71. It is shown that the label is given to the pixel 71 of interest with reference to the label attached to the pixel. Hereinafter, the reference pixels 72a to 72d may be collectively referred to as a "reference range". It should be noted that the numbers 1 to 4 attached to the reference pixels 72a to 72d indicate the order of priority of the labels to be assigned to the pixel of interest 71 when the scan mask 70 has a plurality of pixels to which labels are assigned. .

〔基本的なラベリング処理の手順〕
以下、ラベリング処理について図3を参照して説明する。
図6に示すような1フレーム分の二値画像データは、1画素ずつラベリング処理部20の現ライン処理部21に供給される。現ライン処理部21は、走査マスク70(図7)中の参照画素72a〜72dに付されたラベルを参照して注目画素71に対して順次ラベルを付与する処理を実行する。
[Basic labeling procedure]
The labeling process will be described below with reference to FIG.
Binary image data for one frame as shown in FIG. 6 is supplied to the current line processing unit 21 of the labeling processing unit 20 pixel by pixel. The current line processing unit 21 refers to the labels attached to the reference pixels 72a to 72d in the scan mask 70 (FIG. 7) and sequentially performs the process of assigning labels to the target pixel 71.

図8は、ラベリング処理の一例を示す図であり、(a)は処理画像を示す図であり、(b)は付加情報を示す図であり、(c)は接続情報を示す図である。本図において、グレーの画素は処理済みの画素を示している。白抜き及び黒ベタの画素は未処理の画素を示しており、そのうち白抜きの画素はラベルを付すべき画素を示している。また、図中の右向き矢印は処理の方向を示している。また、本図は第6ラインの途中までラベリング処理が行われた状態を示している。
走査マスク70内には既にラベル「2」「3」の付された画素が存在するが、走査マスク70が参照する画素の優先順位(図5)により注目画素71にはラベル「3」が付与される。
1ライン前処理結果保持部22には、破線で示すように、注目画素の2つ前の画素から1ライン分の画素・ラベル情報が保持されており、現ライン処理部21はラベリング処理時に、1ライン前処理結果保持部22から処理中のラインの1ライン前に位置する参照画素の画素・ラベル情報を読み出して参照する。
現ライン処理部21は、注目画素71の直前に処理された画素の画素・ラベル情報を保持するレジスタを有しており、注目画素71のラベリング処理時にこれを参照する。現ライン処理部21は、注目画素71に対してラベリング処理を行った後に、注目画素71の直前に位置する画素の画素・ラベル情報を1ライン前処理結果保持部22と第二ラベリング情報格納部50の画素・ラベル情報保持部53に記憶させる。
なお、現ライン処理部21は1ラインの処理終了時にレジスタ中の画素・ラベル情報を1ライン前処理結果保持部22と画素・ラベル情報保持部53に記憶させ、レジスタをクリアする。
FIG. 8 is a diagram showing an example of the labeling process, (a) is a diagram showing a processed image, (b) is a diagram showing additional information, and (c) is a diagram showing connection information. In the figure, the gray pixels indicate processed pixels. White and black solid pixels indicate unprocessed pixels, and white pixels among them indicate pixels to be labeled. Further, the arrow pointing to the right in the figure indicates the direction of processing. Further, this figure shows a state in which the labeling process is performed up to the middle of the sixth line.
Pixels with the labels “2” and “3” already exist in the scan mask 70, but the label “3” is given to the target pixel 71 according to the priority order of the pixels referred to by the scan mask 70 (FIG. 5). To be done.
As indicated by the broken line, the 1-line pre-processing result holding unit 22 holds the pixel / label information for one line from the pixel two pixels before the pixel of interest. The pixel / label information of the reference pixel located one line before the line being processed is read from the one-line preprocessing result holding unit 22 and referred to.
The current line processing unit 21 has a register that holds the pixel / label information of the pixel processed immediately before the pixel of interest 71, and refers to this at the time of the labeling process of the pixel of interest 71. After performing the labeling process on the pixel of interest 71, the current line processing unit 21 outputs the pixel / label information of the pixel located immediately before the pixel of interest 71 to the 1-line preprocessing result holding unit 22 and the second labeling information storage unit. It is stored in the pixel / label information holding unit 53 of 50.
The current line processing unit 21 stores the pixel / label information in the register in the 1-line preprocessing result holding unit 22 and the pixel / label information holding unit 53 at the end of the processing of one line, and clears the register.

<付加情報>
現ライン処理部21は、1ラインの処理開始時に付加情報(図8(b))の「domain」を更新する処理を実行する。また、現ライン処理部21は、注目画素に対してラベルを付与した場合に、付加情報を更新する処理を実行する。具体的には、現ライン処理部21は、第一ラベリング情報格納部30の第一付加情報格納部33に記憶されている付加情報を読み出して、「domain」或いは注目画素に付与したラベルに係る情報を変更した付加情報を生成し、第一付加情報格納部33に書き込む処理を実行する。
図8(b)に示されている付加情報は、第7ライン14画素目のラベリング処理が終了した後において、以下のような状態であることを示している。
(1)index1が付された画素は12個存在し、それらのX軸最小値は1、Y軸最小値は2、X軸最大値は4、Y軸最大値は5である。
(2)index2が付された画素は3個存在し、それらのX軸最小値は14、Y軸最小値は5、X軸最大値は16、Y軸最大値は5である。
(3)index3が付された画素は2個存在し、それらのX軸最小値は12、Y軸最小値は6、X軸最大値は13、Y軸最大値は6である。
<Additional information>
The current line processing unit 21 executes a process of updating the "domain" of the additional information (FIG. 8B) at the start of the process of one line. Further, the current line processing unit 21 executes a process of updating the additional information when a label is attached to the pixel of interest. Specifically, the current line processing unit 21 reads the additional information stored in the first additional information storage unit 33 of the first labeling information storage unit 30, and relates to the “domain” or the label given to the target pixel. A process of generating the additional information with the changed information and writing the additional information in the first additional information storage unit 33 is executed.
The additional information shown in FIG. 8B indicates the following state after the labeling process of the 14th pixel of the 7th line is completed.
(1) There are 12 pixels to which index1 is added, and the X axis minimum value is 1, the Y axis minimum value is 2, the X axis maximum value is 4, and the Y axis maximum value is 5.
(2) There are three pixels to which index2 is added, and the X axis minimum value is 14, the Y axis minimum value is 5, the X axis maximum value is 16, and the Y axis maximum value is 5.
(3) There are two pixels to which index3 is added, and the X axis minimum value is 12, the Y axis minimum value is 6, the X axis maximum value is 13, and the Y axis maximum value is 6.

<接続情報>
現ライン処理部21は、新規なラベルを付与した場合、又は異なるラベル間の新規な接続関係を検出した場合に、接続情報(図8(c))を更新する処理を実行する。具体的には、現ライン処理部21は、現在処理接続情報格納部31に記憶されている接続情報を読み出して、注目画素に付与したラベルと接続するラベルに係る情報を変更した接続情報を生成し、現在処理接続情報格納部31に書き込む処理を実行する。
図8(c)の接続情報は、縦軸が注目画素を示し、横軸が注目画素と接続する参照画素の情報を示している。図8(a)に示すように第6ライン第13画素が注目画素であるとき、注目画素にはラベル「3」が付与されるが、参照範囲内にはラベル「2」の付された画素も存在するので、接続情報にはラベル「3」とラベル「2」の画素が接続している旨の情報が追加される。具体的には、ラベリング処理部20は、図8(c)に示す接続情報について、第3行第2列(★印)部分の情報を追加する。
<Connection information>
The current line processing unit 21 executes a process of updating the connection information (FIG. 8C) when a new label is added or when a new connection relationship between different labels is detected. Specifically, the current line processing unit 21 reads out the connection information currently stored in the processing connection information storage unit 31 and generates connection information in which the information related to the label connected to the label attached to the pixel of interest is changed. Then, the process of writing the current process connection information storage unit 31 is executed.
In the connection information of FIG. 8C, the vertical axis shows the target pixel and the horizontal axis shows the information of the reference pixel connected to the target pixel. As shown in FIG. 8A, when the 13th pixel on the 6th line is the target pixel, the target pixel is given the label “3”, but the pixel with the label “2” is added within the reference range. Since there is also, the information indicating that the pixels having the label “3” and the pixel having the label “2” are connected is added to the connection information. Specifically, the labeling processing unit 20 adds the information of the third row, second column (* mark) portion to the connection information shown in FIG. 8C.

〔フラッシュ処理〕
以下、第一ラベリング情報格納部30のフラッシュについて、フラッシュラベル数が4である場合の例により説明する。
図9は、ラベリング処理を説明する図であり、(a)は処理画像を示す図であり、(b)は付加情報を示す図であり、(c)は現在処理接続情報を示す図であり、(d)は前処理接続情報を示す図である。図9は、第7ラインのラベリング処理を終了した状態を示している。
[Flash processing]
Hereinafter, the flash of the first labeling information storage unit 30 will be described with an example in which the number of flash labels is four.
9A and 9B are diagrams for explaining the labeling process, FIG. 9A is a diagram showing a processed image, FIG. 9B is a diagram showing additional information, and FIG. 9C is a diagram showing current processing connection information. , (D) are diagrams showing preprocessing connection information. FIG. 9 shows a state in which the labeling process for the seventh line has been completed.

第一ラベリング情報格納部30は、現ライン処理部21が付与したラベルがフラッシュラベル数に到達した場合にフラッシュされる。
本例においてコントローラ42は、現ライン処理部21によって付与されたラベルに係るラベル数が画像データのライン途中でフラッシュラベル数となり、且つ現ライン処理部21による処理中のラインのラベリング処理が終了した場合に、第一ラベリング情報格納部30をフラッシュするように制御する。
The first labeling information storage unit 30 is flushed when the number of labels given by the current line processing unit 21 reaches the number of flush labels.
In this example, the controller 42 determines that the number of labels related to the label given by the current line processing unit 21 becomes the number of flash labels in the middle of the line of the image data, and the labeling process of the line being processed by the current line processing unit 21 is completed. In this case, the first labeling information storage unit 30 is controlled to flash.

フラッシュ処理における具体的な制御手順は以下の通りである。
現ライン処理部21は、注目画素に対して新規にラベルを付与した場合に、現在処理において付与したラベル数の情報をラベル数判定部41に出力する。例えば、現ライン処理部21は、第7ライン第10画素に対して新規にラベル「4」を付与した場合、使用ラベル数「4」をラベル数判定部41に通知する。ラベル数判定部41は、使用ラベル数がフラッシュラベル数に到達したか否かを判定しており、使用ラベル数がフラッシュラベル数に到達した場合にコントローラ42に対してフラッシュ要求を出力する。
現ライン処理部21は、コントローラ42に対して、1ラインの処理が終了する毎にその旨を示すライン処理終了通知を出力する。
コントローラ42は、ラベル数判定部41からのフラッシュ要求を受け付け、且つ現ライン処理部21からライン処理終了通知を受け付けた場合に、ラベリング情報を第一ラベリング情報格納部30から第二ラベリング情報格納部50に転送する。即ち、コントローラ42は、現在処理接続情報格納部31に格納されている現在処理接続情報と、前処理接続情報格納部32に格納されている前処理接続情報とを読み出して、第二ラベリング情報格納部50の全接続情報格納部51に記憶させる処理を実行する。また、コントローラ42は、第一付加情報格納部33に格納されている付加情報を読み出して、第二ラベリング情報格納部50の第二付加情報格納部52に記憶させる処理を実行する。
その後、コントローラ42は、第一ラベリング情報格納部30をフラッシュする処理を実行する。
更にコントローラ42は、現ライン処理部21に対してラベルの初期化を命令する。
The specific control procedure in the flash process is as follows.
The current line processing unit 21 outputs information on the number of labels added in the current process to the label number determination unit 41 when a new label is attached to the pixel of interest. For example, the current line processing unit 21 notifies the label number determination unit 41 of the used label number “4” when the label “4” is newly added to the seventh line and the tenth pixel. The label number determination unit 41 determines whether or not the number of used labels reaches the number of flash labels, and when the number of used labels reaches the number of flash labels, outputs a flash request to the controller 42.
The current line processing unit 21 outputs a line processing end notification to the controller 42 every time the processing of one line is completed.
When the controller 42 receives the flush request from the label number determination unit 41 and the line processing end notification from the current line processing unit 21, the controller 42 transfers the labeling information from the first labeling information storage unit 30 to the second labeling information storage unit. Transfer to 50. That is, the controller 42 reads the current processing connection information stored in the current processing connection information storage unit 31 and the preprocessing connection information stored in the preprocessing connection information storage unit 32 to store the second labeling information. The process of storing in the all connection information storage unit 51 of the unit 50 is executed. In addition, the controller 42 reads the additional information stored in the first additional information storage unit 33 and stores it in the second additional information storage unit 52 of the second labeling information storage unit 50.
After that, the controller 42 executes a process of flushing the first labeling information storage unit 30.
Further, the controller 42 instructs the current line processing unit 21 to initialize the label.

〔フラッシュ後のラベリング処理〕
図10は、フラッシュ後のラベリング処理を説明する図であり、(a)は処理画像を示す図であり、(b)は付加情報を示す図であり、(c)は現在処理接続情報を示す図であり、(d)は前処理接続情報を示す図である。図10は、第8ラインの途中までラベリング処理が行われた状態を示している。
現ライン処理部21は第一ラベリング情報格納部30がフラッシュされた後、コントローラ42からのラベル初期化命令に従って、画素に付与するラベルを初期化する。即ち、現ライン処理部21は、フラッシュ後に、最初に検知されたラベルの付与対象となる注目画素に対してラベル「1」を付与する。現ライン処理部21は、前処理における付加情報のIDをカウントアップした付加情報を生成して、第一付加情報格納部に記憶させる。このとき、現ライン処理部21は、処理ラインを示す「domain」にフラッシュ後の処理ラインに係る情報を与える。
現ライン処理部21は、新規なラベルを付与した場合、又はフラッシュ後に処理したライン中で異なるラベル間の新規な接続関係を検出した場合に、現在処理接続情報(図10(c))を更新して、現在処理接続情報格納部31に記憶させる。
現ライン処理部21は、フラッシュ前に処理されたライン中のラベルと、フラッシュ後に処理したライン中のラベルとの間に接続関係を検出した場合に、前処理接続情報(図10(d))を更新して、前処理接続情報格納部32に記憶させる。
[Labeling after flash]
FIG. 10 is a diagram for explaining the labeling process after flushing, (a) is a diagram showing a processed image, (b) is a diagram showing additional information, and (c) is current processing connection information. It is a figure and (d) is a figure which shows pre-processing connection information. FIG. 10 shows a state where the labeling process has been performed up to the middle of the eighth line.
After the first labeling information storage unit 30 is flushed, the current line processing unit 21 initializes the label to be given to the pixel according to the label initialization command from the controller 42. That is, the current line processing unit 21 gives the label “1” to the pixel of interest to which the label is first detected after the flash. The current line processing unit 21 generates additional information by counting up the ID of the additional information in the pre-processing, and stores it in the first additional information storage unit. At this time, the current line processing unit 21 gives "domain" indicating the processing line information regarding the processing line after the flush.
The current line processing unit 21 updates the current processing connection information (FIG. 10 (c)) when a new label is added or when a new connection relationship between different labels is detected in the line processed after flushing. Then, it is stored in the current processing connection information storage unit 31.
When the current line processing unit 21 detects the connection relationship between the label in the line processed before the flush and the label in the line processed after the flush, the preprocess connection information (FIG. 10D). Is updated and stored in the preprocessing connection information storage unit 32.

図11は、現ライン処理部によるラベリング処理が完了した後の処理画像の一例を示す図である。本図は、最終的に第二ラベリング情報格納部50の画素・ラベル情報保持部53に記憶される情報を示している。
現ライン処理部21は、コントローラ42に対して1フレームの画像データの処理(図では第23ライン第23画素の処理)が終了したときにフレーム処理終了通知を出力する。
コントローラ42は、現ライン処理部21からのフレーム処理終了通知を受けて、第一ラベリング情報格納部30に記憶されている全ての情報を第二ラベリング情報格納部50へ転送する処理と、第一ラベリング情報格納部30をフラッシュする処理を実行する。
FIG. 11 is a diagram showing an example of a processed image after the labeling process by the current line processing unit is completed. This figure shows the information finally stored in the pixel / label information holding unit 53 of the second labeling information storage unit 50.
The current line processing unit 21 outputs a frame processing end notification to the controller 42 when the processing of the image data of one frame (the processing of the 23rd pixel on the 23rd line in the figure) is completed.
The controller 42 receives the frame processing end notification from the current line processing unit 21 and transfers all the information stored in the first labeling information storage unit 30 to the second labeling information storage unit 50; A process of flushing the labeling information storage unit 30 is executed.

図12(a)〜(c)は、第二ラベリング情報格納部の全接続情報格納部と付加情報格納部に格納されるデータの一例を示す図である。本図は、1フレームの画像についてラベリング処理が完了した場合に第二ラベリング情報格納部に格納される情報を示しており、(a)はID0のラベリング情報を、(b)はID1のラベリング情報を、(c)はID2のラベリング情報を示している。夫々のラベリング情報は、付加情報と現在処理接続情報と前処理接続情報を含んでいる。   12A to 12C are diagrams showing an example of data stored in the all connection information storage unit and the additional information storage unit of the second labeling information storage unit. This figure shows the information stored in the second labeling information storage unit when the labeling process is completed for one frame image. (A) shows the labeling information of ID0, (b) shows the labeling information of ID1. (C) shows the labeling information of ID2. Each piece of labeling information includes additional information, current processing connection information, and preprocessing connection information.

図13は、第二ラベリング情報格納部のアドレスマップの概要を示す図である。本図には、全接続情報格納部51と第二付加情報格納部52に係るアドレスマップのみを示している。第二ラベリング情報格納部50には、ID毎に順次ラベリング情報(図12(a)〜(c))を格納する格納領域54a〜54cが形成される。夫々のラベリング情報の格納領域は、付加情報を格納する付加情報格納領域55、現在処理接続情報を格納する現在処理接続情報格納領域56、及び前処理接続情報を格納する前処理接続情報格納領域57を備えている。   FIG. 13 is a diagram showing an outline of the address map of the second labeling information storage unit. In this figure, only the address maps relating to the all connection information storage unit 51 and the second additional information storage unit 52 are shown. The second labeling information storage unit 50 is formed with storage areas 54a to 54c for sequentially storing labeling information (FIGS. 12A to 12C) for each ID. The respective labeling information storage areas are an additional information storage area 55 for storing additional information, a current processing connection information storage area 56 for storing current processing connection information, and a preprocessing connection information storage area 57 for storing preprocessing connection information. Is equipped with.

〔ラベル連結処理〕
ラベル連結処理部60(図3)は、第二ラベリング情報格納部50の画素・ラベル情報保持部53に記憶された画素・ラベル情報(図11)と、全接続情報格納部51に記憶された接続情報(図12)とを用いてラベルを連結する処理を実行する。
ラベル連結処理部60は、第二ラベリング情報格納部50の画素・ラベル情報保持部53中の画素・ラベル情報(図11)を第0ラインから順次確認していき、ラベルを連結する。
まず、ラベル連結処理部60は、第二ラベリング情報格納部50の全接続情報格納部51に記憶されているID「0」(図12(a))の現在処理接続情報を用いてラベル連結処理を実行する。ラベル連結処理部60は、現在処理接続情報に基づいて、ラベル(index)「2」がラベル「3」及び「4」と接続していると判定し、ラベル「3」、「4」が割り振られた画素のラベルを全て「2」に変更する。なお、ラベル連結処理部60は、ラベル「4」がラベル「2」に変更された旨の情報を一時的に記憶しておく。
[Label connection processing]
The label concatenation processing unit 60 (FIG. 3) stores the pixel / label information (FIG. 11) stored in the pixel / label information holding unit 53 of the second labeling information storage unit 50 and the all connection information storage unit 51. A process of connecting the labels is executed using the connection information (FIG. 12).
The label concatenation processing unit 60 sequentially confirms the pixel / label information (FIG. 11) in the pixel / label information holding unit 53 of the second labeling information storage unit 50 from the 0th line, and concatenates the labels.
First, the label connection processing unit 60 uses the current processing connection information of ID “0” (FIG. 12A) stored in the all connection information storage unit 51 of the second labeling information storage unit 50 to perform label connection processing. To execute. The label concatenation processing unit 60 determines that the label (index) “2” is connected to the labels “3” and “4” based on the current processing connection information, and the labels “3” and “4” are allocated. The labels of the selected pixels are all changed to "2". The label concatenation processing unit 60 temporarily stores information indicating that the label “4” has been changed to the label “2”.

次に、ラベル連結処理部60は、ID「1」(図12(b))の現在処理接続情報及び前処理接続情報を用いてラベル連結処理を実行する。
前処理接続情報にはラベル「1」が前処理におけるラベル「4」と接続している情報が含まれており、ラベル連結処理部60はID「0」のラベル連結処理においてラベル「4」がラベル「2」に変更された旨の情報を記憶しているので、ラベル連結処理部60はID「1」におけるラベル「1」をラベル「2」に変更する。
ラベル連結処理部60は、他のラベルと接続していない独立したラベル「2」、「3」、「4」を、最小の未使用ラベルから順にそれぞれラベル「3」、「4」、「5」に振り直す。また、ラベル連結処理部60は、ID「1」のラベル「1」〜「4」が、それぞれラベル「2」〜「5」に変更された旨の情報を一時的に記憶する。
Next, the label concatenation processing unit 60 executes the label concatenation processing using the current processing connection information and preprocessing connection information of ID "1" (FIG. 12B).
The preprocessing connection information includes the information that the label “1” is connected to the label “4” in the preprocessing, and the label concatenation processing unit 60 determines that the label “4” is identified in the label concatenation processing of ID “0”. Since the information indicating that the label has been changed to “2” is stored, the label concatenation processing unit 60 changes the label “1” in the ID “1” to the label “2”.
The label concatenation processing unit 60 labels the independent labels “2”, “3”, and “4” that are not connected to other labels in order from the smallest unused label to the labels “3”, “4”, and “5”, respectively. Re-roll. Further, the label concatenation processing unit 60 temporarily stores information indicating that the labels “1” to “4” with the ID “1” have been changed to the labels “2” to “5”, respectively.

最後に、ラベル連結処理部60は、ID「2」(図12(c))の現在処理接続情報及び前処理接続情報を用いて上記と同様にラベル連結処理を実行する。
図14は、ラベル連結処理後の処理画像の一例を示す図である。最終的には、図14に示すようなラベル連結画像が得られる。
Finally, the label concatenation processing unit 60 executes the label concatenation processing in the same manner as above using the current processing connection information and preprocessing connection information of ID "2" (FIG. 12 (c)).
FIG. 14 is a diagram showing an example of a processed image after the label connecting process. Finally, the label connected image as shown in FIG. 14 is obtained.

〔変形例等〕
本実施形態において、ラベル数判定部41には、第一ラベリング情報格納部30に格納可能なラベリング情報の最大ラベル数よりも少ない数をフラッシュラベル数として設定する。具体的には以下のように設定される。即ち、フラッシュラベル数は、このフラッシュラベル数に対応したラベリング情報の格納に必要な記憶容量と、現ライン処理部21によって付与されたラベルの個数がライン途中でフラッシュラベル数となった後、このラインの残部について新規に付与されるラベル数の予測値に対応したラベリング情報の格納に必要な記憶容量と、を加算した容量が、第一ラベリング情報格納部30の記憶容量を越えないように設定される。仮に、1ラインの処理中に現ライン処理部21の付与したラベル数がフラッシュラベル数を超えたとしても、第一ラベリング情報格納部30には、1ラインの処理が終了するまで最大ラベル数の範囲内でラベリング情報を順次格納することができる。
[Modifications, etc.]
In the present embodiment, the label number determination unit 41 sets the number smaller than the maximum label number of the labeling information that can be stored in the first labeling information storage unit 30 as the flash label number. Specifically, it is set as follows. That is, the number of flash labels is the storage capacity required for storing the labeling information corresponding to the number of flash labels, and the number of labels given by the current line processing unit 21 becomes the number of flash labels in the middle of the line, The storage capacity required to store the labeling information corresponding to the predicted value of the number of labels newly added to the remaining part of the line is set so that the added capacity does not exceed the storage capacity of the first labeling information storage section 30. To be done. Even if the number of labels assigned by the current line processing unit 21 exceeds the number of flash labels during the processing of one line, the maximum number of labels is stored in the first labeling information storage unit 30 until the processing of one line is completed. The labeling information can be sequentially stored within the range.

本実施形態においては、第一ラベリング情報格納部30のフラッシュを1ラインの処理終了後に実行するが、ライン途中でフラッシュする構成としてもよい。この場合、ラベル数判定部41には、第一ラベリング情報格納部30に格納可能なラベリング情報の最大ラベル数をフラッシュラベル数として設定することができる。付加情報(図5)の「domain」は、フラッシュ処理によって区切られる領域の始点画素と終点画素の情報となる。コントローラ42は、ラベリング処理部20の付与したラベル数がフラッシュラベル数となり、且つそのラベルの付された画素が連続しなくなったときに、第一ラベリング情報格納部30をフラッシュするように制御する。   In the present embodiment, the flushing of the first labeling information storage unit 30 is executed after the processing of one line is completed, but it may be configured to flush in the middle of the line. In this case, the maximum number of labels of the labeling information that can be stored in the first labeling information storage unit 30 can be set in the label number determination unit 41 as the number of flash labels. The “domain” of the additional information (FIG. 5) becomes information of the starting point pixel and the ending point pixel of the area divided by the flash process. The controller 42 controls to flash the first labeling information storage unit 30 when the number of labels provided by the labeling processing unit 20 becomes the number of flash labels and the pixels with the labels are not continuous.

上記実施形態においては、小容量であるがアクセス速度が高速な記憶手段としてSRAMを、大容量であるがアクセス速度が低速な記憶手段(メモリ)としてDRAMを例に挙げて説明したが、本発明において第一ラベリング情報格納部30と第二ラベリング情報格納部50に利用する記憶手段をこれに限定するものではない。
例えば、第一ラベリング情報格納部30にはSRAM以外の高速応答性の高い記憶手段として、フリップフロップ回路を用いることができる。第二ラベリング情報格納部50としてDRAM以外に、フラッシュメモリやHDD(Hard Disk Drive)を用いることもできる。また、第二ラベリング情報格納部50はI/F部16を介して接続された外部メモリ(外部記憶装置)としてもよい。
上記実施形態において、SRAMやDRAMを説明するに際し、アクセス速度と容量との関係を規定しているが、一般的にアクセス速度が高速な記憶装置は高価であるため、装置を安価に提供するためには小容量のものを用いるのが好ましく、一方、アクセス速度が低速な記憶装置は大容量であるにも関わらず安価であることが多いという前提に基づいて記載しているに過ぎず、本発明を何ら限定するものではない。
In the above embodiments, the SRAM has been described as an example of a storage unit having a small capacity but a high access speed, and the DRAM has been described as an example of a storage unit (memory) having a large capacity but a low access speed. In the above, the storage means used for the first labeling information storage unit 30 and the second labeling information storage unit 50 is not limited to this.
For example, a flip-flop circuit can be used in the first labeling information storage unit 30 as a storage device with high high-speed response other than SRAM. As the second labeling information storage unit 50, a flash memory or an HDD (Hard Disk Drive) can be used instead of the DRAM. The second labeling information storage unit 50 may be an external memory (external storage device) connected via the I / F unit 16.
In the above embodiment, the relation between the access speed and the capacity is defined when describing the SRAM or the DRAM. However, since a storage device having a high access speed is generally expensive, the device is provided at low cost. It is preferable to use a small-capacity storage device, while the storage device with a low access speed is often described as an inexpensive storage device despite its large storage capacity. It does not limit the invention in any way.

本実施形態においては、第一ラベリング情報格納部30のフラッシュ時に、現ライン処理部21が付与するラベルも初期化したが、現ライン処理部21はフラッシュ後もフラッシュ前に付与したラベルに連続するラベルを付与してもよい。つまり、現ライン処理部21は、フラッシュが実行されたか否かに関わらず、ラベルをカウントアップして付与してもよい。   In the present embodiment, when the first labeling information storage unit 30 is flushed, the label given by the current line processing unit 21 is also initialized, but the current line processing unit 21 continues to the label given before the flushing even after the flushing. A label may be given. That is, the current line processing unit 21 may count up and add the label regardless of whether the flush is executed.

〔ラベリング処理装置の使用用途〕
本実施形態に係る画像処理装置(ラベリング処理装置)は、製造ラインにおける欠陥検査装置、物体の追跡処理を行うための監視カメラ装置、医療分野における検査装置(例えば眼科の検査装置)等に組み込むことができる。画像データに対してラベリング処理を行うことで入力画像中に存在する連結領域を特定し、特定された連結領域の面積や重心を求めることができ、種々の検査等に利用できる。
なお、連結領域の存在エリアや連結領域の大きさ(連結領域を構成する画素の個数)がわかれば十分であるような場合には、主として付加情報を利用することができ、ラベル連結処理は必要とされない場合もあり得る。
[Usage of labeling equipment]
The image processing apparatus (labeling processing apparatus) according to the present embodiment is incorporated into a defect inspection apparatus in a manufacturing line, a surveillance camera apparatus for performing object tracking processing, an inspection apparatus in the medical field (for example, an ophthalmic inspection apparatus), and the like. You can By performing a labeling process on the image data, it is possible to specify the connected area existing in the input image, obtain the area and the center of gravity of the specified connected area, and use the method for various inspections.
If it is sufficient to know the existing area of the connected area and the size of the connected area (the number of pixels forming the connected area), the additional information can be mainly used and the label connecting process is necessary. It may not be done.

〔本発明の実施態様例と作用、効果のまとめ〕
<第一の実施態様>
本態様に係るラベリング処理装置(画像処理装置1)は、画像データの注目画素に隣接する参照画素に付与されたラベルを参照して、注目画素にラベルを付与するラベリング処理部20と、ラベリング処理部によって付与されたラベルに係るラベリング情報を記憶する第一ラベリング情報格納部30と、第一ラベリング情報格納部から転送されたラベリング情報を記憶する第二ラベリング情報格納部50と、ラベリング処理部によって付与されたラベルに係るラベル数がフラッシュラベル数に到達した場合に、第一ラベリング情報格納部に記憶されているラベリング情報を第二ラベリング情報格納部へ転送させると共に第一ラベリング情報格納部をフラッシュするフラッシュ制御部40と、を備えることを特徴とする。
[Summary of Example Embodiments of the Present Invention and Actions and Effects]
<First embodiment>
The labeling processing device (image processing device 1) according to the present aspect refers to a label attached to a reference pixel adjacent to a pixel of interest of image data, a labeling processing unit 20 that attaches a label to a pixel of interest, and a labeling process. The first labeling information storage unit 30 that stores the labeling information related to the label given by the copy unit, the second labeling information storage unit 50 that stores the labeling information transferred from the first labeling information storage unit, and the labeling processing unit. When the number of labels related to the assigned label reaches the number of flash labels, the labeling information stored in the first labeling information storage unit is transferred to the second labeling information storage unit and the first labeling information storage unit is flushed. And a flash control unit 40 for controlling the flash.

ラベリング処理部が生成するラベリング情報を直接、リアルタイムで記憶していくメモリには高速動作が要求される。しかし、高速動作が可能なメモリに1フレームの画像データから生成される全てのラベリング情報を格納しようとすれば、当該メモリに要求される記憶容量が大きくなり、装置コストが過大となるという問題がある。
そこで、本態様に係るラベリング処理装置には、ラベリングの処理結果を保存する複数のメモリ(第一ラベリング情報格納部と第二ラベリング情報格納部)を配置した。第一ラベリング情報格納部はラベリング処理部が生成するラベリング情報を直接、リアルタイムで記憶していく手段であり、高速動作が要求されるメモリである。第二ラベリング情報格納部は、一旦は第一ラベリング情報格納部に記憶されたラベリング情報を所定のタイミングで第一ラベリング情報格納部から退避させる手段であり、処理速度は低速で構わないが、記憶容量が要求されるメモリである。このように、ラベリング情報格納部を複数用意することによって、夫々のラベリング情報格納部には、役割に応じて必要な性能を与えることができるようになる。
従って、本態様によれば、様々な画像のラベリング処理を行うに際し、ラベリング処理を高速に実行することができ、且つ、ラベリングの処理結果をリアルタイムで保存するメモリの容量を小さくできる。即ち、本態様によれば、画像処理装置の高速性とリアルタイム性を維持しながら、安価な装置構成としても、生成された1フレーム分のラベリング情報を記憶するために必要な容量を十分に確保することができる。
A high-speed operation is required for a memory that directly stores the labeling information generated by the labeling processing unit in real time. However, if all the labeling information generated from one frame of image data is to be stored in a memory that can operate at high speed, the storage capacity required for the memory becomes large and the device cost becomes excessive. is there.
Therefore, in the labeling processing apparatus according to this aspect, a plurality of memories (first labeling information storage section and second labeling information storage section) for storing the labeling processing result are arranged. The first labeling information storage unit is a means for directly storing the labeling information generated by the labeling processing unit in real time, and is a memory that requires high-speed operation. The second labeling information storage unit is a unit that temporarily saves the labeling information stored in the first labeling information storage unit from the first labeling information storage unit at a predetermined timing. It is a memory whose capacity is required. In this way, by preparing a plurality of labeling information storage units, it becomes possible to give each labeling information storage unit a required performance according to its role.
Therefore, according to this aspect, the labeling process can be executed at high speed when the labeling process of various images is performed, and the capacity of the memory for storing the labeling process result in real time can be reduced. That is, according to this aspect, while maintaining the high speed and the real-time property of the image processing apparatus, even with an inexpensive apparatus configuration, a sufficient capacity for storing the generated one frame of labeling information is secured. can do.

<第二の実施態様>
本態様に係るラベリング処理装置(画像処理装置1)において、ラベリング処理部20は、第一ラベリング情報格納部30がフラッシュされた場合に、フラッシュ前に付与されたラベルと、フラッシュ後に付与されたラベルとの接続関係を示す前処理接続情報を第一ラベリング情報格納部30に記憶させることを特徴とする。
本態様によれば、第一ラベリング情報格納部をフラッシュしても、フラッシュ前後に付されたラベル同士の接続関係を第一ラベリング情報格納部に記憶させるので、フラッシュ前後のラベルについても問題なくラベル連結処理を行うことができる。
<Second embodiment>
In the labeling processing apparatus (image processing apparatus 1) according to this aspect, the labeling processing unit 20 is configured such that, when the first labeling information storage unit 30 is flushed, the label given before the flush and the label given after the flush. It is characterized in that preprocessing connection information indicating a connection relationship with is stored in the first labeling information storage unit 30.
According to this aspect, even if the first labeling information storage unit is flushed, the connection relationship between the labels attached before and after the flashing is stored in the first labeling information storage unit, so that the labels before and after the flushing will not be a problem. A connection process can be performed.

<第三の実施態様>
本態様に係るラベリング処理装置(画像処理装置1)において、フラッシュ制御部40は、ラベリング処理部20によって付与されたラベルに係るラベル数が画像データのライン途中でフラッシュラベル数となった場合に、ラベリング処理部による該ラインの処理が終了したときに第一ラベリング情報格納部30をフラッシュすることを特徴とする。
画像データのライン途中で第一ラベリング情報格納部をフラッシュすることも可能であるが、ラベリング処理が複雑化し、ラベリング処理に係わる回路が肥大化するという問題がある。
本態様によれば、第一ラベリング情報格納部のフラッシュをライン単位で行うことによって、ラベリング処理を簡素化にすることができ、ラベリング処理に係わる回路をコンパクトにすることができる。
<Third embodiment>
In the labeling processing device (image processing device 1) according to this aspect, the flash control unit 40, when the label number related to the label given by the labeling processing unit 20 becomes the flash label number in the middle of the line of the image data, It is characterized in that the first labeling information storage unit 30 is flushed when the processing of the line by the labeling processing unit is completed.
Although it is possible to flash the first labeling information storage part in the middle of the line of the image data, there is a problem that the labeling process becomes complicated and the circuit related to the labeling process becomes enlarged.
According to this aspect, by performing the flushing of the first labeling information storage unit on a line-by-line basis, the labeling process can be simplified, and the circuit related to the labeling process can be made compact.

<第四の実施態様>
本態様に係るラベリング処理装置(画像処理装置1)は、第一ラベリング情報格納部30のアクセス速度が、第二ラベリング情報格納部50のアクセス速度よりも速いことを特徴とする。
本態様によれば、ラベリング処理部が生成するラベリング情報を第一ラベリング情報格納部にリアルタイムで高速に記憶させることができる。また、アクセス速度が比較的低速なメモリは安価であるため、第二ラベリング情報格納部を1フレーム分のラベリング情報を記憶するために必要な程度に大容量化しても、装置を安価に構成することができる。
<Fourth Embodiment>
The labeling processing device (image processing device 1) according to this aspect is characterized in that the access speed of the first labeling information storage unit 30 is faster than the access speed of the second labeling information storage unit 50.
According to this aspect, the labeling information generated by the labeling processing unit can be stored in the first labeling information storage unit at high speed in real time. Further, since the memory having a relatively low access speed is inexpensive, even if the capacity of the second labeling information storage unit is increased to the extent necessary to store the labeling information for one frame, the device can be configured inexpensively. be able to.

<第五の実施態様>
本態様に係るラベリング処理装置(画像処理装置1)は、第一ラベリング情報格納部30の記憶容量が、第二ラベリング情報格納部50の記憶容量よりも少ないことを特徴とする。
本態様によれば、第一ラベリング情報格納部を高速アクセスが可能なメモリとしても、記憶容量を低容量とすることができるので、装置の低コスト化を実現できる。また、第二ラベリング情報格納部を大容量とすることによって、第一ラベリング情報格納部を低容量化しても、ラベリング処理において付与するラベル数は制限を受けず、これにより様々な画像のラベリング処理を行うことが可能となる。
<Fifth Embodiment>
The labeling processing apparatus (image processing apparatus 1) according to this aspect is characterized in that the storage capacity of the first labeling information storage unit 30 is smaller than the storage capacity of the second labeling information storage unit 50.
According to this aspect, even if the first labeling information storage unit is a memory that can be accessed at high speed, the storage capacity can be made low, so that the cost of the device can be reduced. Further, by increasing the capacity of the second labeling information storage unit, even if the capacity of the first labeling information storage unit is reduced, the number of labels to be given in the labeling process is not limited, and thus the labeling process of various images is performed. It becomes possible to do.

<第六の実施態様>
本態様に係るラベリング処理装置(画像処理装置1)において、フラッシュラベル数は、フラッシュラベル数に対応したラベリング情報に係る記憶容量と、ラベリング処理部20によって付与されたラベルの個数がライン途中でフラッシュラベル数となった後、該ラインの残部について新規に付与されるラベル数の予測値に対応したラベリング情報に係る記憶容量と、を加算した容量が、第一ラベリング情報格納部30の記憶容量を超えないように設定されることを特徴とする。
画像データのライン途中でフラッシュを行えば、第一ラベリング情報格納部には記憶容量の最大限までラベリング情報を格納することができる。しかし、ラベリング処理の簡素化とラベリング処理に係わる回路のコンパクト化を考慮すると、フラッシュはライン単位で行う方が望ましい。そのためには、ライン単位でのフラッシュを保証できるようにする必要がある。
本態様においては、ラベリング処理部が付与したラベル数がライン途中でフラッシュラベル数に到達したとしても、第一ラベリング情報格納部には少なくとも当該ラインのラベリング処理が終了するまでに生成されるラベリング情報も格納できるような容量を持たせている。このようにすることでライン単位でのフラッシュ処理を保証することができる。
<Sixth embodiment>
In the labeling processing apparatus (image processing apparatus 1) according to the present aspect, the number of flash labels is the storage capacity of the labeling information corresponding to the number of flash labels and the number of labels given by the labeling processing unit 20 in the middle of the line. After the number of labels is reached, the storage capacity of the first labeling information storage unit 30 is calculated by adding the storage capacity of the labeling information corresponding to the predicted value of the number of labels newly added to the rest of the line to the storage capacity of the first labeling information storage unit 30. The feature is that it is set not to exceed.
If the flashing is performed in the middle of the line of the image data, the labeling information can be stored in the first labeling information storage unit up to the maximum storage capacity. However, considering the simplification of the labeling process and the compactness of the circuit related to the labeling process, it is preferable to perform the flash in units of lines. For that purpose, it is necessary to ensure the flash in units of lines.
In this aspect, even if the number of labels given by the labeling processing unit reaches the number of flash labels in the middle of the line, the labeling information generated in the first labeling information storage unit at least until the labeling process of the line is completed. It also has a capacity to store. By doing so, it is possible to guarantee the flash processing for each line.

<第七の実施態様>
本態様に係るラベリング処理装置(画像処理装置1)において、ラベリング処理部20は、ラベリング処理結果として、ラベル同士の接続関係を表す接続情報と、ラベルを付与された画素の数及び存在範囲をラベル毎に示す付加情報とを生成して第一ラベリング情報格納部30に記憶させ、画像データ中の各画素と各画素に付与されたラベルとの対応関係を示す画素・ラベル情報を生成して第二ラベリング情報格納部50に記憶させることを特徴とする。
本態様によれば、ラベリング処理中にリアルタイムで変更される接続情報と付加情報を第一ラベリング情報格納部に記憶させ、ラベリング処理中に変更されない画素・ラベル情報を第二ラベリング情報格納部に記憶させるので、第一ラベリング情報格納部の記憶容量を低容量化することができる。
<Seventh embodiment>
In the labeling processing device (image processing device 1) according to this aspect, the labeling processing unit 20 labels, as the labeling processing result, the connection information indicating the connection relationship between the labels, the number of labeled pixels, and the existing range. The additional information shown for each pixel is generated and stored in the first labeling information storage unit 30, and the pixel / label information indicating the correspondence between each pixel in the image data and the label assigned to each pixel is generated to generate the pixel / label information. It is characterized in that it is stored in the two-labeling information storage unit 50.
According to this aspect, the connection information and the additional information that are changed in real time during the labeling process are stored in the first labeling information storage unit, and the pixel / label information that is not changed during the labeling process is stored in the second labeling information storage unit. Therefore, the storage capacity of the first labeling information storage section can be reduced.

1…画像処理装置(ラベリング処理装置)、11…CPU、12…レジスタ、13…ラベリング演算処理部、14…ライン、15…メモリ、16…I/F部、17…二値化処理部、18…ノイズ除去部、19…制御部、20…ラベリング処理部、21…現ライン処理部、22…ライン前処理結果保持部、30…第一ラベリング情報格納部、31…現在処理接続情報格納部、32…前処理接続情報格納部、33…第一付加情報格納部、40…フラッシュ制御部、41…ラベル数判定部、42…コントローラ、50…第二ラベリング情報格納部、51…全接続情報格納部、52…第二付加情報格納部、53…画素・ラベル情報保持部、54a〜54c…格納領域、55…付加情報格納領域、56…現在処理接続情報格納領域、57…前処理接続情報格納領域、60…ラベル連結処理部、70…走査マスク、71…注目画素、72a〜72d…参照画素   DESCRIPTION OF SYMBOLS 1 ... Image processing device (labeling processing device), 11 ... CPU, 12 ... Register, 13 ... Labeling calculation processing part, 14 ... Line, 15 ... Memory, 16 ... I / F part, 17 ... Binarization processing part, 18 ... noise removing unit, 19 ... control unit, 20 ... labeling processing unit, 21 ... current line processing unit, 22 ... line preprocessing result holding unit, 30 ... first labeling information storage unit, 31 ... current processing connection information storage unit, 32 ... Preprocessing connection information storage unit, 33 ... First additional information storage unit, 40 ... Flash control unit, 41 ... Label number determination unit, 42 ... Controller, 50 ... Second labeling information storage unit, 51 ... All connection information storage 52, second additional information storage unit, 53, pixel / label information holding unit, 54a to 54c, storage area, 55, additional information storage area, 56, current processing connection information storage area, 57, preprocessing connection information Storage area, 60 ... label link unit, 70 ... scanning mask, 71 ... target pixel, 72a to 72d ... reference pixels

Claims (7)

画像データの注目画素に隣接する参照画素に付与されたラベルを参照して、注目画素にラベルを付与するラベリング処理部と、
ラベリング処理部によって付与されたラベルに係るラベリング情報を記憶する第一ラベリング情報格納部と、
第一ラベリング情報格納部から転送されたラベリング情報を記憶する第二ラベリング情報格納部と、
ラベリング処理部によって付与されたラベルに係るラベル数がフラッシュラベル数に到達した場合に、第一ラベリング情報格納部に記憶されているラベリング情報を第二ラベリング情報格納部へ転送させると共に第一ラベリング情報格納部をフラッシュするフラッシュ制御部と、を備えることを特徴とするラベリング処理装置。
A labeling processing unit that attaches a label to a pixel of interest by referring to a label attached to a reference pixel adjacent to the pixel of interest of the image data;
A first labeling information storage unit that stores labeling information related to labels given by the labeling processing unit;
A second labeling information storage unit that stores the labeling information transferred from the first labeling information storage unit;
When the number of labels related to the label given by the labeling processing unit reaches the number of flash labels, the labeling information stored in the first labeling information storage unit is transferred to the second labeling information storage unit and the first labeling information is transferred. A labeling processing device, comprising: a flash control unit that flashes a storage unit.
前記ラベリング処理部は、前記第一ラベリング情報格納部がフラッシュされた場合に、フラッシュ前に付与されたラベルと、フラッシュ後に付与されたラベルとの接続関係を示す前処理接続情報を前記第一ラベリング情報格納部に記憶させることを特徴とする請求項1に記載のラベリング処理装置。   When the first labeling information storage unit is flushed, the labeling processing unit provides preprocessing connection information indicating a connection relationship between a label given before flushing and a label given after flushing. The labeling processing device according to claim 1, wherein the labeling processing device stores the information in the information storage unit. 前記フラッシュ制御部は、前記ラベリング処理部によって付与されたラベルに係るラベル数が前記画像データのライン途中で前記フラッシュラベル数となった場合に、前記ラベリング処理部による該ラインの処理が終了したときに前記第一ラベリング情報格納部をフラッシュすることを特徴とする請求項1又は2に記載のラベリング処理装置。   When the number of labels related to the label given by the labeling processing unit reaches the number of flash labels in the middle of the line of the image data, the flash control unit finishes the processing of the line by the labeling processing unit. The labeling processing apparatus according to claim 1 or 2, wherein the first labeling information storage unit is flashed. 前記第一ラベリング情報格納部のアクセス速度が、前記第二ラベリング情報格納部のアクセス速度よりも速いことを特徴とする請求項1乃至3の何れか一項に記載のラベリング処理装置。   The labeling processing device according to claim 1, wherein an access speed of the first labeling information storage unit is faster than an access speed of the second labeling information storage unit. 前記第一ラベリング情報格納部の記憶容量が、前記第二ラベリング情報格納部の記憶容量よりも少ないことを特徴とする請求項1乃至4の何れか一項に記載のラベリング処理装置。   5. The labeling processing device according to claim 1, wherein the storage capacity of the first labeling information storage unit is smaller than the storage capacity of the second labeling information storage unit. 前記フラッシュラベル数は、該フラッシュラベル数に対応したラベリング情報に係る記憶容量と、前記ラベリング処理部によって付与されたラベルの個数がライン途中で前記フラッシュラベル数となった後、該ラインの残部について新規に付与されるラベル数の予測値に対応したラベリング情報に係る記憶容量と、を加算した容量が、前記第一ラベリング情報格納部の記憶容量を越えないように設定されることを特徴とする請求項1乃至5の何れか一項に記載のラベリング処理装置。   The number of flash labels is the storage capacity related to the labeling information corresponding to the number of flash labels and the number of labels given by the labeling processing unit becomes the number of flash labels in the middle of the line, and then the remaining portion of the line. The storage capacity related to the labeling information corresponding to the predicted value of the number of labels to be newly added, and the storage capacity are set so as not to exceed the storage capacity of the first labeling information storage unit. The labeling processing device according to claim 1. 前記ラベリング処理部は、ラベリング処理結果として、ラベル同士の接続関係を表す接続情報と、ラベルを付与された画素の数及び存在範囲をラベル毎に示す付加情報とを生成して前記第一ラベリング情報格納部に記憶させ、前記画像データ中の各画素と該各画素に付与されたラベルとの対応関係を示す画素・ラベル情報を生成して前記第二ラベリング情報格納部に記憶させることを特徴とする請求項1乃至6の何れか一項に記載のラベリング処理装置。   The labeling processing unit, as the labeling processing result, generates connection information indicating a connection relationship between labels and additional information indicating the number and existence range of labeled pixels for each label, and the first labeling information. A pixel / label information indicating a correspondence between each pixel in the image data and a label given to each pixel is generated and stored in the second labeling information storage unit. The labeling processing apparatus according to any one of claims 1 to 6.
JP2017118442A 2017-06-16 2017-06-16 Labeling processor Active JP6681077B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017118442A JP6681077B2 (en) 2017-06-16 2017-06-16 Labeling processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017118442A JP6681077B2 (en) 2017-06-16 2017-06-16 Labeling processor

Publications (2)

Publication Number Publication Date
JP2019003469A JP2019003469A (en) 2019-01-10
JP6681077B2 true JP6681077B2 (en) 2020-04-15

Family

ID=65006920

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017118442A Active JP6681077B2 (en) 2017-06-16 2017-06-16 Labeling processor

Country Status (1)

Country Link
JP (1) JP6681077B2 (en)

Also Published As

Publication number Publication date
JP2019003469A (en) 2019-01-10

Similar Documents

Publication Publication Date Title
JP5854802B2 (en) Image processing apparatus, image processing method, and computer program
JPH1166325A (en) Method and device for determining boundary of object and recording medium recording boundary determination program for object
JP2006318032A (en) Image processing method and image processor
CN103428511A (en) Pattern processing device, pattern processing method
JP6815741B2 (en) Image processing device and image processing method
JP6681077B2 (en) Labeling processor
US20190244359A1 (en) Image processing method and image processing device
KR20100052850A (en) A rasterizer for 2d vector graphics and method
US5835629A (en) Code pattern-image processing apparatus
JP5697475B2 (en) Labeling processing apparatus and labeling processing method
JP6749528B1 (en) Defect management device, modification management method, and modification management program
JP6922690B2 (en) Character area extraction program, character area extraction device and character area extraction method
US11195249B2 (en) Processing device having a row number determining unit
JP4585999B2 (en) Image processing apparatus, image processing method, and program
JP2585872B2 (en) Image noise removal device
JP3395346B2 (en) Fillet coordinate generation method and device
JP4519272B2 (en) Pattern inspection apparatus and pattern inspection method
JP2838556B2 (en) Image processing device
JPH05189563A (en) Image processor
JP2910295B2 (en) Contour information extraction device
JP2785269B2 (en) Noise removal device
JP2010061581A (en) Image processing apparatus
JPH05143733A (en) Contour extracting device
JP2001307097A (en) Device and method for detecting pattern
JPH11284859A (en) Image processing unit and its method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20190402

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20200306

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20200310

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20200313

R150 Certificate of patent or registration of utility model

Ref document number: 6681077

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250