JP2007026320A - Template matching method and image processor using the method - Google Patents

Template matching method and image processor using the method Download PDF

Info

Publication number
JP2007026320A
JP2007026320A JP2005210487A JP2005210487A JP2007026320A JP 2007026320 A JP2007026320 A JP 2007026320A JP 2005210487 A JP2005210487 A JP 2005210487A JP 2005210487 A JP2005210487 A JP 2005210487A JP 2007026320 A JP2007026320 A JP 2007026320A
Authority
JP
Japan
Prior art keywords
template
image
matching
pixel
numerical
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.)
Pending
Application number
JP2005210487A
Other languages
Japanese (ja)
Inventor
Atsuyuki Hirono
淳之 広野
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.)
Panasonic Electric Works Co Ltd
Original Assignee
Matsushita Electric Works Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Electric Works Ltd filed Critical Matsushita Electric Works Ltd
Priority to JP2005210487A priority Critical patent/JP2007026320A/en
Publication of JP2007026320A publication Critical patent/JP2007026320A/en
Pending legal-status Critical Current

Links

Abstract

<P>PROBLEM TO BE SOLVED: To provide a template matching method capable of efficiently allowing a matching object image to correspond to a template image without being affected by a difference in size or minute change, and to provide an image processor using the method. <P>SOLUTION: A template processing part 4 obtains correspondence so as not to reverse an anteroposterior arrayal sequence between whole pixels, which correspond to a one-dimensional numeral value string at the side of the matching object image from the attribute value of each pixel on the contour line of the matching object image, and the whole pixels, which correspond to the one-dimensional numerical value string at the side of the template image previously stored in a template storage part 5. A difference amount calculating means 42 calculates the amount of difference between the numerical values of the corresponding pixels. Then the minimum total amount among the total amounts of the obtained difference amounts is outputted to a matching determining part 6. A matching determining part 6 compares the difference amount outputted from the template processing part 4 with a threshold and determines whether the matching object image is the same as the template image or not. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、テンプレートマッチング方法及びそれを用いた画像処理装置に関するものである。   The present invention relates to a template matching method and an image processing apparatus using the same.

従来、監視用画像処理において、移動物体を検出するに当たり、一般的に良く用いられる方法としては背景差分方法がある。この背景差分方法は、図12(b)に示す移動物体が存在しない画像を背景画像として記憶しておき、逐次入力される検出用の入力画像(図12(a))から背景画像を引き算して差分値を求める方法である。つまり背景画像にない物体が入力画像中に現われた場合に、差分値が0でなくなる。この、差分値が0でない領域が移動物体領域、つまりマッチング対象画像の領域であって、例えば移動中の人(図12(c)の黒部分)や車の画像が面的に抽出できる。   Conventionally, in the monitoring image processing, there is a background difference method as a commonly used method for detecting a moving object. In this background subtraction method, an image with no moving object shown in FIG. 12B is stored as a background image, and the background image is subtracted from a detection input image (FIG. 12A) that is sequentially input. Thus, the difference value is obtained. That is, when an object not in the background image appears in the input image, the difference value is not zero. The area where the difference value is not 0 is the moving object area, that is, the area of the matching target image. For example, a moving person (black portion in FIG. 12C) or a car image can be extracted in a plane.

そしてこの抽出した物体が、本当に人なのか違うのかを判断する方法として、画像処理ではテンプレートマッチングが一般的に行われている(例えば特許文献1)。   As a method for determining whether the extracted object is really a person or not, template matching is generally performed in image processing (for example, Patent Document 1).

一般的なテンプレートマッチングにおいては、テンプレート画像と入力画像から抽出した濃淡画像からなるマッチング対象画像の各画素毎の濃度値I(i,j)、T(i,j)から、下記の式11で示す残差Rや式12で示す相互相関係数C(これらを総称して「相関値」と呼ぶ)を求め、該相関値から両画像の一致度を判定している。   In general template matching, from the density values I (i, j) and T (i, j) for each pixel of a matching target image composed of a template image and a grayscale image extracted from an input image, the following equation 11 is used. The residual R shown and the cross-correlation coefficient C shown in Expression 12 (collectively referred to as “correlation value”) are obtained, and the degree of coincidence between the two images is determined from the correlation value.

特開平8−24946号公報(第3−7頁、図1)JP-A-8-24946 (page 3-7, FIG. 1)

ところで人か否かの判断を面的なテンプレートマッチングを行うためには、抽出した物体画像の位置と大きさに、テンプレートの位置と大きさを一致させる必要がある。。しかし、位置合わせ、大きさ変化、微細な形の違いに対して面的なテンプレートマッチングでは処理時間がかかったり、また、誤検出誤判断の場合がある。   By the way, in order to perform planar template matching for determining whether or not a person is present, it is necessary to match the position and size of the template with the position and size of the extracted object image. . However, it takes time to perform template matching for alignment, size change, and minute shape difference, and there are cases where erroneous detection and misjudgment occur.

つまり、位置合わせは、最も相関の高いところを画像中を走査しながら探して行い、テンプレート画像の大きさについては、複数の大きさのテンプレート画像を準備しておき、同様に最も相関の高いところを画像中を走査しながら探す。この場合、入力画像から抽出するマッチング対象画像がどの程度大きさが変化しているかは不明であり、結果として様々な大きさのテンプレートを準備することになる。また、例えば0.9倍と0.8倍のテンプレートを準備していても、入力画像が0.85倍であれば、相関値の低下となり、誤検出誤判断の可能性が増加する。   In other words, alignment is performed by searching the image with the highest correlation, and template images of a plurality of sizes are prepared for the size of the template image. Is searched while scanning the image. In this case, it is unclear how much the matching target image extracted from the input image has changed, and as a result, templates of various sizes are prepared. For example, even if templates of 0.9 times and 0.8 times are prepared, if the input image is 0.85 times, the correlation value decreases, and the possibility of erroneous detection misjudgment increases.

一方で形状の若干の変動分を吸収すべく、判断閥値を低下させると、人以外のものを人と判断してしまう可能性がある。例えば微細な形状の違いとしては、手が出ていたり、脚の開き具合や、手荷物の有無などで、抽出された人の形状が異なるが、そのままテンプレートマッチングを行うと、人ではないと判断する可能性が高くなる。   On the other hand, if the judgment threshold value is lowered to absorb a slight variation of the shape, there is a possibility that a person other than a person is judged as a person. For example, as for the difference in fine shape, the shape of the extracted person differs depending on whether the hand is out, the degree of opening of the leg, the presence or absence of baggage, etc. The possibility increases.

上述の課題について具体的に説明すると、図13(a)に示すテンプレート画像の人物に比べて図13(b)に示すマッチング対象画像のように人物の脚部の隙間が少ない場合、(式11、式12)でマッチング処理を行う場合、相違量の最も小さくなる位置をマッチングした位置と判定する。   The above-described problem will be specifically described. When the gap between the legs of the person is small as in the matching target image shown in FIG. 13B compared to the person of the template image shown in FIG. When the matching process is performed using Equation 12), the position where the difference amount is the smallest is determined as the matched position.

従って、図13(c)の位置でマッチングしてほしいのだが、図13(c)で示すように脚部と足先部の合計でマッチングしたはうが、相違量は少なくなるため上下方向に位置がずれることになるが、この位置でマッチングするのは間違いといえる。   Therefore, I would like you to match at the position of FIG. 13 (c), but as shown in FIG. Although the position will be shifted, matching at this position is a mistake.

また、図14(a)に示すテンプレート画像の人物に比べて図14(b)で示すマッチング対象画像の人物がテンプレート画像の人物に比べて面積比で約2倍(寸法比で約√2倍)大きい場合に、図14(c),(d)のように相違量の最も小さい位置が複数個存在するが、倍率も位置も誤っていることになる。従ってテンプレート画像として人物の大きさが1倍の画像から1.5倍までの画像を0.1倍刻みで準備していても、わずかに異なる位置でマッチングしたと判断してしまう。   In addition, compared with the person of the template image shown in FIG. 14A, the person of the matching target image shown in FIG. 14B is about twice the area ratio (about √2 times the size ratio) of the person of the template image. ) When the number is large, there are a plurality of positions having the smallest difference amount as shown in FIGS. 14C and 14D, but the magnification and the position are incorrect. Therefore, even if images having a person size from 1 times to 1.5 times are prepared as template images in increments of 0.1, it is determined that matching is performed at slightly different positions.

従って正しい位置でマッチングさせるには膨大な処理時間が必要になってしまうという問題がある。   Therefore, there is a problem that enormous processing time is required for matching at the correct position.

本発明は、上述の点に鑑みて為されたもので、その目的とするところはマッチング対象画像とテンプレート画像との対応付けが、大きさの違いや微小な変化の影響を受けることなく効率良く行えるテンプレートマッチング方法及びそれを用いた画像処理装置を提供することにある。   The present invention has been made in view of the above points, and the object of the present invention is to efficiently associate the matching target image with the template image without being affected by a difference in size or a minute change. An object of the present invention is to provide a template matching method and an image processing apparatus using the template matching method.

上述の目的を達成するために請求項1のテンプレートマッチング方法では、テンプレート画像及びマッチング対象画像の輪郭線上の各画素が持つ諸元値に基づいた数値からなる一次元の数値列を用いて物体のマッチング処理を行うに当たり、テンプレート画像側の数値列に対応する画素の全てとマッチング対象画像側の数値列に対応する画素の全てとを前後の配列順序が逆転しないように対応付ける処理を行い、対応付けられた画素同士の数値の相違量を算出してその相違量の総和を求める処理を行い、求めた総和が最も小さな対応付けがテンプレート画像とマッチング対象画像とが最もマッチングしている対応付けと判断することを特徴とする。   In order to achieve the above object, the template matching method according to claim 1 uses a one-dimensional numerical sequence consisting of numerical values based on the specification values of each pixel on the contour line of the template image and the matching target image. In performing the matching process, a process for associating all the pixels corresponding to the numerical sequence on the template image side with all the pixels corresponding to the numerical sequence on the matching target image side so that the order of arrangement before and after is not reversed is performed. The amount of difference between the obtained pixels is calculated and the sum of the amount of difference is calculated, and the association with the smallest obtained sum is determined to be the association with which the template image and the matching target image are most matched. It is characterized by doing.

請求項1のテンプレートマッチング方法の発明によれば、テンプレート画像と、マッチング対象画像の大きさの違いを吸収し、また微小な変化があっても影響を受けることなく、マッチング対象画像とテンプレート画像との最もマッチしている対応付けが、効率良く行える。   According to the template matching method of the present invention, the difference between the size of the template image and the matching target image is absorbed, and the matching target image and the template image are not affected even if there is a minute change. The best matching can be performed efficiently.

請求項2のテンプレートマッチング方法の発明では、請求項1の発明において、最もマッチングした対応付けと判断された相違量の総和が、予め設定した閾値よりも小さければ、マッチング対象画像とテンプレート画像とが同一であると判断することを特徴とする。   In the invention of the template matching method of claim 2, in the invention of claim 1, if the sum of the differences determined to be the most matched correspondence is smaller than a preset threshold value, the matching target image and the template image are It is characterized by determining that they are the same.

請求項2のテンプレートマッチング方法の発明によれば、テンプレート画像とマッチング対象画像との大きさの違いを吸収し、また微小な変化があっても影響を受けることなく、マッチング対象画像とテンプレート対象画像とのマッチング判断が正確に行える。   According to the template matching method of the present invention, the difference between the size of the template image and the matching target image is absorbed, and even if there is a minute change, the matching target image and the template target image are not affected. The matching judgment with can be performed accurately.

請求項3のテンプレートマッチング方法の発明では、請求項1の発明において、求めた総和が最も小さな対応付けがテンプレート画像とマッチング対象画像とが最もマッチングしている対応付けと判断したときの各対応付けた画素同士の相違量の分布を調べて、相違量が所定の範囲内にある対応付け数に基づいてマッチング対象画像とテンプレート画像とが同一か否かを判断することを特徴とする。   In the invention of the template matching method of claim 3, in the invention of claim 1, each association when it is determined that the association with the smallest sum obtained is the association with which the template image and the matching target image are the most matched. The distribution of the difference amount between the pixels is examined, and it is determined whether the matching target image and the template image are the same based on the number of associations in which the difference amount is within a predetermined range.

請求項3のテンプレートマッチング方法の発明によれば、相違量の分布状態を用いることにより、相違量の総和によるマッチング判断に加えて、マッチング判断の確度を高めることができる。   According to the template matching method of the present invention, by using the difference amount distribution state, it is possible to increase the accuracy of the matching determination in addition to the matching determination based on the sum of the difference amounts.

請求項4のテンプレートマッチング方法では、請求項1乃至3の何れかの発明において、上記各数値列は、画素が示す明るさの変化方向を基に算出した前記輪郭線の接線方向角度若しくは法線方向角度を配列した列であることを特徴とする。   According to a template matching method of a fourth aspect, in the invention according to any one of the first to third aspects, each numerical sequence is a tangential direction angle or normal line of the contour calculated based on a brightness change direction indicated by a pixel. It is a row in which direction angles are arranged.

請求項4のテンプレートマッチング方法の発明によれば、凹凸の少ない輪郭について、微分フィルタを適用するだけで容易に接線或いは法線方向を算出できる。   According to the template matching method of the present invention, the tangent or normal direction can be easily calculated by simply applying a differential filter to a contour with little unevenness.

請求項5のテンプレートマッチング方法の発明では、請求項1乃至3の何れかの発明において、上記各数値例は、輪郭線の接線方向角度若しくは法線方向角度を配列した列であって、輪郭線上のある注目画素の前後の画素位置を用いて、その前後の画素が為す角度を、当該注目画素の輪郭線の接線方向角度としていることを特徴とする。   According to the invention of the template matching method of claim 5, in the invention of any one of claims 1 to 3, each numerical example is a row in which tangential direction angles or normal direction angles of the contour line are arranged, and on the contour line Using the pixel positions before and after a certain pixel of interest, the angle formed by the pixels before and after the pixel is the tangential direction angle of the contour line of the pixel of interest.

請求項5のテンプレートマッチング方法の発明によれば、凹凸の激しい画像に対して適切なマッチング処理が行える。   According to the invention of the template matching method of the fifth aspect, an appropriate matching process can be performed on an image having severe unevenness.

請求項6のテンプレートマッチング方法の発明では、請求項1乃至5の何れかの発明において、前記相違量が接線方向角度又は法線方向角度の差分値であって、2個のベクトルで構成される角度のうち小さい方とすることを特徴とする。   In a template matching method invention according to a sixth aspect, in the invention according to any one of the first to fifth aspects, the difference amount is a difference value of a tangential direction angle or a normal direction angle, and is constituted by two vectors. The smaller one of the angles is a feature.

請求項6のテンプレートマッチング方法の発明によれば、数値によっては複数の差分確度を一意に表現でき、そのため正しくマッチング判断ができる。   According to the template matching method of the present invention, a plurality of difference probabilities can be uniquely expressed depending on the numerical value, and therefore matching can be correctly determined.

請求項7のテンプレートマッチング方法の発明では、請求項1乃至3の何れかの発明において、上記数値列の数値として、濃淡画像であれば輪郭線位置に対応する画素の輝度値、カラー画像であれば輪郭線位置に対応する画素のHLS値を用いることを特徴とする。   In a template matching method invention according to a seventh aspect, in the invention according to any one of the first to third aspects, the numerical value of the numerical sequence may be a luminance value of a pixel corresponding to a contour position or a color image if the image is a grayscale image. For example, the HLS value of the pixel corresponding to the contour line position is used.

請求項7のテンプレートマッチング方法の発明によれば、人の頭髪部や肌色を用いた人検出や、逐次入力される入力画像中から特定の人を追跡する場合などに有効となる。   According to the template matching method of the present invention, it is effective when detecting a person using a human hair or skin color, or when tracking a specific person from sequentially input images.

請求項8のテンプレートマッチング方法の発明では、請求項1乃至3の何れかの発明において、テンプレート画像側の数値列と、マッチング対象画像側の数値列の相違量に基づいてマトリクスを作成し、このマトリクスの各段の夫々の右端の升目から左端までの升目方向へ順に注目する升目を最下段から最上段まで順次移動しながら、升目が持つ値の累積加算値が最小となる升目を辿る経路を決定する過程を有し、経路の始端となる最下段の右端の升目以外の注目升目での経路決定は、当該注目升目に対して右、右下、下において存在する升目の累積加算値を比較して決定することを特徴とする。   In the invention of the template matching method of claim 8, in the invention of any one of claims 1 to 3, a matrix is created based on the difference between the numerical sequence on the template image side and the numerical sequence on the matching target image side. A path that follows the grid where the cumulative added value of the grid has the smallest value while sequentially moving from the bottom grid to the top grid in the grid direction from the rightmost grid to the leftmost grid in each stage of the matrix. The route determination at the attention cell other than the rightmost cell at the lowermost stage, which is the starting point of the route, is performed by comparing the cumulative addition value of the cells existing on the right, lower right, and lower with respect to the attention cell. It is characterized by determining.

請求項8のテンプレートマッチング方法の発明によれば、決定した経路がテンプレート画像とマッチング対象画像とが最もマッチングしている対応付けを示すことになり、相違量の総和を求める際の処理時間の短縮が図れる。   According to the template matching method of the present invention, the determined route indicates the correspondence in which the template image and the matching target image are most matched, and the processing time when calculating the sum of the differences is reduced. Can be planned.

請求項9のテンプレートマッチング方法の発明では、請求項8の発明において、注目画素の経路決定時に於いて累積加算値がマッチング判断に用いる閾値よりも大きいときに、当該累積加算値を経路決定時に比較する累積加算値から除外することを特徴とする。   In the template matching method invention according to claim 9, in the invention according to claim 8, when the cumulative addition value is larger than a threshold used for matching judgment at the time of determining the path of the target pixel, the cumulative addition value is compared at the time of path determination. It is excluded from the cumulative addition value.

請求項9のテンプレートマッチング方法の発明によれば、更なる処理時間の短縮が図れる。   According to the template matching method of the present invention, the processing time can be further shortened.

請求項10の画像処理装置の発明では、マッチング対象画像の輪郭線を抽出する輪郭線抽出手段と、該輪郭線抽出手段で抽出した輪郭線上の各画素の諸元値からマッチング対象画像側の一次元の数値列を生成する数値列生成手段と、該数値列生成手段で生成したマッチング対象画像側の一次元の数値列に対応する画素の全てと、予め記憶してあるテンプレート画像から抽出した輪郭線上の各画素の諸元値から求めたテンプレート画像側の一次元の数値列に対応する画素の全てとを前後の配列順序が逆転しないように対応付けるとともに、対応付けられた画素同士の数値の相違量を算出してその相違量の総和を求める相違量演算手段とを備え、この相違量演算手段で求める相違量の総和に基づいて対象画像とテンプレート画像とが同一であると判断することを特徴とする。   In the invention of the image processing apparatus according to claim 10, the contour line extracting means for extracting the contour line of the matching target image, and the primary value on the matching target image side from the specification value of each pixel on the contour line extracted by the contour line extracting means. Numerical value sequence generating means for generating the original numerical value sequence, all of the pixels corresponding to the one-dimensional numerical value sequence on the matching target image side generated by the numerical value sequence generating means, and the contour extracted from the template image stored in advance Corresponding all the pixels corresponding to the one-dimensional numerical sequence on the template image side obtained from the specification value of each pixel on the line so that the order of arrangement in the front and rear is not reversed, and the numerical value difference between the associated pixels Difference amount calculating means for calculating the amount and calculating the sum of the difference amounts, and the target image and the template image are the same based on the sum of the difference amounts determined by the difference amount calculating means Characterized by disconnection.

請求項10の画像処理装置の発明によれば、テンプレート画像と、マッチング対象画像の大きさの違いを吸収し、また微小な変化があっても影響を受けることなく、画像マッチング対象画像とテンプレート画像との最もマッチしている対応付けが効率良く行え、テンプレート画像とマッチング対象画像との同一判断正確に行える画像処理装置を提供できる。   According to the invention of the image processing device of claim 10, the difference in size between the template image and the matching target image is absorbed, and the image matching target image and the template image are not affected even if there is a minute change. Thus, it is possible to provide an image processing apparatus that can efficiently perform the best matching with the template image and can accurately determine the template image and the matching target image.

本発明のテンプレートマッチング方法及びそれを用いた画像処理装置は、テンプレート画像と、マッチング対象画像の大きさの違いを吸収し、また微小な変化があっても影響を受けることなく、画像マッチング対象画像とテンプレート画像との最もマッチしている対応付けが、効率良く行えるという効果がある。   The template matching method and the image processing apparatus using the same according to the present invention absorb the difference in size between the template image and the matching target image, and are not affected even if there is a minute change. There is an effect that the best matching between the template image and the template image can be performed efficiently.

図1(a)は本発明の実施形態の人検出に用いる画像処理装置の全体構成を示しており、この画像処理装置は、監視エリアを撮像する撮像カメラ1と、撮像カメラ1からの画像を取り込んだ後、A/D変換して出力する画像入力部2と、この画像入力部2で2値化された入力画像と予め監視エリアを撮像して記憶している背景画像との差分から背景画像以外の領域を入力画像から抽出する領域抽出部3と、検知対象となる人体のテンプレート画像にかかるデータを記憶しているテンプレート記憶部5と、領域抽出部3で抽出された領域画像とテンプレート画像とを後述する対応付けによりマッチング処理を行うためのテンプレート処理部4と、テンプレート処理部4でのマッチング処理から抽出領域の画像(以下マッチング対象画像という)とテンプレート画像との同一判断を行うためのマッチング判断部6と、マッチング判断結果を出力する結果出力部7とで構成される。   FIG. 1A shows the overall configuration of an image processing apparatus used for human detection according to an embodiment of the present invention. This image processing apparatus captures an image from a camera 1 that captures a monitoring area and an image from the imaging camera 1. After capturing, the image input unit 2 that performs A / D conversion and outputs, and the difference between the input image binarized by the image input unit 2 and the background image that has been captured and stored in advance in the monitoring area A region extraction unit 3 that extracts a region other than an image from an input image, a template storage unit 5 that stores data relating to a template image of a human body to be detected, and a region image and template extracted by the region extraction unit 3 A template processing unit 4 for performing a matching process by matching the images to be described later, and an image of an extraction region (hereinafter referred to as a matching target image) from the matching process in the template processing unit 4 A matching determination unit 6 for conducting identification determination of the template image, and a result output unit 7 for outputting a matching determination result.

ここでテンプレート記憶部5は予めテンプレート画像である人物画像の輪郭線上の各画素の前後所定番目(以下N番目とする)の座標情報を使用して算出した接線方向角度(或いは法線方向角度)からなる数値を、ある座標点の画素の数値を開始点として終点の画素の数値までを並べて形成される一次元の数値列Aをテンプレート画像のデータとして記憶している。   Here, the template storage unit 5 preliminarily calculates the tangential direction angle (or normal direction angle) using the predetermined coordinate information (hereinafter referred to as “N”) of each pixel on the outline of the person image that is the template image. A one-dimensional numerical value string A formed by arranging numerical values consisting of a numerical value of a pixel at a certain coordinate point and a numerical value of an end point pixel is stored as template image data.

領域抽出部3は、背景画像と入力画像との差分、つまり背景差分によってマッチング対象画像を抽出し2値化処理してからテンプレート処理部4へ出力しているが、必ずしも背景差分である必要はなく、マッチング対象領域が抽出できる方法であれば他の方法でも良い。例えば、ステレオ視によって得られる3次元距離画像において、カメラから或る距離までの物体を切り出せば、容易に2値化されたマッチング対象画像が得られる。   The area extraction unit 3 extracts the matching target image based on the difference between the background image and the input image, that is, the background difference, binarizes the image, and outputs it to the template processing unit 4. Alternatively, any other method may be used as long as it can extract the matching target region. For example, in a three-dimensional distance image obtained by stereo vision, if an object from a camera to a certain distance is cut out, a binarized matching target image can be easily obtained.

テンプレート処理部4は、図1(b)に示すように領域抽出部3で抽出され、2値化されたマッチング対象画像の輪郭線を抽出する輪郭線抽出手段40と、輪郭線抽出手段40で抽出された輪郭線上の各画素毎に、後述する方法により接線方向角度からなる数値を求め、所定の位置の画素を開始点とし、終点の画素までの一次元の数値列Bを生成する数値列生成手段41と、テンプレート記憶部5からの数値列Aと数値列生成手段41で抽出した数値列Bの各画素の対応付け処理と、対応付けした画素同士の数値の相違値(相違量)を算出してその算出した相違量の総和を求める処理とを行う相違量演算手段42とからなる。   As shown in FIG. 1B, the template processing unit 4 includes a contour line extracting unit 40 that extracts a contour line of a matching target image extracted by the region extracting unit 3 and binarized, and a contour line extracting unit 40. For each pixel on the extracted contour line, a numerical value sequence for obtaining a numerical value consisting of a tangential angle by a method described later, and generating a one-dimensional numerical value sequence B starting from a pixel at a predetermined position and ending with a pixel at the end point The generating unit 41, the numerical value sequence A from the template storage unit 5 and the association processing of each pixel of the numerical value sequence B extracted by the numerical value sequence generating unit 41, and the numerical difference value (difference amount) between the associated pixels And a difference amount calculating means 42 for performing a process of calculating and calculating the sum of the calculated difference amounts.

ここで輪郭線抽出手段40の動作を図2に基づいて簡単に説明する。   Here, the operation of the contour line extracting means 40 will be briefly described with reference to FIG.

先ず輪郭線抽出手段40は、2値化されたマッチング対象画像(図2(a))を取り込むと、図2(b)に示すように左端から走査して白画素を探索し、最初に探索された白画素aを開始点とし、この開始点の周囲8近傍画素を反時計回りに探索し、最初の白画素(図2(c)で開始点画素の左下)の画素bに移動する。次に右上の画素aから移動してきたので、画素bの周囲8近傍画素を、図2(d)に示すように上、左上、左、左下、下、右下、右順で探索して、最初の画素cに移動する(図2(e))。この移動後、上述の場合と同様に右上の画素bから移動してきたので、画素cの周囲8近傍画素を探索し、最初の白画素dに移動する。以後開始点に戻るか、白画素が見つからなくなるまで繰り返すことで、図2(f)に示すように白画素a〜jからなる輪郭線及びその座標列を抽出することになる。   First, the contour line extracting means 40, when taking a binarized matching target image (FIG. 2A), scans from the left end as shown in FIG. The detected white pixel a is used as a start point, and eight neighboring pixels around the start point are searched counterclockwise, and the pixel is moved to the pixel b of the first white pixel (lower left of the start point pixel in FIG. 2C). Next, since the pixel has moved from the upper right pixel a, 8 neighboring pixels around the pixel b are searched in the order of upper, upper left, left, lower left, lower, lower right, and right as shown in FIG. Move to the first pixel c (FIG. 2E). After this movement, since the pixel b has moved from the upper right pixel b as in the case described above, eight neighboring pixels around the pixel c are searched and moved to the first white pixel d. Thereafter, returning to the starting point or repeating until no white pixel is found, the contour line consisting of white pixels a to j and its coordinate sequence are extracted as shown in FIG.

このように抽出した輪郭線からマッチングに用いる数値列を数値列生成手段41で求める方法を次に説明する。   Next, a method for obtaining the numerical sequence used for matching from the extracted contour line by the numerical sequence generation means 41 will be described.

本実施形態では、輪郭形状に基づく輪郭線の接線方向角度(或いは法線方向角度)を用いる方法により数値列を生成するのであるが、その一つの例としては、輪郭線の接線方向角度を輪郭線上の注目画素から前後N番目の画素位置を用いて2点の画素が為す角度を注目画素の輪郭線の接線方向角度として求める方法を採用している。   In this embodiment, the numerical sequence is generated by a method using the tangential direction angle (or normal direction angle) of the contour line based on the contour shape. As one example, the tangential direction angle of the contour line is defined as the contour line. A method is employed in which the angle formed by two pixels using the Nth pixel position before and after the target pixel on the line is determined as the tangential direction angle of the contour line of the target pixel.

具体的には輪郭線抽出手段40で抽出した図3(b)に示す輪郭線座標列が入力された数値列生成手段41は、図3(a)に示すように輪郭線(イ)上の所定の注目画素の前後N番目の画素の座標情報を使用して接線方向角度を算出し、その算出結果を当該画素の輪郭接線方向角度とする。   Specifically, the numerical value string generating means 41 to which the contour line coordinate string shown in FIG. 3B extracted by the contour line extracting means 40 is input is shown on the contour line (A) as shown in FIG. The tangential direction angle is calculated using the coordinate information of the Nth pixel before and after the predetermined target pixel, and the calculation result is set as the contour tangential direction angle of the pixel.

この場合、座標(Y,X)が(14,12)の画素を注目画素とし、Nを4とした場合、注目画素の4個前の画素の座標(16,10)及び4個後の画素の座標(10,10)の座標を用いて次のように算出する。   In this case, when a pixel having coordinates (Y, X) of (14, 12) is a pixel of interest and N is 4, the coordinates (16, 10) of the pixel four pixels before the pixel of interest and the pixel four pixels after Is calculated as follows using the coordinates of (10, 10).

dx=X(+N)−X(−N)=10−10=0
dy=Y(+N)−Y(−N)=10−16=−6
Ang=atan2(−dx,dy)=atan2(0,16)=270度=−90度
となる。図3(b)は注目画素(14,12)を中心として前後4番目の画素の座標との関係を示している。尚図3(b)において、−4〜−1は注目画素から後の4番目〜1番目の画素を示し、+1〜+4は注目画素から前の1番目〜4番目の画素を示す。
dx = X (+ N) -X (-N) = 10-10 = 0
dy = Y (+ N) −Y (−N) = 10−16 = −6
Ang = atan2 (−dx, dy) = atan2 (0,16) = 270 degrees = −90 degrees. FIG. 3B shows the relationship with the coordinates of the fourth pixel before and after the target pixel (14, 12). In FIG. 3B, −4 to −1 indicate the fourth to first pixels after the target pixel, and +1 to +4 indicate the first to fourth pixels before the target pixel.

図4(a)は、人体を撮影した画像から領域抽出部3で人体の領域を抽出した2値画像を示し、このマッチング対象画像(白部分)から輪郭線抽出手段40により輪郭抽出を行った結果が図4(b)である。数値列生成手段41は、抽出された輪郭線画像を○印の位置から矢印方向(ロ)に画素追跡を行って、上述のような各画素の接線方向角度を算出し、この算出した結果を追跡の開始点から終点まで並べて一次元の数値列Bを生成するのである。尚図4(c)は角度方向を示す。また表1は図4(b)での輪郭線上の各画素の座標と算出した輪郭線接線方向角度の一部を示した表である。   FIG. 4A shows a binary image obtained by extracting the human body region from the image obtained by photographing the human body, and the contour extraction unit 40 performs contour extraction from the matching target image (white portion). The result is shown in FIG. The numerical value string generating means 41 performs pixel tracking on the extracted contour image in the arrow direction (b) from the position of the circle, calculates the tangential direction angle of each pixel as described above, and calculates the calculated result. A one-dimensional numerical sequence B is generated by arranging the tracking from the start point to the end point. FIG. 4C shows the angular direction. Table 1 is a table showing the coordinates of each pixel on the contour line in FIG. 4B and a part of the calculated contour line tangent direction angle.

この方法では、凹凸による急激な角度変化を吸収する方向、つまり平滑化する効果がある。換言するとノイズによる微細な凹凸変化の影響を避けられるという効果がある。   This method has an effect of absorbing a sudden angle change due to unevenness, that is, smoothing. In other words, there is an effect that the influence of minute unevenness due to noise can be avoided.

尚N値は大きい程微細な凹凸を無視して平滑化の効果が大きくなるので、テンプレートマッチングにおいて必要な微細構造に応じて決定される数値である。対象によって平滑化効果を可変することができる。   The larger the N value, the smaller the unevenness and the greater the smoothing effect. Therefore, the N value is a value determined according to the fine structure required for template matching. The smoothing effect can be varied depending on the object.

輪郭線の法線方向角度や接線方向角度を算出する方法の別の例として、輪郭線上の各画素の値(明るさ)の変化方向を基に算出する方法がある。この場合輝度値の変化する方向を算出し、変化する方向を法線方向、垂直な方向を接線方向とする。この方法の場合には、例えばソーベル微分フィルターを用いて、明るさの変化方向を抽出すれば良い。この方法によれば凹凸形状の少ない単純な形状、例えば、円、楕円、ハート型のマッチング等に有効な方法である。   As another example of the method for calculating the normal direction angle and the tangential direction angle of the contour line, there is a method of calculating based on the change direction of the value (brightness) of each pixel on the contour line. In this case, the direction in which the luminance value changes is calculated, the changing direction is the normal direction, and the perpendicular direction is the tangential direction. In the case of this method, the brightness change direction may be extracted using, for example, a Sobel differential filter. According to this method, it is an effective method for matching a simple shape with few uneven shapes, for example, a circle, an ellipse, or a heart shape.

このソーベル微分フィルターを用いる場合には、マスクサイズが3×3のソーベルフィルタFx,Fyを図5(a)に示すように用いて輪郭線上の全ての画素に適用することで、局所空間微分を行い、各画素におけるx方向の微分値dxと、y方向の微分値dyとを下式により求める。但しa〜iは図5(b)に示すように注目画素とその8近傍の画素における画素値(濃度値)を表すものとする。   When this Sobel differential filter is used, the Sobel filters Fx and Fy having a mask size of 3 × 3 are used as shown in FIG. And the differential value dx in the x direction and the differential value dy in the y direction at each pixel are obtained by the following equations. However, a to i represent pixel values (density values) in the pixel of interest and its eight neighboring pixels as shown in FIG.

dx=(a+2d+g)−(c+2f+i)
dy=(a+2b+c)−(g+2h+i)
法線方向角度=atan(dy/dx)
数値列Aと数値列Bの対応付けにおいて対応付けた画素間の相違量を算出するに当たり、例えば数値列Aの1番目の画素の輪郭線接線方向角度をθ1,数値列Bの2番目の画素の輪郭線施線方向角度θ2としたときに、画素間の相違量は、図5に示すように2つのベクトルA1、B2が為す角度θ1,θ2のうち、小さい方向の角度θとし、更に正数とする。算出した相違量が、後述する図8(c)のマトリクスのA1とB2の交点の値となる。また数値によっては複数の表現がある差分角度を一意に表現できるので正しくマッチング評価ができるようになる。
dx = (a + 2d + g) − (c + 2f + i)
dy = (a + 2b + c) − (g + 2h + i)
Normal direction angle = atan (dy / dx)
In calculating the amount of difference between the associated pixels in the association between the numerical value sequence A and the numerical value sequence B, for example, the contour line tangential direction angle of the first pixel of the numerical value sequence A is θ1, the second pixel of the numerical value sequence B As shown in FIG. 5, the amount of difference between the pixels is the angle θ in the smaller direction of the angles θ1 and θ2 formed by the two vectors A1 and B2, as shown in FIG. It is a number. The calculated difference amount becomes the value of the intersection of A1 and B2 in the matrix of FIG. Also, depending on the numerical value, a differential angle with a plurality of expressions can be expressed uniquely, so that matching evaluation can be performed correctly.

例えば、
A1=100度、B2=20度ならばA1−B2=80度
A1= 20度、B2=100度ならばA1−B2=−80度→280度→80度
A1= 20度、B2=250度ならばA1−B2=−230度→130度
さて、上述のように数値列生成手段41で角度による数値列が生成されると、相違値演算手段42は、テンプレート記憶部5で記憶してある数値列Aと数値列Bとを画素(要素)毎に対応付ける処理を行うとともに、対応付けた画素の数値の相違量を求め、更にその相違量の総和を求める処理を行う。この総和は領域抽出した画像と、テンプレート画像との類似度を示すことになる。
For example,
If A1 = 100 degrees, B2 = 20 degrees, A1-B2 = 80 degrees A1 = 20 degrees, if B2 = 100 degrees, A1-B2 = -80 degrees → 280 degrees → 80 degrees A1 = 20 degrees, B2 = 250 degrees Then, A1−B2 = −230 degrees → 130 degrees When the numerical sequence by angle is generated by the numerical sequence generation means 41 as described above, the difference value calculation means 42 is stored in the template storage unit 5. A process of associating the numerical value string A and the numerical value string B for each pixel (element) is performed, a difference amount of numerical values of the associated pixels is obtained, and a process of obtaining a total sum of the difference values is performed. This sum indicates the degree of similarity between the region extracted image and the template image.

上述の数値列A,Bの対応付けは数値列の伸縮を行いながら相手との対応関係を決めておき、相違量の総和が最も小さくなる対応関係を最もマッチした状態とするのである。   The association between the numerical sequences A and B described above determines the correspondence with the partner while expanding and contracting the numerical sequence, and the correspondence that minimizes the sum of the difference amounts is set to the most matched state.

例えば、テンプレート画像に対して入力画像から抽出した領域の画像が同じ大きさで且つ類似(同一)形状である場合には各数値列A,Bの画素同士の対応付けは、図7(a)に示すように1対1となる。そして両画素の数値の相違量を演算するとともにその相違量の総和を求める。この場合マッチング対象画像と、テンプレート画像とが同じ形状で場合には各相違量が0であるため、その総和は0となる。   For example, when the image of the region extracted from the input image with respect to the template image has the same size and a similar (same) shape, the correspondence between the pixels of the numerical sequences A and B is shown in FIG. As shown in FIG. Then, the difference between the numerical values of the two pixels is calculated and the sum of the differences is obtained. In this case, when the matching target image and the template image have the same shape, the difference amount is 0, so the sum is 0.

一方入力画像から抽出したマッチング対象画像が、例えばテンプレート画像に対して面積比で寸法比が2倍の相似形の場合(或いは逆の場合)には、図7(b)に示すように数値列Aの各画素が数値列Bの2つの画素に対応させる形となる。この場合対応付けた各画素間の数値の相違量は0で、その総和も0となる。つまり相似形状の場合の大きさ違いを吸収することができる。   On the other hand, when the matching target image extracted from the input image is a similar shape having an area ratio and a dimensional ratio of twice that of the template image (or vice versa), as shown in FIG. Each pixel of A corresponds to two pixels of the numerical sequence B. In this case, the numerical difference between the associated pixels is 0, and the total sum is 0. That is, the difference in size in the case of similar shapes can be absorbed.

またマッチング対象画像と、テンプレート画像とが異なる形状の場合には、同じ形状部分に対応する画素については図7(c)に示すように1対1で対応させることでき、その相違量は0となるが、異なる形状部分に対応する画素同士の対応(太線で示す)では、相違量が0とならない。そのため相違量の総和も0とならない。   Further, when the matching target image and the template image have different shapes, the pixels corresponding to the same shape portion can be made to correspond one-on-one as shown in FIG. However, the amount of difference does not become zero in correspondence between pixels corresponding to different shape portions (indicated by bold lines). For this reason, the sum of the differences is not zero.

ここで、本実施形態において、上述の数値列A,Bの対応付けにおいて対応付けた画素間の相違量を累積加算してその総和(累積加算値)を求める場合、数値列A,Bに対応する画素を総当たりさせる形で対応関係を想定し、夫々の対応関係での相違量の総和を求めて、求めた複数の総和のうち最小となる総和を用いる方法では、処理時間が膨大となる。   Here, in the present embodiment, when the sum of differences (accumulated addition values) is obtained by accumulating the difference amounts between the associated pixels in the association of the numerical sequences A and B, the numerical sequences A and B are supported. The processing time is enormous in the method that assumes the correspondence in the form of brute force pixels, finds the sum of the differences in each correspondence, and uses the smallest sum among the obtained sums. .

そこで、処理時間を短縮して最小となる総和を求める方法を本実施形態では採用しており、その方法を以下に説明する。   In view of this, a method for shortening the processing time and obtaining the minimum sum is adopted in this embodiment, and this method will be described below.

先ず、図8(a)に示す数値列Aと、図8(b)に示す数値列Bとの差分のマトリクスを作成すると、図8(c)のようになり、このマトリクスの最下行の右端の升目から最上行の左端の升目に向かって移動しつつ、各升目の差分値を累積加算していくことは、2つの数値列A,Bにおいて、数値列B側の或る画素は全て数値列A側の何れかの画素に対応し、数値列A側のある画素は全て数値列B側の何れかの要素に対応し、しかも何れの対応関係も前後の順序が逆転しない対応付けとした複数あるもののうちの一つの対応関係を示し、対応関係のある画素の数値の相違量を累積加算していることと同値である。   First, when a matrix of the difference between the numerical value sequence A shown in FIG. 8A and the numerical value sequence B shown in FIG. 8B is created, it becomes as shown in FIG. 8C, and the right end of the bottom row of this matrix. In the two numerical value sequences A and B, all the pixels on the numerical value sequence B side are numerical values. Corresponds to any pixel on the column A side, all pixels on the numeric column A side correspond to any element on the numeric column B side, and all the correspondences are associated so that the order of the order is not reversed. It shows one correspondence among a plurality of things, and is equivalent to the cumulative addition of the difference values of the numerical values of the pixels having the correspondence.

ここで図9(b)に示すようにテンプレート画像αと、マッチング対象画像βとが同一である場合、数値列A,Bの画素同士の対応関係は上述のように1対1の一つのみとなり、差分のマトリクスは図9(a)のようになる。そして対応した画素間の相違量に応じた輝度値として示したマトリクス画像γは図9(b)に示すようになり、図9(a)に示すように対応関係のある画素同士の相違量(この場合は0)に対応した輝度値で示す画素を結ぶ線はマトリクス画像γの対角線Iとなる。   Here, as shown in FIG. 9B, when the template image α and the matching target image β are the same, the correspondence between the pixels of the numerical sequences A and B is only one-to-one as described above. Thus, the difference matrix is as shown in FIG. Then, the matrix image γ shown as the luminance value according to the difference amount between the corresponding pixels is as shown in FIG. 9B, and the difference amount between the corresponding pixels (as shown in FIG. 9A) ( In this case, a line connecting pixels indicated by luminance values corresponding to 0) is a diagonal line I of the matrix image γ.

一方図10に示すようにテンプレート画像αと、マッチング処理画像βとが異なる場合、例えば人検出において、テンプレート画像αには両手が存在しないものの、領域抽出の画像βには両手が存在するため、数値列A,Bの対応付けの際に、一つの画素に複数の画素が対応付けられ、しかも相違量が0とならない対応付けが存在することになって、相違量の総和が0とならない場合には、マトリクス画像γは図示するようになり、対応付けた画素同士の相違量に対応したマトリクス画像を結ぶ線Iは、相違量0となる対応付けができず、輝度値が0でない画素上を通る部分(縦線部分)IIが現われることになる。   On the other hand, when the template image α and the matching processing image β are different as shown in FIG. 10, for example, in human detection, the template image α does not have both hands, but the region extraction image β has both hands. When the numerical sequences A and B are associated, a plurality of pixels are associated with one pixel, and there is an association in which the difference amount is not 0, and the sum of the difference amounts is not 0. Shows a matrix image γ, and a line I connecting the matrix images corresponding to the difference amounts of the associated pixels cannot be associated with a difference amount of 0, and the luminance value is not 0. The part passing through (vertical line part) II will appear.

そこで、マトリクス画像を用いて相違量の総和(累積加算値)が最小となる経路を、次のような方法で求めるのである。   Therefore, a path that minimizes the sum of the difference amounts (cumulative addition value) is obtained using a matrix image by the following method.

ここで説明を簡単にするために数値列A,Bの各画素(要素)数を4とした場合について説明する。先ず相違量演算手段42は、数値列A,Bから各画素間の相違量に基づいた画素値を持つ4×4のマトリクス画像データを作り、マトリクス画像データの左上から右下までの各画素に順次画素番号を付す。図11(a)はこのマトリクス画像データの内容を示す。   Here, in order to simplify the description, a case where the number of pixels (elements) in the numerical sequences A and B is four will be described. First, the difference amount calculation means 42 creates 4 × 4 matrix image data having pixel values based on the difference amounts between the respective pixels from the numerical sequences A and B, and applies each pixel from the upper left to the lower right of the matrix image data. Pixel numbers are assigned sequentially. FIG. 11A shows the contents of this matrix image data.

このマトリクス画像データの右下画素(16)から最下段各画素までの最短経路を決定する。図11(b)はこの決定時の内容を示し、図において経路コストとは経路での画素値の累積和を示す。最下段の各画素における右下画素(16)への最短経路は右方向のみである。   The shortest path from the lower right pixel (16) of the matrix image data to each pixel in the lowermost stage is determined. FIG. 11B shows the contents at the time of determination, and in the figure, the path cost indicates the cumulative sum of pixel values on the path. The shortest path to the lower right pixel (16) in each pixel in the lowermost stage is only in the right direction.

次に図11(c)に示すようにある注目する画素(例えば11)から右、右下、下に夫々位置する画素(12)、(16)、(15)における最短経路の画素値の各累積<右では5(=4+1),右下では4,下では13(=4+9)>を比較して右下画素(16)から注目画素(11)までの最短経路を決定してその総和を求める。つまり最短経路は右下であって、その場合の画素値の累積和は4+6=9となる(図11(d)参照)。   Next, as shown in FIG. 11C, each of the pixel values of the shortest path in the pixels (12), (16), and (15) located on the right, lower right, and lower from a target pixel (for example, 11), respectively. Cumulative <5 (= 4 + 1) on the right, 4 on the lower right, 13 (= 4 + 9) on the lower>, determines the shortest path from the lower right pixel (16) to the target pixel (11), and calculates the sum Ask. That is, the shortest path is at the lower right, and the cumulative sum of pixel values in that case is 4 + 6 = 9 (see FIG. 11D).

次の注目する画素(10)では、右、右下、下に夫々位置する画素(11)、(15)、(14)における最短経路の画素値の各累積加算値9、13、15を比較して右下画素(16)から注目画素(10)での最短経路を決定してその累積和を求める。この場合最短経路は右であって、その場合の画素値の累積和は9+10=19となる(図11(e)参照)。以上のようにして順次最短経路を決定し、図11(f)に示すように左上の画素(1)までの最短経路を決定すると、その時点で左上の画素(1)から右下までの画素(16)までの最短経路とその画素値の最小の累積和が決定していることになる。ここで画素値は数値列A,Bの対応する画素同士の相違量に対応するものであるので、画素値の累積は相違量の総和に対応することになる。   In the next pixel of interest (10), the cumulative addition values 9, 13, and 15 of the pixel values of the shortest path in the pixels (11), (15), and (14) positioned on the right, lower right, and lower are compared. Then, the shortest path from the lower right pixel (16) to the target pixel (10) is determined, and the cumulative sum thereof is obtained. In this case, the shortest path is on the right, and the cumulative sum of pixel values in that case is 9 + 10 = 19 (see FIG. 11E). When the shortest path is sequentially determined as described above and the shortest path to the upper left pixel (1) is determined as shown in FIG. 11F, the pixels from the upper left pixel (1) to the lower right pixel at that time. That is, the shortest path to (16) and the minimum cumulative sum of the pixel values are determined. Here, since the pixel value corresponds to the amount of difference between the corresponding pixels in the numerical sequences A and B, the accumulation of the pixel value corresponds to the sum of the amounts of difference.

尚経路は逆戻り(上、左、左上)を辿らないものことを前提とするため、注目画素が最下段の場合には最小累積和を比較する右下、下の画素が存在しないので比較するのは右の画素のみとする。また最下段の右端の画素では比較する他の画素で存在しない。また最下段でないが右端の注目画素の場合には、右に画素が存在しないので、最小累積和の比較するのは右下、下の画素とする。   Since it is assumed that the path does not follow backwards (upper, left, upper left), if the pixel of interest is at the lowest level, the lower right and lower pixels that compare the minimum cumulative sum do not exist and are compared. Is only the right pixel. Further, the pixel at the right end of the lowermost row does not exist in other pixels to be compared. In the case of the rightmost pixel of interest, although not the lowest stage, since there is no pixel on the right, the minimum cumulative sum is compared with the lower right and lower pixels.

而して本方法によれば、注目画素(升目)までの最小の累積和及びその経路を決めれば、次の注目画素の最小累積和及び経路のための計算処理を繰り返す必要がなくなり、処理時間が短縮されることになるのである。   Thus, according to this method, if the minimum cumulative sum to the target pixel (cell) and its path are determined, it is not necessary to repeat the calculation process for the minimum cumulative sum and path of the next target pixel, and the processing time Will be shortened.

尚上述の或る注目画素(升目)の最小累積和が上述のマッチング判断部6での判断に用いる閾値を超えた場合に、その注目画素について他の注目画素において、参照されるときには累積和の比較対象から外せば、計算時間の短縮化を図ることができる。   When the minimum cumulative sum of a certain pixel of interest (a grid) exceeds a threshold used for the determination by the matching determination unit 6, the cumulative sum of the pixel of interest is referred to in other pixels of interest. If excluded from the comparison target, the calculation time can be shortened.

自身が最下段であったり右端であれば比較するべき右又は右下又は下の升目が存在しないときは、それ以外で比較する。  If there is no right or lower right or lower cell to be compared if it is at the bottom or right end, it is compared otherwise.

尚最小累積和を求めるための升目の移動は、上述の最下行の右端の升目から最上行の左端への移動以外に、最上行の左端の升目から最下行の右端への移動等であっても良い。   Note that the movement of the cells for obtaining the minimum cumulative sum is not only the movement from the rightmost cell of the bottom row to the left end of the top row, but also the movement from the leftmost cell of the top row to the right end of the bottom row, etc. Also good.

而して相違量演算手段42はテンプレート画像の輪郭線上の画素に対応した数値列Aとを、テンプレート画像側の数値列Aに対応する画素の全てとマッチング対象画像側の数値列Bに対応する画素の全てとを前後の配列順序が逆転しないように対応付ける処理を行い、対応付けた画素同士の数値の相違量を求めるとともに最小となる相違量の総和を類似度が最も高いことを示すものとして、マッチング判断部6へ出力するのである。   Thus, the difference amount calculating means 42 corresponds to the numerical value sequence A corresponding to the pixels on the contour line of the template image, all the pixels corresponding to the numerical value sequence A on the template image side, and the numerical value sequence B on the matching target image side. Assume that all the pixels are associated with each other so that the arrangement order of the front and rear is not reversed, the difference between numerical values of the associated pixels is obtained, and the sum of the minimum differences is the highest in similarity The result is output to the matching judgment unit 6.

マッチング判断部6は、予めテンプレート画像とマッチング対象画像とが同じであると判断するための閾値が予め設定されており、この閾値と相違量演算手段42が出力する総和とを比較して、総和が閾値より小さい場合には、テンプレート画像とマッチング対象画像とが同一であると判断し、逆に総和が閾値より大きい場合には、同一でないと判断し、それらの判断結果を結果出力部7に出力する。結果出力部7は判断結果に応じて所定形式の結果信号を外部へ出力するのである。   The matching determination unit 6 is preset with a threshold value for determining that the template image and the matching target image are the same, and compares this threshold value with the sum total output by the difference amount calculation means 42 to determine the sum total. Is smaller than the threshold value, it is determined that the template image and the matching target image are the same. Conversely, when the sum is larger than the threshold value, it is determined that they are not the same, and the determination result is sent to the result output unit 7. Output. The result output unit 7 outputs a result signal in a predetermined format to the outside according to the determination result.

尚上述の最短経路を求める際に累積加算値が閾値を超える注目画素がある場合、当該注目画素の累積加算値を、最短経路を求める際の比較対象から除外することで、演算処理を短縮するようにしても良い。   If there is a pixel of interest whose cumulative addition value exceeds the threshold when obtaining the shortest path described above, the arithmetic processing is shortened by excluding the cumulative addition value of the pixel of interest from the comparison target when obtaining the shortest path. You may do it.

また本実施形態では、数値列A,Bを構成する数値としては各画素の輪郭線の接線方向角度(或いは法線方向角度)を用いているが、濃淡画像を用いてその輪郭線上の画素の輝度値を数値として用いるか、或いはカラー画像の場合にはその輪郭線上のHLS値を用いても良く、前者の場合には人の頭髪部の黒、顔や手の肌色を用いた人検出に有効であり、また後者はある瞬間に検出した人画像をテンプレート画像として用い、その人の服の色や頭髪の範囲などから逐次入力されるマッチング対象画像からその人を特定して追跡する場合に有効である。この追跡の場合にはテンプレート画像となる画像を取り込んだ後、上述のような領域抽出、輪郭線抽出、更に数値列生成をマッチング処理の開始前に行い、その生成された数値列をテンプレート記憶部5に記憶させる処理を行う。   In the present embodiment, the tangential direction angle (or normal direction angle) of the contour line of each pixel is used as the numerical value constituting the numerical sequences A and B. However, the gray level image is used to represent the pixels on the contour line. The luminance value may be used as a numerical value, or in the case of a color image, the HLS value on the contour line may be used. In the former case, the human hair is detected by using the black color of the human hair, the skin color of the face or the hand. The latter is effective when a person image detected at a certain moment is used as a template image, and the person is identified and tracked from matching target images that are sequentially input based on the color of the person's clothes and the range of hair. It is valid. In the case of this tracking, after capturing an image to be a template image, the above-described region extraction, contour line extraction, and numerical sequence generation are performed before the start of the matching process, and the generated numerical sequence is stored in the template storage unit. 5 is stored.

更に、本実施形態では、マッチング判断部6が閾値と、相違量演算手段42から出力される相違量の総和とを比較して、マッチング対象画像がテンプレート画像と同一であるか否かを判断しているが、対応付けた数(図7で画素同士を結ぶ線の数)Yで相違量の総和の正規化を下式(1)のように行っても良い。この場合大きさが極端に異なる画像同士の比較において互いの類似度を正しく判断することが可能となる。更にテンプレート画像に対応した輪郭線の画素数N1と、マッチング対象画像に対応した輪郭線の画素数N2を用いて相違量の総和の値を下式(2)に示すように正規化しても同様な利点がある。   Furthermore, in the present embodiment, the matching determination unit 6 compares the threshold value with the sum of the difference amounts output from the difference amount calculation means 42 to determine whether or not the matching target image is the same as the template image. However, normalization of the sum of the differences may be performed as in the following equation (1) based on the number of associations (the number of lines connecting the pixels in FIG. 7) Y. In this case, it is possible to correctly determine the degree of similarity between images with extremely different sizes. Furthermore, even if the number of contour pixels corresponding to the template image N1 and the number of contour pixels corresponding to the matching target image N2 are normalized as shown in the following equation (2), There are significant advantages.

正規化された相違量の総和=相違量の総和/対応付け数 …(1)
正規化された相違量の総和=相違量の総和/(N1×N2) …(2)
更に相違量演算手段42で求めた全てにおける相違量の分布状態を調べて、相違量が所定の範囲内にある対応付けの数に基づいて、マッチング対象画像とテンプレート画像とが同一であるか否かを判断する方法を用いても良い。例えば対応付け数Yに対して相違量が所定の範囲以内(相違量が0以上5以下)の対応関係の比率が予め設定した値とを比較して同一であるか否かを判断するのである。
Normalized sum of differences = total difference / number of associations (1)
Normalized sum of differences = total sum of differences / (N1 × N2) (2)
Further, the distribution state of the difference amounts in all the difference amount calculation means 42 is checked, and based on the number of associations where the difference amounts are within a predetermined range, whether the matching target image and the template image are the same or not. You may use the method of judging. For example, it is determined whether or not the ratio of the correspondence relationship in which the difference amount is within a predetermined range (the difference amount is 0 or more and 5 or less) with respect to the number of associations Y is equal to a preset value. .

(a)は本発明方法を用いた画像処理装置のブロック図、(b)は同上の画像処理装置のマッチング処理部のブロック図である。(A) is a block diagram of an image processing apparatus using the method of the present invention, and (b) is a block diagram of a matching processing unit of the image processing apparatus of the above. 同上の画像処理装置のマッチング処理部内の輪郭線抽出部の輪郭線追跡方法の説明図である。It is explanatory drawing of the outline tracking method of the outline extraction part in the matching process part of an image processing apparatus same as the above. 同上の画像処理装置のマッチング処理部内の数値列生成部の接線方向角度の算出方法の説明図である。It is explanatory drawing of the calculation method of the tangent direction angle of the numerical value sequence generation part in the matching process part of an image processing apparatus same as the above. 同上の画像処理装置のマッチング処理部の具体例に対する処理動作の説明図である。It is explanatory drawing of the processing operation with respect to the specific example of the matching process part of an image processing apparatus same as the above. 同上の画像処理装置のマッチング処理部の数値列生成部の別の角度算出方法の説明図である。It is explanatory drawing of another angle calculation method of the numerical value sequence generation part of the matching process part of an image processing apparatus same as the above. 同上の画像処理装置のマッチング処理部の数値列生成部で数値列の数値として求める角度の説明図である。It is explanatory drawing of the angle calculated | required as a numerical value of a numerical sequence in the numerical sequence generation part of the matching process part of an image processing apparatus same as the above. 同上の画像処理装置のマッチング処理部の相違量演算部の説明図である。It is explanatory drawing of the difference amount calculating part of the matching process part of an image processing apparatus same as the above. 同上の画像処理装置のマッチング処理部の相違量演算部の総和の演算方法の説明図である。It is explanatory drawing of the calculation method of the sum total of the difference amount calculating part of the matching process part of an image processing apparatus same as the above. 同上の画像処理装置のマッチング処理部の相違量演算部で生成する差分マトリクスとマトリクス画像の一例の説明図である。It is explanatory drawing of an example of the difference matrix produced | generated by the difference amount calculating part of the matching process part of an image processing apparatus same as the above, and a matrix image. 同上の画像処理装置のマッチング処理部の相違量演算部で生成する差分マトリクスとマトリクス画像の他例の説明図である。It is explanatory drawing of the other example of the difference matrix produced | generated by the difference amount calculating part of the matching process part of an image processing apparatus same as the above, and a matrix image. 同上の画像処理装置の累積加算値が最小となる最短経路を求める方法の説明図である。It is explanatory drawing of the method of calculating | requiring the shortest path | route where the cumulative addition value of the image processing apparatus same as the above becomes the minimum. 入力画像からマッチング対象画像を背景画像との差分で得る方法の説明図である。It is explanatory drawing of the method of obtaining a matching object image from the input image by the difference with a background image. 従来のテンプレートマッチングの説明図である。It is explanatory drawing of the conventional template matching. 従来のテンプレートマッチングの課題説明図である。It is a subject explanatory drawing of the conventional template matching.

符号の説明Explanation of symbols

1 撮像カメラ
2 画像入力部
3 領域抽出部
4 テンプレート処理部
40 輪郭線抽出手段
41 数値列生成手段
42 相違量演算手段
5 テンプレート記憶部
6 マッチング判断部
7 結果出力部
DESCRIPTION OF SYMBOLS 1 Imaging camera 2 Image input part 3 Area extraction part 4 Template processing part 40 Outline line extraction means 41 Numerical value sequence generation means 42 Difference amount calculation means 5 Template storage part 6 Matching judgment part 7 Result output part

Claims (10)

テンプレート画像及びマッチング対象画像の輪郭線上の各画素が持つ諸元値に基づいた数値からなる一次元の数値列を用いて物体のマッチング処理を行うに当たり、テンプレート画像側の数値列に対応する画素の全てとマッチング対象画像側の数値列に対応する画素の全てとを前後の配列順序が逆転しないように対応付ける処理を行い、対応付けられた画素同士の数値の相違量を算出してその相違量の総和を求める処理を行い、求めた総和が最も小さな対応付けがテンプレート画像とマッチング対象画像とが最もマッチングしている対応付けと判断することを特徴とするテンプレートマッチング方法。 When performing the object matching process using a one-dimensional numerical sequence consisting of numerical values based on the specification values of each pixel on the contour line of the template image and the matching target image, the pixels corresponding to the numerical sequence on the template image side A process for associating all of the pixels corresponding to the numerical sequence on the matching target image side so that the order of arrangement before and after is not reversed, calculating a numerical difference amount between the associated pixels, and calculating the difference amount A template matching method characterized in that a process for obtaining a sum is performed, and a correspondence with the smallest sum obtained is determined as a correspondence in which a template image and a matching target image are most matched. 最もマッチングした対応付けと判断された相違量の総和が、予め設定した閾値よりも小さければ、マッチング対象画像とテンプレート画像とが同一であると判断することを特徴とする請求項1記載のテンプレートマッチング方法。 The template matching according to claim 1, wherein if the sum of the differences determined to be the most matched correspondence is smaller than a preset threshold value, the matching target image and the template image are determined to be the same. Method. 求めた総和が最も小さな対応付けがテンプレート画像とマッチング対象画像とが最もマッチングしている対応付けと判断したときの各対応付けた画素同士の相違量の分布を調べて、相違量が所定の範囲内にある対応付け数に基づいてマッチング対象画像とテンプレート画像とが同一か否かを判断する請求項1記載のテンプレートマッチング方法。 By examining the distribution of the difference amount between each associated pixel when it is determined that the association with the smallest sum obtained is the association in which the template image and the matching target image are the most matched, the difference amount is within a predetermined range. The template matching method according to claim 1, wherein it is determined whether the matching target image and the template image are the same based on the number of associations in the template. 上記各数値列は、画素が示す明るさの変化方向を基に算出した前記輪郭線の接線方向角度若しくは法線方向角度を配列した列であることを特徴とする請求項1乃至3の何れか記載のテンプレートマッチング方法。 4. The numerical value sequence according to claim 1, wherein the numerical value sequence is a sequence in which tangential direction angles or normal direction angles of the contour line calculated based on a brightness change direction indicated by a pixel are arranged. The template matching method described. 上記各数値例は、輪郭線の接線方向角度若しくは法線方向角度を配列した列であって、輪郭線上のある注目画素の前後の画素位置を用いて、その前後の画素が為す角度を、当該注目画素の輪郭線の接線方向角度としていることを特徴とする請求項1乃至3記載のテンプレートマッチング方法。 Each numerical example described above is a column in which the tangential direction angle or normal direction angle of the contour line is arranged, and using the pixel positions before and after a certain target pixel on the contour line, 4. The template matching method according to claim 1, wherein a tangential direction angle of a contour line of the target pixel is set. 前記相違量が接線方向角度又は法線方向角度の差分値であって、2個のベクトルで構成される角度のうち小さい方とすることを特徴とする請求項1乃至5の何れか記載のテンプレートマッチング方法。 6. The template according to claim 1, wherein the difference amount is a difference value between a tangential direction angle and a normal direction angle, and is a smaller one of angles formed by two vectors. Matching method. 上記数値列の数値として、濃淡画像であれば輪郭線位置に対応する画素の輝度値、カラー画像であれば輪郭線位置に対応する画素のHLS値を用いることを特徴とする請求項1乃至3の何れか記載のテンプレートマッチング方法。 4. The luminance value of a pixel corresponding to the contour line position in the case of a grayscale image, and the HLS value of a pixel corresponding to the contour position in the case of a color image are used as the numerical values in the numerical sequence. The template matching method according to any one of the above. テンプレート画像側の数値列と、マッチング対象画像側の数値列の相違量に基づいてマトリクスを作成し、このマトリクスの各段の夫々の右端の升目から左端までの升目方向へ順に注目する升目を最下段から最上段まで順次移動しながら、升目が持つ値の累積加算値が最小となる升目を辿る経路を決定する過程を有し、経路の始端となる最下段の右端の升目以外の注目升目での経路決定は、当該注目升目に対して右、右下、下において存在する升目の累積加算値を比較して決定することを特徴とする請求項1乃至3の何れか記載のテンプレートマッチング方法。 A matrix is created based on the amount of difference between the numerical sequence on the template image side and the numerical sequence on the matching target image side, and the cells that are noticed in order from the rightmost cell to the leftmost cell in each stage of this matrix are the first. It has a process of determining the route that follows the cell where the accumulated value of the value of the cell is the smallest while moving sequentially from the lower level to the uppermost level. The template matching method according to any one of claims 1 to 3, wherein the route is determined by comparing cumulative addition values of the cells existing on the right, lower right, and lower with respect to the target cell. 注目画素の経路決定時に於いて累積加算値がマッチング判断に用いる閾値よりも大きいときに、当該累積加算値を経路決定時に比較する累積加算値から除外することを特徴とする請求項8記載のテンプレートマッチング方法。 9. The template according to claim 8, wherein, when the path of the target pixel is determined, when the cumulative addition value is larger than a threshold used for matching determination, the cumulative addition value is excluded from the cumulative addition value to be compared at the time of path determination. Matching method. マッチング対象画像の輪郭線を抽出する輪郭線抽出手段と、該輪郭線抽出手段で抽出した輪郭線上の各画素の諸元値からマッチング対象画像側の一次元の数値列を生成する数値列生成手段と、該数値列生成手段で生成したマッチング対象画像側の一次元の数値列に対応する画素の全てと、予め記憶してあるテンプレート画像から抽出した輪郭線上の各画素の諸元値から求めたテンプレート画像側の一次元の数値列に対応する画素の全てとを前後の配列順序が逆転しないように対応付けるとともに、対応付けられた画素同士の数値の相違量を算出してその相違量の総和を求める相違量演算手段とを備え、この相違量演算手段で求める相違量の総和に基づいて対象画像とテンプレート画像とが同一であると判断することを特徴とする画像処理装置。 Contour line extracting means for extracting the contour line of the matching target image, and numerical value string generating means for generating a one-dimensional numerical value sequence on the matching target image side from the specification values of each pixel on the contour line extracted by the contour line extracting means And all the pixels corresponding to the one-dimensional numerical sequence on the matching target image side generated by the numerical sequence generation means, and the specification values of each pixel on the contour line extracted from the template image stored in advance All the pixels corresponding to the one-dimensional numerical sequence on the template image side are associated with each other so that the order of arrangement in the front and rear is not reversed, and the amount of numerical difference between the associated pixels is calculated and the sum of the differences is calculated. An image processing apparatus comprising: a difference amount calculation unit to be calculated; and determining that the target image and the template image are the same based on a sum of the difference amounts calculated by the difference amount calculation unit
JP2005210487A 2005-07-20 2005-07-20 Template matching method and image processor using the method Pending JP2007026320A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005210487A JP2007026320A (en) 2005-07-20 2005-07-20 Template matching method and image processor using the method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005210487A JP2007026320A (en) 2005-07-20 2005-07-20 Template matching method and image processor using the method

Publications (1)

Publication Number Publication Date
JP2007026320A true JP2007026320A (en) 2007-02-01

Family

ID=37786961

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005210487A Pending JP2007026320A (en) 2005-07-20 2005-07-20 Template matching method and image processor using the method

Country Status (1)

Country Link
JP (1) JP2007026320A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9904988B2 (en) 2016-03-11 2018-02-27 Toshiba Memory Corporation Image processing method and image processing program

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01184588A (en) * 1988-01-19 1989-07-24 Fujitsu Ltd System for corresponding to closed curve by dp matching
JPH0767143A (en) * 1993-08-25 1995-03-10 Nippon Hoso Kyokai <Nhk> Matching evaluation method for image

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01184588A (en) * 1988-01-19 1989-07-24 Fujitsu Ltd System for corresponding to closed curve by dp matching
JPH0767143A (en) * 1993-08-25 1995-03-10 Nippon Hoso Kyokai <Nhk> Matching evaluation method for image

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9904988B2 (en) 2016-03-11 2018-02-27 Toshiba Memory Corporation Image processing method and image processing program

Similar Documents

Publication Publication Date Title
US11176406B2 (en) Edge-based recognition, systems and methods
JP6167733B2 (en) Biometric feature vector extraction device, biometric feature vector extraction method, and biometric feature vector extraction program
US8019164B2 (en) Apparatus, method and program product for matching with a template
US9092697B2 (en) Image recognition system and method for identifying similarities in different images
US20160104053A1 (en) Hierarchical Interlinked Multi-scale Convolutional Network for Image Parsing
US20080226171A1 (en) Correcting device and method for perspective transformed document images
JP6900164B2 (en) Information processing equipment, information processing methods and programs
CN101147159A (en) Fast method of object detection by statistical template matching
US9390310B2 (en) Striped pattern image examination support device, striped pattern image examination support method and program
JP2017016593A (en) Image processing apparatus, image processing method, and program
KR20140091762A (en) Text detection using multi-layer connected components with histograms
JP5936561B2 (en) Object classification based on appearance and context in images
EP2639743A2 (en) Image processing device, image processing program, and image processing method
Chen et al. Riemannian manifold learning based k-nearest-neighbor for hyperspectral image classification
US7231086B2 (en) Knowledge-based hierarchical method for detecting regions of interest
JP2015045919A (en) Image recognition method and robot
CN108197628B (en) Image feature joint judgment method based on deep neural network
JP4775957B2 (en) Face detection device
ES2943287T3 (en) Method of verifying the identity of a user by identifying an object within an image that has a biometric characteristic of the user and separating a portion of the image comprising the biometric characteristic from other portions of the image
KR101849933B1 (en) Apparatus of Covariance-matching-based Model for musical-symbol recognition
JP2007026320A (en) Template matching method and image processor using the method
KR100194583B1 (en) Facial component extraction system and its extraction method
JP2007140729A (en) Method and device detecting position and attitude of article
JP5397103B2 (en) Face position detection device, face position detection method, and program
JP2006235817A (en) Character-recognizing device, character-recognizing method and recording medium for character recognition program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20080214

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20100201

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100209

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20100615