JP5526588B2 - Subject tracking program and subject tracking device - Google Patents

Subject tracking program and subject tracking device Download PDF

Info

Publication number
JP5526588B2
JP5526588B2 JP2009098742A JP2009098742A JP5526588B2 JP 5526588 B2 JP5526588 B2 JP 5526588B2 JP 2009098742 A JP2009098742 A JP 2009098742A JP 2009098742 A JP2009098742 A JP 2009098742A JP 5526588 B2 JP5526588 B2 JP 5526588B2
Authority
JP
Japan
Prior art keywords
image
size
area
comparison target
subject
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2009098742A
Other languages
Japanese (ja)
Other versions
JP2010015544A (en
Inventor
啓之 阿部
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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 JP2009098742A priority Critical patent/JP5526588B2/en
Publication of JP2010015544A publication Critical patent/JP2010015544A/en
Application granted granted Critical
Publication of JP5526588B2 publication Critical patent/JP5526588B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、被写体追跡プログラムおよび被写体追跡装置に関する。   The present invention relates to a subject tracking program and a subject tracking device.

連続して撮影された複数の画像上において、予め設定したテンプレート画像を用いてテンプレートマッチングを行い、テンプレート画像に類似した被写体位置を探索するようにした被写体追跡装置が知られている(例えば、特許文献1参照)。この被写体追跡方法では、画像内でテンプレート画像とのマッチングを行う検索領域を定め、その検索領域内においてテンプレート画像と比較する領域を順次ずらしながらテンプレートマッチングを行い、テンプレート画像に最も類似した領域を追跡対象の被写体が存在する領域としている。   2. Description of the Related Art A subject tracking device is known in which template matching is performed on a plurality of consecutively photographed images using a preset template image to search for a subject position similar to the template image (for example, a patent) Reference 1). In this subject tracking method, a search area to be matched with the template image is defined in the image, and template matching is performed while sequentially shifting the area to be compared with the template image in the search area, and the area most similar to the template image is tracked. This is an area where the target subject exists.

この出願の発明に関連する先行技術文献としては次のものがある。
特開平06−083963号公報
Prior art documents related to the invention of this application include the following.
Japanese Patent Laid-Open No. 06-083963

上述した従来の被写体追跡装置では、検索領域を広くすると、マッチング演算時間が長くなる上に、追跡対象の被写体と異なる被写体を誤認する疑似マッチングを起こしやすくなり、逆に検索領域を狭くすると、動きの速い被写体を検索領域から外しやすくなるため、テンプレートマッチング結果の類似度に応じて検索領域の広さを変えている。
ところが、検索領域の広さによってはテンプレートマッチングの演算時間が長くなるという問題がある。
In the conventional subject tracking device described above, if the search area is widened, the matching calculation time becomes long, and it becomes easy to cause false matching that misidentifies a subject different from the subject to be tracked. Therefore, the size of the search area is changed according to the similarity of the template matching results.
However, depending on the size of the search area, there is a problem that the calculation time for template matching becomes long.

請求項1の発明は、連続して撮像された複数の画像のそれぞれに、設定したテンプレート画像と類似する被写体を検索するための検索領域と、前記検索領域内に前記テンプレート画像と比較するための比較対象領域とを設定する領域設定手順と、前記検索領域内で前記比較対象領域を移動させながら、前記比較対象領域の画像と前記テンプレート画像とを比較して類似度を演算する類似度演算手順と、前記画像内で前記類似度の最大値が演算された前記比較対象領域の位置を、追跡対象の被写体が存在する位置として特定する位置特定手順とをコンピューターに実行させるための被写体追跡プログラムであって、前記領域設定手順は、前記類似度の演算回数を前記比較対象領域の大きさと前記検索領域の大きさとの関数で表した場合に、前記類似度の演算回数が極大にならないように、前記比較対象領域の大きさに対する前記検索領域の大きさを設定することを特徴とする。 The invention of claim 1, each of the plurality of images continuously captured, a search area for searching a subject similar to setting boss was a template image for comparison with the template image in the search area A region setting procedure for setting the comparison target region, and similarity calculation for calculating the similarity by comparing the image of the comparison target region with the template image while moving the comparison target region within the search region A subject tracking program for causing a computer to execute a procedure and a position specifying procedure for specifying the position of the comparison target area where the maximum value of the similarity is calculated in the image as a position where the subject to be tracked exists a is the area setting step, when representing the number of operations of the similarity in function of the size of the size and the search area of the comparison regions, wherein As the number of arithmetic operations similarity score is not a maximum, and sets the size of the search area to the size of the comparison area.

本発明によれば、比較対象領域の大きさに対する検索領域の大きさが所定の関係になってテンプレートマッチング演算の回数が急激に増大し、テンプレートマッチングの演算時間が長くなるのを防止することができる。   According to the present invention, the size of the search area with respect to the size of the comparison target area has a predetermined relationship, and the number of times of the template matching calculation increases rapidly, thereby preventing the template matching calculation time from becoming long. it can.

一実施の形態の構成を示す図The figure which shows the structure of one embodiment 撮像画像I、テンプレート画像A、比較対象領域画像Bおよび検索領域Sの関係を示す図The figure which shows the relationship between the captured image I, the template image A, the comparison object area image B, and the search area S 正方形の検索領域と比較対象領域を設定した場合の図Figure with square search area and comparison area set 正方形の検索領域と比較対象領域を設定した場合の、比較対象領域の大きさに対するテンプレートマッチングの演算回数の関係を示す図The figure which shows the relation of the number of operations of template matching to the size of the comparison target area when the square search area and the comparison target area are set 検索領域と比較対象領域の形状を一般化した場合の図Diagram when the shapes of the search area and comparison area are generalized 検索領域と比較対象領域の形状を一般化した場合の、比較対象領域の大きさに対するテンプレートマッチングの演算回数の関係を示す図The figure which shows the relation of the number of operations of template matching to the size of the comparison area when the shape of the search area and the comparison area is generalized 検索領域と比較対象領域の形状を一般化した場合の、比較対象領域の大きさに対するテンプレートマッチングの演算回数の関係を示す図The figure which shows the relation of the number of operations of template matching to the size of the comparison area when the shape of the search area and the comparison area is generalized 一実施の形態の被写体追跡制御プログラムを示すフローチャートThe flowchart which shows the subject tracking control program of one embodiment 一実施の形態による被写体追跡結果を示す図The figure which shows the subject tracking result by one Embodiment

本願発明の被写体追跡プログラムおよび被写体追跡装置をデジタルカメラに適用した一実施の形態を説明する。なお、本願発明の被写体追跡プログラムおよび被写体追跡装置はデジタルカメラ以外の例えばデジタルビデオカメラや各種撮像装置、画像処理装置などに適用することができる。   An embodiment in which the subject tracking program and the subject tracking device of the present invention are applied to a digital camera will be described. The subject tracking program and the subject tracking device of the present invention can be applied to, for example, a digital video camera, various imaging devices, and an image processing device other than a digital camera.

図1は一実施の形態の構成を示す。デジタルカメラ1は、レンズ2、撮像素子3、制御装置4、操作部材5、モニター6などを備えている。撮像素子3はCCDやCMOSなどから構成され、レンズ2により結像された被写体像を画像信号に変換する。制御装置4はCPU4a、メモリ4bなどから構成され、カメラの各種演算制御とシーケンス制御を行うとともに、後述する被写体追跡制御プログラムを実行し、連続して撮像された各画像上において追跡対象の被写体位置を特定する。操作部材5には、シャッターボタンの半押し操作時にオンするスイッチ、全押し操作時にオンするスイッチ、画像上の追跡対象にしたい被写体にカーソルを合わせて追跡対象被写体を指定する方向キーなどを備えている。モニター6は撮像画像と各種撮影情報を表示する。   FIG. 1 shows the configuration of an embodiment. The digital camera 1 includes a lens 2, an image sensor 3, a control device 4, an operation member 5, a monitor 6, and the like. The image sensor 3 is composed of a CCD, a CMOS or the like, and converts the subject image formed by the lens 2 into an image signal. The control device 4 includes a CPU 4a, a memory 4b, and the like. The control device 4 performs various kinds of arithmetic control and sequence control of the camera, and executes a subject tracking control program to be described later. Is identified. The operation member 5 includes a switch that is turned on when the shutter button is half-pressed, a switch that is turned on when the shutter button is fully pressed, and a direction key that designates a tracking target subject by positioning the cursor on the subject to be tracked on the image. Yes. The monitor 6 displays captured images and various types of shooting information.

図2により、一実施の形態のテンプレートマッチングにおける検索領域の設定方法を説明する。図2において、Iは撮像素子3により撮像した画像である。Aは、追跡対象の被写体像すなわちテンプレート画像である。なお、テンプレート画像Aの設定方法は、上述した操作部材5により撮影者が任意の追跡対象被写体を手動で指定し、指定した部分の画像をテンプレート画像Aとする方法以外に、撮像画像Iの中から人物の顔の領域を認識してカメラが自動で追跡対象被写体を設定し、設定した顔領域の画像をテンプレート画像Aとする方法などがある。   A search area setting method in template matching according to an embodiment will be described with reference to FIG. In FIG. 2, I is an image captured by the image sensor 3. A is a subject image to be tracked, that is, a template image. The template image A can be set by a method other than the method in which the photographer manually designates an arbitrary tracking target subject using the operation member 5 described above and the image of the designated portion is used as the template image A. There is a method in which the face area of a person is recognized, the camera automatically sets a tracking target subject, and the image of the set face area is used as a template image A.

Bは、撮像画像I上でテンプレート画像Aと比較してテンプレートマッチング演算を行う比較対象領域の画像であり、この比較対象領域を撮像画像I上で1画素ずつあるいは所定画素ずつずらしながらテンプレートマッチングを行う。この一実施の形態では、比較対象領域画像Bの大きさをテンプレート画像Aの大きさと同じとし、ともに横p画素、縦q画素とする。   B is an image of a comparison target area on which the template matching operation is performed on the captured image I in comparison with the template image A. Template matching is performed while shifting the comparison target area on the captured image I by one pixel or by a predetermined pixel. Do. In this embodiment, the size of the comparison target region image B is the same as the size of the template image A, and both are p horizontal pixels and q vertical pixels.

Sは、比較対象領域を所定画素ずつずらしながらテンプレート画像Aとのテンプレートマッチングを行う検索領域であり、この検索領域Sは撮像画像Iよりも狭い領域である。この検索領域Sの大きさの設定方法については、詳細を後述する。   S is a search area for performing template matching with the template image A while shifting the comparison target area by a predetermined pixel. This search area S is an area narrower than the captured image I. The method for setting the size of the search area S will be described later in detail.

テンプレートマッチングは、(1)式に示すテンプレート画像Aと比較対象領域画像Bとの残差rを演算し、残差rが小さいほど両画像の類似度が高いとする。
r=ΣΣ|Apq−Bpq| ・・・(1)
(1)式において、ΣΣはテンプレート画像Aと比較対象領域画像Bの横(1〜p)画素、縦(1〜q)画素の画素単位の総和演算を表す。つまり、テンプレート画像Aと比較対象領域画像Bとの画素ごとの差の絶対値の総和を残差rとする。この一実施の形態では、残差rの逆数(1/r)を類似度と定義し、残差rが小さいほど、つまり類似度(1/r)が大きいほど、比較対象領域画像Bがテンプレート画像Aに類似していると判断する。なお、テンプレート画像Aと比較対象画像Bが完全に一致する場合、すなわちA=Bの場合は類似度(1/r)=1とする。
In template matching, the residual r between the template image A and the comparison target region image B shown in the equation (1) is calculated, and the smaller the residual r, the higher the similarity between both images.
r = ΣΣ | Apq−Bpq | (1)
In the equation (1), ΣΣ represents a sum operation in units of horizontal (1 to p) pixels and vertical (1 to q) pixels of the template image A and the comparison target region image B. That is, the sum of absolute values of differences between the template image A and the comparison target region image B for each pixel is defined as a residual r. In this embodiment, the reciprocal (1 / r) of the residual r is defined as the similarity, and the smaller the residual r, that is, the higher the similarity (1 / r), the more the comparison target region image B becomes the template. Judged to be similar to image A. Note that if the template image A and the comparison target image B completely match, that is, if A = B, the similarity (1 / r) = 1.

ここで、検索領域Sの大きさについて考察する。上述したように、検索領域Sを広くすると、テンプレートマッチングにおける演算時間が長くなる上に、追跡対象の被写体と異なる被写体を誤認する疑似マッチングを起こしやすくなり、逆に検索領域Sを狭くすると、動きの速い被写体を検索領域Sから外しやすくなるため、基本的にはテンプレートマッチング結果の類似度(1/r)に応じて検索領域Sの広さを変える。   Here, the size of the search area S will be considered. As described above, if the search area S is widened, the calculation time in template matching becomes long, and it becomes easy to cause pseudo matching that misidentifies a subject different from the subject to be tracked. Therefore, the size of the search region S is basically changed according to the similarity (1 / r) of the template matching result.

類似度(1/r)が低い場合は、テンプレート画像Aに一致する追跡対象被写体が現在の比較対象領域の近くにない可能性が高いので、検索領域Sを広くして追跡対象被写体の取り逃しを防ぐ。逆に類似度が高い場合は、追跡対象被写体が現在の比較対象領域またはその近くにいる可能性が高いので、検索領域Sを狭くして疑似マッチングを防ぐ。   When the similarity (1 / r) is low, there is a high possibility that the tracking target subject that matches the template image A is not near the current comparison target region. prevent. Conversely, if the similarity is high, there is a high possibility that the tracking target subject is at or near the current comparison target region, so that the search region S is narrowed to prevent pseudo matching.

ここで、類似度(1/r)を0(不一致)〜1(完全一致)に正規化した場合、検索領域Sの大きさは次式で表される。
(検索領域Sの大きさ)=k・(1−(1/r))・(テンプレート画像Aの大きさ) ・・・(2)
(2)式において、(1/r)は残差rから求めた類似度、kは画像の撮影目的や撮影条件により設定される定数である。なお、この一実施の形態では、テンプレート画像Aの大きさは比較対象領域画像Bの大きさに等しい。
Here, when the similarity (1 / r) is normalized from 0 (unmatched) to 1 (completely matched), the size of the search area S is expressed by the following equation.
(Size of search area S) = k · (1− (1 / r)) · (Size of template image A) (2)
In equation (2), (1 / r) is the similarity obtained from the residual r, and k is a constant set according to the purpose of photographing the image and the photographing conditions. In this embodiment, the size of the template image A is equal to the size of the comparison target region image B.

次に、比較対象領域の大きさ(この一実施の形態ではテンプレート画像Aの大きさと同じ)、検索領域Sの大きさ、およびテンプレートマッチング演算の回数の関係について考察する。まず、図3に示すように検索領域Sと比較対象領域をともに正方形とした場合の上記関係を導く。検索領域Sの一辺の長さをm(画素)、比較対象領域の一辺の長さをn(
画素)とする。この場合には、テンプレートマッチングの演算回数Fは次式で表される。
F=d(m−n+1) ・・・(3)
(3)式において、dは画素の間引き率である。また、(m−n+1) は検索領域S内で比較対象領域の位置をずらして移動する回数を表し、nはテンプレート画像Aと検索対象領域画像Bとのテンプレートマッチング演算を行うループ回数を表す。
Next, the relationship between the size of the comparison target region (same as the size of the template image A in this embodiment), the size of the search region S, and the number of template matching operations will be considered. First, as shown in FIG. 3, the above relationship is derived when both the search area S and the comparison target area are square. The length of one side of the search area S is m (pixel), and the length of one side of the comparison target area is n (
Pixel). In this case, the number F of template matching operations is expressed by the following equation.
F = d (m−n + 1) 2 n 2 (3)
In equation (3), d is a pixel thinning rate. Further, (m−n + 1) 2 represents the number of times the position of the comparison target region is shifted within the search region S, and n 2 represents the number of loops for performing the template matching operation between the template image A and the search target region image B. Represent.

被写体を追跡するにはテンプレートサイズnを固定にし、類似度に応じて検索領域サイズを変更するには検索領域サイズmを変数とするのが合理的である。しかし、(3)式をみると、m≧nの制約の下では、演算回数Fは、テンプレートサイズnと検索領域サイズmが等しいときn回を最小値とするmの2次式であるため、Fの値は発散してしまう。すなわち、最小演算回数Fは、テンプレートサイズnと検索領域サイズmが等しいときという結論が出るが、そのようにすると検索処理が不可能となってしまう。
そこで逆に、検索領域サイズmを固定し、テンプレートサイズnを変数として4次の式として演算回数が最大となる箇所を求めてみる。(3)式をnについて1階微分すると、次式(4)が得られる。
F(n)’=2nd(2n−3mn+m) ・・・(4)
(4)式において、F(n)’=0となる位置、すなわち極値は、
n=0、 m/2、 m ・・・(5)
である。極大値は、n=m/2の場合、つまり、検索領域Sの一辺の長さm(画素)が比較対象領域の一辺の長さn(画素)の2倍近傍では演算回数が増大する。したがって、検索領域Sの一辺の長さm(画素)が比較対象領域の一辺の長さn(画素)の2倍もしくはその近傍値になるのを避けなければならない。
It is reasonable to fix the template size n to track the subject and to use the search area size m as a variable to change the search area size according to the similarity. However, looking at equation (3), under the constraint that m ≧ n, the number of operations F is a quadratic equation of m with the minimum value n 2 times when the template size n and the search area size m are equal. Therefore, the value of F will diverge. In other words, it can be concluded that the minimum number of operations F is equal to the template size n and the search area size m, but if this is done, the search process becomes impossible.
Conversely, the search area size m is fixed, and the template size n is used as a variable to obtain a location where the number of operations is maximized as a quaternary expression. When the equation (3) is first-order differentiated with respect to n, the following equation (4) is obtained.
F (n) ′ = 2nd (2n 2 −3 mn + m 2 ) (4)
In the equation (4), the position where F (n) ′ = 0, that is, the extreme value is
n = 0, m / 2, m (5)
It is. The maximum value increases when n = m / 2, that is, when the length m (pixel) of one side of the search region S is close to twice the length n (pixel) of one side of the comparison target region. Therefore, it is necessary to avoid that the length m (pixel) of one side of the search region S is twice the length n (pixel) of one side of the comparison target region or a value close thereto.

図4は、検索領域Sの一辺の長さを10(画素)とした場合の、比較対象領域の一辺の長さn(画素)(グラフの横軸)に対する演算回数F(グラフの縦軸)の関係を示すグラフである。図4(a)は、画素間引きなし(d=1)、つまり全画素を使ってテンプレートマッチング演算を行った場合の関係を示す。n=5、つまりn=m/2のときに演算回数Fが極大値を示している。一方、図4(b)は、画素間引き率dを0.5、つまり画素2個ごとに1個の画素を取り出してテンプレートマッチング演算を行った場合の関係を示す。この場合でも演算回数Fは少なくなるが、n=5すなわちn=m/2において演算回数Fが極大になることは変わらない。   FIG. 4 shows the number of operations F (vertical axis of the graph) for the length n (pixel) of one side of the comparison target region (horizontal axis of the graph) when the length of one side of the search region S is 10 (pixels). It is a graph which shows the relationship. FIG. 4A shows a relationship when no pixel thinning is performed (d = 1), that is, when template matching calculation is performed using all pixels. When n = 5, i.e., n = m / 2, the number of operations F shows a maximum value. On the other hand, FIG. 4B shows the relationship when the pixel thinning rate d is 0.5, that is, one pixel is extracted for every two pixels and the template matching calculation is performed. Even in this case, the number of operations F is reduced, but the number of operations F is maximized when n = 5, that is, n = m / 2.

次に、比較対象領域と検索領域Sの形状を一般化した場合について考察する。ここでは、図5に示すように、比較対象領域を横n(画素)、縦αn(画素)とし、検索領域Sを横m(画素)、縦βm(画素)とする。この場合のテンプレートマッチングの演算回数Fは次式(6)で表される。
F(n)=dα(m−n+1)(βm−αn+1)n ・・・(6)
(6)式をnについて1階微分してF(n)’=0となる位置、すなわち極値は、
n=0、 {3(α+β)±(9α−14αβ+9β)1/2}m/8α ・・・(7)
となる。比較対象領域の一辺の長さn(画素)と、検索領域Sの一辺の長さm(画素)とが、n=0の場合を除き、(7)式に示す関係にある場合に、演算回数Fが極大になることを示している。
Next, a case where the shapes of the comparison target region and the search region S are generalized will be considered. Here, as shown in FIG. 5, the comparison target area is horizontal n (pixels) and vertical αn (pixels), and the search area S is horizontal m (pixels) and vertical βm (pixels). In this case, the number F of template matching operations is expressed by the following equation (6).
F (n) = dα (m−n + 1) (βm−αn + 1) n 2 (6)
The position where F (n) ′ = 0 is obtained by first-order differentiation of equation (6) with respect to n, that is, the extreme value is
n = 0, {3 (α + β) ± (9α 2 -14αβ + 9β 2 ) 1/2 } m / 8α (7)
It becomes. When the length n (pixel) of one side of the comparison target area and the length m (pixel) of one side of the search area S are in the relationship shown in the expression (7) except when n = 0, the calculation is performed. It shows that the number of times F becomes maximum.

なお、ちなみにα=β、つまり比較対象領域と検索領域Sが相似形の場合には、(7)式は上記(5)式と等しくなる。これは、比較対象領域と検索領域Sが相似形であれば、検索領域Sの一辺の長さが、この検索領域Sの一辺に対応する比較対象領域の一辺の長さの2倍になったときに演算回数が極大になることを示している。   Incidentally, when α = β, that is, when the comparison target area and the search area S are similar, Expression (7) is equal to Expression (5). This is because if the comparison target area and the search area S are similar, the length of one side of the search area S is twice the length of one side of the comparison target area corresponding to one side of the search area S. It shows that the number of operations sometimes becomes maximal.

図6は、比較対象領域と検索領域Sの形状を一般化した場合の演算回数を示す。この例では、図7に示すように、比較対象領域の縦横比を1.2:1、検索領域Sの縦横比を0.9:1とし、検索領域Sの横一辺の長さを10(画素)とした場合、演算回数Fは比較対象領域の横一辺の長さn=4.20(画素)のときに極大になる。   FIG. 6 shows the number of calculations when the shapes of the comparison target region and the search region S are generalized. In this example, as shown in FIG. 7, the aspect ratio of the comparison target area is 1.2: 1, the aspect ratio of the search area S is 0.9: 1, and the length of one side of the search area S is 10 ( In the case of (pixel), the number of times of calculation F becomes maximum when the length n of the horizontal side of the comparison target region is n = 4.20 (pixels).

このように、検索領域Sの大きさを決定する場合に、比較対象領域の大きさに対する演算回数Fが極大にならないように決定すれば、少ない演算回数で追跡対象の被写体位置を演算することができる。   In this way, when determining the size of the search area S, if it is determined so that the number of calculations F with respect to the size of the comparison target area does not become maximal, the subject position to be tracked can be calculated with a small number of calculations. it can.

図8は、一実施の形態の被写体追跡制御プログラムを示すフローチャートである。このフローチャートにより一実施の形態の動作を説明する。制御装置4のCPU4aは、撮影者が操作部材5の方向キーを操作して追跡対象被写体を指定し、シャッターボタンを半押して半押しスイッチがオンすると、指定位置の所定の大きさの画像を追跡対象被写体のテンプレート画像としてメモリ4bに記憶し、この被写体追跡制御プログラムの実行を開始する。なお、ここでは撮影者が手動で指定した追跡対象被写体を例に挙げて説明するが、カメラが顔認識などにより自動で設定した追跡対象被写体の場合も同様である。   FIG. 8 is a flowchart illustrating a subject tracking control program according to an embodiment. The operation of the embodiment will be described with reference to this flowchart. The CPU 4a of the control device 4 operates the direction key of the operation member 5 to designate the subject to be tracked, and when the half-press switch is turned on by half-pressing the shutter button, the image of a predetermined size at the designated position is tracked. The template image of the target subject is stored in the memory 4b, and execution of the subject tracking control program is started. Here, the tracking target subject manually designated by the photographer will be described as an example, but the same applies to the case of the tracking target subject automatically set by the camera by face recognition or the like.

ステップ1において、撮像画像I内における検索領域Sを設定する(図2参照)。なお、被写体追跡動作を開始した直後は、検索領域Sの大きさには予め設定された初期値が設定される。ここでは、検索領域Sの初期値にテンプレート画像Aの大きさを所定値倍した大きさを設定する。続くステップ2では、検索領域S内にテンプレート画像Aと比較してテンプレートマッチング演算を行うための比較対象領域を設定する(図2参照)。なお、最初は検索領域Sの例えば左上隅に比較対象領域を設定し、テンプレートマッチング演算のたびに比較対象領域を所定画素単位で横方向および縦方向に検索領域S内を順次ずらしていく。   In step 1, a search area S in the captured image I is set (see FIG. 2). Immediately after starting the subject tracking operation, a preset initial value is set as the size of the search area S. Here, the initial value of the search area S is set to a size obtained by multiplying the size of the template image A by a predetermined value. In the subsequent step 2, a comparison target region for performing a template matching operation is set in the search region S in comparison with the template image A (see FIG. 2). First, a comparison target area is set, for example, in the upper left corner of the search area S, and the comparison target area is sequentially shifted in the horizontal direction and the vertical direction in units of predetermined pixels every time the template matching calculation is performed.

ステップ3で、テンプレート画像Aと比較対象領域画像Bとの間で上記(1)式に示すテンプレートマッチング演算を行い、類似度(1/r)を算出する。なお、この一実施の形態では(1)式により残差rを演算して類似度(1/r)を求める例を示すが、テンプレート画像Aと比較対象領域画像Bとの類似度は、この一実施の形態の算出方法に限定されず、例えば正規化相関による算出方法など、公知の算出方法を採用することができる。   In step 3, the template matching calculation shown in the above equation (1) is performed between the template image A and the comparison target region image B to calculate the similarity (1 / r). In this embodiment, an example in which the residual r is calculated by the equation (1) to obtain the similarity (1 / r) is shown. However, the similarity between the template image A and the comparison target region image B is calculated as follows. The calculation method is not limited to the calculation method of the embodiment, and a known calculation method such as a calculation method using normalized correlation can be employed.

ステップ4で、検索領域S内において比較対象領域を移動し、被写体追跡を終了したか否かを確認し、終了していない場合はステップ5へ進む。ステップ5では検索領域S内で比較対象領域をずらし、ステップ3へ戻って新しい比較対象領域画像Bとテンプレート画像Aとのテンプレートマッチング演算を行う。一方、検索領域S内における被写体追跡を終了した場合はステップ6へ進み、これまでに演算したテンプレート画像Aと比較対象領域画像Bとの類似度の中で、最大の類似度が得られる比較対象領域を追跡対象の被写体位置として特定する。   In step 4, the comparison target area is moved in the search area S to check whether or not the subject tracking has been completed. In step 5, the comparison target region is shifted in the search region S, and the process returns to step 3 to perform a template matching operation between the new comparison target region image B and the template image A. On the other hand, when the subject tracking in the search area S is completed, the process proceeds to step 6, and the comparison target that obtains the maximum similarity among the similarities between the template image A and the comparison target area image B calculated so far. An area is specified as a subject position to be tracked.

ステップ7で操作部材5の半押しスイッチがオンしたままか、つまりシャッターボタンの半押し操作が継続されているか否かを判別し、半押し操作が継続されている場合はステップ1へ戻り、半押し操作がなされていない場合は被写体追跡制御プログラムの実行を終了する。   In step 7, it is determined whether or not the half-press switch of the operation member 5 is kept on, that is, whether or not the half-press operation of the shutter button is continued. If no push operation has been performed, the execution of the subject tracking control program is terminated.

シャッターボタンの半押し操作が継続されている場合には、ステップ1へ戻って検索領域Sを再設定する。この場合、検索領域Sの大きさを、基本的には上記(2)式に示す最大の類似度(1/r)に応じた大きさとするが、最大類似度に応じた検索領域Sの大きさが比較対象領域の大きさに対して上記(5)式または(7)式に示すような関係にある場合には、比較対象領域の大きさに対するテンプレートマッチングの演算回数が極大にならない検索領域Sの大きさに変更する。   When the half-press operation of the shutter button is continued, the process returns to step 1 to reset the search area S. In this case, the size of the search area S is basically the size corresponding to the maximum similarity (1 / r) shown in the above equation (2), but the size of the search area S corresponding to the maximum similarity is shown. Search area in which the number of times of template matching with respect to the size of the comparison target area does not become a maximum when the relation is as shown in the above formula (5) or (7) with respect to the size of the comparison target area Change to the size of S.

前回のテンプレートマッチングにおけるテンプレート画像Aと比較対象領域画像Bとの最大類似度と、テンプレートマッチング演算回数とに基づいて検索領域Sの大きさを再設定した後、ステップ2へ進み、上述した処理を繰り返す。   After resetting the size of the search region S based on the maximum similarity between the template image A and the comparison target region image B in the previous template matching and the number of template matching operations, the process proceeds to step 2 and the above-described processing is performed. repeat.

図9は一実施の形態による被写体追跡結果を示す図である。図9(a)に示す子供の顔部分の画像をテンプレート画像Aとして被写体追跡を行った結果、図9(b)に示すように、子供の顔の動きが少なく、追跡対象被写体の子供の顔が当初のテンプレート画像A取得時の位置に近い場合には、比較対象領域(図中に白色実線矩形枠で示す)の画像Bとテンプレート画像Aとの類似度が高いので、テンプレート画像Aの大きさよりもわずかに大きい検索領域S(図中に白色破線矩形枠で示す)が設定される。ここで、設定された検索領域Sの大きさは、検索領域Sと比較対象領域の大きさの関係が上記(5)式または(7)式に示す条件を除く関係になっている。これにより、追跡対象被写体の動きが小さい場合には、テンプレートマッチングにおける演算回数を低減、つまり演算時間を低減して被写体追跡の応答性を向上させながら、追跡対象被写体と異なる被写体に疑似マッチングするのを防止することができる。   FIG. 9 is a diagram illustrating a subject tracking result according to the embodiment. As a result of subject tracking using the image of the child's face shown in FIG. 9A as the template image A, as shown in FIG. Is close to the position at the time of initial template image A acquisition, the similarity between the image B in the comparison target region (indicated by a white solid line rectangular frame in the figure) and the template image A is high, so the size of the template image A A search area S (indicated by a white broken-line rectangular frame in the figure) that is slightly larger than that is set. Here, the size of the set search area S is such that the relationship between the size of the search area S and the comparison target area excludes the condition shown in the above formula (5) or (7). As a result, when the movement of the tracking target subject is small, the number of computations in template matching is reduced, that is, the computation time is reduced to improve subject tracking responsiveness, and pseudo matching is performed to a subject different from the tracking target subject. Can be prevented.

これに対し図9(c)に示すように、子供が急に姿勢を低くしたために、追跡対象被写体の子供の顔が当初の位置から遠ざかった場合には、比較対象領域(図中に白色実線矩形枠で示す)の画像Bとテンプレート画像Aとの類似度が低くなるので、図9(b)の場合よりも広い検索領域S(図中に白色破線矩形枠で示す)が設定される。この場合においても、設定された検索領域Sの大きさは、検索領域Sと比較対象領域の大きさの関係が上記(5)式または(7)式に示す条件を除く関係になっている。これにより、追跡対象被写体の動きが大きい場合でも、検索領域S内に追跡対象被写体を確実に捕捉することができる。   On the other hand, as shown in FIG. 9 (c), when the child's face of the tracking target subject moves away from the initial position because the child suddenly lowered his / her posture, the comparison target region (white solid line in the figure) Since the similarity between the image B (shown by a rectangular frame) and the template image A is low, a search area S (shown by a white broken-line rectangular frame in the figure) wider than that in the case of FIG. 9B is set. Even in this case, the size of the set search region S is such that the relationship between the size of the search region S and the comparison target region excludes the condition shown in the above formula (5) or (7). Thereby, even when the movement of the tracking target subject is large, the tracking target subject can be reliably captured in the search region S.

なお、上述した一実施の形態では、テンプレート画像Aの大きさと比較対象領域画像Bの大きさとを等しくした一実施の形態を示したが、両画像の大きさが異なっていてもよい。例えば、比較対象領域画像Bがテンプレート画像Aよりも大きい場合には、比較対象領域画像Bの画素を間引いてテンプレート画像Aの画素数と同じだけ抽出するか、あるいは比較対象領域画像Bにおける隣接画素どうしを平均化してテンプレート画像Aの画素数と同じ画像を再生するなどして比較すればよい。   In the above-described embodiment, the embodiment in which the size of the template image A and the size of the comparison target region image B are made equal is shown. However, the sizes of both images may be different. For example, when the comparison target area image B is larger than the template image A, the pixels of the comparison target area image B are thinned out and extracted as many as the number of pixels of the template image A, or adjacent pixels in the comparison target area image B What is necessary is just to compare by averaging, reproducing | regenerating the image same as the pixel number of the template image A, etc. FIG.

なお、上述した実施の形態とそれらの変形例において、実施の形態どうし、または実施の形態と変形例とのあらゆる組み合わせが可能である。   In the above-described embodiments and their modifications, all combinations of the embodiments or the embodiments and the modifications are possible.

上述した実施の形態とその変形例によれば以下のような作用効果を奏することができる。まず、連続して撮像された複数の画像のそれぞれに、予め設定したテンプレート画像と類似する被写体を検索するための検索領域と、検索領域内にテンプレート画像と比較するための比較対象領域とを設定し、検索領域内で比較対象領域を移動させながら、比較対象領域の画像とテンプレート画像とを比較して類似度を演算し、画像内で類似度の最大値が演算された比較対象領域の位置を、追跡対象の被写体が存在する位置として特定する際に、比較対象領域の大きさに対する検索領域の大きさが所定の関係とならないように検索領域の大きさを設定するようにしたので、比較対象領域の大きさに対する検索領域の大きさが所定の関係になってテンプレートマッチング演算の回数が急激に増大し、テンプレートマッチングの演算時間が長くなるのを防止することができる。   According to the above-described embodiment and its modifications, the following operational effects can be achieved. First, a search area for searching for a subject similar to a preset template image and a comparison target area for comparison with the template image are set in each of a plurality of images captured continuously. Then, while moving the comparison target region in the search region, the image of the comparison target region is compared with the template image to calculate the similarity, and the position of the comparison target region in which the maximum value of the similarity is calculated in the image Since the size of the search area is set so that the size of the search area does not have a predetermined relationship with the size of the comparison target area when specifying the position where the subject to be tracked exists The size of the search area with respect to the size of the target area has a predetermined relationship, the number of template matching operations increases rapidly, and the template matching operation time increases. It is possible to prevent the.

また、一実施の形態によれば、類似度の演算回数を、比較対象領域の大きさと検索領域の大きさとの関数で表した場合に、類似度の演算回数が極大になる所定の関係とならないように検索領域の大きさを設定するようにしたので、比較対象領域の大きさと検索領域の大きさからテンプレートマッチング演算の回数が急激に増大する関係を簡便に導出でき、テンプレートマッチングにおける演算時間の増大を確実に防止することができる。   Further, according to an embodiment, when the number of similarity calculations is expressed as a function of the size of the comparison target area and the size of the search area, there is no predetermined relationship that maximizes the number of similarity calculations. Since the size of the search area is set in this way, the relationship between the size of the comparison target area and the size of the search area can be easily derived, and the relationship between the number of template matching operations can be easily derived. An increase can be reliably prevented.

さらに、一実施の形態によれば、類似度の最大値が低いほど、次の画像に対して大きな検索領域を設定するようにしたので、追跡対象被写体の動きが小さい場合には、テンプレートマッチングにおける演算回数を低減、つまり演算時間を低減して被写体追跡の応答性を向上させながら、追跡対象被写体と異なる被写体に疑似マッチングするのを防止することができる。一方、追跡対象被写体の動きが大きい場合でも、検索領域内に追跡対象被写体を確実に捕捉することができる。   Furthermore, according to an embodiment, as the maximum value of the similarity is lower, a larger search area is set for the next image. Therefore, when the movement of the tracking target subject is small, the template matching is performed. It is possible to prevent pseudo-matching with a subject different from the tracking target subject while reducing the number of computations, that is, reducing the computation time to improve subject tracking responsiveness. On the other hand, even if the movement of the tracking target subject is large, the tracking target subject can be reliably captured in the search area.

4;制御装置、4a;CPU 4; Control device, 4a; CPU

Claims (3)

連続して撮像された複数の画像のそれぞれに、設定したテンプレート画像と類似する被写体を検索するための検索領域と、前記検索領域内に前記テンプレート画像と比較するための比較対象領域とを設定する領域設定手順と、
前記検索領域内で前記比較対象領域を移動させながら、前記比較対象領域の画像と前記テンプレート画像とを比較して類似度を演算する類似度演算手順と、
前記画像内で前記類似度の最大値が演算された前記比較対象領域の位置を、追跡対象の被写体が存在する位置として特定する位置特定手順とをコンピューターに実行させるための被写体追跡プログラムであって、
前記領域設定手順は、前記類似度の演算回数を前記比較対象領域の大きさと前記検索領域の大きさとの関数で表した場合に、前記類似度の演算回数が極大にならないように、前記比較対象領域の大きさに対する前記検索領域の大きさを設定することを特徴とする被写体追跡プログラム。
In each of a plurality of images continuously captured, set a search area for searching a subject similar to setting boss was the template image and the comparison regions to be compared with the template image in the search area Region setting procedure to be performed,
A similarity calculation procedure for calculating the similarity by comparing the image of the comparison target area and the template image while moving the comparison target area in the search area;
A subject tracking program for causing a computer to execute a position specifying procedure for specifying a position of the comparison target region where the maximum value of the similarity is calculated in the image as a position where a subject to be tracked exists. ,
In the region setting procedure, when the number of similarity calculations is expressed as a function of the size of the comparison target region and the size of the search region, the comparison target is not maximized. An object tracking program, wherein the size of the search area is set with respect to the area size.
請求項に記載の被写体追跡プログラムにおいて、
前記領域設定手順は、前記類似度の最大値が低いほど、次の前記画像に対して大きな前記検索領域を設定することを特徴とする被写体追跡プログラム。
The subject tracking program according to claim 1 ,
The subject tracking program is characterized in that the region setting procedure sets a larger search region for the next image as the maximum value of the similarity is lower.
請求項1または2に記載の被写体追跡プログラムを実行する実行手段を備えることを特徴とする被写体追跡装置。
A subject tracking apparatus comprising execution means for executing the subject tracking program according to claim 1 .
JP2009098742A 2008-06-04 2009-04-15 Subject tracking program and subject tracking device Active JP5526588B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009098742A JP5526588B2 (en) 2008-06-04 2009-04-15 Subject tracking program and subject tracking device

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP2008146870 2008-06-04
JP2008146870 2008-06-04
JP2009098742A JP5526588B2 (en) 2008-06-04 2009-04-15 Subject tracking program and subject tracking device

Publications (2)

Publication Number Publication Date
JP2010015544A JP2010015544A (en) 2010-01-21
JP5526588B2 true JP5526588B2 (en) 2014-06-18

Family

ID=41701580

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009098742A Active JP5526588B2 (en) 2008-06-04 2009-04-15 Subject tracking program and subject tracking device

Country Status (1)

Country Link
JP (1) JP5526588B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108053424B (en) * 2017-12-15 2020-06-16 深圳云天励飞技术有限公司 Target tracking method and device, electronic equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3704045B2 (en) * 2001-01-15 2005-10-05 株式会社ニコン Target object tracking device

Also Published As

Publication number Publication date
JP2010015544A (en) 2010-01-21

Similar Documents

Publication Publication Date Title
US10455141B2 (en) Auto-focus method and apparatus and electronic device
CN108764024B (en) Device and method for generating face recognition model and computer readable storage medium
US10269130B2 (en) Methods and apparatus for control of light field capture object distance adjustment range via adjusting bending degree of sensor imaging zone
JP5159515B2 (en) Image processing apparatus and control method thereof
US10455152B2 (en) Panoramic video processing method and device and non-transitory computer-readable medium
JP5699432B2 (en) Image processing device
US9508153B2 (en) Distance measurement apparatus, imaging apparatus, distance measurement method, and program
JP6671994B2 (en) Imaging device and control method therefor, program, storage medium
JP2017059207A (en) Image recognition method
JP2015100066A5 (en) Imaging apparatus, image processing apparatus, image processing method, and program
US9721153B2 (en) Image processing apparatus, image processing method, and storage medium that recognize an image based on a designated object type
US20090207260A1 (en) Image pickup apparatus and image pickup method
JP6656035B2 (en) Image processing apparatus, imaging apparatus, and control method for image processing apparatus
JP2014241505A (en) Photographing apparatus, photographing method, template generation apparatus, template generation method, and program
JP2009141475A (en) Camera
US20220321792A1 (en) Main subject determining apparatus, image capturing apparatus, main subject determining method, and storage medium
JP2015036841A (en) Image processing apparatus, distance measuring apparatus, imaging apparatus, and image processing method
CN102708559B (en) Blur difference estimation using multi-kernel convolution
JP5526588B2 (en) Subject tracking program and subject tracking device
US10212412B2 (en) Method of increasing photographing speed of photographing device
US10880457B2 (en) Image processing apparatus, image capturing apparatus, image processing method, and storage medium
JP2015230515A (en) Subject tracking device and camera
JP2022048077A (en) Image processing apparatus and control method for the same
JP2010257041A (en) Object tracking device and camera
JP2006058959A (en) Similar image determination method, program and apparatus

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120330

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130724

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130813

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20131015

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140331

R150 Certificate of patent or registration of utility model

Ref document number: 5526588

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

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