JPH05303643A - Pattern matching method - Google Patents

Pattern matching method

Info

Publication number
JPH05303643A
JPH05303643A JP4061679A JP6167992A JPH05303643A JP H05303643 A JPH05303643 A JP H05303643A JP 4061679 A JP4061679 A JP 4061679A JP 6167992 A JP6167992 A JP 6167992A JP H05303643 A JPH05303643 A JP H05303643A
Authority
JP
Japan
Prior art keywords
reference image
data
storage unit
image data
read
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
JP4061679A
Other languages
Japanese (ja)
Other versions
JP3066173B2 (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 JP4061679A priority Critical patent/JP3066173B2/en
Publication of JPH05303643A publication Critical patent/JPH05303643A/en
Application granted granted Critical
Publication of JP3066173B2 publication Critical patent/JP3066173B2/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 method requiring the shorter arithmetic operation time and presenting the accurate matching result. CONSTITUTION:In this pattern matching method, the correlation coefficient of both pictures is calculated while moving the reference picture against the photographing picture to provide the highest correlation coefficient. First, a correlation calculation position control means 3 decides the moving step amount according to the sharpness of the self correlation function of the reference picture. A correlation coefficient calculation means 5 calculates the correlation coefficient for each moving step to decide a candidate point of matching. Then, the correlation coefficient is calculated in positions less than one-half apart from the moving step amount around the candidate point. The correlation coefficient is calculated by unit moving amount according to picture element pitch to locate the real matching position around the next candidate point.

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 in the prior art and the exact matching position can be obtained.

【0007】[0007]

【課題を解決する為の手段】本発明に係るパターンマッ
チング方法は、第1記憶手段から読み出された撮影画像
データと第2記憶手段から読み出された基準画像データ
に基づいて、撮影画像に対して基準画像を移動させつつ
両画像の相関係数或いはこれに準じた係数(近似度デー
タ)を算出し、最も高い近似度データが得られるマッチ
ング位置を捜し出すものであって、基本的には次の3つ
の方法がある。
According to the pattern matching method of the present invention, a photographed image is formed on the basis of photographed image data read from the first storage means and reference image data read from the second storage means. On the other hand, while moving the reference image, the correlation coefficient of both images or a coefficient (similarity data) similar to this is calculated, and the matching position where the highest similarity data is obtained is searched for. There are three methods:

【0008】第1のパターンマッチング方法(図5、図
6) 第1ステップでは、基準画像の自己相関関数或いはこれ
に準じた関数の先鋭度に応じ、先鋭度が鈍くなるにつれ
て増大する移動ステップ量を決定し、該移動ステップ量
毎に近似度データを算出して、マッチングの候補点P1
を探索する。第2ステップでは、第1ステップによって
得られた候補点P1を中心として、周囲へ前記移動ステ
ップ量の2分の1の距離だけ拡大した輪郭上の複数の位
置P2での近似度データを算出し、次の候補点P3を探索
する手続きを、1或いは複数回繰り返す。第3ステップ
では、第2ステップによって得られた候補点P3を中心
とする所定領域にて、撮影画像及び基準画像を構成する
画素の配列ピッチに応じた単位移動量で近似度データを
算出し、真のマッチング位置を検出する。
The first pattern matching method (FIG. 5, FIG.
6) In the first step, a moving step amount that increases as the sharpness becomes dull is determined according to the sharpness of the autocorrelation function of the reference image or a function corresponding thereto, and the approximation data is calculated for each moving step amount. Calculate and match candidate point P 1
To explore. In the second step, calculated around the candidate point P 1 obtained by the first step, the approximation degree data at a plurality of positions P2 on the contour of an enlarged by a factor of 2 minutes of the moving step amount to the surroundings Then, the procedure for searching for the next candidate point P 3 is repeated one or more times. In the third step, in the predetermined area centered on the candidate point P 3 obtained in the second step, the degree-of-approach data is calculated with the unit movement amount according to the arrangement pitch of the pixels forming the captured image and the reference image. , Detect true matching position.

【0009】第2のパターンマッチング方法(図7) 第1ステップでは、基準画像の自己相関関数或いはこれ
に準じた関数の先鋭度に応じ、先鋭度が鈍くなるにつれ
て増大する移動ステップ量を決定し、マッチングの推定
位置P7を中心として、周囲へ前記移動ステップ量だけ
拡大した輪郭上の複数位置にて近似度データを算出し
て、これら複数位置から所定値以上の近似度データを有
するマッチング候補点P9を探索する。第2ステップで
は、前記第1ステップにて候補点が発見されない場合
に、前記探索領域を中心として、更に周囲へ前記移動ス
テップ量だけ移動した複数位置にて近似度データを算出
して、これら複数位置から所定値以上の近似度データを
有する候補点を探索する手続きを、候補点が発見される
まで繰り返す。第3ステップでは前記第1及び第2ステ
ップによって得られた候補点P9を中心とする所定領域
にて、撮影画像及び基準画像を構成する画素の配列ピッ
チに応じた単位移動量で近似度データを算出し、真のマ
ッチング位置P8 を検出する。
In the first step of the second pattern matching method (FIG. 7), the moving step amount that increases as the sharpness becomes dull is determined according to the sharpness of the autocorrelation function of the reference image or a function corresponding thereto. , Approximate matching position P 7 is the center, approximation degree data is calculated at a plurality of positions on the contour enlarged by the movement step amount to the surroundings, and matching candidates having approximation degree data of a predetermined value or more from these plurality of positions are calculated. Search for point P 9 . In the second step, if no candidate point is found in the first step, the approximation degree data is calculated at a plurality of positions further moved by the movement step amount to the surroundings with the search area as the center, and these approximation data are calculated. The procedure of searching for a candidate point having closeness data equal to or larger than a predetermined value from the position is repeated until the candidate point is found. In the third step, in the predetermined area centered on the candidate point P 9 obtained in the first and second steps, the approximation degree data is calculated in the unit movement amount according to the arrangement pitch of the pixels forming the captured image and the reference image. Is calculated and the true matching position P 8 is detected.

【0010】第3のパターンマッチング方法(図9) 第1ステップでは、基準画像の自己相関関数或いはこれ
に準じた関数の先鋭度に応じ、先鋭度が鈍くなるにつれ
て増大する移動ステップ量を決定し、該移動ステップ量
毎に近似度データを算出して、マッチングの候補点P
10を探索する。第2ステップでは、第1ステップによ
って得られた候補点P10を出発点として、近似度データ
が増大する方向へ所定のステップ量でマッチング位置の
探索を進め、最終的には、撮影画像及び基準画像を構成
する画素の配列ピッチに応じた単位移動量で近似度デー
タを算出し、真のマッチング位置P12を検出する。
In the first step of the third pattern matching method (FIG. 9) , a moving step amount that increases as the sharpness becomes dull is determined according to the sharpness of the autocorrelation function of the reference image or a function corresponding thereto. , The approximation degree data is calculated for each movement step amount, and the matching candidate point P is calculated.
Search for 10 . In the second step, using the candidate point P 10 obtained in the first step as a starting point, the matching position search is advanced by a predetermined step amount in the direction in which the approximation data increases, and finally, the captured image and the reference Approximation degree data is calculated with a unit movement amount according to the arrangement pitch of pixels forming an image, and the true matching position P 12 is detected.

【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 by hatching in FIG. 3B, the movement step amount when the correlation coefficient is calculated by shifting the reference image in the minor axis direction of the ellipse is If a setting is not made smaller than the movement step amount in the case of performing matching of a perfect circle that is painted as shown by hatching in FIG. 3A, the vicinity of the true matching position may be detected as a rough position. Can not. On the other hand, in the matching of a vertically long ellipse, the movement step amount when calculating the correlation coefficient by shifting the reference image in the long axis direction of the ellipse is set to be larger than the movement step 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 step 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 step 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 step 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】上記第1のマターンマッチング方法におい
ては、第1ステップにより粗位置検出が行なわれ、その
後の第2及び第3ステップにより精位置検出が行なわれ
る。精位置検出では、第2ステップにより、真のマッチ
ング位置に近い候補点P3が選択されるから、第3ステ
ップでの単位移動量による近似度データの計算領域を前
記候補点P3の近傍に縮小出来、これによって計算時間
の短縮が図られる。
In the first mattern matching method, coarse position detection is performed in the first step, and fine position detection is performed in the subsequent second and third steps. In the fine position detection, the candidate point P 3 close to the true matching position is selected in the second step. Therefore, the calculation area of the approximation data by the unit movement amount in the third step is set in the vicinity of the candidate point P 3 . The size can be reduced, and the calculation time can be shortened.

【0016】又、上記第2のパターンマッチング方法
は、マッチング位置の推定が可能な場合を対象するもの
で、第1及び第2ステップによてマッチング推定位置P
7の周囲で粗位置検出が行なわれ、その後の第3ステッ
プにより精位置検出が行なわれる。従って、粗位置検出
における計算領域が限定され、計算時間の短縮が図られ
る。
The second pattern matching method is intended for the case where the matching position can be estimated, and the estimated matching position P is obtained by the first and second steps.
Coarse position detection is performed around 7 , and fine position detection is performed in the subsequent third step. Therefore, the calculation area in the coarse position detection is limited, and the calculation time can be shortened.

【0017】更に、上記第3のパターンマッチング方法
においては、第1ステップにより粗位置検出が行なわ
れ、その後の第2ステップにより精位置検出が行なわれ
る。精位置検出では、先ず候補点P10を出発点とする所
謂山登り法により、真のマッチング位置へ向かって迅速
に探索が進められ、計算時間の短縮が図られる。
Further, in the third pattern matching method, coarse position detection is performed in the first step, and fine position detection is performed in the subsequent second step. In the fine position detection, the so-called hill-climbing method with the candidate point P 10 as the starting point is used to rapidly advance the search toward the true matching position, thereby shortening the calculation time.

【0018】[0018]

【発明の効果】本発明に係るパターンマッチングによれ
ば、粗位置検出において、基準画像の形状的特徴に応じ
た適度な粗さの精度で相関係数を計算することが出来る
ので、相関係数の演算回数は必要最小限に抑えることが
出来、且つその後の精位置検出を経ることによって、真
のマッチング位置を見逃すことなく、的確に捜し出すこ
とが出来る。
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.

【0019】[0019]

【実施例】以下、本発明の実施例を図面に沿って詳述す
る。図1は本発明を実施したパターンマッチング回路の
構成を示している。図示省略するカメラ等から取り込ま
れた撮影画像を記憶すべき画像メモリ(1)は、例えば、
1画素が8bitで画像サイズが512×512画素の画
像データの格納領域を有している。一方、基準画像(以
下、テンプレート画像という)を記憶すべきテンプレー
トメモリ(2)は、L×M(L,M:整数<512)画素
の大きさの画像データの格納領域を有している。
Embodiments of the present invention will now be described in detail 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) is, for example,
There is a storage area for image data in which one pixel is 8 bits and the image size is 512 × 512 pixels. On the other hand, the template memory (2) for storing a reference image (hereinafter referred to as a template image) has a storage area of image data having a size of L × M (L, M: integer <512) pixels.

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

【0021】画像読出し手段(4)は、相関計算位置制御
手段(3)によって指定されたアドレスに応じて、画像メ
モリ(1)及びテンプレートメモリ(2)から画像データを
読み出すものであって、これによって読み出された撮影
画像データ及びテンプレート画像データは相関係数計算
手段(5)へ送られて、所定の位置ずれにおける相関係数
が算出される。
The image reading means (4) reads 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.

【0022】ところで、一般に正規化相関係数(以下、
単に相関係数という)は以下のように与えられる。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]

【0023】撮影画像の内、マッチング対象の大きさを
X,Yとすると 1≦i≦X−L+1 1≦j≦Y−L+1 となる。
If the sizes of the matching target in the photographed image are X and Y, then 1≤i≤X-L + 1 1≤j≤Y-L + 1.

【0024】ここで仮に、マッチング対象X×Y画素の
全ての点についての相関係数を求めようとすれば、(X
−L+1)×(Y−M+1)個のCijを求めなければな
らず、長い演算時間を要することになる。
Here, if it is assumed that the correlation coefficients for all points of the X.times.Y pixel to be matched are to be obtained, (X
It is necessary to obtain −L + 1) × (Y−M + 1) Cij, which requires a long calculation time.

【0025】そこで、本発明では、図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 data (i, j) corresponding to the positional deviation of both images is given and the correlation coefficient Cij is calculated, the information regarding (i, j) and L, M is calculated by the correlation calculation position control means (3). To the 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 Cij is calculated based on the equation (1).

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

【0027】そして、その後の精位置検出においては、
最終的に、前記粗位置の周囲にて(i,j)を1ずつ増
加させて相関係数を計算し、相関係数が最大となる点、
即ち真のマッチング位置を捜し出すのである。
Then, in the subsequent precise position detection,
Finally, 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.

【0028】粗位置検出における移動ステップ量Xste
p、Ystepは後述の如く決定される。先ず、図2(a)に
示すテンプレート画像の周囲に、図2(b)の如くテンプ
レート画像の平均濃度値を1画素幅分加えた(L+2)
×(M+2)の大きさの拡張画像を設定する。
Movement step amount Xste in coarse position detection
p and Ystep 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.

【0029】次に、該拡張画像とテンプレート画像との
相関関数を求める。この相関関数はテンプレート画像の
自己相関関数に準じた関数となる。この場合、テンプレ
ート画像を拡張画像上の中心位置から上下左右及び斜め
方向へ夫々移動させることによって、図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.

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

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

【数7】Ystep=(1.0−A)/Ys ここで、## EQU00007 ## Ystep = (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

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

【0032】図4は、図3(c)及び(d)に示す正確な相
関関数ではなく、真のマッチング位置(相関関数のピー
ク位置)と、その両側へ1画素だけ位置がずれたときの
相関係数に基づいて直線近似を行なった近似的な相関関
数を示しており、本実施例では、該近似相関関数を前記
移動ステップ量Xstep、Ystepの算出に用いる。
FIG. 4 is not 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 step amounts Xstep and Ystep.

【0033】図4に示す如く、+x,−x方向で相関係
数の値がAとなる点のx方向の間隔をSとすると、この
Sは上記数8のXsと等価な値となり、一定ステップ量
Xstep=Sで相関係数を計算していけば、その計算結果
は、A以上の値となる確率が高いと言える。
As shown in FIG. 4, when the interval in the x direction between the points where the correlation coefficient value 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 step amount Xstep = S, it can be said that the calculation result has a high probability of being a value of A or more.

【0034】即ち、上記数6及び数7によって得られる
Xstep、Ystepの間隔ごとに撮影画像とテンプレート画
像の相関係数を計算すれば、相関係数の値が定数A以上
となる粗位置が高い確率で得られることになる。
That is, if the correlation coefficient between the photographed image and the template image is calculated at intervals of Xstep and Ystep 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.

【0035】尚、定数Aは必ずしも一定である必要はな
く、テンプレート画像と撮影画像の一致度が予め判明し
ている場合や、相関係数の値よりも演算時間を優先する
場合等においては、Xstep,Ystepに上限下限を設けた
り、或いは別の算出法によって設定することも可能であ
る。
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, It is also possible to set upper and lower limits for Xstep and Ystep, or to set them by another calculation method.

【0036】その後、精位置検出においては、上述の粗
位置検出によって得られた粗位置の周囲±(Xstep−
1)、±(Ystep−1)の範囲について、画素ピッチに
一致する単位ずれを設定して相関係数を計算し、その中
での最大の相関係数が得られた点をマッチング位置とす
ることが可能である。
Thereafter, in the fine position detection, the circumference of the rough position obtained by the above-mentioned rough position detection ± (Xstep−
1), within the range of ± (Ystep-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 the matching position. It is possible.

【0037】この場合、相関計算の演算回数Nは、In this case, the number of correlation calculations N is

【数10】 N=(X/Xstep)・(Y/Ystep)+(2Xstep-1)・(2Ystep-1)−1 に減少することになる。## EQU10 ## N = (X / Xstep) .multidot. (Y / Ystep) + (2Xstep-1) .multidot. (2Ystep-1) -1.

【0038】この回数は、粗位置検出を行なわず精位置
検出のみによってマッチング位置を捜し出す場合の演算
回数(X−L+1)・(Y−M+1)よりも遥かに少な
く、1つの撮影画像に対して複数のテンプレート画像を
マッチングする場合でも、演算時間は短く、リアルタイ
ムの位置検出が可能である。
This number is much smaller than the number of calculations (X-L + 1). (Y-M + 1) in the case of finding a matching position only by fine position detection without performing coarse position detection, and for one captured image. Even when a plurality of template images are matched, the calculation time is short and real-time position detection is possible.

【0039】ところで、本実施例では更に演算時間の短
縮を図るべく、次の3つのパターンマッチング方法を採
用する。
By the way, in this embodiment, the following three pattern matching methods are adopted in order to further reduce the calculation time.

【0040】第1のマッチング方法 図5(a)の如く、撮影画像(61)に対するマッチング位置
の探索において、前記の移動ステップ量Xstep、Ystep
の間隔で格子状に散在する複数の点P0毎に相関係数を
計算し、これらの点の中で最大の相関係数値を持つ点P
1を最初の候補点として選定する。
First Matching Method As shown in FIG. 5 (a), in searching for a matching position for the photographed image (61), the above-mentioned movement step amounts Xstep, Ystep.
The correlation coefficient is calculated for each of a plurality of points P 0 scattered in a grid pattern at intervals of, and the point P having the maximum correlation coefficient value among these points
Select 1 as the first candidate point.

【0041】次に、図5(b)の如く候補点P1を中心と
して、周囲へ夫々±Xstep/2、±Ystepだけ拡大した
8つ点P2について相関係数を計算し、前記候補点P1
前記8つの点P2の中で最大の相関係数を有する次の候
補点P3を選定する。
Next, as shown in FIG. 5 (b), the correlation coefficient is calculated for eight points P 2 centered on the candidate point P 1 and expanded by ± Xstep / 2 and ± Ystep, respectively, and the candidate points are calculated. The next candidate point P 3 having the largest correlation coefficient between P 1 and the above 8 points P 2 is selected.

【0042】その後、候補点P3の周囲±(Xstep/2−
1)、±(Ystep/2−1)の領域について、画素ピッチ
に一致する単位ずれを設定して相関係数を計算し、その
中での最大の相関係数が得られた点を選択すれば、その
点が真のマッチング位置となる。
Then, around the candidate point P 3 ± (Xstep / 2-
1), ± (Ystep / 2−1) area, set the unit deviation that matches the pixel pitch, calculate the correlation coefficient, and select the point of which the maximum correlation coefficient is obtained. If so, that point becomes the true matching position.

【0043】このときの演算回数Nは、The number of calculations N at this time is

【数11】 N=(X/Xstep)・(Y/Ystep)+8+(Xstep-1)・(Ystep-1)−1 に減少する。## EQU11 ## N = (X / Xstep) .multidot. (Y / Ystep) +8+ (Xstep-1) .multidot. (Ystep-1) -1.

【0044】上記数10から数11を引算した差Dは、
Xstep≧2,Ystep≧2であるとすると、
The difference D obtained by subtracting the equation 11 from the equation 10 is
If Xstep ≧ 2 and Ystep ≧ 2,

【数12】D=3Xstep・Ystep−Xstep−Ystep−8 =Xstep(3Ystep−1)−Ystep−8 ≧2(3Ystep−1)−Ystep−8 =5Ystep−10≧5・2−10=0(12) D = 3Xstep · Ystep−Xstep−Ystep−8 = Xstep (3Ystep−1) −Ystep−8 ≧ 2 (3Ystep−1) −Ystep−8 = 5Ystep−10 ≧ 5 · 2-10 = 0

【0045】従って、この差Dは必ず0以上になって、
数11の演算回数の方が少ないことが判る。
Therefore, this difference D must be 0 or more,
It can be seen that the number of calculations in the equation 11 is smaller.

【0046】尚ここでは、ステップ量を1/2に縮小す
る処理を1回だけ行なっているが、図5(b)の候補点P
3を中心として、更にステップ量を1/2に縮小しなが
ら探索を進め、ステップ量が画素ピッチに一致するまで
同様の計算を繰り返す方法も採用可能である。
Although the process of reducing the step amount to 1/2 is performed only once here, the candidate point P of FIG.
It is also possible to adopt a method in which the search is advanced while further reducing the step amount to 1/2 around 3, and the same calculation is repeated until the step amount matches the pixel pitch.

【0047】一方、図6(a)(b)は上記方法の変形例を
示したもので、図6(a)において、最初の候補点P1
中心として、斜め方向にXstep/2、Ystep/2だけ離
れた4点P4の相関係数を計算し、この中で最大の相関
係数を有する次の候補点P5を選定する。続いて図6
(b)に示すように、前記候補点P5の上下左右の4点P6
についての相関係数を計算し、最大の相関係数が得られ
る次の候補点を選定する。その後は、該候補点の周囲に
おいて、画素ピッチに一致する単位ずれで相関係数を計
算し、真のマッチング位置を検知するのである。
On the other hand, FIGS. 6 (a) and 6 (b) show a modified example of the above method. In FIG. 6 (a), Xstep / 2 and Ystep are obliquely formed around the first candidate point P 1. The correlation coefficient of four points P 4 separated by / 2 is calculated, and the next candidate point P 5 having the largest correlation coefficient is selected. Continuing with FIG.
As shown in (b), four points P 6 above, below, left and right of the candidate point P 5 are provided.
And the next candidate point that gives the maximum correlation coefficient is selected. After that, the correlation coefficient is calculated around the candidate point with a unit deviation that matches the pixel pitch, and the true matching position is detected.

【0048】尚、上記実施例では、テンプレート画像、
撮影画像をそのまま用いて相関計算を行っているが、テ
ンプレート画像を縮小した画像を縮小用テンプレートメ
モリに格納しておき、画像メモリから撮影画像を読み出
す時に画像読みだし手段によってアドレスをスキップし
ながら、読み出す方法も採用可能である。
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.

【0049】即ち、予めテンプレート画像の隣接する4
画素の内、1画素を抽出し、或いは4画素の平均値を取
り出すことによって、1/4に縮小した縮小テンプレー
ト画像を作成し、これを縮小用テンプレートメモリに記
憶しておく。そして、粗位置検出においては、上記縮小
用テンプレートメモリから縮小テンプレート画像データ
を読み出すと共に、画像メモリから撮影画像データを
x,y方向に夫々2画素置きに読み出し、これによって
データ量を夫々1/4に減らして相関係数の計算を行
う。
That is, 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.

【0050】その後、精位置検出においては、粗位置検
出によって得られた候補点の周囲について、縮小してい
ない標準のテンプレート画像と撮影画像の間で相関係数
の計算を行い、真のマッチング位置を捜し出すのであ
る。この結果、更に演算回数が減少することになる。
Thereafter, in the fine position detection, the correlation coefficient is calculated between the standard template image that has not been reduced and the photographed image around the candidate points 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.

【0051】又、他のパターンマッチング方法として、
上記同様に縮小用テンプレートメモリを用意し、その画
像の縮小率を、自己相関関数の分布の先鋭度に応じ、先
鋭度が鈍くなるにつれて減少する値に設定して、該縮小
率にて基準画像を記憶し、粗位置検出においては、縮小
用テンプレートメモリから画像データをスキップするこ
となく読み出すと共に、画像メモリからは前記縮小率に
応じたステップ量にて画像データを読み出し、両画像デ
ータの相関係数を算出する方法も採用可能である。
As another pattern matching method,
Similar to the above, a reduction template memory is prepared, and the reduction ratio 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 ratio. 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 at a step amount corresponding to the reduction ratio, and the correlation between the two image data is stored. A method of calculating the number can also be adopted.

【0052】更に、荒位置検出においては、縮小率が異
なる複数のテンプレートを用意し、ステップ量を1/2
に短縮する度に、より縮小率の小さいテンプレートに順
次切換えると共に、画像メモリからは、そのときの縮小
率に応じたステップ量にて間欠的に撮影画像データを読
み出す。例えば1/4に縮小したテンプレートを用いる
場合、撮影画像データは2画素おきに読み出す。そし
て、精位置検出においては、画像メモリから撮影画像デ
ータをスキップすることなく読み出すと共に、テンプレ
ートは縮小していない標準のものを使用する方法も可能
である。
Furthermore, in rough position detection, a plurality of templates having different reduction rates are prepared, and the step amount is reduced to 1/2.
Each time it is shortened to, the template is sequentially switched to a smaller reduction ratio, and the photographed image data is intermittently read from the image memory at a step amount according to the reduction ratio at that time. For example, when using a template reduced to 1/4, the captured image data is read every two pixels. Then, in the precise position detection, it is possible to read the captured image data from the image memory without skipping and use a standard template which is not reduced.

【0053】これによって、荒位置検出における演算時
間を更に短縮することが出来る。この場合、ステップ量
の短縮につれてテンプレートの縮小率を小さくするの
は、ステップ量が小さい時に縮小率を大きくして計算を
進めると、間違った候補点を選ぶ可能性があるからであ
る。
As a result, it is possible to further reduce the calculation time in rough position detection. In this case, the reduction rate of the template is decreased as the step amount is shortened, because if the reduction rate is increased and the calculation is advanced when the step amount is small, a wrong candidate point may be selected.

【0054】第2のマッチング方法 この方法は、予めマッチング位置のおおよその位置が分
っている場合に有効であって、図7の如く、真のマッチ
ング位置P8はマッチング推定位置P7の近傍に存在して
いる可能性が高いから、該マッチング推定位置P7を中
心として、先ず粗位置検出を行なうのである。
Second Matching Method This method is effective when the approximate position of the matching position is known in advance. As shown in FIG. 7, the true matching position P 8 is near the estimated matching position P 7 . Therefore, the coarse position detection is first performed with the estimated matching position P 7 as the center.

【0055】即ち、マッチング推定位置P7を中心とし
て、前述のテンプレートの自己相関から定めたX、Y方
向の移動ステップ量Xstep、Ystepを用いて、図7中に
破線で示す如く±Xstep、 ±Ystepだけ拡大した範囲
を第1の探索領域に設定する。そして、同領域内にてX
step、Ystepの間隔で相関係数を計算することで、前記
定数A以上の相関係数を有するマッチング候補点P9
探索する。
That is, by using the moving step amounts Xstep and Ystep in the X and Y directions determined from the autocorrelation of the template with the matching estimated position P 7 as the center, ± Xstep, ± as shown by the broken line in FIG. The range expanded by Ystep is set as the first search area. Then, within the same area, X
By calculating the correlation coefficient at intervals of step and Ystep, a matching candidate point P 9 having a correlation coefficient equal to or larger than the constant A is searched for.

【0056】もし、前記領域内で前記定数A以上の相関
係数を有するマッチング候補点が発見されなければ、第
2の探索領域として、破線の範囲を更に周囲へXstep、
Ystepだけ領域を拡大してマッチング候補点の探索を進
める。
If no matching candidate point having a correlation coefficient equal to or larger than the constant A is found in the area, the second search area is set to Xstep around the range of the broken line,
The area is expanded by Ystep to advance the search for matching candidate points.

【0057】この様にしてマッチング候補点P9が発見
されると、最後に、該マッチング候補点P9を中心とし
て、±(Xstep−1)、±(Ystep−1)の領域内で、画素
ピッチに一致する単位ずれで相関係数を計算し、真のマ
ッチング位置P8を検知するのである。
When the matching candidate point P 9 is found in this manner, finally, in the area of ± (Xstep-1), ± (Ystep-1) with the matching candidate point P 9 as the center, The true matching position P 8 is detected by calculating the correlation coefficient with a unit deviation that matches the pitch.

【0058】ここで、前記定数Aは必ずしも一定である
必要はなく、テンプレートと撮影画像の近似度が予め分
かっている場合や、演算時間を優先したい場合には、X
step、Ystepに上限、下限を設ける等、他の設定方法も
可能である。更に、探索領域の設定の方法も図示する例
の様な矩形領域に限らず、円形領域でも可い。
Here, the constant A does not necessarily have to be constant, and when the degree of approximation between the template and the photographed image is known in advance or when it is desired to give priority to the calculation time, X
Other setting methods such as setting upper and lower limits for step and Ystep are also possible. Furthermore, the method of setting the search area is not limited to the rectangular area as in the illustrated example, and may be a circular area.

【0059】上記マッチング方法によれば、演算回数N
は、最初に設定された探索領域内にマッチング位置が存
在する場合、
According to the above matching method, the number of calculations N
Is a matching position within the initially set search area,

【数13】N=9+(2Xstep-1)・(2Ystep-1) と、著しく減少する。[Equation 13] N = 9 + (2Xstep-1) · (2Ystep-1), which is a significant decrease.

【0060】仮に探索領域が拡張され続けて、最終的に
撮影画像(61)と同一になったとしても、演算回数Nは、
Even if the search area continues to be expanded and finally becomes the same as the photographed image (61), the number of calculations N is

【数14】 N=(X/Xstep)・(Y/Ystep)+(2Xstep−1)・(2Ystep−1)−1 に抑えられる。## EQU14 ## N = (X / Xstep) .multidot. (Y / Ystep) + (2Xstep-1) .multidot. (2Ystep-1) -1.

【0061】尚、上記の例では、候補点P9を発見する
ための粗位置検出にて、テンプレート画像及び撮影画像
をそのまま用いて相関計算を行なっているが、前述の縮
小テンプレート及びスキップ読出しによる検索も可能で
ある。
In the above example, in the coarse position detection for finding the candidate point P 9 , the correlation calculation is performed by using the template image and the photographed image as they are. You can also search.

【0062】又、候補点P9が発見された後の精位置検
出に際しても、最初から±(Xstep/2−1)、±(Yste
p/2−1)の範囲内の全ての点で相関係数を計算するの
ではなく、第1のマッチング方法の如く適当な刻み幅を
設けて、その刻み幅ごとに相関係数を計算して次の候補
点を探索し、領域の限定を進める方法も採用出来る。
Also, when detecting the precise position after the candidate point P 9 is discovered, ± (Xstep / 2−1), ± (Yste
Instead of calculating the correlation coefficient at all points within the range of p / 2-1), an appropriate step size is provided as in the first matching method, and the correlation coefficient is calculated for each step size. It is also possible to employ a method of searching for the next candidate point and then limiting the area.

【0063】更に、候補点P9はマッチング位置P8へ至
る検索には、後述の所謂山登り法を採用することも可能
である。
Furthermore, the so-called hill-climbing method, which will be described later, can be adopted for the search for the candidate point P 9 to reach the matching position P 8 .

【0064】第3のマッチング方法 この方法は、テンプレートの自己相関から定めたX、Y
方向の移動ステップ量Xstep、Ystepの設定によって、
図9に示す如くマッチングの候補点P10が発見された後
に、所謂山登り法によってマッチング位置P12へ至る探
索に関するものである。
Third Matching Method This method uses X, Y determined from template autocorrelation.
By setting the moving step amount Xstep and Ystep in the direction,
As shown in FIG. 9, it relates to a search for reaching the matching position P 12 by the so-called hill climbing method after the matching candidate point P 10 is found.

【0065】ここでは、図8に示す如く、例えば3×3
の9画素に対応する矩形マスク(21)を想定する。図示す
る矩形マスク(21)内の数字はマスクの中心から見た方向
を表わしている。
Here, as shown in FIG. 8, for example, 3 × 3
Assume a rectangular mask (21) corresponding to 9 pixels. The numbers in the rectangular mask (21) shown in the figure represent the directions viewed from the center of the mask.

【0066】探索においては、図9の如く候補点P10
中心となる様に矩形マスク(21)を撮影画像(61)に重ね合
わせ、該マスク内の周囲8点(方向番号1〜8)の相関
係数を計算し、最大となる方向を求める。ここでは、8
つの相関係数の内、マッチング位置P12に最も近い方向
番号8の点P11が最大となる。
In the search, as shown in FIG. 9, the rectangular mask (21) is superposed on the photographed image (61) so that the candidate point P 10 becomes the center, and eight peripheral points (direction numbers 1 to 8) in the mask. The correlation coefficient of is calculated to find the maximum direction. Here, 8
Of the two correlation coefficients, the point P 11 having the direction number 8 closest to the matching position P 12 is the maximum.

【0067】そこで、次は前記の点P11が中心となる様
に矩形マスク(21)を移動し、再びマスク内の相関係数を
計算する。この際、既に計算済みの点についての重複計
算は省略出来る。そして、同様に相関係数が最大となる
方向を求め、マスクを移動する。
Then, next, the rectangular mask (21) is moved so that the point P 11 becomes the center, and the correlation coefficient in the mask is calculated again. At this time, it is possible to omit duplicate calculation for points that have already been calculated. Then, similarly, the direction in which the correlation coefficient becomes maximum is obtained, and the mask is moved.

【0068】以上の手続きを繰り返し、矩形マスク(21)
中心点の相関係数がマスク周囲の8つの点の相関係数よ
りも大きくなれば、その位置がマッチング位置P12とな
る。
By repeating the above procedure, the rectangular mask (21)
If the correlation coefficient of the central point becomes larger than the correlation coefficients of the eight points around the mask, that position becomes the matching position P 12 .

【0069】ここで、相関計算の演算回数は、候補点の
探索に際して、(X/Xstep)・(Y/Ystep)回、その後
の山登り探索においては、マスクが斜め方向に一回移動
する度に最大5点の相関係数を計算するとして、n回の
マスク移動が行なわれた場合、(8+5n)回となる。但
し、マッチング位置P12は、候補点P10の周囲±(Xste
p−1)、±(Ystep−1)の範囲内に存在するから、マス
ク移動回数nには下式が成立する。
Here, the number of times of calculation of the correlation calculation is (X / Xstep) .multidot. (Y / Ystep) times in searching the candidate points, and in the subsequent hill climbing search, each time the mask moves diagonally once. Assuming that a maximum of five correlation coefficients are calculated, if the mask is moved n times, it will be (8 + 5n) times. However, matching position P 12, the periphery of the candidate point P 10 ± (Xste
Since it exists within the range of p-1) and ± (Ystep-1), the following formula is established for the mask movement number n.

【0070】[0070]

【数15】n≦Max(Xstep−1,Ystep−1)(15) n ≦ Max (Xstep-1, Ystep-1)

【0071】従って、相関計算の演算回数Nは、Therefore, the number of operations N of the correlation calculation is

【数16】 N=(X/Xstep)・(Y/Ystep)+5×Max(Xstep−1,Ystep−1)+8 に抑えられる。## EQU16 ## N = (X / Xstep) .multidot. (Y / Ystep) + 5.times.Max (Xstep-1, Ystep-1) +8.

【0072】上記の例では、マスク移動後の相関係数の
計算に際して、未計算の5点を全て計算しているが、移
動方向に並ぶ3点、図9の例では方向番号7、8、1の
3点でも十分である。これによって更に演算回数を減少
させることが出来る。
In the above example, when calculating the correlation coefficient after moving the mask, all five uncalculated points are calculated. However, three points lined up in the moving direction, direction numbers 7 and 8 in the example of FIG. 3 points of 1 is enough. As a result, the number of calculations can be further reduced.

【0073】又、マスクに関しては、上記の3×3サイ
ズでは一画素ずつのマスク移動になるが、さらに大きな
マスクを用いれば、数画素ずつ移動出来るから、最初は
大きなマスクを用いて大まかに探索し、マッチング位置
に近づいてからマスクを小さくして、詳細に探索する方
法も採用可能である。
Regarding the mask, in the above 3 × 3 size, the mask is moved pixel by pixel, but if a larger mask is used, it can be moved by several pixels. Therefore, at first, a large mask is used for a rough search. However, it is also possible to employ a method in which the mask is made smaller after approaching the matching position to perform a detailed search.

【0074】上記パターンマッチング方法によれば、先
ず、テンプレート画像の形状的特徴に応じた粗さで相関
係数を計算することによって、マッチング位置近傍の候
補点を発見し、その後、該候補点の近傍にて効率的な探
索が行なわれるから、計算時間の大幅な短縮が可能であ
る。
According to the above pattern matching method, first, a candidate point in the vicinity of the matching position is found by calculating the correlation coefficient with the roughness according to the shape feature of the template image, and then the candidate point Since an efficient search is performed in the vicinity, the calculation time can be greatly reduced.

【0075】上記実施例の説明は、本発明を説明するた
めのものであって、特許請求の範囲に記載の発明を限定
し、或は範囲を減縮する様に解すべきではない。又、本
発明の各部構成は上記実施例に限らず、特許請求の範囲
に記載の技術的範囲内で種々の変形が可能であることは
勿論である。
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 reducing 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.

【0076】例えば上記実施例では、近似度を表わす指
標として相関係数及び相関関数を用いているが、これに
準じた他の係数及び関数を定義して用いることも可能で
ある。又、上述の複数のマッチング方法を組み合わせた
探索方法も採用出来る。
For example, in the above 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. Also, a search method combining a plurality of the above-mentioned matching methods can be adopted.

【図面の簡単な説明】[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.

【図5】第1のマッチング方法における探索過程を示す
図である。
FIG. 5 is a diagram showing a search process in the first matching method.

【図6】第1のマッチング方法の変形例における探索過
程を示す図である。
FIG. 6 is a diagram showing a search process in a modified example of the first matching method.

【図7】第2のマッチング方法における探索過程を示す
図である。
FIG. 7 is a diagram showing a search process in the second matching method.

【図8】第3のマッチング方法に用いる矩形マスクの平
面図である。
FIG. 8 is a plan view of a rectangular mask used in a third matching method.

【図9】第3のマッチング方法における探索過程を示す
図である。
FIG. 9 is a diagram showing a search process in a third matching method.

【符号の説明】[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 (6)

【特許請求の範囲】[Claims] 【請求項1】 第1の記憶手段に記憶されている対象物
体の撮影画像に、第2の記憶手段に記憶されている基準
画像を重ね合わせるパターンマッチング方法において、
第1記憶手段から読み出された撮影画像データと第2記
憶手段から読み出された基準画像データに基づいて、撮
影画像に対して基準画像を移動させつつ両画像の相関係
数或いはこれに準じた係数(近似度データ)を算出し、最
も高い近似度データが得られるマッチング位置を捜し出
す方法であって、 基準画像の自己相関関数或いはこれに準じた関数の先鋭
度に応じ、先鋭度が鈍くなるにつれて増大する移動ステ
ップ量を決定し、該移動ステップ量毎に近似度データを
算出して、マッチングの候補点を探索する第1ステップ
と、 第1ステップによって得られた候補点を中心として、周
囲へ前記移動ステップ量の2分の1の距離だけ拡大した
輪郭上の複数の位置での近似度データを算出し、次の候
補点を探索する手続きを、1或いは複数回繰り返す第2
ステップと、 第2ステップによって得られた候補点を中心とする所定
領域にて、撮影画像及び基準画像を構成する画素の配列
ピッチに応じた単位移動量で近似度データを算出し、真
のマッチング位置を検出する第3ステップとを有するこ
とを特徴とするパターンマッチング方法。
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 photographed image data read from the first storage means and the reference image data read from the second storage means, the reference image is moved with respect to the photographed image while the correlation coefficient between the two images or a similar one It is a method of calculating the coefficient (approximity data) and finding the matching position where the highest approximation data is obtained.The sharpness becomes dull depending on the sharpness of the autocorrelation function of the reference image or a function based on it. The moving step amount that increases as is determined, the approximation degree data is calculated for each moving step amount, the first step of searching for a candidate point for matching, and the candidate point obtained by the first step as the center, The procedure of calculating the degree of approximation data at a plurality of positions on the contour expanded to the surroundings by a distance ½ of the movement step amount and searching for the next candidate point is repeated one or more times. Second
In the step and the predetermined area centered on the candidate point obtained in the second step, the approximation data is calculated by the unit movement amount according to the arrangement pitch of the pixels forming the captured image and the reference image, and true matching is performed. And a third step of detecting a position.
【請求項2】 第2記憶手段は、基準画像を記憶する主
記憶部と、該基準画像を複数種類の縮小率で縮小した複
数の画像を記憶する副記憶部とから構成し、前記第1ス
テップでは、第2記憶手段の副記憶部から縮小率の最も
大きな基準画像データを読み出すと共に、第1記憶手段
からは、前記縮小率に応じたステップ量にて間欠的に撮
影画像データを読み出し、前記第2ステップでは、前記
移動ステップ量の2分の1の距離だけ移動する度に、縮
小率の小さい画像データに順次切り換えると共に、第1
記憶手段からは、該縮小率に応じたステップ量にて間欠
的に撮影画像データを読み出し、前記第3ステップで
は、第1記憶手段から撮影画像データをスキップするこ
となく読み出すと共に、第2記憶手段の主記憶部から基
準画像データを読み出す請求項1に記載のパターンマッ
チング方法。
2. The second storage means comprises a main storage unit for storing a reference image and a sub-storage unit for storing a plurality of images obtained by reducing the reference image at a plurality of reduction ratios. In the step, the reference image data having the largest reduction rate is read from the sub storage unit of the second storage unit, and the photographed image data is intermittently read from the first storage unit at a step amount corresponding to the reduction rate. In the second step, the image data having a smaller reduction ratio is sequentially switched every time the image data is moved by a distance of ½ of the moving step amount.
The photographed image data is intermittently read from the storage means by a step amount according to the reduction ratio, and in the third step, the photographed image data is read from the first storage means without skipping and the second storage means. The pattern matching method according to claim 1, wherein the reference image data is read from the main storage unit of the.
【請求項3】 第1の記憶手段に記憶されている対象物
体の撮影画像に、第2の記憶手段に記憶されている基準
画像を重ね合わせるパターンマッチング方法において、
第1記憶手段から読み出された撮影画像データと第2記
憶手段から読み出された基準画像データに基づいて、撮
影画像に対して基準画像を移動させつつ両画像の相関係
数或いはこれに準じた係数(近似度データ)を算出し、最
も高い近似度データが得られるマッチング位置を捜し出
す方法であって、 基準画像の自己相関関数或いはこれに準じた関数の先鋭
度に応じ、先鋭度が鈍くなるにつれて増大する移動ステ
ップ量を決定し、マッチングの推定位置を中心として、
周囲へ前記移動ステップ量だけ拡大した輪郭上の複数位
置にて近似度データを算出して、これら複数位置から所
定値以上の近似度データを有するマッチング候補点を探
索する第1ステップと、 第1ステップにて候補点が発見されない場合は、前記探
索領域を中心として、更に周囲へ前記移動ステップ量だ
け拡大した輪郭上の複数位置にて近似度データを算出し
て、これら複数位置から所定値以上の近似度データを有
する候補点を探索する手続きを、候補点が発見されるま
で繰り返す第2ステップと、 第1及び第2ステップによって得られた候補点を中心と
する所定領域にて、撮影画像及び基準画像を構成する画
素の配列ピッチに応じた単位移動量で近似度データを算
出し、真のマッチング位置を検出する第3ステップとを
有することを特徴とするパターンマッチング方法。
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 photographed image data read from the first storage means and the reference image data read from the second storage means, the reference image is moved with respect to the photographed image while the correlation coefficient between the two images or a similar one It is a method of calculating the coefficient (approximity data) and finding the matching position where the highest approximation data is obtained.The sharpness becomes dull depending on the sharpness of the autocorrelation function of the reference image or a function based on it. The moving step amount that increases as is determined, centered on the estimated position of matching,
A first step of calculating approximation degree data at a plurality of positions on the contour expanded to the surroundings by the movement step amount, and searching for matching candidate points having approximation degree data of a predetermined value or more from these plurality of positions; If no candidate point is found in the step, the approximation data is calculated at a plurality of positions on the contour centered around the search area and further expanded by the movement step amount to the surroundings, and a predetermined value or more is calculated from these plurality of positions. In a predetermined area centered on the candidate point obtained by the first and second steps And a third step of calculating the degree-of-approach data with a unit movement amount according to the arrangement pitch of the pixels forming the reference image, and detecting a true matching position. Pattern matching method to.
【請求項4】 第2記憶手段は、基準画像を記憶する主
記憶部と、該基準画像を所定の縮小率で縮小した画像を
記憶する副記憶部とから構成し、前記第1ステップ及び
第2ステップでは、第2記憶手段の副記憶部から画像デ
ータを読み出すと共に、第1記憶手段からは、前記縮小
率に応じたスキップ量にて間欠的に撮影画像データを読
み出し、前記第3ステップでは、第1記憶手段から撮影
画像データをスキップすることなく読み出すと共に、第
2記憶手段の主記憶部から基準画像データを読み出す請
求項3に記載のパターンマッチング方法。
4. The second storage means comprises 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. In the second step, the 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 with a skip amount according to the reduction ratio. In the third step, 4. The pattern matching method according to claim 3, wherein the captured image data is read from the first storage means without skipping, and the reference image data is read from the main storage unit of the second storage means.
【請求項5】 第1の記憶手段に記憶されている対象物
体の撮影画像に、第2の記憶手段に記憶されている基準
画像を重ね合わせるパターンマッチング方法において、
第1記憶手段から読み出された撮影画像データと第2記
憶手段から読み出された基準画像データに基づいて、撮
影画像に対して基準画像を移動させつつ両画像の相関係
数或いはこれに準じた係数(近似度データ)を算出し、最
も高い近似度データが得られるマッチング位置を捜し出
す方法であって、 基準画像の自己相関関数或いはこれに準じた関数の先鋭
度に応じ、先鋭度が鈍くなるにつれて増大する移動ステ
ップ量を決定し、該移動ステップ量毎に近似度データを
算出して、マッチングの候補点を探索する第1ステップ
と、 第1ステップによって得られた候補点を出発点として、
近似度データが増大する方向へ所定のステップ量でマッ
チング位置の探索を進め、最終的には、撮影画像及び基
準画像を構成する画素の配列ピッチに応じた単位移動量
で近似度データを算出し、真のマッチング位置を検出す
る第2ステップとを有することを特徴とするパターンマ
ッチング方法。
5. A pattern matching method for overlaying a reference image stored in a second storage means on a captured image of a target object stored in a first storage means,
Based on the captured image data read out from the first storage means and the reference image data read out from the second storage means, the reference image is moved with respect to the captured image while the correlation coefficient of the two images or equivalent thereto. It is a method of calculating the coefficient (approximation degree data) and finding the matching position where the highest approximation degree data is obtained. The moving step amount that increases as is determined, the approximation data is calculated for each moving step amount, and the first step of searching for a candidate point for matching, and the candidate point obtained by the first step as a starting point. ,
The matching position search is advanced in a predetermined step amount in the direction in which the approximation data increases, and finally the approximation data is calculated with a unit movement amount according to the arrangement pitch of the pixels forming the captured image and the reference image. And a second step of detecting a true matching position, the pattern matching method.
【請求項6】 第2記憶手段は、基準画像を記憶する主
記憶部と、該基準画像を所定の縮小率で縮小した画像を
記憶する副記憶部とから構成し、前記第1ステップで
は、第2記憶手段の副記憶部から画像データを読み出す
と共に、第1記憶手段からは、前記縮小率に応じたスキ
ップ量にて間欠的に撮影画像データを読み出し、前記第
2ステップでは、第1記憶手段から撮影画像データをス
キップすることなく読み出すと共に、第2記憶手段の主
記憶部から基準画像データを読み出す請求項5に記載の
パターンマッチング方法。
6. The second storage means comprises 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. In the first step, The image data is read out from the sub storage unit of the second storage unit, and the captured image data is read out intermittently from the first storage unit at a skip amount according to the reduction ratio. In the second step, the first storage unit is used. 6. The pattern matching method according to claim 5, wherein the captured image data is read out without skipping from the means, and the reference image data is read out from the main storage section of the second storage means.
JP4061679A 1992-03-18 1992-03-18 Pattern matching method Expired - Fee Related JP3066173B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4061679A JP3066173B2 (en) 1992-03-18 1992-03-18 Pattern matching method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4061679A JP3066173B2 (en) 1992-03-18 1992-03-18 Pattern matching method

Publications (2)

Publication Number Publication Date
JPH05303643A true JPH05303643A (en) 1993-11-16
JP3066173B2 JP3066173B2 (en) 2000-07-17

Family

ID=13178193

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4061679A Expired - Fee Related JP3066173B2 (en) 1992-03-18 1992-03-18 Pattern matching method

Country Status (1)

Country Link
JP (1) JP3066173B2 (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2003027956A1 (en) * 2001-09-25 2003-04-03 Matsushita Electric Industrial Co., Ltd. Parameter estimation apparatus and data collating apparatus
JP2005062910A (en) * 2002-07-02 2005-03-10 Honda Motor Co Ltd Image recognition device
US7221777B2 (en) 2002-07-02 2007-05-22 Honda Giken Kogyo Kabushiki Kaisha Image analysis device
JP2007257212A (en) * 2006-03-22 2007-10-04 Toyota Motor Corp Image recognition device and method
JP2008102814A (en) * 2006-10-20 2008-05-01 Hitachi Ltd Object detection method
JP2010516003A (en) * 2007-01-12 2010-05-13 クゥアルコム・インコーポレイテッド Panorama image technology
JP4651876B2 (en) * 2001-07-19 2011-03-16 富士通株式会社 PATTERN IDENTIFICATION DEVICE, PATTERN IDENTIFICATION METHOD, AND PATTERN IDENTIFICATION PROGRAM
WO2015136709A1 (en) * 2014-03-14 2015-09-17 オムロン株式会社 Image processing device, image sensor, and image processing method
JP2016176800A (en) * 2015-03-19 2016-10-06 株式会社安藤・間 Displacement or strain calculating program, and displacement or strain measuring method
JP2018014064A (en) * 2016-07-19 2018-01-25 Gft株式会社 Position measuring system of indoor self-propelled robot

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6684475B2 (en) 2017-03-13 2020-04-22 オムロン株式会社 Image processing apparatus, image processing method and program

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4651876B2 (en) * 2001-07-19 2011-03-16 富士通株式会社 PATTERN IDENTIFICATION DEVICE, PATTERN IDENTIFICATION METHOD, AND PATTERN IDENTIFICATION PROGRAM
US7224823B2 (en) 2001-09-25 2007-05-29 Matsushita Electric Industrial Co., Ltd. Parameter estimation apparatus and data matching apparatus
WO2003027956A1 (en) * 2001-09-25 2003-04-03 Matsushita Electric Industrial Co., Ltd. Parameter estimation apparatus and data collating apparatus
JP2005062910A (en) * 2002-07-02 2005-03-10 Honda Motor Co Ltd Image recognition device
US7221777B2 (en) 2002-07-02 2007-05-22 Honda Giken Kogyo Kabushiki Kaisha Image analysis device
JP2007257212A (en) * 2006-03-22 2007-10-04 Toyota Motor Corp Image recognition device and method
JP4724638B2 (en) * 2006-10-20 2011-07-13 株式会社日立製作所 Object detection method
JP2008102814A (en) * 2006-10-20 2008-05-01 Hitachi Ltd Object detection method
JP2010516003A (en) * 2007-01-12 2010-05-13 クゥアルコム・インコーポレイテッド Panorama image technology
US8331725B2 (en) 2007-01-12 2012-12-11 Qualcomm Incorporated Panoramic imaging techniques
WO2015136709A1 (en) * 2014-03-14 2015-09-17 オムロン株式会社 Image processing device, image sensor, and image processing method
CN106062819A (en) * 2014-03-14 2016-10-26 欧姆龙株式会社 Image processing device, image sensor, and image processing method
JPWO2015136709A1 (en) * 2014-03-14 2017-04-06 オムロン株式会社 Image processing apparatus, image sensor, and image processing method
CN106062819B (en) * 2014-03-14 2019-05-10 欧姆龙株式会社 Image processing apparatus, imaging sensor, image processing method
US10311564B2 (en) 2014-03-14 2019-06-04 Omron Corporation Image processing device, image sensor, and image processing method
JP2016176800A (en) * 2015-03-19 2016-10-06 株式会社安藤・間 Displacement or strain calculating program, and displacement or strain measuring method
JP2018014064A (en) * 2016-07-19 2018-01-25 Gft株式会社 Position measuring system of indoor self-propelled robot

Also Published As

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

Similar Documents

Publication Publication Date Title
JP2518578B2 (en) Scene recognition device and scene recognition method
US7512270B2 (en) Method of image segmentation
US20030035098A1 (en) Pose estimation method and apparatus
JP4521235B2 (en) Apparatus and method for extracting change of photographed image
KR19990067567A (en) Vector Correlation System for Automatic Positioning of Patterns in Images
JP2002516440A (en) Image recognition and correlation system
JPH07129770A (en) Image processor
JPH1021389A (en) Template matching method and device for the method
JP3066173B2 (en) Pattern matching method
JP3193240B2 (en) Image processing device
CN112329880A (en) Template fast matching method based on similarity measurement and geometric features
CN107423738A (en) A kind of paper topic localization method and device based on template matches
JP2004012429A (en) Self-position/attitude identification device and self-position/attitude identification method
JPH10301948A (en) Method for retrieving image and video
JP3066137B2 (en) Pattern matching method
JP2981382B2 (en) Pattern matching method
JPH06168331A (en) Patter matching method
JP6278757B2 (en) Feature value generation device, feature value generation method, and program
JP2002536709A (en) Method and apparatus for calculating a similarity between a first structure and at least one preset second structure
JP2516844B2 (en) Parts detection method and device
JP2017004052A (en) Learning device, method, and program
CN114783041B (en) Target object recognition method, electronic device, and computer-readable storage medium
JP2005072840A (en) Moving body detector
JPH1139477A (en) Corresponding point search device
JP2000348175A (en) Method and device for corresponding point detection

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