JP6682167B2 - Template matching device, method, and program - Google Patents

Template matching device, method, and program Download PDF

Info

Publication number
JP6682167B2
JP6682167B2 JP2019070422A JP2019070422A JP6682167B2 JP 6682167 B2 JP6682167 B2 JP 6682167B2 JP 2019070422 A JP2019070422 A JP 2019070422A JP 2019070422 A JP2019070422 A JP 2019070422A JP 6682167 B2 JP6682167 B2 JP 6682167B2
Authority
JP
Japan
Prior art keywords
image
template
pixel
geometric transformation
template image
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.)
Active
Application number
JP2019070422A
Other languages
Japanese (ja)
Other versions
JP2019133702A (en
Inventor
小萌 武
小萌 武
川西 隆仁
隆仁 川西
森 稔
稔 森
薫 平松
薫 平松
柏野 邦夫
邦夫 柏野
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2019070422A priority Critical patent/JP6682167B2/en
Publication of JP2019133702A publication Critical patent/JP2019133702A/en
Application granted granted Critical
Publication of JP6682167B2 publication Critical patent/JP6682167B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Description

本発明は、テンプレートマッチング装置、方法、及びプログラムに係り、特に、観測画像におけるテンプレート画像の位置を計算するテンプレートマッチング装置、方法、及びプログラムに関する。   The present invention relates to a template matching device, method, and program, and more particularly to a template matching device, method, and program for calculating the position of a template image in an observed image.

テンプレートマッチングとは、特定の画像パターンを代表するテンプレート画像をあらかじめ用意し、それと同じパターンが観測画像内に存在するかを検出し、存在する場合それの当該箇所を検出するプロセスである。テンプレートマッチング方法は、画像パターンの位置認識、画像中の物体検出、製造部品の実装検査等に広く用いられている。テンプレートマッチング方法は、概ね特徴点ベースの方法と画素ベースの方法に分けられる。   Template matching is a process of preparing a template image representative of a specific image pattern in advance, detecting whether or not the same pattern exists in the observed image, and detecting the corresponding portion of the pattern if it exists. The template matching method is widely used for position recognition of image patterns, object detection in images, mounting inspection of manufactured parts, and the like. Template matching methods are roughly classified into feature point-based methods and pixel-based methods.

特徴点ベースの方法の一例として、非特許文献1の方法がある。この方法は、テンプレート画像と観測画像を入力とし、画像から複数の特徴点を抽出し、特徴点の照合に基づいてテンプレート画像の観測画像にある位置を算出する。特徴点を抽出する際に、各特徴点について、視覚特徴を表す局所特徴量と、スケール(大きさ)、方向、座標等の幾何形状パラメータが出力される。ここで、入力画像間において、局所特徴量の類似する特徴点のペアを対応点と呼ぶ。前記方法は、入力画像間から全ての対応点を検出した後に、各対応点について、特徴点の幾何形状パラメータに基づいて、拡大縮小倍率、回転角度、位置変動ベクトル等の幾何変換パラメータを算出する。ここで、幾何変換パラメータの類似する対応点を正対応点と呼ぶ。前記方法は、ハフ変換を用いて正対応点を検出し、正対応点の座標に基づいて最小二乗法を用いて入力画像間の幾何変換パラメータを算出する。最後に、前記パラメータを用いてテンプレート画像の観測画像にある位置を算出する。   An example of the feature point-based method is the method of Non-Patent Document 1. This method inputs a template image and an observation image, extracts a plurality of feature points from the image, and calculates the position of the template image in the observation image based on the matching of the feature points. When extracting feature points, local feature quantities representing visual features and geometrical shape parameters such as scale (size), direction, and coordinates are output for each feature point. Here, a pair of feature points having similar local feature amounts between the input images is called a corresponding point. In the method, after detecting all corresponding points between the input images, geometric conversion parameters such as a scaling factor, a rotation angle, and a position variation vector are calculated for each corresponding point based on the geometric shape parameters of the feature points. . Here, corresponding points having similar geometrical transformation parameters are called exact corresponding points. In the method, the Hough transform is used to detect the exact corresponding points, and the geometric transformation parameter between the input images is calculated using the least squares method based on the coordinates of the exact corresponding points. Finally, the position in the observed image of the template image is calculated using the above parameters.

画素ベースの方法の一例として、非特許文献2の方法がある。この方法は、テンプレート画像と観測画像を入力とし、画素の照合に基づいてテンプレート画像の観測画像にある位置を算出する。具体的に、幾何変換パラメータの候補を多数用意し、各候補を用いてテンプレート画像を観測画像に投影する。各候補について、投影されたテンプレート画像と観測画像と重複した画像領域について、テンプレート画像と観測画像との距離測度を算出する。全ての候補の中から、前記距離測度が最小の候補を入力画像間の幾何変換パラメータと推定する。最後に、推定された候補によって投影されたテンプレート画像の観測画像にある位置を出力する。   As an example of the pixel-based method, there is the method of Non-Patent Document 2. In this method, a template image and an observed image are input, and the position of the template image in the observed image is calculated based on pixel matching. Specifically, a large number of geometric transformation parameter candidates are prepared, and the template image is projected onto the observation image using each candidate. For each candidate, the distance measure between the template image and the observed image is calculated for the image area where the projected template image and the observed image overlap. From all the candidates, the candidate with the smallest distance measure is estimated as the geometric transformation parameter between the input images. Finally, the position in the observed image of the template image projected by the estimated candidate is output.

David G. Lowe: Distinctive Image Features from Scale-Invariant Keypoints. International Journal of Computer Vision 60(2): 91-110 (2004)David G. Lowe: Distinctive Image Features from Scale-Invariant Keypoints. International Journal of Computer Vision 60 (2): 91-110 (2004). Chiou-Shann Fuh and Petros Maragos: "Motion displacement estimation using an affine model for image matching", Opt. Eng. 30(7), 881-887 (Jul 01, 1991).Chiou-Shann Fuh and Petros Maragos: "Motion displacement estimation using an affine model for image matching", Opt. Eng. 30 (7), 881-887 (Jul 01, 1991).

<課題1>
非特許文献1の方法は、正対応点の座標に基づいて最小二乗法を用いて入力画像間の幾何変換パラメータを算出する。最小二乗法は外れ値から大きく悪影響を受けるため、正対応点の座標に誤差がある場合、正確に幾何変換パラメータを算出するのが困難である。外れ値の悪影響を軽減する方法としてRandom Sample Consensus (RANSAC)があるが、外れ値の割合が高い場合、前記悪影響を完全に回避するのが困難である。
<Issue 1>
The method of Non-Patent Document 1 calculates a geometric transformation parameter between input images by using the least squares method based on the coordinates of exactly corresponding points. Since the least-squares method is greatly adversely affected by the outlier, it is difficult to accurately calculate the geometric conversion parameter when the coordinates of the exact corresponding points have an error. Although there is Random Sample Consensus (RANSAC) as a method for reducing the adverse effect of the outlier, it is difficult to completely avoid the adverse effect when the ratio of the outlier is high.

<課題2>
非特許文献2の方法は、幾何変換パラメータの候補から最適なものを入力画像間の幾何変換パラメータと推定する。正確に幾何変換パラメータを推定するためには、前記候補を非常に多数用意しなければならない。そのため、入力画像間の距離測度の計算回数が膨大で、計算量が非常に大きい。
<Issue 2>
The method of Non-Patent Document 2 estimates the optimum geometric transformation parameter among the geometric transformation parameter candidates as the geometric transformation parameter between the input images. In order to accurately estimate the geometric transformation parameters, it is necessary to prepare a large number of candidates. Therefore, the number of calculation of the distance measure between the input images is huge, and the amount of calculation is very large.

<課題3>
非特許文献2の方法は、入力画像間の距離測度を計算する際に、テンプレート画像の全ての画素を用いるため、計算量が非常に大きい。一部の画素のみを用いる方法として、均一サンプリングやランダムサンプリング等がある。しかし、これらの方法によって選択された画素は、前記距離測度の最適化において、全て識別力があるとは限らない。そのため、距離測度の近似が大きくずれる場合があり、その場合、正確に幾何変換パラメータを推定するのが困難である。
<Issue 3>
Since the method of Non-Patent Document 2 uses all the pixels of the template image when calculating the distance measure between the input images, the calculation amount is very large. As a method of using only some pixels, there are uniform sampling, random sampling, and the like. However, the pixels selected by these methods are not all discriminative in optimizing the distance measure. Therefore, the approximation of the distance measure may be largely deviated, and in that case, it is difficult to accurately estimate the geometric conversion parameter.

本発明は、上記課題を解決するために成されたものであり、画像間の幾何変換を考慮して、精度よくテンプレート画像の位置を検出することができるテンプレートマッチング装置、方法、及びプログラムを提供することを目的とする。   The present invention has been made to solve the above problems, and provides a template matching device, method, and program capable of accurately detecting the position of a template image in consideration of geometric transformation between images. The purpose is to do.

また、計算量を抑制し、かつ、画像間の幾何変換を考慮して、テンプレート画像の位置を検出することができるテンプレートマッチング装置、方法、及びプログラムを提供することを目的とする。   Another object of the present invention is to provide a template matching device, method, and program that can suppress the amount of calculation and can detect the position of a template image in consideration of geometric transformation between images.

上記目的を達成するために、第1の発明に係るテンプレートマッチング装置は、入力されたテンプレート画像と観測画像とのペアについて、テンプレート画像と観測画像との各々から複数の特徴点を抽出し、画像間の幾何変換を考慮して、前記テンプレート画像と前記観測画像との各々の前記複数の特徴点の中から局所特徴量の対応付けを行い、前記テンプレート画像の特徴点と前記テンプレート画像の特徴点に対応する前記観測画像の特徴点とのペアとなる、画像間の正対応点を検出し、検出された正対応点の各々について、画像間の幾何変換を表す幾何変換パラメータの候補の各々を推定することにより、前記正対応点のペア数の幾何変換パラメータの候補を求める幾何検証部と、前記テンプレート画像の各画素の画素値の二次微分係数の絶対値の大きさに基づいて複数の特徴点を抽出し、前記抽出された複数の特徴点のうちの、スケールが小さい順に上位n個(nは特徴点の総数より小さい整数である。)の特徴点に対応する、前記テンプレート画像における複数の局所領域それぞれの画素を選択する画素選択部と、前記幾何検証部によって推定された前記幾何変換パラメータの候補の各々について、前記画素選択部によって選択された画素の各々に対し、前記幾何変換パラメータの候補を適用したときの、前記観測画像における画素の各々との画素間距離測度を計算する画素間距離測度計算部と、前記選択された画素の各々に対して計算された前記画素間距離測度に基づく画像間距離測度が最小となる前記幾何変換パラメータの候補を、前記テンプレート画像と前記観測画像とのペアにおける幾何変換パラメータとして推定する判断部と、前記判断部によって推定された前記幾何変換パラメータを適用して、前記観測画像における前記テンプレート画像の位置を計算するテンプレート位置計算部と、を含んで構成されている。   To achieve the above object, a template matching device according to a first aspect of the invention extracts a plurality of feature points from each of a template image and an observation image for an input pair of the template image and the observation image, In consideration of the geometric transformation between the template image and the observed image, local feature amounts are associated from the plurality of feature points, and the feature points of the template image and the feature points of the template image are associated with each other. Which is paired with the feature point of the observed image corresponding to, detects the positive corresponding points between the images, and for each of the detected positive corresponding points, each of the candidates of the geometric transformation parameter representing the geometric transformation between the images, A geometrical verification unit that obtains a candidate for a geometrical transformation parameter of the number of pairs of the corresponding points by estimating, and a second derivative of the pixel value of each pixel of the template image. A plurality of characteristic points are extracted based on the magnitude of the absolute value, and among the extracted plurality of characteristic points, the top n (n is an integer smaller than the total number of characteristic points) in the order of smaller scale. A pixel selection unit that selects pixels of each of a plurality of local regions in the template image corresponding to a feature point, and each of the geometric transformation parameter candidates estimated by the geometry verification unit, is selected by the pixel selection unit. For each of the pixels, when applying the candidate of the geometric transformation parameter, an inter-pixel distance measure calculation unit that calculates an inter-pixel distance measure with each of the pixels in the observed image, and each of the selected pixels The candidate of the geometric transformation parameter that minimizes the inter-image distance measure based on the inter-pixel distance measure calculated with respect to the template image and the observed image. And a template position calculation unit that calculates the position of the template image in the observed image by applying the geometric conversion parameter estimated by the determination unit. It is composed of.

第2の発明に係るテンプレートマッチング方法は、幾何検証部が、入力されたテンプレート画像と観測画像とのペアについて、テンプレート画像と観測画像との各々から複数の特徴点を抽出し、画像間の幾何変換を考慮して、前記テンプレート画像と前記観測画像との各々の前記複数の特徴点の中から局所特徴量の対応付けを行い、前記テンプレート画像の特徴点と前記テンプレート画像の特徴点に対応する前記観測画像の特徴点とのペアとなる、画像間の正対応点を検出し、検出された正対応点の各々について、画像間の幾何変換を表す幾何変換パラメータの候補の各々を推定することにより、前記正対応点のペア数の幾何変換パラメータの候補を求め、画素選択部が、前記テンプレート画像の各画素の画素値の二次微分係数の絶対値の大きさに基づいて複数の特徴点を抽出し、前記抽出された複数の特徴点のうちの、スケールが小さい順に上位n個(nは特徴点の総数より小さい整数である。)の特徴点に対応する、前記テンプレート画像における複数の局所領域それぞれの画素を選択し、画素間距離測度計算部が、前記幾何検証部によって推定された前記幾何変換パラメータの候補の各々について、前記画素選択部によって選択された画素の各々に対し、前記幾何変換パラメータの候補を適用したときの、前記観測画像における画素の各々との画素間距離測度を計算し、判断部が、前記選択された画素の各々に対して計算された前記画素間距離測度に基づく画像間距離測度が最小となる前記幾何変換パラメータの候補を、前記テンプレート画像と前記観測画像とのペアにおける幾何変換パラメータとして推定し、テンプレート位置計算部が、前記判断部によって推定された前記幾何変換パラメータを適用して、前記観測画像における前記テンプレート画像の位置を計算する。   In the template matching method according to the second aspect of the present invention, the geometry verification unit extracts a plurality of feature points from each of the template image and the observed image for the input pair of the template image and the observed image, and calculates the geometrical feature between the images. In consideration of the conversion, the local feature amount is associated from the plurality of feature points of each of the template image and the observed image, and the feature points of the template image and the feature points of the template image are associated. Detecting the positive corresponding points between the images that form a pair with the feature points of the observed image, and estimating each of the geometric conversion parameter candidates representing the geometric conversion between the images for each of the detected correct corresponding points. Thus, the candidate of the geometric conversion parameter of the number of pairs of the corresponding points is obtained, and the pixel selection unit determines the large absolute value of the second derivative of the pixel value of each pixel of the template image. A plurality of feature points are extracted based on the size, and correspond to the top n feature points (n is an integer smaller than the total number of feature points) of the extracted feature points in order of decreasing scale. A pixel for each of a plurality of local regions in the template image is selected, and an inter-pixel distance measure calculation unit is selected by the pixel selection unit for each of the geometric transformation parameter candidates estimated by the geometry verification unit. For each of the pixels, when applying the candidate of the geometric transformation parameter, calculates the inter-pixel distance measure with each of the pixels in the observed image, the determination unit, for each of the selected pixels The candidate of the geometric transformation parameter that minimizes the inter-image distance measure based on the calculated inter-pixel distance measure is stored in the pair of the template image and the observed image. It was estimated as the geometric transformation parameters, the template position calculation unit, by applying the geometric transformation parameters estimated by the determination unit, to calculate the position of the template image in the observed image.

本発明に係るプログラムは、コンピュータを、上記のテンプレートマッチング装置を構成する各部として機能させるためのプログラムである。   A program according to the present invention is a program for causing a computer to function as each unit included in the template matching device.

また、本発明のテンプレートマッチング装置、方法、及びプログラムによれば、入力されたテンプレート画像と観測画像とのペアについて、幾何変換パラメータの候補の各々を推定し、テンプレート画像の画素値の二次微分係数に基づいて、複数の画素を選択し、選択された画素の各々に対し、前記幾何変換パラメータの候補を適用したときの、前記観測画像における画素の各々との画素間距離測度を計算し、画素間距離測度に基づく画像間距離測度が最小となる前記幾何変換パラメータの候補を適用して、前記観測画像における前記テンプレート画像の位置を計算することにより、計算量を抑制し、かつ、画像間の幾何変換を考慮して、テンプレート画像の位置を検出することができる、という効果が得られる。   Further, according to the template matching apparatus, method, and program of the present invention, for each pair of the input template image and observation image, each candidate of the geometric transformation parameter is estimated, and the second derivative of the pixel value of the template image is estimated. Based on the coefficient, select a plurality of pixels, for each of the selected pixels, when applying the candidate geometric transformation parameter, to calculate the inter-pixel distance measure with each of the pixels in the observed image, By applying the candidate of the geometric transformation parameter that minimizes the inter-image distance measure based on the inter-pixel distance measure to calculate the position of the template image in the observed image, the amount of calculation is suppressed, and The effect that the position of the template image can be detected in consideration of the geometric transformation of

本発明の第1の実施の形態に係るテンプレートマッチング装置の構成を示すブロック図である。It is a block diagram which shows the structure of the template matching apparatus which concerns on the 1st Embodiment of this invention. 本発明の第1の実施の形態に係るテンプレートマッチング装置の画像間距離測度計算部の構成を示すブロック図である。It is a block diagram which shows the structure of the image distance measure calculation part of the template matching apparatus which concerns on the 1st Embodiment of this invention. 本発明の第1の実施の形態に係るテンプレートマッチング装置におけるテンプレートマッチング処理ルーチンを示すフローチャートである。It is a flowchart which shows the template matching process routine in the template matching device which concerns on the 1st Embodiment of this invention. 本発明の第1の実施の形態に係るテンプレートマッチング装置における画像間距離測度を計算する処理の流れを示すフローチャートである。It is a flowchart which shows the flow of the process which calculates the distance measurement between images in the template matching apparatus which concerns on the 1st Embodiment of this invention.

以下、図面を参照して本発明の実施の形態を詳細に説明する。   Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.

<概要>
前記課題1、2を解決するために、本発明の実施の形態に係るテンプレートマッチング装置は、幾何検証方法を用いて正対応点を検出し、正対応点から算出された幾何変換パラメータのみを候補と見なし、候補の中から、テンプレート画像と観測画像との距離測度が最小の候補を画像間の幾何変換パラメータと推定する。
<Outline>
In order to solve the above problems 1 and 2, the template matching apparatus according to the embodiment of the present invention detects exactly corresponding points by using a geometric verification method, and selects only geometric transformation parameters calculated from the exactly corresponding points. From the candidates, the candidate with the smallest distance measure between the template image and the observed image is estimated as the geometric transformation parameter between the images.

これにより、非特許文献1の方法と比べて、正対応点の中に誤差の小さいものが一点だけでもあれば、より正確に幾何変換パラメータを推定するのが可能である。そのため、正対応点の特徴点の幾何形状パラメータに誤差がある場合やそのような正対応点の割合が高い場合でも、誤差の悪影響を大幅に抑えるのが可能である。   As a result, compared to the method of Non-Patent Document 1, it is possible to more accurately estimate the geometric transformation parameter if there is only one point having a small error in the positive correspondence points. Therefore, even if there is an error in the geometrical shape parameter of the feature point of the directly corresponding point, or even if the proportion of such exactly corresponding points is high, it is possible to significantly suppress the adverse effect of the error.

また、非特許文献2の方法と比べて、幾何変換パラメータの候補の数を非常に少数に絞るのが可能になり、画像間の距離測度の計算回数を大幅に減らし、計算量を抑えるのが可能になる。   Further, as compared with the method of Non-Patent Document 2, it is possible to narrow down the number of geometric transformation parameter candidates to a very small number, and it is possible to significantly reduce the number of calculation of the distance measure between images and suppress the amount of calculation. It will be possible.

[第1の実施の形態]
<第1の実施の形態に係るテンプレートマッチング装置の構成>
本発明の第1の実施の形態に係るテンプレートマッチング装置の構成について説明する。図1に示すように、本発明の第1の実施の形態に係るテンプレートマッチング装置100は、CPUと、RAMと、後述するテンプレートマッチング処理ルーチンを実行するためのプログラムや各種データを記憶したROMと、を含むコンピュータで構成することが出来る。このテンプレートマッチング装置100は、機能的には図1に示すように、入力部10、演算部20と、出力部90とを備えている。
[First Embodiment]
<Structure of Template Matching Device According to First Embodiment>
The configuration of the template matching device according to the first embodiment of the present invention will be described. As shown in FIG. 1, a template matching device 100 according to the first embodiment of the present invention includes a CPU, a RAM, and a ROM that stores a program for executing a template matching processing routine described later and various data. , And can be configured by a computer including. This template matching device 100 is functionally provided with an input unit 10, a calculation unit 20, and an output unit 90, as shown in FIG.

入力部10は、テンプレート画像と観測画像とを受け付ける。   The input unit 10 receives a template image and an observation image.

演算部20は、幾何検証部22と、画像間距離測度計算部24と、判断部26と、テンプレート位置計算部28と、を含んで構成されている。   The calculation unit 20 includes a geometry verification unit 22, an inter-image distance measure calculation unit 24, a determination unit 26, and a template position calculation unit 28.

幾何検証部22は、入力部10により入力されたテンプレート画像と観測画像とのペアについて、画像間の幾何変換を考慮して、画像間の対応点を検出し、検出された対応点に基づいて、画像間の幾何変換を表す幾何変換パラメータの候補の各々を推定する。   The geometric verification unit 22 detects corresponding points between images in the pair of the template image and the observed image input by the input unit 10 in consideration of the geometric transformation between the images, and based on the detected corresponding points. , Each of the geometric transformation parameter candidates representing the geometric transformation between images is estimated.

具体的には、幾何検証部22は、テンプレート画像と観測画像を入力とし、幾何検証方法によって幾何変換パラメータの候補を推定し、出力する。例えば、入力画像から複数の特徴点を抽出し、ハフ変換(非特許文献1)やRANSAC等を用いて正対応点を検出する。正対応点から算出された幾何変換パラメータを候補と見なし、出力する。   Specifically, the geometrical verification unit 22 receives the template image and the observed image as inputs, estimates geometrical conversion parameter candidates by the geometrical verification method, and outputs the estimated geometrical conversion parameter candidates. For example, a plurality of feature points are extracted from the input image, and a Hough transform (Non-Patent Document 1), RANSAC, or the like is used to detect the correct corresponding points. The geometric conversion parameters calculated from the exact corresponding points are regarded as candidates and output.

本実施形態では、各正対応点について、それを構成した特徴点において、テンプレート画像側の特徴点をpで、観測画像側の特徴点をqで表す。特徴点pについて、スケールをσ(p)で、方向をθ(p)で、二次元の座標をt(p)=[x(p),y(p)]Tで表す。特徴点qについても、同様に記す。テンプレート画像から観測画像への拡大縮小倍率は、 In the present embodiment, for each directly corresponding point, the characteristic point on the template image side is represented by p, and the characteristic point on the observed image side is represented by q, among the characteristic points constituting the point. For the feature point p, the scale is represented by σ (p), the direction is represented by θ (p), and the two-dimensional coordinates are represented by t (p) = [x (p), y (p)] T. The same applies to the feature point q. The scaling ratio from the template image to the observation image is


で計算される。テンプレート画像から観測画像への回転角度は、 Is calculated. The rotation angle from the template image to the observation image is


で計算される。ここで、テンプレート画像から観測画像への変換行列 Is calculated. Here, the conversion matrix from the template image to the observed image


を用意する。テンプレート画像から観測画像への位置変動ベクトルは、 To prepare. The position variation vector from the template image to the observation image is


で計算される。従って、各幾何変換パラメータの候補は、2×2の行列Mと2×1の行列dによって表現される。 Is calculated. Therefore, each geometric transformation parameter candidate is represented by the 2 × 2 matrix M and the 2 × 1 matrix d.

画像間距離測度計算部24は、幾何検証部22によって推定された幾何変換パラメータの候補の各々について、当該幾何変換パラメータの候補を適用したときのテンプレート画像と観測画像との画像間距離測度を計算する。   The inter-image distance measure calculation unit 24 calculates, for each of the geometric transformation parameter candidates estimated by the geometry verification unit 22, an inter-image distance measure between the template image and the observed image when the geometric transformation parameter candidate is applied. To do.

画像間距離測度計算部24は、図2に示すように、画素選択部30、幾何変換部32、画素間距離測度計算部34、及び判断部36を備えている。   The inter-image distance measure calculation unit 24 includes a pixel selection unit 30, a geometric conversion unit 32, an inter-pixel distance measure calculation unit 34, and a determination unit 36, as shown in FIG.

画素選択部30は、テンプレート画像における一部の画素を選択し、選択された画素の座標を出力する。   The pixel selection unit 30 selects some pixels in the template image and outputs the coordinates of the selected pixels.

例えば、テンプレート画像に対して、2次元の画像平面上で横と縦の両方向において、一定間隔毎に一個の画素を選択し、選択された全ての画素を出力する。あるいは、テンプレート画像に対して、画素をランダムにn個選択し、選択された画素を出力する。   For example, with respect to the template image, one pixel is selected at regular intervals in both the horizontal and vertical directions on the two-dimensional image plane, and all the selected pixels are output. Alternatively, n pixels are randomly selected for the template image and the selected pixels are output.

幾何変換部32は、幾何検証部22によって推定された幾何変換パラメータの候補の各々と、画素選択部30から出力されるテンプレート画像の画素座標とを入力とし、幾何変換パラメータの候補の各々について、当該幾何変換パラメータの候補を適用してテンプレート画像の画素座標を観測画像に投影し、投影された画素の座標を出力する。   The geometric transformation unit 32 receives each of the geometric transformation parameter candidates estimated by the geometry verification unit 22 and the pixel coordinates of the template image output from the pixel selection unit 30 as input, and regarding each of the geometric transformation parameter candidates, The geometrical transformation parameter candidates are applied to project the pixel coordinates of the template image onto the observed image, and the coordinates of the projected pixels are output.

本実施形態では、幾何変換パラメータの候補は、2×2の行列Mと2×1の行列dによって表現される。テンプレート画像の画素座標をt=[x,y]Tで表し、投影された観測画像の画素座標をt'=[x',y']Tで表す。ここで、t'は In the present embodiment, geometric transformation parameter candidates are represented by a 2 × 2 matrix M and a 2 × 1 matrix d. The pixel coordinates of the template image are represented by t = [x, y] T , and the pixel coordinates of the projected observation image are represented by t ′ = [x ′, y ′] T. Where t'is


で計算される。 Is calculated.

画素間距離測度計算部34は、幾何検証部22によって推定された幾何変換パラメータの候補の各々について、画素選択部30によって選択された画素の各々に対し、幾何変換部32によって出力された観測画像における画素の各々との画素間距離測度を計算する。   The inter-pixel distance measure calculation unit 34, for each of the geometric transformation parameter candidates estimated by the geometry verification unit 22, an observation image output by the geometric transformation unit 32 for each of the pixels selected by the pixel selection unit 30. Compute an inter-pixel distance measure with each of the pixels in.

テンプレート画像の画素と観測画像の画素との間の距離測度は、絶対差や二乗差等を用いて計算する。ここで、テンプレート画像の画素座標tの画素値をI(t)で表し、観測画像の画素座標t'の画素値をI'(t')で表す。絶対差を用いる場合、   The distance measure between the pixel of the template image and the pixel of the observed image is calculated by using the absolute difference or the square difference. Here, the pixel value at the pixel coordinate t of the template image is represented by I (t), and the pixel value at the pixel coordinate t ′ of the observed image is represented by I ′ (t ′). When using absolute difference,


を計算する。二乗差を用いる場合、 Is calculated. If you use the squared difference,


を計算する。前記SADとSSDは、画像間の距離測度であり、画素間距離測度(絶対差|I(t)−I'(t')|又は二乗差(I(t)−I'(t'))2)の総和である。各幾何変換パラメータの候補について、最初はSAD又はSSDを0に初期化し、テンプレート画像の画素座標と観測画像の画素座標のペアの各々について画素間距離測度計算部34の処理を行う度に、上記式(6)又は式(7)にしたがって、画素間距離測度を加算するようにSAD又はSSDを更新する。 Is calculated. The SAD and SSD are distance measures between images, and the distance measure between pixels (absolute difference | I (t) -I '(t') | or square difference (I (t) -I '(t')). It is the sum of 2 ). For each geometric transformation parameter candidate, SAD or SSD is initially initialized to 0, and each time the processing by the inter-pixel distance measure calculation unit 34 is performed for each pair of the pixel coordinate of the template image and the pixel coordinate of the observed image, Update SAD or SSD to add the inter-pixel distance measure according to equation (6) or equation (7).

判断部36は、画素選択部30から出力されたテンプレート画像の画素座標について、幾何変換部32と画素間距離測度計算部34の処理が全て終了したかを判断し、全て終了した場合、画像間距離測度SAD或いはSSDを出力し、そうでない場合、全て終了するまで反復する。   The determination unit 36 determines whether or not the processes of the geometric conversion unit 32 and the inter-pixel distance measure calculation unit 34 have all been completed for the pixel coordinates of the template image output from the pixel selection unit 30, and when all the processes have been completed, It outputs the distance measure SAD or SSD, and if not, iterates until all are done.

判断部26は、全ての幾何変換パラメータの候補について、画像間距離測度計算部の処理が終了したかを判断し、全て終了した場合、画像間距離測度が最小となる幾何変換パラメータの候補を、テンプレート画像と観測画像とのペアにおける幾何変換パラメータとして推定して出力し、そうでない場合、全て終了するまで反復する。   The determination unit 26 determines whether or not the processing by the inter-image distance measure calculation unit has been completed for all geometric transformation parameter candidates, and when all the geometric transformation parameter candidates have been completed, the geometric transformation parameter candidate with the smallest inter-image distance measurement is determined. It is estimated and output as the geometric transformation parameter in the pair of the template image and the observed image, and if not, iteratively repeated until the end.

テンプレート位置計算部28は、判断部26によって推定された幾何変換パラメータを適用して、観測画像におけるテンプレート画像の位置を計算する。   The template position calculation unit 28 applies the geometric transformation parameters estimated by the determination unit 26 to calculate the position of the template image in the observed image.

例えば、テンプレート画像の観測画像にある当該箇所を境界ボックスで表現する場合、境界ボックスの左上の座標をt'min=[x'min,y'minTで、右下の座標をt'max=[x'max,y'maxTで表す。テンプレート画像の左上の座標をtmin=[0,0]Tで表し、右下の座標をtmaxで表す。ここで、t'minFor example, when the relevant part in the observed image of the template image is represented by a bounding box, the upper left coordinate of the bounding box is t ′ min = [x ′ min , y ′ min ] T , and the lower right coordinate is t ′ max. = [ X'max , y'max ] T. The upper left coordinate of the template image is represented by t min = [0,0] T , and the lower right coordinate is represented by t max . Where t'min


で計算し、t'maxAnd calculate t'max


で計算する。 Calculate with.

出力部90は、テンプレート位置計算部28によって計算された観測画像内におけるテンプレート画像の位置を結果として出力する。   The output unit 90 outputs the position of the template image in the observed image calculated by the template position calculation unit 28 as a result.

<本発明の第1の実施の形態に係るテンプレートマッチング装置の作用>
次に、本発明の第1の実施の形態に係るテンプレートマッチング装置100の作用について説明する。入力部10によって、テンプレート画像と観測画像とを受け付けると、テンプレートマッチング装置100は、図3に示すテンプレートマッチング処理ルーチンを実行する。
<Operation of the template matching device according to the first embodiment of the present invention>
Next, the operation of the template matching device 100 according to the first embodiment of the present invention will be described. When the template image and the observed image are received by the input unit 10, the template matching device 100 executes the template matching processing routine shown in FIG.

ステップS100において、入力部10により入力されたテンプレート画像と観測画像とのペアについて、画像間の幾何変換を考慮して、画像間の対応点を検出し、検出された対応点に基づいて、画像間の幾何変換を表す幾何変換パラメータの候補の各々を推定する。   In step S100, regarding the pair of the template image and the observed image input by the input unit 10, the corresponding points between the images are detected in consideration of the geometric transformation between the images, and the image is detected based on the detected corresponding points. Each of the geometric transformation parameter candidates representing the geometric transformation between the two is estimated.

ステップS102において、推定された幾何変換パラメータの候補のうちの処理対象の幾何変換パラメータの候補をテンプレート画像に適用し、テンプレート画像と観測画像との画像間距離測度を計算する。   In step S102, the candidate geometric transformation parameter to be processed among the estimated geometric transformation parameter candidates is applied to the template image, and the inter-image distance measure between the template image and the observed image is calculated.

ステップS104において、上記ステップS100で推定された全ての幾何変換パラメータの候補について、上記ステップS102の処理が実行されたか否かを判定する。全ての幾何変換パラメータの候補について、上記ステップS102の処理が実行された場合には、画像間距離測度が最小となる幾何変換パラメータの候補を、テンプレート画像と観測画像とのペアにおける幾何変換パラメータとして推定して出力し、ステップS106へ進む。一方、上記ステップS102の処理が実行されていない幾何変換パラメータの候補が存在する場合には、当該幾何変換パラメータの候補を処理対象としてステップS102へ戻る。   In step S104, it is determined whether or not the processing in step S102 has been executed for all geometric transformation parameter candidates estimated in step S100. When the process of step S102 is executed for all geometric transformation parameter candidates, the geometric transformation parameter candidate with the smallest inter-image distance measure is set as the geometric transformation parameter in the pair of the template image and the observed image. It is estimated and output, and the process proceeds to step S106. On the other hand, if there is a geometric conversion parameter candidate for which the processing of step S102 has not been executed, the process returns to step S102 with the geometric conversion parameter candidate as the processing target.

ステップS106において、推定された幾何変換パラメータを適用して、観測画像におけるテンプレート画像の位置を計算して出力部90により出力して、テンプレートマッチング処理ルーチンを終了する。   In step S106, the estimated geometric transformation parameter is applied to calculate the position of the template image in the observed image, and the output unit 90 outputs the position, and the template matching processing routine ends.

上記ステップS102は、図4に示す処理ルーチンにより実現される。   The above step S102 is realized by the processing routine shown in FIG.

まず、ステップS110において、テンプレート画像における一部の画素を選択し、選択された画素の座標を出力する。   First, in step S110, some pixels in the template image are selected, and the coordinates of the selected pixels are output.

ステップS112において、処理対象の幾何変換パラメータの候補と、上記ステップS110で出力されたテンプレート画像の画素の座標のうちの処理対象の画素の座標とを入力とし、処理対象の幾何変換パラメータの候補について、当該幾何変換パラメータの候補を用いて、テンプレート画像の処理対象の画素の座標を観測画像に投影し、投影された画素の座標を出力する。   In step S112, the candidates for the geometric transformation parameter to be processed and the coordinates of the pixel to be processed among the coordinates of the pixels of the template image output in step S110 are input, and the candidates for the geometric transformation parameter to be processed are input. , The coordinates of the pixel to be processed in the template image are projected on the observation image using the candidates of the geometric transformation parameters, and the coordinates of the projected pixel are output.

ステップS114において、処理対象の画素の座標に対し、上記ステップS112で出力された観測画像における画素の座標との画素間距離測度を計算し、画像間距離測度に加算する。   In step S114, the inter-pixel distance measure with respect to the coordinates of the pixel to be processed and the coordinates of the pixel in the observed image output in step S112 is calculated and added to the inter-image distance measure.

ステップS116において、上記ステップS110で出力されたテンプレート画像の画素の座標の全てについて、上記ステップS112、S114の処理が終了したかを判断し、全て終了した場合、画像間距離測度を出力する。一方、上記ステップS112、S114の処理が終了していないテンプレート画像の画素の座標が存在する場合、当該画素の座標を処理対象として上記ステップS112へ戻る。   In step S116, it is determined whether the processes in steps S112 and S114 have been completed for all the coordinates of the pixels of the template image output in step S110. If all have been completed, the inter-image distance measure is output. On the other hand, when the coordinates of the pixel of the template image for which the processes of steps S112 and S114 have not been completed exist, the coordinates of the pixel are targeted for processing and the process returns to step S112.

以上説明したように、本発明の第1の実施の形態に係るテンプレートマッチング装置によれば、入力されたテンプレート画像と観測画像とのペアについて、画像間の幾何変換を考慮して、画像間の対応点を検出し、幾何変換パラメータの候補の各々を推定し、幾何変換パラメータの候補を適用したときのテンプレート画像と観測画像との画像間距離測度を計算し、画像間距離測度が最小となる幾何変換パラメータの候補を適用して、観測画像におけるテンプレート画像の位置を計算することにより、画像間の幾何変換を考慮して、効率的かつ精度よくテンプレート画像の位置を検出することができる。   As described above, according to the template matching apparatus according to the first embodiment of the present invention, regarding a pair of an input template image and an observed image, geometric conversion between images is considered, Detect the corresponding points, estimate each geometric transformation parameter candidate, calculate the image distance measure between the template image and the observed image when applying the geometric transformation parameter candidate, and minimize the image distance measure. By calculating the position of the template image in the observed image by applying the candidate geometric transformation parameter, the position of the template image can be detected efficiently and accurately in consideration of the geometric transformation between images.

なお、上記の実施の形態では、テンプレート画像の一部の画素を選択して、画像間距離測度を計算する場合を例に説明したが、これに限定されるものではなく、テンプレート画像の全画素を用いて、画像間距離測度を計算してもよい。この場合には、テンプレート画像の全画素の各々について、幾何変換パラメータの候補を用いて、観測画像に投影し、画素間距離測度を計算すればよい。   In the above embodiment, the case where a part of the pixels of the template image is selected and the inter-image distance measure is calculated has been described as an example. However, the present invention is not limited to this, and all pixels of the template image are calculated. May be used to calculate the inter-image distance measure. In this case, for each of all the pixels of the template image, the candidates for the geometric transformation parameters may be used to project the observation image to calculate the inter-pixel distance measure.

[第2の実施の形態]
次に、本発明の第2の実施の形態に係るテンプレートマッチング装置の構成について説明する。なお、第2の実施の形態に係るテンプレートマッチング装置は、第1の実施の形態と同様であるため、同一符号を付して説明を省略する。
[Second Embodiment]
Next, the configuration of the template matching device according to the second embodiment of the present invention will be described. The template matching device according to the second embodiment is the same as that of the first embodiment, and therefore the same reference numerals are given and the description thereof is omitted.

第2の実施の形態では、テンプレート画像において、画像間距離測度を計算するための画素として、画素値の二次微分係数の絶対値が大きい画素を選択する点が、第1の実施の形態と異なる。   The second embodiment is different from the first embodiment in that, in the template image, a pixel having a large absolute value of the second derivative of the pixel value is selected as the pixel for calculating the inter-image distance measure. different.

<概要>
前記課題3を解決するために、本発明の実施の形態に係るテンプレートマッチング装置は、テンプレート画像の全ての画素に対して、画素の座標における画素値の二次微分係数を算出し、二次微分係数の絶対値が最大の画素を複数選択し、選択された画素のみを用いて画像間距離測度を計算する。
<Outline>
In order to solve the problem 3, the template matching device according to the embodiment of the present invention calculates a second derivative of pixel values at pixel coordinates for all pixels of the template image, and obtains a second derivative. A plurality of pixels having the largest absolute value of the coefficient are selected, and the inter-image distance measure is calculated using only the selected pixels.

これにより、画像間距離測度の計算に用いる画素の数を大幅に減らし、計算量を抑えるのが可能になる。座標における画素値の二次微分係数が顕著な画素は、画像平面上における周辺の画素との画素値の差分が大きい。そのような画素は、距離測度の計算に用いられる際に、正しい幾何変換パラメータと誤っている幾何変換パラメータとの区別において、識別力が高い。そのため、均一サンプリングやランダムサンプリング等の方法と比べて、識別力のより高い画素を選択するのが可能になり、より正確に距離測度を近似し、幾何変換パラメータを推定するのが可能になる。   This makes it possible to significantly reduce the number of pixels used for the calculation of the inter-image distance measure and suppress the calculation amount. A pixel having a significant second derivative of the pixel value at the coordinate has a large difference in pixel value from the peripheral pixels on the image plane. Such pixels are highly discriminative in distinguishing between correct and incorrect geometric transformation parameters when used in the calculation of distance measures. Therefore, it is possible to select a pixel having a higher discriminating power as compared with methods such as uniform sampling and random sampling, and it is possible to more accurately approximate the distance measure and estimate the geometric transformation parameter.

<第2の実施の形態に係るテンプレートマッチング装置の構成>
第2の実施の形態のテンプレートマッチング装置100の画素選択部30は、テンプレート画像の各画素の画素値の二次微分係数に基づいて、テンプレート画像における、画素値の二次微分係数の絶対値が大きい複数の画素を選択する。
<Structure of Template Matching Device According to Second Embodiment>
The pixel selection unit 30 of the template matching device 100 of the second exemplary embodiment determines the absolute value of the secondary differential coefficient of the pixel value in the template image based on the secondary differential coefficient of the pixel value of each pixel of the template image. Select large pixels.

例えば、テンプレート画像の全ての画素に対して、画素の座標における画素値の二次微分係数を算出し、二次微分係数の絶対値が最大の画素をn個選択し、選択された画素を出力する。画素値の二次微分係数は、2次元のラプラシアンフィルタ、Laplacian of Gaussian (LoG)フィルタ、Difference of Gaussian (DoG)フィルタ等を用いて、画像と前記フィルタとの畳み込みを行うことによって算出される。   For example, for all pixels of the template image, the second derivative of the pixel value at the pixel coordinates is calculated, n pixels with the largest absolute value of the second derivative are selected, and the selected pixels are output. To do. The second derivative of the pixel value is calculated by convolving the image with the filter using a two-dimensional Laplacian filter, a Laplacian of Gaussian (LoG) filter, a Difference of Gaussian (DoG) filter, or the like.

なお、第2の実施の形態に係るテンプレートマッチング装置の他の構成及び作用については、第1の実施の形態と同様であるため、説明を省略する。   Note that other configurations and operations of the template matching device according to the second embodiment are the same as those in the first embodiment, and therefore description thereof will be omitted.

以上説明したように、本発明の第2の実施の形態に係るテンプレートマッチング装置によれば、入力されたテンプレート画像と観測画像とのペアについて、幾何変換パラメータの候補の各々を推定し、テンプレート画像の画素値の二次微分係数に基づいて、複数の画素を選択し、選択された画素の各々に対し、幾何変換パラメータの候補を適用したときの、観測画像における画素の各々との画素間距離測度を計算し、画素間距離測度に基づく画像間距離測度が最小となる幾何変換パラメータの候補を適用して、観測画像におけるテンプレート画像の位置を計算することにより、計算量を抑制し、かつ、画像間の幾何変換を考慮して、精度よくテンプレート画像の位置を検出することができる。   As described above, according to the template matching apparatus according to the second embodiment of the present invention, for each pair of the input template image and observation image, each of the geometric transformation parameter candidates is estimated to obtain the template image. Based on the second derivative of the pixel value of, the distance between each pixel in the observed image when multiple pixels are selected, and the candidate geometric transformation parameter is applied to each of the selected pixels Calculate the measure, apply the candidate of the geometric transformation parameter that the inter-image distance measure based on the inter-pixel distance measure is the minimum, by calculating the position of the template image in the observed image, to suppress the amount of calculation, and, The position of the template image can be accurately detected in consideration of the geometric conversion between images.

[第3の実施の形態]
次に、本発明の第3の実施の形態に係るテンプレートマッチング装置の構成について説明する。なお、第3の実施の形態に係るテンプレートマッチング装置は、第1の実施の形態と同様であるため、同一符号を付して説明を省略する。
[Third Embodiment]
Next, a configuration of the template matching device according to the third exemplary embodiment of the present invention will be described. The template matching device according to the third embodiment is the same as that of the first embodiment, and therefore the same reference numerals are given and the description thereof is omitted.

第3の実施の形態では、テンプレート画像において、画像間距離測度を計算するための画素として、画素値の二次微分係数が顕著な特徴点に対応する画素を選択する点が、第1の実施の形態と異なる。   In the third embodiment, the first embodiment is that, in the template image, a pixel corresponding to a feature point whose secondary differential coefficient of the pixel value is remarkable is selected as a pixel for calculating the inter-image distance measure. Different form.

<概要>
前記課題3を解決するために、本発明の実施の形態に係わるテンプレートマッチング装置は、テンプレート画像から二次微分係数が顕著な特徴点を抽出し、特徴点の座標にある画素のみを用いて画像間距離測度を計算する。
<Outline>
In order to solve the above-mentioned problem 3, the template matching apparatus according to the exemplary embodiment of the present invention extracts a feature point having a remarkable second derivative from a template image, and an image is obtained using only pixels at coordinates of the feature point. Compute an inter-distance measure.

特徴点は、複数の画像スケールにおいて二次微分係数が顕著な局所領域である。より大きい画像スケールで検出された特徴点(=スケールの小さい特徴点)は、正しい幾何変換パラメータと誤っている幾何変換パラメータとの差分(誤差)が小さい場合において、識別力が高い。逆に、より小さい画像スケールで検出された特徴点(=スケールの大きい特徴点)は、前記差分が大きい場合において、識別力が高い。従って、特徴点の座標にある画素を距離測度の計算に用いることによって、正しい幾何変換パラメータと誤っている幾何変換パラメータとの差分が小さい場合でも大きい場合でも、より正確に距離測度を近似し、幾何変換パラメータを推定するのが可能である。   The feature point is a local area where the second derivative is remarkable in a plurality of image scales. A feature point detected with a larger image scale (= a feature point with a small scale) has high discrimination power when the difference (error) between the correct geometric transformation parameter and the incorrect geometric transformation parameter is small. On the contrary, a feature point detected with a smaller image scale (= a feature point with a large scale) has high discrimination power when the difference is large. Therefore, by using the pixels at the coordinates of the feature points in the calculation of the distance measure, the distance measure can be more accurately approximated, regardless of whether the difference between the correct geometric transformation parameter and the incorrect geometric transformation parameter is small or large. It is possible to estimate geometric transformation parameters.

<第3の実施の形態に係るテンプレートマッチング装置の構成>
第3の実施の形態のテンプレートマッチング装置100の画素選択部30は、テンプレート画像から画素値の二次微分係数に基づいて複数の特徴点を抽出し、抽出された複数の特徴点に対応する、テンプレート画像における複数の画素を選択する。
<Structure of Template Matching Device According to Third Embodiment>
The pixel selection unit 30 of the template matching device 100 of the third exemplary embodiment extracts a plurality of feature points from the template image based on the second derivative of the pixel value, and corresponds to the plurality of extracted feature points. Select a plurality of pixels in the template image.

例えば、テンプレート画像から二次微分係数が顕著な特徴点を抽出し、特徴点の座標にある画素を選択し、選択された全ての画素を出力する。前記特徴点は、LoG特徴点検出方法、DoG特徴点検出方法、Hessian-Laplace特徴点検出方法等を用いることによって抽出される。   For example, a feature point with a remarkable second derivative is extracted from the template image, a pixel at the coordinates of the feature point is selected, and all the selected pixels are output. The feature points are extracted by using a LoG feature point detection method, a DoG feature point detection method, a Hessian-Laplace feature point detection method, or the like.

なお、第3の実施の形態に係るテンプレートマッチング装置の他の構成及び作用については、第1の実施の形態と同様であるため、説明を省略する。   Note that other configurations and operations of the template matching device according to the third exemplary embodiment are the same as those of the first exemplary embodiment, so description thereof will be omitted.

以上説明したように、本発明の第3の実施の形態に係るテンプレートマッチング装置によれば、入力されたテンプレート画像と観測画像とのペアについて、幾何変換パラメータの候補の各々を推定し、テンプレート画像の画素値の二次微分係数に基づいて、二次微分係数が顕著な特徴点の画素を選択し、選択された画素の各々に対し、幾何変換パラメータの候補を適用したときの、観測画像における画素の各々との画素間距離測度を計算し、画素間距離測度に基づく画像間距離測度が最小となる幾何変換パラメータの候補を適用して、観測画像におけるテンプレート画像の位置を計算することにより、計算量を抑制し、かつ、画像間の幾何変換を考慮して、精度よくテンプレート画像の位置を検出することができる。   As described above, according to the template matching apparatus according to the third embodiment of the present invention, for each pair of the input template image and observation image, each of the geometric transformation parameter candidates is estimated to obtain the template image. Based on the second derivative of the pixel value of, the pixel of the feature point where the second derivative is remarkable is selected, and the candidate of the geometric transformation parameter is applied to each of the selected pixels. By calculating the inter-pixel distance measure with each of the pixels, applying the candidate geometric transformation parameter that minimizes the inter-image distance measure based on the inter-pixel distance measure, and by calculating the position of the template image in the observed image, The position of the template image can be accurately detected while suppressing the calculation amount and taking into consideration the geometric conversion between the images.

[第4の実施の形態]
次に、本発明の第4の実施の形態に係るテンプレートマッチング装置の構成について説明する。なお、第4の実施の形態に係るテンプレートマッチング装置は、第1の実施の形態と同様であるため、同一符号を付して説明を省略する。
[Fourth Embodiment]
Next, the configuration of the template matching device according to the fourth exemplary embodiment of the present invention will be described. The template matching device according to the fourth embodiment is the same as that of the first embodiment, and therefore the same reference numerals are given and the description thereof is omitted.

第4の実施の形態では、テンプレート画像において、画像間距離測度を計算するための画素として、画素値の二次微分係数が顕著な特徴点のうち、スケールが上位n個の特徴点に対応する画素を選択する点が、第1の実施の形態と異なる。   In the fourth embodiment, in the template image, as the pixels for calculating the inter-image distance measure, the scale corresponds to the top n feature points among the feature points whose secondary differential coefficients of the pixel values are remarkable. The point of selecting pixels is different from that of the first embodiment.

<概要>
前記課題3を解決するために、本発明に係わるテンプレートマッチング装置は、テンプレート画像から二次微分係数が顕著な特徴点を抽出し、特徴点の座標にある画素のみを用いて画像間距離測度を計算する。特徴点の数が距離測度の計算に必要な画素の数より大きい場合、スケールが小さい順に特徴点を並べ替え、上位の特徴点の座標にある画素のみを用いる。
<Outline>
In order to solve the above-mentioned problem 3, the template matching apparatus according to the present invention extracts a feature point having a remarkable second derivative from a template image, and uses only pixels at the coordinates of the feature point to obtain an inter-image distance measure. calculate. When the number of feature points is larger than the number of pixels required for calculation of the distance measure, the feature points are rearranged in ascending order of scale, and only the pixels at the coordinates of the higher-order feature points are used.

正しい幾何変換パラメータと誤っている幾何変換パラメータとの差分について、差分が小さい場合、区別がより困難である。そこで、スケールが小さい順に特徴点を並べ替え、上位の特徴点の座標にある画素を選択することによって、正しい幾何変換パラメータと誤っている幾何変換パラメータとを区別する際に、識別力のより高い画素を選択するのが可能になり、より正確に距離測度を近似し、幾何変換パラメータを推定するのが可能になる。   Regarding the difference between the correct geometric transformation parameter and the incorrect geometric transformation parameter, if the difference is small, it is more difficult to distinguish. Therefore, by sorting the feature points in ascending order of scale and selecting pixels at the coordinates of the higher-order feature points, the discriminative power is higher when distinguishing the correct geometric transformation parameter from the incorrect geometric transformation parameter. It becomes possible to select pixels and more accurately approximate the distance measure and estimate geometric transformation parameters.

<第4の実施の形態に係るテンプレートマッチング装置の構成>
第4の実施の形態のテンプレートマッチング装置100の画素選択部30は、テンプレート画像から画素値の二次微分係数に基づいて複数の特徴点を抽出し、抽出された複数の特徴点を、スケールが大きい順に並べ替え、上位n個の特徴点に対応する、テンプレート画像における複数の画素を選択する。
<Structure of Template Matching Device According to Fourth Embodiment>
The pixel selection unit 30 of the template matching device 100 of the fourth exemplary embodiment extracts a plurality of feature points from the template image based on the second derivative of the pixel value, and scales the extracted plurality of feature points. The pixels are rearranged in descending order, and a plurality of pixels in the template image corresponding to the top n feature points are selected.

例えば、テンプレート画像から二次微分係数が顕著な特徴点を抽出し、特徴点の座標にある画素を選択する。特徴点の数が距離測度の計算に必要な画素の数より大きい場合、スケールが小さい順に特徴点を並べ替え、上位n個の特徴点の座標にある画素を出力する。   For example, a feature point having a remarkable second derivative is extracted from the template image, and a pixel at the coordinates of the feature point is selected. If the number of feature points is larger than the number of pixels required for calculation of the distance measure, the feature points are rearranged in order of decreasing scale, and the pixels at the coordinates of the top n feature points are output.

なお、第4の実施の形態に係るテンプレートマッチング装置の他の構成及び作用については、第1の実施の形態と同様であるため、説明を省略する。   Note that other configurations and operations of the template matching device according to the fourth exemplary embodiment are the same as those of the first exemplary embodiment, so description thereof will be omitted.

以上説明したように、本発明の第4の実施の形態に係るテンプレートマッチング装置によれば、入力されたテンプレート画像と観測画像とのペアについて、幾何変換パラメータの候補の各々を推定し、テンプレート画像の画素値の二次微分係数に基づいて、二次微分係数が顕著な特徴点の画素を選択し、選択された画素の各々に対し、幾何変換パラメータの候補を適用したときの、観測画像における画素の各々との画素間距離測度を計算し、画素間距離測度に基づく画像間距離測度が最小となる幾何変換パラメータの候補を適用して、観測画像におけるテンプレート画像の位置を計算することにより、計算量を抑制し、かつ、画像間の幾何変換を考慮して、精度よくテンプレート画像の位置を検出することができる。   As described above, according to the template matching apparatus according to the fourth embodiment of the present invention, each candidate geometric transformation parameter is estimated for the pair of the input template image and observation image, and the template image is obtained. Based on the second derivative of the pixel value of, the pixel of the feature point where the second derivative is remarkable is selected, and the candidate of the geometric transformation parameter is applied to each of the selected pixels. By calculating the inter-pixel distance measure with each of the pixels, applying the candidate geometric transformation parameter that minimizes the inter-image distance measure based on the inter-pixel distance measure, and by calculating the position of the template image in the observed image, The position of the template image can be accurately detected while suppressing the calculation amount and taking into consideration the geometric conversion between the images.

なお、本発明は、上述した実施の形態に限定されるものではなく、この発明の要旨を逸脱しない範囲内で様々な変形や応用が可能である。   The present invention is not limited to the above-described embodiments, and various modifications and applications are possible without departing from the scope of the present invention.

例えば、上述のテンプレートマッチング装置は、内部にコンピュータシステムを有しているが、「コンピュータシステム」は、WWWシステムを利用している場合であれば、ホームページ提供環境(あるいは表示環境)も含むものとする。   For example, the template matching apparatus described above has a computer system inside, but the "computer system" also includes a homepage providing environment (or display environment) if a WWW system is used.

また、本願明細書中において、プログラムが予めインストールされている実施形態として説明したが、当該プログラムを、コンピュータ読み取り可能な記録媒体に格納して提供することも可能である。   Further, in the specification of the present application, the embodiment in which the program is pre-installed has been described, but the program can be stored in a computer-readable recording medium and provided.

10 入力部
20 演算部
22 幾何検証部
24 画像間距離測度計算部
26 判断部
28 テンプレート位置計算部
30 画素選択部
32 幾何変換部
34 画素間距離測度計算部
36 判断部
40 出力部
100 テンプレートマッチング装置
10 input unit 20 arithmetic unit 22 geometric verification unit 24 inter-image distance measure calculation unit 26 judgment unit 28 template position calculation unit 30 pixel selection unit 32 geometric conversion unit 34 inter-pixel distance measure calculation unit 36 judgment unit 40 output unit 100 template matching device

Claims (4)

入力されたテンプレート画像と観測画像とのペアについて、テンプレート画像と観測画像との各々から複数の特徴点を抽出し、画像間の幾何変換を考慮して、前記テンプレート画像と前記観測画像との各々の前記複数の特徴点の中から局所特徴量の対応付けを行い、前記テンプレート画像の特徴点と前記テンプレート画像の特徴点に対応する前記観測画像の特徴点とのペアとなる、画像間の正対応点を検出し、検出された正対応点の各々について、画像間の幾何変換を表す幾何変換パラメータの候補の各々を推定することにより、前記正対応点のペア数の幾何変換パラメータの候補を求める幾何検証部と、
前記テンプレート画像の各画素の画素値の二次微分係数の絶対値の大きさに基づいて複数の特徴点を抽出し、前記抽出された複数の特徴点のうちの、スケールが小さい順に上位n個(nは特徴点の総数より小さい整数である。)の特徴点に対応する、前記テンプレート画像における複数の局所領域それぞれの画素を選択する画素選択部と、
前記幾何検証部によって推定された前記幾何変換パラメータの候補の各々について、前記画素選択部によって選択された画素の各々に対し、前記幾何変換パラメータの候補を適用したときの、前記観測画像における画素の各々との画素間距離測度を計算する画素間距離測度計算部と、
前記選択された画素の各々に対して計算された前記画素間距離測度に基づく画像間距離測度が最小となる前記幾何変換パラメータの候補を、前記テンプレート画像と前記観測画像とのペアにおける幾何変換パラメータとして推定する判断部と、
前記判断部によって推定された前記幾何変換パラメータを適用して、前記観測画像における前記テンプレート画像の位置を計算するテンプレート位置計算部と、
を含むテンプレートマッチング装置。
For a pair of the input template image and the observation image, a plurality of feature points are extracted from each of the template image and the observation image, and considering the geometric transformation between the images, each of the template image and the observation image The local feature amounts are associated from the plurality of feature points, and a pair of feature points of the template image and feature points of the observed image corresponding to the feature points of the template image are paired, By detecting the corresponding points and estimating each of the candidates of the geometric transformation parameters representing the geometric transformation between the images for each of the detected positive corresponding points, the candidates of the geometric transformation parameters of the number of pairs of the positive corresponding points are obtained. The required geometric verification section,
A plurality of characteristic points are extracted based on the magnitude of the absolute value of the second derivative of the pixel value of each pixel of the template image, and among the extracted plurality of characteristic points, the upper n pieces are arranged in order from the smallest scale. A pixel selection unit that selects pixels of each of a plurality of local regions in the template image corresponding to the feature points (n is an integer smaller than the total number of feature points);
For each of the geometric conversion parameter candidates estimated by the geometric verification unit, for each of the pixels selected by the pixel selection unit, when applying the geometric conversion parameter candidates, of the pixels in the observed image An inter-pixel distance measure calculation unit that calculates an inter-pixel distance measure with each,
The candidate of the geometric transformation parameter that minimizes the inter-image distance measure based on the inter-pixel distance measure calculated for each of the selected pixels is a geometric transformation parameter in the pair of the template image and the observed image. And a determination unit that estimates
By applying the geometric transformation parameter estimated by the determination unit, a template position calculation unit that calculates the position of the template image in the observation image,
Template matching device including.
前記画素選択部は、複数の画像スケールにおいて抽出された特徴点のうち、大きい画像スケールで検出された特徴点から順に上位n個の特徴点を、前記スケールが小さい順に上位n個の特徴点とする請求項1記載のテンプレートマッチング装置。   Among the feature points extracted in the plurality of image scales, the pixel selection unit sets the top n feature points in order from the feature point detected in the larger image scale, and the top n feature points in the order of smaller scale. The template matching device according to claim 1. 幾何検証部が、入力されたテンプレート画像と観測画像とのペアについて、テンプレート画像と観測画像との各々から複数の特徴点を抽出し、画像間の幾何変換を考慮して、前記テンプレート画像と前記観測画像との各々の前記複数の特徴点の中から局所特徴量の対応付けを行い、前記テンプレート画像の特徴点と前記テンプレート画像の特徴点に対応する前記観測画像の特徴点とのペアとなる、画像間の正対応点を検出し、検出された正対応点の各々について、画像間の幾何変換を表す幾何変換パラメータの候補の各々を推定することにより、前記正対応点のペア数の幾何変換パラメータの候補を求め、
画素選択部が、前記テンプレート画像の各画素の画素値の二次微分係数の絶対値の大きさに基づいて複数の特徴点を抽出し、前記抽出された複数の特徴点のうちの、スケールが小さい順に上位n個(nは特徴点の総数より小さい整数である。)の特徴点に対応する、前記テンプレート画像における複数の局所領域それぞれの画素を選択し、
画素間距離測度計算部が、前記幾何検証部によって推定された前記幾何変換パラメータの候補の各々について、前記画素選択部によって選択された画素の各々に対し、前記幾何変換パラメータの候補を適用したときの、前記観測画像における画素の各々との画素間距離測度を計算し、
判断部が、前記選択された画素の各々に対して計算された前記画素間距離測度に基づく画像間距離測度が最小となる前記幾何変換パラメータの候補を、前記テンプレート画像と前記観測画像とのペアにおける幾何変換パラメータとして推定し、
テンプレート位置計算部が、前記判断部によって推定された前記幾何変換パラメータを適用して、前記観測画像における前記テンプレート画像の位置を計算する
テンプレートマッチング方法。
The geometrical verification unit extracts a plurality of feature points from each of the template image and the observed image for the pair of the input template image and the observed image, and considers the geometric transformation between the images, and the template image and the A local feature amount is associated from each of the plurality of feature points with the observation image to form a pair of the feature point of the template image and the feature point of the observation image corresponding to the feature point of the template image. , By detecting each of the positive corresponding points between the images and estimating each of the candidates of the geometric transformation parameters representing the geometric transformation between the images for each of the detected positive corresponding points, the geometry of the number of pairs of the positive corresponding points is calculated. Find conversion parameter candidates,
The pixel selection unit extracts a plurality of feature points based on the magnitude of the absolute value of the second derivative of the pixel value of each pixel of the template image, the scale of the extracted plurality of feature points is Select the pixels of each of the plurality of local regions in the template image, which correspond to the top n (n is an integer smaller than the total number of feature points) feature points in ascending order,
When the inter-pixel distance measure calculation unit applies the geometric conversion parameter candidate to each of the pixels selected by the pixel selection unit for each of the geometric conversion parameter candidates estimated by the geometric verification unit , Calculating an inter-pixel distance measure with each of the pixels in the observed image,
The determination unit selects a candidate of the geometrical transformation parameter that minimizes the inter-image distance measure based on the inter-pixel distance measure calculated for each of the selected pixels, as a pair of the template image and the observed image. Estimated as a geometric transformation parameter in
A template matching method in which the template position calculation unit calculates the position of the template image in the observed image by applying the geometric transformation parameter estimated by the determination unit.
コンピュータを、請求項1又は2記載のテンプレートマッチング装置を構成する各部として機能させるためのプログラム。   A program for causing a computer to function as each unit constituting the template matching device according to claim 1.
JP2019070422A 2019-04-02 2019-04-02 Template matching device, method, and program Active JP6682167B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019070422A JP6682167B2 (en) 2019-04-02 2019-04-02 Template matching device, method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019070422A JP6682167B2 (en) 2019-04-02 2019-04-02 Template matching device, method, and program

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2016208802A Division JP6639369B2 (en) 2016-10-25 2016-10-25 Template matching apparatus, method, and program

Publications (2)

Publication Number Publication Date
JP2019133702A JP2019133702A (en) 2019-08-08
JP6682167B2 true JP6682167B2 (en) 2020-04-15

Family

ID=67546315

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019070422A Active JP6682167B2 (en) 2019-04-02 2019-04-02 Template matching device, method, and program

Country Status (1)

Country Link
JP (1) JP6682167B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113405455B (en) * 2021-05-17 2023-03-07 中创智维科技有限公司 Method for automatically calibrating pixel ratio by calculating geometric parameters of contact network

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3223384B2 (en) * 1992-06-19 2001-10-29 オムロン株式会社 Pattern matching device for grayscale images
JP5310402B2 (en) * 2009-09-02 2013-10-09 日本電気株式会社 Image conversion parameter calculation apparatus, image conversion parameter calculation method, and program
JP2012033022A (en) * 2010-07-30 2012-02-16 Panasonic Corp Change area detection device and method in space

Also Published As

Publication number Publication date
JP2019133702A (en) 2019-08-08

Similar Documents

Publication Publication Date Title
JP5671281B2 (en) Position / orientation measuring apparatus, control method and program for position / orientation measuring apparatus
CN105160641B (en) X-ray welded seam area extracting method based on image procossing
JP6899189B2 (en) Systems and methods for efficiently scoring probes in images with a vision system
CN107292869B (en) Image speckle detection method based on anisotropic Gaussian kernel and gradient search
JP7188201B2 (en) Image processing device, image processing method, and image processing program
EP3300025B1 (en) Image processing device and image processing method
CN110378906B (en) Ellipse detection method based on chord tangent distance
CN106296587B (en) Splicing method of tire mold images
CN106340010A (en) Corner detection method based on second-order contour difference
CN111222507A (en) Automatic identification method of digital meter reading and computer readable storage medium
CN111161339A (en) Distance measuring method, device, equipment and computer readable medium
JP6682167B2 (en) Template matching device, method, and program
JP5976089B2 (en) Position / orientation measuring apparatus, position / orientation measuring method, and program
TWI543117B (en) Method for recognizing and locating object
JP2008116207A (en) Apparatus and method for image measurement, and program
JP6639369B2 (en) Template matching apparatus, method, and program
JP2009146150A (en) Method and device for detecting feature position
CN111667429B (en) Target positioning correction method for inspection robot
JP4639044B2 (en) Contour shape extraction device
JP4887820B2 (en) Image position measuring method, image position measuring apparatus, and image position measuring program
JP2013182416A (en) Feature amount extraction device, feature amount extraction method, and feature amount extraction program
JP2018041169A (en) Information processing device and control method and program thereof
WO2002063547A1 (en) Structure-guided image measurement method
Dowson et al. Image template matching using mutual information and NP-Windows
KR102389295B1 (en) Method and Apparatus for Instance Segmentation Based Object Size Estimation from Single Indoor Image

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20190402

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20200310

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20200317

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20200324

R150 Certificate of patent or registration of utility model

Ref document number: 6682167

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150