JP4612352B2 - Labeling processing apparatus and labeling processing method - Google Patents
Labeling processing apparatus and labeling processing method Download PDFInfo
- Publication number
- JP4612352B2 JP4612352B2 JP2004225615A JP2004225615A JP4612352B2 JP 4612352 B2 JP4612352 B2 JP 4612352B2 JP 2004225615 A JP2004225615 A JP 2004225615A JP 2004225615 A JP2004225615 A JP 2004225615A JP 4612352 B2 JP4612352 B2 JP 4612352B2
- Authority
- JP
- Japan
- Prior art keywords
- pixel
- data
- register
- labeling
- processing
- 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 - Fee Related
Links
Images
Description
本発明は、2値画像データのラベリング処理を行うラベリング処理方法、及びラベリング処理装置に関する。 The present invention, labeling processing method for performing labeling processing for binary image data, and a labeling processor.
白、もしくは黒に2値化された画像データに対して行う一般的な画像処理として、ラベリング処理がある。以下において、白画素を背景画素、黒画素を特徴画素と呼ぶこととすると、ラベリング処理とは、連結している特徴画素に対して、同一のラベル(例えば、昇順の番号)を割り付ける処理である。このラベリング処理を行うことで、画像データ内に存在する複数の対象物を区別し、対象物ごとに面積や重心を求めることが可能となる。 As a general image process performed on image data binarized to white or black, there is a labeling process. In the following, if white pixels are referred to as background pixels and black pixels are referred to as feature pixels, the labeling process is a process of assigning the same label (for example, ascending numbers) to the connected feature pixels. . By performing this labeling process, it is possible to distinguish a plurality of objects existing in the image data and obtain the area and the center of gravity for each object.
連結の判定の仕方には、概ね、
(1)対象画素と、その上下左右の4画素との連結を判定する4連結(4近傍)の考え方と、
(2)(1)の4連結に斜め方向を加えた周囲8画素との連結を判定する8連結(8近傍)の考え方と
がある。
The method of determining the connection is roughly
(1) The concept of 4 connections (4 neighborhoods) for determining the connection between the target pixel and the 4 pixels on the top, bottom, left and right;
(2) There is a concept of 8 connections (near 8) that determines connection with surrounding 8 pixels obtained by adding an oblique direction to the 4 connections of (1).
メモリなどの記憶装置に2次元状に配置された2値画像データに対して4連結でラベリング処理を行う場合には、例えば、対象画素から見て左に隣接する画素、及び上に隣接している画素の、少なくとも2画素に対する処理結果を参照しながら、2値画像データを左上端から右下端に向けて走査していく逐次処理を行わなければならない。さらに、8連結でラベリング処理を行う場合には、例えば、対象画素から見て左に隣接する画素、左斜め上に隣接する画素、上に隣接する画素、右斜め上に隣接する画素の、少なくとも4画素に対する処理結果を参照する逐次処理を行わなければならない。 When performing binary labeling processing on binary image data arranged two-dimensionally in a storage device such as a memory, for example, a pixel adjacent to the left as viewed from the target pixel, and an upper adjacent pixel data. It is necessary to perform sequential processing of scanning binary image data from the upper left end toward the lower right end while referring to the processing result of at least two pixels. Further, when performing the labeling process with eight connections, for example, at least of the pixel adjacent to the left as viewed from the target pixel, the pixel adjacent to the upper left, the pixel adjacent to the upper, the pixel adjacent to the upper right, Sequential processing that refers to the processing results for four pixels must be performed.
また、対象画素の地点で、異なる仮ラベル同士が連結した場合には、その接続情報を記憶するためメモリにアクセスする必要があり、特に、8連結のラベリング処理の場合には、後で詳細に説明するが、参照する隣接4画素の中に異なる仮ラベルが3つ以上存在する可能性があり、これら3つの異なる仮ラベル同士の接続情報を記憶するために、1つの対象画素への処理の際に少なくとも2度メモリにライトアクセスしなければならない。このメモリへのアクセスと、逐次処理とのために、ラベリング処理は処理時間がかかる画像処理の一つに挙げられている。 In addition, when different temporary labels are connected at the target pixel, it is necessary to access the memory to store the connection information. In particular, in the case of the 8-connected labeling process, details will be described later. As will be described, there is a possibility that three or more different temporary labels exist in the adjacent four pixels to be referred to, and in order to store connection information between these three different temporary labels, processing of one target pixel is performed. In some cases, the memory must be write-accessed at least twice. The labeling process is listed as one of the image processes that takes a long processing time due to the access to the memory and the sequential processing.
ラベリング処理の処理速度を上げるために、対象画素を2画素以上の複数として、同時に処理していく手法が考えられる。しかし、上記のように、衝突する仮ラベルの個数が増えてしまうと、メモリにアクセスする回数が増えてしまうために、十分な効果は得られない。 In order to increase the processing speed of the labeling process, it is conceivable to use a plurality of target pixels as a plurality of target pixels and process them simultaneously. However, as described above, if the number of colliding temporary labels increases, the number of accesses to the memory increases, so that a sufficient effect cannot be obtained.
特許文献1では、仮ラベルを割り付ける対象画素と、それに隣接する周囲3画素の計4画素をラスタスキャン方式により読み込み、それら4画素の画素パターンに基づいて、対象画素に割り付ける仮ラベルの決定と、仮ラベル同士の連結情報を記憶する処理を行うラベリング処理装置、及び方法について開示しているが、1回の処理における処理速度を低下させずに、対象画素を2画素以上の複数とする手法については開示されていない。
In
ところで、SIMD(Single Instruction Stream, Multiple Data Stream)型マイクロプロセッサでは、複数のデータに対して1つの命令で同時に同一の演算処理(SIMD処理)が実行可能である。この構造により、演算は同一であるがデータ量が非常に多い処理(例えば、並列に演算が可能な画像処理)に係る用途において頻用される。SIMD型マイクロプロセッサにおける通常の画像処理では、複数の演算ユニット(Processor Element [PE]; プロセッサエレメント)を主走査方向に並べ、同一の演算を同時に複数のデータに対して実行することによって高速な演算処理が可能となっている。 By the way, in a single instruction stream, multiple data stream (SIMD) type microprocessor, the same arithmetic processing (SIMD processing) can be executed simultaneously with a single instruction for a plurality of data. This structure is frequently used in applications related to processing that has the same computation but a very large amount of data (for example, image processing capable of computation in parallel). In normal image processing in a SIMD type microprocessor, a plurality of arithmetic units (Processor Element [PE]; processor elements) are arranged in the main scanning direction, and high-speed arithmetic is performed by simultaneously executing the same arithmetic on a plurality of data. Processing is possible.
ラベリング処理などの逐次処理を行う場合、処理速度に関しては、SIMD型プロセッサの構成を十分に生かすことはできない。このSIMD型マイクロプロセッサでも、上述のラベリング処理をいかに行うかが課題として挙げられる。
本発明は、簡単なハードウェアを追加したSIMD型マイクロプロセッサを利用して、上記の8連結のラベリング処理を4連結のラベリング処理と同等の処理速度で行い、また対象画素を2画素以上の複数としたとき、1回の処理における処理速度を低下させずに、十分な効果が得られる画像処理方法、及び画像処理装置を作成することを目的とする。 The present invention uses the SIMD type microprocessor to which simple hardware is added, performs the above 8-connected labeling process at a processing speed equivalent to the 4-connected labeling process, and sets a plurality of target pixels to two or more pixels. It is an object of the present invention to create an image processing method and an image processing apparatus that can obtain a sufficient effect without reducing the processing speed in one process.
本発明は、上記の目的を達成するために為されたものである。本発明に係る請求項1に記載のラベリング処理方法は、
複数のデータを処理するためのM個のプロセッサエレメント及びグローバルプロセッサを有するSIMD型マイクロプロセッサを用いて、連結している特徴画素に対して同一のラベルを割り付けるラベリング処理方法であって、
上記ラベリング処理方法は、
2次元状に配置され背景画素と特徴画素とに2値化された2値画像データに対して一次的にラベリングを行う仮ラベリングの工程と、
上記仮ラベリングの工程の結果に基づいて、仮ラベル間の接続情報を整理して仮ラベルを本ラベルに変換する本ラベリングの工程とを含み、
上記仮ラベリングの工程の際において、
対象画素のデータをP[M,N](M=0,1,2,…/N=0,1,2,…)で表し、
更に、対象画素の1つ左隣の画素のデータをP[M−1,N]、対象画素の2つ左隣の画素のデータをP[M−2,N]、対象画素の1つ右隣の画素のデータをP[M+1,N]、対象画素の2つ右隣の画素のデータをP[M+2,N]、対象画素の1つ下の画素のデータをP[M,N+1]のように表すこととし、
N−1ライン目、Nライン目及びN+1ライン目におけるM−1列のデータであるP[M−1,N−1]、P[M−1,N] 、及びP[M−1,N+1]が、M−1番目のプロセッサエレメントが備えるレジスタに格納され、
N−1ライン目、Nライン目及びN+1ライン目におけるM列のデータであるP[M,N−1]、P[M,N] 、及びP[M,N+1]が、M番目のプロセッサエレメントが備えるレジスタに格納され、
N−1ライン目、Nライン目及びN+1ライン目におけるM+1列のデータであるP[M+1,N−1]、P[M+1,N] 、及びP[M+1,N+1]が、M+1番目のプロセッサエレメントが備えるレジスタに格納されており、
(1)プロセッサエレメントに備わるレジスタに格納されるデータにおいて、グローバルプロセッサが、P[M,N]が背景画素、かつP[M,N+1]が特徴画素、かつP[M−1,N]が特徴画素、かつP[M+1,N]が特徴画素であると判断すれば、M番目のプロセッサエレメントが備える第2の条件レジスタを1にセットし、
(2)プロセッサエレメントに備わるレジスタに格納されるデータにおいて、グローバルプロセッサが、P[M,N]とP[M−1,N]が背景画素、かつP[M,N+1]とP[M−1,N+1]が特徴画素、かつP[M+1,N]が特徴画素、かつP[M−2,N]が特徴画素であると判断すれば、M番目のプロセッサエレメントが備える第3の条件レジスタを1にセットし、
(3)プロセッサエレメントに備わるレジスタに格納されるデータにおいて、グローバルプロセッサが、P[M,N]とP[M+1,N]が背景画素、かつP[M,N+1]とP[M+1,N+1]が特徴画素、かつP[M+2,N]が特徴画素、かつP[M−1,N]が特徴画素であると判断すれば、M番目のプロセッサエレメントが備える第4の条件レジスタを1にセットし、
(4)上記(1)(2)(3)の判断の後、第2の条件レジスタ、第3の条件レジスタ、第4の条件レジスタの、いずれかが1にセットされていれば、対象画素のデータP[M,N]を背景画素から特徴画素へと書き換える処理を行うラベリング処理方法である。
The present invention has been made to achieve the above object. The labeling processing method according to
A labeling processing method for assigning the same label to feature pixels connected by using a SIMD type microprocessor having M processor elements and a global processor for processing a plurality of data,
The labeling method is
A provisional labeling step in which binary image data that is two-dimensionally arranged and binarized into background pixels and feature pixels is primarily labeled ;
Based on the result of the provisional labeling step, the information on the connection between the provisional labels is organized and the provisional labeling step of converting the provisional label into the real label ,
During the temporary labeling process,
The target pixel data is represented by P [M, N] (M = 0, 1, 2,... / N = 0, 1, 2,...)
Furthermore, the data of the pixel one pixel to the left of the target pixel is P [M-1, N], the data of the pixel two pixels to the left of the target pixel is P [M-2, N], and the right of the target pixel is one pixel. The data of the adjacent pixel is P [M + 1, N], the data of the pixel two pixels to the right of the target pixel is P [M + 2, N], and the data of the pixel immediately below the target pixel is P [M, N + 1]. And to represent
P [M−1, N−1], P [M−1, N], and P [M−1, N + 1], which are data of the M−1 column in the N−1th line, the Nth line, and the N + 1th line. Is stored in a register included in the (M−1) -th processor element,
P [M, N−1], P [M, N], and P [M, N + 1], which are M columns of data in the (N−1) th line, the Nth line, and the (N + 1) th line, are Mth processor elements. Stored in a register
P + 1 [M + 1, N−1], P [M + 1, N], and P [M + 1, N + 1], which are M + 1 columns of data in the (N−1) th line, the Nth line, and the (N + 1) th line, are the M + 1th processor element Is stored in a register
(1) In data stored in a register included in a processor element, a global processor determines that P [M, N] is a background pixel, P [M, N + 1] is a feature pixel, and P [M-1, N] is If it is determined that the feature pixel and P [M + 1, N] are feature pixels, the second condition register included in the Mth processor element is set to 1 ,
(2) In the data stored in the register provided in the processor element, the global processor determines that P [M, N] and P [M−1, N] are background pixels, and P [M, N + 1] and P [M− 1, N + 1] is a feature pixel, P [M + 1, N] is a feature pixel, and P [M-2, N] is a feature pixel, the third condition register included in the Mth processor element Set to 1 ,
(3) In the data stored in the register provided in the processor element, the global processor determines that P [M, N] and P [M + 1, N] are background pixels, and P [M, N + 1] and P [M + 1, N + 1] Is a feature pixel, P [M + 2, N] is a feature pixel, and P [M-1, N] is a feature pixel, the fourth condition register included in the Mth processor element is set to 1. And
(4) After determination of (1), (2), and (3) above, if any of the second condition register, the third condition register, and the fourth condition register is set to 1, the target pixel Is a labeling processing method for performing a process of rewriting the data P [M, N] from the background pixel to the feature pixel.
本発明に係る請求項2に記載の画像処理装置は、
複数のデータを処理するためのM個のプロセッサエレメント及びグローバルプロセッサを有するSIMD型マイクロプロセッサを含み、
対象画素のデータP[M,N]を格納するレジスタを備えるプロセッサエレメントから、同一ラインの画素のデータであるP[M−2,N]、P[M−1,N]、P[M+1,N]、P[M+2,N]の夫々を格納するレジスタと、1つ下のラインの画素のデータであるP[M−1,N+1]、P[M,N+1]、P[M+1,N+1]の夫々を格納するレジスタが参照可能であり、それら参照可能なレジスタに格納される画素との関係から、自身の画素の状態を書き換える手段を備えた、請求項1に記載のラベリング処理方法を行うラベリング処理装置である。
An image processing apparatus according to
A SIMD type microprocessor having M processor elements and a global processor for processing a plurality of data;
P [M−2, N], P [M−1, N], and P [M + 1, P] are pixel data on the same line from a processor element that includes a register that stores target pixel data P [M, N]. N], P [M + 2, N] , and P [M-1, N + 1], P [M, N + 1], P [M + 1, N + 1] which are pixel data of the next lower line. 2. The labeling processing method according to
本発明に係る請求項3に記載の画像処理装置は、
特徴画素へと書き換えた背景画素の画素データに、元々は背景画素であったことを示す第1のデータを付加し、
所定の処理後に各背景画素において、画素データ内の第1のデータの存在を判断し、第1のデータが付加されていれば、背景画素へと書き戻すことを特徴とする請求項2に記載のラベリング処理装置である。
An image processing apparatus according to
First data indicating that the pixel was originally a background pixel is added to the pixel data of the background pixel rewritten to the feature pixel,
The presence of the first data in the pixel data is determined for each background pixel after a predetermined process, and if the first data is added, the data is written back to the background pixel. This is a labeling processing apparatus.
本発明を利用することにより、次のような効果を得ることができる。 By using the present invention, the following effects can be obtained.
2値画像データに対して8連結のラベリング処理を行う際に、仮ラベル付けを行う対象画素の地点で衝突する異なる値の仮ラベルの数を低減させ、仮ラベル同士の接続情報を記憶するためのメモリにアクセスする回数を低減させることによって、8連結の仮ラベリング処理を高速で行うことができる。 When performing 8-connected labeling processing on binary image data, the number of temporary labels with different values that collide at the target pixel point where temporary labeling is performed is reduced, and connection information between temporary labels is stored. By reducing the number of times the memory is accessed, it is possible to perform eight-link temporary labeling processing at high speed.
更に、2値画像データに対して仮ラベリング処理を行う際に、入力された2値画像データに対して正しいラベリング処理を行うことができる。 Further, when the temporary labeling process is performed on the binary image data, the correct labeling process can be performed on the input binary image data.
以下、図面を参照して本発明に係る好適な実施の形態を説明する。 DESCRIPTION OF THE PREFERRED EMBODIMENTS Preferred embodiments according to the present invention will be described below with reference to the drawings.
図16は、本発明に係る画像処理装置の構成を示すブロック図である。該画像処理装置は、SIMD型マイクロプロセッサ2、及びデータ制御装置11を含む。更に該SIMD型マイクロプロセッサ2は、概略、グローバルプロセッサ4、レジスタファイル6、演算アレイ8、及び外部インタフェース7から構成される。
FIG. 16 is a block diagram showing the configuration of the image processing apparatus according to the present invention. The image processing apparatus includes a
(1)グローバルプロセッサ4
このグローバルプロセッサ4そのものは、いわゆるSISD(Single Instruction Stream, Single Data Stream)型のプロセッサである。プログラムRAM10とデータRAM12を内蔵し(図17参照)、プログラムを解読し各種制御信号を生成する。この制御信号は内蔵する各種ブロックの制御以外に、レジスタファイル6、演算アレイ8、及びデータ制御装置11にも供給される。また、GP(グローバルプロセッサ)命令実行時は内蔵する汎用レジスタ、ALU(算術論理演算器)等を使用して各種演算処理、プログラム制御処理を行う。
(1)
The
(2)レジスタファイル6
PE(プロセッサエレメント)命令で処理されるデータを保持している。PE(プロセッサエレメント)3は、公知のように、SIMD(Single Instruction−Stream,Multiple Data−Stream)型マイクロプロセッサにおいて個別の演算を実行する構成単位である。図16のレジスタファイル6及び演算アレイ8が示すように、図16のSIMD型マイクロプロセッサ2では256個のPE3を含んでいる。PE命令はSIMD型の命令であり、レジスタファイル6に保持されている複数のデータに対して同時に同じ処理を行う。このレジスタファイル6からのデータの読み出し/書き込みの制御はグローバルプロセッサ4からの制御によって行われる。読み出されたデータは演算アレイ8に送られ、演算アレイ8での演算処理後にレジスタファイル6に書き込まれる。
(2)
It holds data processed by PE (processor element) instructions. As is well known, the PE (processor element) 3 is a structural unit that executes individual operations in a single instruction-stream (SIMD) type microprocessor. As shown in the
また、レジスタファイル6は、外部インタフェース7を介してプロセッサ外部のデータ制御装置11からのアクセスが可能であり、グローバルプロセッサ4の制御とは別に、外部から特定のレジスタに対して読み出し/書き込みが行われる。
Further, the
(3)演算アレイ8
PE命令の演算処理が行われる。処理の制御はすべてグローバルプロセッサ4から行われる。後で説明するように、仮ラベリング処理における副走査方向の画素連結判定処理を行う。
(3)
Processing of PE instruction is performed. All processing control is performed from the
(4)データ制御装置(ラベリング処理装置)11
外部インタフェース7のポートに、クロックとアドレス、リード/ライト制御を出力し、任意のPE3のレジスタから、データを読み出し、処理することができる。処理の制御はすべてグローバルプロセッサ4から行われる。後で説明するように、仮ラベリング処理における主走査方向の画素連結判定処理を行う。
(4) Data control device (labeling processing device) 11
The clock, address, and read / write control are output to the port of the
図17は、本発明に係るSIMD型マイクロプロセッサ2の、更に詳細な構成を示すブロック図である。
FIG. 17 is a block diagram showing a more detailed configuration of the
グローバルプロセッサ4には、本プロセッサ2のプログラム格納用のプログラムRAM10と、演算データ格納用のデータRAM12が内蔵されている。さらに、プログラムのアドレスを保持するプログラムカウンタ(PC)14、演算処理のデータ格納のための汎用レジスタであるG0、G1、G2及びG3レジスタ(16、18、20、22)、レジスタ退避・復帰時に退避先データRAMのアドレスを保持しているスタックポインタ(SP)24、サブルーチンコール時にコール元のアドレスを保持するリンクレジスタ(LS)26、同じくIRQ(Interrupt ReQuest;割込み要求)時とNMI(Non−Maskable Interrupt request;禁止不能割込み要求)時の分岐元アドレスを保持するLIレジスタ28及びLNレジスタ30、プロセッサの状態を保持しているプロセッサステータスレジスタ(P)32が内蔵されている。
The
これらのレジスタと、(図示していない)命令デコーダ、ALU、メモリ制御回路、割り込み制御回路、外部I/O制御回路、及びGP演算制御回路を使用して、GP命令の実行が行われる。 The GP instruction is executed using these registers, an instruction decoder (not shown), an ALU, a memory control circuit, an interrupt control circuit, an external I / O control circuit, and a GP operation control circuit.
また、PE命令実行時には、命令デコーダ(図示せず)、レジスタファイル制御回路(図示せず)、PE演算制御回路(図示せず)を使用して、レジスタファイル6の制御と演算アレイ8の制御を行う。
When executing the PE instruction, the instruction decoder (not shown), the register file control circuit (not shown), and the PE operation control circuit (not shown) are used to control the
レジスタファイル6には、1つのPE単位に8ビットのレジスタが32本内蔵されており、256PE分の(32本の)組がアレイ構成になっている。レジスタ34はPE毎にR0、R1、R2、・・・R31と呼ばれる。それぞれのレジスタ34は演算アレイに対して1つの読み出しポートと1つの書き込みポートを備えており、8ビットのリード/ライト兼用のバスで演算アレイからアクセスされる。32本のレジスタの内、24本(R0〜R23)は外部インタフェース7を介してプロセッサ外部からアクセス可能であり、外部からクロック(CLK)とアドレス(Address)、リード/ライト制御(RWB)を入力することで、任意のレジスタ34に対して読み書きできる。
The
レジスタ34の外部からのアクセスにおいて、1つの外部ポートで各PEの1つのレジスタ34がアクセス可能である。外部から入力されたアドレスでPEの番号(0〜255)が指定される。したがって、レジスタアクセスの外部ポートは全部で24組搭載されている。また、外部からのアクセスは16ビットデータで行い、1回のアクセスで2つのレジスタ(偶数のPEのレジスタと奇数のPEレジスタの1組)に同時にアクセスしている。
In accessing from the outside of the
演算アレイ8は、16ビットALU36と16ビットAレジスタ38、Fレジスタ40を内蔵している。PE命令による演算は、レジスタファイル6から読み出されたデータ若しくはグローバルプロセッサ4から与えられたデータをALU36の片側の入力とし、Aレジスタ38の内容をもう片側の入力として行われる。演算結果はAレジスタ38に格納される。したがって、R0〜R31レジスタ34若しくはグローバルプロセッサ4から与えられたデータと、Aレジスタ38に格納されるデータとの、演算が通常行われることになる。
The
レジスタファイル6と演算アレイ8との接続に、7to1(7対1)のマルチプレクサ42が置かれている。図17に示すように、あるマルチプレクサ42から見て、左方向の3つのPE3に含まれるR0〜R31レジスタ34のデータと、右方向の3つのPE3に含まれるR0〜R31レジスタ34のデータと、自らが属するPE3に含まれるR0〜R31レジスタ34のデータを、演算対象として選択し得るように設定されている。また、レジスタファイル6の8ビットのデータは、シフト・拡張回路44により任意ビットだけ、左シフトしてALU36に入力する。
A 7 to 1 (7 to 1)
さらに、8ビットの条件レジスタ(図示せず)により、PE3別に演算実行の無効/有効の制御をしており、特定のPE3だけを演算対象として選択できるようになっている。
Furthermore, the execution / invalidation control of the operation is controlled for each
《前提となる4連結のラベリング処理について》
本発明は、上述のように8連結のラベリング処理を行う画像処理に関するものであるが、4連結のラベリング処理が前提技術となる。そこで、先ず4連結のラベリング処理について概説する。
<< About the pre-requisite 4-link labeling process >>
The present invention relates to image processing that performs 8-connected labeling processing as described above, but 4-connected labeling processing is a prerequisite technology. Therefore, first, the outline of the 4-connected labeling process will be described.
2値画像データは、PE3のレジスタファイル6上に2次元状に配置されているとする。通常、画像データの1ライン中の画素数はPE数より多い。その場合、(図示していないが)外部インタフェース7にデータ転送装置、及びフレームバッファとしてのメモリを配置し、このメモリ(フレームバッファ)に画像データを格納し、処理に応じてPE3のレジスタファイルに画像データを順次転送すればよい。
It is assumed that the binary image data is arranged two-dimensionally on the
まず、第1の実施の形態で取り扱う16ビットの2値画像データ、及び(仮)ラベルを以下のように定義する。
・2値画像データ
背景画素・・・0000h
特徴画素・・・8000h
・(仮)ラベル・・・0001h〜7FFFh
First, 16-bit binary image data and (temporary) labels handled in the first embodiment are defined as follows.
・ Binary image data Background pixel: 0000h
Characteristic pixel ... 8000h
・ (Temporary) label: 0001h to 7FFFh
上記のような定義にした理由は、2値画像データにおいて背景画素と特徴画素との判別を16ビットデータの最上位1ビットのみに委ねればよく、また、(仮)ラベルを含めて0000hより大きな数は特徴画素であると判断すればよい、という処理の簡易さを考慮したためである。 The reason for the above definition is that the determination of the background pixel and the characteristic pixel in the binary image data is left to only the most significant 1 bit of 16-bit data, and from 0000h including the (provisional) label. This is because the simplicity of the process of considering that a large number is a feature pixel should be considered.
また、仮ラベリング処理では、異なる仮ラベル同士が後方での処理で連結した場合に、その接続情報を記憶するためのメモリが必要であり、その場合アドレスに仮ラベルを対応させ、データにその仮ラベルと連結している他の仮ラベルの値を記述して、仮ラベル同士の接続情報をメモリに記憶させている。 Further, in the temporary labeling process, when different temporary labels are connected in the later process, a memory for storing the connection information is necessary. In this case, the temporary label is associated with the address, and the temporary label is associated with the data. The value of another temporary label connected to the label is described, and the connection information between the temporary labels is stored in the memory.
ここで、アドレス値addrのメモリのデータをRAM[addr]と表記することとする。具体的には以下のように接続情報がメモリに記憶される。
・RAM[addr] = 0000h(初期値、ラベリング処理開始前に初期化)の時、仮ラベルaddrは存在しない。
・RAM[addr] = addrの時、仮ラベルaddrと連結している他の仮ラベルがない、もしくは連結している複数の仮ラベルの中で自身の値が一番小さい。
・RAM[addr] = A(A!=0000h かつ A!=addr)の時、仮ラベルaddrと仮ラベルAが連結している。
Here, the memory data of the address value addr is expressed as RAM [addr]. Specifically, the connection information is stored in the memory as follows.
When RAM [addr] = 0000h (initial value, initialized before starting the labeling process), the temporary label addr does not exist.
When RAM [addr] = addr, there is no other temporary label connected to the temporary label addr, or its own value is the smallest among a plurality of connected temporary labels.
When RAM [addr] = A (A! = 0000h and A! = Addr), the temporary label addr and the temporary label A are connected.
以上の定義を用いて、副走査方向の画素の連結判定処理(処理A1)と、主走査方向の画素の連結判定処理(処理B1)との内容を以下に記載する。なお、本明細書における主走査方向の画素の連結判定処理では、2画素同時に仮ラベル付けを行っていく。 Using the above definitions, the contents of the pixel connection determination process (process A1) in the sub-scanning direction and the pixel connection determination process (process B1) in the main scanning direction will be described below. Note that, in the connection determination process of pixels in the main scanning direction in this specification, provisional labeling is performed simultaneously for two pixels.
〈処理A1〉
処理A1は、1ライン中の全ての画素(実際には、フレームバッファからPE3のレジスタファイル6に1回の転送で格納される画素データ群)に対して、一度に並列に行われる。
・対象ラインから見て1つ上のラインの画像データを参照し、同じ列の画素に仮ラベルが割り付けられており(即ち、0000h(背景画素)ではなく)、かつ対象ラインの同一列の2値画像データが8000h(特徴画素)であれば、その仮ラベルを対象ラインにコピーする。
<Process A1>
The process A1 is performed in parallel on all the pixels in one line (actually, the pixel data group stored in one transfer from the frame buffer to the
The image data of the line one line higher than the target line is referred to, a temporary label is assigned to the pixel in the same column (ie, not 0000h (background pixel)), and 2 in the same column of the target line If the value image data is 8000h (characteristic pixel), the temporary label is copied to the target line.
〈処理B1〉
処理B1は、対象となる2画素データを、PE3のレジスタファイル6からデータ制御装置11に転送して行われる。対象画素(2画素)の処理後の値は、その対象画素(2画素)の処理前の値と、その2画素に隣接する画素(対象ラインを左から走査する場合は左に隣接する画素、対象ラインを右から走査する場合は右に隣接する画素)の値との、3画素での値の組み合わせにより決定される。つまり、処理B1は、対象画素(2画素)に隣接する画素の処理結果を参照する逐次処理となる。この処理のパターンが図3に示される。
<Process B1>
The process B1 is performed by transferring the target two-pixel data from the
図3で用いている記号について、以下の表1で説明する。
ここで、図3の見方について説明する。例えばNo.13の処理パターンの場合、隣接画素に値Aの仮ラベルが割り付けられており、処理前の(2つの)対象画素の状態が、1つ目の対象画素が値Bの仮ラベルであり、2つめの対象画素が背景画素であった場合には、1つ目の対象画素には値AとRAM[B]のうち値の小さい方の仮ラベルが割り付けられ、2つ目の対象画素にはそのまま背景画素であることを示す値(0000h)が割り付けられることを表している。更にこのとき、仮ラベルAと仮ラベルBの接続情報を記憶する処理として、値AとRAM[B]のうち値の大きい方をアドレス、値の小さい方をデータとして、メモリへの書き込みアクセスを行うことも示している。 Here, how to view FIG. 3 will be described. For example, no. In the case of 13 processing patterns, a temporary label of value A is assigned to adjacent pixels, and the state of (two) target pixels before processing is that the first target pixel is a temporary label of value B. If the first target pixel is a background pixel, the first target pixel is assigned a temporary label having a smaller value of A and RAM [B], and the second target pixel is assigned to the second target pixel. A value (0000h) indicating that it is a background pixel is assigned as it is. Further, at this time, as a process for storing the connection information between the temporary label A and the temporary label B, write access to the memory is performed using the larger value of the value A and RAM [B] as the address and the smaller value as the data. It also shows what to do.
なお、No.15の処理パターンでは、2つの対象画素ともに仮ラベルが割り付けられているが、4連結のラベリング処理を行う場合においては、処理A1が終了した時点で、連続する特徴画素に異なる値の仮ラベルが割り付けられることが無いので、2つの対象画素ともに同一の仮ラベルが割り付けられている場合のみを想定すればよい。 In addition, No. In the 15 processing patterns, a temporary label is assigned to each of the two target pixels. However, in the case of performing the 4-connected labeling process, when the process A1 is completed, a temporary label having a different value is added to the consecutive feature pixels. Since no assignment is made, it is only necessary to assume a case where the same temporary label is assigned to both two target pixels.
また処理B1では、異なる値の仮ラベル同士が衝突した場合には若い番号の仮ラベルを残すという処理(図3のNo.12からNo.15の処理パターン)内容の特性から、対象ライン中に存在する同一領域に異なる仮ラベルが割り付けられることが生じ得る。そのため、対象ラインを左からと右からの2度走査して、一つの対象ラインにおいては同一領域にすべて同じ仮ラベルが割り付けられるようにする。この処理により、異なる仮ラベル同士の接続情報を作成する処理の負担を軽減させることができる。 Further, in the process B1, when temporary labels having different values collide with each other, the process of leaving a temporary label with a lower number (process pattern from No. 12 to No. 15 in FIG. 3) contents is included in the target line. It can happen that different temporary labels are assigned to the same existing area. Therefore, the target line is scanned twice from the left and the right so that the same temporary label is allocated to the same area in one target line. With this process, it is possible to reduce the burden of the process of creating connection information between different temporary labels.
図2に、以上の処理A1と処理B1による仮ラベリング処理のフローチャートを示す。図2では、便宜上、1ライン中の画素数がPE数よりも小さいものとしている。1ライン中の画素数がPE数より多い場合は、既に述べたように、画像データを格納しているフレームバッファから、データ転送装置を介して、処理に応じてPEのレジスタファイルに画像データを順次転送すればよい。 FIG. 2 shows a flowchart of the provisional labeling process by the process A1 and the process B1. In FIG. 2, for the sake of convenience, the number of pixels in one line is assumed to be smaller than the number of PEs. If the number of pixels in one line is greater than the number of PEs, as described above, the image data is transferred from the frame buffer storing the image data to the PE register file according to the process via the data transfer device. What is necessary is just to transfer sequentially.
図1は、処理B1を行うためのデータ制御装置11のブロック図である。図1に示されるデータ制御装置11は、
・外部インタフェース7に対してクロック、アドレス、及びリード/ライト制御を供給することで外部インタフェース7を制御する外部インタフェース制御部52、
・データ制御装置11に接続されている仮ラベル間の接続情報を記憶するためのメモリ15に対して、クロック、アドレス、リード/ライト制御、及びデータを供給することでメモリ15を制御するメモリ制御部64、
・外部インタフェース7を介してPE3のレジスタファイル6から読み出される画素データと、メモリ15から読み出されるデータ(仮ラベル間の接続情報)と、1つ前の処理で対象画素に隣接する画素に割り付けた仮ラベルの値を読み込み、対象画素に割り付けるべき仮ラベルの値を決定するラベル判定回路58、
・ラベル判定回路58での判定結果に基づいて仮ラベルを新規に発生させるラベルカウンタ56、
・上記カウンタ56によって発生される仮ラベルと、仮ラベル割り付け済みの対象画素のデータと、1つ前の処理で対象画素に隣接する画素に割り付けた仮ラベルと、メモリ15から読み出されるデータが入力されており、上記ラベル判定回路58において仮ラベルとして判定されたデータを出力するマルチプレクサ60、
・マルチプレクサ60からデータを受け取り、そのデータを仮ラベルとして外部インタフェース7に書き戻すためのラベルレジスタ62から構成されている。
FIG. 1 is a block diagram of the data control
An external
Memory control for controlling the
-Pixel data read from the
A
The temporary label generated by the
A
上記の構成において、ラベル判定回路58に読み込むデータのうち、上記の「1つ前の処理で対象画素に隣接する画素に割り付けた仮ラベル」は、対象画素についての処理開始前のラベルレジスタ62の値と等価である。外部インタフェース制御部52は、外部インタフェース7に供給するアドレスを発生させるためのアドレスカウンタを内蔵している。アドレスカウンタは、画素データの転送が主走査方向の左からも右からも行えるように、アップ・ダウンカウンタを用いている。
In the above configuration, among the data to be read into the
メモリ制御部64は、仮ラベリング処理開始前のメモリ初期化時には内蔵しているアップカウンタからアドレスを生成し、内蔵しているレジスタの値をメモリ15への入力データとして発行する。仮ラベリング処理実行時においては、処理B1のアルゴリズムに従いラベルカウンタ56の値、対象画素のデータ、ラベルレジスタ62の値、メモリ15から読み出したデータのいずれかをアドレスとして発行し、仮ラベルカウンタの値、ラベルレジスタ62の値、メモリ15から読み出したデータのいずれかをメモリ15への入力データとして発行する。なお、この構成において、対象画素を1画素、もしくは2画素以上の複数入力できるように変更することは容易である。
The
《第1の実施の形態》
続いて、本発明の第1の実施の形態に係る画像処理方法を説明する。
<< First Embodiment >>
Subsequently, an image processing method according to the first embodiment of the present invention will be described.
前記の「前提となる4連結のラベリング処理」を行う構成を利用して、8連結の仮ラベリング処理を行おうとすると、以下のような2つの問題点が生じる。 If an attempt is made to perform the 8-label provisional labeling process using the above-described “premise 4-connected labeling process”, the following two problems arise.
8連結の仮ラベリング処理では、副走査方向の画素の連結処理A1を拡張し、図4に示すように、対象ラインから見て1つ上のラインの、同一列上の画素とともに、その両隣の画素も参照する必要がある。この処理A1を拡張した処理を処理A2と呼ぶこととする。ここで、図5に示すような図形を含む2値画像データを処理する場合、処理A2の処理過程において、値Aの仮ラベルと値Bの仮ラベルとが衝突するため、その接続情報をメモリに書き込まなければならない。図5に示すような図形は同一ライン上に複数存在する可能性があり、処理A2をPE3の演算アレイ8で並列に処理できなくなってしまう。
In the 8-connected provisional labeling process, the pixel connection process A1 in the sub-scanning direction is expanded, and as shown in FIG. It is also necessary to refer to the pixels. A process obtained by extending the process A1 is referred to as a process A2. Here, when processing binary image data including a figure as shown in FIG. 5, the temporary label of value A and the temporary label of value B collide with each other in the process of process A2. Must be written to. There is a possibility that a plurality of figures as shown in FIG. 5 exist on the same line, and the processing A2 cannot be processed in parallel by the
また、図6のような図形を含む2値画像データを処理する場合では、処理A2は問題なく行うことができるが、その結果により、処理B1の処理パターンNo.15(図3参照)において、3つ(以上)の異なる仮ラベルが衝突することがある。それら3つの仮ラベル間の接続情報をメモリに書き込まなければならないとすると、他の処理パターンに比べ処理速度が遅くなってしまう。具体的には、3つの仮ラベルの内で最も小さい仮ラベルを仮ラベルCとすると、仮ラベルCと仮ラベルA、仮ラベルCと仮ラベルBの接続情報を記述せねばならず、従ってメモリに2度ライト(書き込み)アクセスしなければならない。他の処理パターンでは、2つの異なる仮ラベルの衝突までしかないため、メモリへのライトアクセスは1度だけでよい。 In the case of processing binary image data including a figure as shown in FIG. 6, the process A2 can be performed without any problem, but as a result, the process pattern No. of the process B1. 15 (see FIG. 3), three (or more) different temporary labels may collide. If the connection information between these three temporary labels must be written to the memory, the processing speed will be slower than other processing patterns. Specifically, if the smallest temporary label among the three temporary labels is the temporary label C, the connection information between the temporary label C and the temporary label A and between the temporary label C and the temporary label B must be described. Write (write) access twice. In other processing patterns, there is only a collision between two different temporary labels, so that only one write access to the memory is required.
そこで、図5、及び図6のようなV字型の図形が現れた場合には、それぞれ、図7、図8のように、V字の間の画素を仮に埋める方法が有効である。この方法を実践する処理を、主走査方向の画素の連結処理(処理B1)の前処理として行うことで、上記2つの問題点、即ち、処理A1を8連結ラベリング処理のために処理A2に拡張した際に発生する問題点を解消することができる。 Therefore, when a V-shaped figure as shown in FIGS. 5 and 6 appears, a method of temporarily filling pixels between the V-shapes as shown in FIGS. 7 and 8 is effective. By performing the process of practicing this method as a pre-process of the pixel concatenation process (process B1) in the main scanning direction, the above two problems, that is, the process A1 is expanded to the process A2 for the 8-link labeling process. It is possible to solve the problems that occur when this is done.
また、8連結ラベリング処理の際も処理B1を拡張する必要が無く、4連結ラベリング処理の際と同一の処理を用いることができる。従って、処理B1を行う図1に示したデータ制御装置11をそのまま用いることができる。このV字の間の画素を埋める処理(以下、処理C1と言う。)を、本発明の第1の実施の形態に係るSIMD型マイクロプロセッサにおけるソフトウェア処理(処理C1)で実現した場合のものを以下に記す。
Further, it is not necessary to expand the process B1 even in the 8-connected labeling process, and the same process as that in the 4-connected labeling process can be used. Therefore, the data control
《処理C1》
処理C1では、8ビットの条件レジスタ(Tレジスタ)を使用する。PE番号がM(M列目)のTレジスタのビット0をT0[M]、ビット1をT1[M]というように表記することとする。Tレジスタは各PEに1つずつ備えられているため、画素ごとの状態を保持するのに使用することができる。処理C1開始前に全てのTレジスタは0に初期化する。Nライン目の画像データに対して処理C1を行う場合、既に述べたようにN+1ライン目の画像データを参照する。Nライン目のM列の画素データを“PEn[M]”と表記することとし、処理C1の内容を以下に記載する。
<< Process C1 >>
In the process C1, an 8-bit condition register (T register) is used. The
(Step1.)Nライン目の画素データが0000h(背景画素)であった場合、その画素に対応するT1に1をセットする。
PEn[M]=0000h → T1[M]=1
(
PEn [M] = 0000h → T1 [M] = 1
(Step2.)N+1ライン目の画素データが8000h(特徴画素)であり、且つその画素に対応するT1に1がセットされている場合、引き続きそのT1に1をセットする。それ以外の場合、T1に0をセットする。
PEn+1[M]=8000h && T1[M]=1 → T1[M]=1
(
PEn + 1 [M] = 8000h && T1 [M] = 1 → T1 [M] = 1
(Step3.)T1に1がセットされており、Nライン目の画素の左右両隣の画素が共に8000h(特徴画素)であった場合、その画素に対応するT2に1をセットする。
T1[M]=1 && PEn[M−1]=8000h && PEn[M+1]=8000h → T2[M]=1
(
T1 [M] = 1 && PEn [M-1] = 8000h && PEn [M + 1] = 8000h → T2 [M] = 1
(Step4.)T1に1がセットされており、Nライン目の画素の左隣の画素が8000h(特徴画素)であり、その右隣の画素が0000h(背景画素)であるが、対応するT1の値が1であり、もう1つ右隣の画素が8000h(特徴画素)であるとき、その画素に対応するT3に1をセットする。
T1[M]=1 && PEn[M−1]=8000h && (PEn[M+1]=0000h && T1[M+1]=1) && PE[M+2]=8000h → T3[M]=1
(
T1 [M] = 1 && PEn [M-1] = 8000h && (PEn [M + 1] = 0000h && T1 [M + 1] = 1) && PE [M + 2] = 8000h → T3 [M] = 1
(Step5.)T1に1がセットされており、Nライン目の画素の右隣の画素が8000h(特徴画素)であり、その左隣の画素が0000h(背景画素)であるが、対応するT1の値が1であり、もう1つ左隣の画素が8000h(特徴画素)であるとき、その画素に対応するT4に1をセットする。
T1[M]=1 && PEn[M+1]=8000h && (PEn[M−1]=0000h && T1[M−1]=1) && PE[M−2]=8000h → T4[M]=1
(
T1 [M] = 1 && PEn [M + 1] = 8000h && (PEn [M-1] = 0000h && T1 [M-1] = 1) && PE [M-2] = 8000h → T4 [M] = 1
(Step6.)T2、T3、T4に1がセットされているNライン目の画素を特徴画素(例えば、8000h)に書き換える。
T2[M]=1 && T3[M]=1 && T4[M]=1 → PEn[M]=8000h
(
T2 [M] = 1 && T3 [M] = 1 && T4 [M] = 1 → PEn [M] = 8000h
次に、処理A2、処理B1、及び処理C1を用いた8連結の仮ラベリング処理の概略の流れを示す。 Next, an outline flow of the eight-link temporary labeling process using the process A2, the process B1, and the process C1 is shown.
《8連結の仮ラベリング処理》
以下では、説明の便宜上、1ライン中の画素数がPE数よりも小さい場合の例について記載している。1ライン中の画素数がPE数より多い場合は、既に述べたように、外部インタフェース7にデータ転送装置、及びフレームバッファとしてのメモリを配置し、このメモリ(フレームバッファ)に画像データを格納し、処理に応じてPE3のレジスタファイルに画像データを順次転送すればよい。
《8-link temporary labeling process》
In the following, for convenience of explanation, an example in which the number of pixels in one line is smaller than the number of PEs is described. When the number of pixels in one line is larger than the number of PEs, as described above, a data transfer device and a memory as a frame buffer are arranged in the
(Step1.)Nライン目の画像データに対し処理A2を行う。処理A2は副走査方向の画素の連結処理であり、N−1ライン目の画像データを参照する。
(
(Step2.)Nライン目の画像データに対し処理C1を行う。処理C1はV字の間の画素を埋める処理であり、N+1ライン目の画像データを参照する。
(
(Step3.)Nライン目の画像データに対して、先ず、主走査方向の左から走査して処理B1を行う。処理B1は、主走査方向の画素の連結処理である。
(
(Step4.)Nライン目の画像データに対して、次に、主走査方向の右から走査して処理B1を行う。
(
(Step5.)Step1からStep4の処理ステップを画像データの全ラインについての処理が終了するまで繰り返す。
(
なお、SIMD型マイクロプロセッサは、上記処理C1を実現するために、N−1ライン目、Nライン目(対象ライン)、N+1ライン目の3ライン分の画像データをPE3のレジスタファイル6に読み込んでおり、上記処理A2のためにNライン目の画像データからN−1ライン目の画像データを参照可能であり、上記処理C1のためにNライン目の画像データからN+1ライン目の画像データを参照可能であることが、必要である。
Note that the SIMD type microprocessor reads the image data for the 3rd line of the (N−1) th line, the Nth line (target line), and the (N + 1) th line into the
《第2の実施の形態》
続いて、本発明の第2の実施の形態に係る画像処理方法を説明する。
<< Second Embodiment >>
Next, an image processing method according to the second embodiment of the present invention will be described.
本発明の第2の実施の形態に係る画像処理方法では、第1の実施の形態に係る画像処理方法で記述したV字の間の画素を埋める処理(処理C1)において、背景画素から特徴画素に書き換えられる画素(特徴画素Bとする。)と、元々特徴画素であった画素(特徴画素Aとする。)を区別する。即ち、2値画像データ、及び(仮)ラベルを以下のように定義し、条件レジスタ(Tレジスタ)を用いてそのように設定する。
・2値画像データ
背景画素 … 0000h
特徴画素A … 8000h(ビット15のみが1)
特徴画素B … C000h(ビット15、及びビット14が1)
・(仮)ラベル … 0001hから3FFFhの数(ビット0からビット13で表現)
In the image processing method according to the second embodiment of the present invention, in the process of filling pixels between V-characters described in the image processing method according to the first embodiment (processing C1), the feature pixel is changed from the background pixel. And a pixel that is originally a feature pixel (referred to as a feature pixel A). That is, binary image data and (temporary) label are defined as follows, and set using a condition register (T register).
・ Binary image data Background pixel: 0000h
Feature pixel A 8000h (only bit 15 is 1)
Feature pixel B ... C000h (
・ (Tentative) label: Number from 0001h to 3FFFh (expressed from
第1の実施の形態に係る画像処理方法で述べたように、V字の間の画素を埋める処理(処理C1)の後に、主走査方向の画素の連結処理として処理B1が行われるが、ビット15、ビット14の情報を残しておくことで、仮ラベリング処理終了後に、特徴画素Bを再び背景画素に書き戻すことができる。
As described in the image processing method according to the first embodiment, the process B1 is performed as the pixel concatenation process in the main scanning direction after the process of filling pixels between the V-characters (process C1). By leaving the information of 15 and
通常のラベリング処理では、仮ラベリング処理終了後に、仮ラベル間の接続情報を整理して仮ラベルが正しいラベルに変換されるように変換テーブルを作成し、作成された変換テーブルを参照しながら仮ラベルを本ラベルに変換する本ラベリング処理を行う。この本ラベリング処理の際に、特徴画素Bを背景画素に書き戻す処理を行えば、第2の実施の形態で処理ステップの増加はない。 In the normal labeling process, after the temporary labeling process is completed, the connection information between the temporary labels is organized and a conversion table is created so that the temporary label is converted to the correct label. The temporary label is referenced while referring to the created conversion table. This labeling process is performed to convert to a label. If the process of writing back the characteristic pixel B to the background pixel is performed during the main labeling process, there is no increase in processing steps in the second embodiment.
仮ラベル間の接続情報を整理して本ラベリング処理のための変換テーブルを作成する処理を処理D1、本ラベリング処理を処理E1として以下に記す。この処理E1に、特徴画素Bを背景画素に書き直す処理が含まれている。 The process of organizing connection information between temporary labels and creating a conversion table for the main labeling process will be described as process D1, and the main labeling process will be described as process E1. This process E1 includes a process of rewriting the feature pixel B into the background pixel.
《処理D1》
処理D1では、メモリ(変換テーブル)のデータに対して、以下の処理D1−1からD1−2のいずれかを、“RAM[addr] = 0000h”となるまで、“addr”を1から昇順にインクリメントして実行していく。ここで、“0000h”は変換テーブルのデータの初期値であり、“RAM[addr] = 0000h”であるということは、そのaddrに対応する仮ラベルが存在しないことを示す(図10〜図13参照)。また、処理D1では、カウンタを1つ使用する(本ラベルカウンタと呼ぶ。)。本ラベルカウンタは、処理D1開始前に“0000h”に初期化しておく。
<< Process D1 >>
In the process D1, one of the following processes D1-1 to D1-2 is performed on the data in the memory (conversion table), and “addr” is set in ascending order from 1 until “RAM [addr] = 0000h”. Increment and execute. Here, “0000h” is the initial value of the data in the conversion table, and “RAM [addr] = 0000h” indicates that there is no temporary label corresponding to the addr (FIGS. 10 to 13). reference). In the process D1, one counter is used (referred to as a “label counter”). This label counter is initialized to “0000h” before the process D1 is started.
・処理D1−1
RAM[addr] = addrのとき、本ラベルカウンタを1インクリメントし、インクリメント後の値をRAM[addr]に書き戻す。
・処理D1−2
RAM[addr] != addrのとき、RAM[RAM[addr]]の値をRAM[addr]に書き戻す。
・ Process D1-1
When RAM [addr] = addr, this label counter is incremented by 1, and the incremented value is written back to RAM [addr].
・ Process D1-2
RAM [addr]! When = addr, the value of RAM [RAM [addr]] is written back to RAM [addr].
《処理E1》
処理E1では、仮ラベリング処理終了後の画像データを順次走査し、画素データの値に応じて、以下の処理E1−1から処理E1−3のいずれかの処理を行う。処理E1−2が、特徴画素Bを再び背景画素に書き戻す処理に対応する。
<< Process E1 >>
In the process E1, the image data after the provisional labeling process is sequentially scanned, and any one of the following processes E1-1 to E1-3 is performed according to the value of the pixel data. The process E1-2 corresponds to a process of writing the feature pixel B back to the background pixel again.
・処理E1−1
対象画素データが0000h(背景画素)であるとき、対象画素データにそのまま0000hを割り付ける。
・処理E1−2
対象画素データの最上位2ビット(ビット15、及びビット14)がともに1である(即ち、特徴画素Bである)とき、対象画素データに0000hを割り付ける。
・処理E1−3
対象画素データが処理E1−1、処理E1−2のいずれの条件も満たさない(特徴画素Aから変換された仮ラベルである)とき、この値をLabelとすると、RAM[Label]を本ラベルとして、対象画素データに割り付ける。
・ Process E1-1
When the target pixel data is 0000h (background pixel), 0000h is assigned to the target pixel data as it is.
・ Process E1-2
When the most significant 2 bits (
・ Process E1-3
When the target pixel data does not satisfy any of the conditions of processing E1-1 and processing E1-2 (a temporary label converted from the feature pixel A), if this value is Label, RAM [Label] is used as the main label. And assigned to the target pixel data.
上記の処理E1を実現するハードウェア(データ制御装置)は、図1に示す第1の実施の形態に係るデータ制御装置11と略同様の構成で実現することができる。即ち、データ制御装置11に含まれるラベル判定回路58において、処理B1の判定処理に加えて、処理E1の判定処理を行えるように追加変更して構成すればよい。
The hardware (data control device) that realizes the processing E1 can be realized with a configuration substantially similar to that of the
図9は、本発明の第2の実施の形態に係る画像処理方法を構成する処理A2、処理B1、処理C1、処理D1、及び処理E1を用いたラベリング処理全体のフローチャートである。図9のフローチャートを概略説明する。 FIG. 9 is a flowchart of the entire labeling process using process A2, process B1, process C1, process D1, and process E1 constituting the image processing method according to the second embodiment of the present invention. The flowchart of FIG. 9 will be schematically described.
第2の実施の形態に係る画像処理方法を構成するラベリング処理では、まず、画像データがPE3のレジスタファイル6へ転送(1ライン分)される(S32)。次に、PE部におけるSIMD処理により2値化処理が行われる(S34)。続いて、処理A2、即ち、副走査方向の画素の連結が行われる(S36)。そして、処理C1、即ち、V字の間の画素を埋める処理が行われる(S38)。更に、主走査方向の左から走査して主走査方向の画素の連結がなされ(処理B1、S40)、直後に主走査方向の右から走査して主走査方向の画素の連結がなされる(処理B1、S42)。
In the labeling process constituting the image processing method according to the second embodiment, first, image data is transferred to the
画像データの全ラインについての処理が終了するまで、上記S32〜S42の処理が繰り返される(S44)。画像データの全ラインについての処理が終了すれば(S44・YES)、本ラベリング処理用変換テーブルがデータ制御装置11で作成され(処理D1、S46)、その上で本ラベリング処理がデータ制御装置11で行われる(処理E1、S48)。以上でラベリング処理が終了する(S50)。
The processes of S32 to S42 are repeated until the processes for all lines of the image data are completed (S44). When the processing for all the lines of the image data is completed (S44, YES), the conversion table for main labeling processing is created by the data control device 11 (processing D1, S46), and then the main labeling processing is performed by the
図10(1)のような2値画像データに対して、処理A2、処理B1、処理C1を用いて仮ラベリング処理を行った場合の、画像データの状態と、仮ラベル間の接続情報を記憶するメモリ(変換テーブル)の状態との変化の様子を、図10(2)から図13(14)までに示す。 Stores the state of the image data and the connection information between the temporary labels when the temporary labeling process is performed on the binary image data as shown in FIG. 10A using the process A2, the process B1, and the process C1. FIG. 10 (2) to FIG. 13 (14) show how the memory (conversion table) changes.
図10〜図15において、“●”は特徴画素Aを、空欄は背景画素を、数値は(仮)ラベルを表している。また、“★”は特徴画素Bを表し、この特徴画素Bに例えば値3の仮ラベルが割り付けられたならば、“★3”というように示している。
10 to 15, “●” represents a feature pixel A, a blank represents a background pixel, and a numerical value represents a (provisional) label. Further, “★” represents the feature pixel B. If a temporary label of
なお、仮ラベリング処理は、図9で示したフローチャートに従って行われるが、処理A2、処理B1、処理C1により画像データの状態が変化しない場合は、図面から省略している。 The provisional labeling process is performed according to the flowchart shown in FIG. 9, but is omitted from the drawing when the state of the image data is not changed by the process A2, the process B1, and the process C1.
図14は、処理D1により、仮ラベル間の接続情報(図13(14))から作成された本ラベリング処理のための変換テーブルである。図15は、処理E1により、図14の画像データに対して本ラベリング処理が行われた後の画像データの状態である。 FIG. 14 is a conversion table for the main labeling process created from the connection information between temporary labels (FIG. 13 (14)) by the process D1. FIG. 15 shows a state of the image data after the main labeling process is performed on the image data of FIG. 14 by the process E1.
4・・・グローバルプロセッサ、6・・・レジスタファイル、7・・・外部インタフェース、11・・・データ制御装置、15・・・(仮ラベル間接続情報格納)メモリ、52・・・外部インタフェース制御部、58・・・ラベル判定回路、62・・・ラベルレジスタ、64・・・メモリ制御部。
4 ... global processor, 6 ... register file, 7 ... external interface, 11 ... data control device, 15 ... (temporary label connection information storage) memory, 52 ...
Claims (3)
上記ラベリング処理方法は、
2次元状に配置され背景画素と特徴画素とに2値化された2値画像データに対して一次的にラベリングを行う仮ラベリングの工程と、
上記仮ラベリングの工程の結果に基づいて、仮ラベル間の接続情報を整理して仮ラベルを本ラベルに変換する本ラベリングの工程とを含み、
上記仮ラベリングの工程の際において、
対象画素のデータをP[M,N](M=0,1,2,…/N=0,1,2,…)で表し、
更に、対象画素の1つ左隣の画素のデータをP[M−1,N]、対象画素の2つ左隣の画素のデータをP[M−2,N]、対象画素の1つ右隣の画素のデータをP[M+1,N]、対象画素の2つ右隣の画素のデータをP[M+2,N]、対象画素の1つ下の画素のデータをP[M,N+1]のように表すこととし、
N−1ライン目、Nライン目及びN+1ライン目におけるM−1列のデータであるP[M−1,N−1]、P[M−1,N] 、及びP[M−1,N+1]が、M−1番目のプロセッサエレメントが備えるレジスタに格納され、
N−1ライン目、Nライン目及びN+1ライン目におけるM列のデータであるP[M,N−1]、P[M,N] 、及びP[M,N+1]が、M番目のプロセッサエレメントが備えるレジスタに格納され、
N−1ライン目、Nライン目及びN+1ライン目におけるM+1列のデータであるP[M+1,N−1]、P[M+1,N] 、及びP[M+1,N+1]が、M+1番目のプロセッサエレメントが備えるレジスタに格納されており、
(1)プロセッサエレメントに備わるレジスタに格納されるデータにおいて、グローバルプロセッサが、P[M,N]が背景画素、かつP[M,N+1]が特徴画素、かつP[M−1,N]が特徴画素、かつP[M+1,N]が特徴画素であると判断すれば、M番目のプロセッサエレメントが備える第2の条件レジスタを1にセットし、
(2)プロセッサエレメントに備わるレジスタに格納されるデータにおいて、グローバルプロセッサが、P[M,N]とP[M−1,N]が背景画素、かつP[M,N+1]とP[M−1,N+1]が特徴画素、かつP[M+1,N]が特徴画素、かつP[M−2,N]が特徴画素であると判断すれば、M番目のプロセッサエレメントが備える第3の条件レジスタを1にセットし、
(3)プロセッサエレメントに備わるレジスタに格納されるデータにおいて、グローバルプロセッサが、P[M,N]とP[M+1,N]が背景画素、かつP[M,N+1]とP[M+1,N+1]が特徴画素、かつP[M+2,N]が特徴画素、かつP[M−1,N]が特徴画素であると判断すれば、M番目のプロセッサエレメントが備える第4の条件レジスタを1にセットし、
(4)上記(1)(2)(3)の判断の後、第2の条件レジスタ、第3の条件レジスタ、第4の条件レジスタの、いずれかが1にセットされていれば、対象画素のデータP[M,N]を背景画素から特徴画素へと書き換える処理を行うラベリング処理方法。 A labeling processing method for assigning the same label to feature pixels connected by using a SIMD type microprocessor having M processor elements and a global processor for processing a plurality of data,
The labeling method is
A provisional labeling step in which binary image data that is two-dimensionally arranged and binarized into background pixels and feature pixels is primarily labeled ;
Based on the result of the provisional labeling step, the information on the connection between the provisional labels is organized and the provisional labeling step of converting the provisional label into the real label ,
During the temporary labeling process,
The target pixel data is represented by P [M, N] (M = 0, 1, 2,... / N = 0, 1, 2,...)
Furthermore, the data of the pixel one pixel to the left of the target pixel is P [M-1, N], the data of the pixel two pixels to the left of the target pixel is P [M-2, N], and the right of the target pixel is one pixel. The data of the adjacent pixel is P [M + 1, N], the data of the pixel two pixels to the right of the target pixel is P [M + 2, N], and the data of the pixel immediately below the target pixel is P [M, N + 1]. And to represent
P [M−1, N−1], P [M−1, N], and P [M−1, N + 1], which are data of the M−1 column in the N−1th line, the Nth line, and the N + 1th line. Is stored in a register included in the (M−1) -th processor element,
P [M, N−1], P [M, N], and P [M, N + 1], which are M columns of data in the (N−1) th line, the Nth line, and the (N + 1) th line, are Mth processor elements. Stored in a register
P + 1 [M + 1, N−1], P [M + 1, N], and P [M + 1, N + 1], which are M + 1 columns of data in the (N−1) th line, the Nth line, and the (N + 1) th line, are the M + 1th processor element Is stored in a register
(1) In data stored in a register included in a processor element, a global processor determines that P [M, N] is a background pixel, P [M, N + 1] is a feature pixel, and P [M-1, N] is If it is determined that the feature pixel and P [M + 1, N] are feature pixels, the second condition register included in the Mth processor element is set to 1 ,
(2) In the data stored in the register provided in the processor element, the global processor determines that P [M, N] and P [M−1, N] are background pixels, and P [M, N + 1] and P [M− 1, N + 1] is a feature pixel, P [M + 1, N] is a feature pixel, and P [M-2, N] is a feature pixel, the third condition register included in the Mth processor element Set to 1 ,
(3) In the data stored in the register provided in the processor element, the global processor determines that P [M, N] and P [M + 1, N] are background pixels, and P [M, N + 1] and P [M + 1, N + 1] Is a feature pixel, P [M + 2, N] is a feature pixel, and P [M-1, N] is a feature pixel, the fourth condition register included in the Mth processor element is set to 1. And
(4) After determination of (1), (2), and (3) above, if any of the second condition register, the third condition register, and the fourth condition register is set to 1, the target pixel A labeling processing method for performing processing for rewriting the data P [M, N] from the background pixel to the feature pixel.
対象画素のデータP[M,N]を格納するレジスタを備えるプロセッサエレメントから、同一ラインの画素のデータであるP[M−2,N]、P[M−1,N]、P[M+1,N]、P[M+2,N]の夫々を格納するレジスタと、1つ下のラインの画素のデータであるP[M−1,N+1]、P[M,N+1]、P[M+1,N+1]の夫々を格納するレジスタが参照可能であり、それら参照可能なレジスタに格納される画素との関係から、自身の画素の状態を書き換える手段を備えた、請求項1に記載のラベリング処理方法を行うラベリング処理装置。 A SIMD type microprocessor having M processor elements and a global processor for processing a plurality of data;
P [M−2, N], P [M−1, N], and P [M + 1, P] are pixel data on the same line from a processor element that includes a register that stores target pixel data P [M, N]. N], P [M + 2, N] , and P [M-1, N + 1], P [M, N + 1], P [M + 1, N + 1] which are pixel data of the next lower line. 2. The labeling processing method according to claim 1, further comprising means for rewriting a state of its own pixel from a relationship with a pixel stored in the register that can be referred to. Labeling processing device.
所定の処理後に各背景画素において、画素データ内の第1のデータの存在を判断し、第1のデータが付加されていれば、背景画素へと書き戻すことを特徴とする請求項2に記載のラベリング処理装置。 First data indicating that the pixel was originally a background pixel is added to the pixel data of the background pixel rewritten to the feature pixel,
The presence of the first data in the pixel data is determined for each background pixel after a predetermined process, and if the first data is added, the data is written back to the background pixel. Labeling processing equipment.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004225615A JP4612352B2 (en) | 2004-08-02 | 2004-08-02 | Labeling processing apparatus and labeling processing method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004225615A JP4612352B2 (en) | 2004-08-02 | 2004-08-02 | Labeling processing apparatus and labeling processing method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2006048222A JP2006048222A (en) | 2006-02-16 |
JP4612352B2 true JP4612352B2 (en) | 2011-01-12 |
Family
ID=36026719
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2004225615A Expired - Fee Related JP4612352B2 (en) | 2004-08-02 | 2004-08-02 | Labeling processing apparatus and labeling processing method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4612352B2 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2017215689A (en) | 2016-05-30 | 2017-12-07 | 株式会社リコー | Image processing device and image processing method |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH05233807A (en) * | 1991-12-25 | 1993-09-10 | Sumitomo Metal Ind Ltd | Device and method for labelling processing |
JPH0887597A (en) * | 1994-09-20 | 1996-04-02 | Toshiba Corp | Image processor |
JP2002230540A (en) * | 2001-02-02 | 2002-08-16 | Fuji Xerox Co Ltd | Image processing method |
JP4237046B2 (en) * | 2003-12-24 | 2009-03-11 | 株式会社リコー | Image processing device |
JP4482356B2 (en) * | 2004-03-19 | 2010-06-16 | 株式会社リコー | Image processing method and image processing apparatus using SIMD processor |
-
2004
- 2004-08-02 JP JP2004225615A patent/JP4612352B2/en not_active Expired - Fee Related
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH05233807A (en) * | 1991-12-25 | 1993-09-10 | Sumitomo Metal Ind Ltd | Device and method for labelling processing |
JPH0887597A (en) * | 1994-09-20 | 1996-04-02 | Toshiba Corp | Image processor |
JP2002230540A (en) * | 2001-02-02 | 2002-08-16 | Fuji Xerox Co Ltd | Image processing method |
JP4237046B2 (en) * | 2003-12-24 | 2009-03-11 | 株式会社リコー | Image processing device |
JP4482356B2 (en) * | 2004-03-19 | 2010-06-16 | 株式会社リコー | Image processing method and image processing apparatus using SIMD processor |
Also Published As
Publication number | Publication date |
---|---|
JP2006048222A (en) | 2006-02-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JPH0137788B2 (en) | ||
JP2009223758A (en) | Image processing apparatus | |
JP3971535B2 (en) | SIMD type processor | |
US7512290B2 (en) | Image processing apparatus with SIMD-type microprocessor to perform labeling | |
JP2001358942A (en) | Error diffusion calculating device | |
JP4612352B2 (en) | Labeling processing apparatus and labeling processing method | |
JP4482356B2 (en) | Image processing method and image processing apparatus using SIMD processor | |
US7508397B1 (en) | Rendering of disjoint and overlapping blits | |
JPS6321694A (en) | Graphic processor | |
JP2812292B2 (en) | Image processing device | |
JP2839026B1 (en) | Parallel image processing device | |
JP4413905B2 (en) | SIMD type processor | |
JP4835872B2 (en) | Image processing device | |
JP4821427B2 (en) | Data processing apparatus and program thereof | |
JP4845351B2 (en) | Data transfer control device, data processing device, and control method for data transfer control device | |
JPS638951A (en) | Information memory device | |
JP4346039B2 (en) | Data processing device | |
JP4997821B2 (en) | Data processing apparatus and program thereof | |
JP2003195847A (en) | Graphic processor | |
JPS63298673A (en) | Image memory element | |
JPS63292377A (en) | High-speed drawing system for horizontal line vector | |
JPS63168785A (en) | Picture processor | |
JPH04278652A (en) | Graphic drawing device and its memory access system | |
JPS61131084A (en) | Picture processor | |
JPH0528399B2 (en) |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20070702 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20100713 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20100720 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20100921 |
|
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: 20101012 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20101015 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20131022 Year of fee payment: 3 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |