JPH05250475A - Pattern matching method - Google Patents

Pattern matching method

Info

Publication number
JPH05250475A
JPH05250475A JP3267475A JP26747591A JPH05250475A JP H05250475 A JPH05250475 A JP H05250475A JP 3267475 A JP3267475 A JP 3267475A JP 26747591 A JP26747591 A JP 26747591A JP H05250475 A JPH05250475 A JP H05250475A
Authority
JP
Japan
Prior art keywords
storage unit
image
reference image
data
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
JP3267475A
Other languages
Japanese (ja)
Other versions
JP3066137B2 (en
Inventor
Fumio Yasutomi
文夫 安富
Shin Miyaji
伸 宮治
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.)
Sanyo Electric Co Ltd
Original Assignee
Sanyo Electric Co Ltd
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 Sanyo Electric Co Ltd filed Critical Sanyo Electric Co Ltd
Priority to JP3267475A priority Critical patent/JP3066137B2/en
Publication of JPH05250475A publication Critical patent/JPH05250475A/en
Application granted granted Critical
Publication of JP3066137B2 publication Critical patent/JP3066137B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Image Analysis (AREA)

Abstract

PURPOSE:To provide the pattern matching capable of obtaining accurate matching result with shorter arithmetic operation time than before. CONSTITUTION:While shifting the reference picture for a photographing picture, the coefficients of correlation of both pictures are calculated to search the matching point where the highest coefficient of correlation is obtained. In rough position detection, a correlation calculation position control means 3 determines the shift skip amount according to the accuracy of the self correlation function of the reference picture, and a correlation coefficient calculation means 5 calculates the coefficient of correlation for each shift skip amount, determining the rough position of matching. In the position detection and later, the coefficient of correlation for each unit shift amount according to the picture element pitch is calculated around the rough position, searching the real matching position.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、例えばカメラによって
撮影した対象物体の現在位置を検出するべく、対象物体
の撮影画像と該対象物体について予め記憶されている基
準画像との相関をとることによって、撮影画像に対する
基準画像の位置合わせを行なうパターンマッチング方法
に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention uses a correlation between a photographed image of a target object and a reference image stored in advance for the target object in order to detect the current position of the target object photographed by a camera. , A pattern matching method for aligning a reference image with a captured image.

【0002】[0002]

【従来の技術】従来、工場における組立工程や検査工程
などにおいて、対象物体をカメラで撮影し、該撮影画像
と基準画像との相関をとることによって、対象物体の位
置を検出することが行われている。相関の算出方法とし
ては、濃淡画像を用いた正規化相互相関法が知られてい
る。
2. Description of the Related Art Conventionally, in an assembly process or inspection process in a factory, a target object is photographed by a camera, and the position of the target object is detected by correlating the photographed image with a reference image. ing. As a correlation calculation method, a normalized cross-correlation method using a grayscale image is known.

【0003】この正規化相互相関法は照明の変化等にも
影響が少なく高精度の検出が可能であるが、演算回数が
非常に多くなる欠点がある。そこで、演算回数を減少さ
せる手段として、基準画像及び撮影画像を同一比率で縮
小して記憶し、縮小画像どうしで相関をとって粗位置検
出を行った後、縮小しない画像どうしで相関をとって精
位置検出を行う方法が提案されている(特開平3-110685
〔G06F15/70〕)。該方法によれば、縮小比率が1/Nの
とき、演算時間が粗相関では1/N2に減少することに
なる。
This normalized cross-correlation method has a small influence on changes in illumination and the like and enables highly accurate detection, but has a drawback that the number of calculations is extremely large. Therefore, as a means of reducing the number of calculations, the reference image and the photographed image are reduced and stored at the same ratio, the coarse positions are detected by correlating the reduced images, and then the correlation is performed between the images that are not reduced. A method for detecting a precise position has been proposed (Japanese Patent Laid-Open No. 3-110685).
[G06F15 / 70]). According to this method, when the reduction ratio is 1 / N, the calculation time is reduced to 1 / N 2 in the rough correlation.

【0004】[0004]

【発明が解決しようとする課題】しかしながら、上記方
法では、画像の縮小率が過大となると、粗位置検出にお
ける精度が極度に低下して、これによって得られた粗位
置が必ずしもマッチング位置の近傍に存在せず、その後
の精位置検出によっては真のマッチング位置が得られな
い虞れがある。
However, in the above method, when the reduction ratio of the image becomes excessively large, the accuracy in coarse position detection is extremely lowered, and the coarse position obtained by this is not always close to the matching position. There is a possibility that a true matching position will not be obtained if it does not exist and subsequent precise position detection is performed.

【0005】逆に画像の縮小率を過小に設定すると、演
算時間短縮の効果が薄れ、例えば1つの撮影画像に対し
て複数の基準画像をマッチングさせんとする場合には、
演算時間が長くなって、リアルタイムの位置検出が困難
となる問題がある。
On the contrary, if the image reduction ratio is set too small, the effect of shortening the calculation time is weakened. For example, when a plurality of reference images are to be matched with one captured image,
There is a problem that calculation time becomes long and real-time position detection becomes difficult.

【0006】本発明の目的は、従来よりも演算時間が短
く、且つ正確なマッチング結果が得られるパターンマッ
チング方法を提供することである。
An object of the present invention is to provide a pattern matching method in which the calculation time is shorter than before and an accurate matching result can be obtained.

【0007】[0007]

【課題を解決する為の手段】本発明に係るパターンマッ
チング方法は、第1画像記憶手段から読み出された撮影
画像データと第2記憶手段から読み出された基準画像デ
ータに基づいて、撮影画像に対して基準画像を移動させ
つつ両画像の相関係数或いはこれに準じた係数(近似度
データ)を算出し、最も高い近似度が得られるマッチン
グ位置を捜し出す方法であって、基本的には、マッチン
グの粗位置検出と精位置検出の2つの手順から構成され
る。
A pattern matching method according to the present invention uses a captured image based on captured image data read from a first image storage means and reference image data read from a second storage means. On the other hand, a method of calculating the correlation coefficient of both images or a coefficient similar thereto (approximation degree data) while moving the reference image, and finding the matching position where the highest degree of approximation is obtained. , Matching coarse position detection and fine position detection.

【0008】粗位置検出においては、先ず、基準画像の
自己相関関数或いはこれに準じた関数の先鋭度に応じ、
先鋭度が鈍くなるにつれて増大する移動スキップ量を決
定し、該移動スキップ量毎に近似度データを算出して、
マッチングの粗位置を決定する。その後、精位置検出に
おいては、前記粗位置の周囲にて、撮影画像及び基準画
像を構成する画素の配列ピッチに応じた単位移動量毎に
近似度データを算出して、マッチングの精位置を決定す
る。
In coarse position detection, first, according to the sharpness of the autocorrelation function of the reference image or a function based on it,
The movement skip amount that increases as the sharpness becomes dull is determined, and the approximation data is calculated for each movement skip amount,
Determine the coarse position of matching. Then, in the fine position detection, the proximity data is determined around the rough position by calculating the degree of approximation data for each unit movement amount according to the arrangement pitch of the pixels forming the captured image and the reference image. To do.

【0009】この場合、第2記憶手段は、基準画像を記
憶する主記憶部と、該基準画像を所定の縮小率で縮小し
た画像を記憶する副記憶部とから構成し、前記移動ステ
ップ量毎に近似度データを算出して粗位置検出を行なう
際には、第2記憶手段の副記憶部から基準画像データを
読み出すと共に、第1記憶手段からは、前記副記憶部の
画像の縮小率に応じたスキップ量にて間欠的に撮影画像
データを読み出し、その後、精位置検出を行なう際は、
第1記憶手段から撮影画像データをスキップすることな
く読み出すと共に、第2記憶手段の主記憶部から基準画
像データを読み出す方法が採用可能である。
In this case, the second storage means is composed of a main storage unit for storing the reference image and a sub storage unit for storing an image obtained by reducing the reference image at a predetermined reduction ratio, and for each movement step amount. When calculating the approximation degree data to detect the coarse position, the reference image data is read from the sub storage unit of the second storage unit, and the reduction ratio of the image of the sub storage unit is read from the first storage unit. When the photographed image data is read out intermittently with a skip amount according to the following, and then the precise position is detected,
A method of reading the captured image data from the first storage unit without skipping and reading the reference image data from the main storage unit of the second storage unit can be adopted.

【0010】又、他のパターンマッチング方法として、
第2記憶手段は、基準画像を記憶する主記憶部と、該基
準画像を縮小した画像を記憶する副記憶部とから構成
し、副記憶部には、基準画像の自己相関関数或いはこれ
に準じた関数の先鋭度に応じ、先鋭度が鈍くなるにつれ
て減少する画像縮小率にて基準画像を記憶する。そし
て、粗位置検出では、第2記憶手段の副記憶部から基準
画像データを読み出すと共に、第1記憶手段からは、前
記副記憶部の画像の縮小率に応じたスキップ量にて間欠
的に撮影画像データを読み出して、両画像データの近似
度データを算出して、マッチングの粗位置を決定する。
その後、精位置検出では、前記粗位置の周囲にて、第1
記憶手段及び第2記憶手段の主記憶部から夫々撮影画像
及び基準画像を読み出して、撮影画像及び基準画像を構
成する画素の配列ピッチに応じた単位移動量毎に近似度
データを算出して、マッチングの精位置を決定する。
As another pattern matching method,
The second storage means comprises a main storage unit for storing the reference image and a sub storage unit for storing the reduced image of the reference image, and the sub storage unit has an autocorrelation function of the reference image or a similar function. The reference image is stored at an image reduction rate that decreases as the sharpness decreases according to the sharpness of the function. Then, in the rough position detection, the reference image data is read from the sub storage unit of the second storage unit, and the first storage unit intermittently shoots at a skip amount according to the reduction ratio of the image of the sub storage unit. The image data is read out, the degree of approximation data of both image data is calculated, and the rough position of matching is determined.
Then, in the fine position detection, the first position is detected around the rough position.
The captured image and the reference image are read from the main storage unit of the storage unit and the second storage unit, respectively, and the degree-of-approach data is calculated for each unit movement amount according to the arrangement pitch of the pixels forming the captured image and the reference image, Determine the exact position of matching.

【0011】[0011]

【作用】本発明に係るパターンマッチング方法は、撮影
画像と基準画像の所定ずれ量における相関係数が、それ
らの形状的な特徴によって変ることに基づいている。即
ち、例えば図3(b)に示す如き塗り込みが施された縦長
の楕円のマッチングにおいては、基準画像を楕円の短軸
方向へずらして相関係数を計算する際の移動スキップ量
は、図3(a)に示す如き塗り込みが施された真円のマッ
チングを行なう場合の移動スキップ量よりも小さく設定
しなければ、真のマッチング位置の近傍を粗位置として
検出することが出来ない。一方、縦長の楕円のマッチン
グにおいて、基準画像を楕円の長軸方向へずらして相関
係数を計算する際の移動スキップ量は、真円のマッチン
グを行なう場合の移動スキップ量よりも大きく設定して
も差支えない。
The pattern matching method according to the present invention is based on the fact that the correlation coefficient between the photographed image and the reference image in the predetermined shift amount changes depending on their geometrical characteristics. That is, for example, in the matching of a vertically elongated ellipse that is painted as shown in FIG. 3B, the movement skip amount when shifting the reference image in the minor axis direction of the ellipse and calculating the correlation coefficient is Unless it is set to be smaller than the movement skip amount in the case of performing matching of a perfect circle with a fill as shown in 3 (a), the vicinity of the true matching position cannot be detected as a rough position. On the other hand, in vertical ellipse matching, the movement skip amount when shifting the reference image in the long axis direction of the ellipse to calculate the correlation coefficient is set to be larger than the movement skip amount when performing perfect circle matching. Does not matter.

【0012】そこで本発明においては、粗位置検出に
て、上記のごとき図形の形状的な特徴を自己相関関数に
よって把握し、その結果に基づいて移動スキップ量或い
は画像縮小率を決定することとしたものである。例え
ば、真円の自己相関関数は図3(c)に示す様に比較的緩
やかな先鋭度のカーブとなるのに対し、縦長の楕円の短
軸方向の自己相関関数は図3(d)の如く急峻な先鋭度を
有するカーブとなる。従って、自己相関関数の先鋭度に
応じて、先鋭度が鈍くなるにつれて大きな移動スキップ
量を設定し、或いは小なる縮小率にて基準画像を記憶す
る。
Therefore, in the present invention, in the rough position detection, the geometrical characteristics of the above-mentioned figure are grasped by the autocorrelation function, and the movement skip amount or the image reduction rate is determined based on the result. It is a thing. For example, the autocorrelation function of a perfect circle has a relatively gentle sharpness curve as shown in FIG. 3C, while the autocorrelation function of a vertically elongated ellipse in the minor axis direction is as shown in FIG. Thus, the curve has a sharp sharpness. Therefore, depending on the sharpness of the autocorrelation function, a larger movement skip amount is set as the sharpness becomes dull, or the reference image is stored at a small reduction rate.

【0013】この結果、粗位置検出においては、適切な
移動スキップ量或いは画像縮小率が設定され、真のマッ
チング位置に近傍を確実に粗位置として検出出来る。
As a result, in the coarse position detection, an appropriate movement skip amount or image reduction ratio is set, and the vicinity of the true matching position can be surely detected as the coarse position.

【0014】従って、その後、前記粗位置検出により決
定された粗位置の周囲にて、画素ピッチに応じた単位移
動量を設定して、精位置検出を行なえば、真のマッチン
グ位置を捜し出すことが出来る。
Therefore, after that, if a unit movement amount corresponding to the pixel pitch is set around the rough position determined by the rough position detection and fine position detection is performed, a true matching position can be found. I can.

【0015】[0015]

【発明の効果】本発明に係るパターンマッチングによれ
ば、粗位置検出において、基準画像の形状的特徴に応じ
た適度な粗さの精度で相関係数を計算することが出来る
ので、相関係数の演算回数は必要最小限に抑えることが
出来、且つその後の精位置検出を経ることによって、真
のマッチング位置を見逃すことなく、的確に捜し出すこ
とが出来る。
According to the pattern matching according to the present invention, in the coarse position detection, the correlation coefficient can be calculated with an accuracy of an appropriate roughness according to the geometrical characteristics of the reference image. It is possible to minimize the number of computations of, and by performing subsequent precise position detection, it is possible to accurately find the true matching position without missing it.

【0016】[0016]

【実施例】以下、本発明の一実施例を図面をもとに説明
する。図1は本発明を実施したパターンマッチング回路
の構成を示している。図示省略するカメラ等から取り込
まれた撮影画像を記憶すべき画像メモリ(1)は、例え
ば、1画素が8bitで画像サイズが512×512画素
の画像データの格納領域を有している。一方、基準画像
(以下、テンプレート画像という)を記憶すべきテンプレ
ートメモリ(2)は、L×M(L,M:整数<512)画
素の大きさの画像データの格納領域を有している。
DESCRIPTION OF THE PREFERRED EMBODIMENTS An embodiment of the present invention will be described below with reference to the drawings. FIG. 1 shows the configuration of a pattern matching circuit embodying the present invention. The image memory (1) for storing captured images taken from a camera (not shown) has, for example, a storage area for image data in which one pixel is 8 bits and the image size is 512 × 512 pixels. Meanwhile, the reference image
The template memory (2) for storing (hereinafter referred to as template image) has a storage area of image data having a size of L × M (L, M: integer <512) pixels.

【0017】更に、パターンマッチング回路は、テンプ
レート画像と撮影画像の相関係数を計算する際の両画像
の相対位置を設定する相関計算位置制御手段(3)を具え
ており、前記両メモリ(1)(2)と共に、画像読出し手段
(4)へ接続されている。
Further, the pattern matching circuit comprises a correlation calculation position control means (3) for setting the relative position of both images when calculating the correlation coefficient between the template image and the photographed image. ) (2) and image reading means
It is connected to (4).

【0018】画像読出し手段(4)は、相関計算位置制御
手段(3)によって指定されたアドレスに応じて、画像メ
モリ(1)及びテンプレートメモリ(2)から画像データを
読み出すものであって、これによって読み出された撮影
画像データ及びテンプレート画像データは相関係数計算
手段(5)へ送られて、所定の位置ずれにおける相関係数
が算出される。
The image reading means (4) reads out image data from the image memory (1) and the template memory (2) according to the address designated by the correlation calculation position control means (3). The photographed image data and the template image data read by are sent to the correlation coefficient calculation means (5), and the correlation coefficient at a predetermined position shift is calculated.

【0019】ところで、一般に正規化相関係数(以下、
単に相関係数という)は以下のように与えられる。L×
M画素の大きさのテンプレート画像A(x,y)と、撮
影画像中のテンプレート画像と同じ大きさの部分画像B
ij(x,y)(1≦x≦L,1≦y≦M)の相関係数C
ijは数1で表される。
By the way, in general, the normalized correlation coefficient (hereinafter,
The correlation coefficient) is given as follows. L ×
A template image A (x, y) having a size of M pixels and a partial image B having the same size as the template image in the captured image
Correlation coefficient C of ij (x, y) (1 ≦ x ≦ L, 1 ≦ y ≦ M)
ij is expressed by Equation 1.

【数1】 [Equation 1]

【数2】 [Equation 2]

【数3】 [Equation 3]

【数4】 [Equation 4]

【数5】 [Equation 5]

【0020】撮影画像の内、マッチング対象の大きさを
X,Yとすると1≦i≦L,1≦j≦Lとなる。ここで
仮に、マッチング対象X×Y画素の全ての点についての
相関係数を求めようとすれば、(X−Y)×(Y−M)
個のCijを求めなければならず、長い演算時間を要する
ことになる。
If the sizes of the matching target in the photographed image are X and Y, 1 ≦ i ≦ L and 1 ≦ j ≦ L. Here, if the correlation coefficient for all points of the matching target X × Y pixels is to be obtained, (X−Y) × (Y−M)
Since C ij must be obtained, a long calculation time is required.

【0021】そこで、本発明では、図1のパターンマッ
チング回路によって以下の演算処理を行なう。先ず、両
画像の位置ずれに相当するデータ(i,j)が与えられ
て、相関係数Cijを計算する際、(i,j)とL,Mに関
する情報が相関計算位置制御手段(3)から画像読みだし
手段(4)へ与えられる。画像読みだし手段(4)は、画像
メモリ(1)の(i,j)の位置からL×Mの矩形領域内の
画像データを1画素ずつ読み出すと共に、テンプレート
メモリ(2)内の画像データを1画素ずつ読み出す。読み
出された2つの画像データは相関係数計算手段(5)へ送
られ、前記数1に基づいて相関係数Cijが計算される。
Therefore, in the present invention, the following arithmetic processing is performed by the pattern matching circuit of FIG. First, when the data (i, j) corresponding to the positional deviation of both images is given and the correlation coefficient C ij is calculated, the information regarding (i, j) and L, M is calculated by the correlation calculation position control means (3). ) To image reading means (4). The image reading means (4) reads out the image data in the L × M rectangular area pixel by pixel from the position (i, j) of the image memory (1) and at the same time reads the image data in the template memory (2). Read out pixel by pixel. The two image data read out are sent to the correlation coefficient calculation means (5), and the correlation coefficient C ij is calculated based on the equation (1).

【0022】次に、相関計算位置制御手段(3)による
(i,j)の与え方について述べる。粗位置検出において
は、(i,j)は1ずつ増加させるのではなく、予めテ
ンプレート画像の形状的特徴から決定したX,Y方向の
スキップ量Xskip,Yskipを用いて、i=i+Xskip,
j=j+Yskip毎の(i,j)について相関係数を計算
し、その中で相関係数が最も大きな点をマッチングの粗
位置として選択する。
Next, the correlation calculation position control means (3) is used.
How to give (i, j) is described. In the coarse position detection, (i, j) is not increased by 1, but i = i + Xskip,
The correlation coefficient is calculated for (i, j) for each j = j + Yskip, and the point with the largest correlation coefficient is selected as the rough matching position.

【0023】そして、その後の精位置検出においては、
前記粗位置の周囲にて(i,j)を1ずつ増加させて相
関係数を計算し、相関係数が最大となる点、即ち真のマ
ッチング位置を捜し出すのである。
Then, in the subsequent precise position detection,
The correlation coefficient is calculated by increasing (i, j) by 1 around the rough position, and the point where the correlation coefficient becomes maximum, that is, the true matching position is searched for.

【0024】粗位置検出における移動スキップ量Xski
p,Yskipは後述の如く決定される。先ず、図2(a)に
示すテンプレート画像の周囲に、図2(b)の如くテンプ
レート画像の平均濃度値を1画素幅分加えた(L+2)
×(M+2)の大きさの拡張画像を設定する。
Movement skip amount Xski in coarse position detection
p and Yskip are determined as described later. First, as shown in FIG. 2B, the average density value of the template image is added by one pixel width around the template image shown in FIG. 2A (L + 2).
An extended image having a size of × (M + 2) is set.

【0025】次に、該拡張画像とテンプレート画像との
相関関数を求める。この相関関数はテンプレート画像の
自己相関関数に準じた関数となる。この場合、テンプレ
ート画像を拡張画像上の中心位置から上下左右及び斜め
方向へ夫々移動させることによって、図2(c)の如く、
00,C01,C02,C10,C11,C12,C20,C21,C
22の合計9個の相関係数が求めれる。ここで、C11は拡
張画像中の元々のテンプレート画像と全く同じ画像部分
との相関をとることになるので、C11=1.0となる。
Next, the correlation function between the extended image and the template image is obtained. This correlation function is a function based on the autocorrelation function of the template image. In this case, by moving the template image vertically, horizontally, and diagonally from the center position on the expanded image, as shown in FIG.
C 00 , C 01 , C 02 , C 10 , C 11 , C 12 , C 20 , C 21 , C
A total of 22 correlation coefficients are obtained. Here, C 11 is to be correlated with the completely same image portion as the original template image in the extended image, so that C 11 = 1.0.

【0026】そして、数6及び数7によって、X軸方向
の移動スキップ量Xskip及びY軸方向の移動スキップ量
Yskipを算出する。但し、Aは1.0未満の正の定数で
あって、例えばA=0.2に設定する。
Then, the movement skip amount Xskip in the X-axis direction and the movement skip amount Yskip in the Y-axis direction are calculated by Equations 6 and 7. However, A is a positive constant less than 1.0, and is set to A = 0.2, for example.

【数6】Xskip=(1.0−A)/Xs## EQU6 ## Xskip = (1.0-A) / Xs

【数7】Yskip=(1.0−A)/Ysここで、## EQU00007 ## Yskip = (1.0-A) / Ys where:

【数8】Xs={(C11−C10)+(C11−C12)}/4Xs = {(C 11 −C 10 ) + (C 11 −C 12 )} / 4

【数9】Ys={(C11−C01)+(C11−C21)}/4## EQU9 ## Ys = {(C 11 -C 01 ) + (C 11 -C 21 )} / 4

【0027】上記算出式の根拠を図3及び図4によって
説明する。図3(a)(b)に示す如く塗り込みが施された
真円及び縦長の楕円を対象画像として、夫々撮影画像
(6)(7)及びテンプレート画像(8)(9)を設定した場
合、x軸方向の自己相関関数は、真円においては図3
(c)の如く比較的先鋭度が緩やかなカーブを示すが、楕
円においては図3(d)の如く急峻な先鋭度のカーブを示
す。従って、楕円のテンプレート画像(9)の方が円のテ
ンプレート画像(8)に比べてマッチング位置からのずれ
に対して相関係数の変化が敏感であり、楕円のXskipは
真円よりも小さく設定しなければ、相関係数の山を見落
す虞れがある。
The basis of the above calculation formula will be described with reference to FIGS. Captured images of a perfect circle and a vertically elongated ellipse painted as shown in FIGS.
When (6) (7) and template images (8) (9) are set, the autocorrelation function in the x-axis direction is as shown in FIG.
A curve having a relatively gentle sharpness is shown as in (c), but a steep sharpness curve is shown as in FIG. 3 (d) in the ellipse. Therefore, the elliptical template image (9) is more sensitive to the deviation from the matching position than the circular template image (8), and the elliptical Xskip is set smaller than the perfect circle. Otherwise, there is a risk that the peak of the correlation coefficient may be overlooked.

【0028】図4は、図3(c)及び(d)に示す正確な相
関関数ではなく、真のマッチング位置(相関関数のピー
ク位置)と、その両側へ1画素だけ位置がずれたときの
相関係数に基づいて直線近似を行なった近似的な相関関
数を示しており、本実施例では、該近似相関関数を前記
移動スキップ量Xskip、Yskipの算出に用いる。
FIG. 4 does not show the exact correlation function shown in FIGS. 3 (c) and 3 (d), but the true matching position (peak position of the correlation function) and the position shifted by one pixel on both sides. An approximate correlation function obtained by performing a linear approximation based on the correlation coefficient is shown. In the present embodiment, the approximate correlation function is used to calculate the movement skip amounts Xskip and Yskip.

【0029】図4に示す如く、+x,−x方向で相関係
数の値がAとなる点のx方向の間隔をSとすると、この
Sは上記数8のXsと等価な値となり、一定スキップ量
Xskip=Sで相関係数を計算していけば、その計算結果
は、A以上の値となる確率が高いと言える。
As shown in FIG. 4, when the interval in the x direction between the points where the value of the correlation coefficient is A in the + x and -x directions is S, this S becomes a value equivalent to Xs in the above equation 8 and is constant. If the correlation coefficient is calculated with the skip amount Xskip = S, it can be said that the calculation result has a high probability of being a value of A or more.

【0030】即ち、上記数6及び数7によって得られる
Xskip、Yskipの間隔ごとに撮影画像とテンプレート画
像の相関係数を計算すれば、相関係数の値が定数A以上
となる粗位置が高い確率で得られることになる。
That is, if the correlation coefficient between the photographed image and the template image is calculated at intervals of Xskip and Yskip obtained by the above Equations 6 and 7, the coarse position where the value of the correlation coefficient is the constant A or higher is high. It will be obtained with a probability.

【0031】尚、定数Aは必ずしも一定である必要はな
く、テンプレート画像と撮影画像の一致度が予め判明し
ている場合や、相関係数の値よりも演算時間を優先する
場合等においては、Xskip,Yskipに上限下限を設けた
り、或いは別の算出法によって設定することも可能であ
る。
The constant A does not necessarily have to be constant, and when the degree of coincidence between the template image and the photographed image is known in advance, or when the calculation time has priority over the value of the correlation coefficient, etc. It is also possible to set upper and lower limits on Xskip and Yskip, or to set them by another calculation method.

【0032】その後、精位置検出においては、上述の粗
位置検出によって得られた粗位置の周囲±(Xskip−
1)、±(Yskip−1)の範囲について、画素ピッチに
一致する単位ずれを設定して相関係数を計算し、その中
での最大の相関係数が得られた点をマッチング位置とす
る。
After that, in the fine position detection, ± (Xskip− around the rough position obtained by the above-mentioned rough position detection.
1), within the range of ± (Yskip-1), the unit deviation that matches the pixel pitch is set, the correlation coefficient is calculated, and the point at which the maximum correlation coefficient is obtained is set as the matching position. ..

【0033】従って、相関計算の演算回数は、粗位置検
出での回数と精位置検出での回数の合計として、(X/
Xskip)・(Y/Yskip)+(Xskip−1)・(Yskip−1)×
4回となる。この回数は、粗位置検出を行なわず精位置
検出のみによってマッチング位置を捜し出す場合の演算
回数(X−L)・(Y−M)よりも遥かに少なく、1つの
撮影画像に対して複数のテンプレート画像をマッチング
する場合でも、演算時間は短く、リアルタイムの位置検
出が可能である。
Therefore, the number of calculations for correlation calculation is (X /
Xskip) ・ (Y / Yskip) + (Xskip-1) ・ (Yskip-1) ×
It will be four times. This number is much smaller than the number of calculations (XL-L) / (Y-M) in the case of searching for a matching position by only detecting the precise position without performing the coarse position detection. Even when matching images, the calculation time is short and the position can be detected in real time.

【0034】尚、上記実施例では、テンプレート画像、
撮影画像をそのまま用いて相関計算を行っているが、テ
ンプレート画像を縮小した画像を縮小用テンプレートメ
モリに格納しておき、画像メモリから撮影画像を読み出
す時に画像読みだし手段によってアドレスをスキップし
ながら、読み出す方法も採用可能である。
In the above embodiment, the template image,
Although the correlation calculation is performed using the captured image as it is, the image obtained by reducing the template image is stored in the reduction template memory, and the address is skipped by the image reading means when the captured image is read from the image memory. A reading method can also be adopted.

【0035】即ち、予めテンプレート画像の隣接する4
画素の内、1画素を抽出し、或いは4画素の平均値を取
り出すことによって、1/4に縮小した縮小テンプレー
ト画像を作成し、これを縮小用テンプレートメモリに記
憶しておく。そして、粗位置検出においては、上記縮小
用テンプレートメモリから縮小テンプレート画像データ
を読み出すと共に、画像メモリから撮影画像データを
x,y方向に夫々2画素置きに読み出し、これによって
データ量を夫々1/4に減らして相関係数の計算を行
う。
That is, the four adjacent template images
One of the pixels is extracted, or the average value of the four pixels is extracted to create a reduced template image reduced to ¼, and this is stored in the reduction template memory. In coarse position detection, the reduced template image data is read from the reduction template memory, and the photographed image data is read from the image memory every two pixels in the x and y directions. The correlation coefficient is calculated by reducing it to.

【0036】その後、精位置検出においては、粗位置検
出によって得られて粗位置の周囲について、縮小してい
ない標準のテンプレート画像と撮影画像の間で相関係数
の計算を行い、真のマッチング位置を捜し出すのであ
る。この結果、更に演算回数が減少することになる。
Thereafter, in the fine position detection, the correlation coefficient is calculated between the standard template image that has not been reduced and the captured image around the rough position obtained by the rough position detection, and the true matching position is calculated. To find out. As a result, the number of calculations is further reduced.

【0037】又、他のパターンマッチング方法として、
上記同様に縮小用テンプレートメモリを容易し、その画
像の縮小率を、自己相関関数の分布の先鋭度に応じ、先
鋭度が鈍くなるにつれて減少する値に設定して、該縮小
率にて基準画像を記憶し、粗位置検出においては、縮小
用テンプレートメモリから画像データをスキップするこ
となく読み出すと共に、画像メモリからは前記縮小率に
応じたスキップ量にて画像データを読み出し、両画像デ
ータの相関係数を算出する方法も採用可能である。これ
によっても本発明の効果が得られる。
As another pattern matching method,
Similarly to the above, the template memory for reduction is facilitated, and the reduction rate of the image is set to a value that decreases as the sharpness becomes dull according to the sharpness of the distribution of the autocorrelation function, and the reference image is set at the reduction rate. In the coarse position detection, the image data is read from the reduction template memory without skipping, and the image data is read from the image memory with a skip amount according to the reduction ratio, and the correlation between the two image data is stored. A method of calculating the number can also be adopted. The effect of the present invention can be obtained also by this.

【0038】上記パターンマッチング方法によれば、先
ず、テンプレート画像の形状的特徴に応じた粗さで相関
係数を計算することによって、マッチング位置近傍の粗
位置を決定し、その後、粗位置の周囲のみを精細に探索
するので、必要最小限の演算回数によって、マッチング
位置を的確に捜し出すことが出来る。
According to the above pattern matching method, first, the rough position in the vicinity of the matching position is determined by calculating the correlation coefficient with the roughness according to the shape feature of the template image, and thereafter, the rough position around the rough position is determined. Since only the fine search is performed, the matching position can be accurately found with the minimum number of calculations.

【0039】上記実施例の説明は、本発明を説明するた
めのものであって、特許請求の範囲に記載の発明を限定
し、或は範囲を減縮する様に解すべきではない。又、本
発明の各部構成は上記実施例に限らず、特許請求の範囲
に記載の技術的範囲内で種々の変形が可能であることは
勿論である。例えば上記実施例では、近似度を表わす指
標として相関係数及び相関関数を用いているが、これに
準じた他の係数及び関数を定義して用いることも可能で
ある。
The above description of the embodiments is for explaining the present invention, and should not be construed as limiting the invention described in the claims or limiting the scope. The configuration of each part of the present invention is not limited to the above embodiment, and it is needless to say that various modifications can be made within the technical scope described in the claims. For example, in the above-described embodiment, the correlation coefficient and the correlation function are used as the index indicating the degree of approximation, but it is also possible to define and use other coefficients and functions according to this.

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

【図1】本発明に係るパターンマッチング方法を実施す
るための回路構成を示すブロック図である。
FIG. 1 is a block diagram showing a circuit configuration for implementing a pattern matching method according to the present invention.

【図2】粗位置検出における自己相関関数の算出範囲を
説明する図である。
FIG. 2 is a diagram illustrating a calculation range of an autocorrelation function in coarse position detection.

【図3】形状的特徴による自己相関関数の相違を説明す
る図である。
FIG. 3 is a diagram illustrating a difference in autocorrelation function due to a shape feature.

【図4】直線近似した自己相関関数を表わす図である。FIG. 4 is a diagram showing an autocorrelation function that is linearly approximated.

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

(1) 画像メモリ (2) テンプレートメモリ (3) 相関計算位置制御手段 (4) 画像読出し手段 (5) 相関係数計算手段 (6) 撮影画像 (7) 撮影画像 (8) テンプレート画像 (9) テンプレート画像 (1) Image memory (2) Template memory (3) Correlation calculation position control means (4) Image reading means (5) Correlation coefficient calculation means (6) Photographed image (7) Photographed image (8) Template image (9) Template image

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 第1の記憶手段に記憶されている対象物
体の撮影画像に、第2の記憶手段に記憶されている基準
画像を重ね合わせるパターンマッチング方法において、
第1画像記憶手段から読み出された撮影画像データと第
2記憶手段から読み出された基準画像データに基づい
て、撮影画像に対して基準画像を移動させつつ両画像の
相関係数或いはこれに準じた係数(近似度データ)を算出
し、最も高い近似度が得られるマッチング位置を捜し出
す方法であって、先ず、基準画像の自己相関関数或いは
これに準じた関数の先鋭度に応じ、先鋭度が鈍くなるに
つれて増大する移動スキップ量を決定し、該移動スキッ
プ量毎に近似度データを算出して、マッチングの粗位置
検出を行ない、その後、前記粗位置の周囲にて、撮影画
像及び基準画像を構成する画素の配列ピッチに応じた単
位移動量毎に近似度データを算出して、マッチングの精
位置検出を行なうことを特徴とするパターンマッチング
方法。
1. A pattern matching method for superimposing a reference image stored in a second storage unit on a captured image of a target object stored in a first storage unit,
Based on the captured image data read out from the first image storage means and the reference image data read out from the second storage means, while moving the reference image with respect to the captured image, the correlation coefficient of the two images or A method of calculating a coefficient (approximation data) according to the method, and searching for a matching position where the highest degree of approximation is obtained.First, the sharpness is determined according to the sharpness of the autocorrelation function of the reference image or a function similar thereto. The movement skip amount that increases as becomes dull, the approximation data is calculated for each movement skip amount, coarse position detection of matching is performed, and then, the captured image and the reference image around the coarse position. The pattern matching method is characterized in that the approximation degree data is calculated for each unit movement amount according to the arrangement pitch of the pixels forming the, and the precise position of the matching is detected.
【請求項2】 第2記憶手段は、基準画像を記憶する主
記憶部と、該基準画像を所定の縮小率で縮小した画像を
記憶する副記憶部とから構成し、前記移動ステップ量毎
に近似度データを算出して粗位置検出を行なう際には、
第2記憶手段の副記憶部から基準画像データを読み出す
と共に、第1記憶手段からは、前記副記憶部の画像の縮
小率に応じたスキップ量にて間欠的に撮影画像データを
読み出し、その後、精位置検出を行なう際は、第1記憶
手段から撮影画像データをスキップすることなく読み出
すと共に、第2記憶手段の主記憶部から基準画像データ
を読み出す請求項1に記載のパターンマッチング方法。
2. The second storage means includes a main storage unit for storing a reference image and a sub storage unit for storing an image obtained by reducing the reference image at a predetermined reduction ratio, and for each movement step amount. When calculating the approximation data and performing coarse position detection,
The reference image data is read from the sub storage unit of the second storage unit, and the captured image data is intermittently read from the first storage unit at a skip amount according to the reduction ratio of the image of the sub storage unit, and thereafter, 2. The pattern matching method according to claim 1, wherein when the precise position is detected, the captured image data is read out without skipping from the first storage unit and the reference image data is read out from the main storage unit of the second storage unit.
【請求項3】 第1の記憶手段に記憶されている対象物
体の撮影画像に、第2の記憶手段に記憶されている基準
画像を重ね合わせるパターンマッチング方法において、
第1画像記憶手段から読み出された撮影画像データと第
2記憶手段から読み出された基準画像データに基づい
て、撮影画像に対して基準画像を移動させつつ両画像の
相関係数或いはこれに準じた係数(近似度データ)を算出
し、最も高い近似度が得られるマッチング位置を捜し出
す方法であって、第2記憶手段は、基準画像を記憶する
主記憶部と、該基準画像を縮小した画像を記憶する副記
憶部とから構成し、副記憶部には、基準画像の自己相関
関数或いはこれに準じた関数の先鋭度に応じ、先鋭度が
鈍くなるにつれて減少する縮小率にて基準画像を記憶
し、先ず、第2記憶手段の副記憶部から基準画像データ
を読み出すと共に、第1記憶手段からは、前記副記憶部
の画像の縮小率に応じたスキップ量にて間欠的に撮影画
像データを読み出して、両画像データの近似度データを
算出して、マッチングの粗位置検出を行ない、その後、
前記粗位置の周囲にて、第1記憶手段及び第2記憶手段
の主記憶部から夫々撮影画像及び基準画像を読み出し
て、撮影画像及び基準画像を構成する画素の配列ピッチ
に応じた単位移動量毎に近似度データを算出して、マッ
チングの精位置検出を行なうことを特徴とするパターン
マッチング方法。
3. A pattern matching method for superimposing a reference image stored in a second storage unit on a captured image of a target object stored in a first storage unit,
Based on the captured image data read out from the first image storage means and the reference image data read out from the second storage means, while moving the reference image with respect to the captured image, the correlation coefficient of the two images or A method of calculating a similar coefficient (approximation degree data) and searching for a matching position where the highest degree of approximation is obtained, wherein the second storage means reduces the reference image and a main storage unit that stores the reference image. The sub-storage unit stores an image, and the sub-storage unit stores the reference image at a reduction rate that decreases as the sharpness decreases in accordance with the sharpness of the autocorrelation function of the reference image or a function equivalent thereto. First, the reference image data is read from the sub-storage unit of the second storage unit, and the captured image is intermittently read from the first storage unit at a skip amount according to the reduction ratio of the image of the sub-storage unit. Read the data To calculate the approximation degree data of both the image data, performs coarse position detection of the matching, then
Around the rough position, the picked-up image and the reference image are read from the main storage units of the first storage unit and the second storage unit, respectively, and the unit movement amount according to the arrangement pitch of the pixels forming the picked-up image and the reference image. A pattern matching method, characterized in that the approximation degree data is calculated for each time and the precise position of the matching is detected.
JP3267475A 1991-10-16 1991-10-16 Pattern matching method Expired - Fee Related JP3066137B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3267475A JP3066137B2 (en) 1991-10-16 1991-10-16 Pattern matching method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3267475A JP3066137B2 (en) 1991-10-16 1991-10-16 Pattern matching method

Publications (2)

Publication Number Publication Date
JPH05250475A true JPH05250475A (en) 1993-09-28
JP3066137B2 JP3066137B2 (en) 2000-07-17

Family

ID=17445362

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3267475A Expired - Fee Related JP3066137B2 (en) 1991-10-16 1991-10-16 Pattern matching method

Country Status (1)

Country Link
JP (1) JP3066137B2 (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08327322A (en) * 1995-05-24 1996-12-13 Samsung Electron Co Ltd Inspection of part mounting state of circuit board
JP2006127195A (en) * 2004-10-29 2006-05-18 Fujitsu Ltd Image sensor device and image sensor system
JP2006293870A (en) * 2005-04-13 2006-10-26 Yamatake Corp Image selection device and automatic focusing device
US7305664B2 (en) 2002-10-09 2007-12-04 Ricoh Company, Ltd. Apparatus, method, software and medium storage for performing the tasks of detecting specified marks
JP2010097437A (en) * 2008-10-16 2010-04-30 Keyence Corp Method for deciding image data reduction rate in image processing, positioning method for pattern model in image processing, creation method for pattern model in image processing, image processing apparatus, image processing program and computer-readable recording medium
US9746049B2 (en) 2006-04-02 2017-08-29 Fox Factory, Inc. Suspension damper having inertia valve and user adjustable pressure-relief

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08327322A (en) * 1995-05-24 1996-12-13 Samsung Electron Co Ltd Inspection of part mounting state of circuit board
US7305664B2 (en) 2002-10-09 2007-12-04 Ricoh Company, Ltd. Apparatus, method, software and medium storage for performing the tasks of detecting specified marks
JP2006127195A (en) * 2004-10-29 2006-05-18 Fujitsu Ltd Image sensor device and image sensor system
JP2006293870A (en) * 2005-04-13 2006-10-26 Yamatake Corp Image selection device and automatic focusing device
US9746049B2 (en) 2006-04-02 2017-08-29 Fox Factory, Inc. Suspension damper having inertia valve and user adjustable pressure-relief
US10359092B2 (en) 2006-04-02 2019-07-23 Fox Factory, Inc. Suspension damper having inertia valve and user adjustable pressure-relief
US11085503B2 (en) 2006-04-02 2021-08-10 Fox Factory, Inc. Suspension damper having inertia valve and user adjustable pressure-relief
JP2010097437A (en) * 2008-10-16 2010-04-30 Keyence Corp Method for deciding image data reduction rate in image processing, positioning method for pattern model in image processing, creation method for pattern model in image processing, image processing apparatus, image processing program and computer-readable recording medium

Also Published As

Publication number Publication date
JP3066137B2 (en) 2000-07-17

Similar Documents

Publication Publication Date Title
US7471809B2 (en) Method, apparatus, and program for processing stereo image
CN111369495B (en) Panoramic image change detection method based on video
CN108470356B (en) Target object rapid ranging method based on binocular vision
JPH07167649A (en) Distance measuring equipment
US6519358B1 (en) Parallax calculating apparatus, distance calculating apparatus, methods of the same, and information providing media
CN108369739B (en) Object detection device and object detection method
JP2001351193A (en) Device for detecting passenger
JP2006350465A (en) Image matching device, image matching method, and program for image matching
JP3066173B2 (en) Pattern matching method
JP3008875B2 (en) Subject extraction device
JP2002296010A (en) Own position identifying method using image
JPH05250475A (en) Pattern matching method
JPH07103734A (en) Apparatus for searching stereocorrespondence
CN111415327B (en) PCB image block sampling device and method based on correlation analysis
JPH06168331A (en) Patter matching method
TW202020732A (en) Objective identification method and device thereof
US6141439A (en) Apparatus for image measurement
JPH1096607A (en) Object detector and plane estimation method
US20040146194A1 (en) Image matching method, image matching apparatus, and wafer processor
JP2004240909A (en) Image processor and image processing method
JP2002536709A (en) Method and apparatus for calculating a similarity between a first structure and at least one preset second structure
WO2002077922A1 (en) Image detection method, image detection apparatus, and wafer treatment apparatus
JP2516844B2 (en) Parts detection method and device
JPH11223516A (en) Three dimensional image pickup device
JPH1063842A (en) Template matching method

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20000411

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080512

Year of fee payment: 8

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090512

Year of fee payment: 9

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090512

Year of fee payment: 9

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100512

Year of fee payment: 10

LAPS Cancellation because of no payment of annual fees