JPH064670A - Pattern matching device for gradation picture - Google Patents

Pattern matching device for gradation picture

Info

Publication number
JPH064670A
JPH064670A JP4188639A JP18863992A JPH064670A JP H064670 A JPH064670 A JP H064670A JP 4188639 A JP4188639 A JP 4188639A JP 18863992 A JP18863992 A JP 18863992A JP H064670 A JPH064670 A JP H064670A
Authority
JP
Japan
Prior art keywords
image
pixel
picture
model
pattern matching
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.)
Granted
Application number
JP4188639A
Other languages
Japanese (ja)
Other versions
JP3223385B2 (en
Inventor
Masahiro Kawachi
雅弘 河内
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
Omron Tateisi Electronics Co
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, Omron Tateisi Electronics Co 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

Landscapes

  • Character Input (AREA)
  • Character Discrimination (AREA)
  • Image Analysis (AREA)

Abstract

PURPOSE:To reduce the calculation quantity of the correlation operation of pattern matching and to correctly execute pattern matching even if an input picture is rotated. CONSTITUTION:A model picture 1 is expansion/contraction-processed and an expanded picture 7 and a contracted picture 8 are generated. Density data on the respective constitution picture elements of the expanded picture 7 and the contracted picture 8 are subjected to second-order differentiation. Respective second-order differential values on the expanded picture 7 and the contracted picture 8 are compared with different thresholds. The picture element exceeding the respective thresholds is selected. When density data on the model picture 1 as to the selected picture element is sampled, a picture part 34 at an external side near the edge position of the expanded picture 7 and a picture part 35 at an internal side near the edge position of the contracted picture 8 are extracted, and correlation operation is executed only on the picture parts 34 and 35 with density data of the input picture.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】この発明は、対象物を撮像して得
られた濃淡画像について、対象物のモデル画像を用い
て、パターンマッチングを行うための濃淡画像のパター
ンマッチング装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a grayscale image pattern matching apparatus for performing pattern matching on a grayscale 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 or the like has been obtained from a grayscale image obtained by imaging the object using a pattern matching technique. FIG. 8 is a diagram for explaining the normalized correlation grayscale matching method. In FIG. 8, 1 is a rectangular model image prepared in advance, 2 is an input grayscale image (hereinafter, “input image”). That is).
The input image is scanned one pixel at a time by the model image 1 over the entire screen, and the degree of coincidence between the model image 1 and the input image 2 is obtained by the correlation calculation for each scanning position P j, and the model image 1 having the maximum correlation value is obtained. The position of the object or the like is obtained from the scanning position P j .

【0003】いまモデル画像1が入力画像2上のj番目
の走査位置Pj (Xj ,Yj )にあるとき、モデル画像
1におけるi番目の画素の濃度データをMi 、入力画像
2の対応する画素の濃度データをIi 、モデル画像1の
構成画素数をnとすると、走査位置Pj における相関値
2 (Xj ,Yj )はつぎの(1) 式で与えられる。
Now, 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 , and the density data of the input image 2 is When the density data of the corresponding pixel is I i and the number of pixels constituting 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 is apparent from the 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 subject to pattern matching, the calculation amount of the correlation calculation becomes enormous and the processing time becomes long.

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

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

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

【0009】各画素の2次微分値の絶対値は所定の正の
しきい値THと比較し、このしきい値THより大きな値
をとる画素をパターンマッチングの対象画素として選択
する。
The absolute value of the secondary differential value of each pixel is compared with a predetermined positive threshold value TH, and a pixel having a value larger than this 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 has been binarized, that is, the range of the target pixel 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. To be

【0011】図9(2)はこのようにしてサンプリング
された濃度データより成る濃淡画像5を示しており、サ
ンプリングされた濃度データには文字Aの画像部分3に
ついての濃度データ、すなわちエッジの内側近傍の画素
列3aの濃度データと、背景の画像部分4についての濃
度データ、すなわちエッジの外側近傍の画素列4aの濃
度データとが同程度に含まれる。
FIG. 9 (2) shows a grayscale image 5 consisting of the density data sampled in this way. The density data sampled is 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 by the model image 1 pixel by pixel over the entire screen, and between the density data of the model image 1 sampled by the binarized data and the density data of the input image for each scanning position. Perform correlation calculation,
The position of the object is obtained from the scanning position of the model image 1 having the maximum correlation value.

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

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

【0015】[0015]

【課題を解決するための手段】この発明は、対象物のモ
デル画像を用いて、入力された濃淡画像のパターンマッ
チングを行う装置において、前記モデル画像を膨張処理
して膨張画像を生成する膨張画像生成手段と、前記モデ
ル画像を収縮処理して収縮画像を生成する収縮画像生成
手段と、前記膨張画像および収縮画像のエッジ位置近傍
の画素を選択する画素選択手段と、前記画素選択手段に
より選択されたエッジ位置近傍の画素について対象物の
モデル画像と入力された濃淡画像との相関値を演算する
演算手段とを備えたものである。
SUMMARY OF THE INVENTION The present invention is an apparatus for performing pattern matching of an input grayscale image by using a model image of an object, the dilated image for dilating the model image to generate an dilated 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 pixels in the vicinity of the edge positions of the expansion image and the contraction image, and the pixel selection unit. The calculation means calculates the correlation value between the model image of the object and the input grayscale image for the pixels near the edge position.

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

【0017】[0017]

【作用】モデル画像の膨張画像および収縮画像の各エッ
ジ位置近傍の画素について、モデル画像と入力された濃
淡画像との相関値を演算するので、入力された濃淡画像
がいずれか方向に回転していても、正しいパターンマッ
チングが行われ、位置計測が可能である。また相関演算
の対象を膨張画像および収縮画素の各エッジ位置近傍の
画素に限定するので、パターンマッチングの対象画素が
効率的に削減され、相関演算の計算量が減少し、処理時
間が短縮される。
Since the correlation value between the model image and the input grayscale image is calculated for the pixels in the vicinity of 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 the pixels in the vicinity of each edge position of the dilated image and the contracted pixel, the target pixel of the 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
のしきい値を越える画素とを選択するので、モデル画像
のエッジを挟んで両側近傍の画素が確実に抽出される。
According to the pattern matching device of claim 2,
A value obtained by second-order differentiating the density data of each constituent pixel of the dilated image and the density data of each constituent pixel of the dilated image and a pixel whose value obtained by second-order differentiation exceeds the first threshold value. Is the second
Pixels that exceed the threshold value of are selected, so that pixels on both sides 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 principle explanatory views for explaining the principle of a pattern matching device for a grayscale image according to the present invention. FIG. 1A is a model image 1 obtained by imaging a model of a target object (in this case, the character “A”), 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 background image portion 4 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. 1 (2) shows an expanded image 7 generated by expanding the model image 1 shown in FIG.
(2) ′ shows a contracted image 8 generated by contracting the model image 1. 2 (2) (2) '
In, the broken line b is the edge of the model image 1 before the expansion or contraction processing. The expansion and contraction processes are performed a plurality of times depending on 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 the horizontal line 9 of the expanded image 7 in the figure. Further, the density data (0 to 255 gradations) of each pixel along the same horizontal line 9 of the contracted image 7 is shown in FIG. 3 (1).

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

【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 its 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-order differential value of each pixel in the expanded image 7 is compared with a positive first threshold value TH1 and a pixel having a value larger than the first threshold value TH1 is selected. 2 (4) shows that the first threshold value TH1 is 2
The binarized data is shown.

【0026】前記収縮画像8についての各画素の2次微
分値は、負の第2のしきい値TH2と比較され、この第
2のしきい値TH2より小さな値をとる画素が選択され
る。図3(4)には前記第2のしきい値TH2により2
値化された2値化データが示してある。
The second derivative value of each pixel in the contracted image 8 is compared with a second negative threshold value TH2, and a pixel having a value smaller than the second threshold value TH2 is selected. In FIG. 3 (4), the second threshold value TH2 is 2
The binarized data 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 grayscale image 32 as shown in (3) is obtained. In the grayscale image 32, 34 is an image portion generated by the sampled density data, and this image portion 3
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. 3 (4),
A grayscale image 33 as shown in FIG. 1 (3) 'is obtained. In the grayscale image 33, 35 is an image portion generated by 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. 1C is the model image 1
1 corresponds to the image portion 4 of the background near the outside of the edge, and the image portion 35 of FIG. 1 (3) ′ corresponds to the image portion 3 of the character A near the inside of the edge in the model image 1. FIG. 1 in which parts 34 and 35 are combined
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 are displayed.
The same as the concentration data for. Figure 1
In (4), the broken line b is the edge of the model image 1, and the image portions 34 and 35 are located in the vicinity of the edge b, but are separated from each other by the amount that allows rotation of the input image.

【0030】前記モデル画像1を1画素ずつ移行させて
入力画像を全画面にわたり走査し、走査位置毎に前記2
値化データによりサンプリングされたモデル画像1の濃
度データと入力画像2の濃度データとの間で相関演算を
行い、その相関値が最大となるモデル画像1の走査位置
から対象物の位置が求められる。この場合に、入力画像
2が図8の破線aのようにわずかに回転していても、モ
デル画像1の膨張画像7と収縮画像8とのエッジ近傍か
ら相関演算の対象画素を選択しているので、モデル画像
1および入力画像2のいずれについても対象物の画像部
分と背景の画像部分とから濃度データがサンプリングさ
れて、正しいパターンマッチングが行われることにな
る。
The input image is scanned over the entire screen by shifting the model image 1 pixel by pixel, and the input image is scanned for each scanning position.
A correlation calculation is performed between the density data of the model image 1 sampled by the binarized 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 having the maximum correlation value. . In this case, even if the input image 2 is slightly rotated as indicated by the broken line a in FIG. 8, the target pixel for correlation calculation is selected from the vicinity of the edges of the expanded image 7 and the contracted 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 a circuit configuration example of a pattern matching device based on the above principle. The apparatus of the illustrated example includes a camera 10, a grayscale image processing unit 11, and a monitor 12. The grayscale image processing unit 11 includes an A / D converter 13, an expansion / contraction processing unit 25, a differential measurement unit 14, and a LUT 15. , Image memory 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 inputs an analog signal of a grayscale image from the camera 10 and converts it into a digital signal. The density data of each pixel forming this digital signal takes any value of 256 gradations, for example. The grayscale image (model image 1) obtained by imaging the model of the object is
It is input to the expansion / contraction processing unit 25 via the A / D converter 13 and stored in one image memory 16. Further, the input image 2 obtained by picking up an image of the measurement object is stored in the other image memory 17 via the A / D converter 13. The image memories 16 and 17 store density data in pixel units.

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

【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 quadratic differential value of each pixel of the dilated image 7 provided by the differential measuring unit 14 with the above-mentioned first threshold TH1 and the quadratic pixel of each pixel of the eroded 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 of the expanded image 7 and the binarized data of 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 unit 19 is for controlling the image display operation of the monitor 12. It inputs a grayscale image signal or binary data of a model or an object to be measured, and D / A converts 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 unit 21 has a CPU 22 which is a main body of control and calculation, and a ROM 23 which stores programs.
And a RAM 24 for storing various data. The CPU 22 controls the operation of the entire apparatus according to a program, and the image memories 16, 17, the binary memory 18, the RAM 2
While performing reading and writing of data to and from No. 4, various calculations and processing related to pattern matching are executed.

【0037】図6は、パターンマッチングの対象画素を
選択するための処理の流れをステップ1〜ステップ6
(図中、各ステップは「ST」で示す)で示す。
FIG. 6 shows steps 1 to 6 of the processing flow for selecting the target pixel for pattern matching.
(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 the figure, the CPU 22 makes the LUT
Binary data for performing binarization processing on the expanded image 7 and the contracted image 8 is set in each address area of 15. 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 of the model image 1 is expanded by the expansion / contraction processing unit 25. The expanded image 7 and the contracted 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 performs a secondary differential process on the dilated image 7 and the eroded image 8 to obtain their respective 2
Calculate the second derivative. The address signal corresponding to the second-order differential value of each pixel in the expanded image 7 and the contracted image 8 is L
When given to the UT 15, the LUT 15 outputs the binarized data from the corresponding address area (step 5). The binarized data of the expanded image 7 and the binarized data of the contracted image 8 are combined and stored in the binary memory 18 on a pixel-by-pixel basis (step 6).

【0040】図7は、前記CPU22によるパターンマ
ッチングの制御手順をステップ1〜ステップ17で示
す。同図のステップ1でCPU22はRAM24のワー
クエリアの内容をクリアして初期化した後、計測対象物
を撮像して得られた入力画像2を濃淡画像処理部11に
取り込み、A/D変換後に画像メモリ17に格納する
(ステップ2,3)。
FIG. 7 shows the control procedure of pattern matching by the CPU 22 in steps 1 to 17. In step 1 of the figure, the CPU 22 clears the contents of the work area of the RAM 24 and initializes it, then takes in the input image 2 obtained by imaging the measurement object into the grayscale image processing unit 11, and after 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 inside 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 scanned at the first scanning position P 0 (X 0 on the input image 2). , Y 0 ). Next step 5
Then, the CPU 22 sets the counter i for counting the pixel positions in the model image 1 to zero, and then in step 6, the CPU 22 refers to the binary memory 18 and 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",
When the determination in step 7 is “YES”, the process proceeds to step 8, and the CPU 22 causes the density data M i of the model image 1 at the first pixel position (x 0 , y 0 ) and the density of the corresponding pixel position of the input image 2 to be present. The data I i and the image memories 16 and 17 are read out, 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 , and (Σ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 operation 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, and if the determination is "NO", the counter is counted in step 12. 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 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 pixel positions in the model image 1, the determination in step 11 becomes "YES", and in the next step 13, the CPU
22 executes the calculation of equation (1) using the calculated value of step 10, and 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 correlation value. In this case, the maximum correlation value is initially set to zero, so 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 correlation value, and in step 16, the coordinates (X 0 , Y 0 ) of the scanning position P 0 are set to the position of the object ( X ', Y') is stored 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 )に設定し、上記と同様
の手順を実行する。
In the next step 17, it is judged whether or not 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, sets 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 above. .

【0048】このようにして入力画像2の全画面をモデ
ル画像1により走査しつつ全ての走査位置Pj で上記手
順を実行することにより相関値が最大となる走査位置P
j の座標(X´,Y´)が得られ、ステップ17の判定
が「YES」になったとき、CPU22はパターンマッ
チングを終了させる。
In this way, by scanning the entire screen of the input image 2 with the model image 1 and executing the above procedure at all the scanning positions P j , the scanning position P where the correlation value becomes maximum.
When the coordinate (X ′, Y ′) of j is obtained and the determination in step 17 is “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 binarized data is "1", the model image 1
The density data M i of the pixel is read from the image memory 16 each time, but the density data M of the pixel in the model image 1 in which the binarized data is “1” before the pattern matching.
i together with the coordinates (x i , y i ) of the pixel position in the RAM 24
It may be stored in a table such as a table.

【0050】[0050]

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

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

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

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

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

【図3】収縮画像についての各処理段階の処理結果を示
す説明図である。
FIG. 3 is an explanatory diagram showing a processing result of each processing stage 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 grayscale image pattern matching apparatus according to an embodiment of the present invention.

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

【図7】CPUによるパターンマッチングの制御手順を
示すフローチャートである。
FIG. 7 is a flowchart showing a pattern matching control procedure 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 view showing a principle of a system in which a conventional example is improved.

【図10】図9の改良方式についての各処理段階の処理
結果を示す説明図である。
FIG. 10 is an explanatory diagram showing a processing result of each processing stage in the improved system 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 grayscale image processing unit 14 differential measurement unit 15 LUT 21 control unit 22 CPU 23 ROM 24 RAM 25 expansion / contraction processing unit

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 対象物のモデル画像を用いて、入力され
た濃淡画像のパターンマッチングを行う装置において、 前記モデル画像を膨張処理して膨張画像を生成する膨張
画像生成手段と、 前記モデル画像を収縮処理して収縮画像を生成する収縮
画像生成手段と、 前記膨張画像および収縮画像のエッジ位置近傍の画素を
選択する画素選択手段と、 前記画素選択手段により選択されたエッジ位置近傍の画
素について対象物のモデル画像と入力された濃淡画像と
の相関値を演算する演算手段とを備えて成る濃淡画像の
パターンマッチング装置。
1. An apparatus for performing pattern matching of an input grayscale image by using a model image of an object, an expanded image generating unit for expanding the model image to generate an expanded image, and the model image Shrinkage image generation means that performs shrinkage processing to generate a shrinkage image, pixel selection means that selects pixels near the edge positions of the dilated image and shrinkage image, and pixels that are near the edge position selected by the pixel selection means A pattern matching device for a grayscale image, comprising: a computing means for computing a correlation value between the model image of the object and the input grayscale image.
【請求項2】前記画素選択手段は、前記膨張画像の各構
成画素の濃度データを2次微分して得られた値が第1の
しきい値を越える画素を選択する第1の画素選択手段
と、前記収縮画像の各構成画素の濃度データを2次微分
して得られた値が第2のしきい値を越える画素を選択す
る第2の画素選択手段とを備えている請求項1に記載さ
れた濃淡画像のパターンマッチング装置。
2. A first pixel selecting means for selecting a pixel whose value obtained by quadratic differentiating the density data of each constituent pixel of the expanded image exceeds a first threshold value. And second pixel selecting means for selecting a pixel whose value obtained by second-order differentiating the density data of each constituent pixel of the contracted image exceeds a second threshold value. The described pattern matching device for grayscale images.
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 true JPH064670A (en) 1994-01-14
JP3223385B2 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)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001195583A (en) * 2000-01-14 2001-07-19 Canon Inc Position detector and exposure device using the same
JP2009223414A (en) * 2008-03-13 2009-10-01 Hitachi High-Technologies Corp Matching degree computing device and method, program
JP2013061771A (en) * 2011-09-13 2013-04-04 Glory Ltd Image feature extraction method and image feature extraction device and image collation method and image collation device using the same

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001195583A (en) * 2000-01-14 2001-07-19 Canon Inc Position detector and exposure device using the same
JP4532640B2 (en) * 2000-01-14 2010-08-25 キヤノン株式会社 Position detection apparatus and exposure apparatus using the same
JP2009223414A (en) * 2008-03-13 2009-10-01 Hitachi High-Technologies Corp Matching degree computing device and method, program
JP2013061771A (en) * 2011-09-13 2013-04-04 Glory Ltd Image feature extraction method and image feature extraction device and image collation method and image collation device using the same

Also Published As

Publication number Publication date
JP3223385B2 (en) 2001-10-29

Similar Documents

Publication Publication Date Title
CN110274908B (en) Defect inspection apparatus, defect inspection method, and computer-readable recording medium
JP7004145B2 (en) Defect inspection equipment, defect inspection methods, and their programs
CN112567229A (en) Defect inspection device, defect inspection method, and program thereof
JPH0591411A (en) Image processor
JPH06348850A (en) Gradation picture processor
JP3223384B2 (en) Pattern matching device for grayscale images
JP3223385B2 (en) Pattern matching device for grayscale images
JPH06113139A (en) Picture binarization device
JP6788929B1 (en) Image processing device and image processing method for determining the test object
JP3127598B2 (en) Method for extracting density-varying constituent pixels in image and method for determining density-fluctuation block
JP2004219291A (en) Line defect detection method and device for screen
JPH0735699A (en) Method and apparatus for detecting surface defect
JPH0310107A (en) Inspecting method utilizing gradation pattern matching
JP2004219072A (en) Method and apparatus for detecting streak defect of screen
JPH09245166A (en) Pattern matching device
CN117474932B (en) Object segmentation method and device, electronic equipment and storage medium
JP3252574B2 (en) Image processing device
JP3109237B2 (en) Line segment constituent pixel extraction method and line segment judgment method in image
JP3728184B2 (en) Image processing system
JPH10143673A (en) Picture processor
JPH08334476A (en) Method and device for setting inspection area and inspection device using the same
JP2841866B2 (en) Image processing apparatus and method and its application
JP3175946B2 (en) Object position measuring method and device
JP2002230564A (en) Contour extraction device and method and contour extraction program
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