JP2008225636A - Template matching device, camera equipped with template matching device, and program for making computer perform template matching - Google Patents

Template matching device, camera equipped with template matching device, and program for making computer perform template matching Download PDF

Info

Publication number
JP2008225636A
JP2008225636A JP2007060087A JP2007060087A JP2008225636A JP 2008225636 A JP2008225636 A JP 2008225636A JP 2007060087 A JP2007060087 A JP 2007060087A JP 2007060087 A JP2007060087 A JP 2007060087A JP 2008225636 A JP2008225636 A JP 2008225636A
Authority
JP
Japan
Prior art keywords
image
template
feature amount
matching
color components
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
JP2007060087A
Other languages
Japanese (ja)
Other versions
JP2008225636A5 (en
JP5076567B2 (en
Inventor
Hiroyuki Abe
啓之 阿部
Kenji Takiguchi
健二 瀧口
O Mori
王 森
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.)
Nikon Corp
Original Assignee
Nikon 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 Nikon Corp filed Critical Nikon Corp
Priority to JP2007060087A priority Critical patent/JP5076567B2/en
Publication of JP2008225636A publication Critical patent/JP2008225636A/en
Publication of JP2008225636A5 publication Critical patent/JP2008225636A5/ja
Application granted granted Critical
Publication of JP5076567B2 publication Critical patent/JP5076567B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Analysis (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a template matching device and a template matching method that can accurately specify a matching position even if an input image has geometric change. <P>SOLUTION: The template matching device includes a first calculating means of calculating a first feature quantity by performing operations by a plurality of color components using a predetermined distance table for the intensity of a known template image containing the color components, an extracting means of extracting partial images for operations from a plurality of different positions in an input image containing a plurality of color components, a second calculating means of calculating a second feature quantity by performing operations by the respective color components using the distance table for intensities of the partial images extracted by the extracting means, an arithmetic means of finding similarities between the template image and partial images by comparing identical color components with each other based upon the first feature quantity and second feature quantity, and a specifying means of specifying positions of matching with the template image in the input image by comparing the similarities found at the respective positions in the input image with each other. <P>COPYRIGHT: (C)2008,JPO&INPIT

Description

本発明は、画像に対してテンプレートマッチングを行うテンプレートマッチング装置、テンプレートマッチング装置を備えたカメラ、テンプレートマッチングをコンピュータで行うためのプログラムに関する。   The present invention relates to a template matching device that performs template matching on an image, a camera including the template matching device, and a program for performing template matching on a computer.

テンプレートマッチングは、入力信号の中から既知のテンプレート信号に合致する部分信号(ターゲット)を探索して、ターゲットの位置(合致位置)を特定する処理である。この処理では、入力信号の中から抽出した演算用の部分信号と既知のテンプレート信号とのマッチング演算が、演算用の部分信号の抽出位置を少しずつ移動させながら、繰り返し行われる。そして、入力信号の中の各位置でのマッチング演算の結果を大小比較することで、合致位置が特定される。   Template matching is a process of searching for a partial signal (target) that matches a known template signal from input signals and specifying a target position (matching position). In this process, the matching operation between the partial signal for calculation extracted from the input signal and the known template signal is repeatedly performed while the extraction position of the partial signal for calculation is moved little by little. Then, the matching position is specified by comparing the result of the matching calculation at each position in the input signal.

また、マッチング演算には、周知の相互相関法や残差逐次検定法などが用いられる(例えば特許文献1を参照)。これらの方法は、演算用の部分信号とテンプレート信号との対応位置どうしで信号強度の演算を行い、その結果を信号全体で集計するものである。
特開平5−81433号公報
For the matching operation, a well-known cross-correlation method, residual successive test method, or the like is used (see, for example, Patent Document 1). In these methods, signal strength is calculated between corresponding positions of a partial signal for calculation and a template signal, and the results are totaled over the entire signal.
JP-A-5-81433

しかしながら、演算用の部分信号とテンプレート信号との対応位置どうしで信号強度の演算を行う上記の方法には、次の問題があった。例えば、画像情報を含む二次元の入力信号の場合、入力信号に幾何学的変化(回転や縮尺の変化など)があると、合致位置の特定を正確に行えるとは限らず、疑似マッチングやマッチング不可能になることがある。また、音声情報を含む一次元の入力信号の場合は、入力信号に幾何学的変化(縮尺の変化など)があると、同様に疑似マッチングやマッチング不可能になることがある。   However, the above method for calculating the signal intensity between the corresponding positions of the partial signal for calculation and the template signal has the following problems. For example, in the case of a two-dimensional input signal containing image information, if there is a geometric change (rotation, change in scale, etc.) in the input signal, it is not always possible to accurately identify the matching position, and pseudo matching or matching It may be impossible. In the case of a one-dimensional input signal including audio information, if there is a geometric change (such as a change in scale) in the input signal, pseudo matching or matching may not be possible.

本発明の目的は、入力画像に幾何学的変化があっても正確に合致位置を特定できるテンプレートマッチング装置を提供することにある。   An object of the present invention is to provide a template matching apparatus that can accurately specify a matching position even if there is a geometric change in an input image.

本発明のテンプレートマッチング装置は、複数の色成分を含む既知のテンプレート画像の強度に対して、所定の距離テーブルを用いて各色成分ごとに演算を施し第1の特徴量を算出する第1の算出手段と、前記複数の色成分を含む入力画像の中の異なる複数の位置から演算用の部分画像を抽出する抽出手段と、前記抽出手段により抽出された前記部分画像の強度に対して、前記距離テーブルを用いて各色成分ごとに演算を施し第2の特徴量を算出する第2の算出手段と、前記第1の特徴量と前記第2の特徴量とに基づいて、同じ色成分どうしを比較することにより、前記テンプレート画像と前記部分画像との類似度を求める演算手段と、前記入力画像の各位置で求められた前記類似度を大小比較することにより、前記入力画像の中の前記テンプレート画像との合致位置を特定する特定手段とを備える。   The template matching apparatus of the present invention performs a first calculation for calculating a first feature amount by performing an operation for each color component using a predetermined distance table with respect to the intensity of a known template image including a plurality of color components. Means for extracting partial images for calculation from a plurality of different positions in the input image including the plurality of color components, and the distance with respect to the intensity of the partial image extracted by the extraction means A second calculation unit that calculates a second feature amount by performing an operation for each color component using a table, and compares the same color components based on the first feature amount and the second feature amount Thus, the calculation means for obtaining the similarity between the template image and the partial image and the similarity obtained at each position of the input image are compared in size to thereby compare the template in the input image. And a specifying means for specifying the matching position between the rate image.

なお、好ましくは、前記距離テーブルは、前記テンプレート画像の大きさに応じて定められたテーブルであり、前記テンプレート画像の中心からの距離に依存した数値群からなっても良い。
本発明の別のテンプレートマッチング装置は、複数の色成分を含む既知のテンプレート画像の強度を前記テンプレート画像内の全ての画素について各色成分ごとに加算するか、または、前記強度を前記テンプレート画像内の一部の画素について各色成分ごとに加算して第1の特徴量を算出する第1の算出手段と、前記複数の色成分を含む入力画像の中の異なる複数の位置から演算用の部分画像を抽出する抽出手段と、前記抽出手段により抽出された前記部分画像の強度を前記部分画像内の全ての画素について各色成分ごとに加算するか、または、前記強度を前記部分画像内の一部の画素について各色成分ごとに加算して第2の特徴量を算出する第2の算出手段と、前記第1の特徴量と前記第2の特徴量とに基づいて、同じ色成分どうしを比較することにより、前記テンプレート画像と前記部分画像との類似度を求める演算手段と、前記入力画像の各位置で求められた前記類似度を大小比較することにより、前記入力画像の中の前記テンプレート画像との合致位置を特定する特定手段とを備える。
Preferably, the distance table is a table determined according to the size of the template image, and may be composed of a numerical value group depending on the distance from the center of the template image.
Another template matching apparatus of the present invention adds the intensity of a known template image including a plurality of color components for each color component for all pixels in the template image, or adds the intensity in the template image. First calculating means for calculating a first feature amount by adding each color component for a part of pixels, and partial images for calculation from a plurality of different positions in the input image including the plurality of color components An extracting means for extracting, and the intensity of the partial image extracted by the extracting means is added for each color component for all pixels in the partial image, or the intensity is added to some pixels in the partial image The second calculation means for calculating the second feature amount by adding each color component for the same, and comparing the same color components based on the first feature amount and the second feature amount By calculating the similarity between the template image and the partial image, the template image in the input image is compared by comparing the similarity obtained at each position of the input image. And specifying means for specifying a matching position.

なお、好ましくは、前記演算手段は、前記第1の特徴量と前記第2の特徴量との差分が所定の閾値以下である場合のみ、前記類似度を算出しても良い。
また、上述したテンプレートマッチング装置を備えたカメラも本発明の具体的態様として有効である。
また、上記発明に関する構成を、処理対象の画像データに対する処理をコンピュータで実現するためのテンプレートマッチングプログラムに変換して表現したものも本発明の具体的態様として有効である。
Preferably, the calculation means may calculate the similarity only when a difference between the first feature value and the second feature value is equal to or less than a predetermined threshold value.
A camera equipped with the template matching device described above is also effective as a specific aspect of the present invention.
In addition, a configuration obtained by converting the configuration related to the above invention into a template matching program for realizing processing on image data to be processed by a computer is also effective as a specific aspect of the present invention.

本発明によれば、入力画像に幾何学的変化があっても正確に合致位置を特定することができる。   According to the present invention, it is possible to accurately specify a matching position even if there is a geometric change in the input image.

以下、図面を用いて本発明の実施形態を詳細に説明する。
(第1実施形態)
ここでは、第1実施形態のテンプレートマッチング装置および方法について、図1に示す電子カメラ10を例に説明する。電子カメラ10には、光学系11と光学系制御部12と撮像素子13と画像処理部14と記録部15と記録媒体16と画像表示部17と操作部18とCPU19とが設けられる。光学系11は、レンズや絞りなどを含む。光学系制御部12は、絞りやレンズの焦点位置の制御を行う。撮像素子13は、光学系11を介して結像された被写体像を画像データに変換して、画像処理部14に出力する。画像処理部14は、色信号生成、マトリクス変換処理、γ変換処理、補正処理など各種のディジタル信号処理を行い、入力画像として不図示のメモリに記憶させる。なお、各画像処理の具体的な方法は説明を省略する。また、画像処理部14は、後述するテンプレートマッチングを行う。記録部15は、画像データを記録媒体16に記録する。記録媒体16は、メモリカードなどのリムーバブルメモリである。画像表示部17は、撮像により生成された画像や記録媒体16に記録された画像を表示する。操作部18は、不図示の電源ボタン、レリーズボタンなどを含む。CPU19は、各部を統合的に制御する。なお、CPU19は、後述するテンプレートマッチングの結果を用いて、AF調整、AE調整、ホワイトバランス調整、主要被写体検出(顔認識など)、自動撮影などの制御を行う。また、CPU19は、操作部18に対するユーザ操作の有無を検知するとともに、各処理を実行するためのプログラムを予め記録している。
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
(First embodiment)
Here, the template matching apparatus and method according to the first embodiment will be described using the electronic camera 10 shown in FIG. 1 as an example. The electronic camera 10 includes an optical system 11, an optical system control unit 12, an image sensor 13, an image processing unit 14, a recording unit 15, a recording medium 16, an image display unit 17, an operation unit 18, and a CPU 19. The optical system 11 includes a lens, a diaphragm, and the like. The optical system control unit 12 controls the focal position of the diaphragm and lens. The imaging device 13 converts the subject image formed through the optical system 11 into image data and outputs the image data to the image processing unit 14. The image processing unit 14 performs various kinds of digital signal processing such as color signal generation, matrix conversion processing, γ conversion processing, and correction processing, and stores them in a memory (not shown) as an input image. Note that a description of a specific method of each image processing is omitted. The image processing unit 14 performs template matching described later. The recording unit 15 records the image data on the recording medium 16. The recording medium 16 is a removable memory such as a memory card. The image display unit 17 displays an image generated by imaging or an image recorded on the recording medium 16. The operation unit 18 includes a power button and a release button (not shown). The CPU 19 controls each unit in an integrated manner. Note that the CPU 19 performs control such as AF adjustment, AE adjustment, white balance adjustment, main subject detection (face recognition, etc.), automatic shooting, and the like using the result of template matching described later. Further, the CPU 19 detects the presence / absence of a user operation on the operation unit 18 and records a program for executing each process in advance.

次に、電子カメラ10におけるテンプレートマッチングについて説明する。テンプレートマッチングは、例えば図2に示す入力画像21の中から既知のテンプレート画像22に合致する部分画像(ターゲット23)を探索して、ターゲット23の位置(以下「合致位置(X1,Y1)」という)を特定する処理である。第1実施形態のテンプレートマッチングは、図3に示すフローチャートの手順(ステップS1〜S11)にしたがって行われる。また、入力画像21は、スルー画像を含む撮像により生成された画像や、記録媒体16に記録された画像である。 Next, template matching in the electronic camera 10 will be described. In template matching, for example, a partial image (target 23) that matches a known template image 22 is searched from the input image 21 shown in FIG. 2, and the position of the target 23 (hereinafter referred to as “matching position (X 1 , Y 1 )). ”). The template matching of the first embodiment is performed according to the procedure (steps S1 to S11) of the flowchart shown in FIG. The input image 21 is an image generated by imaging including a through image or an image recorded on the recording medium 16.

図3の処理では、入力画像21の中から抽出した演算用の部分画像24とテンプレート画像22とのマッチング演算(S4〜S7)が、部分画像24の抽出位置(X2,Y2)を少しずつ移動させながら、繰り返し行われる。マッチング演算(S4〜S7)は、後述の慣性モーメントに基づいて、部分画像24とテンプレート画像22との類似度を求める演算である。類似度は、部分画像24とテンプレート画像22との「類似性に関する指標」の1つであり、「類似性に関する正確な指標」である。 In the processing of FIG. 3, the matching operation (S 4 to S 7) between the partial image 24 for calculation extracted from the input image 21 and the template image 22 slightly sets the extraction position (X 2 , Y 2 ) of the partial image 24. Repeatedly moving while moving. The matching operations (S4 to S7) are operations for obtaining the similarity between the partial image 24 and the template image 22 based on the moment of inertia described later. The similarity is one of “an index related to similarity” between the partial image 24 and the template image 22 and is an “accurate index related to similarity”.

また、図3の処理では、入力画像21と演算用の部分画像24とテンプレート画像22が、各々、3つの色成分(つまり加色の三原色または光の三原色と呼ばれるRGB成分)を含むとする。RGB成分を含む画像(21,24,22)はカラー画像である。
図3の処理(S1〜S11)について順に説明する。
ステップS1において、CPU19は、テンプレート画像22の全体からRGB成分の慣性モーメントM22(以下、「第1慣性モーメントM22」と称する)を各色成分ごとに算出する。
In the processing of FIG. 3, it is assumed that the input image 21, the partial image 24 for calculation, and the template image 22 each include three color components (that is, RGB components called additive primary colors or light primary colors). Images (21, 24, 22) including RGB components are color images.
The processes (S1 to S11) in FIG. 3 will be described in order.
In step S <b> 1, the CPU 19 calculates an RGB component inertia moment M 22 (hereinafter referred to as “first inertia moment M 22 ”) for each color component from the entire template image 22.

例えば、R成分の第1慣性モーメントM22は、テンプレート画像22のR成分(図4)の位置(x,y)における濃度値Aiを用い、次の式(1)により算出される。濃度値Aiの“i”は、テンプレート画像22の中での画素番号である。
22 = Σ(xi 2+yi 2)Ai …式(1)
式(1)の第1慣性モーメントM22は、原点(画像中心)まわりの濃度の慣性モーメントであり、X軸まわりの濃度の慣性モーメント(MX=Σxi 2i)と、Y軸まわりの濃度の慣性モーメント(MY=Σyi 2i)との和に相当する。
For example, the first inertia moment M 22 of the R component is calculated by the following equation (1) using the density value A i at the position (x, y) of the R component (FIG. 4) of the template image 22. “I” in the density value A i is a pixel number in the template image 22.
M 22 = Σ (x i 2 + y i 2 ) A i (1)
The first moment of inertia M 22 in equation (1) is the moment of inertia of the density around the origin (image center), and the moment of inertia of the density around the X axis (M X = Σx i 2 A i ) and the Y axis Is equivalent to the sum of the moment of inertia (M Y = Σy i 2 A i ).

また、座標(xg,yg)まわりの濃度の慣性モーメントは、次の(式)2により算出される。
22 = Σ((xi−xg2+(yi−yg2)Ai …式(2)
R成分の他、G成分,B成分の第1慣性モーメントM22は、各々、テンプレート画像22のG成分,B成分の全体から、上記の式(1)または式(2)と同様の式により算出される。
Further, the moment of inertia of the concentration around the coordinates (x g , y g ) is calculated by the following (Expression) 2.
M 22 = Σ ((x i −x g ) 2 + (y i −y g ) 2 ) A i Formula (2)
In addition to the R component, the first inertia moment M 22 of the G component and the B component is obtained from the whole of the G component and the B component of the template image 22 by the same formula as the above formula (1) or formula (2), respectively. Calculated.

テンプレート画像22の大きさを固定にすれば式(1)または式(2)の前半部分は固定化され距離テーブルであらわされる。15×15の大きさのテンプレート画像の距離テーブルを図5に示す。図5に示すように、慣性モーメントの距離テーブルは周辺で値が大きく中央でゼロになる。一方、通常テンプレート画像は、図6に示すように、中央部分に人物等の主要被写体が多い。つまり、図5に示した距離テーブルを用いると、重要な情報が軽く扱われ、重要でない情報が重く扱われてしまう。そのため、第1実施形態では、図7に示す距離テーブルを用いる。図7の距離テーブルは、中心の値が大きく、周辺の値が小さい距離テーブルである。図7に示した距離テーブルは、図5に示した距離テーブルに基づいて作成することができる。   If the size of the template image 22 is fixed, the first half of the equation (1) or (2) is fixed and represented by a distance table. FIG. 5 shows a distance table for a template image having a size of 15 × 15. As shown in FIG. 5, the distance table of the moment of inertia has a large value at the periphery and zero at the center. On the other hand, as shown in FIG. 6, the normal template image has many main subjects such as a person in the center. That is, when the distance table shown in FIG. 5 is used, important information is handled lightly and unimportant information is handled heavy. Therefore, in the first embodiment, the distance table shown in FIG. 7 is used. The distance table in FIG. 7 is a distance table having a large central value and a small peripheral value. The distance table shown in FIG. 7 can be created based on the distance table shown in FIG.

ステップS2において、CPU19は、入力画像21の中から演算用の部分画像24を抽出する。演算用の部分画像24は、テンプレート画像22と縦横各々同じ大きさ(画素数)の矩形状である。演算用の部分画像24とテンプレート画像22は、共に、入力画像21より小さい(画素数が少ない)。
ステップS3において、CPU19は、ステップS2で抽出した演算用の部分画像24の全体からRGB成分の慣性モーメントM24(以下、「第2慣性モーメントM24」と称する)を各色成分ごとに算出する。例えば、R成分の第2慣性モーメントM24の算出は、部分画像24のR成分の全体から上記したステップS1と同様に算出される。G成分,B成分も同様である。
In step S <b> 2, the CPU 19 extracts a partial image 24 for calculation from the input image 21. The calculation partial image 24 has a rectangular shape having the same size (number of pixels) as the template image 22 in the vertical and horizontal directions. The partial image 24 for calculation and the template image 22 are both smaller than the input image 21 (the number of pixels is small).
In step S3, the CPU 19 calculates an RGB component inertia moment M 24 (hereinafter referred to as “second inertia moment M 24 ”) for each color component from the entire calculation partial image 24 extracted in step S2. For example, the calculation of the second moment of inertia M 24 of the R component is calculated in the same manner as in step S 1 described above from the entire R component of the partial image 24. The same applies to the G component and the B component.

ステップS4において、CPU19は、部分画像24のR成分の第2慣性モーメントM24と、テンプレート画像22のR成分の第1慣性モーメントM22とを比較し、2つのR成分の慣性モーメントの差分の絶対値を出力する。この場合の出力値ORは、R成分の第2慣性モーメントM24と第1慣性モーメントM22との類似性に関する指標である。
ステップS5において、CPU19は、部分画像24のG成分の第2慣性モーメントM24と、テンプレート画像22のG成分の第1慣性モーメントM22とを比較し、2つのG成分の慣性モーメントの差分の絶対値を出力する(出力値OG)。
In step S4, CPU 19 is in the partial image 24 and the second moment of inertia M 24 of the R component, the template image 22 is compared with the first moment of inertia M 22 of the R component, the two R components of the moment of inertia of the differential Output the absolute value. The output value O R in this case is an index relating to the similarity between the second inertia moment M 24 and the first inertia moment M 22 of the R component.
In step S <b> 5, the CPU 19 compares the second inertia moment M 24 of the G component of the partial image 24 with the first inertia moment M 22 of the G component of the template image 22, and calculates the difference between the inertia moments of the two G components. An absolute value is output (output value O G ).

ステップS6において、CPU19は、部分画像24のB成分の第2慣性モーメントM24と、テンプレート画像22のB成分の第1慣性モーメントM22とを比較し、2つのB成分の慣性モーメントの差分の絶対値を出力する(出力値OB)。
ステップS7において、CPU19は、上記したステップS4のR成分の出力値ORと、ステップS5のG成分の出力値OGと、ステップS6のB成分の出力値OBとを、それぞれ第1慣性モーメントM22の各色成分IR,IG,IBで除すことにより正規化を行う。そして、正規化によって算出された各色成分ごとの類似度SR,SG,SBの平均を求め、その値を「部分画像24とテンプレート画像22との類似度」とする。
In step S <b> 6, the CPU 19 compares the second inertia moment M 24 of the B component of the partial image 24 with the first inertia moment M 22 of the B component of the template image 22, and calculates the difference between the inertia moments of the two B components. and it outputs the absolute value (the output value O B).
In step S7, CPU 19 includes an output value O R of the R component in step S4 described above, the output value O G of the G component in step S5, and the output value O B of the B component in step S6, a first inertia respectively Normalization is performed by dividing by the color components I R , I G and I B of the moment M 22 . Then, the average of the similarities S R , S G and S B for each color component calculated by normalization is obtained, and the value is set as “similarity between the partial image 24 and the template image 22”.

ステップS7で求めた類似度(=(SR+SG+SB)/3)は、傾向として、その値が小さいほど、部分画像24とテンプレート画像22との類似性が高く、部分画像24の抽出位置(X2,Y2)が合致位置(X1,Y1)に近いことを表す。
上記のマッチング演算(S4〜S7)が終了すると、ステップS8において、CPU19は、マッチング演算の結果である類似度(=(SR+SG+SB)/3)を、部分画像24の抽出位置(X2,Y2)と対応づけてメモリに保存する。これらのステップS2〜S8の処理を経て、入力画像21の中の1つの抽出位置(X2,Y2)に対する処理が終わる。
The degree of similarity (= (S R + S G + S B ) / 3) obtained in step S7 has a tendency that the smaller the value, the higher the similarity between the partial image 24 and the template image 22, and the extraction of the partial image 24. It represents that the position (X 2 , Y 2 ) is close to the matching position (X 1 , Y 1 ).
When the matching calculation (S4 to S7) is completed, in step S8, the CPU 19 uses the similarity (= (S R + S G + S B ) / 3) as a result of the matching calculation to extract the partial image 24 ( X 2 , Y 2 ) are stored in the memory in association with each other. After the processing of these steps S2 to S8, processing is completed for one extraction position in the input image 21 (X 2, Y 2) .

ステップS9において、CPU19は、演算用の部分画像24の抽出位置(X2,Y2)を次の位置へ移動させるか否かを判定する。CPU19は、次の位置へ移動させると判定するとステップS10に進み、次の位置へ移動させないと判定するとステップS11に進む。
ステップS10において、CPU19は、演算用の部分画像24の抽出位置(X2,Y2)の移動処理を行う。CPU19は、部分画像24の抽出位置(X2,Y2)を現在の位置から次の位置へ移動させる。その後、ステップS2の処理に戻り、新たな抽出位置(X2,Y2)において、演算用の部分画像24の抽出(S2)→RGB成分の第2慣性モーメントM24の算出(S3)→マッチング演算(S4〜S7)→結果保存(S8)を繰り返す。
In step S9, the CPU 19 determines whether or not to move the extraction position (X 2 , Y 2 ) of the partial image 24 for calculation to the next position. If it determines with moving to the next position, CPU19 will progress to step S10, and if it determines with not moving to the next position, it will progress to step S11.
In step S < b > 10, the CPU 19 performs a process for moving the extraction position (X 2 , Y 2 ) of the calculation partial image 24. The CPU 19 moves the extraction position (X 2 , Y 2 ) of the partial image 24 from the current position to the next position. Thereafter, the processing returns to step S2, and at the new extraction position (X 2 , Y 2 ), extraction of the partial image 24 for calculation (S2) → calculation of the second moment of inertia M 24 of RGB components (S3) → matching The calculation (S4 to S7) → result storage (S8) is repeated.

このようにして、ステップS2→…→S10→S2…の処理を繰り返すことにより、演算用の部分画像24の抽出位置(X2,Y2)を少しずつ移動させながら、各々の位置で部分画像24を順に抽出し、部分画像24を抽出するごとに、RGB成分の第1慣性モーメントM22および第2慣性モーメントM24に基づいてマッチング演算(S4〜S7)を行うことができる。 In this way, by repeating the processing of steps S2 →... → S10 → S2..., The partial image at each position is moved while the extraction position (X 2 , Y 2 ) of the partial image 24 for calculation is moved little by little. extracting 24 sequentially, each time extracting the partial image 24, it is possible to perform a matching operation (S4 to S7) based on the first moment of inertia M 22 and the second moment of inertia M 24 of the RGB components.

そして、演算用の部分画像24の抽出位置(X2,Y2)が終点に到達し、そこでのステップS2〜S8の処理が終了すると、ステップS11において、CPU19は、入力画像21の中の異なる複数の位置で求められた類似度(=(SR+SG+SB)/3)を大小比較することにより、その値が最も小さく、テンプレート画像22との類似性が最も高い部分画像24の抽出位置(X2,Y2)を合致位置(X1,Y1)と特定する。以上で入力画像21に対するテンプレートマッチングの処理は終了となる。 Then, when the extraction position (X 2 , Y 2 ) of the partial image 24 for calculation reaches the end point, and the processing of steps S2 to S8 ends there, the CPU 19 differs in the input image 21 in step S11. Extraction of the partial image 24 having the smallest value and the highest similarity to the template image 22 by comparing the similarity (= (S R + S G + S B ) / 3) obtained at a plurality of positions. The position (X 2 , Y 2 ) is identified as the matching position (X 1 , Y 1 ). The template matching process for the input image 21 is thus completed.

上記のように、第1実施形態のテンプレートマッチングでは、RGB成分の第1慣性モーメントM22および第2慣性モーメントM24に基づいて、同じ色成分どうしを比較することによりマッチング演算(S4〜S7)を行い、その結果である類似度(=(SR+SG+SB)/3)を大小比較する。RGB成分の第1慣性モーメントM22は、テンプレート画像22のRGB成分それぞれの特徴量であり、RGB成分の第2慣性モーメントM24は、演算用の部分画像24のRGB成分それぞれの特徴量である。このように、特徴量が画素の位置に依存しない量として求められるので、入力画像21に幾何学的変化(回転や縮尺の変化など)があっても、正確に合致位置(X1,Y1)を特定することができる。 As described above, the template matching in the first embodiment, based on the first moment of inertia M 22 and the second moment of inertia M 24 of the RGB components, the matching operation by comparing the same color components each other (S4 to S7) And the degree of similarity (= (S R + S G + S B ) / 3) is compared. The RGB component first inertia moment M 22 is a feature amount of each of the RGB components of the template image 22, and the RGB component second inertia moment M 24 is a feature amount of each of the RGB components of the partial image 24 for calculation. . As described above, since the feature amount is obtained as an amount that does not depend on the position of the pixel, even if there is a geometric change (rotation, change in scale, etc.) in the input image 21, it is possible to accurately match the position (X 1 , Y 1 ) Can be specified.

また、図7に示した中心の値が大きく、周辺の値が小さい距離テーブルを用いることにより、重要な情報をテンプレートマッチングに十分反映させることができる。
なお、第1実施形態のテンプレートマッチングでは、各々の画像(21,24,22)に含まれる全ての色成分(つまりRGB成分)を用いてマッチング演算(S4〜S7)を行う。このため、多くの情報量を確保でき、より正確に合致位置(X1,Y1)を特定できる。
Further, by using the distance table having a large center value and a small peripheral value shown in FIG. 7, important information can be sufficiently reflected in template matching.
In the template matching of the first embodiment, the matching calculation (S4 to S7) is performed using all the color components (that is, RGB components) included in each image (21, 24, 22). For this reason, a large amount of information can be secured, and the matching position (X 1 , Y 1 ) can be specified more accurately.

また、上記した第1実施形態では、図3のステップS7において、ステップS4〜S6の出力値を正規化した後に、その平均値(=(SR+SG+SB)/3)を求め、その値を「部分画像24とテンプレート画像22との類似度」としたが、本発明はこれに限定されない。ステップS4〜S6の出力値を正規化した後に、その和(=(SR+SG+SB))を求め、その値を「部分画像24とテンプレート画像22との類似度」としても良い。和(=(SR+SG+SB))の場合でも、その値が小さいほど、部分画像24とテンプレート画像22との類似性が高く、部分画像24の抽出位置(X2,Y2)が合致位置(X1,Y1)に近いことを表す。 Further, in the first embodiment described above, after normalizing the output values of steps S4 to S6 in step S7 of FIG. 3, the average value (= (S R + S G + S B ) / 3) is obtained, Although the value is “similarity between the partial image 24 and the template image 22”, the present invention is not limited to this. After normalizing the output values in steps S4 to S6, the sum (= (S R + S G + S B )) is obtained, and the value may be set as “similarity between partial image 24 and template image 22”. Even in the case of the sum (= (S R + S G + S B )), the smaller the value is, the higher the similarity between the partial image 24 and the template image 22 is, and the extraction position (X 2 , Y 2 ) of the partial image 24 is higher. This means that it is close to the matching position (X 1 , Y 1 ).

また、第1実施形態で示した図7の距離テーブルを例に挙げて説明したが、本発明はこれに限定されない。中心の値が大きく、周辺の値が小さい距離テーブルであればどのような形態でもかまわない。
また、上記した第1実施形態では、3つの色成分(つまりRGB成分)を含む画像(21,24,22)の例で説明したが、本発明はこれに限定されない。色成分の数が2つであっても4つ以上であっても本発明を適用できる。つまり複数の色成分を含む場合に本発明を適用できる。
(第2実施形態)
第2実施形態は、第1実施形態の変形例である。第2実施形態では、第1実施形態と異なる部分についてのみ説明する。また、第2実施形態では、第1実施形態と同様の符号を用いて説明を行う。
Further, although the distance table of FIG. 7 shown in the first embodiment has been described as an example, the present invention is not limited to this. Any distance table may be used as long as the center value is large and the peripheral values are small.
In the first embodiment described above, an example of an image (21, 24, 22) including three color components (that is, RGB components) has been described, but the present invention is not limited to this. The present invention can be applied regardless of whether the number of color components is two or four or more. That is, the present invention can be applied to a case where a plurality of color components are included.
(Second Embodiment)
The second embodiment is a modification of the first embodiment. In the second embodiment, only different parts from the first embodiment will be described. The second embodiment will be described using the same reference numerals as those in the first embodiment.

第2実施形態では、演算用の部分画像24とテンプレート画像22とのマッチング演算を、後述の濃度加算値に基づいて行う場合を説明する。第2実施形態のテンプレートマッチングは、第1実施形態の“慣性モーメント”の代わりに“濃度加算値”を用いるものである。第2実施形態では、RGB成分を含む画像(21,24,22)を例に説明する。
第1実施形態で示した図7の距離テーブルの値を全て「1」にすると、第1実施形態で説明した式(1)および式(2)は、以下の式(3)となる。
In the second embodiment, a case will be described in which a matching calculation between the calculation partial image 24 and the template image 22 is performed based on a density addition value described later. The template matching of the second embodiment uses a “density addition value” instead of the “moment of inertia” of the first embodiment. In the second embodiment, an image (21, 24, 22) including RGB components will be described as an example.
When all the values in the distance table of FIG. 7 shown in the first embodiment are set to “1”, the expressions (1) and (2) described in the first embodiment become the following expressions (3).

22 = ΣAi …式(3)
式(3)により算出されるN22は、テンプレート画像22内の全ての画素の濃度値Aiの加算値である。第2実施形態では、テンプレート画像22について第1濃度加算値N22を算出し、部分画像24について同様に第2濃度加算値N24を求める。
第2実施形態のテンプレートマッチングは、図8に示すフローチャートの手順(ステップS21〜S31)にしたがって行われる。また、入力画像21は、スルー画像を含む撮像により生成された画像や、記録媒体16に記録された画像である。
N 22 = ΣA i Equation (3)
N 22 calculated by Expression (3) is an addition value of the density values A i of all the pixels in the template image 22. In the second embodiment, the first density addition value N 22 is calculated for the template image 22, and the second density addition value N 24 is similarly obtained for the partial image 24.
Template matching of the second embodiment is performed according to the procedure of the flowchart shown in FIG. 8 (steps S21 to S31). The input image 21 is an image generated by imaging including a through image or an image recorded on the recording medium 16.

図8の処理(S21〜S31)について順に説明する。
ステップS21において、CPU19は、テンプレート画像22の全体からRGB成分の第1濃度加算値N22を各色成分ごとに算出する。
ステップS22において、CPU19は、図3のステップS2と同様に、入力画像21の中から演算用の部分画像24を抽出する。
The processes (S21 to S31) in FIG. 8 will be described in order.
In step S21, the CPU 19 calculates a first density addition value N 22 of RGB components for each color component from the entire template image 22.
In step S22, the CPU 19 extracts a partial image 24 for calculation from the input image 21 as in step S2 of FIG.

ステップS23において、CPU19は、ステップS22で抽出した演算用の部分画像24の全体からRGB成分の第2濃度加算値N24を各色成分ごとに算出する。
ステップS24において、CPU19は、部分画像24のR成分の第2濃度加算値N24と、テンプレート画像22のR成分の第1濃度加算値N22とを比較し、2つのR成分の濃度加算値の差分の絶対値を出力する。この場合の出力値TRは、R成分の第2濃度加算値N24と第1濃度加算値N22の類似性に関する指標である。
In step S23, CPU 19 calculates the total of the partial image 24 for computation extracted in step S22 the second density addition value N 24 of the RGB components for each color component.
In step S24, CPU 19 has a second density addition value N 24 of the R component of the partial image 24 is compared with the first density addition value N 22 of the R component of the template image 22, density sum of the two R components Output the absolute value of the difference. The output value T R in this case is an index related to the similarity between the second density addition value N 24 of the R component and the first density addition value N 22 .

ステップS25において、CPU19は、部分画像24のG成分の第2濃度加算値N24と、テンプレート画像22のG成分の第1濃度加算値N22とを比較し、2つのG成分の濃度加算値の差分の絶対値を出力する(出力値TG)。
ステップS26において、CPU19は、部分画像24のB成分の第2濃度加算値N24と、テンプレート画像22のB成分の第1濃度加算値N22とを比較し、2つのB成分の濃度加算値の差分の絶対値を出力する(出力値TB)。
In step S25, CPU 19 has a second density addition value N 24 of the G component of the partial image 24 is compared with the first density addition value N 22 of the G component of the template image 22, density sum of the two G components Is output (output value T G ).
In step S26, CPU 19 has a second density addition value N 24 of the B component of the partial image 24 is compared with the first density addition value N 22 of the B component of the template image 22, density sum of the two B components The absolute value of the difference is output (output value T B ).

ステップS27において、CPU19は、上記したステップS24のR成分の出力値TRと、ステップS25のG成分の出力値TGと、ステップS26のB成分の出力値TBとを、それぞれ第1濃度加算値N22の各色成分JR,JG,JBで除すことにより正規化を行う。そして、正規化によって算出された各色成分ごとの類似度UR,UG,UBの平均を求め、その値を「部分画像24とテンプレート画像22との類似度」とする。 In step S27, CPU 19 includes an output value T R of the R component in step S24 described above, the output value T G of the G component in step S25, and the output value T B of the B component in step S26, the first concentration, respectively Normalization is performed by dividing by the color components J R , J G , and J B of the added value N 22 . Then, the average of the similarities U R , U G , and U B for each color component calculated by normalization is obtained, and the value is set as “similarity between the partial image 24 and the template image 22”.

ステップS28からステップS31において、CPU19は、図3のステップS8からステップS11と同様の処理を行い、テンプレートマッチングの処理を行う。
上記のように、第2実施形態のテンプレートマッチングでは、RGB成分の強度(第1濃度加算値N22および第2濃度加算値N24)に基づいて、同じ色成分どうしを比較することによりマッチング演算(S24〜S27)を行い、その結果である類似度(=(UR+UG+UB)/3)を大小比較する。RGB成分の第1濃度加算値N22は、テンプレート画像22のRGB成分それぞれの特徴量であり、RGB成分の第2濃度加算値N24は、演算用の部分画像24のRGB成分それぞれの特徴量である。このように、特徴量が画素の位置に依存しない量として求められるので、入力画像21に幾何学的変化(回転や縮尺の変化など)があっても、正確に合致位置(X1,Y1)を特定することができる。また、テンプレートマッチングにおける処理の負荷を軽減することが期待できる。
In step S28 to step S31, the CPU 19 performs the same processing as that in step S8 to step S11 in FIG. 3 to perform template matching processing.
As described above, in the template matching according to the second embodiment, the matching operation is performed by comparing the same color components based on the intensity of the RGB components (first density addition value N 22 and second density addition value N 24 ). (S24 to S27) are performed, and the degree of similarity (= (U R + U G + U B ) / 3) as a result is compared in magnitude. The RGB component first density addition value N 22 is a feature amount of each RGB component of the template image 22, and the RGB component second density addition value N 24 is a feature amount of each RGB component of the calculation partial image 24. It is. As described above, since the feature amount is obtained as an amount that does not depend on the position of the pixel, even if there is a geometric change (rotation, change in scale, etc.) in the input image 21, it is possible to accurately match the position (X 1 , Y 1 ) Can be specified. It can also be expected to reduce the processing load in template matching.

また、第2実施形態のテンプレートマッチングでは、各々の画像(21,24,22)に含まれる全ての色成分(つまりRGB成分)を用いてマッチング演算(S24〜S27)を行う。このため、多くの情報量を確保でき、より正確に合致位置(X1,Y1)を特定できる。
なお、第2実施形態の処理を、以下のように変形しても良い。図8のステップS26の後に、CPU19は、R成分の出力値TRと、ステップS25のG成分の出力値TGと、ステップS26のB成分の出力値TBとを、それぞれ所定の閾値と比較する。そして、R成分の出力値TRと、ステップS25のG成分の出力値TGと、ステップS26のB成分の出力値TBとが、所定の閾値以下である場合には、CPU19は、ステップS22で抽出した部分画像24の抽出位置(X2,Y2)が合致位置(X1,Y1)から遠いと判定する。そして、ステップS27の処理を行わずにステップS28に進み、ステップS28において、マッチング演算の結果である類似度を「圏外」として、部分画像24の抽出位置(X2,Y2)と対応づけてメモリに保存する。
In the template matching of the second embodiment, the matching calculation (S24 to S27) is performed using all the color components (that is, RGB components) included in each image (21, 24, 22). For this reason, a large amount of information can be secured, and the matching position (X 1 , Y 1 ) can be specified more accurately.
Note that the processing of the second embodiment may be modified as follows. After step S26 in FIG. 8, the CPU 19 sets the R component output value T R , the G component output value T G in step S25, and the B component output value T B in step S26 to respective predetermined threshold values. Compare. When the output value T R of the R component, the output value T G of the G component in step S25, and the output value T B of the B component in step S26, is less than the predetermined threshold value, CPU 19, the step It is determined that the extraction position (X 2 , Y 2 ) of the partial image 24 extracted in S22 is far from the matching position (X 1 , Y 1 ). Then, the process proceeds to step S28 without performing the process of step S27. In step S28, the similarity as a result of the matching calculation is set to “out of range” and is associated with the extraction position (X 2 , Y 2 ) of the partial image 24. Save to memory.

このように、ステップS24からステップS26で算出した濃度加算値の差分が所定の閾値以下である場合のみ、類似度を算出する処理(ステップS27)を行うことにより、無駄な処理を省くことができる。したがって、テンプレートマッチング処理の高速化が期待できる。
また、上記した第2実施形態では、図8のステップS27において、ステップS24〜S26の出力値を正規化した後に、その平均値(=(UR+UG+UB)/3)を求め、その値を「部分画像24とテンプレート画像22との類似度」としたが、本発明はこれに限定されない。ステップS24〜S26の出力値を正規化した後に、その和(=(UR+UG+UB))を求め、その値を「部分画像24とテンプレート画像22との類似度」としても良い。和(=(UR+UG+UB))の場合でも、その値が小さいほど、部分画像24とテンプレート画像22との類似性が高く、部分画像24の抽出位置(X2,Y2)が合致位置(X1,Y1)に近いことを表す。
As described above, only when the difference between the density addition values calculated in step S24 to step S26 is equal to or less than the predetermined threshold value, the processing for calculating the similarity (step S27) can be performed, so that useless processing can be omitted. . Therefore, the template matching process can be expected to be speeded up.
In the second embodiment described above, in step S27 of FIG. 8, after normalizing the output values of steps S24 to S26, the average value (= (U R + U G + U B ) / 3) is obtained, Although the value is “similarity between the partial image 24 and the template image 22”, the present invention is not limited to this. After normalizing the output values in steps S24 to S26, the sum (= (U R + U G + U B )) is obtained, and the value may be set as “similarity between partial image 24 and template image 22”. Even in the case of the sum (= (U R + U G + U B )), the smaller the value is, the higher the similarity between the partial image 24 and the template image 22 is, and the extraction position (X 2 , Y 2 ) of the partial image 24 is higher. This means that it is close to the matching position (X 1 , Y 1 ).

また、上記した第2実施形態では、テンプレート画像22および部分画像24内の全ての画素の濃度値Aiを加算した加算値を用いる例を示したが、平均値を用いても良い。すなわち、テンプレート画像22および部分画像24内の全ての画素の濃度値Aiを加算し、それぞれ面積で除した値を用いても良い。
また、上記した第2実施形態では、テンプレート画像22および部分画像24内の全ての画素の濃度値Aiを加算する例を示したが、一部の画素の濃度値Aiを加算しても良い。この場合、テンプレート画像22および部分画像24において、対応する部分の画素の濃度値Aiを加算すれば良い。
In the second embodiment described above, an example is shown in which an addition value obtained by adding the density values A i of all the pixels in the template image 22 and the partial image 24 is used, but an average value may be used. That is, the values obtained by adding the density values A i of all the pixels in the template image 22 and the partial image 24 and dividing each by the area may be used.
In the second embodiment described above, an example is shown in which the density values A i of all the pixels in the template image 22 and the partial image 24 are added. However, even if the density values A i of some pixels are added. good. In this case, in the template image 22 and the partial image 24, the density values A i of the corresponding portions of the pixels may be added.

また、上記した第2実施形態では、3つの色成分(つまりRGB成分)を含む画像(21,24,22)の例で説明したが、本発明はこれに限定されない。色成分の数が2つであっても4つ以上であっても本発明を適用できる。つまり複数の色成分を含む場合に本発明を適用できる。
(第3実施形態)
第3実施形態では、コンピュータを例に挙げて説明を行う。
In the second embodiment described above, an example of an image (21, 24, 22) including three color components (that is, RGB components) has been described. However, the present invention is not limited to this. The present invention can be applied regardless of whether the number of color components is two or four or more. That is, the present invention can be applied to a case where a plurality of color components are included.
(Third embodiment)
In the third embodiment, a computer will be described as an example.

図9は、第3実施形態のコンピュータ100の構成を示す図である。コンピュータ100は、図9に示すように、取得部101と画像処理部114と記録部115と画像表示部117と操作部118とCPU119とを備える。取得部101は、有線、無線、記録媒体用のドライブなどを介して、電子カメラなどの外部機器や記録媒体から画像データを取得する。画像処理部114は、第1実施形態の画像処理部14と同様である。記録部115は、画像データなどを記録する。画像表示部117は、液晶表示素子などの画像表示素子を備える。操作部118は、電源ボタン、マウス、キーボードなどを含む。CPU119は、各部を統合的に制御する。また、CPU119は、各処理を実行するためのプログラムを予め記録している。   FIG. 9 is a diagram illustrating a configuration of a computer 100 according to the third embodiment. As shown in FIG. 9, the computer 100 includes an acquisition unit 101, an image processing unit 114, a recording unit 115, an image display unit 117, an operation unit 118, and a CPU 119. The acquisition unit 101 acquires image data from an external device such as an electronic camera or a recording medium via a wired, wireless, or recording medium drive. The image processing unit 114 is the same as the image processing unit 14 of the first embodiment. The recording unit 115 records image data and the like. The image display unit 117 includes an image display element such as a liquid crystal display element. The operation unit 118 includes a power button, a mouse, a keyboard, and the like. The CPU 119 controls each unit in an integrated manner. In addition, the CPU 119 records a program for executing each process in advance.

CPU119は、取得部101により取得した画像や、記録部115に記録された画像に対して、第1実施形態の図3のフローチャートおよび第2実施形態の図8のフローチャートで説明した処理を行うためのプログラムを記録している。
そして、操作部118を介したユーザ指示に基づいて、第1実施形態の図3のフローチャートおよび第2実施形態の図8のフローチャートで説明した処理と同様の処理を行う。
The CPU 119 performs the processing described in the flowchart of FIG. 3 of the first embodiment and the flowchart of FIG. 8 of the second embodiment on the image acquired by the acquisition unit 101 and the image recorded in the recording unit 115. The program is recorded.
Then, based on a user instruction via the operation unit 118, processing similar to that described in the flowchart of FIG. 3 of the first embodiment and the flowchart of FIG. 8 of the second embodiment is performed.

上記のように、第3実施形態のコンピュータ100によれば、第1実施形態および第2実施形態と同様の効果を得ることができる。
また、上記した各実施形態では、演算用の部分画像24とテンプレート画像22の形状が矩形状である例を説明したが、本発明はこれに限定されない。部分画像24とテンプレート画像22は、矩形状である必要はない。他の形状でも本質的な処理は同じである。
As described above, according to the computer 100 of the third embodiment, the same effects as those of the first embodiment and the second embodiment can be obtained.
In each of the above-described embodiments, the example in which the shapes of the calculation partial image 24 and the template image 22 are rectangular has been described, but the present invention is not limited to this. The partial image 24 and the template image 22 do not have to be rectangular. The essential process is the same for other shapes.

さらに、上記した各実施形態では、図1の電子カメラ10を例にテンプレートマッチングの説明を行ったが、本発明はこれに限定されない。その他、試料(半導体ウエハや液晶基板、プリント基板、生物標本(例えば細胞)など)の観察や検査や位置合わせなどを行う観察装置、試料の局所領域を電子線で走査して画像を取り込む電子顕微鏡装置、監視カメラなどにも、本発明を適用できる。また、試料の局所領域の画像に限らず、試料の全面の画像を一括で取り込む装置にも、本発明を適用できる。また、第1実施形態および第2実施形態の電子カメラに外部のコンピュータを接続し、第1実施形態および第2実施形態で説明した処理の一部をコンピュータにより実現する場合でも、同様の効果を得ることができる。   Further, in each of the above-described embodiments, the template matching has been described by taking the electronic camera 10 of FIG. 1 as an example, but the present invention is not limited to this. Other observation devices for observing, inspecting and aligning samples (semiconductor wafers, liquid crystal substrates, printed boards, biological specimens (for example, cells)), electron microscopes that scan the local area of the sample with an electron beam and capture images The present invention can also be applied to devices, surveillance cameras, and the like. Further, the present invention can be applied not only to an image of a local region of a sample but also to an apparatus that captures an image of the entire surface of the sample at once. The same effect can be obtained even when an external computer is connected to the electronic camera of the first and second embodiments and a part of the processing described in the first and second embodiments is realized by the computer. Obtainable.

また、上記した実施形態では、入力画像(画像情報を含む二次元の入力信号)に対してテンプレートマッチングを行う例について説明したが、本発明はこれに限定されない。その他、音声情報を含む一次元の入力信号(入力音声)に対してテンプレートマッチングを行う場合(信号処理)にも、本発明を同様に適用できる。一次元の入力信号を対象とする場合、上述の「画像の濃度」を「信号の強度」に置き換えて考えれば良い。一次元の入力信号の場合には、入力信号に幾何学的変化(縮尺の変化など)があっても正確に合致位置を特定することができる。   In the above-described embodiment, an example in which template matching is performed on an input image (a two-dimensional input signal including image information) has been described. However, the present invention is not limited to this. In addition, the present invention can be similarly applied to the case of performing template matching (signal processing) on a one-dimensional input signal (input speech) including speech information. When a one-dimensional input signal is targeted, the above-mentioned “image density” may be replaced with “signal intensity”. In the case of a one-dimensional input signal, even if there is a geometric change (change in scale, etc.) in the input signal, the matching position can be specified accurately.

第1実施形態の電子カメラ10の概略図である。It is the schematic of the electronic camera 10 of 1st Embodiment. 入力画像21,テンプレート画像22,ターゲット23,演算用の部分画像24を説明する図である。It is a figure explaining the input image 21, the template image 22, the target 23, and the partial image 24 for a calculation. 第1実施形態のテンプレートマッチングの処理手順を示すフローチャートである。It is a flowchart which shows the process sequence of the template matching of 1st Embodiment. R成分の慣性モーメントM22について説明する図である。It is a diagram illustrating a moment of inertia M 22 of the R component. 距離テーブルについて説明する図である。It is a figure explaining a distance table. テンプレート画像について説明する図である。It is a figure explaining a template image. 距離テーブルについて説明する別の図である。It is another figure explaining a distance table. 第2実施形態のテンプレートマッチングの処理手順を示すフローチャートである。It is a flowchart which shows the process sequence of the template matching of 2nd Embodiment. 第3実施形態のコンピュータ100の概略図である。It is the schematic of the computer 100 of 3rd Embodiment.

符号の説明Explanation of symbols

10…電子カメラ,11…光学系,12…光学系制御部,13…撮像素子,14・114…画像処理部,15・115…記録部,17・117…画像表示部,18・118…操作部,19・119…CPU,100…コンピュータ,101…取得部
DESCRIPTION OF SYMBOLS 10 ... Electronic camera, 11 ... Optical system, 12 ... Optical system control part, 13 ... Imaging device, 14 * 114 ... Image processing part, 15 * 115 ... Recording part, 17 * 117 ... Image display part, 18 * 118 ... Operation Part, 19.119 ... CPU, 100 ... computer, 101 ... acquisition part

Claims (7)

複数の色成分を含む既知のテンプレート画像の強度に対して、所定の距離テーブルを用いて各色成分ごとに演算を施し第1の特徴量を算出する第1の算出手段と、
前記複数の色成分を含む入力画像の中の異なる複数の位置から演算用の部分画像を抽出する抽出手段と、
前記抽出手段により抽出された前記部分画像の強度に対して、前記距離テーブルを用いて各色成分ごとに演算を施し第2の特徴量を算出する第2の算出手段と、
前記第1の特徴量と前記第2の特徴量とに基づいて、同じ色成分どうしを比較することにより、前記テンプレート画像と前記部分画像との類似度を求める演算手段と、
前記入力画像の各位置で求められた前記類似度を大小比較することにより、前記入力画像の中の前記テンプレート画像との合致位置を特定する特定手段とを備えた
ことを特徴とするテンプレートマッチング装置。
First calculating means for calculating a first feature amount by performing an operation for each color component using a predetermined distance table with respect to the intensity of a known template image including a plurality of color components;
Extracting means for extracting partial images for calculation from a plurality of different positions in the input image including the plurality of color components;
Second calculating means for calculating a second feature amount by performing an operation for each color component using the distance table with respect to the intensity of the partial image extracted by the extracting means;
An arithmetic means for obtaining a similarity between the template image and the partial image by comparing the same color components based on the first feature amount and the second feature amount;
A template matching device comprising: specifying means for specifying a matching position with the template image in the input image by comparing the similarity obtained at each position of the input image. .
請求項1に記載のテンプレートマッチング装置において、
前記距離テーブルは、前記テンプレート画像の大きさに応じて定められたテーブルであり、前記テンプレート画像の中心からの距離に依存した数値群からなる
ことを特徴とするテンプレートマッチング装置。
The template matching apparatus according to claim 1,
The said distance table is a table defined according to the magnitude | size of the said template image, and consists of a numerical value group depending on the distance from the center of the said template image. The template matching apparatus characterized by the above-mentioned.
複数の色成分を含む既知のテンプレート画像の強度を前記テンプレート画像内の全ての画素について各色成分ごとに加算するか、または、前記強度を前記テンプレート画像内の一部の画素について各色成分ごとに加算して第1の特徴量を算出する第1の算出手段と、
前記複数の色成分を含む入力画像の中の異なる複数の位置から演算用の部分画像を抽出する抽出手段と、
前記抽出手段により抽出された前記部分画像の強度を前記部分画像内の全ての画素について各色成分ごとに加算するか、または、前記強度を前記部分画像内の一部の画素について各色成分ごとに加算して第2の特徴量を算出する第2の算出手段と、
前記第1の特徴量と前記第2の特徴量とに基づいて、同じ色成分どうしを比較することにより、前記テンプレート画像と前記部分画像との類似度を求める演算手段と、
前記入力画像の各位置で求められた前記類似度を大小比較することにより、前記入力画像の中の前記テンプレート画像との合致位置を特定する特定手段とを備えた
ことを特徴とするテンプレートマッチング装置。
Add the intensity of a known template image containing multiple color components for each color component for all pixels in the template image, or add the intensity for each color component for some pixels in the template image First calculating means for calculating the first feature amount;
Extracting means for extracting partial images for calculation from a plurality of different positions in the input image including the plurality of color components;
The intensity of the partial image extracted by the extraction means is added for each color component for all pixels in the partial image, or the intensity is added for each color component for some pixels in the partial image. Second calculating means for calculating the second feature amount;
An arithmetic means for obtaining a similarity between the template image and the partial image by comparing the same color components based on the first feature amount and the second feature amount;
A template matching device comprising: specifying means for specifying a matching position with the template image in the input image by comparing the similarity obtained at each position of the input image. .
請求項3に記載のテンプレートマッチング装置において、
前記演算手段は、前記第1の特徴量と前記第2の特徴量との差分が所定の閾値以下である場合のみ、前記類似度を算出する
ことを特徴とするテンプレートマッチング装置。
The template matching apparatus according to claim 3,
The template matching apparatus characterized in that the calculation means calculates the similarity only when a difference between the first feature value and the second feature value is equal to or less than a predetermined threshold.
請求項1から請求項4の何れか1項に記載のテンプレートマッチング装置を備えることを特徴とするカメラ。   A camera comprising the template matching device according to any one of claims 1 to 4. 複数の色成分を含む既知のテンプレート画像の強度に対して、所定の距離テーブルを用いて各色成分ごとに演算を施し第1の特徴量を算出する第1の算出手順と、
前記複数の色成分を含む入力画像の中の異なる複数の位置から演算用の部分画像を抽出する抽出手順と、
前記抽出手順において抽出された前記部分画像の強度に対して、前記距離テーブルを用いて各色成分ごとに演算を施し第2の特徴量を算出する第2の算出手順と、
前記第1の特徴量と前記第2の特徴量とに基づいて、同じ色成分どうしを比較することにより、前記テンプレート画像と前記部分画像との類似度を求める演算手順と、
前記入力画像の各位置で求められた前記類似度を大小比較することにより、前記入力画像の中の前記テンプレート画像との合致位置を特定する特定手順と
をコンピュータで実現することを特徴とするテンプレートマッチングプログラム。
A first calculation procedure for calculating a first feature amount by performing an operation for each color component using a predetermined distance table with respect to the intensity of a known template image including a plurality of color components;
An extraction procedure for extracting partial images for calculation from a plurality of different positions in the input image including the plurality of color components;
A second calculation procedure for calculating a second feature amount by performing an operation for each color component using the distance table with respect to the intensity of the partial image extracted in the extraction procedure;
A calculation procedure for obtaining a similarity between the template image and the partial image by comparing the same color components based on the first feature amount and the second feature amount;
A specific procedure for specifying a matching position with the template image in the input image by comparing the degree of similarity obtained at each position of the input image with a computer. Matching program.
複数の色成分を含む既知のテンプレート画像の強度を前記テンプレート画像内の全ての画素について各色成分ごとに加算するか、または、前記強度を前記テンプレート画像内の一部の画素について各色成分ごとに加算して第1の特徴量を算出する第1の算出手順と、
前記複数の色成分を含む入力画像の中の異なる複数の位置から演算用の部分画像を抽出する抽出手順と、
前記抽出手順において抽出された前記部分画像の強度を前記部分画像内の全ての画素について各色成分ごとに加算するか、または、前記強度を前記部分画像内の一部の画素について各色成分ごとに加算して第2の特徴量を算出する第2の算出手順と、
前記第1の特徴量と前記第2の特徴量とに基づいて、同じ色成分どうしを比較することにより、前記テンプレート画像と前記部分画像との類似度を求める演算手順と、
前記入力画像の各位置で求められた前記類似度を大小比較することにより、前記入力画像の中の前記テンプレート画像との合致位置を特定する特定手順と
をコンピュータで実現することを特徴とするテンプレートマッチングプログラム。
Add the intensity of a known template image containing multiple color components for each color component for all pixels in the template image, or add the intensity for each color component for some pixels in the template image A first calculation procedure for calculating the first feature amount;
An extraction procedure for extracting partial images for calculation from a plurality of different positions in the input image including the plurality of color components;
The intensity of the partial image extracted in the extraction procedure is added for each color component for all pixels in the partial image, or the intensity is added for each color component for some pixels in the partial image. A second calculation procedure for calculating the second feature amount;
A calculation procedure for obtaining a similarity between the template image and the partial image by comparing the same color components based on the first feature amount and the second feature amount;
A specific procedure for specifying a matching position with the template image in the input image by comparing the degree of similarity obtained at each position of the input image with a computer. Matching program.
JP2007060087A 2007-03-09 2007-03-09 Template matching device, camera equipped with template matching device, computer matching program for computer Active JP5076567B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007060087A JP5076567B2 (en) 2007-03-09 2007-03-09 Template matching device, camera equipped with template matching device, computer matching program for computer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007060087A JP5076567B2 (en) 2007-03-09 2007-03-09 Template matching device, camera equipped with template matching device, computer matching program for computer

Publications (3)

Publication Number Publication Date
JP2008225636A true JP2008225636A (en) 2008-09-25
JP2008225636A5 JP2008225636A5 (en) 2011-04-21
JP5076567B2 JP5076567B2 (en) 2012-11-21

Family

ID=39844217

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007060087A Active JP5076567B2 (en) 2007-03-09 2007-03-09 Template matching device, camera equipped with template matching device, computer matching program for computer

Country Status (1)

Country Link
JP (1) JP5076567B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109086738A (en) * 2018-08-23 2018-12-25 深圳市深晓科技有限公司 A kind of character identifying method and device based on template matching

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB0602876D0 (en) 2006-02-14 2006-03-22 Young Ronald A Absorbent mop sheet
CN107958454A (en) * 2017-12-04 2018-04-24 江苏维普光电科技有限公司 The fast matching method and system of reticle pattern picture are carried out based on precision surface plate

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04290186A (en) * 1991-03-19 1992-10-14 Eastman Kodak Japan Kk Image processing method
JPH06195512A (en) * 1992-12-25 1994-07-15 Fuji Facom Corp Character feature extracting device
JPH06268859A (en) * 1993-01-18 1994-09-22 Sharp Corp Picture processing unit
JPH10187967A (en) * 1996-12-25 1998-07-21 Hitachi Ltd Template matching method and device
JP2005352543A (en) * 2004-06-08 2005-12-22 Nikon Corp Template matching device
JP2006174022A (en) * 2004-12-15 2006-06-29 Canon Inc Image processing apparatus and method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04290186A (en) * 1991-03-19 1992-10-14 Eastman Kodak Japan Kk Image processing method
JPH06195512A (en) * 1992-12-25 1994-07-15 Fuji Facom Corp Character feature extracting device
JPH06268859A (en) * 1993-01-18 1994-09-22 Sharp Corp Picture processing unit
JPH10187967A (en) * 1996-12-25 1998-07-21 Hitachi Ltd Template matching method and device
JP2005352543A (en) * 2004-06-08 2005-12-22 Nikon Corp Template matching device
JP2006174022A (en) * 2004-12-15 2006-06-29 Canon Inc Image processing apparatus and method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109086738A (en) * 2018-08-23 2018-12-25 深圳市深晓科技有限公司 A kind of character identifying method and device based on template matching
CN109086738B (en) * 2018-08-23 2021-05-11 深圳市同维通信技术有限公司 Character recognition method and device based on template matching

Also Published As

Publication number Publication date
JP5076567B2 (en) 2012-11-21

Similar Documents

Publication Publication Date Title
JP4772839B2 (en) Image identification method and imaging apparatus
CN107818554B (en) Information processing apparatus and information processing method
JP7292979B2 (en) Image processing device and image processing method
CN106469455B (en) Image processing method, image processing apparatus, and recording medium
JP2013132447A (en) Image processing apparatus, image processing system, image processing method and program
JP6521626B2 (en) Object tracking device, method and program
KR20110090787A (en) Image processing device and method, and program therefor
WO2021024499A1 (en) Reinforcing bar determination device and reinforcing bar determination method
JP2010262601A (en) Pattern recognition system and pattern recognition method
EP3093822A1 (en) Displaying a target object imaged in a moving picture
JP5099120B2 (en) Template matching device, camera equipped with template matching device, computer matching program for computer
JP5076567B2 (en) Template matching device, camera equipped with template matching device, computer matching program for computer
JP2005293334A (en) Template matching device
JP2005352543A (en) Template matching device
JP5791361B2 (en) PATTERN IDENTIFICATION DEVICE, PATTERN IDENTIFICATION METHOD, AND PROGRAM
JP2009009206A (en) Extraction method of outline inside image and image processor therefor
JP2007241418A (en) Template matching device
JP2014109832A (en) Image processing apparatus, imaging apparatus, imaging system, image processing method, image processing program, and storage medium
JP6950376B2 (en) Image processing device, training image processing device, image identification device, training image processing method, image identification method, and program
JP6897431B2 (en) Image processing device, setting support method, and setting support program
JP6776532B2 (en) Image processing equipment, imaging equipment, electronic devices and image processing programs
JP2011124955A (en) Method for processing image and image processing apparatus
JP2010197968A (en) Focus evaluation apparatus, camera and program
CN117576609A (en) Automatic labeling method, system, equipment and medium for experimental equipment
US10409051B2 (en) Extraction of microscope zoom level using object tracking

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20100304

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100323

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110301

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20110627

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110802

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20111003

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120327

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120525

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: 20120731

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20120813

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

Free format text: PAYMENT UNTIL: 20150907

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Ref document number: 5076567

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20150907

Year of fee payment: 3

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250