JP3223385B2 - Pattern matching device for grayscale images - Google Patents

Pattern matching device for grayscale images

Info

Publication number
JP3223385B2
JP3223385B2 JP18863992A JP18863992A JP3223385B2 JP 3223385 B2 JP3223385 B2 JP 3223385B2 JP 18863992 A JP18863992 A JP 18863992A JP 18863992 A JP18863992 A JP 18863992A JP 3223385 B2 JP3223385 B2 JP 3223385B2
Authority
JP
Japan
Prior art keywords
image
pixel
pattern matching
model
density 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.)
Expired - Fee Related
Application number
JP18863992A
Other languages
Japanese (ja)
Other versions
JPH064670A (en
Inventor
雅弘 河内
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Omron Corp
Original Assignee
Omron 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 Omron Corp filed Critical Omron Corp
Priority to JP18863992A priority Critical patent/JP3223385B2/en
Publication of JPH064670A publication Critical patent/JPH064670A/en
Application granted granted Critical
Publication of JP3223385B2 publication Critical patent/JP3223385B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【産業上の利用分野】この発明は、対象物を撮像して得
られた濃淡画像について、対象物のモデル画像を用い
て、パターンマッチングを行うための濃淡画像のパター
ンマッチング装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a gray-scale image pattern matching apparatus for performing pattern matching on a gray-scale image obtained by imaging an object using a model image of the object.

【0002】[0002]

【従来の技術】従来、対象物を撮像して得られた濃淡画
像からパターンマッチングの手法を用いて対象物の位置
などを求めることが行われている。図8は、正規化相関
濃淡マッチング法を説明するための図であって、同図
中、1は予め用意された矩形状のモデル画像、2は入力
された濃淡画像(以下、「入力画像」という)である。
このモデル画像1により入力画像が1画素ずつ全画面に
わたり走査され、走査位置Pj 毎にモデル画像1と入力
画像2との一致度合を相関演算により求め、相関値が最
大となるモデル画像1の走査位置Pj から対象物の位置
などが求められる。
2. Description of the Related Art Conventionally, the position of an object is determined from a grayscale image obtained by imaging the object by using a pattern matching technique. FIG. 8 is a diagram for explaining the normalized correlation density matching method, in which 1 is a rectangular model image prepared in advance, 2 is an input density image (hereinafter referred to as “input image”). It is).
The input image is scanned one pixel at a time over the entire screen by the model image 1, and the degree of coincidence between the model image 1 and the input image 2 is obtained by a correlation operation at each scanning position Pj, and the model image 1 having the maximum correlation value is obtained. From the scanning position Pj , the position of the object is obtained.

【0003】いまモデル画像1が入力画像2上のj番目
の走査位置Pj (Xj ,Yj )にあるとき、モデル画像
1におけるi番目の画素の濃度データをMi 、入力画像
2の対応する画素の濃度データをIi 、モデル画像1の
構成画素数をnとすると、走査位置Pj における相関値
2 (Xj ,Yj )はつぎの(1) 式で与えられる。
When the model image 1 is at the j-th scanning position P j (X j , Y j ) on the input image 2, the density data of the i-th pixel in the model image 1 is M i , Assuming that the density data of the corresponding pixel is I i and the number of constituent pixels of the model image 1 is n, the correlation value r 2 (X j , Y j ) at the scanning position P j is given by the following equation (1).

【0004】[0004]

【数1】 (Equation 1)

【0005】[0005]

【発明が解決しようとする課題】(1) 式から明らかなよ
うに、従来は、モデル画像1の全ての構成画素の濃度デ
ータMi について、入力画像2の対応する画素の濃度デ
ータIi との間で相関演算を行っているが、モデル画像
1の全ての構成画素がパターンマッチングの対象となっ
ているため、相関演算の計算量が膨大となり、処理時間
が長くかかるという問題があった。
As apparent from equation (1), conventionally, the density data M i of all the constituent pixels of the model image 1 are compared with the density data I i of the corresponding pixels of the input image 2. However, since all the constituent pixels of the model image 1 are subjected to pattern matching, the amount of calculation of the correlation operation becomes enormous and the processing time is long.

【0006】そこで発明者は、先般、対象物のモデル画
像1を用いて、入力画像2のパターンマッチングを行う
のに、モデル画像1のエッジ位置近傍の画素を選択し、
そのエッジ位置近傍の各画素についてのみ対象物のモデ
ル画像1と入力画像2との相関値を演算する方式を開発
した。
Therefore, the inventor recently selects pixels near the edge position of the model image 1 to perform pattern matching of the input image 2 using the model image 1 of the object.
A method for calculating a correlation value between the model image 1 of the target object and the input image 2 only for each pixel near the edge position has been developed.

【0007】図9および図10は、この方式を具体的に
実施する場合の原理説明図である。図9(1)は、対象
物のモデル(この場合、文字「A」)を撮像して得られ
たモデル画像1を示したもので、同図中、3が文字Aの
白っぽい画像部分、4が背景の黒っぽい画像部分であ
る。
FIG. 9 and FIG. 10 are explanatory diagrams of the principle when this method is concretely implemented. FIG. 9A shows a model image 1 obtained by imaging a model of a target object (in this case, the character “A”). In FIG. 9, reference numeral 3 denotes a whitish image portion of the character A; Is a dark image portion of the background.

【0008】このモデル画像1のある水平ライン6に沿
う各画素の濃度データ(0〜255階調)を図で表す
と、図10(1)に示すとおりである。また各画素の濃
度データを微分した値は図10(2)に示すとおりであ
り、さらにその2次微分値は図10(3)に示すとおり
である。また、この2次微分値の絶対値は図10(4)
に示すような形となる。
FIG. 10A shows the density data (0 to 255 gradations) of each pixel along a certain horizontal line 6 of the model image 1 as shown in FIG. The value obtained by differentiating the density data of each pixel is as shown in FIG. 10 (2), and the secondary differential value is as shown in FIG. 10 (3). The absolute value of the second derivative is calculated as shown in FIG.
The shape is as shown in

【0009】各画素の2次微分値の絶対値は所定の正の
しきい値THと比較し、このしきい値THより大きな値
をとる画素をパターンマッチングの対象画素として選択
する。
The absolute value of the second derivative of each pixel is compared with a predetermined positive threshold value TH, and a pixel having a value larger than the threshold value TH is selected as a target pixel for pattern matching.

【0010】図10(5)は前記しきい値THにより2
値化された2値化データ、すなわちパターンマッチング
の対象画素の範囲を示しており、前記2値化データによ
りモデル画像1の濃度データをサンプリングすると、図
10(6)のようなサンプリングデータが得られる。
FIG. 10 (5) shows that the threshold value TH is 2
The binarized data, that is, the range of target pixels for pattern matching, is shown. When the density data of the model image 1 is sampled by the binarized data, sampling data as shown in FIG. Can be

【0011】図9(2)はこのようにしてサンプリング
された濃度データより成る濃淡画像5を示しており、サ
ンプリングされた濃度データには文字Aの画像部分3に
ついての濃度データ、すなわちエッジの内側近傍の画素
列3aの濃度データと、背景の画像部分4についての濃
度データ、すなわちエッジの外側近傍の画素列4aの濃
度データとが同程度に含まれる。
FIG. 9 (2) shows a gray-scale image 5 composed of the density data sampled in this manner. The sampled density data includes the density data of the image portion 3 of the character A, that is, the inside of the edge. The density data of the neighboring pixel row 3a and the density data of the background image portion 4, that is, the density data of the pixel row 4a near the outside of the edge are included to the same extent.

【0012】前記モデル画像1により入力画像2を1画
素ずつ全画面にわたり走査し、走査位置毎に前記2値化
データによりサンプリングされたモデル画像1の濃度デ
ータと入力画像の濃度データとの間で相関演算を行い、
その相関値が最大となるモデル画像1の走査位置から対
象物の位置が求められる。
The input image 2 is scanned one pixel at a time over the entire screen by the model image 1, and the density data of the model image 1 sampled by the binary data and the density data of the input image are scanned at each scanning position. Perform a correlation operation,
The position of the object is obtained from the scanning position of the model image 1 at which the correlation value becomes maximum.

【0013】ところがこの方式によれば、適正な姿勢の
対象物を撮像した場合は問題はないが、対象物の姿勢が
傾いて入力画像2が図8の破線aで示すように、いずれ
か方向にわずかに回転していると、正しいパターンマッ
チングを行えず、位置計測が困難な場合が生ずる。
However, according to this method, there is no problem when an object having a proper posture is imaged, but the posture of the object is inclined and the input image 2 is moved in any direction as shown by a broken line a in FIG. If it is slightly rotated, correct pattern matching cannot be performed, and position measurement may be difficult.

【0014】この発明は、上記問題に着目してなされた
もので、パターンマッチングの対象画素を効率的に削減
することにより、相関演算の計算量を減少して処理時間
を短縮させ、しかも入力画像が回転していても正しいパ
ターンマッチングが行える濃淡画像のパターンマッチン
グ装置を提供することを目的とする。
SUMMARY OF THE INVENTION The present invention has been made in view of the above-mentioned problem. By efficiently reducing the number of pixels to be subjected to pattern matching, the amount of correlation calculation can be reduced to shorten the processing time. It is an object of the present invention to provide a gray-scale image pattern matching apparatus that can perform correct pattern matching even when the image is rotated.

【0015】[0015]

【課題を解決するための手段】この発明は、対象物のモ
デル画像を用いて、入力された濃淡画像のパターンマッ
チングを行う装置において、前記モデル画像を膨張処理
して膨張画像を生成する膨張画像生成手段と、前記モデ
ル画像を収縮処理して収縮画像を生成する収縮画像生成
手段と、前記膨張画像および収縮画像のエッジ位置近傍
の画素を選択する画素選択手段と、前記画素選択手段に
より選択されたエッジ位置近傍の画素について対象物の
モデル画像と入力された濃淡画像との相関値を演算する
演算手段とを備えたものである。
According to the present invention, there is provided an apparatus for performing pattern matching of an input gray-scale image using a model image of an object, wherein the expanded image is generated by expanding the model image to generate an expanded image. A generation unit, a contraction image generation unit that contracts the model image to generate a contraction image, a pixel selection unit that selects a pixel near an edge position of the dilation image and the contraction image, and a pixel selection unit. Calculating means for calculating a correlation value between the model image of the object and the inputted grayscale image for the pixels near the edge position.

【0016】請求項2の発明は、請求項1に記載された
濃淡画像のパターンマッチング装置であって、前記画素
選択手段は、前記膨張画像の各構成画素の濃度データを
2次微分して得られた値が第1のしきい値を越える画素
を選択する第1の画素選択手段と、前記収縮画像の各構
成画素の濃度データを2次微分して得られた値が第2の
しきい値を越える画素を選択する第2の画素選択手段と
を備えたものである。
According to a second aspect of the present invention, there is provided the pattern matching apparatus for a grayscale image according to the first aspect, wherein the pixel selecting means obtains the density data of each of the constituent pixels of the expanded image by performing second-order differentiation. First pixel selecting means for selecting a pixel whose value exceeds a first threshold value; and a second threshold value obtained by secondarily differentiating the density data of each constituent pixel of the contracted image. Second pixel selecting means for selecting a pixel exceeding the value.

【0017】[0017]

【作用】モデル画像の膨張画像および収縮画像の各エッ
ジ位置近傍の画素について、モデル画像と入力された濃
淡画像との相関値を演算するので、入力された濃淡画像
がいずれか方向に回転していても、正しいパターンマッ
チングが行われ、位置計測が可能である。また相関演算
の対象を膨張画像および収縮画素の各エッジ位置近傍の
画素に限定するので、パターンマッチングの対象画素が
効率的に削減され、相関演算の計算量が減少し、処理時
間が短縮される。
Since the correlation value between the model image and the input grayscale image is calculated for pixels near each edge position of the dilated image and the contracted image of the model image, the input grayscale image is rotated in either direction. However, correct pattern matching is performed, and position measurement is possible. Further, since the target of the correlation calculation is limited to pixels near each edge position of the dilated image and the contracted pixel, the number of target pixels for pattern matching is efficiently reduced, the calculation amount of the correlation calculation is reduced, and the processing time is shortened. .

【0018】請求項2のパターンマッチング装置では、
膨張画像の各構成画素の濃度データを2次微分して得ら
れた値が第1のしきい値を越える画素と、収縮画像の各
構成画素の濃度データを2次微分して得られた値が第2
のしきい値を越える画素とを選択するので、モデル画像
のエッジを挟んで両側近傍の画素が確実に抽出される。
In the pattern matching device of the second aspect,
A pixel whose value obtained by secondarily differentiating the density data of each constituent pixel of the dilated image exceeds a first threshold value, and a value obtained by secondarily differentiating the density data of each constituent pixel of the contracted image Is the second
Is selected, pixels near both sides of the edge of the model image are reliably extracted.

【0019】[0019]

【実施例】図1〜図3は、この発明にかかる濃淡画像の
パターンマッチング装置の原理を説明するための原理説
明図である。図1(1)は、対象物のモデル(この場
合、文字「A」)を撮像して得られたモデル画像1であ
り、3が文字Aの画像部分、4が背景の画像部分であ
る。この例では、文字Aの画像部分3は白く、背景の画
像部分4は黒いが、これに限らず、入力画像2に応じ
て、白黒反転したモデル画像を用いることもできる。
1 to 3 are explanatory diagrams for explaining the principle of a pattern matching apparatus for a gray-scale image according to the present invention. FIG. 1A is a model image 1 obtained by capturing an image of a model of a target object (in this case, the character “A”), where 3 is an image portion of the character A and 4 is an image portion of the background. In this example, the image portion 3 of the character A is white and the image portion 4 of the background is black. However, the present invention is not limited to this, and a black-and-white inverted model image can be used according to the input image 2.

【0020】図1(2)は、前記モデル画像1を膨張処
理することにより生成された膨張画像7を示し、図1
(2)′は前記モデル画像1を収縮処理することにより
生成された収縮画像8を示す。なお図2(2)(2)′
において、破線bは膨張または収縮処理前のモデル画像
1のエッジである。また膨張、収縮の各処理は、入力画
像の回転度合に応じて複数回行う。
FIG. 1B shows an expanded image 7 generated by expanding the model image 1.
(2) 'shows a contracted image 8 generated by subjecting the model image 1 to contraction processing. 2 (2) (2) '
In FIG. 7, a broken line b is an edge of the model image 1 before the expansion or contraction processing. Each processing of expansion and contraction is performed a plurality of times according to the degree of rotation of the input image.

【0021】前記膨張画像7のある水平ライン9に沿う
各画素の濃度データ(0〜255階調)を図で表したの
が図2(1)である。また前記収縮画像7の同じ水平ラ
イン9に沿う各画素の濃度データ(0〜255階調)を
図で表したので図3(1)である。
FIG. 2A shows the density data (0 to 255 gradations) of each pixel along a certain horizontal line 9 of the expanded image 7. FIG. 3A shows the density data (0 to 255 gradations) of each pixel along the same horizontal line 9 of the contracted image 7.

【0022】前記膨張画像7および収縮画像8は、モデ
ル画像1を所定の演算子を用いて画像処理することによ
り生成され、図4にその生成方法が具体的に示してあ
る。図4において、30はモデル画像1を矢印方向へ走
査するための縦3画素×横3画素の矩形状のマスクであ
って、このマスク30の中心に位置するモデル画像1の
画素が着目画素31である。
The dilated image 7 and the contracted image 8 are generated by subjecting the model image 1 to image processing using a predetermined operator. FIG. In FIG. 4, reference numeral 30 denotes a rectangular mask of 3 × 3 pixels for scanning the model image 1 in the direction of the arrow, and the pixel of the model image 1 located at the center of the mask 30 is a target pixel 31. It is.

【0023】膨張画像7は、モデル画像1のマスク走査
において、モデル画像31の着目画素31の濃度データ
を、マスク30内の9画素のうち、最も明るい画素の濃
度データに順次置き換えてゆくことにより生成される。
また収縮画像7は、モデル画像1のマスク走査におい
て、モデル画像31の着目画素31の濃度データを、マ
スク30内の9画素のうち、最も暗い画素の濃度データ
に順次置き換えてゆくことにより生成される。
The expanded image 7 is obtained by sequentially replacing the density data of the target pixel 31 of the model image 31 with the density data of the brightest pixel among the nine pixels in the mask 30 in the mask scanning of the model image 1. Generated.
The contracted image 7 is generated by sequentially replacing the density data of the target pixel 31 of the model image 31 with the density data of the darkest pixel among the nine pixels in the mask 30 in the mask scanning of the model image 1. You.

【0024】前記膨張画像7の各画素の濃度データを微
分した値は図2(2)に示すとおりであり、さらにその
2次微分値は図2(3)に示すとおりである。また前記
収縮画像8の各画素の濃度データを微分した値は図3
(2)に示すとおりであり、さらにその2次微分値は図
3(3)に示すとおりである。
The value obtained by differentiating the density data of each pixel of the expanded image 7 is as shown in FIG. 2 (2), and the secondary differential value is as shown in FIG. 2 (3). The value obtained by differentiating the density data of each pixel of the contracted image 8 is shown in FIG.
This is as shown in (2), and its secondary differential value is as shown in FIG. 3 (3).

【0025】前記膨張画像7についての各画素の2次微
分値は、正の第1のしきい値TH1と比較され、この第
1のしきい値TH1より大きな値をとる画素が選択され
る。図2(4)には前記第1のしきい値TH1により2
値化された2値化データが示してある。
The second derivative of each pixel of the expanded image 7 is compared with a first positive threshold TH1, and a pixel having a value larger than the first threshold TH1 is selected. FIG. 2 (4) shows that the first threshold value TH1
The binarized data that has been digitized is shown.

【0026】前記収縮画像8についての各画素の2次微
分値は、負の第2のしきい値TH2と比較され、この第
2のしきい値TH2より小さな値をとる画素が選択され
る。図3(4)には前記第2のしきい値TH2により2
値化された2値化データが示してある。
The second derivative of each pixel of the contracted image 8 is compared with a negative second threshold value TH2, and a pixel having a value smaller than the second threshold value TH2 is selected. FIG. 3D shows that the second threshold value TH2
The binarized data that has been digitized is shown.

【0027】図2(4)に示す前記2値化データにより
モデル画像1の濃度データをサンプリングすると、図1
(3)に示すような濃淡画像32が得られる。この濃淡
画像32において、34はサンプリングされた濃度デー
タにより生成される画像部分であって、この画像部分3
4は膨張画像7のエッジ位置の近傍外側に位置する。
When the density data of the model image 1 is sampled by the binarized data shown in FIG.
A gray image 32 as shown in (3) is obtained. In the grayscale image 32, reference numeral 34 denotes an image portion generated based on the sampled density data.
4 is located outside the vicinity of the edge position of the dilated image 7.

【0028】また図3(4)に示す前記2値化データに
よりモデル画像1の濃度データをサンプリングすると、
図1(3)′に示すような濃淡画像33が得られる。こ
の濃淡画像33において、35はサンプリングされた濃
度データにより生成される画像部分であって、この画像
部分35は収縮画像8のエッジ位置の近傍内側に位置す
る。
When the density data of the model image 1 is sampled by the binarized data shown in FIG.
A gray image 33 as shown in FIG. 1 (3) 'is obtained. In the gray-scale image 33, reference numeral 35 denotes an image portion generated based on the sampled density data, and the image portion 35 is located inside the vicinity of the edge position of the contracted image 8.

【0029】図1(3)の画像部分34はモデル画像1
におけるエッジの外側近傍の背景の画像部分4に相当
し、また図1(3)′の画像部分35はモデル画像1に
おけるエッジの内側近傍の文字Aの画像部分3に相当し
ており、これら画像部分34,35が合成された図1
(4)に示す濃淡画像36では、モデル画像1の背景の
画像部分4についての濃度データと文字Aの画像部分3
についての濃度データとが同程度に含まれる。なお図1
(4)において、破線bはモデル画像1のエッジであ
り、各画像部分34,35はこのエッジbの近傍ではあ
るが、入力画像の回転を許容する分だけ相互に離れて位
置している。
The image portion 34 in FIG.
1 (3) 'corresponds to the image portion 3 of the character A near the inside of the edge in the model image 1, and these images FIG. 1 with parts 34 and 35 synthesized
In the grayscale image 36 shown in (4), the density data of the background image portion 4 of the model image 1 and the image portion 3 of the character A
And the same concentration data as the concentration data. FIG. 1
In (4), the dashed line b is the edge of the model image 1, and the image portions 34 and 35 are located near the edge b but are separated from each other by an amount that allows the rotation of the input image.

【0030】前記モデル画像1を1画素ずつ移行させて
入力画像を全画面にわたり走査し、走査位置毎に前記2
値化データによりサンプリングされたモデル画像1の濃
度データと入力画像2の濃度データとの間で相関演算を
行い、その相関値が最大となるモデル画像1の走査位置
から対象物の位置が求められる。この場合に、入力画像
2が図8の破線aのようにわずかに回転していても、モ
デル画像1の膨張画像7と収縮画像8とのエッジ近傍か
ら相関演算の対象画素を選択しているので、モデル画像
1および入力画像2のいずれについても対象物の画像部
分と背景の画像部分とから濃度データがサンプリングさ
れて、正しいパターンマッチングが行われることにな
る。
The model image 1 is shifted one pixel at a time and the input image is scanned over the entire screen.
A correlation operation is performed between the density data of the model image 1 sampled by the digitized data and the density data of the input image 2, and the position of the object is obtained from the scanning position of the model image 1 at which the correlation value is maximum. . In this case, even if the input image 2 is slightly rotated as shown by the broken line a in FIG. 8, the target pixel of the correlation operation is selected from near the edges of the dilated image 7 and the eroded image 8 of the model image 1. Therefore, for both the model image 1 and the input image 2, the density data is sampled from the image portion of the object and the image portion of the background, and correct pattern matching is performed.

【0031】図5は、上記の原理に基づくパターンマッ
チング装置の回路構成例を示す。図示例の装置は、カメ
ラ10と濃淡画像処理部11とモニタ12とで構成され
ており、濃淡画像処理部11はA/D変換器13,膨張
・収縮処理部25,微分計測部14,LUT15,画像
メモリ16,17,2値メモリ18,表示制御部19,
D/A変換器20,制御部21などを含む。
FIG. 5 shows an example of a circuit configuration of a pattern matching apparatus based on the above principle. The apparatus in the illustrated example includes a camera 10, a gray image processing unit 11, and a monitor 12. The gray image processing unit 11 includes an A / D converter 13, an expansion / contraction processing unit 25, a differential measurement unit 14, and an LUT 15. , Image memories 16, 17, binary memory 18, display control unit 19,
It includes a D / A converter 20, a control unit 21, and the like.

【0032】前記A/D変換器13はカメラ10より濃
淡画像のアナログ信号を入力してディジタル信号に変換
する。このディジタル信号を構成する各画素の濃度デー
タは例えば256階調のいずれか値をとる。対象物のモ
デルを撮像して得られた濃淡画像(モデル画像1)は、
A/D変換器13を経て膨張・収縮処理部25に入力さ
れると共に、一方の画像メモリ16に格納される。また
計測対象物を撮像して得られた入力画像2は、A/D変
換器13を経て他方の画像メモリ17に格納される。各
画像メモリ16,17は濃度データを画素単位で記憶す
る。
The A / D converter 13 receives an analog signal of a grayscale image from the camera 10 and converts it into a digital signal. The density data of each pixel constituting this digital signal takes, for example, any value of 256 gradations. The grayscale image (model image 1) obtained by imaging the model of the object is
The data is input to the expansion / contraction processing unit 25 via the A / D converter 13 and stored in one image memory 16. The input image 2 obtained by imaging the measurement object is stored in the other image memory 17 via the A / D converter 13. Each of the image memories 16 and 17 stores density data in pixel units.

【0033】前記膨張・収縮処理部25は、モデル画像
1を1ないし複数回膨張処理して膨張画像7を生成する
と共に、モデル画像1を1ないし複数回収縮処理して収
縮画像8を生成する。前記微分計測部14は、膨張画像
7と収縮画像8とにつき、各画素の濃度データをそれぞ
れ2次微分して2値微分値を得る。
The expansion / contraction processing unit 25 generates an expansion image 7 by expanding the model image 1 one or more times, and generates an expansion image 8 by contracting the model image 1 one or more times. . The differential measuring unit 14 obtains a binary differential value by secondarily differentiating the density data of each pixel with respect to the expanded image 7 and the contracted image 8.

【0034】前記LUT15は、微分計測部14より与
えられる膨張画像7の各画素の2次微分値を前記した第
1のしきい値TH1で2値化し、また収縮画像8の各画
素の2次微分値を前記した第2のしきい値TH2で2値
化するためのものである。このLUT15に2次微分値
に相応したアドレス信号が与えられると、対応するアド
レス領域より2値化データが出力される。膨張画像7に
ついての2値化データと収縮画像8についての2値化デ
ータとは組み合わされて2値メモリ18に画素単位で格
納される。
The LUT 15 binarizes the secondary differential value of each pixel of the dilated image 7 given by the differential measuring section 14 with the above-mentioned first threshold value TH1, and converts the secondary differential value of each pixel of the dilated image 8 This is for binarizing the differential value with the above-mentioned second threshold value TH2. When an address signal corresponding to the secondary differential value is given to the LUT 15, binary data is output from the corresponding address area. The binarized data for the dilated image 7 and the binarized data for the contracted image 8 are combined and stored in the binary memory 18 in pixel units.

【0035】前記表示制御部19はモニタ12の画像表
示動作を制御するためのもので、モデルや計測対象物に
ついての濃淡画像信号や2値化データを入力してそのい
ずれかをD/A変換器20へ出力する。D/A変換器2
0は入力信号をアナログ信号に変換してモニタ12へ出
力する。
The display control section 19 is for controlling the image display operation of the monitor 12, and inputs a grayscale image signal or binary data of a model or an object to be measured, and performs D / A conversion on one of them. Output to the container 20. D / A converter 2
0 converts the input signal into an analog signal and outputs it to the monitor 12.

【0036】前記制御部21は、制御・演算の主体であ
るCPU22と、プログラムが格納されるROM23
と、各種データを記憶させるRAM24とを含む。前記
CPU22はプログラムに従い装置全体の動作を制御
し、画像メモリ16,17,2値メモリ18,RAM2
4に対するデータの読み書きを行いつつ、パターンマッ
チングに関わる各種演算や処理を実行する。
The control section 21 includes a CPU 22 which is a main body of control and calculation, and a ROM 23 in which programs are stored.
And a RAM 24 for storing various data. The CPU 22 controls the operation of the entire apparatus according to a program, and stores image memories 16, 17, a binary memory 18, a RAM 2
4 while performing various calculations and processes relating to pattern matching while reading and writing data.

【0037】図6は、パターンマッチングの対象画素を
選択するための処理の流れをステップ1〜ステップ6
(図中、各ステップは「ST」で示す)で示す。
FIG. 6 shows the flow of processing for selecting a target pixel for pattern matching in steps 1 to 6.
(In the figure, each step is indicated by “ST”).

【0038】同図のステップ1で、CPU22はLUT
15の各アドレス領域に膨張画像7および収縮画像8に
ついての2値化処理を行うための2値データを設定す
る。ステップ2でカメラ10により対象物のモデルが撮
像されると、そのモデル画像1は濃淡画像処理部11に
取り込まれて画像メモリ16に格納されると共に、膨張
・収縮処理部25によりモデル画像1の膨張画像7と収
縮画像8とが生成される(ステップ3)。
In step 1 of FIG.
In each of the 15 address areas, binary data for performing the binarization processing on the expanded image 7 and the contracted image 8 is set. When the model of the object is imaged by the camera 10 in step 2, the model image 1 is captured by the grayscale image processing unit 11 and stored in the image memory 16, and the model image 1 is An expansion image 7 and a contraction image 8 are generated (Step 3).

【0039】つぎのステップ4で微分計測部14は膨張
画像7と収縮画像8とを2次微分処理してそれぞれの2
次微分値を算出する。膨張画像7および収縮画像8につ
いての各画素の2次微分値に相応するアドレス信号がL
UT15に与えられると、LUT15は該当するアドレ
ス領域より2値化データを出力する(ステップ5)。膨
張画像7についての2値化データと収縮画像8について
の2値化データとは組み合わされて2値メモリ18に画
素単位で格納される(ステップ6)。
In the next step 4, the differential measuring section 14 subjects the dilated image 7 and the eroded image 8 to second-order differential processing, and
Calculate the next differential value. An address signal corresponding to the second derivative of each pixel of the expanded image 7 and the contracted image 8 is L
When given to the UT 15, the LUT 15 outputs binary data from the corresponding address area (step 5). The binarized data for the dilated image 7 and the binarized data for the contracted image 8 are combined and stored in the binary memory 18 in pixel units (step 6).

【0040】図7は、前記CPU22によるパターンマ
ッチングの制御手順をステップ1〜ステップ17で示
す。同図のステップ1でCPU22はRAM24のワー
クエリアの内容をクリアして初期化した後、計測対象物
を撮像して得られた入力画像2を濃淡画像処理部11に
取り込み、A/D変換後に画像メモリ17に格納する
(ステップ2,3)。
FIG. 7 shows a procedure of controlling the pattern matching by the CPU 22 in steps 1 to 17. In step 1 of the figure, the CPU 22 clears and initializes the contents of the work area of the RAM 24, takes in the input image 2 obtained by imaging the measurement target object into the grayscale image processing unit 11, and after the A / D conversion It is stored in the image memory 17 (steps 2 and 3).

【0041】つぎのステップ4でモデル画像1の走査位
置Pj を計数するCPU22の内部のカウンタjをゼロ
に設定して、モデル画像1を入力画像2上の最初の走査
位置P0 (X0 ,Y0 )に設定する。つぎのステップ5
でCPU22はモデル画像1における画素位置を計数す
るためのカウンタiをゼロに設定した後、つぎのステッ
プ6でCPU22は2値メモリ18を参照してモデル画
像1における最初の画素位置(x0 ,y0 )の2値化デ
ータを読み取る。
In the next step 4, the counter j in the CPU 22 for counting the scanning position P j of the model image 1 is set to zero, and the model image 1 is set to the first scanning position P 0 (X 0) on the input image 2. , Y 0 ). Next Step 5
After the CPU 22 sets the counter i for counting the pixel position in the model image 1 to zero, the CPU 22 refers to the binary memory 18 to determine the first pixel position (x 0 , Read the binarized data of y 0 ).

【0042】もしその2値化データが「1」であれば、
ステップ7の判定が「YES」となってステップ8へ進
み、CPU22は最初の画素位置(x0 ,y0 )のモデ
ル画像1の濃度データMi と、入力画像2の対応する画
素位置の濃度データIi とを各画像メモリ16,17よ
り読み出し、つぎのステップ9で前記した式における
i ・Mi ,Ii 2 ・Mi 2 を算出する。
If the binarized data is "1",
The determination in step 7 proceeds to step 8 is "YES", the concentration of the first pixel position (x 0, y 0) and density data M i of the model image 1, the corresponding pixel position of the input image 2 is CPU22 The data I i is read out from each of the image memories 16 and 17, and in the next step 9, I i · M i and I i 2 · M i 2 in the above equation are calculated.

【0043】つぎにCPU22は、ステップ9の算出値
を用いて累積加算値ΣIi ・Mi ,ΣIi ・ΣMi ,Σ
i 2 ,(ΣIi 2 ,ΣMi 2 ,(ΣMi 2 を算出
してRAM24のワークエリアに記憶させる(ステップ
10)。もし前記のステップ7において、2値化データ
が「0」であると判定されたとき、ステップ8〜10は
スキップされて前記の演算が省略される。
Next, the CPU 22 uses the values calculated in step 9 to calculate the cumulative addition values {I i · M i , {I i · ΣM i ,}
I i 2 , (ΣI i ) 2 , ΣM i 2 , (ΣM i ) 2 are calculated and stored in the work area of the RAM 24 (step 10). If it is determined in step 7 that the binarized data is "0", steps 8 to 10 are skipped and the above calculation is omitted.

【0044】つぎのステップ11では、CPU22は前
記カウンタiの値がモデル画像1の総画素数に達したか
否かを判定しており、その判定が「NO」であれば、ス
テップ12でカウンタiの値をインクリメントし、CP
U22はモデル画像1におけるつぎの画素位置(x1
1 )の2値化データを読み取り、前記と同様の手順を
実行する。
In the next step 11, the CPU 22 determines whether or not the value of the counter i has reached the total number of pixels of the model image 1. Increment the value of i, CP
U22 is the next pixel position (x 1 ,
The binary data of y 1 ) is read, and the same procedure as described above is executed.

【0045】モデル画像1における全ての画素位置につ
いて上記手順が繰り返し実行されると、ステップ11の
判定が「YES」となり、つぎのステップ13でCPU
22はステップ10の算出値を用いて(1) 式の演算を実
行し、最初の走査位置(X0,Y0 )での相関値r
2 (X0 ,Y0 )を算出する。
When the above procedure is repeatedly executed for all the pixel positions in the model image 1, the determination in step 11 becomes "YES", and in the next step 13, the CPU
Numeral 22 executes the calculation of the expression (1) using the calculated value of step 10, and calculates the correlation value r at the first scanning position (X 0 , Y 0 ).
2 (X 0 , Y 0 ) is calculated.

【0046】つぎのステップ14では、CPU22はそ
の相関値r2 (X0 ,Y0 )と相関値の最大値とを比較
する。この場合、相関値の最大値はゼロに初期設定され
ているから、ステップ14の判定は「YES」となり、
ステップ15で前記相関値r2 (X0 ,Y0 )を相関値
の最大値としてRAM24に記憶させ、さらにステップ
16で走査位置P0 の座標(X0 ,Y0 )を対象物の位
置(X´,Y´)としてRAM24に記憶させる。な
お、もしステップ14の判定が「NO」であれば、ステ
ップ15,16はスキップされ、相関値の最大値は更新
されない。
In the next step 14, the CPU 22 compares the correlation value r 2 (X 0 , Y 0 ) with the maximum value of the correlation values. In this case, since the maximum value of the correlation value is initially set to zero, the determination in step 14 is “YES”,
In step 15, the correlation value r 2 (X 0 , Y 0 ) is stored in the RAM 24 as the maximum value of the correlation value. In step 16, the coordinates (X 0 , Y 0 ) of the scanning position P 0 are stored in the position of the object ( X ', Y') in the RAM 24. If the determination in step 14 is “NO”, steps 15 and 16 are skipped and the maximum correlation value is not updated.

【0047】つぎのステップ17では、モデル画像1の
走査位置Pi が最終位置に達したか否かをカウンタjの
値により判定しており、この場合、その判定は「NO」
であるから、CPU22はステップ18でカウンタjを
インクリメントして、モデル画像1を入力画像2上のつ
ぎの走査位置P1 (X1 ,Y1 )に設定し、上記と同様
の手順を実行する。
[0047] At the next step 17, which determines whether the scanning position P i of the model image 1 has reached the final position by the value of the counter j, in this case, the judgment is "NO"
Therefore, the CPU 22 increments the counter j in step 18 to set the model image 1 to the next scanning position P 1 (X 1 , Y 1 ) on the input image 2 and executes the same procedure as described above. .

【0048】このようにして入力画像2の全画面をモデ
ル画像1により走査しつつ全ての走査位置Pj で上記手
順を実行することにより相関値が最大となる走査位置P
j の座標(X´,Y´)が得られ、ステップ17の判定
が「YES」になったとき、CPU22はパターンマッ
チングを終了させる。
The scan position P at which the correlation value is maximized by performing the way the procedure at all scanning positions P j while scanning the entire screen of the input image 2 by model image 1
When the coordinates (X ′, Y ′) of j are obtained and the determination in step 17 becomes “YES”, the CPU 22 ends the pattern matching.

【0049】なお上記実施例では、2値メモリ18の内
容を参照し、2値化データが「1」のときモデル画像1
の濃度データMi をその都度画像メモリ16より読み出
しているが、パターンマッチングに先立ち、2値化デー
タが「1」のモデル画像1における画素の濃度データM
i を画素位置の座標(xi ,yi )とともにRAM24
などにテーブル化して記憶させておいてもよい。
In the above embodiment, the contents of the binary memory 18 are referred to, and when the binary data is "1", the model image 1
The While the density data M i is read from the respective image memory 16, prior to the pattern matching, the binarized data is density data M of the pixels in the model image 1 of "1"
i along with the coordinates (x i , y i ) of the pixel position
For example, it may be stored in a table.

【0050】[0050]

【発明の効果】この発明は上記のように、モデル画像を
膨張および収縮の各処理を行って膨張画像および収縮画
像を生成した後、膨張画像および収縮画像の各エッジ位
置近傍の画素につきモデル画像と入力された濃淡画像と
の相関値を演算するようにしたから、入力された濃淡画
像がいずれか方向に回転していても、正しいパターンマ
ッチングが行われ、位置計測が可能である。また相関演
算の対象画素を膨張画像および収縮画素の各エッジ位置
近傍の画素に限定するから、パターンマッチングの対象
画素を効率的に削減でき、相関演算の計算量が減少し、
処理時間を短縮できる。
As described above, the present invention performs dilation and erosion processing on a model image to generate an dilated image and a eroded image, and then applies the model image to pixels near each edge position of the dilated image and the eroded image. Since the correlation value between the input grayscale image and the input grayscale image is calculated, correct pattern matching is performed even if the input grayscale image is rotated in either direction, and position measurement is possible. Further, since the target pixel of the correlation operation is limited to pixels near each edge position of the dilated image and the contracted pixel, the target pixel of the pattern matching can be efficiently reduced, and the calculation amount of the correlation operation is reduced.
Processing time can be reduced.

【0051】請求項2のパターンマッチング装置では、
膨張画像の各構成画素の濃度データを2次微分して得ら
れた値が第1のしきい値を越える画素と、収縮画像の各
構成画素の濃度データを2次微分して得られた値が第2
のしきい値を越える画素とを選択するようにしたから、
モデル画像のエッジを挟んで両側近傍の画素を確実に抽
出できるという効果がある。
According to the pattern matching apparatus of the second aspect,
A pixel whose value obtained by secondarily differentiating the density data of each constituent pixel of the dilated image exceeds a first threshold value, and a value obtained by secondarily differentiating the density data of each constituent pixel of the contracted image Is the second
Pixels that exceed the threshold of
There is an effect that pixels near both sides of the edge of the model image can be reliably extracted.

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

【図1】この発明にかかる濃淡画像のパターンマッチン
グ装置の原理を説明するための原理説明図である。
FIG. 1 is a principle explanatory diagram for explaining the principle of a pattern matching apparatus for a grayscale image according to the present invention.

【図2】膨張画像についての各処理段階の処理結果を示
す説明図である。
FIG. 2 is an explanatory diagram showing a processing result of each processing step for an expanded image.

【図3】収縮画像についての各処理段階の処理結果を示
す説明図である。
FIG. 3 is an explanatory diagram showing a processing result of each processing step for a contracted image.

【図4】膨張画像および収縮画像の生成方法を示す説明
図である。
FIG. 4 is an explanatory diagram showing a method of generating an expanded image and a contracted image.

【図5】この発明の一実施例にかかる濃淡画像のパター
ンマッチング装置の回路構成例を示すブロック図であ
る。
FIG. 5 is a block diagram showing a circuit configuration example of a gray-scale image pattern matching apparatus according to one embodiment of the present invention;

【図6】パターンマッチングの対象画素を選択する処理
の流れを示すフローチャートである。
FIG. 6 is a flowchart illustrating a flow of a process of selecting a target pixel for pattern matching.

【図7】CPUによるパターンマッチングの制御手順を
示すフローチャートである。
FIG. 7 is a flowchart showing a control procedure of pattern matching by a CPU.

【図8】従来の正規化相関濃淡マッチング法を示す説明
図である。
FIG. 8 is an explanatory diagram showing a conventional normalized correlation density matching method.

【図9】従来例を改良した方式の原理を示す原理説明図
である。
FIG. 9 is a principle explanatory diagram showing the principle of a system in which a conventional example is improved.

【図10】図9の改良方式についての各処理段階の処理
結果を示す説明図である。
FIG. 10 is an explanatory diagram showing processing results at each processing stage for the improved method of FIG. 9;

【符号の説明】[Explanation of symbols]

10 カメラ 11 濃淡画像処理部 14 微分計測部 15 LUT 21 制御部 22 CPU 23 ROM 24 RAM 25 膨張・収縮処理部 Reference Signs List 10 camera 11 density image processing unit 14 differential measurement unit 15 LUT 21 control unit 22 CPU 23 ROM 24 RAM 25 expansion / contraction processing unit

───────────────────────────────────────────────────── フロントページの続き (58)調査した分野(Int.Cl.7,DB名) G06T 7/00 - 7/60 G06K 9/36 G06K 9/62 ──────────────────────────────────────────────────続 き Continued on the front page (58) Field surveyed (Int.Cl. 7 , DB name) G06T 7 /00-7/60 G06K 9/36 G06K 9/62

Claims (2)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 対象物のモデル画像を用いて、入力され
た濃淡画像のパターンマッチングを行う装置において、 前記モデル画像を膨張処理して膨張画像を生成する膨張
画像生成手段と、 前記モデル画像を収縮処理して収縮画像を生成する収縮
画像生成手段と、 前記膨張画像および収縮画像のエッジ位置近傍の画素を
選択する画素選択手段と、 前記画素選択手段により選択されたエッジ位置近傍の画
素について対象物のモデル画像と入力された濃淡画像と
の相関値を演算する演算手段とを備えて成る濃淡画像の
パターンマッチング装置。
1. An apparatus for performing pattern matching of an input grayscale image using a model image of an object, comprising: an expanded image generating unit configured to expand the model image to generate an expanded image; A contracted image generating unit that generates a contracted image by performing a contraction process; a pixel selecting unit that selects a pixel near an edge position of the dilated image and the contracted image; A pattern matching apparatus for a gray-scale image, comprising: arithmetic means for calculating a correlation value between a model image of an object and an input gray-scale image.
【請求項2】前記画素選択手段は、前記膨張画像の各構
成画素の濃度データを2次微分して得られた値が第1の
しきい値を越える画素を選択する第1の画素選択手段
と、前記収縮画像の各構成画素の濃度データを2次微分
して得られた値が第2のしきい値を越える画素を選択す
る第2の画素選択手段とを備えている請求項1に記載さ
れた濃淡画像のパターンマッチング装置。
2. The first pixel selecting means for selecting a pixel whose value obtained by secondarily differentiating the density data of each constituent pixel of the expanded image exceeds a first threshold value. And a second pixel selecting means for selecting a pixel whose value obtained by secondarily differentiating the density data of each constituent pixel of the contracted image exceeds a second threshold value. A pattern matching device for the described gray image.
JP18863992A 1992-06-22 1992-06-22 Pattern matching device for grayscale images Expired - Fee Related JP3223385B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP18863992A JP3223385B2 (en) 1992-06-22 1992-06-22 Pattern matching device for grayscale images

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP18863992A JP3223385B2 (en) 1992-06-22 1992-06-22 Pattern matching device for grayscale images

Publications (2)

Publication Number Publication Date
JPH064670A JPH064670A (en) 1994-01-14
JP3223385B2 true JP3223385B2 (en) 2001-10-29

Family

ID=16227234

Family Applications (1)

Application Number Title Priority Date Filing Date
JP18863992A Expired - Fee Related JP3223385B2 (en) 1992-06-22 1992-06-22 Pattern matching device for grayscale images

Country Status (1)

Country Link
JP (1) JP3223385B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4532640B2 (en) * 2000-01-14 2010-08-25 キヤノン株式会社 Position detection apparatus and exposure apparatus using the same
JP4966893B2 (en) * 2008-03-13 2012-07-04 株式会社日立ハイテクノロジーズ Matching degree calculation device and method, program
JP5804862B2 (en) * 2011-09-13 2015-11-04 グローリー株式会社 Image feature extraction method, image feature extraction device, image matching method and image matching device using the same

Also Published As

Publication number Publication date
JPH064670A (en) 1994-01-14

Similar Documents

Publication Publication Date Title
JPH0591411A (en) Image processor
JP3223384B2 (en) Pattern matching device for grayscale images
JP3223385B2 (en) Pattern matching device for grayscale images
CN113793316B (en) Ultrasonic scanning area extraction method, device, equipment and storage medium
JP3164835B2 (en) Pre-processing method and post-processing method in human image recognition
JPH08101139A (en) Defect inspection method and device
JP3016687B2 (en) Image processing device
JP3267107B2 (en) Background image creation method and image processing apparatus
JPH0310107A (en) Inspecting method utilizing gradation pattern matching
JP2002140695A (en) Inspection method and its device
US11640535B2 (en) Probability acquisition apparatus and probability acquisition method
JP3728184B2 (en) Image processing system
JPH09245166A (en) Pattern matching device
JP2002230564A (en) Contour extraction device and method and contour extraction program
JP2732608B2 (en) Background image erasing and binarization processing method for linear figure image and apparatus therefor
JP3252574B2 (en) Image processing device
JPH10143673A (en) Picture processor
JP4458210B2 (en) Object detection method
CN115830304A (en) Object detection system
JPH0949712A (en) Apparatus for measuring flow ratio of wire
JP3025365B2 (en) Image binarization processing device
JP2966448B2 (en) Image processing device
JPH0474283A (en) Method and device for picture processing
JP3175946B2 (en) Object position measuring method and device
JP3112693B2 (en) Figure number calculation device and figure number calculation method

Legal Events

Date Code Title Description
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080824

Year of fee payment: 7

LAPS Cancellation because of no payment of annual fees