JP2019020839A - Image processing apparatus, image processing method and program - Google Patents

Image processing apparatus, image processing method and program Download PDF

Info

Publication number
JP2019020839A
JP2019020839A JP2017136410A JP2017136410A JP2019020839A JP 2019020839 A JP2019020839 A JP 2019020839A JP 2017136410 A JP2017136410 A JP 2017136410A JP 2017136410 A JP2017136410 A JP 2017136410A JP 2019020839 A JP2019020839 A JP 2019020839A
Authority
JP
Japan
Prior art keywords
feature point
tracking
image
tracking destination
destination feature
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
JP2017136410A
Other languages
Japanese (ja)
Inventor
谷口 浩之
Hiroyuki Taniguchi
浩之 谷口
俊宏 望月
Toshihiro Mochizuki
俊宏 望月
稔 坂井田
Minoru Sakaida
稔 坂井田
総一郎 鈴木
Soichiro Suzuki
総一郎 鈴木
友貴 植草
Tomotaka Uekusa
友貴 植草
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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP2017136410A priority Critical patent/JP2019020839A/en
Publication of JP2019020839A publication Critical patent/JP2019020839A/en
Pending legal-status Critical Current

Links

Images

Abstract

To allow processing to be completed within a prescribed period of time with less degradation in vector detection accuracy in the case of maldistribution of tracked feature points within an image.SOLUTION: A first RDDMAC (221) divides an image into a plurality of regions. A new feature point calculation unit (202) extracts feature points in each of the divided regions. A matching processing unit (203) detects a motion vector value on the basis of the feature points. A tracked feature point determination unit (205) calculates tracked feature points for use in motion vector detection for a next frame on the basis of a motion vector value obtained from a preceding frame and the feature points. If the tracked feature points meet a preliminarily determined condition, the tracked feature point determination unit (205) discards at least a part of the tracked feature points and supplements new feature points as tracked feature points.SELECTED DRAWING: Figure 2

Description

本発明は、画像の動きを検出する画像処理装置、画像処理方法、及びプログラムに関する。   The present invention relates to an image processing apparatus, an image processing method, and a program for detecting image motion.

デジタルスチルカメラやデジタルビデオカメラ等の撮像装置を用いて撮影された映像に対して手ぶれ補正を施すためには、フレーム画像間の動き量を検出して複数枚の画像に対して位置合わせを行う必要がある。フレーム画像間の動き量を検出する方法としては、ジャイロセンサのような外部機器の情報を用いたり、撮影されたフレーム画像から動き量を推定したりする方法等がある。   In order to perform camera shake correction on video shot using an imaging device such as a digital still camera or a digital video camera, the amount of motion between frame images is detected and alignment is performed on a plurality of images. There is a need. As a method for detecting the amount of motion between frame images, there are a method of using information of an external device such as a gyro sensor, a method of estimating the amount of motion from a captured frame image, and the like.

フレーム画像を用いた動き量推定の方法は従来から種々提案されているが、その代表的なものとしてテンプレートマッチングによる動きベクトル検出がある。テンプレートマッチングでは、まず映像中の連続した2枚のフレーム画像の一方を原画像、もう一方を参照画像とする。そして、原画像上に配置した所定の大きさの矩形領域をテンプレートブロックとし、参照画像の各位置においてテンプレートブロック内の画素値の分布との相関を求める。このとき、参照画像中で最も相関が高くなる位置がテンプレートブロックの移動先であり、原画像上でのテンプレートブロックの位置を基準とした時の移動先への向きと移動量が動きベクトルとなる。   Various methods for estimating the amount of motion using a frame image have been proposed in the past. A typical example is motion vector detection by template matching. In template matching, first, one of two consecutive frame images in a video is used as an original image, and the other is used as a reference image. Then, a rectangular area having a predetermined size arranged on the original image is used as a template block, and a correlation with a distribution of pixel values in the template block is obtained at each position of the reference image. At this time, the position where the correlation is highest in the reference image is the destination of the template block, and the direction and amount of movement to the destination when the position of the template block on the original image is used as a reference is the motion vector. .

動きベクトルの検出率を向上させるため、特徴点を抽出し、抽出した特徴点にテンプレートブロックを配置して、フレーム画像間でテンプレートマッチングを行う技術がある。ここで、画像全体で特徴点抽出を行うと、特徴点の分布は不均一になることが多い。分布が不均一な特徴点に対して得られた動きベクトルを手ぶれ補正の用途で使用する場合、特徴点の集中した領域が主となる手ぶれ補正となってしまう。   In order to improve the detection rate of motion vectors, there is a technique for extracting feature points, placing template blocks at the extracted feature points, and performing template matching between frame images. Here, if feature points are extracted from the entire image, the distribution of feature points is often non-uniform. When a motion vector obtained for feature points having a non-uniform distribution is used for the purpose of camera shake correction, a region where the feature points are concentrated is the main camera shake correction.

そこで、特徴点を均一に分布させるため、画像をグリッド状に分割して、特徴の大きさを表す特徴値を画素ごとに計算し、各グリッド内で特徴値が最も大きい画素を特徴点として抽出する技術がある(例えば特許文献1)。
さらに動きベクトルの検出率を向上させるため、特徴点を追跡する技術がある。特徴点追跡は、画像から抽出された特徴点の動きベクトルを、連続する複数のフレーム画像に渡って逐次検出することで実現できる(例えば特許文献2)。
Therefore, in order to distribute the feature points uniformly, the image is divided into grids, feature values representing the feature size are calculated for each pixel, and the pixel with the largest feature value in each grid is extracted as the feature point. There is a technique (for example, Patent Document 1).
Furthermore, there is a technique for tracking feature points in order to improve the detection rate of motion vectors. Feature point tracking can be realized by sequentially detecting motion vectors of feature points extracted from an image over a plurality of continuous frame images (for example, Patent Document 2).

特開2008−192060号公報JP 2008-192060 A 特開2007−334625号公報JP 2007-334625 A

ところで、前述したように特徴点の追跡処理が行われる場合、追跡先の特徴点が、画像内の一部の領域に偏在してしまうことがある。このように追跡先の特徴点が一部の領域に偏在すると、動きベクトル検出性能の低下や、所定の期間内に処理を完了させることができなくなるという問題が生ずることがある。   By the way, when the feature point tracking process is performed as described above, the feature point of the tracking destination may be unevenly distributed in a part of the region in the image. Thus, if the characteristic points of the tracking destination are unevenly distributed in a part of the region, there may be a problem that the motion vector detection performance is deteriorated and the processing cannot be completed within a predetermined period.

そこで、本発明は、追跡先の特徴点が画像内で偏在した場合に、ベクトル検出精度の低下を抑えつつ、所定の期間内に処理を完了させることを目的とする。   Therefore, an object of the present invention is to complete a process within a predetermined period while suppressing a decrease in vector detection accuracy when feature points of tracking destinations are unevenly distributed in an image.

本発明は、フレームの画像を複数の領域に分割する分割手段と、前記複数に分割された各領域内で画像の特徴点を抽出する抽出手段と、前記特徴点を基に動きベクトルを検出する検出手段と、前フレームから検出された前記動きベクトルの値と特徴点とを基に、次のフレームの動きベクトル検出に用いられる追跡先特徴点を算出する算出手段と、前記追跡先特徴点が予め定めた条件に該当する場合に、前記追跡先特徴点の少なくとも一部を破棄して、前記抽出手段にて抽出された新規特徴点を追跡先特徴点として補填する補填手段と、を有することを特徴とする。   The present invention relates to a dividing unit that divides a frame image into a plurality of regions, an extracting unit that extracts image feature points in each of the divided regions, and a motion vector is detected based on the feature points. Detection means, calculation means for calculating a tracking destination feature point used for motion vector detection of the next frame based on the value and feature point of the motion vector detected from the previous frame, and the tracking destination feature point Compensation means for discarding at least a part of the tracking destination feature points and filling the new feature points extracted by the extraction means as tracking destination feature points when a predetermined condition is met. It is characterized by.

本発明によれば、追跡先の特徴点が画像内で偏在した場合に、ベクトル検出精度の低下を抑えつつ、所定の期間内に処理を完了させることが可能となる。   According to the present invention, when the feature point of the tracking destination is unevenly distributed in the image, it is possible to complete the processing within a predetermined period while suppressing a decrease in vector detection accuracy.

本実施形態の画像処理装置を備えたデジタルカメラのブロック図である。It is a block diagram of a digital camera provided with the image processing apparatus of this embodiment. 第1の実施形態のベクトル検出部のブロック図である。It is a block diagram of the vector detection part of 1st Embodiment. グリッド配置、特徴点、テンプレートマッチング領域の説明図である。It is explanatory drawing of a grid arrangement | positioning, a feature point, and a template matching area | region. 特徴点追跡処理の概要の説明図である。It is explanatory drawing of the outline | summary of a feature point tracking process. テンプレートマッチング処理タイミングの説明図である。It is explanatory drawing of a template matching process timing. テンプレートマッチング処理タイミングの遅延例の説明図である。It is explanatory drawing of the example of a delay of a template matching process timing. 第1の実施形態のベクトル検出部の処理フローチャートである。It is a process flowchart of the vector detection part of 1st Embodiment. 第1の実施形態の新規特徴点算出部のブロック図である。It is a block diagram of the new feature point calculation unit of the first embodiment. 第1の実施形態の精度判定部における判定処理の説明に用いる図である。It is a figure used for description of the determination process in the precision determination part of 1st Embodiment. 第1の実施形態の追跡先特徴点決定部のブロック図である。It is a block diagram of the tracking destination feature point determination unit of the first embodiment. 追跡先特徴点と新規特徴点の位置関係を示す図である。It is a figure which shows the positional relationship of a tracking destination feature point and a new feature point. 第1の実施形態の追跡先特徴点決定部の処理フローチャートである。It is a process flowchart of the tracking destination feature point determination part of 1st Embodiment. 画像処理部における処理タイミングを示す図である。It is a figure which shows the process timing in an image process part. 第2の実施形態のベクトル検出部のブロック図である。It is a block diagram of the vector detection part of 2nd Embodiment. 第2の実施形態の追跡先特徴点決定部のブロック図である。It is a block diagram of the tracking destination feature point determination unit of the second embodiment. 範囲判定部の処理の説明に用いる図である。It is a figure used for description of the process of a range determination part. 第2の実施形態の追跡先特徴点決定部の処理フローチャートである。It is a process flowchart of the tracking destination feature point determination part of 2nd Embodiment. 範囲判定部と新規特徴点補填部の処理の説明に用いる図である。It is a figure used for description of a process of a range determination part and a new feature point compensation part. 第3の実施形態のベクトル検出部のブロック図である。It is a block diagram of the vector detection part of 3rd Embodiment. 第3の実施形態における補填領域区分の説明に用いる図である。It is a figure used for description of the compensation area | region division in 3rd Embodiment. 第3の実施形態の追跡先特徴点決定部のブロック図である。It is a block diagram of the tracking destination feature point determination unit of the third embodiment. 2点の追跡先特徴点の位置関係の説明に用いる図である。It is a figure used for description of the positional relationship of two tracking destination feature points. 第3の実施形態の追跡先特徴点決定部の処理フローチャートである。It is a process flowchart of the tracking destination feature point determination part of 3rd Embodiment. 第4の実施形態の追跡先特徴点決定部のブロック図である。It is a block diagram of the tracking destination feature point determination part of 4th Embodiment. 第4の実施形態における追跡先特徴点の位置関係を示す図である。It is a figure which shows the positional relationship of the tracking destination feature point in 4th Embodiment. 第4の実施形態の追跡先特徴点決定部の処理フローチャートである。It is a process flowchart of the tracking destination feature point determination part of 4th Embodiment. 第4の実施形態における処理タイミングを示す図である。It is a figure which shows the process timing in 4th Embodiment. 第5の実施形態のマッチング処理部のブロック図である。It is a block diagram of the matching process part of 5th Embodiment. マッチング処理部の処理フローチャートである。It is a process flowchart of a matching process part. 第5の実施形態の領域区分部の処理の説明に用いる図である。It is a figure used for description of the process of the area | region division part of 5th Embodiment. サイズ変更部と推定部の処理の説明に用いる図である。It is a figure used for description of the process of a size change part and an estimation part.

以下、添付図面を参照して本発明の好適な実施形態について説明する。
<第1の実施形態>
図1は実施形態の画像処理装置の一適用例としてのデジタルカメラの概略構成例を示す図である。なお、本実施形態の画像処理装置は、デジタルカメラの他にも、例えばデジタルビデオカメラ、カメラ機能を備えたスマートフォンやタブレット端末等の各種携帯端末、工業用カメラ、車載カメラ、医療用カメラ等の各種撮像装置にも適用可能である。また、図2は、本実施形態の画像処理装置に係る画像処理部104が有する動きベクトル検出部の概略構成を示した図である。なお、図2にはベクトル検出に関連した他の構成も含まれている。
Preferred embodiments of the present invention will be described below with reference to the accompanying drawings.
<First Embodiment>
FIG. 1 is a diagram illustrating a schematic configuration example of a digital camera as an application example of the image processing apparatus according to the embodiment. In addition to the digital camera, the image processing apparatus of the present embodiment includes, for example, a digital video camera, various portable terminals such as a smartphone and a tablet terminal having a camera function, an industrial camera, an in-vehicle camera, a medical camera, and the like. The present invention can also be applied to various imaging devices. FIG. 2 is a diagram illustrating a schematic configuration of a motion vector detection unit included in the image processing unit 104 according to the image processing apparatus of the present embodiment. FIG. 2 includes other configurations related to vector detection.

図1において、結像光学部101は、レンズ及び絞りなどを備えており、撮影の際にはフォーカス調節及び露出調節を行い、撮像素子102に光学像を結像させる。撮像素子102は、光学像を電気信号(アナログ画像信号)に変換する光電変換機能を有し、CCDやCMOSセンサ等で構成される。A/D変換部103は、撮像素子102からのアナログ画像信号をデジタル画像データに変換する。   In FIG. 1, the imaging optical unit 101 includes a lens, a diaphragm, and the like, and performs focus adjustment and exposure adjustment at the time of shooting to form an optical image on the image sensor 102. The image sensor 102 has a photoelectric conversion function for converting an optical image into an electrical signal (analog image signal), and is configured by a CCD, a CMOS sensor, or the like. The A / D conversion unit 103 converts an analog image signal from the image sensor 102 into digital image data.

DRAM107は、データを記憶するメモリであり、所定枚数の静止画像や所定時間の動画像、音声等のデータ、CPU112の動作用の定数、プログラム等を記憶するのに十分な記憶容量を備えている。メモリ制御部106は、CPU112或いはデータ転送部105からの指示に応じて、DRAM107へのデータ書き込みやデータ読み出しを行う。   The DRAM 107 is a memory for storing data, and has a sufficient storage capacity for storing a predetermined number of still images, moving images for a predetermined time, data such as sound, constants for operating the CPU 112, programs, and the like. . The memory control unit 106 performs data writing to and data reading from the DRAM 107 in accordance with instructions from the CPU 112 or the data transfer unit 105.

不揮発性メモリ制御部108は、CPU112からの指示に応じて、ROM109へのデータの書き込みや読み出しを行う。ROM109は、電気的に消去・記録可能な不揮発性メモリであり、EEPROM等が用いられる。ROM109には、CPU112の動作用の定数、プログラム等が格納されている。   The nonvolatile memory control unit 108 writes and reads data to and from the ROM 109 in accordance with instructions from the CPU 112. The ROM 109 is an electrically erasable / recordable nonvolatile memory, and an EEPROM or the like is used. The ROM 109 stores constants for operating the CPU 112, programs, and the like.

CPU112は、デジタルカメラ全体の制御を司るマイクロコンピュータ等で構成され、各機能ブロックに対して動作指示を行い、各種の制御処理を実行する。CPU112は、バス114を介して、画像処理部104、データ転送部105、メモリ制御部106、不揮発性メモリ制御部108、表示制御部110、操作部113、撮像素子102等を制御する。また、CPU112は、撮像素子102を制御してA/D変換部103にアナログ信号を読み出す際の設定を、読み出し順序設定としてROM109に記憶する。更にCPU112は、ROM109に記録されている読み出し順序設定を読み込み、その設定に応じて画像処理部104の各種画像処理を制御することができる。CPU112のマイクロコンピュータは、ROM109に記録されたプログラムを実行することにより、本実施形態に係る各処理の制御を実現する。バス114はシステムバスであり、バス115は画像データバスである。   The CPU 112 is configured by a microcomputer or the like that controls the entire digital camera, and instructs each functional block to execute various control processes. The CPU 112 controls the image processing unit 104, the data transfer unit 105, the memory control unit 106, the nonvolatile memory control unit 108, the display control unit 110, the operation unit 113, the image sensor 102, and the like via the bus 114. In addition, the CPU 112 stores settings in the ROM 109 as settings for reading out analog signals to the A / D conversion unit 103 by controlling the image sensor 102 as reading order settings. Further, the CPU 112 can read the reading order setting recorded in the ROM 109 and control various image processes of the image processing unit 104 according to the setting. The microcomputer of the CPU 112 implements control of each process according to the present embodiment by executing a program recorded in the ROM 109. The bus 114 is a system bus, and the bus 115 is an image data bus.

表示部111は、液晶モニタ等から成り、表示制御部110により制御され、各種画像等を表示部111に表示する。操作部113は、ユーザにより操作されるスイッチやボタン等を含み、電源のON/OFF、シャッタのON/OFF等の操作に使用される。   The display unit 111 includes a liquid crystal monitor and is controlled by the display control unit 110 to display various images on the display unit 111. The operation unit 113 includes switches and buttons operated by the user, and is used for operations such as power ON / OFF and shutter ON / OFF.

画像処理部104は、各種の画像処理を行う構成及びバッファメモリ等を有して構成されており、各種画像処理には図2に示す動きベクトル検出部にて行われるベクトル検出処理も含まれる。図2に示すベクトル検出部の説明については後述する。データ転送部105は、データ転送を行う複数のDMAC(Direct Memory Access Controller)を有して構成されており、バス115を介して、DRAM107へのデータの書き込みや読み出しを行う。   The image processing unit 104 includes a configuration for performing various types of image processing, a buffer memory, and the like. The various types of image processing include vector detection processing performed by the motion vector detection unit illustrated in FIG. The description of the vector detection unit shown in FIG. 2 will be described later. The data transfer unit 105 includes a plurality of DMACs (Direct Memory Access Controllers) that perform data transfer, and writes and reads data to and from the DRAM 107 via the bus 115.

以下、動きベクトル検出処理の概要について説明する。
動きベクトル検出処理としては、前述したようなテンプレートマッチングを用いた動きベクトル検出処理が知られている。動きベクトル検出処理の際には、ベクトル検出率を向上させるために、前述したように画像をグリッド状に分割して特徴点を抽出する処理、特徴点を追跡する処理等が行われる。
The outline of the motion vector detection process will be described below.
As the motion vector detection process, a motion vector detection process using template matching as described above is known. In the motion vector detection process, in order to improve the vector detection rate, as described above, a process of extracting feature points by dividing an image into a grid shape, a process of tracking feature points, and the like are performed.

図3は、ベクトル検出処理の際のグリッド配置と特徴点、テンプレートマッチング領域の関係説明に用いる図である。ベクトル検出処理の際には、フレームの画像が、複数のグリッドに分割される。各グリッドは、予め設定されたサイズの特徴抽出グリッド302及び周辺グリッド301(図3中のドット模様が付されたグリッド)として、水平,垂直方向にそれぞれ設定された個数分配置される。そして、特徴抽出グリッド302毎に、特徴点303が一つ抽出される。周辺グリッド301は、各特徴抽出グリッド302からなる特徴抽出グリッド群の周囲に配置される。周辺グリッド301は、テンプレートマッチングには使用されるが、特徴点の抽出は行われない。テンプレートマッチング処理の際には、特徴点303を中心として、予め決めたサイズの矩形状のサーチ領域305及びテンプレート領域304が設定される。なお、テンプレートマッチング処理の際のサーチ領域305及びテンプレート領域304は、撮像素子102のセンサ出力におけるいわゆるラスタスキャン順に合わせて順に設定される。   FIG. 3 is a diagram used for explaining the relationship between the grid arrangement, the feature points, and the template matching area in the vector detection process. In the vector detection process, the frame image is divided into a plurality of grids. Each grid is arranged as a feature extraction grid 302 and a peripheral grid 301 (grid with a dot pattern in FIG. 3) having a preset size in the number set in the horizontal and vertical directions. One feature point 303 is extracted for each feature extraction grid 302. The peripheral grid 301 is arranged around a feature extraction grid group including the feature extraction grids 302. The peripheral grid 301 is used for template matching, but feature points are not extracted. In the template matching process, a rectangular search area 305 and a template area 304 having a predetermined size are set around the feature point 303. Note that the search area 305 and the template area 304 in the template matching process are sequentially set in accordance with the so-called raster scan order in the sensor output of the image sensor 102.

図4(a)は、抽出された特徴点を用いた追跡処理の概要説明に用いる図である。図4(a)において、特徴点追跡処理の際には、先ず、現フレームの画像に対し、前述した特徴抽出グリッド1010及び周辺グリッド1011が設定される。そして、特徴抽出グリッド1010内で特徴点1001が抽出され、さらにサーチ領域1005とテンプレート領域1003が設定されてテンプレートマッチングが行われることにより、動きベクトルのベクトル値1004が算出される。次のフレームの処理では、前フレームで算出されたベクトル値1004を特徴点1001に加算することで、追跡先となる特徴点(追跡先特徴点1002とする。)が算出され、その追跡先特徴点1002を中心にテンプレートマッチングが実施される。以後、複数のフレームにわたって順番に前述同様の処理が行われ、各フレームで順に算出された追跡先特徴点に対してベクトル値が順に加算されることにより、特徴点の追跡が実現される。   FIG. 4A is a diagram used for explaining the outline of the tracking process using the extracted feature points. In FIG. 4A, in the feature point tracking process, first, the feature extraction grid 1010 and the peripheral grid 1011 described above are set for the image of the current frame. A feature point 1001 is extracted in the feature extraction grid 1010, and a search region 1005 and a template region 1003 are set and template matching is performed, whereby a vector value 1004 of a motion vector is calculated. In the processing of the next frame, the vector value 1004 calculated in the previous frame is added to the feature point 1001, thereby calculating a feature point that is a tracking destination (referred to as a tracking destination feature point 1002), and the tracking destination feature. Template matching is performed around the point 1002. Thereafter, processing similar to that described above is performed in order over a plurality of frames, and vector values are sequentially added to the tracking destination feature points calculated sequentially in each frame, thereby realizing tracking of the feature points.

図5(a)は、撮像素子102の画像出力(以下、センサ出力とする。)からテンプレートマッチング処理の終了までのタイミングチャートを示す図である。また、図5(b)は、図4(a)と同様の特徴抽出グリッド1010、周辺グリッド1011、サーチ領域1005、テンプレート領域1003、追跡先特徴点1002を表した図である。図5(b)には、いわゆるラスタスキャン1020を表す矢印と、テンプレートマッチング処理を開始できる最初(一番初め)のテンプレート位置1101も示されている。図5(a)において、撮像素子102の画像出力(センサ出力)は1フレームの垂直同期信号VDのパルス間隔の周期内(フレーム周期)で行われ、そのセンサ出力の画像データを基にテンプレートマッチング用画像が生成される。テンプレートマッチング用画像の生成は、ラスタスキャン順のセンサ出力に合わせて開始され、画像生成処理に要する時間分だけ遅延したタイミングで完了する。テンプレートマッチング処理はテンプレートマッチング用画像を用いて行われ、図5(a)中の期間T1〜T8の各期間は、それぞれが追跡先特徴点に対応したテンプレートマッチングの処理に要する時間を表している。なお、テンプレートマッチング処理に要する時間は、テンプレート領域のサイズに応じて増減する。   FIG. 5A is a diagram illustrating a timing chart from the image output of the image sensor 102 (hereinafter referred to as sensor output) to the end of the template matching process. FIG. 5B illustrates a feature extraction grid 1010, a peripheral grid 1011, a search area 1005, a template area 1003, and a tracking destination feature point 1002 similar to those in FIG. FIG. 5B also shows an arrow representing a so-called raster scan 1020 and the first (first) template position 1101 at which the template matching process can be started. In FIG. 5A, the image output (sensor output) of the image sensor 102 is performed within the cycle (frame cycle) of the pulse interval of one frame of the vertical synchronization signal VD, and template matching is performed based on the image data of the sensor output. A business image is generated. Generation of the template matching image is started in accordance with the sensor output in the raster scan order, and is completed at a timing delayed by the time required for the image generation processing. The template matching process is performed using a template matching image. Each period T1 to T8 in FIG. 5A represents the time required for the template matching process corresponding to the tracking destination feature point. . Note that the time required for the template matching process increases or decreases according to the size of the template area.

図5(b)の例では、特徴抽出グリッド1010として8個のみを図示し、それら各特徴抽出グリッド1010にそれぞれ1個の追跡先特徴点1002が得られている。このため、図5(a)には、それら8個の追跡先特徴点1002のそれぞれに対するテンプレートマッチング処理に要する時間として、8個の期間T1〜T8が表されている。また、1フレームの期間におけるテンプレートマッチング処理は、図5(b)に示すように、ラスタスキャン順で最初(一番目)となる追跡先特徴点1002に対して設定されたテンプレート位置1101から開始される。そして、テンプレートマッチング処理は、8個の追跡先特徴点1002にそれぞれ対応した各期間T1〜T8の全ての処理が終了した時点で完了する。   In the example of FIG. 5B, only eight feature extraction grids 1010 are illustrated, and one tracking destination feature point 1002 is obtained for each of the feature extraction grids 1010. For this reason, in FIG. 5A, eight periods T1 to T8 are shown as the time required for the template matching process for each of the eight tracking destination feature points 1002. Further, as shown in FIG. 5B, the template matching process in the period of one frame is started from the template position 1101 set for the tracking destination feature point 1002 that is the first (first) in the raster scan order. The The template matching process is completed when all the processes in the periods T1 to T8 corresponding to the eight tracking destination feature points 1002 are completed.

ところで、前述のような特徴点追跡処理が行われた場合、複数の追跡先特徴点が、フレームの画像範囲内の例えば一部の領域に偏在してしまうようになることがある。図4(b)は、追跡先特徴点がフレームの画像範囲内の下部領域に集中するように偏在した例を示している。図4(b)に示すように、追跡先特徴点がフレームの画像範囲内の下部領域に集中するように偏在する状態は、例えばデジタルカメラの撮影時にカメラがチルティングされた場合などに生ずることが多い。なお、図4(b)には、図4(a)と同様の特徴抽出グリッド1010、周辺グリッド1011、サーチ領域1005、テンプレート領域1003、追跡先特徴点1002も示している。   By the way, when the feature point tracking process as described above is performed, a plurality of tracking destination feature points may be unevenly distributed in, for example, a partial region within the image range of the frame. FIG. 4B shows an example in which the tracking destination feature points are unevenly distributed so as to be concentrated in the lower region within the image range of the frame. As shown in FIG. 4B, the state in which the tracking target feature points are unevenly distributed so as to be concentrated in the lower region in the image range of the frame occurs, for example, when the camera is tilted during photographing with a digital camera. There are many. 4B also shows a feature extraction grid 1010, a peripheral grid 1011, a search area 1005, a template area 1003, and a tracking destination feature point 1002 similar to those in FIG.

図6(a)は、図5(a)と同様、センサ出力からテンプレートマッチング処理の終了までのタイミングチャートを示した図であり、図4(b)のように下部領域に多数の追跡先特徴点が集中した場合の処理タイミングを表している。図6(b)は、前述の図5(b)と同様の特徴抽出グリッド1010、周辺グリッド1011、サーチ領域1005、テンプレート領域1003、追跡先特徴点1002を表した図である。また、図6(b)には、図5(b)と同様に、ラスタスキャン1020を表す矢印と、テンプレートマッチング処理を開始できる最初(一番初め)のテンプレート位置1201も示されている。図6(b)の例では、8個の追跡先特徴点1002が、フレームの画像範囲内の下部領域に集中するように偏在している。そして、図6(a)の8個の期間T1〜T8は、図6(b)の8個の追跡先特徴点1002のそれぞれに対するテンプレートマッチング処理に要する時間を表している。   FIG. 6A is a diagram showing a timing chart from sensor output to the end of the template matching process, as in FIG. 5A, and a large number of tracking destination features in the lower area as shown in FIG. 4B. The processing timing when points are concentrated is shown. FIG. 6B is a diagram showing a feature extraction grid 1010, a peripheral grid 1011, a search region 1005, a template region 1003, and a tracking destination feature point 1002, which are the same as those in FIG. FIG. 6B also shows an arrow representing the raster scan 1020 and the first (first) template position 1201 at which the template matching process can be started, as in FIG. 5B. In the example of FIG. 6B, the eight tracking destination feature points 1002 are unevenly distributed so as to be concentrated in the lower region within the image range of the frame. Then, the eight periods T1 to T8 in FIG. 6A represent the time required for the template matching process for each of the eight tracking destination feature points 1002 in FIG.

テンプレートマッチング処理は、前述のようにセンサ出力のラスタスキャン順に合わせて行われるため、フレームの画像範囲内の下部領域は、ラスタスキャン順では終盤に処理が行われる領域となる。図4(b)や図6(b)のように下部領域に多数の追跡先特徴点が集中した場合、図6(a)に示すように、垂直同期信号VDのパルス間隔の期間内に、期間T1〜T8の全てのテンプレートマッチング処理を完了できなくなることがある。つまり、下部領域に追跡先特徴点が集中した場合、図6(b)に示すように、テンプレートマッチング処理が開始される最初のテンプレート位置1201は、ラスタスキャン順の終盤に相当する位置になる。そして、ラスタスキャン順の終盤に相当するテンプレート位置1201からテンプレートマッチング処理が始まると、図6(a)に示すように、期間T1〜T8の処理の開始までの期間1200が長くなる。このため、期間T1〜T8の処理が完了する前に、垂直同期信号VDの次のパルスが来てしまって処理を完了できなくなることがある。   Since the template matching process is performed in accordance with the raster scan order of the sensor output as described above, the lower area in the image range of the frame is an area that is processed at the end in the raster scan order. When many tracking destination feature points are concentrated in the lower region as shown in FIG. 4B and FIG. 6B, as shown in FIG. 6A, within the period of the pulse interval of the vertical synchronization signal VD, It may become impossible to complete all template matching processes in the periods T1 to T8. That is, when the tracking destination feature points are concentrated in the lower area, as shown in FIG. 6B, the first template position 1201 at which the template matching process is started is a position corresponding to the last stage in the raster scan order. Then, when the template matching process starts from the template position 1201 corresponding to the last stage of the raster scan order, as shown in FIG. 6A, the period 1200 until the start of the processes in the periods T1 to T8 becomes longer. For this reason, before the processing in the periods T1 to T8 is completed, the next pulse of the vertical synchronization signal VD may come and the processing may not be completed.

ここで、本実施形態のデジタルカメラのように、撮影時の手ぶれ補正に動きベクトルを用いる場合、1フレーム期間内にテンプレートマッチング処理を完了させて動きベクトルを検出し、その動きベクトルを次のフレームの処理にフィードバックする必要がある。
前述した図5(a)及び図5(b)の例の場合、1フレーム分の周期内で期間T1〜T8の全ての処理が終了し、テンプレートマッチング処理が完了している。このため、動きベクトルを次のフレームの処理にフィードバックでき、その結果、デジタルカメラの撮影時の手ぶれ補正も正しく行える。
これに対し、図6(a)及び図6(b)の例のように、1フレームの期間内でテンプレートマッチング処理を完了できない場合、正しい動きベクトルを次のフレームの処理にフィードバックすることができなくなる。この場合、ベクトル検出性能が低下し、その結果、デジタルカメラ等の撮影時の手ぶれ補正性能も低下してしまうことになる。
Here, when a motion vector is used for camera shake correction at the time of shooting as in the digital camera of the present embodiment, the motion vector is detected by completing the template matching process within one frame period, and the motion vector is detected as the next frame. It is necessary to feed back to the process.
In the example of FIGS. 5A and 5B described above, all the processes in the periods T1 to T8 are completed within one frame period, and the template matching process is completed. For this reason, the motion vector can be fed back to the processing of the next frame, and as a result, camera shake correction at the time of photographing with the digital camera can be performed correctly.
On the other hand, if the template matching process cannot be completed within the period of one frame as in the examples of FIGS. 6A and 6B, the correct motion vector can be fed back to the process of the next frame. Disappear. In this case, the vector detection performance is lowered, and as a result, the camera shake correction performance at the time of shooting of a digital camera or the like is also lowered.

そこで、第1の実施形態に係るベクトル検出部では、フレームの画像範囲内で追跡先特徴点が偏在する場合、所定領域内の追跡先特徴点の数に応じた追跡先特徴点の破棄補填処理を行うことにより、1フレーム期間などの所定期間内に処理を完了させるようにする。   Therefore, in the vector detection unit according to the first embodiment, when tracking destination feature points are unevenly distributed within the image range of the frame, tracking destination feature point discard compensation processing according to the number of tracking destination feature points in the predetermined region is performed. As a result, the processing is completed within a predetermined period such as one frame period.

図7は、本実施形態に係る図2に示したベクトル検出部及び関連した構成における処理の流れを示すフローチャートである。なお、図7のフローチャートの処理は、ソフトウェア構成のみ、或いはハードウェア構成のみにより実行されてもよいし、一部がソフトウェア構成で残りがハードウェア構成により実現されてもよい。ソフトウェア構成により処理が実行される場合、図7のフローチャートの処理は、例えばROM109に記憶されているプログラムをCPU112が実行することにより実現されてもよい。本実施形態に係るプログラムは、ROM109に予め用意されていてもよく、また着脱可能な半導体メモリ等から読み出されたり、不図示のインターネット等のネットワークからダウンロードされたりしてもよい。また以下の説明では、図7の各処理のステップS401〜ステップS409をS401〜S409と略記する。これらのことは後述する他のフローチャートにおいても同様とする。   FIG. 7 is a flowchart showing a flow of processing in the vector detection unit shown in FIG. 2 and the related configuration according to the present embodiment. Note that the processing of the flowchart of FIG. 7 may be executed only by a software configuration or only by a hardware configuration, or a part may be realized by a software configuration and the rest by a hardware configuration. When the process is executed by the software configuration, the process of the flowchart in FIG. 7 may be realized by the CPU 112 executing a program stored in the ROM 109, for example. The program according to the present embodiment may be prepared in advance in the ROM 109, read from a detachable semiconductor memory, or downloaded from a network such as the Internet (not shown). In the following description, steps S401 to S409 of each process in FIG. 7 are abbreviated as S401 to S409. The same applies to other flowcharts described later.

以下、図7のフローチャートを参照しながら、図2に示したベクトル検出部及び関連した構成により行われる処理の概要を説明する。
先ず、S401の処理として、図1のデータ転送部105が具備している第1のRDDMAC221は、バス115を介して、DRAM107からベクトル検出処理の対象となる現フレームの画像データ241を読み出す。なお、以下の説明では、データ転送部105から転送されるデータがバス115を介することの記載は省略する。このとき読み出されるデータは前述したグリッド単位のデータとなされ、図3に示した特徴抽出グリッド302や周辺グリッド301毎にデータの読み出しが行われる。なお、画像データ241には、画像処理部104による他の各種画像処理が実施されているとする。第1のRDDMAC221によりグリッド単位で読み出された画像データ241は、マッチング用画像生成部201及び新規特徴点算出部202に送られる。また、第1のRDDMAC221は、読み出したグリッドの座標位置を示すグリッド座標情報252を、後述する追跡先特徴点決定部205に出力する。S401の後、ベクトル検出部の処理は、S402に遷移する。
Hereinafter, an outline of processing performed by the vector detection unit shown in FIG. 2 and related configurations will be described with reference to the flowchart of FIG.
First, as the processing of S401, the first RDDMAC 221 provided in the data transfer unit 105 in FIG. 1 reads out the image data 241 of the current frame that is the target of vector detection processing from the DRAM 107 via the bus 115. In the following description, the description that the data transferred from the data transfer unit 105 passes through the bus 115 is omitted. The data read at this time is data in units of grids as described above, and data is read for each of the feature extraction grid 302 and the peripheral grid 301 shown in FIG. It is assumed that the image data 241 is subjected to various other image processing by the image processing unit 104. The image data 241 read out in grid units by the first RDDMAC 221 is sent to the matching image generation unit 201 and the new feature point calculation unit 202. Also, the first RDDMAC 221 outputs grid coordinate information 252 indicating the read grid coordinate position to the tracking destination feature point determination unit 205 described later. After S401, the processing of the vector detection unit transitions to S402.

S402の処理として、マッチング用画像生成部201は、第1のRDDMAC221によりグリッド単位で読み出された画像データ241から、ベクトル検出時のテンプレートマッチングに使用するテンプレートマッチング用画像を生成する。マッチング用画像生成部201は、例えばバンドパスフィルタ回路を有し、画像データ241から、テンプレートマッチング処理に不要な画像信号の高周波成分と低周波成分とをカットする。そして、マッチング用画像生成部201は、現フレームについて生成したテンプレートマッチング用画像を、データ転送部105が具備するWRDMAC231に出力する。S402の後、ベクトル検出部の処理は、S403に遷移する。   As processing of S402, the matching image generation unit 201 generates a template matching image used for template matching at the time of vector detection from the image data 241 read out in grid units by the first RDDMAC 221. The matching image generation unit 201 includes, for example, a band-pass filter circuit, and cuts high-frequency components and low-frequency components of image signals that are unnecessary for template matching processing from the image data 241. Then, the matching image generation unit 201 outputs the template matching image generated for the current frame to the WRDMAC 231 provided in the data transfer unit 105. After S402, the processing of the vector detection unit transitions to S403.

S403の処理として、WRDMAC231は、現フレームで生成されたテンプレートマッチング用画像データ242を、DRAM107に対して書き込む処理を行う。なお、このときのDRAM107には、前フレームで生成されたテンプレートマッチング用画像データ243も格納されているとする。S403の後、ベクトル検出部の処理は、S405に遷移する。   As the process of S403, the WRDMAC 231 performs a process of writing the template matching image data 242 generated in the current frame into the DRAM 107. It is assumed that the template matching image data 243 generated in the previous frame is also stored in the DRAM 107 at this time. After S403, the processing of the vector detection unit transitions to S405.

また、前述したS402、S403の処理と並列に、S404の処理として、新規特徴点算出部202は、現フレームの画像から特徴抽出グリッド毎に新規特徴点を算出する。新規特徴点とは、前述した動きベクトル値の加算により算出される追跡先特徴点とは異なり、現フレームの画像から特徴抽出グリッド毎に一つずつ新規に抽出される特徴点である。S404の後、ベクトル検出部の処理は、S405に遷移する。
図8は、新規特徴点算出部202の概略的な構成例を示すブロック図である。新規特徴点算出部202は、特徴フィルタ部501、特徴評価部502、特徴点決定部503を有する。
In parallel with the processing of S402 and S403 described above, as the processing of S404, the new feature point calculation unit 202 calculates a new feature point for each feature extraction grid from the image of the current frame. A new feature point is a feature point newly extracted for each feature extraction grid from the image of the current frame, unlike the tracking destination feature point calculated by adding the motion vector values described above. After S404, the processing of the vector detection unit transitions to S405.
FIG. 8 is a block diagram illustrating a schematic configuration example of the new feature point calculation unit 202. The new feature point calculation unit 202 includes a feature filter unit 501, a feature evaluation unit 502, and a feature point determination unit 503.

特徴フィルタ部501は、バンドパスフィルタ、水平微分フィルタ、垂直微分フィルタ、平滑化フィルタなど、複数のフィルタを有して構成される。特徴フィルタ部501は、バンドパスフィルタにより画像データ241から不要な高周波成分と低周波成分をカットし、さらに、そのバンドパスフィルタ処理後の画像データに対し、水平方向の微分フィルタ処理と、垂直方向の微分フィルタ処理とを施す。そして、特徴フィルタ部501は、水平方向の微分フィルタ処理を施した画像データと、垂直方向の微分フィルタ処理を施した画像データとの、各々に対して平滑化フィルタ処理を施し、特徴評価部502に出力する。   The feature filter unit 501 includes a plurality of filters such as a band pass filter, a horizontal differential filter, a vertical differential filter, and a smoothing filter. The feature filter unit 501 cuts unnecessary high-frequency components and low-frequency components from the image data 241 by using a bandpass filter, and further performs horizontal differential filter processing and vertical direction processing on the image data after the bandpass filter processing. The differential filter processing is performed. The feature filter unit 501 performs a smoothing filter process on each of the image data that has been subjected to the differential filter process in the horizontal direction and the image data that has been subjected to the differential filter process in the vertical direction, and the feature evaluation unit 502 Output to.

特徴評価部502は、特徴フィルタ部501によるフィルタ処理後のグリッド単位の画像データから特徴値を算出する。具体的には、特徴評価部502は、画素ごとに、所定の特徴評価式を用いた演算を行い、二つのエッジの交点や曲率が極大である曲線状の点など、画素の周辺の微分値が多方向に大きい点を、特徴点として算出する。   The feature evaluation unit 502 calculates a feature value from the image data in units of grids after the filter processing by the feature filter unit 501. Specifically, the feature evaluation unit 502 performs a calculation using a predetermined feature evaluation formula for each pixel, and a differential value around the pixel such as an intersection of two edges or a curved point having a maximum curvature. A point where is large in multiple directions is calculated as a feature point.

以下、例えばいわゆるShi and Tomasiの手法を例に挙げて、本実施形態の特徴評価部502における特徴値の算出例について説明する。
特徴評価部502は、先ず、前述した水平方向の微分フィルタ処理が施されたデータと垂直方向の微分フィルタ処理が施されたデータとを用い、式(1)に示す演算式により、自己相関行列Hを作成する。式(1)は、Ixが水平方向の微分フィルタ処理を施した結果を表し、Iyが垂直方向の微分フィルタを施した結果を表しており、ガウシアンフィルタGを畳み込む演算式となされている。

Figure 2019020839
Hereinafter, for example, a so-called Shi and Tomasi technique will be described as an example, and a feature value calculation example in the feature evaluation unit 502 of this embodiment will be described.
First, the feature evaluation unit 502 uses the data subjected to the above-described horizontal differential filter processing and the data subjected to the vertical differential filter processing to calculate the autocorrelation matrix by the arithmetic expression shown in Expression (1). Create H. In Expression (1), Ix represents the result of applying the horizontal differential filter processing, and Iy represents the result of applying the vertical differential filter, which is an arithmetic expression for convolving the Gaussian filter G.
Figure 2019020839

そして、特徴評価部502は、式(2)に示すShi and Tomasiの特徴評価式を用いて特徴値を算出する。式(2)は、式(1)の自己相関行列Hの固有値(λ1,λ2)のうち、小さい方の固有値を特徴値とすることを表している。
Shi and Tomasi=min(λ1,λ2) 式(2)
このようにして特徴評価部502にて画素ごとに算出された特徴値は、特徴点決定部503に送られる。
Then, the feature evaluation unit 502 calculates the feature value using the Shi and Tomasi feature evaluation formula shown in Formula (2). Expression (2) represents that the smaller eigenvalue of the eigenvalues (λ1, λ2) of the autocorrelation matrix H of Expression (1) is used as the feature value.
Shi and Tomasi = min (λ1, λ2) Equation (2)
The feature value calculated for each pixel by the feature evaluation unit 502 in this way is sent to the feature point determination unit 503.

特徴点決定部503は、特徴評価部502にてグリッド内の各画素について算出された特徴値の中で最も大きい値を持つ画素を、そのグリッド内の特徴点として新規に決定する。本実施形態の場合、特徴点の情報は、グリッドの左上端を座標(0,0)とした相対座標(PX,PY)が用いられる。なお、特徴点の座標は、フレーム画像における座標により表現されてもよい。そして、特徴点決定部503により新規に決定された特徴点座標情報は、新規特徴点算出部202が具備している内部メモリに格納される。この内部メモリは、前フレームから取得された各特徴点座標情報と現フレームから取得された各特徴点座標情報とを格納できるだけの容量を有している。   The feature point determination unit 503 newly determines a pixel having the largest value among the feature values calculated for each pixel in the grid by the feature evaluation unit 502 as a feature point in the grid. In the case of the present embodiment, the feature point information uses relative coordinates (PX, PY) with the upper left corner of the grid as coordinates (0, 0). Note that the coordinates of the feature points may be expressed by coordinates in the frame image. The feature point coordinate information newly determined by the feature point determination unit 503 is stored in an internal memory provided in the new feature point calculation unit 202. This internal memory has a capacity sufficient to store each feature point coordinate information acquired from the previous frame and each feature point coordinate information acquired from the current frame.

新規特徴点算出部202は、マッチング処理部203にて対応するグリッドのテンプレートマッチング処理が開始される際に、前フレームと現フレームとで夫々算出した特徴点座標情報251を、内部メモリから読み出して追跡先特徴点決定部205に出力する。
追跡先特徴点決定部205は、その追跡先特徴点座標情報257を、データ転送部105が具備している第2のRDDMAC222に出力する。
The new feature point calculation unit 202 reads out the feature point coordinate information 251 calculated for the previous frame and the current frame from the internal memory when the matching template 203 starts the corresponding grid template matching process. The result is output to the tracking destination feature point determination unit 205.
The tracking destination feature point determination unit 205 outputs the tracking destination feature point coordinate information 257 to the second RDDMAC 222 included in the data transfer unit 105.

図7のフローチャートと図2に説明を戻す。
S405の処理として、第2のRDDMAC222は、DRAM107内のテンプレートマッチング用画像データ242及び243から、追跡先特徴点座標情報257を中心とし、それぞれ予め設定されたサイズの矩形領域のデータを読み出す。すなわち、現フレームで生成されたテンプレートマッチング用画像データ242からは、図3のサーチ領域305のデータが、一方、前フレームで生成されたテンプレートマッチング用画像データ243からは、テンプレート領域304のデータが読み出される。そして、それら読み出されたサーチ領域画像データ253とテンプレート領域画像データ254は、マッチング処理部203へ送られる。ただし、最初のテンプレートマッチング処理では、前フレームから追跡先特徴点座標を算出することができないため、全て現フレームで算出された新規特徴点座標を用いた処理が実施される。S405の後、ベクトル検出部の処理は、S406に遷移する。
Returning to the flowchart of FIG. 7 and FIG.
As the processing of S405, the second RDDMAC 222 reads out data of a rectangular area having a preset size centering on the tracking destination feature point coordinate information 257 from the template matching image data 242 and 243 in the DRAM 107. That is, from the template matching image data 242 generated in the current frame, the data in the search area 305 in FIG. 3 is stored, while from the template matching image data 243 generated in the previous frame, the data in the template area 304 is stored. Read out. Then, the read search area image data 253 and template area image data 254 are sent to the matching processing unit 203. However, in the first template matching process, since the tracking destination feature point coordinates cannot be calculated from the previous frame, processing using the new feature point coordinates calculated in the current frame is performed. After S405, the vector detection unit transitions to S406.

S406の処理として、マッチング処理部203は、入力されたサーチ領域画像データ253、テンプレート領域画像データ254を用いて、相関値を算出し、その相関値を基にベクトル値を算出する。S406の後、ベクトル検出部の処理は、S407に遷移する。   As processing of S406, the matching processing unit 203 calculates a correlation value using the input search area image data 253 and template area image data 254, and calculates a vector value based on the correlation value. After S406, the process of the vector detection unit transitions to S407.

本実施形態では、相関値の算出方法として、差分絶対値和(Sum of Absolute Difference、以下SADと略す。)を使用する。式(3)はSADの算出式である。

Figure 2019020839
In the present embodiment, the sum of absolute difference (hereinafter abbreviated as SAD) is used as a correlation value calculation method. Equation (3) is a formula for calculating SAD.
Figure 2019020839

式(3)において、f(i,j)はテンプレート領域画像データ254における座標(i,j)の画素値を表しており、g(i,j)はサーチ領域画像データ253において相関値算出の対象領域(以下、相関値算出領域とする。)内の各画素値を表している。相関値算出領域は、テンプレート領域画像データ254における領域と同じ大きさである。そして、マッチング処理部203は、それら領域の各画素値f(i,j)及びg(i,j)について差の絶対値を計算し、それらの総和を求めることで相関値S_SADを算出する。ここで、相関値S_SADの値が小さいほど両領域間の輝度値の差分が小さい、つまりテンプレート領域画像データ254と相関値算出領域内のテクスチャとが類似していることになる。なお、本実施形態では、相関値の一例としてSADを使用しているが、これに限るものではなく、例えば、差分二乗和(SSD)や正規化相互相関(NCC)等の他の相関値が用いられてもよい。   In Expression (3), f (i, j) represents the pixel value of the coordinates (i, j) in the template area image data 254, and g (i, j) represents the correlation value calculation in the search area image data 253. Each pixel value in the target area (hereinafter referred to as a correlation value calculation area) is represented. The correlation value calculation area is the same size as the area in the template area image data 254. Then, the matching processing unit 203 calculates the absolute value of the difference for each pixel value f (i, j) and g (i, j) in those regions, and calculates the correlation value S_SAD by obtaining the sum of them. Here, the smaller the value of correlation value S_SAD, the smaller the difference in luminance value between the two regions, that is, the template region image data 254 and the texture in the correlation value calculation region are similar. In the present embodiment, SAD is used as an example of the correlation value, but the present invention is not limited to this. For example, other correlation values such as sum of squares of differences (SSD) and normalized cross-correlation (NCC) may be used. May be used.

そして、マッチング処理部203は、相関値の最小値の位置を、グリッドの動きベクトル値として求める。マッチング処理部203は、前述のようにして算出したベクトル値及び相関値情報255を、精度判定部204に出力する。   Then, the matching processing unit 203 obtains the position of the minimum value of the correlation value as the grid motion vector value. The matching processing unit 203 outputs the vector value and the correlation value information 255 calculated as described above to the accuracy determining unit 204.

S407の処理として、精度判定部204は、S406の処理で算出されたベクトル値及び相関値情報255のうち、相関値を用いて、相関値の最大値、最小値、平均値、極小値を求める。そして、精度判定部204は、それら相関値の最大値、最小値、平均値、極小値を用いて、以下に説明するような低コントラスト判定、画素値の最大値突出判定、繰り返しパターン判定の処理を行う。S407の後、ベクトル検出部の処理は、S408に遷移する。   As the process of S407, the accuracy determination unit 204 obtains the maximum value, the minimum value, the average value, and the minimum value of the correlation values using the correlation value among the vector values and the correlation value information 255 calculated in the process of S406. . Then, the accuracy determination unit 204 uses the maximum value, the minimum value, the average value, and the minimum value of the correlation values to perform low contrast determination, pixel value maximum value protrusion determination, and repeated pattern determination processing as described below. I do. After S407, the processing of the vector detection unit transitions to S408.

図9(a)〜図9(d)は、相関値の最大値、最小値、平均値、極小値と、それらを用いた判定例との関係説明に用いるグラフである。ただし、本実施形態の場合、相関値が小さいほど類似度が高いことになるため、図9(a)〜図9(d)において、画素値の最大値は相関値では最小値、画素値の最小値は相関値では最大値、画素値の極大値は相関値では極小値を表す。
図9(a)は、それぞれの判定結果が良好な結果となる例を示している。
FIG. 9A to FIG. 9D are graphs used for explaining the relationship between the maximum value, the minimum value, the average value, and the minimum value of the correlation values and the determination example using them. However, in this embodiment, the smaller the correlation value is, the higher the similarity is. Therefore, in FIGS. 9A to 9D, the maximum value of the pixel value is the minimum value of the correlation value, and the pixel value of FIG. The minimum value represents the maximum value in the correlation value, and the maximum value of the pixel value represents the minimum value in the correlation value.
FIG. 9A shows an example in which each determination result is a good result.

図9(b)は、低コントラスト判定において低コントラストと判定される例を示している。低コントラスト判定とは、相関値算出領域内が低コントラストであるか否かを判定する処理である。本実施形態における低コントラスト判定では、相関値算出領域内の相関値の最大値と最小値との差分が、予め設定されている所定の閾値よりも小さい場合に、相関値算出領域内は低コントラストであると判定される。図9(b)の場合、図9(a)と比べて、画素値の最大値と最小値との差が少なく、相関値算出領域内の相関値の最大値と最小値の差分も所定の閾値より小さいとする。したがって、図9(b)の場合、精度判定部204は、相関値算出領域内の相関値の最大値と最小値の差分が所定の閾値よりも小さいため、相関値算出領域内は低コントラストであると判定する。   FIG. 9B shows an example in which low contrast is determined in low contrast determination. The low contrast determination is a process for determining whether or not the correlation value calculation area has low contrast. In the low contrast determination in the present embodiment, when the difference between the maximum value and the minimum value of the correlation value in the correlation value calculation area is smaller than a predetermined threshold value, the correlation value calculation area has a low contrast. It is determined that In the case of FIG. 9B, the difference between the maximum value and the minimum value of the pixel value is small compared to FIG. 9A, and the difference between the maximum value and the minimum value of the correlation value in the correlation value calculation region is also a predetermined value. It is assumed that it is smaller than the threshold value. Therefore, in the case of FIG. 9B, the accuracy determination unit 204 has a low contrast in the correlation value calculation area because the difference between the maximum value and the minimum value of the correlation value in the correlation value calculation area is smaller than the predetermined threshold value. Judge that there is.

図9(c)は、画素値の最大値突出判定において低ピークと判定される例を示している。画素値の最大値突出判定とは、相関値算出領域内の相関値の最小値がどれだけ際立っているかを判定する処理である。本実施形態における画素値の最大値突出判定では、画素値の最大値と平均値との差分と、画素値の最大値と最小値との差分との除算結果の値が、予め設定されている所定の閾値よりも小さい場合に、相関値算出領域内は低ピークであると判定される。一方、除算結果の値が所定の閾値よりも大きい場合、相関値算出領域内は高ピークであると判定される。図9(c)の場合、図9(a)と比べて、画素値の最大値と平均値との差分と、画素値の最大値と最小値との差分との除算結果の値が小さく、閾値よりも小さいとする。したがって、図9(c)の場合、精度判定部204は、除算結果の値が所定の閾値より小さいため、相関値算出領域内は低ピークであると判定する。   FIG. 9C shows an example in which it is determined that the peak is low in the maximum value protrusion determination of the pixel value. The pixel value maximum value protrusion determination is a process for determining how much the minimum value of the correlation value in the correlation value calculation region stands out. In the maximum value protrusion determination of the pixel value in the present embodiment, the value of the division result of the difference between the maximum value and the average value of the pixel values and the difference between the maximum value and the minimum value of the pixel values is set in advance. When it is smaller than the predetermined threshold, it is determined that the correlation value calculation region has a low peak. On the other hand, when the value of the division result is larger than the predetermined threshold value, it is determined that the correlation value calculation area has a high peak. In the case of FIG. 9C, compared with FIG. 9A, the value of the division result between the difference between the maximum value and the average value of the pixel values and the difference between the maximum value and the minimum value of the pixel values is small. It is assumed that it is smaller than the threshold value. Therefore, in the case of FIG. 9C, the accuracy determination unit 204 determines that the correlation value calculation region has a low peak because the value of the division result is smaller than the predetermined threshold value.

図9(d)は、繰り返しパターン判定で繰り返しパターンと判定される例を示している。繰り返しパターン判定とは、画素値が繰り返し変動しているか否かを判定する処理である。本実施形態における繰り返しパターン判定では、相関値算出領域内の画素値の最大値と極大値との差分が、予め設定されている所定の閾値よりも小さい場合に、繰り返しパターンであると判定される。図9(d)の場合、図9(a)と比べて、画素値の最大値と極大値との差分が小さく、所定の閾値よりも小さいとする。したがって、図9(d)の場合、精度判定部204は、相関値算出領域内の画素値の最大値と極大値との差分が所定の閾値より小さいため、繰り返しパターンであると判定する。   FIG. 9D shows an example in which a repetitive pattern is determined as a repetitive pattern. The repetitive pattern determination is a process for determining whether or not the pixel value fluctuates repeatedly. In the repetitive pattern determination in the present embodiment, a repetitive pattern is determined when the difference between the maximum value and the maximum value of the pixel values in the correlation value calculation area is smaller than a predetermined threshold value set in advance. . In the case of FIG. 9D, it is assumed that the difference between the maximum value and the maximum value of the pixel values is smaller than that in FIG. Therefore, in the case of FIG. 9D, the accuracy determination unit 204 determines that the pattern is a repetitive pattern because the difference between the maximum value and the maximum value of the pixel values in the correlation value calculation region is smaller than the predetermined threshold value.

図7のフローチャートと図2に説明を戻す。
S408の処理として、精度判定部204は、前述した低コントラスト、低ピーク、繰り返しパターンの各判定情報及びベクトル情報256を、SRAM206に書き込む。これにより、SRAM206の格納領域244にはそれら各情報が格納される。S408の後、ベクトル検出部の処理は、S409に遷移する。
Returning to the flowchart of FIG. 7 and FIG.
As the processing of S408, the accuracy determination unit 204 writes the above-described determination information of low contrast, low peak, and repetitive pattern, and vector information 256 into the SRAM 206. As a result, each information is stored in the storage area 244 of the SRAM 206. After S408, the processing of the vector detection unit transitions to S409.

S409の処理として、追跡先特徴点決定部205は、次フレームのテンプレートマッチング処理に用いるための追跡先特徴点の算出を行う。
ここで、図10は、図2の追跡先特徴点決定部205の概略構成例を示すブロック図である。図10に示すように、追跡先特徴点決定部205は、カウント部701、カウント数比較部702、新規特徴点補填部703を有する。なお、図10には、追跡先特徴点決定部205における追跡先特徴点決定処理に関連した他の構成(新規特徴点算出部202、SRAM206、第2のRDDMAC222)も示されている。また、図11は、追跡先特徴点決定部205が処理する追跡先特徴点と新規特徴点の位置関係を示す図である。さらに、図12は、本実施形態に係る追跡先特徴点決定部205の処理のフローチャートである。図13は、本実施形態の画像処理装置における処理タイミングチャートを示す図である。
In step S409, the tracking destination feature point determination unit 205 calculates a tracking destination feature point to be used for template matching processing of the next frame.
Here, FIG. 10 is a block diagram illustrating a schematic configuration example of the tracking destination feature point determination unit 205 of FIG. As illustrated in FIG. 10, the tracking destination feature point determination unit 205 includes a count unit 701, a count number comparison unit 702, and a new feature point compensation unit 703. FIG. 10 also shows another configuration (new feature point calculation unit 202, SRAM 206, second RDDMAC 222) related to the tracking destination feature point determination process in the tracking destination feature point determination unit 205. FIG. 11 is a diagram showing the positional relationship between the tracking destination feature point and the new feature point processed by the tracking destination feature point determination unit 205. Further, FIG. 12 is a flowchart of processing of the tracking destination feature point determination unit 205 according to the present embodiment. FIG. 13 is a diagram illustrating a processing timing chart in the image processing apparatus according to the present embodiment.

以下、図10〜図13を参照しながら、追跡先特徴点決定部205における追跡先特徴点決定処理の概要を説明する。なお、図11のグリッド配置では、特徴抽出グリッドの個数が25となる例が示されている。したがって、新規特徴点算出部202では、グリッド数と同数の25個の新規特徴点座標と、それら各座標における特徴値とが算出される。同様にテンプレートマッチング処理では、各追跡先特徴点座標を中心として、グリッド数と同数の25個のベクトル値が算出されるとする。また、図11において、各特徴点901,902,903はそれぞれ追跡先特徴点を表しており、各特徴点901は後述するように追跡先特徴点として補填される新規特徴点を、各特徴点903は後述するように破棄される追跡先特徴点を表しているとする。   The outline of the tracking destination feature point determination process in the tracking destination feature point determination unit 205 will be described below with reference to FIGS. In the grid arrangement of FIG. 11, an example in which the number of feature extraction grids is 25 is shown. Accordingly, the new feature point calculation unit 202 calculates 25 new feature point coordinates, which are the same number as the number of grids, and feature values at these coordinates. Similarly, in the template matching process, it is assumed that 25 vector values equal to the number of grids are calculated around each tracking destination feature point coordinate. Also, in FIG. 11, each feature point 901, 902, 903 represents a tracking destination feature point, and each feature point 901 represents a new feature point to be compensated as a tracking destination feature point, as will be described later. Assume that reference numeral 903 denotes a tracking destination feature point that is discarded as will be described later.

先ず、図12のS901の処理として、追跡先特徴点決定部205は、SRAM206からベクトル値及び前述の判定情報258を取得する。追跡先特徴点決定部205は、取得したベクトル値を用いて現フレームの追跡先特徴点を算出し、更にその追跡先特徴点座標を中心としてテンプレートマッチング処理を行い算出したベクトル値を加算して、次フレームの追跡先特徴点の座標を算出する。図11に示したグリッド配置の例の場合、合計25個の追跡先特徴点座標が算出される。S901の後、追跡先特徴点決定部205の処理はS902に遷移する。   First, as the processing of S <b> 901 in FIG. 12, the tracking destination feature point determination unit 205 acquires a vector value and the above-described determination information 258 from the SRAM 206. The tracking destination feature point determination unit 205 calculates the tracking destination feature point of the current frame using the acquired vector value, and further performs template matching processing centered on the tracking destination feature point coordinates to add the calculated vector value. The coordinates of the tracking destination feature point of the next frame are calculated. In the example of the grid arrangement shown in FIG. 11, a total of 25 tracking destination feature point coordinates are calculated. After S901, the process of the tracking destination feature point determination unit 205 transitions to S902.

次に、S902の処理として、追跡先特徴点決定部205は、SRAM206から取得した前述の判定情報を基に、S901で算出された追跡先特徴点が、次フレームのテンプレートマッチング処理に使用可能な有効な追跡先特徴点であるか否かを判定する。追跡先特徴点決定部205は、低コントラスト判定で低コントラストと判定、又は、画素値の最大値突出判定で低ピークと判定、又は、繰り返しパターン判定で繰り返しパターンと判定されている場合、追跡先特徴点は有効でないと判定(NG判定)する。一方、追跡先特徴点決定部205は、低コントラスト、低ピーク、繰り返しパターンの何れでもない場合には、追跡先特徴点は有効であると判定(OK判定)する。そして、追跡先特徴点決定部205は、S902において、NG判定とした場合(NO)にはS904に処理を進め、一方、OK判定とした場合(YES)にはS903に処理を進める。   Next, as the processing of S902, the tracking destination feature point determination unit 205 can use the tracking destination feature point calculated in S901 for template matching processing of the next frame based on the above-described determination information acquired from the SRAM 206. It is determined whether the feature point is a valid tracking destination feature point. The tracking destination feature point determination unit 205 determines that the low contrast is determined by the low contrast determination, the low peak is determined by the maximum value protrusion determination of the pixel value, or the repeated pattern determination determines that the pattern is a repeated pattern. It is determined that the feature point is not valid (NG determination). On the other hand, the tracking destination feature point determination unit 205 determines that the tracking destination feature point is valid (OK determination) when none of the low contrast, the low peak, and the repetitive pattern. Then, in S902, the tracking destination feature point determination unit 205 advances the process to S904 when the determination is NG (NO), and advances the process to S903 when the determination is OK (YES).

S903の処理として、追跡先特徴点決定部205は、S901で算出された追跡先特徴点座標が、フレームの画像範囲内(画角内)であるか否か判定する。具体的には、追跡先特徴点決定部205は、追跡先特徴点座標を中心とするテンプレート領域が周辺グリッドの内側に収まっている場合にはOK判定とし、周辺グリッドの内側に収まっていない場合にはNG判定とする。そして、追跡先特徴点決定部205は、S903において、NG判定とした場合(NO)にはS904に処理を進め、一方、OK判定とした場合(YES)にはS905に処理を進める。   As the processing of S903, the tracking destination feature point determination unit 205 determines whether or not the tracking destination feature point coordinates calculated in S901 are within the image range (angle of view) of the frame. Specifically, the tracking destination feature point determination unit 205 makes an OK determination when the template region centered on the tracking destination feature point coordinates is within the peripheral grid, and when the template region is not within the peripheral grid. Is judged as NG. Then, in S903, the tracking destination feature point determination unit 205 advances the process to S904 if the determination is NG (NO), and advances the process to S905 if the determination is OK (YES).

S904に進むと、追跡先特徴点決定部205は、S902又はS903でNG判定された座標位置に該当する追跡先特徴点座標を削除する。そして、追跡先特徴点決定部205は、削除された追跡先特徴点座標を、現フレームにおいて一番初めに新規特徴点が算出された位置の特徴点抽出グリッドの該当位置で算出された新規特徴点座標により置き換える処理を行う。S904の後、追跡先特徴点決定部205の処理は、ステップS905に遷移する。   When the processing proceeds to S904, the tracking destination feature point determination unit 205 deletes the tracking destination feature point coordinates corresponding to the coordinate position determined as NG in S902 or S903. Then, the tracking destination feature point determination unit 205 uses the new feature calculated at the corresponding position of the feature point extraction grid at the position where the new feature point is calculated first in the current frame as the tracking destination feature point coordinates. Performs replacement with point coordinates. After S904, the process of the tracking destination feature point determination unit 205 transitions to step S905.

S905に進むと、追跡先特徴点決定部205は、特徴抽出グリッド数分の全ての追跡先特徴点座標が算出されたか否か判定する。S905において、追跡先特徴点決定部205は、全ての追跡先特徴点座標が算出されたと判定(YES)した場合にはS906に処理を進める。一方、追跡先特徴点決定部205は、S905において、全ての追跡先特徴点座標が算出されていないと判定(NO)した場合にはS901に処理を戻して前述の処理を行う。S901からS905までの処理は、S905において全ての追跡先特徴点座標が算出されたと判定(YES)されるまで反復される。図11の例の場合、25個の追跡先特徴点座標の算出処理が行われるため、S901から905までの処理は25回反復されることになる。   In step S905, the tracking destination feature point determination unit 205 determines whether all tracking destination feature point coordinates for the number of feature extraction grids have been calculated. If the tracking destination feature point determination unit 205 determines in step S905 that all the tracking destination feature point coordinates have been calculated (YES), the processing proceeds to step S906. On the other hand, if the tracking destination feature point determination unit 205 determines in S905 that all the tracking destination feature point coordinates have not been calculated (NO), the process returns to S901 and the above-described processing is performed. The processing from S901 to S905 is repeated until it is determined (YES) that all the tracking destination feature point coordinates have been calculated in S905. In the case of the example in FIG. 11, since the calculation processing of 25 tracking destination feature point coordinates is performed, the processing from S901 to 905 is repeated 25 times.

次に、S906に進むと、追跡先特徴点決定部205が具備するカウント部701は、所定の領域区分内に追跡先特徴点座標が何個あるかを計数する。本実施形態の場合、図11の各特徴抽出グリッド群が、図中の破線957よりも下側の領域区分と、図中の破線954よりも上側の領域区分とに区分けされる。そして、カウント部701は、所定の領域区分として、破線957より下側の領域区分(以下、計数領域区分とする。)内にある追跡先特徴点座標の数をカウントする。すなわち、破線957より下側の計数領域区分は、ラスタスキャン順で終盤に処理が行われる領域であり、この領域内に多数の追跡先特徴点が集中した場合、1フレーム期間内にテンプレートマッチング処理を完了できなくなる可能性のある領域である。図11の例の場合、計数領域区分の追跡先特徴点座標数は、合計17個となっている。後述するように、これら17個の追跡先特徴点は、後に破棄対象となる追跡先特徴点903と、破棄対象ではない追跡先特徴点902とに分けられる。なお、図11中の破線954より上側の領域区分の詳細については後述する。   Next, when proceeding to S906, the count unit 701 included in the tracking destination feature point determination unit 205 counts how many tracking destination feature point coordinates are in a predetermined area section. In the case of the present embodiment, each feature extraction grid group in FIG. 11 is divided into an area section below the broken line 957 in the figure and an area section above the broken line 954 in the figure. Then, the counting unit 701 counts the number of tracking destination feature point coordinates in the area section below the broken line 957 (hereinafter referred to as the counting area section) as the predetermined area section. That is, the counting area section below the broken line 957 is an area that is processed in the last stage in the raster scan order. When a large number of tracking destination feature points are concentrated in this area, the template matching process is performed within one frame period. It is an area that may not be able to be completed. In the example of FIG. 11, the total number of tracking destination feature point coordinates in the counting area section is 17. As will be described later, these 17 tracking destination feature points are divided into a tracking destination feature point 903 to be discarded later and a tracking destination feature point 902 that is not to be discarded. Details of the area section above the broken line 954 in FIG. 11 will be described later.

図13のタイミングチャートを用いて、追跡先特徴点決定部205における処理の詳細を説明する。図13の時刻1953〜1959は、図11の各々破線953〜959で示される各領域がDRAM107上に順に生成されるタイミングを表している。   Details of the processing in the tracking destination feature point determination unit 205 will be described with reference to the timing chart of FIG. Times 1953 to 1959 in FIG. 13 represent timings at which the areas indicated by broken lines 953 to 959 in FIG.

ここで、一つのテンプレート領域に対してテンプレートマッチング処理を実施するために必要な時間は、テンプレート領域のサイズにより一意に決まる。図13内の期間920内の各区切りで表される各期間は、それぞれが個々のテンプレートマッチング処理に要する処理期間を表している。前述した図11の例の場合、破線957より下側の計数領域区分にある追跡先特徴点座標数は合計17個であり、このためテンプレート領域としては17個が設定される。しがたって、図13の期間920の各区切りの数(処理期間数)は、それら17個のテンプレート領域に対するテンプレートマッチング処理数に相当する17個となっている。   Here, the time required to perform the template matching process for one template region is uniquely determined by the size of the template region. Each period represented by each break in the period 920 in FIG. 13 represents a processing period required for each template matching process. In the case of the above-described example of FIG. 11, the total number of tracking destination feature point coordinates in the counting area section below the broken line 957 is 17, and thus 17 template areas are set. Therefore, the number of divisions (the number of processing periods) in the period 920 in FIG. 13 is 17 corresponding to the number of template matching processes for the 17 template regions.

一方で、1フレーム分の全テンプレートマッチング処理は、垂直同期信号VDのパルス間隔の周期内(1フレーム期間内)、つまり次のフレームの処理が開始される前に完了させなければならない。図13のタイミング例の場合、次のフレームの処理が開始される前に処理を終了できるのは、期間920内の12処理期間分までとなる。すなわち、図13のタイミング例の場合、図11の破線957より下側の計数領域区分内の追跡先特徴点座標数が12個までであるならば次のフレームの処理開始前にテンプレートマッチング処理を完了することができる。しかしながら、図11の例の場合、追跡先特徴点座標数が17個であるため、図13の期間921に示すように、13個目以降の5個分の処理期間に相当するテンプレートマッチング処理については、次のフレームの処理開始前に完了させることができない。   On the other hand, the entire template matching process for one frame must be completed within the period of the pulse interval of the vertical synchronization signal VD (within one frame period), that is, before the processing of the next frame is started. In the case of the timing example in FIG. 13, the processing can be completed before the processing of the next frame is started up to 12 processing periods in the period 920. That is, in the case of the timing example in FIG. 13, if the number of tracking destination feature point coordinates in the counting area section below the broken line 957 in FIG. 11 is up to 12, the template matching process is performed before starting the process of the next frame. Can be completed. However, in the case of the example in FIG. 11, since the number of tracking destination feature point coordinates is 17, as shown in a period 921 in FIG. 13, the template matching process corresponding to the 13th and subsequent five processing periods is performed. Cannot be completed before processing of the next frame starts.

このため、本実施形態において、追跡先特徴点決定部205のカウント数比較部702は、S907の処理として、S906でカウントされた追跡先特徴点座標数(前述した計数領域区分内の追跡先特徴点座標数)が所定の設定数以下か否かを判定する。図11及び図13の例では、次フレームの処理開始前に処理可能な追跡先特徴点座標数は12個であるため、所定の設定数としては12が用いられる。そして、S907において、カウント数比較部702により追跡先特徴点座標数が設定数以下(12以下)であると判定(NO)された場合、追跡先特徴点決定部205は、図12のフローチャートの処理を終了する。一方、S907において、カウント数比較部702により追跡先特徴点座標数が設定数を超える(13以上)と判定(YES)された場合、追跡先特徴点決定部205の処理は、S908に遷移する。なお、図11及び図13の例の場合、追跡先特徴点座標数は17であり、設定数の12を超えるため、追跡先特徴点決定部205の処理はS908に進むことになる。   For this reason, in this embodiment, the count number comparison unit 702 of the tracking destination feature point determination unit 205 performs the processing of S907 as the number of tracking destination feature point coordinates counted in S906 (the tracking destination feature in the counting area section described above). It is determined whether the number of point coordinates is equal to or less than a predetermined set number. In the example of FIGS. 11 and 13, the number of tracking destination feature point coordinates that can be processed before the start of processing of the next frame is 12, and therefore, 12 is used as the predetermined set number. Then, in S907, when the count number comparison unit 702 determines (NO) that the number of coordinates of the tracking destination feature point is equal to or less than the set number (12 or less), the tracking destination feature point determination unit 205 displays the flowchart of FIG. End the process. On the other hand, in S907, when the count comparison unit 702 determines (YES) that the number of coordinates of the tracking destination feature point exceeds the set number (13 or more), the processing of the tracking destination feature point determination unit 205 transitions to S908. . In the case of the examples of FIGS. 11 and 13, the number of coordinates of the tracking destination feature point is 17, which exceeds the set number of 12, so that the processing of the tracking destination feature point determination unit 205 proceeds to S908.

S908に進むと、追跡先特徴点決定部205の新規特徴点補填部703は、追跡先特徴点の破棄と新規特徴点の補填とを行う破棄補填処理を実施する。図11及び図13の例の場合、新規特徴点補填部703は、計数領域区分内の各追跡先特徴点の中から、所定の設定数(12個)を越える個数(5個)の追跡先特徴点(追跡先特徴点903)を選定して破棄する。そして、新規特徴点補填部703は、新規特徴点算出部202にて算出された新規特徴点を、指定された領域に追跡先特徴点として補填する。図11の例の場合、新規特徴点補填部703は、図11中の破線954より上側である領域区分(以下、補填領域区分とする。)に、破棄された数に対応した5個の新規特徴点901を補填する。破線954より上側の補填領域区分は、ラスタスキャン順で初期に処理が行われる領域であり、この領域区分内に新規特徴点を補填したとしても、1フレーム期間内にテンプレートマッチング処理を完了できなくなることは無いと考えられる領域である。   In step S908, the new feature point compensation unit 703 of the tracking destination feature point determination unit 205 performs discarding compensation processing for discarding the tracking destination feature point and supplementing the new feature point. In the example of FIGS. 11 and 13, the new feature point compensation unit 703 has a number (5) of tracking destinations exceeding a predetermined set number (12) from each tracking destination feature point in the counting area section. A feature point (tracking destination feature point 903) is selected and discarded. Then, the new feature point compensation unit 703 compensates the new feature point calculated by the new feature point calculation unit 202 as a tracking destination feature point in the designated area. In the case of the example of FIG. 11, the new feature point compensation unit 703 includes five new feature points corresponding to the number discarded in the region segment above the broken line 954 in FIG. The feature point 901 is compensated. The compensation area segment above the broken line 954 is an area that is initially processed in the raster scan order. Even if a new feature point is supplemented in this area segment, the template matching process cannot be completed within one frame period. This is an area where there is no possibility.

このような破棄補填処理により追跡先特徴点として補填された5個の新規特徴点901の各特徴点座標に対するテンプレートマッチング処理に要する処理期間は、図13中の期間930で表すことができる。すなわち、前述した期間920の17処理期間分の処理は、1フレーム期間の前半部にて行われる5処理期間分の期間930と、1フレーム期間の後半部にて行われる残りの12処理期間分の期間931とに分散されることになる。したがって、本実施形態において、合計17個分の追跡先特徴点座標数に相当するテンプレート処理は、次のフレームの処理が開始される前に完了することになる。   A processing period required for the template matching process for each feature point coordinate of the five new feature points 901 compensated as tracking destination feature points by the discard compensation process can be represented by a period 930 in FIG. That is, the processing for 17 processing periods of the above-described period 920 is performed for the period 930 for 5 processing periods performed in the first half of one frame period and the remaining 12 processing periods performed in the second half of one frame period. The period 931 is distributed. Therefore, in the present embodiment, the template processing corresponding to the total number of 17 tracking destination feature point coordinates is completed before the processing of the next frame is started.

なお、図11中の破線957より下側の計数領域区分内の各追跡先特徴点のなかで、何れの追跡先特徴点を破棄対象にするか決定する場合、例えば、各追跡先特徴点の有する特徴値の小さいものから順に破棄対象として選定する手法を用いることができる。また、補填対象となる特徴点を決定する際には、例えば、図11中の破線954より上側の補填領域区分にある新規特徴点のなかで、特徴値の大きいものから順に補填対象として選定するような手法を用いることができる。   When determining which tracking destination feature points are to be discarded among the tracking destination feature points in the counting area section below the broken line 957 in FIG. 11, for example, It is possible to use a method of selecting the objects to be discarded in order from the smallest feature value. Further, when determining feature points to be compensated, for example, new feature points in the compensation area section above the broken line 954 in FIG. 11 are selected in order from the largest feature value. Such a technique can be used.

以上が、第1の実施形態におけるベクトル検出処理の流れである。本実施形態では、1フレーム分の処理を例に挙げて説明したが、前述した1フレーム分の処理は毎フレームに対して同様に行われ、毎フレームでベクトル値が算出される。   The above is the flow of the vector detection process in the first embodiment. In the present embodiment, processing for one frame has been described as an example, but the processing for one frame described above is performed in the same manner for each frame, and a vector value is calculated for each frame.

また、本実施形態において、前述した特徴点座標数をカウントする際の対象領域(計数領域区分)や前述の設定数は、画像処理装置の処理能力に応じて決めることができる。例えば、画像処理装置におけるテンプレートマッチング用画像の生成処理速度やテンプレートマッチングの処理速度を基に、画像処理装置が一定処理期間内に処理を完了できるように、計数領域区分や設定数を決めることができる。   In the present embodiment, the target area (counting area section) and the set number described above when counting the number of feature point coordinates described above can be determined according to the processing capability of the image processing apparatus. For example, based on the template matching image generation processing speed and the template matching processing speed in the image processing apparatus, the counting area division and the set number can be determined so that the image processing apparatus can complete the processing within a certain processing period. it can.

また本実施形態では、図11中の破線957より下側の計数領域区分において追跡先特徴点座標数をカウントして、1フレーム期間内に処理が完了するか否かを判定していたが、この例には限定されるものではない。例えば、追跡先特徴点決定部205は、図11の破線955から破線956まで、破線956から破線957まで、破線957から破線958までの3領域区分内の追跡先特徴点数をカウントして、それら領域区分ごとに設定数と比較してもよい。そして、追跡先特徴点決定部205は、それらカウントした各領域区間の追跡先特徴点数が設定数より大きい場合に、前述同様に追跡先特徴点の破棄補填処理を行うようにする。また、追跡先特徴点決定部205は、領域区分の数を増やして領域を細かく区分けして、1フレーム期間内におけるテンプレートマッチング処理をフレームの画像範囲内(画角内)で、より均一に分散させることようにしてもよい。これにより、より多くのテンプレートマッチング数や、より大きいテンプレートサイズでの処理が行われる場合であっても、1フレーム期間内に処理が完了させることが可能となる。   In the present embodiment, the number of tracking destination feature point coordinates is counted in the counting area section below the broken line 957 in FIG. 11 to determine whether or not the processing is completed within one frame period. It is not limited to this example. For example, the tracking destination feature point determination unit 205 counts the number of tracking destination feature points in the three region segments from the broken line 955 to the broken line 956, the broken line 956 to the broken line 957, and the broken line 957 to the broken line 958 in FIG. You may compare with a setting number for every area division. Then, when the number of tracking destination feature points in each area section counted is larger than the set number, the tracking destination feature point determination unit 205 performs the tracking destination feature point discard compensation process as described above. Further, the tracking destination feature point determination unit 205 divides the region finely by increasing the number of region divisions, and the template matching process within one frame period is more evenly distributed within the frame image range (within the angle of view). You may make it let it. As a result, even when processing is performed with a larger number of template matches or a larger template size, the processing can be completed within one frame period.

また本実施形態では、撮像素子102の読み出し順がラスタスキャン順である場合を例に挙げたため、特徴点座標数をカウントする計数領域区分がフレームの画像範囲(画角)の下側の領域区分となされたが、これには限定されない。例えば撮像素子102の読み出し順が左側から垂直方向に順に走査される場合、特徴点座標数をカウントする計数領域区分は、フレームの画像範囲内の右側の領域区分となされてもよい。同様に、撮像素子102の読み出し順が左側から垂直方向に順に走査される場合、新規特徴点を追跡先特徴点として補填する補填領域区分は、フレームの画像範囲内の左側の領域区分となされてもよい。すなわち、本実施形態においては、追跡先特徴点の破棄補填の際、動きベクトルの検出に使用される画像の生成が先に行われる領域区分が、補填領域区分として設定される。一方、本実施形態においては、追跡先特徴点の破棄補填の際、動きベクトルの検出で使用される画像の生成が補填領域区分よりも後に行われる領域区分が、計数領域区分として設定される。   In the present embodiment, the case where the reading order of the image sensor 102 is the raster scan order is taken as an example. Therefore, the counting area section for counting the number of feature point coordinates is the lower area section of the image range (view angle) of the frame. However, it is not limited to this. For example, when the reading order of the image sensor 102 is scanned sequentially from the left side in the vertical direction, the counting area section for counting the number of feature point coordinates may be the right area section in the image range of the frame. Similarly, when the reading order of the image sensor 102 is scanned sequentially from the left side in the vertical direction, the supplemental area segment that compensates for the new feature point as the tracking destination feature point is the left region segment in the image range of the frame. Also good. In other words, in this embodiment, when the tracking destination feature point is discarded and compensated, an area segment in which an image used to detect a motion vector is generated first is set as the compensation region segment. On the other hand, in the present embodiment, when the tracking destination feature point is discarded and compensated, an area segment in which generation of an image used for motion vector detection is performed after the compensation region segment is set as the count region segment.

第1の実施形態の画像処理装置は、特徴点追跡を行うベクトル検出において、フレームの画像範囲内で追跡先特徴点が偏在した場合、所定領域内の追跡先特徴点数をカウントして破棄補填処理を行うことにより、所定期間内に処理を完了させることができる。したがって、第1の実施形態の画像処理装置によれば、追跡先特徴点がフレームの画像範囲内で偏在した場合でも、ベクトル検出性能の低下を防止しつつ、ベクトル検出を高速化し、所定期間内に処理を完了させることが可能となる。   In the vector detection that performs feature point tracking, the image processing apparatus according to the first embodiment counts the number of tracking destination feature points in a predetermined area and discards compensation processing when the tracking destination feature points are unevenly distributed within the image range of the frame. By performing the above, the processing can be completed within a predetermined period. Therefore, according to the image processing apparatus of the first embodiment, even when the tracking destination feature points are unevenly distributed within the image range of the frame, the vector detection is speeded up while preventing a decrease in the vector detection performance, and within a predetermined period. It is possible to complete the processing.

<第2の実施形態>
以下、第2の実施形態について説明する。
第2の実施形態の画像処理装置が適用されるデジタルカメラの構成は、図1に示した第1の実施形態のデジタルカメラと同様であるため、その図示と説明は省略する。
第2の実施形態の画像処理装置は、抽出された特徴点を基に追跡する範囲を設定し、その設定された範囲内から追跡先特徴点を算出する。すなわち、第2の実施形態では、特徴点追跡を行うベクトル検出において特徴点の初期座標から追跡範囲を設定し、追跡範囲を超えた場合に追跡先特徴点の破棄補填処理を行うことで、1フレーム期間内など所定期間内に処理を完了させる。第2の実施形態における追跡範囲とは、特徴点の追跡が行われる範囲を表しており、追跡範囲を外れた追跡先特徴点は破棄される。
<Second Embodiment>
Hereinafter, the second embodiment will be described.
Since the configuration of the digital camera to which the image processing apparatus of the second embodiment is applied is the same as that of the digital camera of the first embodiment shown in FIG. 1, its illustration and description are omitted.
The image processing apparatus according to the second embodiment sets a tracking range based on the extracted feature points, and calculates a tracking destination feature point from the set range. That is, in the second embodiment, the tracking range is set from the initial coordinates of the feature point in the vector detection for tracking the feature point, and the tracking destination feature point is discarded and compensated when the tracking range is exceeded. The processing is completed within a predetermined period such as a frame period. The tracking range in the second embodiment represents a range in which feature points are tracked, and tracking destination feature points outside the tracking range are discarded.

図14は、第2の実施形態の画像処理部104に含まれるベクトル検出部の概略構成例を示すブロック図である。なお、図14において、第1の実施形態の図2に示した構成と同じ構成には同一の参照符号を付してそれらの説明は省略する。また、第2の実施形態のベクトル検出部における処理のフローチャートは、前述した第1の実施形態の図7のフローチャートと概ね同様であり、また前述の図8、図9についても第1の実施形態と同様であるためそれらの図示と説明は省略する。   FIG. 14 is a block diagram illustrating a schematic configuration example of a vector detection unit included in the image processing unit 104 according to the second embodiment. In FIG. 14, the same components as those shown in FIG. 2 of the first embodiment are denoted by the same reference numerals, and description thereof is omitted. Further, the flowchart of the process in the vector detection unit of the second embodiment is substantially the same as the flowchart of FIG. 7 of the first embodiment described above, and the first embodiment also relates to the aforementioned FIG. 8 and FIG. Since these are the same, their illustration and description are omitted.

第2の実施形態の場合、図7のS401において、第1のRDDMAC221は、DRAM107から読み出したグリッドの左上座標位置を示すグリッド座標情報252を、第2のRDDMAC222に出力する。
また、第2の実施形態のベクトル検出部の場合、図7のS409において、追跡先特徴点決定部205は、算出した追跡先特徴点の座標情報を、追跡先特徴点座標情報257として第2のRDDMAC222に出力するとともに、SRAM206へも出力する。
In the case of the second embodiment, the first RDDMAC 221 outputs the grid coordinate information 252 indicating the upper left coordinate position of the grid read from the DRAM 107 to the second RDDMAC 222 in S401 of FIG.
In the case of the vector detection unit of the second embodiment, in S409 of FIG. 7, the tracking destination feature point determination unit 205 stores the calculated tracking destination feature point coordinate information as tracking destination feature point coordinate information 257 as second information. And output to the SRAM 206 as well.

以下、図14に示した第2の実施形態の追跡先特徴点決定部205の構成とその処理内容について、図15から図18を参照しながら説明する。図15は、第2の実施形態における追跡先特徴点決定部205の概略構成を示すブロック図である。図15に示すように、第2の実施形態の追跡先特徴点決定部205は、特徴点管理部801、範囲設定部802、範囲判定部803、新規特徴点補填部804を有する。図16(a)及び図16(b)は、図15の追跡先特徴点決定部205が備えている範囲判定部803の処理の説明に用いる図である。図17は、第2の実施形態の追跡先特徴点決定部205の処理を示すフローチャートである。図18は、図15の追跡先特徴点決定部205が備えている範囲判定部803と新規特徴点補填部804の処理の説明に用いる図である。   Hereinafter, the configuration and processing contents of the tracking destination feature point determination unit 205 of the second embodiment illustrated in FIG. 14 will be described with reference to FIGS. 15 to 18. FIG. 15 is a block diagram illustrating a schematic configuration of the tracking destination feature point determination unit 205 according to the second embodiment. As illustrated in FIG. 15, the tracking destination feature point determination unit 205 according to the second embodiment includes a feature point management unit 801, a range setting unit 802, a range determination unit 803, and a new feature point compensation unit 804. FIGS. 16A and 16B are diagrams used for explaining the processing of the range determination unit 803 provided in the tracking destination feature point determination unit 205 of FIG. FIG. 17 is a flowchart illustrating processing of the tracking destination feature point determination unit 205 according to the second embodiment. FIG. 18 is a diagram used for explaining the processing of the range determination unit 803 and the new feature point compensation unit 804 provided in the tracking destination feature point determination unit 205 of FIG.

先ず、図17のS1701の処理として、特徴点管理部801は、SRAM206から入力された現フレームのベクトル情報と前フレームの追跡先特徴点座標情報とを基に、現フレームの追跡先特徴点座標情報の更新を行う。具体的には、特徴点管理部801は、前フレームの追跡先特徴点座標に対して現フレームのベクトル値を加算することにより、現フレームの追跡先特徴点座標情報の更新を行う。そして、特徴点管理部801は、その更新した現フレームの追跡先特徴点座標情報を内部のメモリに格納する。なお、特徴点管理部801の内部メモリは、少なくとも現フレームの追跡先特徴点座標情報と、その追跡先特徴点座標情報に関連付けられた特徴点の初期座標とを格納できる容量を有している。   First, as the processing of S1701 in FIG. 17, the feature point management unit 801, based on the current frame vector information and the previous frame tracking destination feature point coordinate information input from the SRAM 206, tracks the current frame tracking destination feature point coordinates. Update information. Specifically, the feature point management unit 801 updates the tracking destination feature point coordinate information of the current frame by adding the vector value of the current frame to the tracking destination feature point coordinates of the previous frame. Then, the feature point management unit 801 stores the updated tracking destination feature point coordinate information of the current frame in the internal memory. The internal memory of the feature point management unit 801 has a capacity capable of storing at least the tracking destination feature point coordinate information of the current frame and the initial coordinates of the feature points associated with the tracking destination feature point coordinate information. .

次のS1702の処理として、特徴点管理部801は、S1701で更新した追跡先特徴点座標情報に関連付けられた特徴点の初期座標が、内部メモリ内に格納されているか否かを判定する。特徴点管理部801は、S1702において、関連付けられた特徴点の初期座標が存在する(内部メモリ内に格納されている)と判定(YES)した場合にはS1704に処理を進める。一方、特徴点管理部801は、S1702において、関連付けられた特徴点の初期座標が存在しないと判定(NO)した場合にはS1703に処理を進める。   As the next processing of S1702, the feature point management unit 801 determines whether or not the initial coordinates of the feature points associated with the tracking destination feature point coordinate information updated in S1701 are stored in the internal memory. If the feature point management unit 801 determines (YES) in S1702 that the initial coordinates of the associated feature point exist (stored in the internal memory) (YES), the process proceeds to S1704. On the other hand, if the feature point management unit 801 determines in S1702 that the initial coordinates of the associated feature point do not exist (NO), the feature point management unit 801 advances the process to S1703.

S1703に進むと、特徴点管理部801は、今回更新した追跡先特徴点座標情報が初期座標であると判断し、S1701で更新した現フレームの追跡先特徴点座標を初期座標とし、今回更新した追跡先特徴点座標情報と関連付けた後、S1704に遷移する。具体的には、特徴点管理部801は、関連付けの処理として、初期座標と今回更新した追跡先特徴点座標情報に共通のIDを付加する処理を行う。これにより、特徴点管理部801は、追跡先特徴点座標情報に付加されているIDを参照することで、関連付けられた特徴点の初期座標が存在するか否かを判定することができる。   In step S1703, the feature point management unit 801 determines that the tracking destination feature point coordinate information updated this time is the initial coordinate, and uses the tracking destination feature point coordinate of the current frame updated in step S1701 as the initial coordinate, and updated this time. After associating with the tracking destination feature point coordinate information, the process proceeds to S1704. Specifically, the feature point management unit 801 performs a process of adding a common ID to the initial coordinates and the tracking destination feature point coordinate information updated this time as the association process. Thereby, the feature point management unit 801 can determine whether or not the initial coordinates of the associated feature point exist by referring to the ID added to the tracking destination feature point coordinate information.

S1704に進むと、特徴点管理部801は、内部のメモリに格納されている現フレームの追跡先特徴点座標情報を範囲判定部803と新規特徴点補填部804とに出力し、特徴点の初期座標を範囲設定部802に出力する。S1704の後、追跡先特徴点決定部205の処理は、S1705に遷移する。   In step S1704, the feature point management unit 801 outputs the tracking destination feature point coordinate information of the current frame stored in the internal memory to the range determination unit 803 and the new feature point compensation unit 804, thereby initializing the feature points. The coordinates are output to the range setting unit 802. After S1704, the process of the tracking destination feature point determination unit 205 transitions to S1705.

S1705に進むと、範囲設定部802は、入力された特徴点の初期座標を基に、追跡範囲(SX,SY)〜(EX,EY)を設定する。この設定された追跡範囲の情報は、範囲判定部803に送られる。S1705の後、追跡先特徴点決定部205の処理は、S1706に遷移する。   In step S1705, the range setting unit 802 sets tracking ranges (SX, SY) to (EX, EY) based on the input initial coordinates of the feature points. Information on the set tracking range is sent to the range determination unit 803. After S1705, the process of the tracking destination feature point determination unit 205 transitions to S1706.

ここで、図16(a)及び図16(b)を用いて、第2の実施形態における追跡範囲(SX,SY)〜(EX,EY)の設定方法を具体的に説明する。
図16(a)は、現フレームの画像を水平方向に5分割、垂直方向に5分割して計25個のグリッドを設定した場合の座標系と、現フレームの画像読み出し順序を示す概念図である。各グリッドは、前述した特徴抽出グリッド302、周辺グリッド301からなる。図16(a)の場合、水平方向GX、垂直方向GYの座標(gx,gy)毎にグリッドが区切られている。図16(a)の座標系では、左上角の特徴抽出グリッドの左上端の座標が(0,0)、右上角の特徴抽出グリッドの右上端の座標が(5gx,0)となる。また、左下角の特徴抽出グリッドの左下端の座標が(0,5gy)、右下角の特徴抽出グリッドの右下端の座標が(5gx,5gy)となる。なお、現フレームにおけるグリッドの画像読み出し順は、図16(a)中の矢印1601で示すようにラスタスキャン方式に応じた読み出し順となされる。
Here, a method for setting the tracking ranges (SX, SY) to (EX, EY) in the second embodiment will be specifically described with reference to FIGS.
FIG. 16A is a conceptual diagram showing a coordinate system and an image reading order of the current frame when the image of the current frame is divided into 5 in the horizontal direction and 5 in the vertical direction to set a total of 25 grids. is there. Each grid includes the feature extraction grid 302 and the peripheral grid 301 described above. In the case of FIG. 16A, the grid is divided for each coordinate (gx, gy) in the horizontal direction GX and the vertical direction GY. In the coordinate system of FIG. 16A, the upper left corner coordinates of the upper left corner feature extraction grid are (0, 0), and the upper right corner coordinates of the upper right corner feature extraction grid are (5gx, 0). Further, the coordinates of the lower left corner of the feature extraction grid at the lower left corner are (0, 5 gy), and the coordinates of the lower right corner of the feature extraction grid at the lower right corner are (5 gx, 5 gy). Note that the grid image reading order in the current frame is the reading order corresponding to the raster scan method, as indicated by an arrow 1601 in FIG.

図16(b)は、範囲設定部802が、図1のROM109に記録されている読み出し順序設定を読み込んで、追跡範囲を設定した一例を示した図である。図16(b)では、現フレームを水平方向に5分割、垂直方向に5分割した計25個のグリッドに区切った場合の各グリッドにおける垂直方向の追跡範囲が、SYとEYの値により設定される例を示している。第2の実施形態の場合、例えば追跡先特徴点が垂直方向の下部領域に集中して所定期間内に処理が終了しなくなるのを防止するために、ラスタスキャン方式の読み出し順序設定に従って垂直方向下部で特徴点の追跡が行われる範囲を狭めている。言い換えると、第2の実施形態における追跡範囲は、ラスタスキャン順で終盤に処理が行われる領域では追跡が行われないようにする範囲として設定されている。   FIG. 16B is a diagram showing an example in which the range setting unit 802 reads the reading order setting recorded in the ROM 109 of FIG. 1 and sets the tracking range. In FIG. 16B, the vertical tracking range in each grid when the current frame is divided into a total of 25 grids divided into 5 parts in the horizontal direction and 5 parts in the vertical direction is set by the values of SY and EY. An example is shown. In the case of the second embodiment, for example, in order to prevent the tracking target feature points from concentrating on the lower region in the vertical direction and not ending the processing within a predetermined period, The range in which feature points are tracked is narrowed. In other words, the tracking range in the second embodiment is set as a range in which tracking is not performed in an area where processing is performed at the end in the raster scan order.

図16(b)のグリッド441を例に挙げた場合、範囲設定部802は、入力された特徴点の初期座標の属するグリッド441に設定された追跡範囲の値を読み出して、追跡範囲(SX,SY)〜(EX,EY)を設定する。図16(b)の例では、グリッド441の追跡範囲の値としてSY:0、EY:3gyが設定されているため、範囲設定部802は、追跡範囲(SX,SY)〜(EX,EY)を(0,0)〜(5gx,3gy)に設定する。つまり、追跡範囲は、図16(a)の座標系の特徴抽出グリッド群の範囲(0,0)〜(5gx,5gy)よりも狭められた、追跡範囲(0,0)〜(5gx,3gy)に設定される。   When the grid 441 in FIG. 16B is taken as an example, the range setting unit 802 reads the tracking range value set in the grid 441 to which the initial coordinates of the input feature points belong, and the tracking range (SX, SY) to (EX, EY) are set. In the example of FIG. 16B, since SY: 0 and EY: 3gy are set as the tracking range values of the grid 441, the range setting unit 802 includes tracking ranges (SX, SY) to (EX, EY). Is set to (0, 0) to (5 gx, 3 gy). That is, the tracking range is narrower than the range (0,0) to (5gx, 5gy) of the feature extraction grid group in the coordinate system of FIG. 16A, and the tracking range (0,0) to (5gx, 3gy) is narrowed. ).

なお、第2の実施形態では、撮像素子102の読み出し順がラスタスキャン(水平方向)の場合を説明したが、これには特に限定しない。例えば撮像素子102の読み出し順が左側から垂直方向に順に走査される場合、範囲設定部802は、その読み出し順に応じて水平方向の追跡範囲を狭めてもよい。この例の場合、例えば追跡先特徴点が水平方向の右側領域に集中した場合であっても、水平方向の追跡範囲を狭めることで、所定の期間内に処理が終了しなくなることを防止することができる。   In the second embodiment, the case where the reading order of the image sensor 102 is raster scan (horizontal direction) has been described, but the present invention is not particularly limited thereto. For example, when the reading order of the image sensor 102 is scanned in the vertical direction from the left side, the range setting unit 802 may narrow the horizontal tracking range according to the reading order. In this example, for example, even when the tracking target feature points are concentrated on the right side area in the horizontal direction, the processing range is prevented from being finished within a predetermined period by narrowing the horizontal tracking range. Can do.

図17に説明を戻す。
図17のS1706の処理に進むと、範囲判定部803は、入力された現フレームの追跡先特徴点座標が追跡範囲を超えるか否か(追跡範囲を外れるか否か)を判断する。そして、S1706において、範囲判定部803は、追跡範囲を超えると判断した場合には判定結果NGの情報を、一方、追跡範囲を超えないと判断した場合には判定結果OKの情報を、新規特徴点補填部804に出力する。
Returning to FIG.
When the processing proceeds to S1706 in FIG. 17, the range determination unit 803 determines whether or not the input tracking destination feature point coordinates of the current frame exceed the tracking range (whether or not the tracking range is exceeded). Then, in S1706, the range determination unit 803 provides information on the determination result NG when it is determined that the tracking range is exceeded, and information on the determination result OK when it is determined that the tracking range is not exceeded. The data is output to the point compensation unit 804.

図18を参照し、追跡範囲(0,0)〜(5gx,3gy)の例を用いて、範囲判定部803における判断処理を説明する。図18では、図中の斜線部分の各グリッドが追跡範囲のグリッドを表し、それ以外は追跡範囲外のグリッドを表している。また、図18の例において、入力された現フレームの追跡先特徴点座標1803は追跡範囲外であるとする。したがって、図18の例の場合、範囲判定部803は、現フレームの追跡先特徴点座標1803については判定結果NGとし、その判定結果NGの情報を、新規特徴点補填部804に出力する。S1706の後、追跡先特徴点決定部205の処理は、S1707に遷移する。   With reference to FIG. 18, the determination process in the range determination unit 803 will be described using examples of tracking ranges (0, 0) to (5 gx, 3 gy). In FIG. 18, each grid in the hatched portion in the figure represents a grid in the tracking range, and the others represent grids outside the tracking range. In the example of FIG. 18, it is assumed that the input tracking destination feature point coordinates 1803 of the current frame are outside the tracking range. Therefore, in the example of FIG. 18, the range determination unit 803 sets the determination result NG for the tracking destination feature point coordinates 1803 of the current frame, and outputs information on the determination result NG to the new feature point compensation unit 804. After S1706, the process of the tracking destination feature point determination unit 205 transitions to S1707.

S1707に進むと、新規特徴点補填部804は、範囲判定部803から送られてきた判定結果に基づいて、現フレームの追跡先特徴点座標情報に対して補填処理を行うか否かを判定する。そして、新規特徴点補填部804は、範囲判定部803から判定結果OKが送られてきた場合にはS1709に処理を進め、判定結果NGが送られてきた場合にはS1708に処理を進める。   In step S1707, the new feature point compensation unit 804 determines whether or not to perform compensation processing on the tracking destination feature point coordinate information of the current frame based on the determination result sent from the range determination unit 803. . The new feature point compensation unit 804 advances the process to S1709 when the determination result OK is sent from the range determination unit 803, and advances the process to S1708 when the determination result NG is sent.

S1708の処理に進むと、新規特徴点補填部804は、現フレームの追跡先特徴点座標から追跡先特徴点を破棄して、新規特徴点座標情報で補填して、S1709に処理を進める。前述した図18の例の場合、新規特徴点補填部804は、現フレームの追跡先特徴点座標1803を破棄して、図16(b)のグリッド441の位置で算出された新規特徴点座標1804を追跡先特徴点座標として補填する。S1708の後、追跡先特徴点決定部205の処理は、S1709に遷移する。   When the processing proceeds to S1708, the new feature point compensation unit 804 discards the tracking destination feature point from the tracking destination feature point coordinates of the current frame, compensates with the new feature point coordinate information, and proceeds to S1709. In the case of the example of FIG. 18 described above, the new feature point compensation unit 804 discards the tracking destination feature point coordinates 1803 of the current frame and calculates the new feature point coordinates 1804 calculated at the position of the grid 441 in FIG. Is compensated as the tracking destination feature point coordinates. After S1708, the process of the tracking destination feature point determination unit 205 transitions to S1709.

S1709に進むと、追跡先特徴点決定部205は、現フレームの全ての追跡先特徴点座標(特徴抽出グリッド数分の追跡先特徴点座標)が算出されたか否かを判定する。そして、追跡先特徴点決定部205は、全ての追跡先特徴点座標が算出されたと判定(YES)した場合には図17のフローチャートの処理を終了する。一方、S1709において、現フレームの全ての追跡先特徴点座標が算出されていないと判定(NO)した場合、追跡先特徴点決定部205は、S1701に処理を戻し、S1701以降の前述した処理を行う。S1701からS1709までの処理は、S1709において全ての追跡先特徴点座標が算出されたと判定(YES)されるまで反復される。   In step S1709, the tracking destination feature point determination unit 205 determines whether all tracking destination feature point coordinates (tracking destination feature point coordinates for the number of feature extraction grids) in the current frame have been calculated. When the tracking destination feature point determination unit 205 determines that all the tracking destination feature point coordinates have been calculated (YES), the processing of the flowchart of FIG. 17 ends. On the other hand, if it is determined in S1709 that all the tracking destination feature point coordinates of the current frame have not been calculated (NO), the tracking destination feature point determination unit 205 returns the processing to S1701, and performs the above-described processing after S1701. Do. The processing from S1701 to S1709 is repeated until it is determined (YES) that all the tracking destination feature point coordinates have been calculated in S1709.

以上が、第2の実施形態の追跡先特徴点決定部205における処理の流れである。本実施形態では、1フレーム分の処理を例に挙げて説明したが、前述した1フレーム分の処理は毎フレームに対して同様に行われ、毎フレームでベクトル値が算出される。
また、第2の実施形態における追跡範囲設定は、画像処理装置の処理能力に応じて決めることができる。例えば、画像処理装置におけるテンプレートマッチング用画像の生成処理速度やテンプレートマッチングの処理速度を基に、画像処理装置が一定処理期間内に処理を完了できるように、追跡範囲の設定を行うことができる。
The above is the flow of processing in the tracking destination feature point determination unit 205 of the second embodiment. In the present embodiment, processing for one frame has been described as an example, but the processing for one frame described above is performed in the same manner for each frame, and a vector value is calculated for each frame.
Further, the tracking range setting in the second embodiment can be determined according to the processing capability of the image processing apparatus. For example, the tracking range can be set so that the image processing apparatus can complete the processing within a predetermined processing period based on the template matching image generation processing speed and the template matching processing speed in the image processing apparatus.

第2の実施形態の画像処理装置は、特徴点追跡を行うベクトル検出において特徴点の初期座標を基に追跡範囲を設定し、追跡範囲を超えた場合に、追跡先特徴点の破棄補填処理を行うことで、1フレーム期間など所定期間内に処理を完了させることができる。したがって、第2の実施形態の画像処理装置によれば、追跡先特徴点がフレームの画像範囲内で偏在した場合でも、ベクトル検出性能の低下を防止しつつ、ベクトル検出を高速化し、所定期間内に処理を完了させることが可能となる。   The image processing apparatus according to the second embodiment sets a tracking range based on initial coordinates of feature points in vector detection for performing feature point tracking, and performs tracking point feature point discard compensation processing when the tracking range is exceeded. By performing the processing, the processing can be completed within a predetermined period such as one frame period. Therefore, according to the image processing apparatus of the second embodiment, even when the tracking destination feature points are unevenly distributed within the image range of the frame, the vector detection is speeded up while preventing the deterioration of the vector detection performance, and within a predetermined period. It is possible to complete the processing.

<第3の実施形態>
以下、第3の実施形態について説明する。
第3の実施形態の画像処理装置が適用されるデジタルカメラの構成は、図1に示した第1の実施形態のデジタルカメラと同様であるため、その図示と説明は省略する。
第3の実施形態の画像処理装置は、各追跡先特徴点の座標情報を基に追跡先特徴点間の距離を算出し、その算出した距離に基づいて追跡先特徴点の破棄補填処理を行うことにより、1フレーム期間内など所定期間内に処理を完了させる。第3の実施形態の場合、例えば二つの追跡先特徴点間の距離が近い場合に一方を破棄し、新規特徴点を追跡先特徴点として補填する。
<Third Embodiment>
Hereinafter, a third embodiment will be described.
Since the configuration of the digital camera to which the image processing apparatus of the third embodiment is applied is the same as that of the digital camera of the first embodiment shown in FIG. 1, its illustration and description are omitted.
The image processing apparatus according to the third embodiment calculates a distance between tracking destination feature points based on the coordinate information of each tracking destination feature point, and performs a discard compensation process for the tracking destination feature point based on the calculated distance. Thus, the processing is completed within a predetermined period such as one frame period. In the case of the third embodiment, for example, when the distance between two tracking destination feature points is short, one is discarded and a new feature point is compensated as the tracking destination feature point.

図19は、第3の実施形態の画像処理部104に含まれるベクトル検出部の概略構成例を示すブロック図である。なお、図19において、第1の実施形態の図2に示した構成と同じ構成には同一の参照符号を付してそれらの説明は省略する。図19では図示していないが、図14と同様、グリッド座標情報は、第2のRDDMAC222を介してマッチング処理部203に送られる。また、第3の実施形態のベクトル検出部の処理フローチャートは、前述した図7のフローチャートと概ね同様であり、前述の図8、図9についても前述同様であるためそれらの図示と説明は省略する。   FIG. 19 is a block diagram illustrating a schematic configuration example of a vector detection unit included in the image processing unit 104 according to the third embodiment. In FIG. 19, the same components as those shown in FIG. 2 of the first embodiment are denoted by the same reference numerals, and description thereof is omitted. Although not shown in FIG. 19, the grid coordinate information is sent to the matching processing unit 203 via the second RDDMAC 222 as in FIG. 14. Further, the processing flowchart of the vector detection unit of the third embodiment is substantially the same as the flowchart of FIG. 7 described above, and the above-described FIG. 8 and FIG. .

図20は、第3の実施形態におけるベクトル検出処理の際のグリッド配置と、特徴点、テンプレートマッチング領域の関係説明に用いる図である。図20において、特徴抽出グリッド302、周辺グリッド301、サーチ領域305、テンプレート領域304は、前述した図3で説明したものと同様である。図20の図中斜線部分で表された各グリッドからなる領域は、新規特徴点が追跡先特徴点として補填される領域であり、第3の実施形態ではこの領域を補填領域区分310と表記する。補填領域区分310は、動きベクトルの検出に使用される画像の生成が先に行われる領域(ラスタスキャン順で初期に処理が行われる領域)に設定される。   FIG. 20 is a diagram used for explaining the relationship between the grid layout, the feature points, and the template matching area in the vector detection process according to the third embodiment. In FIG. 20, the feature extraction grid 302, the peripheral grid 301, the search area 305, and the template area 304 are the same as those described with reference to FIG. In FIG. 20, the area composed of the grids indicated by the hatched area is an area in which the new feature point is compensated as the tracking destination feature point. In the third embodiment, this area is represented as a compensation area section 310. . The compensation area section 310 is set to an area where an image used for motion vector detection is generated first (an area where processing is initially performed in the raster scan order).

図21は、第3の実施形態に係る追跡先特徴点決定部205の概略構成例を示すブロック図である。第3の実施形態の追跡先特徴点決定部205は、距離算出部715、処理判定部716、新規特徴点補填部717を有する。なお、図21において、前述した図10と同じ構成には同一の参照符号を付してそれらの説明は省略する。また、図22は、第3の実施形態の追跡先特徴点決定部205が処理する追跡先特徴点の位置関係の説明に用いる図である。図22の例では、図を見やすくするために、1グリッド分とその周囲のグリッドの一部のみを図示している。さらに、図23は、第3の実施形態に係る追跡先特徴点決定部205の処理フローチャートである。第3の実施形態における処理タイミングは、前述の図13の例と同様であるため、その図示と説明は諸略する。   FIG. 21 is a block diagram illustrating a schematic configuration example of the tracking destination feature point determination unit 205 according to the third embodiment. The tracking destination feature point determination unit 205 according to the third embodiment includes a distance calculation unit 715, a process determination unit 716, and a new feature point compensation unit 717. In FIG. 21, the same components as those in FIG. 10 described above are denoted by the same reference numerals, and description thereof is omitted. FIG. 22 is a diagram used for explaining the positional relationship of the tracking destination feature points processed by the tracking destination feature point determination unit 205 according to the third embodiment. In the example of FIG. 22, only one grid and a part of the surrounding grid are shown for easy viewing of the figure. Furthermore, FIG. 23 is a process flowchart of the tracking destination feature point determination unit 205 according to the third embodiment. Since the processing timing in the third embodiment is the same as that in the example of FIG. 13 described above, illustration and description thereof are omitted.

以下、図20から図23を参照して、第3の実施形態の追跡先特徴点決定部205における構成と処理の概要を説明する。なお、図23のS901〜S905までの処理は前述の図12のS901〜S905の処理と同様であるためそれらの説明は省略し、図12とは異なる処理であるS2301〜S2304について説明を行う。
図23のフローチャートにおいて、S905の後、追跡先特徴点決定部205の処理は、S2301に遷移する。
Hereinafter, with reference to FIG. 20 to FIG. 23, an outline of the configuration and processing in the tracking destination feature point determination unit 205 of the third embodiment will be described. Note that the processing from S901 to S905 in FIG. 23 is the same as the processing from S901 to S905 in FIG. 12 described above, and therefore a description thereof will be omitted, and S2301 to S2304, which are processing different from FIG.
In the flowchart of FIG. 23, after S905, the process of the tracking destination feature point determination unit 205 transitions to S2301.

S2301に進むと、追跡先特徴点決定部205の距離算出部715は、各追跡先特徴点の2点間の距離を算出する。具体的には、図22に示すように、2点の追跡先特徴点2210,2211の座標をそれぞれ(X1,Y1)、(X2,Y2)とした場合、距離算出部715は、それら2点の追跡先特徴点間の距離Dを、下記の式(4)により算出する。S2301の後、追跡先特徴点決定部205の処理は、S2302に遷移する。

Figure 2019020839
In step S2301, the distance calculation unit 715 of the tracking destination feature point determination unit 205 calculates the distance between the two tracking destination feature points. Specifically, as shown in FIG. 22, when the coordinates of the two tracking destination feature points 2210 and 2211 are (X1, Y1) and (X2, Y2), the distance calculation unit 715 The distance D between the tracking destination feature points is calculated by the following equation (4). After S2301, the process of the tracking destination feature point determination unit 205 transitions to S2302.
Figure 2019020839

S2302に進むと、追跡先特徴点決定部205の処理判定部716は、距離算出部715で求めた2点の追跡先特徴点間の距離Dに基づき、それら2点の追跡先特徴点に対する破棄補填処理を行うか否か判定する。具体的には、処理判定部716は、S2301で求めた2点の追跡先特徴点の距離Dが所定の閾値Dthより小さいか否かを判定する。閾値Dthは、2点の追跡先特徴点について破棄補填処理を行うかどうかを判断する際の指標である。第3の実施形態の場合、閾値Dthは、例えば図22のテンプレート領域304の一辺の長さの半分の距離2202とする。なお、本実施形態において、閾値Dthを距離2202としたのは、2点の追跡先特徴点間の距離Dがテンプレート領域の一辺の長さの半分より短ければ(近ければ)、一つのテンプレート領域内に2点の特徴点が入ることになるためである。そして、S2302において、処理判定部716は、2点の追跡先特徴点間の距離Dが、閾値以上(D≧Dth)である場合(NO)にS2304へ処理を進め、一方、閾値未満(D<Dth)である場合(YES)にはS2303へ処理を進める。   In S2302, the process determination unit 716 of the tracking destination feature point determination unit 205 discards the two tracking destination feature points based on the distance D between the two tracking destination feature points obtained by the distance calculation unit 715. It is determined whether or not compensation processing is performed. Specifically, the process determination unit 716 determines whether or not the distance D between the two tracking destination feature points obtained in S2301 is smaller than a predetermined threshold value Dth. The threshold value Dth is an index when determining whether or not to perform the discard compensation process for the two tracking destination feature points. In the case of the third embodiment, the threshold value Dth is, for example, a distance 2202 that is half the length of one side of the template region 304 in FIG. In the present embodiment, the threshold value Dth is set to the distance 2202 if the distance D between the two tracking destination feature points is shorter (if closer) than half the length of one side of the template area. This is because there are two feature points inside. In step S2302, the process determining unit 716 advances the process to step S2304 when the distance D between the two tracking destination feature points is equal to or greater than the threshold (D ≧ Dth) (NO). If <Dth) (YES), the process proceeds to S2303.

なお、テンプレートマッチング処理を1フレーム期間内に完了できるように、閾値Dthを調整してもよい。例えば、テンプレートマッチング処理を分散させるように、複数の追跡先特徴点の密集度合いを評価し、密集度が高いほど閾値Dthの値を大きくして、追跡先特徴点に対する破棄補填処理がなされ易くしてもよい。また、テンプレートマッチング処理がフレームの画像範囲内(画角内)の下部領域に集中しないように、追跡先特徴点の座標を評価し、フレームの画像範囲の下端部に近づくほど閾値Dthを大きくして、追跡先特徴点に対する破棄補填処理がなされ易くしてもよい。   Note that the threshold value Dth may be adjusted so that the template matching process can be completed within one frame period. For example, the degree of congestion of a plurality of tracking destination feature points is evaluated so as to distribute the template matching process, and the threshold Dth value is increased as the density increases, so that the discarding compensation process for the tracking destination feature points is easily performed. May be. Also, the coordinates of the tracking target feature points are evaluated so that the template matching process does not concentrate on the lower region within the frame image range (within the angle of view), and the threshold Dth is increased as it approaches the lower end of the frame image range. Thus, it may be easy to perform the discard compensation process for the tracking destination feature point.

S2303に進むと、追跡先特徴点決定部205の新規特徴点補填部717は、第3の実施形態における追跡先特徴点の破棄、及び新規特徴点を追跡先特徴点として補填する破棄補填処理を実施する。先ず、新規特徴点補填部717は、2点の追跡先特徴点における特徴値の大小比較を行う。そして、新規特徴点補填部717は、特徴値が小さい方の追跡先特徴点を破棄対象とする。なお、特徴値ではなく、2点の追跡先特徴点の座標を基に破棄対象を選定してもよい。例えば、2点の追跡先特徴点の座標を基に、何れの追跡先特徴点座標がフレームの画像範囲の下部領域側になっているかを判断し、下部領域側となっている方を破棄対象として選定する。そして、新規特徴点補填部717は、追跡先特徴点の1点を破棄した後、図20に示した補填領域区分310の特徴抽出グリッドに対し、新規特徴点を追跡先特徴点として補填する。この破棄補填処理により、前述した図13で説明したのと同様に、補填された追跡先特徴点に対するテンプレートマッチング処理に要する期間930が、1フレーム期間の前半に分散されることになる。S2303の後、追跡先特徴点決定部205の処理は、S2304に遷移する。   In step S2303, the new feature point compensation unit 717 of the tracking destination feature point determination unit 205 performs discarding processing for discarding the tracking destination feature point and compensating for the new feature point as the tracking destination feature point in the third embodiment. carry out. First, the new feature point compensation unit 717 compares the feature values of the two tracking destination feature points. Then, the new feature point compensation unit 717 sets a tracking destination feature point having a smaller feature value as a discard target. Note that the discard target may be selected based on the coordinates of the two tracking destination feature points instead of the feature values. For example, based on the coordinates of two tracking destination feature points, it is determined which tracking destination feature point coordinates are on the lower area side of the image range of the frame, and the one that is on the lower area side is subject to destruction Select as Then, the new feature point compensation unit 717 discards one of the tracking destination feature points, and then compensates the feature extraction grid of the compensation region section 310 illustrated in FIG. 20 as the tracking destination feature point. By this discard compensation process, the period 930 required for the template matching process for the compensated tracking destination feature points is distributed in the first half of one frame period, as described with reference to FIG. After S2303, the process of the tracking destination feature point determination unit 205 transitions to S2304.

S2304に進むと、追跡先特徴点決定部205は、S2301からS2303までの処理を全ての追跡先特徴点間に対して実施したか否か判定する。そして、S2304において、全ての追跡先特徴点間に対する処理が実施されていないと判定(NO)した場合、追跡先特徴点決定部205は、S2301に処理を戻してS2301からS2303までの前述した破棄補填処理を行う。一方、S2304において、全ての追跡先特徴点間に対する処理が実施されたと判定(YES)した場合、追跡先特徴点決定部205は、図23の処理を終了する。   In S2304, the tracking destination feature point determination unit 205 determines whether or not the processing from S2301 to S2303 has been performed between all the tracking destination feature points. If it is determined in S2304 that the processing between all the tracking destination feature points has not been performed (NO), the tracking destination feature point determination unit 205 returns the processing to S2301 and discards the processing from S2301 to S2303 described above. Perform compensation processing. On the other hand, if it is determined in S2304 that the processing for all the tracking destination feature points has been performed (YES), the tracking destination feature point determination unit 205 ends the processing of FIG.

以上が、第3の実施形態の追跡先特徴点決定部205における処理の流れである。本実施形態では、1フレーム分の処理を例に挙げて説明したが、前述した1フレーム分の処理は毎フレームに対して同様に行われ、毎フレームでベクトル値が算出される。   The above is the flow of processing in the tracking destination feature point determination unit 205 of the third embodiment. In the present embodiment, processing for one frame has been described as an example, but the processing for one frame described above is performed in the same manner for each frame, and a vector value is calculated for each frame.

第3の実施形態における破棄補填処理の指標となる閾値Dthや補填領域区分310は、画像処理装置の処理能力に応じて決めることができる。例えば、画像処理装置におけるテンプレートマッチング用画像の生成処理速度やテンプレートマッチングの処理速度を基に、画像処理装置が一定処理期間内に処理を完了できるように、閾値Dthや補填領域区分310の設定を行うことができる。   The threshold value Dth and the compensation region classification 310 that serve as an index for discard compensation processing in the third embodiment can be determined according to the processing capability of the image processing apparatus. For example, based on the template matching image generation processing speed and the template matching processing speed in the image processing apparatus, the threshold value Dth and the compensation region section 310 are set so that the image processing apparatus can complete the processing within a predetermined processing period. It can be carried out.

また、追跡先特徴点決定部205は、複数の追跡先特徴点のうち、距離を算出する2点の追跡先特徴点を選定する際、例えば特徴値の小さい追跡先特徴点から優先的に破棄されるように、特徴値が小さい追跡先特徴点順の2点の追跡先特徴点から選定してもよい。
また、追跡先特徴点決定部205は、複数の追跡先特徴点の全ての追跡先特徴点間の距離を求めなくてもよい。例えば、追跡先特徴点決定部205は、テンプレートマッチング処理の完了時間に影響を及ぼし易い、前述した下部領域の追跡先特徴点群のみを距離算出の対象とされてもよい。また例えば、一部の領域のみで追跡先特徴点が密集し、それ以外の画像範囲では追跡先特徴点が広く分散している場合、追跡先特徴点決定部205は、図23のS2301〜S2304の処理をスキップして破棄補填処理を実施しないようにしてもよい。このように、破棄補填処理をスキップした場合、画像処理部104の処理負担が軽減され、処理の高速化が可能となる。
その他にも、追跡先特徴点決定部205は、補填領域区分に新規特徴点を補填する際、特徴値が大きなものから優先的に補填するようにしてもよい。また、追跡先特徴点決定部205は、補填領域区分に新規特徴点を補填する際、追跡先特徴点の分布をより広く分散させるように、上部領域側のグリッドから優先的に新規特徴点を補填するようにしてもよい。
Further, the tracking destination feature point determination unit 205 preferentially discards, for example, tracking destination feature points with small feature values when selecting two tracking destination feature points for calculating the distance from among the plurality of tracking destination feature points. As described above, it may be selected from two tracking destination feature points in the order of the tracking destination feature points with small feature values.
Further, the tracking destination feature point determination unit 205 may not obtain the distance between all the tracking destination feature points of the plurality of tracking destination feature points. For example, the tracking destination feature point determination unit 205 may set the distance calculation target only to the tracking destination feature point group in the lower region, which easily affects the completion time of the template matching process. Further, for example, when the tracking destination feature points are dense in only a part of the region and the tracking destination feature points are widely dispersed in the other image range, the tracking destination feature point determination unit 205 performs S2301 to S2304 in FIG. This processing may be skipped and the discard compensation processing may not be performed. As described above, when the discard compensation process is skipped, the processing load on the image processing unit 104 is reduced, and the processing speed can be increased.
In addition, the tracking-destination feature point determination unit 205 may preferentially compensate for new feature points in the compensation region segment from those having large feature values. In addition, the tracking destination feature point determination unit 205 preferentially assigns new feature points from the grid on the upper region side so that the distribution of the tracking destination feature points is more widely dispersed when the new feature points are compensated for in the compensation region classification. You may make it supplement.

第3の実施形態の画像処理装置は、複数の追跡先特徴点間の距離を基に、追跡先特徴点の破棄補填処理を行うことで、1フレーム期間など所定期間内に処理を完了させることができる。したがって、第3の実施形態の画像処理装置によれば、追跡先特徴点がフレームの画像範囲内で偏在した場合でも、ベクトル検出性能の低下を防止しつつ、ベクトル検出を高速化し、所定期間内に処理を完了させることが可能となる。   The image processing apparatus according to the third embodiment completes the processing within a predetermined period such as one frame period by performing a discarding compensation process for the tracking destination feature points based on the distance between the plurality of tracking destination feature points. Can do. Therefore, according to the image processing apparatus of the third embodiment, even when the tracking destination feature points are unevenly distributed within the image range of the frame, the vector detection is speeded up while preventing a decrease in the vector detection performance, and within a predetermined period It is possible to complete the processing.

<第4の実施形態>
以下、第4の実施形態について説明する。
第4の実施形態の画像処理装置が適用されるデジタルカメラの構成は、図1に示した第1の実施形態のデジタルカメラと同様であるため、その図示と説明は省略する。
第4の実施形態の画像処理装置は、前述した複数の特徴抽出グリッドを、非追跡領域区分と追跡領域区分とに区分けし、追跡領域区分では追跡先特徴点を基に動きベクトルを検出し、非追跡領域区分では新規特徴点を基に動きベクトルを検出する。
<Fourth Embodiment>
Hereinafter, a fourth embodiment will be described.
Since the configuration of the digital camera to which the image processing apparatus of the fourth embodiment is applied is the same as that of the digital camera of the first embodiment shown in FIG. 1, its illustration and description are omitted.
The image processing apparatus according to the fourth embodiment divides the plurality of feature extraction grids described above into a non-tracking area section and a tracking area section, and detects a motion vector based on a tracking destination feature point in the tracking area section, In the non-tracking area section, a motion vector is detected based on a new feature point.

第4の実施形態の画像処理部104に含まれるベクトル検出部の構成は、前述した第3の実施形態の図19に示したものと同様であるため、その図示と説明は省略する。また、第4の実施形態のベクトル検出部における処理フローチャートは、前述した図7のフローチャートと概ね同様であり、また前述の図8、図9についても前述同様であるためそれらの図示と説明は省略する。   Since the configuration of the vector detection unit included in the image processing unit 104 of the fourth embodiment is the same as that shown in FIG. 19 of the third embodiment described above, its illustration and description are omitted. Further, the processing flowchart in the vector detection unit of the fourth embodiment is substantially the same as the flowchart of FIG. 7 described above, and also the above-described FIG. 8 and FIG. To do.

図24は、第4の実施形態の追跡先特徴点決定部205の概略構成例を示すブロック図である。第4の実施形態の追跡先特徴点決定部205は、領域判定部720、新規特徴点補填部721を有する。なお、図24において、前述した図10と同じ構成には同一の参照符号を付してそれらの説明は省略する。図25は、第4の実施形態の追跡先特徴点決定部205が処理する追跡先特徴点と新規特徴点、並びに追跡領域区分と非追跡領域区分の位置関係の説明に用いる図である。なお、図25の特徴点2501、追跡先特徴点2502、ベクトル値2503、特徴抽出グリッド2504、周辺グリッド2505は前述同様のものである。   FIG. 24 is a block diagram illustrating a schematic configuration example of the tracking destination feature point determination unit 205 according to the fourth embodiment. The tracking destination feature point determination unit 205 according to the fourth embodiment includes an area determination unit 720 and a new feature point compensation unit 721. 24, the same components as those in FIG. 10 described above are denoted by the same reference numerals, and description thereof is omitted. FIG. 25 is a diagram used for explaining the positional relationship between the tracking destination feature point and the new feature point processed by the tracking destination feature point determination unit 205 of the fourth embodiment, and the tracking region segment and the non-tracking region segment. Note that the feature point 2501, the tracking destination feature point 2502, the vector value 2503, the feature extraction grid 2504, and the peripheral grid 2505 in FIG. 25 are the same as described above.

また、第4の実施形態では、図25の下部領域の複数の特徴抽出グリッド群が非追跡領域区分2506となされ、それ以外の特徴抽出グリッド群が追跡領域区分となされる。第4の実施形態の追跡先特徴点決定部205は、追跡先特徴点が、非追跡領域区分2506内に入った場合には、その追跡先特徴点を破棄する。また、本実施形態の場合、マッチング処理部203は、非追跡領域区分2506の各グリッド(図25の例では5個の特徴抽出グリッド)については、新規特徴点算出部202で算出した新規特徴点座標2507を中心としたテンプレートマッチングを実施する。   In the fourth embodiment, the plurality of feature extraction grid groups in the lower region of FIG. 25 are set as the non-tracking area section 2506, and the other feature extraction grid groups are set as the tracking area section. The tracking destination feature point determination unit 205 according to the fourth embodiment discards the tracking destination feature point when the tracking destination feature point enters the non-tracking area section 2506. In the case of the present embodiment, the matching processing unit 203 uses the new feature points calculated by the new feature point calculation unit 202 for each grid of the non-tracking region section 2506 (five feature extraction grids in the example of FIG. 25). Template matching centering on coordinates 2507 is performed.

図26は、第4の実施形態に係る追跡先特徴点決定部205の処理フローチャートである。さらに、図27は、第4の実施形態における処理タイミングチャートを示す図である。なお、図26において、前述の図12と同様の処理については図12と同一の参照符号を付してそれらの説明は省略する。また、図27においても前述の図13と同じ部分については図13と同一の参照符号を付してそれらの説明は省略する。   FIG. 26 is a process flowchart of the tracking destination feature point determination unit 205 according to the fourth embodiment. Further, FIG. 27 is a diagram showing a processing timing chart in the fourth embodiment. In FIG. 26, processes similar to those in FIG. 12 described above are denoted by the same reference numerals as those in FIG. 12, and description thereof is omitted. Also, in FIG. 27, the same parts as those in FIG. 13 are given the same reference numerals as those in FIG.

図27に示した処理タイミングにおいて、一つのテンプレート領域に対してテンプレートマッチング処理を実施するために必要な時間は、前述したようにテンプレート領域のサイズにより一意に決まる。例えば前述した図11の例のように、フレームの画像範囲内の下部領域(第4の実施形態の非追跡領域区分)に17個の追跡先特徴点が集中した場合、それら17個分のテンプレートマッチング処理は、図27の時刻1959のタイミングで開始する。また、前述したように、時刻1959からフレーム期間が終わるまでの時間910(次のフレーム期間が開始するまでの時間)内では、それら17個分の全てのテンプレートマッチング処理は完了しない。図27の例の場合、期間921に示すように、少なくとも5個分の追跡先特徴点におけるテンプレートマッチング処理が終了しないことになる。   At the processing timing shown in FIG. 27, the time required to perform the template matching process for one template region is uniquely determined by the size of the template region as described above. For example, when 17 tracking destination feature points are concentrated in the lower region (non-tracking region classification of the fourth embodiment) in the image range of the frame as in the example of FIG. The matching process starts at the timing of time 1959 in FIG. Further, as described above, all of the 17 template matching processes are not completed within the time 910 from the time 1959 until the end of the frame period (the time until the start of the next frame period). In the case of the example of FIG. 27, as shown in the period 921, the template matching process for at least five tracking destination feature points will not end.

このため、第4の実施形態の追跡先特徴点決定部205は、図25に示した5グリッド分の非追跡領域区分2506を設定し、この非追跡領域区分2506の追跡先特徴点を破棄する。したがって、非追跡領域区分2506の追跡先特徴点が破棄された場合、テンプレートマッチング処理は、非追跡領域区分2506を除く追跡領域区分内の追跡先特徴点のみを用いたテンプレートマッチング処理となる。非追跡領域区分2506を除く追跡領域区分内の追跡先特徴点のみを用いたテンプレートマッチング処理は、最大でも(最も時間がかかったとしても)期間2000のタイミングで完了することになる。つまり、非追跡領域区分に17個の追跡先特徴点が在った場合、それら追跡先特徴点が破棄されて処理不要となるため、追跡領域区分の追跡先特徴点の処理に、ある程度時間が掛かったとしても、期間2000までには処理は終了する。   For this reason, the tracking destination feature point determination unit 205 of the fourth embodiment sets the non-tracking area segment 2506 for five grids shown in FIG. 25 and discards the tracking destination feature point of this non-tracking area segment 2506. . Therefore, when the tracking destination feature point of the non-tracking area segment 2506 is discarded, the template matching process is a template matching process using only the tracking destination feature point in the tracking area segment excluding the non-tracking area segment 2506. The template matching process using only the tracking destination feature points in the tracking area section excluding the non-tracking area section 2506 is completed at the timing of the period 2000 at the maximum (even if it takes the longest). In other words, if there are 17 tracking destination feature points in the non-tracking area segment, these tracking destination feature points are discarded and no processing is required, so it takes some time to process the tracking destination feature points in the tracking area segment. Even if it takes time, the process ends by the period 2000.

一方、第4の実施形態の場合、追跡先特徴点決定部205は、非追跡領域区分2506の5個のグリッドで新規特徴点算出部202がそれぞれ一つ抽出した新規特徴点(5個)を基に動きベクトルを検出してテンプレートマッチング処理が行われる。図27の場合、期間930が、5個の新規特徴点に基づくテンプレートマッチング処理に要する期間を表している。そして、期間2000からフレーム期間の終了までの時間2010(次フレーム期間開始までの時間)は、非追跡領域区分2506の5個の新規特徴点についてテンプレートマッチング処理(期間930の処理)を行うのには十分な時間である。したがって、第4の実施形態の場合、1フレーム期間内に、テンプレートマッチング処理による動きベクトル値の検出までの処理を終えることができる。   On the other hand, in the case of the fourth embodiment, the tracking destination feature point determination unit 205 extracts five new feature points (5 pieces) extracted by the new feature point calculation unit 202 in each of the five grids of the non-tracking region section 2506. Based on this, a motion vector is detected and a template matching process is performed. In the case of FIG. 27, a period 930 represents a period required for template matching processing based on five new feature points. A time 2010 from the period 2000 to the end of the frame period (time until the start of the next frame period) is for performing template matching processing (processing in the period 930) on the five new feature points in the non-tracking area section 2506. Is enough time. Therefore, in the case of the fourth embodiment, the process up to the detection of the motion vector value by the template matching process can be completed within one frame period.

以下、図24から図27を参照しながら、第4の実施形態の追跡先特徴点決定部205における構成と処理の概要を説明する。図26のS901〜S905までの処理は前述の図12の処理と同様であり、ここでは図12とは異なっている処理であるS2601〜S2603について説明を行う。   The outline of the configuration and processing in the tracking destination feature point determination unit 205 of the fourth embodiment will be described below with reference to FIGS. The processing from S901 to S905 in FIG. 26 is the same as the processing in FIG. 12 described above, and here, S2601 to S2603, which are different from FIG. 12, will be described.

なお、図11の例は非追跡領域区分2506に17個の追跡先特徴点が存在する例であったが、以下、説明を判り易くするために、非追跡領域区分2506の5グリッドに計5個の追跡先特徴点が入り、それら5個の追跡先特徴点を破棄する例を挙げる。このため、追跡領域区分内に在って追跡対象となる追跡先特徴点の数は20個であるとする。したがって、S901で算出される追跡先特徴点座標は20個となる。一方、非追跡領域区分2506の5個のグリッドからは、新規特徴点算出部202により5個の新規特徴点が抽出される。したがって、ベクトル値については、非追跡領域区分2506で抽出された5個の新規特徴点と、追跡領域区分内の20個の追跡先特徴点とを用いたテンプレートマッチング処理の実施により、25個分が算出されることになる。   The example of FIG. 11 is an example in which there are 17 tracking destination feature points in the non-tracking area section 2506, but in order to make the explanation easier to understand, a total of five grids in the non-tracking area section 2506 are used. An example will be given in which five tracking destination feature points are entered and these five tracking destination feature points are discarded. For this reason, it is assumed that the number of tracking destination feature points to be tracked in the tracking area section is 20. Therefore, the tracking destination feature point coordinates calculated in S901 are 20. On the other hand, five new feature points are extracted by the new feature point calculation unit 202 from the five grids of the non-tracking region section 2506. Therefore, the vector value is obtained by performing template matching processing using the five new feature points extracted in the non-tracking region segment 2506 and the 20 tracking destination feature points in the tracking region segment, thereby obtaining 25 vector values. Will be calculated.

図26のS903でYESと判定された場合、又は、S904の処理の後、追跡先特徴点決定部205の処理は、S2601に遷移する。
S2601に進むと、追跡先特徴点決定部205の領域判定部720は、S901で算出された追跡先特徴点座標が、図25の非追跡領域区分2506内に侵入したか否かを判定する。具体的には、領域判定部720は、追跡先特徴点の垂直座標の値が、非追跡領域区分2506の上端座標の値以上である場合に、非追跡領域区分2506内にあると判定(YES)してS2602に処理を進める。一方、領域判定部720は、追跡先特徴点の垂直座標が、非追跡領域区分2506の上端座標の値未満である場合、非追跡領域区分2506内にないと判定(NO)してS2603に処理を進める。
When it is determined YES in S903 of FIG. 26, or after the process of S904, the process of the tracking destination feature point determination unit 205 transitions to S2601.
In step S2601, the area determination unit 720 of the tracking destination feature point determination unit 205 determines whether the tracking destination feature point coordinates calculated in step S901 have entered the non-tracking area section 2506 in FIG. Specifically, the area determination unit 720 determines that the vertical coordinate value of the tracking destination feature point is within the non-tracking area section 2506 when the vertical coordinate value is equal to or greater than the upper end coordinate value of the non-tracking area section 2506 (YES) ) And the process proceeds to S2602. On the other hand, if the vertical coordinate of the tracking destination feature point is less than the value of the upper end coordinate of the non-tracking area segment 2506, the area determination unit 720 determines that it is not within the non-tracking area segment 2506 (NO), and processing in S2603 To proceed.

S2602に進んだ場合、新規特徴点補填部721は、S2601で非追跡領域区分2506内にあると判定された追跡先特徴点座標を破棄し、新規特徴点算出部202にて算出された新規特徴点座標に置き換える。なお、追跡先特徴点決定部205は、削除された追跡先特徴点座標を、現フレームにおいて一番初めに新規特徴点が算出された位置の特徴点抽出グリッドの該当位置で算出された新規特徴点座標により置き換えてもよい。S2602の後、追跡先特徴点決定部205の処理は、S2603に遷移する。   When the process proceeds to S2602, the new feature point compensation unit 721 discards the tracking destination feature point coordinates determined to be in the non-tracking area section 2506 in S2601, and the new feature point calculated by the new feature point calculation unit 202 Replace with point coordinates. The tracking destination feature point determination unit 205 uses the deleted tracking destination feature point coordinates at the corresponding position in the feature point extraction grid at the position where the new feature point is calculated first in the current frame. It may be replaced by point coordinates. After S2602, the process of the tracking destination feature point determination unit 205 transitions to S2603.

S2603に進むと、追跡先特徴点決定部205は、全ての追跡先特徴点座標の算出が終わったか否か判定する。そして、S2603において、追跡先特徴点決定部205は、全ての追跡先特徴点座標の算出が終わっていないと判定(NO)した場合には、S901に処理を戻して、S901以降の処理を行う。図25の例の場合、20個の追跡先特徴点座標の算出処理が行われるため、S901からステップ2603までの処理は20回反復されることになる。一方、追跡先特徴点決定部205は、S2603において、全ての追跡先特徴点座標の算出が終わったと判定(YES)した場合、図26のフローチャートの処理を終了する。   In step S2603, the tracking destination feature point determination unit 205 determines whether all the tracking destination feature point coordinates have been calculated. In S2603, if the tracking destination feature point determination unit 205 determines that all the tracking destination feature point coordinates have not been calculated (NO), the process returns to S901, and the processing after S901 is performed. . In the case of the example of FIG. 25, since the calculation processing of 20 tracking destination feature point coordinates is performed, the processing from S901 to Step 2603 is repeated 20 times. On the other hand, if the tracking destination feature point determination unit 205 determines in S2603 that all the tracking destination feature point coordinates have been calculated (YES), the processing of the flowchart in FIG.

以上が、第4の実施形態の追跡先特徴点決定部205における処理の流れである。本実施形態では、1フレーム分の処理を例に挙げて説明したが、前述した1フレーム分の処理は毎フレームに対して同様に行われ、毎フレームでベクトル値が算出される。   The above is the flow of processing in the tracking destination feature point determination unit 205 of the fourth embodiment. In the present embodiment, processing for one frame has been described as an example, but the processing for one frame described above is performed in the same manner for each frame, and a vector value is calculated for each frame.

第4の実施形態における非追跡領域区分や追跡領域区分は、画像処理装置の処理能力に応じて決めることができる。例えば、画像処理装置におけるテンプレートマッチング用画像の生成処理速度やテンプレートマッチングの処理速度を基に、画像処理装置が一定処理期間内に処理を完了できるように、非追跡領域区分や追跡領域区分の設定を行うことができる。   The non-tracking area section and the tracking area section in the fourth embodiment can be determined according to the processing capability of the image processing apparatus. For example, based on the template matching image generation processing speed and the template matching processing speed in the image processing apparatus, the non-tracking area section and the tracking area section are set so that the image processing apparatus can complete the processing within a certain processing period. It can be performed.

また、第4の実施形態では、非追跡領域区分を設けることでテンプレートマッチング処理期間を分散させるようにしており、非追跡領域区分は下部領域となされている。非追跡領域区分は、任意の領域に設定することも可能であり、例えば、フレームの画像範囲の上部領域、右部領域、左部領域、中央部領域等の、少なくとも一つに設定可能である。さらに、記非追跡領域区分は、フレームの画像範囲内に分散して配置されてもよい。
また、第4の実施形態において、補填する新規特徴点は、新規特徴点が補填される領域内のグリッドのうち特徴値が大きなものから優先的に補填してもよいし、分散し易いように上部領域のグリッドで算出したものから優先的に補填してもよい。
In the fourth embodiment, the template matching processing period is distributed by providing a non-tracking area section, and the non-tracking area section is a lower area. The non-tracking area section can be set to an arbitrary area, and can be set to at least one of an upper area, a right area, a left area, a center area, etc. of the image range of the frame, for example. . Furthermore, the non-tracking area sections may be distributed and arranged in the image range of the frame.
Further, in the fourth embodiment, new feature points to be compensated may be preferentially compensated from the grid with the largest feature value in the region in which the new feature points are compensated, or may be easily dispersed. You may preferentially compensate from what was calculated by the grid of the upper area.

第4の実施形態の画像処理装置は、追跡領域区分と非追跡領域区分とを設け、追跡領域区分では追跡先特徴点を基に動きベクトルを検出され、非追跡領域区分では新規特徴点を基に動きベクトルを検出する。これにより、第4の実施形態の画像処理装置は、追跡先特徴点がフレームの画像範囲内で偏在した場合でも、ベクトル検出性能の低下を防止しつつ、ベクトル検出を高速化し、所定期間内に処理を完了させることが可能となる。   The image processing apparatus according to the fourth embodiment includes a tracking area section and a non-tracking area section. In the tracking area section, a motion vector is detected based on the tracking destination feature point, and in the non-tracking area section, a new feature point is used. A motion vector is detected. As a result, the image processing apparatus according to the fourth embodiment speeds up the vector detection while preventing deterioration in vector detection performance even when the tracking destination feature points are unevenly distributed within the image range of the frame, and within a predetermined period. The process can be completed.

<第5の実施形態>
以下、第5の実施形態について説明する。
第5の実施形態の画像処理装置が適用されるデジタルカメラの構成は、図1に示した第1の実施形態のデジタルカメラと同様であるため、その図示と説明は省略する。
第5の実施形態の画像処理装置は、複数の特徴抽出グリッド群を第1の領域区分と第2の領域区分の少なくとも二つの領域区分に、区分けする。そして、第5の実施形態の画像処理装置は、追跡先特徴点のベクトル値と他のベクトル値を基に、追跡先特徴点が、何れの領域区分に属するかを判定し、その判定結果に応じてテンプレートマッチング処理に用いるテンプレートサイズ(大きさ)を決定する。
<Fifth Embodiment>
The fifth embodiment will be described below.
Since the configuration of the digital camera to which the image processing apparatus of the fifth embodiment is applied is the same as that of the digital camera of the first embodiment shown in FIG. 1, its illustration and description are omitted.
The image processing apparatus according to the fifth embodiment divides a plurality of feature extraction grid groups into at least two area sections, a first area section and a second area section. Then, the image processing apparatus according to the fifth embodiment determines to which region section the tracking destination feature point belongs based on the vector value of the tracking destination feature point and other vector values, and the determination result Accordingly, the template size (size) used for the template matching process is determined.

第5の実施形態の画像処理部104のベクトル検出部の構成は、例えば前述した第2の実施形態の図14に示したものと同様であるため、その図示と説明は省略する。また、第5の実施形態のベクトル検出部における処理のフローチャートは、前述した図7のフローチャートと概ね同様であり、また前述の図8、図9についても前述同様であるためそれらの図示と説明は省略する。   Since the configuration of the vector detection unit of the image processing unit 104 of the fifth embodiment is the same as that shown in FIG. 14 of the second embodiment described above, for example, its illustration and description are omitted. In addition, the flowchart of the processing in the vector detection unit of the fifth embodiment is almost the same as the flowchart of FIG. 7 described above, and also the above-described FIG. 8 and FIG. Omitted.

図28は、第5の実施形態におけるマッチング処理部203の概略構成を示した図である。図28に示すように、第5の実施形態のマッチング処理部203は、領域区分部2801、カウント部2802、サイズ変更部2803、推定部2804、処理実行部2805を有する。図29は、第5の実施形態のマッチング処理部203におけるテンプレートマッチング処理の流れを示すフローチャートである。図30(a)、図30(b)は、マッチング処理部203内の領域区分部2801の処理の説明に用いる図である。図31(a)、図31(b)は、マッチング処理部203内のサイズ変更部2803と推定部2804の処理の説明に用いる図である。   FIG. 28 is a diagram illustrating a schematic configuration of the matching processing unit 203 according to the fifth embodiment. As shown in FIG. 28, the matching processing unit 203 according to the fifth embodiment includes an area dividing unit 2801, a counting unit 2802, a size changing unit 2803, an estimating unit 2804, and a process executing unit 2805. FIG. 29 is a flowchart showing the flow of template matching processing in the matching processing unit 203 of the fifth embodiment. FIG. 30A and FIG. 30B are diagrams used for explaining the processing of the area sorting unit 2801 in the matching processing unit 203. FIG. 31A and FIG. 31B are diagrams used for explaining the processing of the size changing unit 2803 and the estimation unit 2804 in the matching processing unit 203.

以下、図28から図31を参照しながら、第5の実施形態のマッチング処理部203における構成と処理の概要について説明する。
第5の実施形態において、第2のRDDMAC222からは、前述したサーチ領域画像データ253、テンプレート領域画像データ254とともに、グリッド座標情報252も読み出されて、マッチング処理部203にも送られる。
Hereinafter, the configuration and processing outline of the matching processing unit 203 according to the fifth embodiment will be described with reference to FIGS. 28 to 31.
In the fifth embodiment, the grid coordinate information 252 is read from the second RDDMAC 222 together with the search area image data 253 and the template area image data 254 described above, and is also sent to the matching processing unit 203.

マッチング処理部203の領域区分部2801は、S2901の処理として、現フレームの複数の特徴抽出グリッドを、第1の領域区分と第2の領域区分の少なくとも二つの領域区分に、区分けする。具体的には、領域区分部2801は、現フレームのグリッド座標情報を基に、それぞれ特徴抽出グリッドが属する領域区分を算出する。S2901の後、マッチング処理部203の処理は、S2902に遷移する。   The area classification unit 2801 of the matching processing unit 203 divides the plurality of feature extraction grids of the current frame into at least two area classifications of the first area classification and the second area classification as processing of S2901. Specifically, the region segmentation unit 2801 calculates the region segment to which each feature extraction grid belongs based on the grid coordinate information of the current frame. After S2901, the processing of the matching processing unit 203 transitions to S2902.

ここで、図30(a)、図30(b)を用いて、領域区分部2801における領域区分の算出設定方法について具体的に説明する。図30(a)は、現フレームを水平方向に5分割、垂直方向に5分割して計25個のグリッドに区切った場合の画像読み出し順序を示す概念図である。また図30(a)に示すように、現フレームの画像読み出しは、図中の矢印に示すようにラスタスキャン方式により行われる。図30(b)は、ラスタスキャン方式において、25個の各グリッドに対して割り当てられる領域区分を示す概念図である。領域区分部2801は、図30(b)の下端より上側の2行分の特徴抽出グリッド群(ラスタスキャンの後半部)を第1の領域区分として設定する。すなわち、第1の領域区分は、前記動きベクトルの検出に使用される画像の生成が後に行われる領域区分であり、言い換えると画像読み出し順の終盤に読み出しが行われる領域区分である。また、領域区分部2801は、図30(b)の上端より下側の3行分の特徴抽出グリッド群(ラスタスキャンの前半部)を第2の領域区分として設定する。すなわち、第2の領域区分は、前記動きベクトルの検出に使用される画像の生成が先に後に行われる領域区分であり、言い換えると画像読み出し順の初期に読み出しが行われる領域区分である。なお、図30(b)の例では、下端より上側の2行分の特徴抽出グリッド群を第1の領域区分としたが、これには限定されず、任意の領域を第1の領域区分、第2の領域区分に設定することも可能である。   Here, the region segment calculation setting method in the region segmentation unit 2801 will be specifically described with reference to FIGS. FIG. 30 (a) is a conceptual diagram showing the image reading order when the current frame is divided into five grids in the horizontal direction and five in the vertical direction. Further, as shown in FIG. 30A, image reading of the current frame is performed by a raster scan method as indicated by an arrow in the figure. FIG. 30B is a conceptual diagram showing the area divisions assigned to each of the 25 grids in the raster scan method. The area division unit 2801 sets the feature extraction grid group (second half of the raster scan) for two rows above the lower end of FIG. 30B as the first area division. That is, the first area segment is an area segment where an image used for detection of the motion vector is generated later. In other words, the first area segment is an area segment where reading is performed at the end of the image reading order. In addition, the area segmenting unit 2801 sets the feature extraction grid group (the first half of the raster scan) for three rows below the upper end of FIG. 30B as the second area segment. That is, the second region segment is a region segment where the image used for the detection of the motion vector is first generated later, in other words, a region segment where reading is performed at the beginning of the image reading order. In the example of FIG. 30B, the feature extraction grid group for two rows above the lower end is set as the first area section. However, the present invention is not limited to this, and an arbitrary area is defined as the first area section, It is also possible to set the second area section.

S2902に処理に進むと、マッチング処理部203は、テンプレートマッチング処理対象となっているテンプレート領域画像データが属している特徴抽出グリッドが、第1の領域区分内の特徴抽出グリッドであるか否かを判定する。マッチング処理部203は、第1の領域区分でないと判別(NO)した場合には、現状のテンプレート領域画像データを、サイズ変更部2803を介して処理実行部2805に送る。その後、マッチング処理部203の処理はS2909に遷移する。一方、マッチング処理部203は、S2902にて第1の領域区分であると判別(YES)した場合には、S2903に処理を進める。なお、特徴抽出グリッドが第1の領域区分か否かの判定は、図1のCPU112により行われてもよい。   In step S2902, the matching processing unit 203 determines whether or not the feature extraction grid to which the template region image data that is the template matching processing target belongs is the feature extraction grid in the first region section. judge. If the matching processing unit 203 determines that it is not the first region section (NO), it sends the current template region image data to the processing execution unit 2805 via the size changing unit 2803. Thereafter, the processing of the matching processing unit 203 transitions to S2909. On the other hand, if the matching processing unit 203 determines in S2902 that the region is the first area division (YES), the process proceeds to S2903. Note that the determination of whether or not the feature extraction grid is the first region section may be performed by the CPU 112 in FIG.

マッチング処理部203のカウント部2802は、グリッドごとに追跡先特徴点を計数するカウンタである。S2903の処理に進んだ場合、カウント部2802は、現フレームのグリッド座標情報から、該当するグリッド内の追跡先特徴点を計数してカウンタ値を更新する。S2903の後、マッチング処理部203の処理はS2904に遷移する。   The counting unit 2802 of the matching processing unit 203 is a counter that counts tracking destination feature points for each grid. When the processing proceeds to S2903, the counting unit 2802 counts the tracking destination feature points in the corresponding grid from the grid coordinate information of the current frame, and updates the counter value. After S2903, the processing of the matching processing unit 203 transitions to S2904.

S2904に進むと、マッチング処理部203は、図1のROM109内に格納されている所定の閾値を用い、カウント部2802によりグリッド内で計数された追跡先特徴点数が所定の閾値を超えるか否かを判断する。マッチング処理部203は、グリッド内の追跡先特徴点数が閾値を超えないと判定(NO)した場合には、サイズ変更部2803を介して、現状のテンプレート領域画像データを処理実行部2805に送った後、S2909に処理を進める。一方、マッチング処理部203は、グリッド内の追跡先特徴点数が閾値を超えると判定(YES)した場合には、S2905に処理を進める。なお、グリッド内の追跡先特徴点数が閾値を超えるか否かの判定は、図1のCPU112により行われてもよい。また、閾値は、予めグリッド毎に設定されており、撮影条件などに応じて適宜更新可能となされている。なお、撮影条件などに応じた閾値の更新は、図1のCPU112により行われる。   In S2904, the matching processing unit 203 uses a predetermined threshold value stored in the ROM 109 of FIG. 1, and determines whether the number of tracking destination feature points counted in the grid by the counting unit 2802 exceeds the predetermined threshold value. Judging. If the matching processing unit 203 determines that the number of tracking destination feature points in the grid does not exceed the threshold (NO), the matching processing unit 203 sends the current template region image data to the processing execution unit 2805 via the size changing unit 2803. Then, the process proceeds to S2909. On the other hand, if the matching processing unit 203 determines that the number of tracking destination feature points in the grid exceeds the threshold (YES), the matching processing unit 203 advances the process to S2905. Note that the CPU 112 in FIG. 1 may determine whether or not the number of tracking destination feature points in the grid exceeds a threshold value. In addition, the threshold value is set for each grid in advance, and can be updated as appropriate according to shooting conditions and the like. Note that the threshold value is updated according to the shooting conditions and the like by the CPU 112 in FIG.

S2905に進むと、マッチング処理部203は、入力されたテンプレート領域画像データのテンプレートサイズが、予め決められた最少サイズか否かを判定する。マッチング処理部203は、テンプレートサイズが最少サイズであると判定(YES)した場合、所定期間内に処理を完了させることはできないと判断して、図29のフローチャートの処理を終了する。一方、マッチング処理部203は、テンプレートサイズが最少サイズではないと判定(NO)場合にはS2906に処理を進める。なお、テンプレートサイズが予め決められた最少サイズか否かの判断は、CPU112により行われてもよい。   In step S2905, the matching processing unit 203 determines whether or not the template size of the input template area image data is a predetermined minimum size. When it is determined that the template size is the minimum size (YES), the matching processing unit 203 determines that the process cannot be completed within a predetermined period, and ends the process of the flowchart of FIG. On the other hand, if it is determined that the template size is not the minimum size (NO), the matching processing unit 203 advances the process to S2906. Note that the CPU 112 may determine whether or not the template size is a predetermined minimum size.

S2906に進むと、サイズ変更部2803は、入力されたテンプレート領域画像データのサイズ(つまりテンプレートの大きさ)を縮小し、その縮小したテンプレート領域画像データを推定部2804に出力する。S2906の後、マッチング処理部203の処理はS2907に遷移する。   In step S2906, the size changing unit 2803 reduces the size of the input template area image data (that is, the size of the template), and outputs the reduced template area image data to the estimation unit 2804. After S2906, the processing of the matching processing unit 203 transitions to S2907.

図31(a)を用いて、サイズ変更部2803におけるテンプレートサイズの変更処理について説明する。図31(a)はテンプレートサイズの例を表した図である。本実施形態においてテンプレートマッチングで使用するテンプレート領域は例えば正方形であり、図31(a)の例では1辺がn、2n、3n(nは複数の画素数)となる計3種類をサイズ例に挙げている。サイズ変更部2803は、入力されたテンプレート領域画像データが1辺3nのテンプレート領域である場合、S2907において、テンプレート領域の中心に対して上下左右の領域をトリミングして1辺2nのテンプレート領域画像に縮小する。なお、サイズ変更部2803は、1辺3nのテンプレート領域を1辺nのテンプレート領域画像に縮小してもよい。   A template size changing process in the size changing unit 2803 will be described with reference to FIG. FIG. 31A shows an example of the template size. In this embodiment, the template region used for template matching is, for example, a square. In the example of FIG. 31A, three types with one side of n, 2n, and 3n (n is the number of pixels) are used as size examples. Cite. If the input template area image data is a template area having one side of 3n, the size changing unit 2803 trims the upper, lower, left, and right areas with respect to the center of the template area in step S2907 to obtain a template area image having one side of 2n. to shrink. Note that the size changing unit 2803 may reduce a template area having one side of 3n to a template area image having one side of n.

S2907の処理に進むと、推定部2804は、入力されたテンプレート領域画像のサイズを基に、処理時間を推定するための処理時間係数を算出する。S2907の後、マッチング処理部203の処理はS2908に遷移する。   In step S2907, the estimation unit 2804 calculates a processing time coefficient for estimating the processing time based on the size of the input template area image. After S2907, the processing of the matching processing unit 203 transitions to S2908.

図31(b)を用いて、推定部2804における時間算出の処理について説明する。図31(b)は、推定部2804における処理時間係数算出例の説明に用いる図である。本実施形態においてテンプレート領域は、図31(a)に示したように正方形であり、図31(b)のn、2n、3nはテンプレート領域の1辺のサイズを表している。また、図31(b)のSAD演算量は、テンプレートマッチングで相関値を算出する際の演算量を示しており、SAD演算は前述した式(3)により行われる。相関値算出ではテンプレート領域内の全画素値に対する演算が行われるため、テンプレートサイズの1辺がn、2n、3nのように大きくなるにつれて、SAD演算量は、図31(b)のn、4n、9nで表されるように増加する。また、図31(b)の処理時間係数は、テンプレート領域の1辺のサイズがnの場合のテンプレートマッチング処理の処理時間係数を1として表している。したがって、テンプレート領域の1辺がn、2n、3nのように大きくなるにつれて、処理時間係数は1、4、9のように多く(時間が長く)なる。一方、サイズ変更部2803よりテンプレート領域が例えば1辺3nのサイズから1辺nのサイズに変更されたとすると、テンプレートマッチング処理の処理時間係数は1から9に減り、処理時間が1/9に短縮されることになる。   The time calculation process in the estimation unit 2804 will be described with reference to FIG. FIG. 31B is a diagram used for explaining an example of processing time coefficient calculation in the estimation unit 2804. In the present embodiment, the template area is a square as shown in FIG. 31A, and n, 2n, and 3n in FIG. 31B represent the size of one side of the template area. Further, the SAD calculation amount in FIG. 31B indicates the calculation amount when the correlation value is calculated by template matching, and the SAD calculation is performed by the above-described equation (3). In the correlation value calculation, calculation is performed on all the pixel values in the template region. Therefore, as one side of the template size increases as n, 2n, and 3n, the SAD calculation amount becomes n, 4n in FIG. , 9n. In addition, the processing time coefficient in FIG. 31B represents the processing time coefficient of the template matching process when the size of one side of the template region is n as 1. Therefore, as one side of the template region becomes larger as n, 2n, 3n, the processing time coefficient becomes larger (longer) as 1, 4, 9, and so on. On the other hand, if the template area is changed from the size of one side 3n to the size of one side n by the size changing unit 2803, the processing time coefficient of the template matching process is reduced from 1 to 9, and the processing time is reduced to 1/9. Will be.

S2908の処理に進むと、マッチング処理部203は、推定部2804にて算出された処理時間係数を基に、追跡先特徴点を中心としたテンプレートマッチングの処理が所定の時間内(1フレーム期間内)に終了するか否かを判断する。マッチング処理部203は、所定の時間内に処理が終了すると判断(YES)した場合、サイズ変更部2803にて縮小されたテンプレート領域画像データを、処理実行部2805に送った後、S2909に処理を進める。一方、マッチング処理部203は、所定の時間内に終了しないと判断(NO)した場合には、更にテンプレートサイズを縮小する処理を継続するために、S2905に処理を戻す。すなわち、S2905からS2908までで行われるテンプレートサイズの変更の処理は、テンプレートマッチングに要する処理時間が1フレーム期間のような所定の時間に収まるようになるまで繰り返される。なお、テンプレートマッチングの処理が所定の時間内に終了するか否かの判断は、CPU112により行われてもよい。   When the processing proceeds to S2908, the matching processing unit 203 performs template matching processing centered on the tracking destination feature point within a predetermined time (within one frame period) based on the processing time coefficient calculated by the estimation unit 2804. ) To determine whether or not to end. If the matching processing unit 203 determines that the processing is completed within a predetermined time (YES), the template region image data reduced by the size changing unit 2803 is sent to the processing execution unit 2805, and the process is performed in S2909. Proceed. On the other hand, if the matching processing unit 203 determines that the process does not end within the predetermined time (NO), the matching processing unit 203 returns the process to S2905 to continue the process of further reducing the template size. That is, the template size change processing performed in steps S2905 to S2908 is repeated until the processing time required for template matching falls within a predetermined time such as one frame period. Note that the CPU 112 may determine whether or not the template matching process is completed within a predetermined time.

S2909の処理に進むと、処理実行部2805は、入力されたテンプレート領域画像データとサーチ領域画像データとを用いて相関値を算出し、その相関値を基に動きベクトルを検出する。そして、マッチング処理部203は、その検出した動きベクトルのベクトル値情報と相関値情報とを、前述の精度判定部204に出力する。その後、マッチング処理部203は、図29のフローチャートの処理を終了する。   In step S2909, the process execution unit 2805 calculates a correlation value using the input template area image data and search area image data, and detects a motion vector based on the correlation value. Then, the matching processing unit 203 outputs the detected vector value information and correlation value information of the motion vector to the accuracy determination unit 204 described above. Thereafter, the matching processing unit 203 ends the process of the flowchart of FIG.

以上が、第5の実施形態のマッチング処理部203における処理の流れである。本実施形態では、1フレーム分の処理を例に挙げて説明したが、前述した1フレーム分の処理は毎フレームに対して同様に行われ、毎フレームでベクトル値が算出される。   The above is the flow of processing in the matching processing unit 203 of the fifth embodiment. In the present embodiment, processing for one frame has been described as an example, but the processing for one frame described above is performed in the same manner for each frame, and a vector value is calculated for each frame.

以上説明したように、第5の実施形態の画像処理装置は、サイズ変更部2803によりテンプレート領域のサイズを縮小することで前述した相関値算出領域を縮小することにより、SAD計算量を削減する。これにより、第5の実施形態の画像処理装置は、1フレームの期間内にテンプレートマッチング処理を完了することができるようになる。したがって、第5の実施形態の画像処理装置は、追跡先の特徴点がフレームの画像範囲内で偏在した場合でも、ベクトル検出性能の低下を防止しつつ、ベクトル検出を高速化し、所定期間内に処理を完了させることが可能となる。   As described above, the image processing apparatus according to the fifth embodiment reduces the SAD calculation amount by reducing the above-described correlation value calculation region by reducing the size of the template region by the size changing unit 2803. As a result, the image processing apparatus according to the fifth embodiment can complete the template matching process within one frame period. Therefore, the image processing apparatus according to the fifth embodiment speeds up vector detection while preventing deterioration in vector detection performance even when feature points of tracking destinations are unevenly distributed within the image range of the frame, and within a predetermined period. The process can be completed.

<その他の実施形態>
本発明は、上述の実施形態の1以上の機能を実現するプログラムを、ネットワーク又は記憶媒体を介してシステム又は装置に供給し、そのシステム又は装置のコンピュータにおける1つ以上のプロセッサがプログラムを読出し実行する処理でも実現可能である。また、1以上の機能を実現する回路(例えば、ASIC)によっても実現可能である。
<Other embodiments>
The present invention supplies a program that realizes one or more functions of the above-described embodiments to a system or apparatus via a network or a storage medium, and one or more processors in the computer of the system or apparatus read and execute the program This process can be realized. It can also be realized by a circuit (for example, ASIC) that realizes one or more functions.

上述の実施形態は、何れも本発明を実施するにあたっての具体化の例を示したものに過ぎず、これらによって本発明の技術的範囲が限定的に解釈されてはならないものである。即ち、本発明は、その技術思想、又はその主要な特徴から逸脱することなく、様々な形で実施することができる。   The above-described embodiments are merely examples of implementation in carrying out the present invention, and the technical scope of the present invention should not be construed as being limited thereto. That is, the present invention can be implemented in various forms without departing from the technical idea or the main features thereof.

104:画像処理部、107:DRAM、112:CPU、221:第1のRDDMAC、201:マッチング用画像生成部、202:新規特徴点算出部、203:マッチング処理部、204:精度判定部、205:追跡先特徴点決定部、206:SRAM、222:第2のRDDMAC、231:WRDMAC   104: Image processing unit, 107: DRAM, 112: CPU, 221: First RDDMAC, 201: Image generation unit for matching, 202: New feature point calculation unit, 203: Matching processing unit, 204: Accuracy determination unit, 205 : Tracking destination feature point determination unit, 206: SRAM, 222: second RDDMAC, 231: WRDMAC

Claims (30)

フレームの画像を複数の領域に分割する分割手段と、
前記複数に分割された各領域内で画像の特徴点を抽出する抽出手段と、
前記特徴点を基に動きベクトルを検出する検出手段と、
前フレームから検出された前記動きベクトルの値と特徴点とを基に、次のフレームの動きベクトル検出に用いられる追跡先特徴点を算出する算出手段と、
前記追跡先特徴点が予め定めた条件に該当する場合に、前記追跡先特徴点の少なくとも一部を破棄して、前記抽出手段にて抽出された新規特徴点を追跡先特徴点として補填する補填手段と、
を有することを特徴とする画像処理装置。
A dividing means for dividing the frame image into a plurality of regions;
Extraction means for extracting feature points of an image in each of the divided areas;
Detecting means for detecting a motion vector based on the feature points;
Calculation means for calculating a tracking destination feature point used for motion vector detection of the next frame based on the value of the motion vector and the feature point detected from the previous frame;
Compensation for discarding at least a part of the tracking destination feature point and supplementing the new feature point extracted by the extraction unit as the tracking destination feature point when the tracking destination feature point satisfies a predetermined condition Means,
An image processing apparatus comprising:
前記分割された複数の領域を計数領域区分と補填領域区分とに区分けする区分手段と、
前記計数領域区分のなかの前記追跡先特徴点の数を計数する計数手段と、をさらに有し、
前記補填手段は、前記計数領域区分のなかの前記追跡先特徴点の数が所定の設定数を超えた場合、前記計数領域区分のなかで追跡先特徴点を破棄して、前記抽出手段にて抽出された新規特徴点を追跡先特徴点として前記補填領域区分のなかに補填することを特徴とする請求項1に記載の画像処理装置。
A dividing means for dividing the plurality of divided areas into a counting area section and a compensation area section;
Counting means for counting the number of the tracking destination feature points in the counting area section,
When the number of the tracking destination feature points in the counting area section exceeds a predetermined number, the compensation means discards the tracking destination feature points in the counting area section, and the extracting means The image processing apparatus according to claim 1, wherein the extracted new feature point is compensated in the compensation region section as a tracking destination feature point.
前記補填手段は、前記計数領域区分のなかで前記設定数を超えた数の追跡先特徴点を破棄し、前記破棄された追跡先特徴点の数に応じた前記新規特徴点を前記補填領域区分のなかに補填することを特徴とする請求項2に記載の画像処理装置。   The compensation means discards the number of tracking destination feature points exceeding the set number in the counting area section, and sets the new feature points according to the number of the discarded tracking destination feature points to the compensation area section. The image processing apparatus according to claim 2, wherein the image processing apparatus compensates for the above. 前記区分手段は、前記動きベクトルの検出に使用される画像の生成が先に行われる領域区分を、前記補填領域区分として設定することを特徴とする請求項2または3に記載の画像処理装置。   The image processing apparatus according to claim 2, wherein the segmentation unit sets, as the compensation region segment, a region segment in which an image used for detecting the motion vector is generated first. 前記区分手段は、前記動きベクトルの検出で使用される画像の生成が前記補填領域区分よりも後に行われる領域区分を、前記計数領域区分として設定することを特徴とする請求項4に記載の画像処理装置。   5. The image according to claim 4, wherein the segmentation unit sets, as the count region segment, a region segment in which generation of an image used for detection of the motion vector is performed after the compensation region segment. Processing equipment. 前記動きベクトルの検出に使用される画像の生成はラスタスキャン順に行われることを特徴とする請求項4または5に記載の画像処理装置。   6. The image processing apparatus according to claim 4, wherein generation of an image used for detecting the motion vector is performed in a raster scan order. 前記補填手段は、前記破棄の対象となる追跡先特徴点を、前記計数領域区分のなかの複数の追跡先特徴点のうち特徴値が低い順に選定するすることを特徴とする請求項2から6の何れか1項に記載の画像処理装置。   7. The compensation means selects the tracking destination feature points to be discarded as a plurality of tracking destination feature points in the counting area section in ascending order of feature values. The image processing apparatus according to any one of the above. 前記補填手段は、前記補填の対象となる新規特徴点を、前記補填領域区分のなかの複数の新規特徴点のうち特徴値が高い順に選定することを特徴とする請求項2から7の何れか1項に記載の画像処理装置。   The said compensation means selects the new feature point used as the object of the said compensation from the several new feature point in the said compensation area | region division in order with a high feature value, The any one of Claim 2 to 7 characterized by the above-mentioned. The image processing apparatus according to item 1. 前記抽出された特徴点を基に追跡範囲を設定する範囲設定手段を、さらに有し、
前記算出手段は、前記追跡範囲のなかから前記追跡先特徴点を算出し、
前記補填手段は、前記算出した前記追跡先特徴点が前記追跡範囲を外れる場合、前記追跡範囲から外れた追跡先特徴点を破棄して、前記追跡範囲のなかで前記抽出手段にて抽出された新規特徴点を追跡先特徴点として前記追跡範囲のなかに補填することを特徴とする請求項1に記載の画像処理装置。
A range setting means for setting a tracking range based on the extracted feature points;
The calculation means calculates the tracking destination feature point from the tracking range,
When the calculated tracking destination feature point is out of the tracking range, the compensation unit discards the tracking destination feature point outside the tracking range and is extracted by the extraction unit within the tracking range. The image processing apparatus according to claim 1, wherein a new feature point is compensated in the tracking range as a tracking destination feature point.
前記範囲設定手段は、前記フレームの画像の読み出し順序の設定に応じて、前記追跡範囲を設定することを特徴とする請求項9に記載の画像処理装置。   The image processing apparatus according to claim 9, wherein the range setting unit sets the tracking range according to a setting of a reading order of the image of the frame. 前記範囲設定手段は、前記フレームの画像の読み出し順序の設定に応じて、前記追跡範囲を前記フレームの画像範囲よりも狭めるように設定することを特徴とする請求項10に記載の画像処理装置。   The image processing apparatus according to claim 10, wherein the range setting unit sets the tracking range to be narrower than the image range of the frame according to the setting of the reading order of the image of the frame. 前記範囲設定手段は、前記フレームの画像の読み出し順序の設定が、前記画像の水平方向への読み出し順序の設定である場合、前記水平方向への読み出し順序の設定に応じて、前記画像の垂直方向で前記追跡範囲を前記狭めるように設定することを特徴とする請求項11に記載の画像処理装置。   The range setting means, when the setting of the reading order of the image of the frame is the setting of the reading order of the image in the horizontal direction, in accordance with the setting of the reading order in the horizontal direction, The image processing apparatus according to claim 11, wherein the tracking range is set to be narrowed. 前記範囲設定手段は、前記フレームの画像の読み出し順序の設定が、前記画像の垂直方向への読み出し順序の設定である場合、前記垂直方向への読み出し順序の設定に応じて、前記画像の水平方向で前記追跡範囲を前記狭めるように設定することを特徴とする請求項11に記載の画像処理装置。   The range setting means, when the setting of the reading order of the image of the frame is the setting of the reading order of the image in the vertical direction, in accordance with the setting of the reading order in the vertical direction, The image processing apparatus according to claim 11, wherein the tracking range is set to be narrowed. 前記画像の読み出し順序の設定は、前記フレームの画像を撮像する撮像手段からの読み出し順序の設定であることを特徴とする請求項9から13の何れか1項に記載の画像処理装置。   The image processing apparatus according to claim 9, wherein the setting of the reading order of the image is a setting of a reading order from an imaging unit that picks up an image of the frame. 複数の追跡先特徴点間の距離を算出する距離算出手段を、さらに有し、
前記算出手段は、前記追跡先特徴点間で算出された前記距離に基づいて前記追跡先特徴点を算出し、
前記補填手段は、前記追跡先特徴点間で算出された前記距離が所定の閾値未満である場合に、前記距離が算出された2点の追跡先特徴点のうち一方を破棄し、前記抽出手段にて抽出された新規特徴点を追跡先特徴点として所定の領域区分のなかに補填することを特徴とする請求項1に記載の画像処理装置。
It further has a distance calculation means for calculating the distance between the plurality of tracking destination feature points,
The calculating means calculates the tracking destination feature point based on the distance calculated between the tracking destination feature points;
When the distance calculated between the tracking destination feature points is less than a predetermined threshold, the compensation means discards one of the two tracking destination feature points whose distances are calculated, and the extraction means The image processing apparatus according to claim 1, wherein the new feature point extracted in step (b) is supplemented in a predetermined area section as a tracking destination feature point.
前記破棄される追跡先特徴点は、前記算出された距離が前記閾値未満となっている2点の追跡先特徴点の、特徴値と座標位置との少なくとも一方に基づいて、決定されることを特徴とする請求項15に記載の画像処理装置。   The discarded tracking destination feature point is determined based on at least one of a feature value and a coordinate position of two tracking destination feature points whose calculated distance is less than the threshold. The image processing apparatus according to claim 15, characterized in that: 前記閾値は、前記動きベクトルを検出するのに用いる矩形領域の大きさに基づいて決定された値であることを特徴とする請求項15または16に記載の画像処理装置。   The image processing apparatus according to claim 15 or 16, wherein the threshold value is a value determined based on a size of a rectangular region used for detecting the motion vector. 前記閾値は、複数の追跡先特徴点の座標位置に基づいて決定された値であることを特徴とする請求項15または16に記載の画像処理装置。   The image processing apparatus according to claim 15, wherein the threshold value is a value determined based on coordinate positions of a plurality of tracking destination feature points. 前記分割された複数の領域を追跡領域区分と非追跡領域区分とに区分けする区分手段を、さらに有し、
前記検出手段は、前記追跡領域区分では前記追跡先特徴点に基づいて動きベクトルを検出し、前記非追跡領域区分では前記抽出手段にて抽出された新規特徴点に基づいて動きベクトルを算出し、
前記補填手段は、前記追跡先特徴点が前記非追跡領域区分のなかにある場合には前記追跡先特徴点を破棄して、前記抽出手段により抽出された前記新規特徴点を補填することを特徴とする請求項1に記載の画像処理装置。
A dividing means for dividing the plurality of divided areas into a tracking area section and a non-tracking area section;
The detection means detects a motion vector based on the tracking destination feature point in the tracking area section, and calculates a motion vector based on the new feature point extracted by the extraction means in the non-tracking area section,
The compensation means discards the tracking destination feature point when the tracking destination feature point is in the non-tracking area section, and compensates the new feature point extracted by the extraction means. The image processing apparatus according to claim 1.
前記補填手段は、前記追跡領域区分から前記抽出手段により抽出された前記新規特徴点を前記補填することを特徴とする請求項19に記載の画像処理装置。   The image processing apparatus according to claim 19, wherein the compensation unit compensates the new feature point extracted by the extraction unit from the tracking area section. 前記非追跡領域区分は、フレームの画像範囲の下部の領域、左部の領域、上部の領域、右部の領域の、少なくとも一つである、ことを特徴とする請求項19または20に記載の画像処理装置。   21. The non-tracking area segment is at least one of a lower area, a left area, an upper area, and a right area of an image range of a frame. Image processing device. 前記非追跡領域区分は、フレームの画像範囲内に分散して配置されることを特徴とする請求項19から21の何れか1項に記載の画像処理装置。   The image processing apparatus according to any one of claims 19 to 21, wherein the non-tracking area sections are distributed and arranged in an image range of a frame. 画像を複数の領域に分割する分割手段と、
前記複数に分割された各領域内で画像の特徴点を抽出する抽出手段と、
前記特徴点に基づくテンプレートマッチングにより動きベクトルを検出する検出手段と、
前フレームから検出された前記動きベクトルの値と特徴点とを基に、次のフレームの動きベクトル検出に用いられる追跡先特徴点を算出する算出手段と、
前記分割された複数の領域を第1の領域区分と第2の領域区分とに区分けする区分手段と、を有し、
前記検出手段は、前記追跡先特徴点が前記第1の領域区分と第2の領域区分の何れの領域区分に属するかに応じて、前記動きベクトルの検出のテンプレートマッチングに用いるテンプレートの大きさを決定することを特徴とする画像処理装置。
A dividing means for dividing the image into a plurality of regions;
Extraction means for extracting feature points of an image in each of the divided areas;
Detecting means for detecting a motion vector by template matching based on the feature points;
Calculation means for calculating a tracking destination feature point used for motion vector detection of the next frame based on the value of the motion vector and the feature point detected from the previous frame;
Dividing means for dividing the plurality of divided areas into a first area section and a second area section;
The detecting means determines a size of a template used for template matching for detection of the motion vector according to which of the first area section and the second area section the tracking destination feature point belongs to. An image processing apparatus characterized by determining.
前記区分手段は、
画像読み出し順の終盤に読み出しが行われる領域区分を、前記第1の領域区分として設定し、
画像読み出し順の初期に読み出しが行われる領域区分を、前記第2の領域区分として設定することを特徴とする請求項23に記載の画像処理装置。
The sorting means includes
An area segment that is read at the end of the image readout order is set as the first area segment,
24. The image processing apparatus according to claim 23, wherein an area section that is read out in an initial order of image reading is set as the second area section.
前記検出手段は、前記追跡先特徴点が前記第1の領域区分に属する場合に、前記テンプレートマッチングに用いるテンプレートの大きさを変更することを特徴とする請求項23または24に記載の画像処理装置。   25. The image processing apparatus according to claim 23, wherein the detection unit changes a size of a template used for the template matching when the tracking destination feature point belongs to the first region section. . 前記分割された領域ごとに追跡先特徴点の数を計数する計数手段を有し、
前記検出手段は、前記分割された領域の追跡先特徴点が前記第1の領域区分に属し、且つ、前記領域について計数された追跡先特徴点の数が所定の閾値を超えた場合に、テンプレートマッチングを用いるテンプレートの大きさを小さく変更することを特徴とする請求項24または25に記載の画像処理装置。
Counting means for counting the number of tracking destination feature points for each of the divided areas;
The detection means includes a template when a tracking destination feature point of the divided area belongs to the first area section and the number of tracking destination feature points counted for the area exceeds a predetermined threshold. The image processing apparatus according to claim 24, wherein the size of the template using matching is changed to be small.
ベクトル検出の処理時間を算出する時間算出手段を有し、
前記検出手段は、前記算出された処理時間が所定の時間内に収まるようになるまで前記テンプレートの大きさの変更を繰り返すことを特徴とする請求項23から26の何れか1項に記載の画像処理装置。
Having time calculation means for calculating the processing time of vector detection;
27. The image according to any one of claims 23 to 26, wherein the detection unit repeats changing the size of the template until the calculated processing time is within a predetermined time. Processing equipment.
フレームの画像を複数の領域に分割する分割工程と、
前記複数に分割された各領域内で画像の特徴点を抽出する抽出工程と、
前記特徴点を基に動きベクトルを検出する検出工程と、
前フレームから検出された前記動きベクトルの値と特徴点とを基に、次のフレームの動きベクトル検出に用いられる追跡先特徴点を算出する算出工程と、
前記追跡先特徴点が予め定めた条件に該当する場合に、前記追跡先特徴点の少なくとも一部を破棄して、前記抽出工程にて抽出された新規特徴点を追跡先特徴点として補填する補填工程と、
を有することを特徴とする画像処理装置の画像処理方法。
A division step of dividing the frame image into a plurality of regions;
An extraction step of extracting feature points of an image in each of the divided areas;
A detection step of detecting a motion vector based on the feature points;
A calculation step of calculating a tracking destination feature point used for motion vector detection of the next frame based on the value of the motion vector and the feature point detected from the previous frame;
Compensation for discarding at least a part of the tracking destination feature point and supplementing the new feature point extracted in the extraction step as the tracking destination feature point when the tracking destination feature point satisfies a predetermined condition Process,
An image processing method for an image processing apparatus, comprising:
画像を複数の領域に分割する分割工程と、
前記複数に分割された各領域内で画像の特徴点を抽出する抽出工程と、
前記特徴点に基づくテンプレートマッチングにより動きベクトルを検出する検出工程と、
前フレームから検出された前記動きベクトルの値と特徴点とを基に、次のフレームの動きベクトル検出に用いられる追跡先特徴点を算出する算出工程と、
前記分割された複数の領域を第1の領域区分と第2の領域区分とに区分けする区分工程と、を有し、
前記検出工程では、前記追跡先特徴点が前記第1の領域区分と第2の領域区分の何れの領域区分に属するかに応じて、前記動きベクトルの検出のテンプレートマッチングに用いるテンプレートの大きさを決定することを特徴とする画像処理装置の画像処理方法。
A division step of dividing the image into a plurality of regions;
An extraction step of extracting feature points of an image in each of the divided areas;
A detection step of detecting a motion vector by template matching based on the feature points;
A calculation step of calculating a tracking destination feature point used for motion vector detection of the next frame based on the value of the motion vector and the feature point detected from the previous frame;
A dividing step of dividing the plurality of divided areas into a first area section and a second area section;
In the detection step, a size of a template used for template matching for the detection of the motion vector is determined according to which of the first region segment and the second region segment the tracking destination feature point belongs to. An image processing method of an image processing apparatus characterized by determining.
コンピュータを、請求項1から27の何れか1項に記載の画像処理装置の各手段として機能させるためのプログラム。   A program for causing a computer to function as each unit of the image processing apparatus according to any one of claims 1 to 27.
JP2017136410A 2017-07-12 2017-07-12 Image processing apparatus, image processing method and program Pending JP2019020839A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017136410A JP2019020839A (en) 2017-07-12 2017-07-12 Image processing apparatus, image processing method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017136410A JP2019020839A (en) 2017-07-12 2017-07-12 Image processing apparatus, image processing method and program

Publications (1)

Publication Number Publication Date
JP2019020839A true JP2019020839A (en) 2019-02-07

Family

ID=65354737

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017136410A Pending JP2019020839A (en) 2017-07-12 2017-07-12 Image processing apparatus, image processing method and program

Country Status (1)

Country Link
JP (1) JP2019020839A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020253618A1 (en) * 2019-06-21 2020-12-24 苏宁云计算有限公司 Video jitter detection method and device
CN112465050A (en) * 2020-12-04 2021-03-09 广东拓斯达科技股份有限公司 Image template selection method, device, equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020253618A1 (en) * 2019-06-21 2020-12-24 苏宁云计算有限公司 Video jitter detection method and device
CN112465050A (en) * 2020-12-04 2021-03-09 广东拓斯达科技股份有限公司 Image template selection method, device, equipment and storage medium
CN112465050B (en) * 2020-12-04 2024-02-09 广东拓斯达科技股份有限公司 Image template selection method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
US9251589B2 (en) Depth measurement apparatus, image pickup apparatus, and depth measurement program
JP5980294B2 (en) Data processing apparatus, imaging apparatus, and data processing method
JP5794705B2 (en) Imaging apparatus, control method thereof, and program
KR101634562B1 (en) Method for producing high definition video from low definition video
JP6570296B2 (en) Image processing apparatus, image processing method, and program
JP6579868B2 (en) Image processing apparatus, imaging apparatus, image processing method, and program
US20210099646A1 (en) Method and Apparatus for Detecting Subject, Electronic Device, and Computer Readable Storage Medium
JP7032871B2 (en) Image processing equipment and image processing methods, programs, storage media
CN110866486B (en) Subject detection method and apparatus, electronic device, and computer-readable storage medium
US11836903B2 (en) Subject recognition method, electronic device, and computer readable storage medium
US9942477B2 (en) Image processing apparatus and method
JP2021086616A (en) Method for extracting effective region of fisheye image based on random sampling consistency
JP2019020839A (en) Image processing apparatus, image processing method and program
JP2019175112A (en) Image processing device, photographing device, image processing method, and program
US9842260B2 (en) Image processing apparatus and image processing method of performing image segmentation
JP6576179B2 (en) Image processing apparatus, image processing method, and program
US20140152862A1 (en) Image processing apparatus, image pickup apparatus, image pickup system, image processing method, and non-transitory computer-readable storage medium
US11847784B2 (en) Image processing apparatus, head-mounted display, and method for acquiring space information
JP2019021990A (en) Image processing apparatus, image processing method, and program
JP2019192048A (en) Imaging apparatus
CN107045724B (en) Markov judgment method for object moving direction under low resolution
JP2018180964A (en) Image processing apparatus and image processing method
JP2018072941A (en) Image processing device, image processing method, program, and storage medium
JP2020046744A (en) Image processing apparatus, background image generation method, and program
JP2018132946A (en) Parallax calculator