JP2004038669A - Image processing method - Google Patents

Image processing method Download PDF

Info

Publication number
JP2004038669A
JP2004038669A JP2002196206A JP2002196206A JP2004038669A JP 2004038669 A JP2004038669 A JP 2004038669A JP 2002196206 A JP2002196206 A JP 2002196206A JP 2002196206 A JP2002196206 A JP 2002196206A JP 2004038669 A JP2004038669 A JP 2004038669A
Authority
JP
Japan
Prior art keywords
label
temporary
labeling
image
data
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.)
Pending
Application number
JP2002196206A
Other languages
Japanese (ja)
Inventor
Keiji Minagawa
皆川 圭司
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.)
TDK Corp
Original Assignee
TDK 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 TDK Corp filed Critical TDK Corp
Priority to JP2002196206A priority Critical patent/JP2004038669A/en
Publication of JP2004038669A publication Critical patent/JP2004038669A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Analysis (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To enhance speed and reduce a used capacity of a memory by improving a label processing method. <P>SOLUTION: The image processing method has a step of attaching a temporary label to a continuous picture element group of the same type in two-dimensional image data, and a connecting process step of connecting adjacent continuous picture element groups as the same label when continuous picture element groups with different temporary labels are adjacent. In the step of attaching the temporary labels, the temporary labels are sequentially attached to continuous picture element groups of the same type along a picture element arranged direction and pieces of data of a temporary label or no label corresponding to each picture element are stored in a labeling memory, but when attaching a temporary label to a predetermined picture element, the temporary label is determined by using at least either one of temporary label data of the image data one picture element prior to the predetermined picture element or temporary label data of the labeling memory of an adjacent picture element one line prior to the predetermined picture element. By configuring the labeling memory in a cache memory 11, processing speed of a processor 10 is enhanced. <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
本発明は、2次元状に配列された画像データの画像処理方法に関し、特に、同種画素が連続した画素群の連結処理に特徴がある画像データの処理方法に関する。本発明は、例えば、プリント基板等に電子部品を自動装着する場合に、電子部品を撮像し、画像処理によって電子部品の傾きや位置を修正し、正確に電子部品を位置決めする場合に使用される。
【0002】
【従来の技術】
従来、対象物の背景も含めて撮像した領域の全体を2値画像データとして画像メモリに2次元状に一旦ストアする。この画像認識等の処理のためには、一般に画像全体の左上の画素から対角線上の対向する右下の画素までを順次走査してゆき、通常は「0」で表される背景画素データをとばし、「1」で表現されている対象物の画素データを探す。そしてその画素に仮のラベルが付与(ラベリング)される。また、「1」で表現されている画素データが連続している場合にはそれらの画素データには同一の仮ラベルを採用する。更に、既に割り当てられた仮ラベル同士が結合する場合は、全ての走査が終了した後で仮ラベルの整理、即ち、リラベリングが行われる。そして、リラベリング終了後再度走査し、ラベル毎に累積加算し面積、重心を求めていた。
【0003】
また、例えば特開平9−91426号公報には、リラベリングを行わず面積や先頭アドレス座標を得る方法について述べられているが、先頭アドレス座標の場合重心に比べて処理時間が速くできるが、位置精度的に誤差が大きくなり後に述べるパターンマッチングにおけるサーチ領域を拡大しなければならず、全体的な処理時間低下を招いてしまう。また、図形によっては合流対が多くなるとラベル間の連結処理が複雑になることが予想される。
【0004】
精度の高い位置決めを行なうパターンマッチングにおいては、認識したい部分の形状をあらかじめ標準パターンとして記憶しておき、その標準パターンと認識画像との間で相関演算を行い、相関が最大となる位置をもって物体の位置検出を行なっている。サーチするパターンの移動量を考慮してある程度余裕を持って設定されたサーチ領域内を少しずつずらしながら相関を求める為に、サーチ領域が広がるほどサーチ回数が多くなり処理時間がかかる。
【0005】
【発明が解決しようとする課題】
しかしながら、上記の画像処理方法によるラベル処理では、ラベル処理したデータを保存しておかなければならず、そのデータ量は用意するラベル数に相当するビット(ラベル数の上限を255とすると8ビット)が必要となる為、2値化データに比べ大きなメモリが必要となり、それを読み出すバイト数も増えることから処理時間も増加する。
【0006】
また、パターンマッチングにおいては、サーチ領域内を少しずつずらしながら相関を求める為に処理時間がかかり、縮小画像等を用い処理を高速化させようとすると誤検出や精度低下が生じる。
【0007】
本発明は、上記の点に鑑み、ラベル処理方法を改善して高速化を計るとともに、メモリの使用容量を低減せしめる画像データの処理方法を提供することと、パターンマッチングにおけるサーチ領域の範囲を狭める事によって高速でかつ誤検出のない画像処理方法を提供することを目的とする。
【0008】
本発明のその他の目的や新規な特徴は後述の実施の形態において明らかにする。
【0009】
【課題を解決するための手段】
上記目的を達成するために、本願請求項1の発明は、2次元状に配列された画像データのうち、同種の連続画素群に仮ラベルを付すステップと、異なる仮ラベルが付された連続画素群同士が隣接している場合に同一ラベルとして連結する連結処理ステップとを有する画像処理方法であって、
前記仮ラベルを付すステップでは前記画像データの同種の連続画素群に画素配列方向に沿って仮ラベルを順次付してラベリングリンクメモリに画素毎に対応する仮ラベル又はラベル無しのデータを格納するが、所定画素に仮ラベルを付す際に、前記画像データの1画素前の仮ラベルデータ及び1ライン前の隣接画素の前記ラベリングリンクメモリの仮ラベルデータの少なくともいずれかを用いて当該画素の仮ラベルを決定するようにしている。
【0010】
本願請求項2の発明に係る画像処理方法は、請求項1において、所定画素の仮ラベルの決定は、所定の検索順序で隣接画素の仮ラベルを検索し、最初に検出した仮ラベルを選択することにより行うことを特徴としている。
【0011】
本願請求項3の発明に係る画像処理方法は、請求項2において、前記仮ラベル毎の画素数及び1個の仮ラベルに対し1個の隣接ラベルの情報を登録する機能を有するラベリングテーブルを用い、隣接ラベルの検出においては仮ラベル付け時と異なる検索順序で最初に検出した隣接ラベルを前記ラベリングテーブルに登録し、仮ラベル付け及び隣接ラベル検出終了後に、前記ラベリングテーブルにより隣接する仮ラベル同士の画素数を加算することで連結処理ステップを行なうことを特徴としている。
【0012】
本願請求項4の発明に係る画像処理方法は、請求項3において、前記ラベリングテーブルに仮ラベル毎の画素数の他にライン/画素方向の累積座標値を登録し、前記連結処理ステップにて隣接する仮ラベル同士の累積座標値を加算することにより、連結後のラベルの面積及び重心を求めることを特徴としている。
【0013】
本願請求項5の発明に係る画像処理方法は、前記請求項4の画像処理方法で、基準となるマスタ画像の各閉図形の面積及び重心を求めるとともに位置決めする被測定物の画像の各閉図形の面積及び重心を求め、求められた前記マスタ画像と被測定物の画像との各閉図形の面積及び重心の比較より角度と位置ずれ量を算出することを特徴としている。
【0014】
本願請求項6の発明に係る画像処理方法は、請求項5において、前記角度と位置ずれ量をもとに狭められたサーチ領域でパターンマッチングを併用して前記被測定物を位置決めすることを特徴としている。
【0015】
本願請求項7の発明に係る画像処理方法は、請求項1,2,3,4,5又は6において、前記ラベリングリンクメモリをキャッシュメモリ内に配置したことを特徴としている。
【0016】
【発明の実施の形態】
以下、本発明に係る画像処理方法の実施の形態を図面に従って説明する。
【0017】
図1は本発明に係る画像処理方法に使用される装置の構成を示し、図2は2値画像が2次元状に配列(図示の例では水平X座標方向に10画素、垂直Y座標方向に10画素配置)されていることを示す説明図である。
【0018】
図1において、CCDカメラ等のITVカメラ1によって撮像されたアナログ画像信号2は、画像処理装置8内のA/Dコンバータ3でディジタル化処理され、多値化データ5として出力されFIFO(ファースト・イン・ファースト・アウト)メモリ7にいったん蓄積される。また、多値化データ5は2値化回路4で2値化処理されグレーレベルの2次元画像の2値化データ6に変換され同様にFIFOメモリ7に蓄積される。プロセッサ10は取込みと同時にFIFOメモリ7から画像データ信号9を読み出し、多値化データはワーキングメモリ12に保存する一方、2値化データは読込んで後述のラベリング処理(同種の連続画素群にラベルを付す処理)を行なう。ラベリングの際、ラベリングデータが格納されるラベリングリンクメモリはキャッシュメモリ11に作成(配置)され、ラベリングの結果はワーキングメモリ12に保存される。なお、キャッシュメモリ11はプロセッサ10内に含まれている場合もあるし、プロセッサ外に配置されている場合もある。キャッシュメモリ11はワーキングメモリ12等からのキャッシュデータを一次蓄えておくものである。
【0019】
プロセッサ10は、FIFOメモリ7の図2に例示するX,Y方向に2次元状に配列された2値画像データを読み取り、X方向の画素配列ラインに沿って白で示した「1」の画素データの連続画素群に仮ラベルを付していく。
【0020】
以下においては、こうした連結性を考慮した仮ラベル付けステップにつき説明する。図3は、画像データの処理方法の模式図であり、図4は図2の例を仮ラベリングした2次元形状配列を示す説明図である。仮ラベル付けは、先頭ラインの先頭画素から順次X座標方向(画素配列方向)へ移行し、そのラインが終了すれば次のラインヘ順次移行していく。
【0021】
図3に図示の例では、5ライン目の4画素目に相当する画素のラベル付け処理を図示している。これと、図5の仮ラベリングの流れ図を用いて仮ラベルの付け方について説明する。
【0022】
処理番地の水平座標:m、垂直座標:nであるとすると、最初に2値化画像データの(m,n)座標{例では(4,5)}のデータを読む。今、図2の白い部分の面積及び重心を求めようとしているので、読込んだデータが「0」(グレー部分)であれば同一ラインの1画素前のラベルデータをラベリングリンクメモリの(m−1)番地に書込んだ後、図3の処理中ラインデータの1画素前のラベルデータを0に書き換える(図3の▲5▼の処理を行う)。そして、(m+1,n)のデータ処理時にそれが1画素前のラベルデータとして使用される。さらに、その後、ラベリングリンクメモリに書き込まれて(m−1,n+1),(m,n+1),(m+1,n+1)の処理時に1ライン前ラベルデータとして使用される。
【0023】
「1」(白の部分)の場合は、
(1)1画素前のラベルデータ
(2)ラベリングリンクメモリ(1ライン前のラベルデータが格納されている)の(m−1)番地のラベルデータ
(3)ラベリングリンクメモリのm番地のラベルデータ
(4)ラベリングリンクメモリの(m+1)番地のラベルデータ
の順に読み出してラベルが「0」以外であれば処理を中断して、読み出したラベル値を、処理している座標(m,n)のラベル値としてラベリングテーブルの処理を行なう。上記4つのデータが全て「0」の場合は、新規ラベル(ラベルは1から始めて新しい画素群を検出するたびに1づつインクリメントしていく)を、同様に処理している座標(m,n)のラベル値としてラベリングテーブルの処理を行なう。
【0024】
以上が仮ラベル付けであるが、先頭ライン及びラインの先頭と最後尾においては、配列外を参照しなければいけないのでその部分は本実施の形態では全て「0」(面積及び重心を求める方でないデータ)として処理する必要がある。仮ラベリングが終了すると図4に示すような2次元形状配列ができる。実際には、ラベリングデータはラベリングリンクメモリを上書きしていくので、図4のようにメモリ展開されるわけではないが仮ラベルの結果を示すために挙げている。
【0025】
なお、キャッシュメモリ内のデータはアクセスがしばらくないと別なデータに更新されて、再びアクセスしたときにはワーキングメモリ12から再度アクセスデータを読み込む必要があるが、ラベリングリンクメモリ内のラベルデータのようにある頻度で繰り返し読み込むデータは更新が起きないようにラベリングリンクメモリをキャッシュメモリ内に常駐させる。また、図3における、ラベリングリンクメモリよりも下段に示された1ライン前のデータ、処理中ラインデータ、ラベル付け後のデータもキャッシュメモリあるいはプロセッサ10内の一次記憶手段に格納される。
【0026】
以下においては、図5中のラベリングテーブル処理の詳細流れ図を図6に示す。この図6を用いて、ラベルの書き換えとラベリングテーブルの処理方法について説明する。図5のラベリング処理(仮ラベル付け処理)において処理している座標の仮ラベル値が確定したら、図6にあるように、
(1)1画素前のラベルデータをラベリングリンクメモリの(m−1)番地に書込む、
(2)1画素前のラベルデータを新しいラベル「r」に書き換える、
という手順でメモリ操作を行なう。メモリ操作が終了したら、次にラベリングテーブルの操作を行なう。
【0027】
ラベリングテーブルは図8に示すような配列形状をしており、行(上下方向の数値で、図示の場合、1,2,3,4,5)にはラベル数が取られており、列(横方向)には1隣接ラベル、2個数(画素数)、3累積水平座標値、4累積垂直座標値の4項目が用意されている。例えば、図6中の行列(r,2)のrはラベル数値、すなわち図8のr行目を示し、2は2列目で個数の項目を示す。図8のラベリングテーブルは、処理開始前にはすべてクリアされている。ここで、累積水平座標値はラベルが付された連続画素群の各画素の水平座標値の総和であり、累積垂直座標値は各画素の垂直座標値の総和である。
【0028】
ラベリングテーブルの処理は、ラベル数に相当する行の個数(画素数)の項を1インクリメントし(図6に示すようにラベリングテーブルの行列(r,2)に1を加算し)、累積水平座標と累積垂直座標の項には、処理している座標の水平座標値と垂直座標値を加算する(図6に示すようにラベリングテーブルの行列(r,3)にmを加算し、行列(r,4)にnを加算する)。隣接ラベルの項には、
(1)ラベリングリンクメモリの(m−1)番地のデータ
(2)ラベリングリンクメモリのm番地のデータ
(3)ラベリングリンクメモリの(m+1)番地のデータ
の順に読み出してラベルが「0」や「r」以外のラベルがあれば処理を中断して、読み出したラベル値を書込む。読み出したラベルが「0」や「r」であれば隣接ラベルの項は書き換えずに終了する。ここで重要なのは、ラベリングリンクメモリの読み出す順番であり、本実施の形態においては、仮ラベル付け時には横方向の連結を主にし(X座標方向の連結を優先し)、隣接ラベル付け時には縦方向の連結を行なっている。すなわち、仮ラベル付け時と隣接ラベル付け時で異なる方向の連結を優先させることで、後の連結操作を容易にしているのである。
【0029】
図2の2次元状画像データの仮ラベル付けを行なって得られたラベリングテーブルの結果を図8(A)に示す。
【0030】
以下においては、仮ラベル付けステップの結果によって得られたラベリングテーブルを用いて隣接する仮ラベル同士を連結する連結処理ステップについて図7の隣接ラベルの連結処理の流れ図と図8のラベリングテーブルの1例を用いて説明する。
【0031】
図8(A)は仮ラベル付けステップ終了後のラベリングテーブルの状態である。連結処理ステップは、図7の流れ図のように、ラベリングテーブルの1行目より処理を開始し、面積(画素の個数)の項目が「0」(ラベルがない状態)になったら終了する。処理内容は最初に、その行の隣接ラベルの項{処理している行が「i」であれば、ラベリングテーブルの行列(i,1)}より読み出してその数値が「0」であれば次の行の処理に移行する。読み出した数値が、「0」以外であればその数値p(処理している行「i」、その行の隣接ラベルp)行の面積、累積水平座標及び累積垂直座標の項目の数値を、処理行であるi行の数値とそれぞれ加算してその数値に書換える(図7のa(p,j)=a(i,j)+a(p,j)の処理を行い、加算結果はp行に上書きする。但し、a(p,j)は図8のp行j列の値を表す)。処理行のi行では面積、累積水平座標及び累積垂直座標の項目をそれぞれ「0」に書換える(図7のa(i,j)=0の処理を行う)。
【0032】
上記連結処理を図8(A)について行った結果が、図8(B)となる。得られた連結処理結果より個数が「0」の行を削除し、各行に関して個数を面積とし、
重心水平座標値=累積水平座標値/面積
重心垂直座標値=累積垂直座標値/面積
の式にしたがって、それぞれの閉図形の重心座標が求められる。図8(B)について重心計算を行なった結果が、図9である。
【0033】
仮ラベル付けステップ及び連結処理ステップが終了すると図10に示すような最終的なラベル付けがされた2次元形状配列ができる。実際には、連結処理はラベリングテーブル内で処理される為、図10のようにメモリ展開されるわけではないが連結処理の結果を示すために挙げている。
【0034】
次に、ラベルが付された閉図形の面積及び重心を用いたパターンマッチング手法に関して説明する。図2の2値化画像を基準となるマスター画像の標準パターンとして登録し、位置決めする被測定物の画像とパターンマッチングを行なう場合、標準パターン登録時に上記仮ラベル付けステップ及び連結処理ステップを用いて面積及び重心を求め、その数値も含めて同時に登録しておく。さらに、角度付のパターンマッチングの場合は、あらかじめ閉図形ごと、あるいは画像全体のアフィン変換(画像情報の座標変換による移動、回転処理)を使用し各角度における回転標準パターンを登録しておくことで処理時間を短縮することができる。
【0035】
図11のように図2を移動(回転も含む)させた2値画像データの2次元形状配列の例(位置決めする被測定物の画像の例)にパターンマッチングを実施する場合、前述の仮ラベル付けステップによって図12のような結果がラベリングテーブル上に得られる。図12の結果についてさらに連結処理と面積及び重心の計算を行なうと図13のような結果が得られる。図14は、図11に対して仮ラベル付けを行なった2次元形状配列である。実際には、ラベリングデータはラベリングリンクメモリを上書きしていくので、図14のようにメモリ展開されるわけではないが仮ラベルの結果を示すために挙げている。
【0036】
標準パターンと被測定物の認識画像の面積及び重心データをそれぞれ面積でソートしたのが図15である。閉図形1、2の重心間の長さと角度(正しくはアスペクト比を考慮する必要があるが、ここでは簡略化の為にアスペクト比を1:1としている。)を算出している。長さの算出は、閉図形の位置関係により面積だけで判別が不能のときに用いられる(本例では、閉図形が2個しかない為機能しないが、多数個の閉図形がある場合は、面積と重心間長さの情報より、標準パターンと認識画像それぞれの閉図形との対応を取ることが考えられる。)。
【0037】
本実施の形態においては、閉図形1と2の相対角度を標準パターンと認識画像について求めて、その角度差が標準パターンから認識画像への回転角度になる。これを図14に図示している。閉図形1においては、標準パターンの重心13(3,5.47)が認識画像の重心15(8.5,5)に移動しており、閉図形2においては、同様に標準パターンの重心14(7.55,5.45)から認識画像の重心16(3.75,5.65)に移動している。回転角は、標準パターンでは閉図形1−2間の角度が359.7°であったのに対し、認識画像の場合は187.7°であり、標準パターンと認識画像の回転角は、その差分である188.0°となる。ここで、認識画像に対して標準パターンを回転させて重ね合わせる場合、反時計回りをプラスとし時計回りをマイナスの角度するとき、標準パターンの角度をθx、認識画像の角度をθyとすると、標準パターンを回転させる角度θzは、
(1) θx>θy のとき
θz =360−(θx−θy)
(2) θx<θy のとき
θz =θy−θx
となる。
【0038】
標準パターンと認識画像の面積及び重心の比較から求めた位置ずれ量や回転角度でもある程度の精度が期待できるが、さらに多値化のパターンマッチングを併用することで、認識画像の照明のばらつきや欠けに強くなり、サブピクセル(1画素より小さい寸法)まで位置決め精度を向上させることができる。
【0039】
また、標準パターンと認識画像の面積及び重心の比較から求めた位置ずれ量や回転角度を用いて、閉図形1の重心の位置ずれ量の±1〜2画素の領域に対して、求められた回転角度に最も近い角度で標準パターンをアフィン変換してあらかじめ作成された画像をマスタ画像として認識画像とのパターンマッチングを行い、それぞれの相関値を求め正規化相関により位置ずれ量を求め、次に閉図形2に対しても同様にして位置ずれ量を求め、求められた閉図形1と2の位置ずれ量から再度回転角度を計算することで、さらに精度の良い回転角度が得られる。
【0040】
通常の回転パターンマッチングの場合、サーチ領域が±5画素の領域(サーチ領域は標準パターンの最大位置ずれ量によって決まる)であるとすると、標準パターンを11×ll=121回移動させて演算する必要がある。また、回転を考慮してnパターンの回転画像(回数は求める角度範囲と角度ずれによる誤差によって決まる)を用意したとするとさらに121×n回の演算が必要となる。これに対し、本実施の形態に係る処理方法を用いると、サーチ領域を±1〜2画素に制限できるため、移動回数を9〜25回に抑えることができ、回転に関してもあらかじめ概略の回転角度が判明している為、1つの回転画像についてのみ行われるので移動回数が増加することはない。
【0041】
従って、サーチ領域がさらに広い場合や回転精度を精度よく求めることが要求されるような場合においては、本実施の形態に係る処理方法はさらに有効性を増す。
【0042】
この実施の形態によれば、次の通りの効果を得ることができる。
【0043】
(1) 仮ラベル付けステップでは、図2のように2次元状に配列された画像データのうち、同種の連続画素群について画素配列方向に沿って順次仮ラベルを付してラベリングリンクメモリに画素毎に対応する仮ラベル又は仮ラベル無しのデータを格納するが、所定画素に仮ラベルを付す際に、図3のように前記画像データの1画素前及び1ライン前の隣接画素の前記ラベリングリンクメモリのラベルリングデータ(仮ラベルデータ)を用いて当該画素の仮ラベルを決定している。
【0044】
従って、各画素についての仮ラベル情報を1ライン分のラベリングリンクメモリに上書きしながら処理することによりメモリ容量を低減し、ラベリングリンクメモリを図1のプロセッサ10内のキャッシュメモリ11に置くことによってメモリヘのアクセスを高速化し、なおかつラベリングリンクメモリに格納されたラベリングデータ(仮ラベルデータ)ヘのアクセス回数を低減可能でこの点でも高速化を図ることができる。
【0045】
(2) 前記仮ラベル毎の画素数及び1個の仮ラベルに対し1個の隣接ラベルの情報(連結情報)を登録する機能を有するラベリングテーブルを用い、前記画像データの画素配列方向(X座標方向)に沿って同種の連続画素群に仮ラベルを順次付して行き(検索順序はX座標方向優先)、隣接ラベルの検出においては仮ラベル付け時と異なる検索順序(Y座標方向)で最初に検出した隣接ラベルを前記ラベリングテーブルに登録し、仮ラベル付け及び隣接ラベル検出終了後に、前記ラベリングテーブルにより隣接する仮ラベル同士の画素数を加算することで連結処理ステップを行なう。この連結処理で隣接する仮ラベル同士の画素数を加算することにより、同種画素の連続帯である面積が求められる。
【0046】
このように、ラベリングテーブル上に隣接ラベルの情報を登録出来るようにしたことにより、リラベリングを不要にし、速度向上とメモリ使用容量を低減させ得る。
【0047】
(3) 前記ラベリングテーブルに仮ラベル毎の画素数の他にライン/画素方向の累積座標値を登録し、連結処理ステップにて隣接する仮ラベル同士の累積座標値を加算することにより、再度ラベリングデータを処理することなく連結後の各ラベルの面積、重心を求めることが可能ある。このように、連結と重心処理を並列処理することによってメモリアクセス回数を減らしてさらに高速化が図れる。
【0048】
(4) 上記の仮ラベル付けステップ及び連結処理ステップで、基準となるマスタ画像の各閉図形の面積及び重心を求め、また位置決めする被測定物の画像の各閉図形の面積及び重心も同様に求めることにより、求められた前記マスタ画像と被測定物の画像との各閉図形の面積及び重心の比較より角度と位置ずれ量を高速算出可能である。このように、位置関係や回転角度を算出しておくことにより、パターンマッチングを行なう際のサーチ領域を狭めることが可能となる。
【0049】
(5) 前記マスタ画像と被測定物の画像における各閉図形の角度と位置ずれ量をもとに狭められたサーチ領域でパターンマッチングを併用して前記被測定物を位置決めするため、サーチ回数を減らすことによって全体としての画像処理速度を高めることができる。また、サーチ領域が狭められている為に、縮小画像による検索を用いなくても高速な処理速度を保てるので、縮小画像による弊害や似通った画像が近傍に存在していても誤検出することがない。
【0050】
以上本発明の実施の形態について説明してきたが、本発明はこれに限定されることなく請求項の記載の範囲内において各種の変形、変更が可能なことは当業者には自明であろう。
【0051】
【発明の効果】
以上説明したように、本発明に係る画像処理方法によれば、2次元状に配列された画像データのうち、同種の連続画素群に仮ラベルを付す場合に、前記画像データの同種の連続画素群に画素配列方向に沿って仮ラベルを順次付してラベリングリンクメモリに画素毎に対応する仮ラベル又は仮ラベル無しのデータを格納するが、所定画素に仮ラベルを付す際に、前記画像データの1画素前の仮ラベルデータ及び1ライン前の隣接画素の前記ラベリングリンクメモリの仮ラベルデータの少なくともいずれかを用いて当該画素の仮ラベルを決定するようにしている。ラベリング後の仮ラベルデータを1ラインのラベリングリンクメモリに制限し、キャッシュメモリ内に配置することにより必要メモリ容量も少なく高速なラベリング処理が実現できる。
【0052】
また、連結処理において、ラベリングテーブルに隣接ラベル、画素数、累積座標値の項目を付加し、隣接ラベル同士の連結処理と同時に面積及び重心を求める処理を行なう場合、再度ラベリングデータにアクセスすることなくラベリングテーブル内で処理したことにより高速な面積、重心処理が可能である。
【0053】
さらに、上記の高速で面積及び重心を求める処理方法を用い、基準となるマスタ画像と被測定物の画像の位置ずれ量と回転角度を算出し、そのデータをもとにパターンマッチングのサーチ領域を狭め、回転角を固定化して処理することによって、高速でかつ精度の高い位置決めを行なうための画像データの処理方法を実現可能となる。
【図面の簡単な説明】
【図1】本発明に係る画像処理方法の実施の形態で用いる装置構成を示すブロック図である。
【図2】2値画像データの2次元形状配列の例を示す説明図である。
【図3】実施の形態における画像データの仮ラベル付け処理の模式図である。
【図4】図2の2値画像データの例を仮ラベル付けした2次元形状配列を示す説明図である。
【図5】実施の形態における仮ラベル付けステップ(仮ラベル付け処理)の流れ図である。
【図6】図5の流れ図中におけるラベリングテーブル処理の詳細流れ図である。
【図7】実施の形態における隣接ラベルの連結処理ステップの流れ図である。
【図8】実施の形態におけるラベリングテーブルの一例を示す説明図である。
【図9】図8のラベリングテーブルを用いた連結処理より求められた面積及び重心の算出結果を示す説明図である。
【図10】図2の2値画像データの例を最終ラベリング処理した後(連結処理した後)の2次元形状配列を示す説明図である。
【図11】図2の2値画像データを移動させた2値画像データの2次元形状配列の例を示す説明図である。
【図12】図11の2値画像データの場合のラベリングテーブルの一例を示す説明図である。
【図13】図12のラベリングテーブルより求められた面積及び重心の結果を示す説明図である。
【図14】図11の2値画像データの例を仮ラベル付けした2次元形状配列を示す説明図である。
【図15】図2と図11の2値画像データの比較における移動量及び回転角計算結果の一例を示す説明図である。
【符号の説明】
1 カメラ
2 画像信号
3 A/Dコンバータ
4 2値化回路
5 多値化データ
6 2値化データ
7 FIFOメモリ
8 画像処理装置
9 画像データ信号
10 プロセッサ
11 キャッシュメモリ
12 ワーキングメモリ
13 標準パターンの閉図形1の重心座標
14 標準パターンの閉図形2の重心座標
15 認識図形の閉図形1の重心座標
16 認識図形の閉図形2の重心座標
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to an image processing method for image data arranged two-dimensionally, and more particularly to a method for processing image data characterized by a process of connecting a group of consecutive pixels of the same kind. The present invention is used, for example, when automatically mounting an electronic component on a printed circuit board or the like, imaging the electronic component, correcting the tilt or position of the electronic component by image processing, and accurately positioning the electronic component. .
[0002]
[Prior art]
2. Description of the Related Art Conventionally, the entire imaged area including the background of an object is temporarily stored in an image memory as two-dimensional image data as binary image data. In order to perform such processing as image recognition and the like, generally, the upper left pixel of the entire image is sequentially scanned from the diagonally opposite lower right pixel, and background pixel data usually represented by "0" is skipped. , "1" is searched for pixel data of the object. Then, a temporary label is given (labeled) to the pixel. If the pixel data represented by “1” is continuous, the same temporary label is adopted for the pixel data. Furthermore, when the temporary labels already assigned are combined, the temporary labels are arranged, that is, relabeling is performed after all the scans are completed. After relabeling, scanning is performed again, and cumulative addition is performed for each label to determine the area and the center of gravity.
[0003]
For example, Japanese Patent Application Laid-Open No. 9-91426 describes a method of obtaining an area and a start address coordinate without performing relabeling. In the case of the start address coordinate, the processing time can be shortened as compared with the center of gravity. The error increases in accuracy, and the search area in the pattern matching described later must be expanded, resulting in a reduction in the overall processing time. Also, depending on the figure, it is expected that the connection process between the labels will be complicated when the number of merged pairs increases.
[0004]
In pattern matching for high-precision positioning, the shape of the part to be recognized is stored in advance as a standard pattern, a correlation operation is performed between the standard pattern and the recognized image, and the position of the object with the position where the correlation is maximum is determined. The position is being detected. In order to obtain the correlation while gradually shifting the search area set with some allowance in consideration of the amount of movement of the pattern to be searched, the number of searches increases and the processing time increases as the search area expands.
[0005]
[Problems to be solved by the invention]
However, in the label processing by the above-described image processing method, the data subjected to the label processing must be stored, and the data amount is a bit corresponding to the number of labels to be prepared (8 bits when the upper limit of the number of labels is 255). Is required, a larger memory is required as compared with the binarized data, and the number of bytes to be read out increases, so that the processing time also increases.
[0006]
Further, in pattern matching, it takes a long time to calculate the correlation while shifting the search area little by little. If the processing is speeded up using a reduced image or the like, an erroneous detection or a decrease in accuracy occurs.
[0007]
In view of the above, the present invention provides a method of processing image data that improves the label processing method to increase the speed and reduces the memory usage, and narrows the range of a search area in pattern matching. It is an object of the present invention to provide an image processing method which is fast and free from erroneous detection.
[0008]
Other objects and novel features of the present invention will be clarified in embodiments described later.
[0009]
[Means for Solving the Problems]
In order to achieve the above object, the invention according to claim 1 of the present application includes a step of assigning a temporary label to a group of continuous pixels of the same type in image data arranged two-dimensionally, A link processing step of linking as the same label when the groups are adjacent to each other,
In the step of attaching the temporary label, temporary labels are sequentially attached to the same kind of continuous pixel group of the image data along the pixel array direction, and the corresponding temporary label or data without a label is stored in the labeling link memory. When assigning a temporary label to a predetermined pixel, the temporary label of the pixel is determined by using at least one of the temporary label data of one pixel before the image data and the temporary label data of the labeling link memory of an adjacent pixel one line before. Is to decide.
[0010]
In the image processing method according to the second aspect of the present invention, in the first aspect, the provisional label of a predetermined pixel is determined by searching for a temporary label of an adjacent pixel in a predetermined search order and selecting a temporary label detected first. It is characterized by performing by doing.
[0011]
An image processing method according to a third aspect of the present invention uses the labeling table according to the second aspect, which has a function of registering the number of pixels for each temporary label and information of one adjacent label for one temporary label. In the detection of the adjacent label, the first adjacent label detected in a different search order from that at the time of provisional labeling is registered in the labeling table, and after the provisional labeling and the detection of the adjacent label are completed, the temporary labels adjacent to each other are detected by the labeling table. The connection processing step is performed by adding the number of pixels.
[0012]
An image processing method according to a fourth aspect of the present invention is the image processing method according to the third aspect, wherein the cumulative coordinate value in the line / pixel direction is registered in the labeling table in addition to the number of pixels for each temporary label, The area and the center of gravity of the connected labels are obtained by adding the cumulative coordinate values of the temporary labels.
[0013]
An image processing method according to a fifth aspect of the present invention is the image processing method according to the fourth aspect, wherein an area and a center of gravity of each closed figure of the master image serving as a reference are obtained and each closed figure of the image of the DUT to be positioned is positioned. And calculating the angle and the amount of displacement from the comparison of the area and the center of gravity of each closed figure between the obtained master image and the image of the device under test.
[0014]
An image processing method according to a sixth aspect of the present invention is the image processing method according to the fifth aspect, wherein the object to be measured is positioned by using pattern matching together in a search area narrowed based on the angle and the displacement amount. And
[0015]
An image processing method according to a seventh aspect of the present invention is the image processing method according to the first, second, third, fourth, fifth or sixth aspect, wherein the labeling link memory is arranged in a cache memory.
[0016]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of an image processing method according to the present invention will be described with reference to the drawings.
[0017]
FIG. 1 shows the configuration of an apparatus used in the image processing method according to the present invention, and FIG. 2 shows a two-dimensional array of binary images (10 pixels in the horizontal X coordinate direction and 10 pixels in the vertical Y coordinate direction in the illustrated example). FIG. 9 is an explanatory diagram showing that (10 pixels are arranged).
[0018]
In FIG. 1, an analog image signal 2 captured by an ITV camera 1 such as a CCD camera is digitized by an A / D converter 3 in an image processing device 8, output as multi-valued data 5, and output to a FIFO (fast (In-first-out) memory 7. The multi-valued data 5 is binarized by the binarization circuit 4, converted into gray-level two-dimensional image binarized data 6, and similarly stored in the FIFO memory 7. The processor 10 reads out the image data signal 9 from the FIFO memory 7 at the same time as the reading, stores the multi-valued data in the working memory 12, and reads the binary data and performs a labeling process described below (labels the same kind of continuous pixel group as a continuous pixel group). Processing). At the time of labeling, a labeling link memory in which labeling data is stored is created (placed) in the cache memory 11, and the result of labeling is stored in the working memory 12. Note that the cache memory 11 may be included in the processor 10 or may be arranged outside the processor. The cache memory 11 temporarily stores cache data from the working memory 12 and the like.
[0019]
The processor 10 reads the binary image data two-dimensionally arranged in the X and Y directions illustrated in FIG. 2 of the FIFO memory 7, and displays “1” pixels indicated in white along the pixel array lines in the X direction. A temporary label is assigned to a continuous pixel group of data.
[0020]
Hereinafter, a temporary labeling step in consideration of such connectivity will be described. FIG. 3 is a schematic diagram of a method of processing image data, and FIG. 4 is an explanatory diagram showing a two-dimensional shape array obtained by temporarily labeling the example of FIG. The provisional labeling is sequentially shifted in the X coordinate direction (pixel arrangement direction) from the first pixel of the first line, and is sequentially shifted to the next line when the line ends.
[0021]
In the example illustrated in FIG. 3, a labeling process of a pixel corresponding to the fourth pixel on the fifth line is illustrated. A method of attaching a temporary label will be described with reference to this and a flowchart of the temporary labeling shown in FIG.
[0022]
Assuming that the horizontal coordinate of the processing address is m and the vertical coordinate is n, the data of the (m, n) coordinate {in the example, (4, 5)} of the binary image data is read. Now, since the area and the center of gravity of the white part in FIG. 2 are to be obtained, if the read data is “0” (gray part), the label data one pixel before the same line is read from the (m− 1) After writing to the address, the label data one pixel before the line data being processed in FIG. 3 is rewritten to 0 (the processing of (5) in FIG. 3 is performed). Then, at the time of data processing of (m + 1, n), it is used as label data of one pixel before. Further, thereafter, the data is written to the labeling link memory and is used as one-line preceding label data in the processing of (m-1, n + 1), (m, n + 1), (m + 1, n + 1).
[0023]
In the case of "1" (white part)
(1) Label data one pixel before
(2) Label data at address (m-1) of the labeling link memory (where the label data of the previous line is stored)
(3) Label data at address m in the labeling link memory
(4) Label data at address (m + 1) in the labeling link memory
If the label is other than "0" and the label is other than "0", the processing is interrupted and the read label value is processed as the label value of the coordinate (m, n) being processed, and the labeling table is processed. If the above four data are all “0”, the coordinates (m, n) of the new label (the label starts from 1 and is incremented by one each time a new pixel group is detected) The processing of the labeling table is performed as the label value of.
[0024]
The above is the provisional labeling. However, since the outside of the array must be referred to at the head line and at the head and tail of the line, all of the parts are "0" in this embodiment. Data). When the temporary labeling is completed, a two-dimensional shape array as shown in FIG. 4 is created. Actually, since the labeling data overwrites the labeling link memory, the labeling data is not developed as shown in FIG. 4, but is shown to show the result of the temporary label.
[0025]
It should be noted that the data in the cache memory is updated to another data if the access is not performed for a while, and it is necessary to read the access data again from the working memory 12 when the access is made again, but it is like the label data in the labeling link memory. The labeling link memory is resident in the cache memory so that the data that is repeatedly read at a frequency is not updated. In addition, the data one line before, the line data being processed, and the data after labeling shown in the lower part of the labeling link memory in FIG. 3 are also stored in the cache memory or the primary storage means in the processor 10.
[0026]
In the following, a detailed flowchart of the labeling table process in FIG. 5 is shown in FIG. A method of rewriting a label and processing a labeling table will be described with reference to FIG. When the temporary label value of the coordinates being processed in the labeling process (temporary labeling process) in FIG. 5 is determined, as shown in FIG.
(1) Write the label data one pixel before to the address (m-1) of the labeling link memory;
(2) rewrite the label data one pixel before to a new label “r”;
Memory operation is performed in the following procedure. After the memory operation is completed, the labeling table is operated next.
[0027]
The labeling table has an array shape as shown in FIG. 8, and the number of labels is taken in a row (numerical values in the vertical direction, 1, 2, 3, 4, 5 in the figure), and a column ( In the (horizontal direction), four items of one adjacent label, two pieces (number of pixels), three cumulative horizontal coordinate values, and four cumulative vertical coordinate values are prepared. For example, r in the matrix (r, 2) in FIG. 6 indicates the label value, that is, the r-th row in FIG. 8, and 2 indicates the number item in the second column. All the labeling tables in FIG. 8 are cleared before the processing starts. Here, the cumulative horizontal coordinate value is the sum of the horizontal coordinate values of each pixel of the continuous pixel group to which the label is attached, and the cumulative vertical coordinate value is the sum of the vertical coordinate values of each pixel.
[0028]
In the processing of the labeling table, the term of the number of rows (the number of pixels) corresponding to the number of labels is incremented by 1 (one is added to the matrix (r, 2) of the labeling table as shown in FIG. 6), and the accumulated horizontal coordinates The horizontal coordinate value and the vertical coordinate value of the coordinate being processed are added to the term of the accumulated vertical coordinate (m is added to the matrix (r, 3) of the labeling table as shown in FIG. , 4) with n). In the adjacent label section,
(1) Data at address (m-1) of the labeling link memory
(2) Data at address m in the labeling link memory
(3) Data at address (m + 1) in the labeling link memory
If there is a label other than "0" or "r" and the label is not "0" or "r", the processing is interrupted and the read label value is written. If the read label is "0" or "r", the process ends without rewriting the term of the adjacent label. What is important here is the order of reading from the labeling link memory. In the present embodiment, the connection in the horizontal direction is mainly performed at the time of provisional labeling (the connection in the X coordinate direction is given priority), and the connection in the vertical direction is performed at the time of adjacent labeling. We are connecting. That is, prioritizing the connection in a different direction between the time of provisional labeling and the time of adjacent labeling facilitates the subsequent connection operation.
[0029]
FIG. 8A shows the result of the labeling table obtained by performing the temporary labeling of the two-dimensional image data of FIG.
[0030]
In the following, regarding the connection processing step of connecting adjacent temporary labels using the labeling table obtained as a result of the temporary labeling step, an example of the flowchart of the connection processing of adjacent labels in FIG. 7 and an example of the labeling table in FIG. This will be described with reference to FIG.
[0031]
FIG. 8A shows the state of the labeling table after the provisional labeling step is completed. As shown in the flowchart of FIG. 7, the connection processing step starts processing from the first row of the labeling table, and ends when the item of the area (the number of pixels) becomes “0” (state where there is no label). The processing content is first read from the adjacent label item of the row {if the row being processed is “i”, read from the matrix (i, 1) of the labeling table}, and if the numerical value is “0”, the next step is Move to the processing of the row. If the read numerical value is other than “0”, the numerical value of the item of the numerical value p (the line “i” being processed, the label p adjacent to the line), the cumulative horizontal coordinate and the cumulative vertical coordinate are processed. The value is added to the value of the i-th row, which is a row, and rewritten to the value (the processing of a (p, j) = a (i, j) + a (p, j) in FIG. 7 is performed, and the addition result is p rows Where a (p, j) represents the value of the row p and the column j of FIG. 8). In the i-th processing line, the items of the area, the accumulated horizontal coordinate, and the accumulated vertical coordinate are rewritten to “0” (the processing of a (i, j) = 0 in FIG. 7 is performed).
[0032]
FIG. 8B shows the result of performing the above connection processing for FIG. 8A. The number of rows “0” is deleted from the obtained connection processing result, and the number is defined as an area for each row,
Barycenter horizontal coordinate value = cumulative horizontal coordinate value / area
Barycenter vertical coordinate value = cumulative vertical coordinate value / area
The barycentric coordinates of each closed figure are obtained according to the following equation. FIG. 9 shows the result of calculating the center of gravity for FIG. 8B.
[0033]
When the provisional labeling step and the connection processing step are completed, a final labeled two-dimensional shape array as shown in FIG. 10 is created. Actually, since the linking process is performed in the labeling table, the memory is not expanded as shown in FIG. 10, but is shown to show the result of the linking process.
[0034]
Next, a pattern matching method using the area and the center of gravity of a closed figure with a label will be described. When the binarized image of FIG. 2 is registered as a standard pattern of a master image serving as a reference, and pattern matching is performed with the image of the DUT to be positioned, the temporary labeling step and the connection processing step are used when the standard pattern is registered. Find the area and center of gravity, and register them together with their numerical values. Furthermore, in the case of pattern matching with an angle, a rotation standard pattern at each angle is registered in advance by using an affine transformation (movement and rotation processing by coordinate transformation of image information) for each closed figure or the entire image. Processing time can be reduced.
[0035]
When pattern matching is performed on an example of a two-dimensional array of binary image data (an example of an image of an object to be positioned) obtained by moving (including rotating) FIG. 2 as shown in FIG. By the attaching step, a result as shown in FIG. 12 is obtained on the labeling table. When the connection processing and the calculation of the area and the center of gravity are further performed on the result of FIG. 12, a result as shown in FIG. 13 is obtained. FIG. 14 shows a two-dimensional shape array obtained by performing temporary labeling on FIG. In practice, the labeling data overwrites the labeling link memory, so the memory is not developed as shown in FIG. 14, but is shown to show the result of the temporary label.
[0036]
FIG. 15 shows the area of the standard pattern and the area and the center of gravity data of the recognition image of the device under test sorted by area. The length and angle between the centers of gravity of the closed figures 1 and 2 (correctly, it is necessary to consider the aspect ratio, but here the aspect ratio is set to 1: 1 for simplicity) is calculated. The calculation of the length is used when it is impossible to determine only the area due to the positional relationship of the closed figures (in this example, there is only two closed figures, so it does not function, but if there are many closed figures, Based on the information on the area and the length between the centers of gravity, it is conceivable to make correspondence between the standard pattern and the closed figure of each recognized image.)
[0037]
In the present embodiment, the relative angle between the closed figures 1 and 2 is obtained for the standard pattern and the recognition image, and the angle difference is the rotation angle from the standard pattern to the recognition image. This is illustrated in FIG. In the closed figure 1, the center of gravity 13 (3, 5.47) of the standard pattern has moved to the center of gravity 15 (8.5, 5) of the recognized image. It has moved from (7.55, 5.45) to the center of gravity 16 (3.75, 5.65) of the recognized image. The rotation angle is 359.7 ° between the closed patterns 1-2 in the standard pattern, whereas it is 187.7 ° in the case of the recognition image, and the rotation angle between the standard pattern and the recognition image is The difference is 188.0 °. Here, when the standard pattern is rotated and superimposed on the recognition image, when the counterclockwise direction is plus and the clockwise direction is a minus angle, the standard pattern angle is θx, and the recognition image angle is θy. The angle θz for rotating the pattern is
(1) When θx> θy
θz = 360− (θx−θy)
(2) When θx <θy
θz = θy−θx
It becomes.
[0038]
A certain degree of accuracy can be expected even with the displacement and rotation angle obtained from the comparison of the area and the center of gravity of the standard pattern and the recognition image. And the positioning accuracy can be improved up to sub-pixels (dimensions smaller than one pixel).
[0039]
In addition, using the displacement and the rotation angle obtained from the comparison between the area and the center of gravity of the standard pattern and the recognition image, the displacement of the center of gravity of the closed figure 1 ± 1 to 2 pixels was obtained using the displacement and the rotation angle. Affine transform the standard pattern at the angle closest to the rotation angle, perform pattern matching with the recognized image using the image created in advance as the master image, obtain the respective correlation values, obtain the displacement amount by normalized correlation, and then In the same manner, the amount of displacement is obtained for the closed figure 2 and the rotation angle is calculated again from the obtained amount of displacement between the closed figures 1 and 2, thereby obtaining a more accurate rotation angle.
[0040]
In the case of normal rotation pattern matching, if the search area is an area of ± 5 pixels (the search area is determined by the maximum displacement of the standard pattern), the standard pattern needs to be moved 11 × 11 = 121 times for calculation. There is. If n patterns of rotated images are prepared in consideration of the rotation (the number of times is determined by the error due to the angle range to be obtained and the angle deviation), 121 × n more calculations are required. On the other hand, when the processing method according to the present embodiment is used, the search area can be limited to ± 1 to 2 pixels, so that the number of movements can be suppressed to 9 to 25 times, and the rotation can be performed in advance with the approximate rotation angle. Is known only for one rotated image, so that the number of movements does not increase.
[0041]
Therefore, in a case where the search area is wider or a case where it is required to obtain the rotation accuracy with high accuracy, the processing method according to the present embodiment further increases the effectiveness.
[0042]
According to this embodiment, the following effects can be obtained.
[0043]
(1) In the temporary labeling step, of the image data arranged two-dimensionally as shown in FIG. 2, a temporary label is sequentially assigned to the same kind of continuous pixel group along the pixel arrangement direction, and the pixels are stored in the labeling link memory. Each time a corresponding temporary label or data without a temporary label is stored, when a predetermined pixel is assigned a temporary label, as shown in FIG. 3, the labeling link of an adjacent pixel one pixel before and one line before the image data as shown in FIG. The temporary label of the pixel is determined using the label ring data (temporary label data) of the memory.
[0044]
Therefore, the memory capacity is reduced by processing the temporary label information for each pixel while overwriting the labeling link memory for one line, and the labeling link memory is stored in the cache memory 11 in the processor 10 of FIG. And the number of accesses to the labeling data (temporary label data) stored in the labeling link memory can be reduced, and the speed can also be increased in this regard.
[0045]
(2) Using a labeling table having a function of registering the number of pixels for each of the temporary labels and the information (connection information) of one adjacent label for one temporary label, the pixel arrangement direction of the image data (X coordinate ), A temporary label is sequentially attached to the same kind of continuous pixel group along the direction (the search order is prioritized in the X coordinate direction). Is registered in the labeling table, and after the provisional labeling and the detection of the adjacent label are completed, the connection processing step is performed by adding the number of pixels of the temporary labels adjacent to each other by the labeling table. By adding the number of pixels between adjacent temporary labels in this connection processing, the area that is a continuous band of the same kind of pixels is obtained.
[0046]
As described above, since the information of the adjacent label can be registered on the labeling table, the relabeling becomes unnecessary, and the speed can be improved and the memory capacity can be reduced.
[0047]
(3) The cumulative coordinate values in the line / pixel direction are registered in the labeling table in addition to the number of pixels for each temporary label, and the cumulative coordinate values of adjacent temporary labels are added in the connection processing step, thereby re-labeling. The area and the center of gravity of each connected label can be obtained without processing the data. As described above, by performing the concatenation and the center-of-gravity processing in parallel, the number of memory accesses can be reduced and the speed can be further increased.
[0048]
(4) In the above-described provisional labeling step and the link processing step, the area and the center of gravity of each closed figure of the master image serving as a reference are obtained, and the area and the center of gravity of each closed figure of the image of the DUT to be positioned are similarly calculated. The angle and the displacement can be calculated at high speed by comparing the area and the center of gravity of each closed figure between the obtained master image and the image of the device under test. By calculating the positional relationship and the rotation angle in this way, it is possible to narrow the search area when performing pattern matching.
[0049]
(5) In order to position the device under test using pattern matching together in a narrowed search area based on the angle and displacement of each closed figure in the master image and the image of the device under test, the number of searches is The reduction can increase the image processing speed as a whole. In addition, since the search area is narrowed, a high processing speed can be maintained without using a search with a reduced image, so that harmful detection due to the reduced image or erroneous detection even when a similar image exists in the vicinity may occur. Absent.
[0050]
Although the embodiments of the present invention have been described above, it will be obvious to those skilled in the art that the present invention is not limited to the embodiments and various modifications and changes can be made within the scope of the claims.
[0051]
【The invention's effect】
As described above, according to the image processing method of the present invention, when a temporary label is assigned to a continuous pixel group of the same type in image data arranged two-dimensionally, the same type of continuous pixel of the image data is used. Temporary labels are sequentially assigned to the groups along the pixel array direction, and the corresponding temporary labels or data without temporary labels are stored in the labeling link memory for each pixel. The temporary label of the pixel is determined by using at least one of the temporary label data of one pixel before and the temporary label data of the labeling link memory of the adjacent pixel one line before. By limiting the temporary label data after labeling to a one-line labeling link memory and arranging it in a cache memory, a small memory capacity is required and high-speed labeling processing can be realized.
[0052]
In addition, in the linking process, when an item of the adjacent label, the number of pixels, and the cumulative coordinate value is added to the labeling table and the process of obtaining the area and the center of gravity is performed simultaneously with the process of connecting the adjacent labels, without accessing the labeling data again. High-speed area and center-of-gravity processing is possible by processing within the labeling table.
[0053]
Further, using the processing method for obtaining the area and the center of gravity at a high speed, the displacement amount and the rotation angle between the reference master image and the image of the device under test are calculated, and the search area for pattern matching is calculated based on the data. By narrowing and processing with a fixed rotation angle, a method of processing image data for performing high-speed and high-accuracy positioning can be realized.
[Brief description of the drawings]
FIG. 1 is a block diagram illustrating an apparatus configuration used in an embodiment of an image processing method according to the present invention.
FIG. 2 is an explanatory diagram showing an example of a two-dimensional shape array of binary image data.
FIG. 3 is a schematic diagram of a process of temporarily labeling image data according to the embodiment;
FIG. 4 is an explanatory diagram illustrating a two-dimensional shape array in which an example of the binary image data in FIG. 2 is provisionally labeled.
FIG. 5 is a flowchart of a temporary labeling step (temporary labeling process) in the embodiment.
FIG. 6 is a detailed flowchart of a labeling table process in the flowchart of FIG. 5;
FIG. 7 is a flowchart of a linking step of adjacent labels according to the embodiment;
FIG. 8 is an explanatory diagram illustrating an example of a labeling table according to the embodiment;
FIG. 9 is an explanatory diagram showing the calculation results of the area and the center of gravity obtained by the connection processing using the labeling table of FIG. 8;
FIG. 10 is an explanatory diagram showing a two-dimensional shape array after final labeling processing (after connection processing) of the example of the binary image data of FIG. 2;
11 is an explanatory diagram showing an example of a two-dimensional shape array of binary image data obtained by moving the binary image data of FIG. 2;
FIG. 12 is an explanatory diagram illustrating an example of a labeling table in the case of the binary image data in FIG. 11;
FIG. 13 is an explanatory diagram showing the results of the area and the center of gravity obtained from the labeling table of FIG. 12;
FIG. 14 is an explanatory diagram showing a two-dimensional shape array obtained by temporarily labeling the example of the binary image data shown in FIG. 11;
FIG. 15 is an explanatory diagram showing an example of a movement amount and a rotation angle calculation result in a comparison between the binary image data of FIGS. 2 and 11;
[Explanation of symbols]
1 camera
2 Image signal
3 A / D converter
4 Binarization circuit
5 Multi-valued data
6 Binary data
7 FIFO memory
8 Image processing device
9 Image data signal
10 processor
11 Cache memory
12 Working memory
13 Coordinates of barycenter of closed figure 1 of standard pattern
14 Coordinates of barycenter of closed figure 2 of standard pattern
15 Coordinates of center of gravity of closed figure 1 of recognition figure
16 Coordinates of barycenter of closed figure 2 of recognition figure

Claims (7)

2次元状に配列された画像データのうち、同種の連続画素群に仮ラベルを付すステップと、異なる仮ラベルが付された連続画素群同士が隣接している場合に同一ラベルとして連結する連結処理ステップとを有する画像処理方法であって、
前記仮ラベルを付すステップでは前記画像データの同種の連続画素群に画素配列方向に沿って仮ラベルを順次付してラベリングリンクメモリに画素毎に対応する仮ラベル又はラベル無しのデータを格納するが、所定画素に仮ラベルを付す際に、前記画像データの1画素前の仮ラベルデータ及び1ライン前の隣接画素の前記ラベリングリンクメモリの仮ラベルデータの少なくともいずれかを用いて当該画素の仮ラベルを決定することを特徴とする画像処理方法。
A step of assigning a temporary label to a group of continuous pixels of the same type in the image data arranged in a two-dimensional manner, and a linking process of linking as a same label when a group of continuous pixels with different temporary labels is adjacent to each other And an image processing method comprising:
In the step of attaching the temporary label, temporary labels are sequentially attached to the same kind of continuous pixel group of the image data along the pixel array direction, and the corresponding temporary label or data without a label is stored in the labeling link memory. When assigning a temporary label to a predetermined pixel, the temporary label of the pixel is determined by using at least one of the temporary label data of one pixel before the image data and the temporary label data of the labeling link memory of an adjacent pixel one line before. An image processing method characterized in that:
所定画素の仮ラベルの決定は、所定の検索順序で隣接画素の仮ラベルを検索し、最初に検出した仮ラベルを選択することにより行う請求項1記載の画像処理方法。2. The image processing method according to claim 1, wherein the determination of the temporary label of the predetermined pixel is performed by searching for a temporary label of an adjacent pixel in a predetermined search order and selecting a temporary label detected first. 前記仮ラベル毎の画素数及び1個の仮ラベルに対し1個の隣接ラベルの情報を登録する機能を有するラベリングテーブルを用い、隣接ラベルの検出においては仮ラベル付け時と異なる検索順序で最初に検出した隣接ラベルを前記ラベリングテーブルに登録し、仮ラベル付け及び隣接ラベル検出終了後に、前記ラベリングテーブルにより隣接する仮ラベル同士の画素数を加算することで連結処理ステップを行なう請求項2記載の画像処理方法。A labeling table having a function of registering the number of pixels for each temporary label and the information of one adjacent label for one temporary label is used. 3. The image according to claim 2, wherein the detected adjacent label is registered in the labeling table, and after the provisional labeling and the detection of the adjacent label are completed, the connection processing step is performed by adding the number of pixels of the adjacent temporary labels by the labeling table. Processing method. 前記ラベリングテーブルに仮ラベル毎の画素数の他にライン/画素方向の累積座標値を登録し、前記連結処理ステップにて隣接する仮ラベル同士の累積座標値を加算することにより、連結後のラベルの面積及び重心を求める請求項3記載の画像処理方法。By registering the cumulative coordinate values in the line / pixel direction in addition to the number of pixels for each temporary label in the labeling table, and adding the cumulative coordinate values of adjacent temporary labels in the connection processing step, the label after connection is obtained. 4. The image processing method according to claim 3, wherein an area and a center of gravity of the image are obtained. 前記請求項4の画像処理方法で、基準となるマスタ画像の各閉図形の面積及び重心を求めるとともに位置決めする被測定物の画像の各閉図形の面積及び重心を求め、求められた前記マスタ画像と被測定物の画像との各閉図形の面積及び重心の比較より角度と位置ずれ量を算出することを特徴とする画像処理方法。5. The image processing method according to claim 4, wherein an area and a center of gravity of each closed figure of a master image serving as a reference are obtained, and an area and a center of gravity of each closed figure of an image of an object to be positioned are obtained. An image processing method comprising calculating an angle and an amount of displacement from a comparison between the area and the center of gravity of each closed figure between the image and the image of the device under test. 前記角度と位置ずれ量をもとに狭められたサーチ領域でパターンマッチングを併用して前記被測定物を位置決めする請求項5記載の画像処理方法。6. The image processing method according to claim 5, wherein the object to be measured is positioned by using pattern matching together in a search area narrowed based on the angle and the displacement amount. 前記ラベリングリンクメモリをキャッシュメモリ内に配置した請求項1,2,3,4,5又は6記載の画像処理方法。7. The image processing method according to claim 1, wherein said labeling link memory is arranged in a cache memory.
JP2002196206A 2002-07-04 2002-07-04 Image processing method Pending JP2004038669A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002196206A JP2004038669A (en) 2002-07-04 2002-07-04 Image processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002196206A JP2004038669A (en) 2002-07-04 2002-07-04 Image processing method

Publications (1)

Publication Number Publication Date
JP2004038669A true JP2004038669A (en) 2004-02-05

Family

ID=31704366

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002196206A Pending JP2004038669A (en) 2002-07-04 2002-07-04 Image processing method

Country Status (1)

Country Link
JP (1) JP2004038669A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080007626A1 (en) * 2006-07-07 2008-01-10 Sony Ericsson Mobile Communications Ab Active autofocus window
US7912286B2 (en) 2005-05-10 2011-03-22 Ricoh Company, Ltd. Image processing apparatus and method of image processing capable of effective labeling

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7912286B2 (en) 2005-05-10 2011-03-22 Ricoh Company, Ltd. Image processing apparatus and method of image processing capable of effective labeling
US20080007626A1 (en) * 2006-07-07 2008-01-10 Sony Ericsson Mobile Communications Ab Active autofocus window
US8213734B2 (en) * 2006-07-07 2012-07-03 Sony Ericsson Mobile Communications Ab Active autofocus window

Similar Documents

Publication Publication Date Title
US7543753B2 (en) Reconstruction of virtual raster
JP2952170B2 (en) Information reproduction system
JP5739522B2 (en) System and method for processing image data relating to the focus of attention within a whole image
JP2001109895A (en) Processing method for digital images
US6654495B1 (en) Method and apparatus for removing ruled lines
CN111210478A (en) Method, medium and system for calibrating external parameters of common-view-free multi-camera system
JP3591184B2 (en) Barcode reader
US5255354A (en) Comparison of image shapes based on near neighbor data
JP2004038669A (en) Image processing method
JP2810660B2 (en) Particle image analyzer
CN108876701B (en) Run-length-based single-scanning connected domain marking method and hardware structure thereof
JP3325120B2 (en) Component recognition method and device
JP3575512B2 (en) Pattern inspection method and apparatus
JPH0130180B2 (en)
JPH11144054A (en) Method and device for image recognition and recording medium
JP3039704B2 (en) Printing evaluation method and printing evaluation device
JP3016687B2 (en) Image processing device
JP2000030016A (en) Information recording medium and information reproducing system
KR100295245B1 (en) A parallel thinning method using weighted value
JP2001317919A (en) Method and apparatus for measuring circuit pattern line width
JP2002197410A (en) Information reproducing system
JP3119376B2 (en) Printing evaluation method and printing evaluation device
JP2620094B2 (en) How to measure figure patterns
JPS60156175A (en) Method and apparatus of picture analysis
JP2798013B2 (en) Two-dimensional code reading method and apparatus

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050425

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20071214

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20071219

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20080423