JP6452481B2 - Image processing apparatus and control method thereof - Google Patents

Image processing apparatus and control method thereof Download PDF

Info

Publication number
JP6452481B2
JP6452481B2 JP2015023544A JP2015023544A JP6452481B2 JP 6452481 B2 JP6452481 B2 JP 6452481B2 JP 2015023544 A JP2015023544 A JP 2015023544A JP 2015023544 A JP2015023544 A JP 2015023544A JP 6452481 B2 JP6452481 B2 JP 6452481B2
Authority
JP
Japan
Prior art keywords
image
subject
group
image processing
processing apparatus
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2015023544A
Other languages
Japanese (ja)
Other versions
JP2016146601A (en
Inventor
桂一 齊藤
桂一 齊藤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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 JP2015023544A priority Critical patent/JP6452481B2/en
Publication of JP2016146601A publication Critical patent/JP2016146601A/en
Application granted granted Critical
Publication of JP6452481B2 publication Critical patent/JP6452481B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Studio Devices (AREA)
  • Image Analysis (AREA)

Description

本発明は画像処理装置およびその制御方法に関し、特には複数の画像を合成するための技術に関する。   The present invention relates to an image processing apparatus and a control method thereof, and more particularly to a technique for synthesizing a plurality of images.

撮影範囲の重複した複数の画像を位置合わせして合成することにより、ノイズを低減した画像を取得したり、ダイナミックレンジを拡大した画像を取得したりする技術が知られている。このような画像合成技術において、合成する画像を幾何変換して基準画像と位置合わせする方法が知られており、アフィン変換や射影変換が代表的な幾何変換として用いられている。   A technique for acquiring an image with reduced noise or acquiring an image with an expanded dynamic range by aligning and synthesizing a plurality of images with overlapping shooting ranges is known. In such an image synthesis technique, a method of geometrically transforming an image to be synthesized and aligning it with a reference image is known, and affine transformation and projective transformation are used as typical geometric transformations.

幾何変換を規定する係数(幾何変換係数)は、合成する画像と基準画像の両方に含まれる被写体の動きの方向と大きさを表す複数の動きベクトルから算出することができる。画像間での被写体の移動は、手持ち撮影時のように撮影位置および/または撮影方向の変化によって画像全体に生じるものと、被写体自体が背景に対して移動することで生じるものに大別できる。そして、前者の移動を表す動きベクトルをグローバル動きベクトル、後者の移動を表す動きベクトルを動体の動きベクトルと呼ぶ。   A coefficient defining the geometric transformation (geometric transformation coefficient) can be calculated from a plurality of motion vectors representing the direction and magnitude of the motion of the subject included in both the image to be synthesized and the reference image. The movement of the subject between images can be broadly divided into those that occur in the entire image due to changes in the shooting position and / or shooting direction as in hand-held shooting, and those that occur when the subject itself moves relative to the background. The motion vector representing the former movement is called a global motion vector, and the motion vector representing the latter movement is called a moving object motion vector.

画像間で静止被写体を位置合わせするためには、グローバル動きベクトルのみで算出された幾何変換係数を用いる必要がある。また、移動被写体を位置合わせするためには、被写体毎に動体の動きベクトルから算出された幾何変換係数を用いる必要がある。   In order to align a stationary subject between images, it is necessary to use a geometric transformation coefficient calculated only by a global motion vector. Further, in order to align the moving subject, it is necessary to use a geometric transformation coefficient calculated from the motion vector of the moving object for each subject.

特許文献1には、グローバルな動きベクトルと、画像を複数のブロックに分割してブロックごとに算出したローカル動きベクトルとの一致度から、各ブロックが背景か移動被写体なのか判定し、位置合わせに用いる動きベクトルを決定する方法が開示されている。   In Patent Document 1, it is determined whether each block is a background or a moving subject from the degree of coincidence between a global motion vector and a local motion vector calculated for each block by dividing an image into a plurality of blocks. A method for determining a motion vector to use is disclosed.

特許文献2には、複数のテンプレートの各々について得られる動きベクトルの頻度分布を算出し、最大頻度の動きベクトルをグローバル動きベクトルと判定する方法が開示されている。   Patent Document 2 discloses a method of calculating a frequency distribution of motion vectors obtained for each of a plurality of templates and determining a motion vector having the maximum frequency as a global motion vector.

特開2012−142828号公報JP 2012-142828 A 特開2006−94560号公報JP 2006-94560 A

カメラの動きによる撮像画像内の被写体の移動量は被写体距離によって異なり、近い被写体ほど画像内での移動量は大きくなる。しかしながら、特許文献1や特許文献2では、グローバル動きベクトルの算出に被写体距離を考慮していないため、近距離の静止被写体に関する動きベクトルを移動被写体の動きベクトルと誤判定する可能性があった。   The amount of movement of the subject in the captured image due to the movement of the camera varies depending on the subject distance, and the closer the subject, the larger the amount of movement in the image. However, in Patent Literature 1 and Patent Literature 2, since the subject distance is not considered in the calculation of the global motion vector, there is a possibility that a motion vector related to a short-distance still subject is erroneously determined as a motion vector of a moving subject.

また、移動被写体が画像内で占める面積が大きいと動体の動きベクトルが支配的になるため、数の多い動体の動きベクトルがグローバル動きベクトルとして誤判定される可能性もあった。   In addition, since the motion vector of the moving object becomes dominant when the area occupied by the moving subject in the image is large, the motion vector of a large number of moving objects may be erroneously determined as a global motion vector.

本発明はこのような従来技術の課題に鑑み、被写体の距離を考慮することによって画像中の静止被写体と移動被写体とを精度よく判別することが可能な画像処理装置およびその制御方法を提供することを目的とする。   The present invention provides an image processing apparatus capable of accurately discriminating between a stationary subject and a moving subject in an image by considering the distance of the subject, and a method for controlling the same, in view of the problems of the prior art. With the goal.

上述の目的は、距離情報を用いて、画像の領域をグループ化するグループ化手段と、グループごとに、他の画像に対する動きを検出する検出手段と、動きの大きさを、特定の距離に基づいて正規化する正規化手段と、大きさが正規化された動きに基づいて、グループごとに、静止被写体の領域か移動被写体の領域かを判定する判定手段と、を有することを特徴とする画像処理装置によって達成される。   The above-described object is based on a specific distance based on a specific distance, a grouping unit that groups image regions using distance information, a detection unit that detects a motion relative to another image for each group, and a magnitude of the motion. And a normalizing unit that normalizes the image and a determination unit that determines, for each group, whether the region is a stationary subject region or a moving subject region based on a motion whose size is normalized. Achieved by processing equipment.

このような構成により本発明によれば、被写体の距離を考慮することによって画像中の静止被写体と移動被写体とを精度よく判別することが可能な画像処理装置およびその制御方法を提供することができる。   With such a configuration, according to the present invention, it is possible to provide an image processing apparatus capable of accurately discriminating between a stationary subject and a moving subject in an image by considering the distance of the subject, and a control method therefor. .

実施形態に係る画像処理装置の一例としてのデジタルカメラの機能構成例を示すブロック図1 is a block diagram illustrating a functional configuration example of a digital camera as an example of an image processing apparatus according to an embodiment; 図1の撮像部205の構成例を示す図The figure which shows the structural example of the imaging part 205 of FIG. 図1の距離情報算出部210の動作を説明するための図The figure for demonstrating operation | movement of the distance information calculation part 210 of FIG. 第1の実施形態に係る位置合わせ処理を説明するためのフローチャートFlowchart for explaining the alignment process according to the first embodiment. 第1の実施形態に係る位置合わせ処理を説明するためのフローチャートFlowchart for explaining the alignment process according to the first embodiment. 第1の実施形態を説明するための撮影シーンを示す図The figure which shows the imaging | photography scene for demonstrating 1st Embodiment. 第1の実施形態におけるグループ化処理を説明するための図The figure for demonstrating the grouping process in 1st Embodiment 実施形態における動きベクトルの算出処理を説明するための図The figure for demonstrating the calculation process of the motion vector in embodiment 第1の実施形態における代表動きベクトルと正規化代表動きベクトルの例を示す図The figure which shows the example of the representative motion vector and normalization representative motion vector in 1st Embodiment 実施形態における推定グローバル動きベクトルの生成処理を説明するための図The figure for demonstrating the production | generation process of the estimation global motion vector in embodiment 実施形態における動き判定処理を説明するための図The figure for demonstrating the motion determination process in embodiment 実施形態における再判定処理を説明するためのフローチャートFlowchart for explaining redetermination processing in the embodiment 実施形態における再判定処理を説明するための図The figure for demonstrating the redetermination process in embodiment 実施形態における、他の幾何変換係数から幾何変換係数を算出する方法の例を説明するための図The figure for demonstrating the example of the method of calculating a geometric transformation coefficient from the other geometric transformation coefficient in embodiment. 第2の実施形態を説明するための撮影シーンを示す図The figure which shows the imaging | photography scene for demonstrating 2nd Embodiment. 第2の実施形態に係る位置合わせ処理の動作を説明するためのフローチャートFlowchart for explaining the operation of the alignment processing according to the second embodiment. 第2の実施形態における1段目のグループ化処理を説明するための図The figure for demonstrating the grouping process of the 1st step | paragraph in 2nd Embodiment. 第2の実施形態における2段目のグループ化処理を説明するための図The figure for demonstrating the grouping process of the 2nd step | paragraph in 2nd Embodiment. 第2の実施形態における代表動きベクトルの例を示す図The figure which shows the example of the representative motion vector in 2nd Embodiment 第2の実施形態における正規化代表動きベクトルの例を示す図The figure which shows the example of the normalization representative motion vector in 2nd Embodiment.

●(第1の実施形態)
以下、図面を参照して本発明の例示的な実施形態について詳細に説明する。なお、ここでは被写体の距離情報を取得可能な画像処理装置の一例としての、撮像素子の各画素が複数の光電変換領域を有し、1度の撮影(露光)で複数の視差画像を取得可能な構成を有するデジタルカメラに本発明を適用した例を説明する。しかしながら、多眼カメラを用いるなど、他の方法で視差画像を取得してもよい。また、被写体の距離情報が取得できれば、必ずしも視差画像を用いなくてもよい。
● (first embodiment)
Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the drawings. Here, as an example of an image processing apparatus capable of acquiring subject distance information, each pixel of the image sensor has a plurality of photoelectric conversion regions, and a plurality of parallax images can be acquired by one photographing (exposure). An example in which the present invention is applied to a digital camera having various configurations will be described. However, the parallax image may be acquired by other methods such as using a multi-lens camera. Further, if the distance information of the subject can be acquired, the parallax image is not necessarily used.

さらに、本発明において撮像機能や被写体の距離情報を生成する機能は必須でない。例えば、画像データと、この画像データが表す画像中の被写体の距離情報とが対応付けて記憶された記憶装置から、合成を行う複数の画像データと、対応する被写体の距離情報とを取得する構成であってよい。距離情報は例えば距離画像、奥行き画像、デプスマップなどと呼ばれる形式の情報であってよい。   Furthermore, in the present invention, an imaging function and a function for generating subject distance information are not essential. For example, a configuration for acquiring a plurality of pieces of image data to be combined and corresponding subject distance information from a storage device in which image data and distance information of the subject in the image represented by the image data are stored in association with each other It may be. The distance information may be information in a format called a distance image, a depth image, a depth map, or the like.

図1は、本実施形態に係るデジタルカメラ200の機能構成例を示すブロック図である。
システム制御部201は例えばCPUであり、デジタルカメラ200が備える各ブロックの制御プログラムをROM202より読み出し、RAM203に展開して実行することにより各ブロックの動作を制御し、デジタルカメラ200の各種機能を実現する。
FIG. 1 is a block diagram illustrating a functional configuration example of a digital camera 200 according to the present embodiment.
The system control unit 201 is, for example, a CPU, reads out a control program for each block included in the digital camera 200 from the ROM 202, develops it in the RAM 203, and executes it to control the operation of each block and realize various functions of the digital camera 200 To do.

ROM202は、書き換え可能な不揮発性メモリであり、デジタルカメラ200が備える各ブロックの制御プログラムに加え、各ブロックの動作に必要なパラメータや、GUIデータ等を記憶する。また、射出瞳距離などのレンズ情報もROM202が記憶する。   The ROM 202 is a rewritable nonvolatile memory, and stores parameters necessary for the operation of each block, GUI data, and the like in addition to the control program for each block included in the digital camera 200. The ROM 202 also stores lens information such as the exit pupil distance.

RAM203は、書き換え可能な揮発性メモリであり、制御プログラムがロードされるほか、システム制御部201のワークエリアや、各ブロックから出力されたデータの一時的な記憶領域などとしても用いられる。   The RAM 203 is a rewritable volatile memory, and is used as a work area for the system control unit 201 and a temporary storage area for data output from each block in addition to loading a control program.

光学系204は、絞りおよびフォーカスレンズを含み、撮像部205に被写体像を形成する。撮像部205(撮像手段)は、例えばCCDやCMOSセンサ等の撮像素子であり、光学系204により形成された被写体像を、各画素で光電変換し、得られたアナログ画像信号をA/D変換部206に出力する。   The optical system 204 includes a stop and a focus lens, and forms a subject image on the imaging unit 205. The imaging unit 205 (imaging means) is an imaging element such as a CCD or a CMOS sensor, for example, photoelectrically converts the subject image formed by the optical system 204 at each pixel, and A / D converts the obtained analog image signal The data is output to the unit 206.

上述の通り、本実施形態のデジタルカメラ200は、複数の視差画像を一度の撮影(露光)で取得することができる。このようなカメラとしてはステレオカメラの様な多眼カメラを代表としてさまざまなものが知られているが、本実施形態では、撮像部205(撮像素子)が受光面上に光学系204の射出瞳を分割するマイクロレンズアレイ(以下、MLA)を備えている。そして、このような撮像素子で得られる複数の視差画像の位相差を検出することで、被写体の距離情報(奥行き情報)を得ることができる。また、視差画像を加算することで、通常の撮像画像も得ることができる。   As described above, the digital camera 200 of the present embodiment can acquire a plurality of parallax images by one shooting (exposure). Various cameras such as a stereo camera such as a stereo camera are known as such cameras. In this embodiment, the imaging unit 205 (imaging device) is placed on the light receiving surface of the exit pupil of the optical system 204. Is provided with a microlens array (hereinafter referred to as MLA). Then, by detecting the phase difference between a plurality of parallax images obtained by such an image sensor, distance information (depth information) of the subject can be obtained. Moreover, a normal captured image can also be obtained by adding parallax images.

A/D変換部206は、入力されたアナログ画像信号にA/D変換処理を適用し、得られたデジタル画像データを出力する。デジタル画像データは、例えばシステム制御部201がRAM203に記憶する。   The A / D conversion unit 206 applies A / D conversion processing to the input analog image signal, and outputs the obtained digital image data. For example, the system control unit 201 stores the digital image data in the RAM 203.

画像処理部207(画像処理手段)は、RAM203に記憶されている画像データに、ガンマ補正処理、ホワイトバランス調整処理や、色補間処理等の画像処理を適用する。なお、画像処理部207は、視差画像データを加算して通常画像を生成したり、必要に応じて画像データの符号化処理や復号処理も行ったりする。   An image processing unit 207 (image processing means) applies image processing such as gamma correction processing, white balance adjustment processing, and color interpolation processing to the image data stored in the RAM 203. Note that the image processing unit 207 generates a normal image by adding parallax image data, and performs encoding processing and decoding processing of image data as necessary.

記録媒体208は例えば着脱可能なメモリカード等であり、画像処理部207で処理された画像データやA/D変換部206が出力する画像データなどが、予め定められた形式の画像ファイルとして記録される。   The recording medium 208 is, for example, a removable memory card or the like, and image data processed by the image processing unit 207, image data output by the A / D conversion unit 206, and the like are recorded as an image file in a predetermined format. The

バス209は、各ブロックを、制御信号やデータを互いに通信可能に接続する。
距離情報算出部210(第4の算出手段)は画像処理部207で処理された視差画像データを読み込み、画像の各画素についての距離情報を算出する。距離情報算出部210の動作の詳細については後述する。
A bus 209 connects the blocks so that control signals and data can communicate with each other.
A distance information calculation unit 210 (fourth calculation unit) reads the parallax image data processed by the image processing unit 207 and calculates distance information for each pixel of the image. Details of the operation of the distance information calculation unit 210 will be described later.

変換係数算出部211は、基準画像データと、基準画像データに合成する画像データ(被合成画像データ)と、被合成画像データに対応する距離情報を取得する。そして、変換係数算出部211(グループ化手段)は、距離情報を用いて被合成画像内の被写体領域を抽出し、被写体領域をグループ化する。あるいは、変換係数算出部211は、被合成画像の領域を、距離範囲ごとのグループに分類する。変換係数算出部211(第1の算出手段)は、被写体グループごとに動きベクトルを算出し、被写体グループの被写体領域(被写体グループ領域)を基準画像に位置合わせするための幾何変換係数を、動きベクトルに基づいて算出する。   The conversion coefficient calculation unit 211 acquires reference image data, image data to be combined with the reference image data (combined image data), and distance information corresponding to the combined image data. Then, the conversion coefficient calculation unit 211 (grouping means) extracts subject areas in the synthesized image using the distance information, and groups the subject areas. Alternatively, the conversion coefficient calculation unit 211 classifies the region of the combined image into groups for each distance range. A conversion coefficient calculation unit 211 (first calculation unit) calculates a motion vector for each subject group, and uses a geometric conversion coefficient for aligning the subject region (subject group region) of the subject group with the reference image as a motion vector. Calculate based on

変換係数算出部211(第3の算出手段)はさらに、後述する変換係数判定部212が出力する判定情報を所得し、判定情報からグローバルな動きと判定された被写体グループ領域の動きベクトルのみを用い、画像全体に対する幾何変換係数を算出する。   The conversion coefficient calculation unit 211 (third calculation unit) further obtains determination information output from the conversion coefficient determination unit 212 described later, and uses only the motion vector of the subject group area determined as global movement from the determination information. The geometric transformation coefficient for the entire image is calculated.

変換係数判定部212(生成手段)は変換係数算出部211が算出した幾何変換係数を用いて、被写体グループごとに代表動きベクトルを生成する。そして、変換係数判定部212(正規化手段および推定手段)は、代表動きベクトルを特定の距離によって正規化し、被写体距離に依存しない動きに変換してから、基準画像と被合成画像のグローバルな動きを表す動きベクトルを推定する。そして、変換係数判定部212(判定手段)は、被写体グループ領域の動きがグローバルな動き(静止被写体)か、個別の動き(移動被写体)かを判定し、判定結果を表す判定情報を被写体グループごとに出力する。変換係数算出部211と、変換係数判定部212は、グループごとに、他の画像に対する動きを検出する検出手段を構成する。   The conversion coefficient determination unit 212 (generation unit) generates a representative motion vector for each subject group using the geometric conversion coefficient calculated by the conversion coefficient calculation unit 211. Then, the transform coefficient determination unit 212 (normalization unit and estimation unit) normalizes the representative motion vector by a specific distance and converts it into a motion that does not depend on the subject distance, and then global motion of the reference image and the synthesized image. Is estimated. Then, the conversion coefficient determination unit 212 (determination unit) determines whether the movement of the subject group area is a global movement (a stationary subject) or an individual movement (a moving subject), and sets determination information representing the determination result for each subject group. Output to. The conversion coefficient calculation unit 211 and the conversion coefficient determination unit 212 constitute detection means for detecting a motion with respect to another image for each group.

幾何変換部213(変換手段)は被合成画像データと、被写体グループごとの幾何変換係数とを取得し、被合成画像内の各グループに属する被写体領域を対応する幾何変換係数に基づいて変換し、基準画像に位置合わせされた被合成画像のデータを生成する。
もしくは幾何変換部213は、被合成画像データと、被合成画像全体に対する幾何変換係数とを取得し、被合成画像を幾何変換係数に基づいて変換し、基準画像に位置合わせされた被合成画像のデータを生成する。
幾何変換部213(合成手段)はさらに、生成した被合成画像のデータを基準画像のデータに合成する処理を行ってもよい。
The geometric conversion unit 213 (conversion unit) acquires the combined image data and the geometric conversion coefficient for each subject group, converts the subject region belonging to each group in the combined image based on the corresponding geometric conversion coefficient, Data of a composite image aligned with the reference image is generated.
Alternatively, the geometric conversion unit 213 acquires the combined image data and the geometric conversion coefficient for the entire combined image, converts the combined image based on the geometric conversion coefficient, and converts the combined image aligned with the reference image. Generate data.
The geometric conversion unit 213 (synthesizing unit) may further perform a process of combining the generated combined image data with the reference image data.

次に、本実施形態における被写体の距離情報の生成方法について説明する。まず、撮像部205の構成例について、図2(a)〜図2(d)を用いて説明する。図2(a)は撮像部205をデジタルカメラ200の正面および側方から見た状態を模式的に示している。撮像部205が有する画素群143の受光面上にはMLA141が形成され、画素群143を構成する各画素は、図2(b)および(c)に示すように、一つのマイクロレンズ142と二つのフォトダイオード(光電変換領域)143a,143bで構成される。以下、フォトダイオード143aをA像用フォトダイオード(Aピクセル)、フォトダイオード143bをB像用フォトダイオード(Bピクセル)と呼ぶ。   Next, a method for generating subject distance information in the present embodiment will be described. First, a configuration example of the imaging unit 205 will be described with reference to FIGS. 2 (a) to 2 (d). FIG. 2A schematically shows a state in which the imaging unit 205 is viewed from the front and side of the digital camera 200. An MLA 141 is formed on the light-receiving surface of the pixel group 143 included in the imaging unit 205, and each pixel constituting the pixel group 143 includes two microlenses 142 and two as shown in FIGS. It is composed of two photodiodes (photoelectric conversion regions) 143a and 143b. Hereinafter, the photodiode 143a is referred to as an A image photodiode (A pixel), and the photodiode 143b is referred to as a B image photodiode (B pixel).

図2(d)は光学系204の射出瞳144を概念的に示しており、A像瞳145aとAピクセル143a、B像瞳145bとBピクセル143bは、それぞれマイクロレンズ142により共役の関係を有する。従って、撮像部205の各画素は瞳分割機能を有し、Aピクセル143aには射出瞳144の右半分のA像瞳145aを通過した光束が、Bピクセル143bには射出瞳144の左半分のB像瞳145bを通過した光束が入射する。従って、Aピクセル群からなる画像と、Bピクセル群からなる画像は視差画像である。   FIG. 2D conceptually shows the exit pupil 144 of the optical system 204. The A image pupil 145a and the A pixel 143a, and the B image pupil 145b and the B pixel 143b have a conjugate relationship by the microlens 142, respectively. . Accordingly, each pixel of the imaging unit 205 has a pupil division function, and the light beam that has passed through the A image pupil 145a in the right half of the exit pupil 144 is present in the A pixel 143a, and the left half of the exit pupil 144 is present in the B pixel 143b. The light beam that has passed through the B image pupil 145b enters. Therefore, an image composed of the A pixel group and an image composed of the B pixel group are parallax images.

複数の画素について、Aピクセル群から構成される像信号をA像、Bピクセル群から構成される像信号をB像とし、A像とB像のずれ量を検出することにより、光学系204のデフォーカス量とデフォーカス方向を検出することができる。従って、撮像部205の出力する信号から位相差検出方式の自動焦点検出(AF)を実現することができる。   For a plurality of pixels, an image signal composed of an A pixel group is an A image, an image signal composed of a B pixel group is a B image, and a deviation amount between the A image and the B image is detected. The defocus amount and defocus direction can be detected. Accordingly, automatic focus detection (AF) using the phase difference detection method can be realized from the signal output from the imaging unit 205.

図2(e)〜(g)は位相差検出方式の焦点検出の原理を模式的に示している。図2(e)の状態は被写体よりも前にピントが合っている様子を、図2(f)は被写体にピントが合っている様子を、図2(g)は被写体よりも後ろにピントが合っている様子をそれぞれ表している。147aおよび147bは撮像部205に設定された焦点検出領域内の画素群から得られるA像およびB像をそれぞれ模式的に表したものである。図2(f)の場合はA像147aとB像147bのずれがなく、被写体に対して合焦している。図2(e)の場合はA像147aが中心に対して左側に、B像147bが中心に対して右側に離れており、図2(g)の場合はA像147aが中心に対して右側に、B像147bが中心に対して左側に離れている。このA像、B像のズレ量(デフォーカス量)と中心からのズレ方向、光学系204の焦点距離、撮像部205とフォーカスレンズとの距離から、被写体の距離情報を得ることができる。   FIGS. 2E to 2G schematically show the principle of focus detection by the phase difference detection method. 2 (e) shows how the subject is in focus before the subject, FIG. 2 (f) shows how the subject is in focus, and FIG. 2 (g) shows the subject behind the subject. Represents the state of suitability. Reference numerals 147a and 147b schematically represent an A image and a B image obtained from the pixel group in the focus detection area set in the imaging unit 205, respectively. In the case of FIG. 2F, there is no deviation between the A image 147a and the B image 147b, and the subject is in focus. In the case of FIG. 2E, the A image 147a is separated from the center on the left side, and the B image 147b is separated on the right side with respect to the center. In the case of FIG. In addition, the B image 147b is separated to the left with respect to the center. The distance information of the subject can be obtained from the deviation amount (defocus amount) of the A image and the B image, the deviation direction from the center, the focal length of the optical system 204, and the distance between the imaging unit 205 and the focus lens.

次に、図3を用いて、距離情報算出部210が行う距離情報の算出方法について説明する。図3は被写体距離の算出方法を模式的に表している。A像151aとB像151bが得られているとすると、光学系204の焦点距離および、フォーカスレンズと撮像部205との距離情報から、実線のように光束が屈折されることがわかる。従って、ピントの合う被写体は152aの位置にあることがわかる。同様にして、A像151aに対してB像151cが得られた場合には位置152b、B像151dが得られた場合には位置152cにピントの合う被写体があることがわかる。以上のように、各画素において、その画素を含むA像信号と、対応するB像信号との相対位置から、その画素位置における被写体の距離情報を算出することができる。   Next, a distance information calculation method performed by the distance information calculation unit 210 will be described with reference to FIG. FIG. 3 schematically shows a method for calculating the subject distance. Assuming that an A image 151a and a B image 151b are obtained, it can be seen from the focal length of the optical system 204 and the distance information between the focus lens and the imaging unit 205 that the light beam is refracted as shown by a solid line. Therefore, it can be seen that the subject in focus is at the position 152a. Similarly, when the B image 151c is obtained for the A image 151a, it can be seen that there is a subject in focus at the position 152b, and when the B image 151d is obtained, the position 152c is in focus. As described above, in each pixel, distance information of the subject at the pixel position can be calculated from the relative position between the A image signal including the pixel and the corresponding B image signal.

例えば図3においてA像151aとB像151dが得られている場合、像のずれ量の半分に相当する中間点の画素154から被写体位置152cまでの距離153を、画素154における被写体の距離情報として記憶する。このようにして、各画素について、被写体の距離情報を保持することが可能である。距離情報は、奥行き画像または距離画像として記憶してもよい。   For example, when the A image 151a and the B image 151d are obtained in FIG. 3, the distance 153 from the intermediate point pixel 154 to the subject position 152c corresponding to half of the image shift amount is used as the subject distance information in the pixel 154. Remember. In this way, it is possible to hold subject distance information for each pixel. The distance information may be stored as a depth image or a distance image.

次に、図4Aおよび図4Bに示すフローチャートを用いて、本実施形態における被合成画像の位置合わせ処理の全体について説明する。複数の画像のうち基準画像を除く各画像に対して順次以下の位置合わせ処理が適用される。ここでは、合成を行う複数の画像が連写などによって予め取得されているものとする。   Next, with reference to the flowcharts shown in FIG. 4A and FIG. 4B, the overall alignment process of the composite image in this embodiment will be described. The following alignment process is sequentially applied to each of the plurality of images excluding the reference image. Here, it is assumed that a plurality of images to be combined are acquired in advance by continuous shooting or the like.

S1500
システム制御部201は、被合成画像を構成する視差画像を用い、距離情報算出部210によって上述した方法で距離情報を算出し、例えばRAM203に保存する。なお、これも上述したが、距離情報の算出処理は必須でなく、予め算出された距離情報を取得する場合にはS1500は省略可能である。
S1500
The system control unit 201 uses the parallax images constituting the composite image, calculates distance information by the distance information calculation unit 210 using the method described above, and stores the distance information in, for example, the RAM 203. Although this is also described above, the distance information calculation process is not essential, and S1500 can be omitted when the distance information calculated in advance is acquired.

システム制御部201は、S1501〜S1512において変換係数算出部211および変換係数判定部212を用い、位置合わせを行うための幾何変換係数の算出および、静止被写体と移動被写体の判定を行う。
S1501
変換係数算出部211は、距離情報に基づいて被合成画像内の被写体をグループ化する。グループ化の具体例を、図5および図6を用いて説明する。
図5(a)は撮影シーンの一例を示す図であり、デジタルカメラ200に近い順に静止被写体A 100、静止被写体B 101、移動被写体a 104、静止被写体C 102、静止被写体D 103が存在する。なお、背景部分についても1つ以上の被写体として取り扱ってよいが、以下の説明では省略する。
The system control unit 201 uses the conversion coefficient calculation unit 211 and the conversion coefficient determination unit 212 in steps S1501 to S1512 to calculate a geometric conversion coefficient for alignment and determine a stationary subject and a moving subject.
S1501
The conversion coefficient calculation unit 211 groups subjects in the combined image based on the distance information. A specific example of grouping will be described with reference to FIGS.
FIG. 5A is a diagram illustrating an example of a shooting scene. A stationary subject A 100, a stationary subject B 101, a moving subject a 104, a stationary subject C 102, and a stationary subject D 103 exist in the order from the digital camera 200. The background portion may also be handled as one or more subjects, but will be omitted in the following description.

図6(a)は、図5(a)の撮影シーンに含まれる被写体と、デジタルカメラ200からの距離を模式的に表している。また、図6(b)は、被合成画像について算出した画素ごとの距離情報のヒストグラムであり、被写体距離を示す横軸の縮尺は図6(a)と対応している。   FIG. 6A schematically shows the distance from the subject included in the shooting scene of FIG. 5A and the digital camera 200. FIG. 6B is a histogram of distance information for each pixel calculated for the composite image, and the horizontal scale indicating the subject distance corresponds to FIG.

本実施形態において変換係数算出部211は、被合成画像の距離情報の頻度分布(ヒストグラム)において、極大となる頻度を含む、予め定めた閾値以上の頻度が連続する距離情報のまとまりを1つの被写体グループとして、被写体をグループ化する。グループの境界は極小となる頻度か、閾値未満となる頻度の境界として定めることができるが、近接した距離に存在する2つの被写体グループを1つの被写体グループにまとめてもよい。これらの方法により、画像中の被写体領域は、同じ距離範囲に含まれる領域が同じグループに属するようにグループ化される。   In the present embodiment, the transform coefficient calculation unit 211 determines a group of distance information having a frequency equal to or higher than a predetermined threshold, including a maximum frequency, in a frequency distribution (histogram) of distance information of a combined image as one subject. Group subjects as a group. The boundary between the groups can be determined as a minimum frequency or a frequency boundary that is less than the threshold value, but two subject groups existing at close distances may be combined into one subject group. By these methods, the subject areas in the image are grouped so that the areas included in the same distance range belong to the same group.

図5〜図6の例では、静止被写体A 100,静止被写体B 101,静止被写体D 103がそれぞれ独立した被写体グループA,B,Dにグループ化され、近接している移動被写体a 104と静止被写体C 102が1つの被写体グループCにグループ化されている。
図5(b)は、グループ化の結果を被合成画像の領域として示している。被写体グループA〜Dはそれぞれ被写体グループ領域500〜503に相当する。
5 to 6, the stationary subject A 100, the stationary subject B 101, and the stationary subject D 103 are grouped into independent subject groups A, B, and D, respectively, and the moving subject a 104 and the stationary subject that are close to each other are grouped. C 102 is grouped into one subject group C.
FIG. 5B shows the result of grouping as a region of the combined image. Subject groups A to D correspond to subject group regions 500 to 503, respectively.

変換係数算出部211は、グループ化の結果として、各被写体グループの代表距離(例えば頻度が最も高い距離情報)と、各被写体グループに対応する画像領域(被写体グループ領域)を表す情報(例えば座標情報)とを、例えばRAM203に保存する。   As a result of grouping, the conversion coefficient calculation unit 211 represents information (for example, coordinate information) that represents a representative distance (for example, distance information having the highest frequency) of each subject group and an image region (subject group region) corresponding to each subject group. Are stored in the RAM 203, for example.

S1502
次に変換係数算出部211は、各被写体グループ領域について動きベクトルを算出する。本実施形態において変換係数算出部211は、テンプレートマッチングに基づいて動きベクトルを算出する。
S1502
Next, the conversion coefficient calculation unit 211 calculates a motion vector for each subject group region. In this embodiment, the conversion coefficient calculation unit 211 calculates a motion vector based on template matching.

動きベクトルの算出方法について図7を用いて説明する。図7(a)および(b)は被合成画像と基準画像における被写体A 100の領域(被写体グループ領域500)をそれぞれクローズアップしたものである。
変換係数算出部211は、被合成画像における被写体グループ領域500に、n×n画素の矩形領域をターゲット領域600として設定する。ターゲット領域600の中心座標が動きベクトルの始点座標となる。
A motion vector calculation method will be described with reference to FIG. 7A and 7B are close-up views of the area of the subject A 100 (subject group area 500) in the combined image and the reference image.
The conversion coefficient calculation unit 211 sets a rectangular area of n × n pixels as the target area 600 in the subject group area 500 in the composite image. The center coordinates of the target area 600 are the start point coordinates of the motion vector.

次に変換係数算出部211は、基準画像における被写体グループ領域500に、探索領域601を設定する。探索領域601は、ターゲット領域600に対応する領域を含み、かつターゲット領域600よりも広い範囲である。そして、変換係数算出部211は、探索領域601内でターゲット領域600と輝度や色差などで一致度が最も高い領域の中心の座標を動きベクトルの終点座標とする。テンプレートマッチングを用いた動きベクトルの検出については公知であるため、これ以上の詳細については説明を省略する。変換係数算出部211は、個々の被写体領域について複数箇所にターゲット領域を設定し、ターゲット領域ごとに動きベクトルを検出する。設定するターゲット領域の大きさ、位置および数については、予め条件を設定しておくことができるが、被写体領域内に満遍なく設定されるような条件とする。   Next, the conversion coefficient calculation unit 211 sets a search area 601 in the subject group area 500 in the reference image. The search area 601 includes an area corresponding to the target area 600 and is wider than the target area 600. Then, the transform coefficient calculation unit 211 sets the coordinates of the center of the region having the highest degree of coincidence with the target region 600 in the search region 601 as the end point coordinate of the motion vector. Since detection of a motion vector using template matching is known, the description of further details is omitted. The conversion coefficient calculation unit 211 sets target areas at a plurality of locations for each subject area, and detects a motion vector for each target area. Conditions can be set in advance for the size, position, and number of target areas to be set, but the conditions are set uniformly in the subject area.

図7(c)は、図5(b)に示した被合成画像に、被写体グループ領域500〜503について算出された動きベクトル700〜703を模式的に示した図である。
被写体グループAに対応する被写体グループ領域500で算出された複数の動きベクトル700のそれぞれは、長さで移動量を、矢印の方向で移動方向を示している。他の被写体グループB〜Dについても同様に、複数の動きベクトル701〜703を示している。
FIG. 7C is a diagram schematically showing motion vectors 700 to 703 calculated for the subject group regions 500 to 503 in the combined image shown in FIG.
Each of the plurality of motion vectors 700 calculated in the subject group area 500 corresponding to the subject group A indicates the amount of movement in length and the direction of movement in the direction of the arrow. Similarly, a plurality of motion vectors 701 to 703 are shown for the other subject groups B to D.

S1503
変換係数算出部211は、まず最初の被写体グループ(i=0番目)を選択する。説明のためグループAは0番目、グループBは1番目のように、グループのアルファベット順(あるいは距離の近い順)に番号が割り当てられるものとする。
S1503
The conversion coefficient calculation unit 211 first selects the first subject group (i = 0th). For the sake of explanation, it is assumed that numbers are assigned in alphabetical order (or in order of distance) of the group A, such as the 0th group A and the first group B.

S1504
変換係数算出部211は、i番目の被写体グループの領域について算出されている動きベクトルの数が第1の所定値以上か判定し、第1の所定値以上ならS1505に、第1の所定値未満ならS1508に、処理を進める。ここで第1の所定値は、被写体グループ領域についての幾何変換係数を算出するに必要な数であり、幾何変換を射影変換で行う場合には4となる。アフィン変換など他の方法を用いる場合には方法に応じた数とする。
S1504
The conversion coefficient calculation unit 211 determines whether the number of motion vectors calculated for the area of the i-th subject group is greater than or equal to a first predetermined value. If so, the process proceeds to S1508. Here, the first predetermined value is a number necessary for calculating the geometric transformation coefficient for the subject group region, and is 4 when the geometric transformation is performed by projective transformation. When other methods such as affine transformation are used, the number depends on the method.

S1505
変換係数算出部211は、i番目の被写体グループの領域について算出されている動きベクトルを用いて、その被写体グループ領域に対する幾何変換係数を算出する。
幾何変換係数が射影変換係数である場合の算出方法について説明する。射影変換は以下の式1で表すことができる。

Figure 0006452481
ここで(x0,y0)は動きベクトルの始点の座標であり、(x,y)は動きベクトルの終点の座標、a〜iは射影変換係数である。なお、本実施形態では光学系204の光軸と撮像部205との交点を原点(0,0)とした直交座標系とするが、他の予め定めた位置(例えば左上隅)を原点としてもよい。 S1505
The conversion coefficient calculation unit 211 calculates a geometric conversion coefficient for the subject group region using the motion vector calculated for the i-th subject group region.
A calculation method when the geometric transformation coefficient is a projective transformation coefficient will be described. Projective transformation can be expressed by Equation 1 below.
Figure 0006452481
Here, (x0, y0) is the coordinates of the start point of the motion vector, (x, y) is the coordinates of the end point of the motion vector, and a to i are projective transformation coefficients. In the present embodiment, an orthogonal coordinate system having the origin (0, 0) as the intersection point of the optical axis of the optical system 204 and the imaging unit 205 is used, but another predetermined position (for example, the upper left corner) may be used as the origin. Good.

式(1)は以下の式(2)および式(3)のように変換することができる。

Figure 0006452481
変換係数算出部211は、i番目の被写体グループ領域について算出された個々の動きベクトルについて、始点及び終点の座標(x,y)、(x0,y0)をそれぞれ式(2)、式(3)に代入する。変換係数算出部211は、これにより得られる9変数の方程式を解くことで幾何変換係数を算出し、例えばRAM203に保存する。 Equation (1) can be transformed into Equation (2) and Equation (3) below.
Figure 0006452481
The conversion coefficient calculation unit 211 sets the coordinates (x, y) and (x0, y0) of the start point and the end point of the individual motion vectors calculated for the i-th subject group region, respectively, using the equations (2) and (3). Assign to. The conversion coefficient calculation unit 211 calculates a geometric conversion coefficient by solving an equation of nine variables obtained thereby, and stores it in the RAM 203, for example.

S1506
変換係数判定部212は、変換係数算出部211がS1505で算出した幾何変換係数を用いて基準点の座標変換を行い、変換前の座標を始点、変換後の座標を終点とする動きベクトルを作成する。この動きベクトルを、i番目の被写体グループ領域の代表動きベクトルと呼ぶ。なお、本実施形態では基準点を座標原点(0,0)とする。図8(a)〜(d)に、被写体グループ領域500〜503(被写体グループA〜D)について得られた代表動きベクトル800〜803を示している。
S1506
The conversion coefficient determination unit 212 performs coordinate conversion of the reference point using the geometric conversion coefficient calculated by the conversion coefficient calculation unit 211 in S1505, and creates a motion vector having the coordinates before conversion as the start point and the coordinates after conversion as the end point. To do. This motion vector is called a representative motion vector of the i-th subject group region. In the present embodiment, the reference point is the coordinate origin (0, 0). 8A to 8D show representative motion vectors 800 to 803 obtained for the subject group regions 500 to 503 (subject groups A to D).

S1507
変換係数判定部212は、i番目の被写体グループ領域の代表動きベクトルを、特定の被写体グループの距離情報に基づいて正規化し、正規化代表動きベクトルを生成する。特定の距離情報で正規化することにより、静止被写体のみで構成された被写体グループの正規化代表動きベクトルの大きさは、被写体距離によらず同等な大きさを示すようになる。
S1507
The conversion coefficient determination unit 212 normalizes the representative motion vector of the i-th subject group region based on the distance information of the specific subject group, and generates a normalized representative motion vector. By normalizing with specific distance information, the size of the normalized representative motion vector of a subject group composed only of still subjects becomes equivalent regardless of the subject distance.

正規化代表動きベクトルの生成方法について説明する。
まず、変換係数判定部212は、正規化を行う光軸方向の距離を決定する。本実施形態ではデジタルカメラ200からの被写体グループAの距離(被写体グループAの代表距離)を、正規化距離とする。
正規化距離をDA(図6(b))、正規化を行いたい被写体グループの代表距離をDとすると、以下の式(4)によって、正規化を行いたい被写体グループの代表動きベクトルの大きさを正規化する。
|正規化代表動きベクトル|=|代表動きベクトル|×D/DA ・・・式(4)
A method for generating a normalized representative motion vector will be described.
First, the conversion coefficient determination unit 212 determines the distance in the optical axis direction for normalization. In this embodiment, the distance of the subject group A from the digital camera 200 (representative distance of the subject group A) is set as a normalized distance.
When the normalized distance is DA (FIG. 6B) and the representative distance of the subject group to be normalized is D, the size of the representative motion vector of the subject group to be normalized is expressed by the following equation (4). Is normalized.
| Normalized representative motion vector | = | Representative motion vector | × D / DA Expression (4)

図8(e)〜(h)は、図8(a)〜(d)に示した各被写体グループの代表動きベクトル800〜803の正規化代表動きベクトル804〜807を示している。ここでは、被写体グループAの距離で正規化しているため、図8(e)に示す被写体グループAの正規化代表動きベクトル804は、正規化前の代表動きベクトル800と等しい。なお、図8(e)〜(h)における808〜811は、正規化領域動きベクトル804〜807がx軸となす角(動きの方向)である。   FIGS. 8E to 8H show normalized representative motion vectors 804 to 807 of the representative motion vectors 800 to 803 of the subject groups shown in FIGS. 8A to 8D. Here, since normalization is performed by the distance of the subject group A, the normalized representative motion vector 804 of the subject group A shown in FIG. 8E is equal to the representative motion vector 800 before normalization. In FIGS. 8E to 8H, reference numerals 808 to 811 denote angles (directions of movement) formed by the normalized region motion vectors 804 to 807 with the x axis.

変換係数判定部212は、算出した正規化代表動きベクトルの情報を、被写体グループの番号(i)と関連付けて例えばRAM203に保存し、処理をS1509へ進める。   The conversion coefficient determination unit 212 stores the calculated normalized representative motion vector information in association with the subject group number (i), for example, in the RAM 203, and advances the process to S1509.

S1508
S1504で、算出されている動きベクトルの数が第1の所定値よりも少ないと判定された場合、変換係数算出部211は、変換係数のない被写体グループを特定する情報として例えば被写体グループの番号iをRAM203に保存し、処理をS1509へ進める。
S1508
In S1504, when it is determined that the number of calculated motion vectors is less than the first predetermined value, the conversion coefficient calculation unit 211 uses, for example, a subject group number i as information for specifying a subject group having no conversion coefficient. Are stored in the RAM 203, and the process advances to step S1509.

S1509
システム制御部201は、全ての被写体グループ領域について正規化代表動きベクトルの算出もしくはグループ番号の保存を行ったか判定し、未処理の被写体グループ領域があればS1510へ、未処理の被写体グループ領域がなければS1511へ処理を進める。
S1509
The system control unit 201 determines whether the normalized representative motion vector is calculated or the group number is stored for all subject group regions. If there is an unprocessed subject group region, the process proceeds to step S1510, and there is no unprocessed subject group region. If so, the process advances to S1511.

S1510
システム制御部201は、グループ番号iをインクリメントして処理をS1504へ戻す。
S1510
The system control unit 201 increments the group number i and returns the process to S1504.

S1511
変換係数判定部212は、算出した正規化代表動きベクトルから、基準画像と被合成画像の撮影位置の変化量および変化方向に関する推定グローバル動きベクトルを生成する。ここでは、幾何変換係数が算出された被写体グループ領域のみを処理対象とする。
まず変換係数判定部212は、正規化代表動きベクトルについて、大きさと方向に関するヒストグラムを作成する。ここでは、方向をx軸と正規化代表動きベクトルとがなす角808〜811(図8(e)〜(h))で表すものとする。
S1511
The transform coefficient determination unit 212 generates an estimated global motion vector related to the change amount and change direction of the shooting position of the reference image and the combined image from the calculated normalized representative motion vector. Here, only the subject group region for which the geometric transformation coefficient is calculated is set as the processing target.
First, the transform coefficient determination unit 212 creates a histogram regarding the magnitude and direction of the normalized representative motion vector. Here, the direction is expressed by angles 808 to 811 (FIGS. 8E to 8H) formed by the x-axis and the normalized representative motion vector.

図9(a),(b)に、正規化代表動きベクトルの大きさと角度のヒストグラムの例を示す。そして、変換係数判定部212は、頻度が最も高い大きさ900、方向901を有するベクトルを、推定グローバル動きベクトルとする。推定グローバル動きベクトルを図9(c)に示す。推定グローバル動きベクトル1000は、正規化代表動きベクトルの最頻値の大きさ900と角度901を有する。   FIGS. 9A and 9B show examples of normalized and representative motion vector magnitude and angle histograms. Then, the transform coefficient determination unit 212 sets the vector having the highest frequency 900 and the direction 901 as the estimated global motion vector. The estimated global motion vector is shown in FIG. The estimated global motion vector 1000 has a mode value 900 and an angle 901 of the normalized representative motion vector.

S1512
次に変換係数判定部212は、被写体グループ領域ごとに、グローバルな動き(静止被写体)なのか、個別な動き(移動被写体)なのかを判定する。ここでも、幾何変換係数が算出された被写体グループ領域のみを処理対象とする。
S1512
Next, the conversion coefficient determination unit 212 determines whether the movement is a global movement (stationary subject) or an individual movement (moving subject) for each subject group region. Again, only the subject group region for which the geometric transformation coefficient has been calculated is set as the processing target.

この判定処理の詳細について、図10のフローチャートを用いて説明する。
S1600
変換係数判定部212は、最初の被写体グループ領域(i=0)の正規化代表動きベクトルを選択する。
Details of this determination processing will be described with reference to the flowchart of FIG.
S1600
The conversion coefficient determination unit 212 selects a normalized representative motion vector of the first subject group region (i = 0).

S1601
変換係数判定部212は、正規化代表動きベクトルの大きさと推定グローバル動きベクトルの大きさの差分絶対値を算出し、差分絶対値が第2の所定値未満か否か判定する。変換係数判定部212は、差分絶対値が第2の所定値未満の場合はS1602へ、第2の所定値以上の場合はS1604へ処理を進める。例えば第2の所定値は1[画素]とする。
S1601
The transform coefficient determination unit 212 calculates a difference absolute value between the size of the normalized representative motion vector and the size of the estimated global motion vector, and determines whether the difference absolute value is less than a second predetermined value. The conversion coefficient determination unit 212 advances the process to S1602 if the absolute difference value is less than the second predetermined value, and advances to S1604 if it is greater than or equal to the second predetermined value. For example, the second predetermined value is 1 [pixel].

S1602
変換係数判定部212は、正規化代表動きベクトルの方向(角度)と推定グローバル動きベクトルの方向(角度)の差分絶対値を算出し、差分絶対値が第3の所定値未満か否か判定する。変換係数判定部212は、差分絶対値が第3の所定値未満の場合はS1603へ、第2の所定値以上の場合はS1604へ処理を進める。例えば第3の所定値は1[度]とする。
S1602
The transform coefficient determination unit 212 calculates a difference absolute value between the direction (angle) of the normalized representative motion vector and the direction (angle) of the estimated global motion vector, and determines whether the difference absolute value is less than a third predetermined value. . The conversion coefficient determination unit 212 advances the process to S1603 if the difference absolute value is less than the third predetermined value, and advances to S1604 if the difference absolute value is greater than or equal to the second predetermined value. For example, the third predetermined value is 1 [degree].

S1603
変換係数判定部212は、処理対象の被写体グループ領域がグローバルな動きをしている(静止被写体)と判定し、処理をS1605へ進める。
S1603
The conversion coefficient determination unit 212 determines that the subject group area to be processed is moving globally (still subject), and advances the processing to step S1605.

S1604
変換係数判定部212は、処理対象の被写体グループ領域がグローバルな動きをしていない(移動被写体)と判定し、処理をS1605へ進める。
S1604
The conversion coefficient determination unit 212 determines that the subject group area to be processed does not move globally (moving subject), and advances the process to step S1605.

S1605
システム制御部201は、全ての(幾何変換係数が算出された)被写体グループ領域について判定処理を行なったか判定し、未処理の被写体グループ領域があればS1606へ処理を進める。未処理の被写体グループ領域がなければシステム制御部201は、個々の被写体グループ領域についての判定結果を表す情報を例えばRAM203に保存し、判定処理を終了してS1513(図4B)へ処理を進める。
S1605
The system control unit 201 determines whether determination processing has been performed for all subject group areas (geometric transformation coefficients have been calculated). If there is an unprocessed subject group region, the process proceeds to S1606. If there is no unprocessed subject group area, the system control unit 201 stores information representing the determination result for each subject group area in, for example, the RAM 203, ends the determination process, and advances the process to S1513 (FIG. 4B).

S1606
システム制御部201は、グループ番号iをインクリメントして処理をS1601へ戻す。
S1606
The system control unit 201 increments the group number i and returns the process to S1601.

S1513
システム制御部201は、S1512の判定処理において、グローバルな動きではない(移動被写体)と判定された被写体グループ領域について、グループ分けの精度を上げて再判定を行うか否か判定する。
S1513
In step S1512, the system control unit 201 determines whether or not to perform re-determination for the subject group area that is determined not to be a global movement (moving subject) by increasing the grouping accuracy.

静止被写体の領域と移動被写体の領域の両方を含んだ被写体グループ領域は、S1512の判定処理でグローバルな動きでないと判定される可能性が高い。そのため、グローバルな動きではない(移動被写体)と判定された被写体グループ領域が複数の被写体領域を含んでいると考えられる場合には、個々の被写体領域に再グループ化して再判定処理を行う。   There is a high possibility that the subject group region including both the stationary subject region and the moving subject region is determined not to be a global movement in the determination processing in S1512. For this reason, when it is considered that the subject group area determined not to be a global movement (moving subject) includes a plurality of subject areas, re-determination processing is performed by regrouping into individual subject areas.

システム制御部201は、グローバルな動きではない(移動被写体)と判定された被写体グループ領域に対応する距離情報のヒストグラムが、離散的な距離に高頻度を有している場合に、複数の被写体領域が含まれるものと判定し、再判定処理を行うと決定する。より具体的には、システム制御部201は、被写体グループ領域の距離情報のヒストグラムが、頻度の極大値を複数有する場合に、複数の被写体領域が含まれるものと判定する。なお、この判定方法は例示であり、例えば被写体グループ領域の距離情報に該当する画素の画像内における分布(座標)に基づいて、複数の被写体領域が含まれるか否かを判定してもよい。   When the histogram of the distance information corresponding to the subject group region that is determined not to be a global movement (moving subject) has a high frequency at discrete distances, the system control unit 201 has a plurality of subject regions. Is determined to be included, and it is determined that re-determination processing is performed. More specifically, the system control unit 201 determines that a plurality of subject areas are included when the histogram of the distance information of the subject group area has a plurality of frequency maximum values. Note that this determination method is an example, and for example, it may be determined whether or not a plurality of subject regions are included based on the distribution (coordinates) in the image of pixels corresponding to the distance information of the subject group region.

再判定を行うと決定した被写体グループ領域が存在する場合、システム制御部201は処理をS1514へ進める。また、再判定を行うと決定した被写体グループ領域が存在しないか、全ての被写体グループ領域がグローバルな動きと判定されている場合、システム制御部201は処理をS1515へ進める。   If there is a subject group area determined to be redetermined, the system control unit 201 advances the process to step S1514. If the subject group area determined to be redetermined does not exist or if all subject group areas are determined to be global movements, the system control unit 201 advances the process to step S1515.

S1514
システム制御部201は、変換係数算出部211および変換係数判定部212によって再判定処理を行う。再判定処理の詳細について、図11のフローチャートを用いて説明する。
S1514
The system control unit 201 performs redetermination processing by the conversion coefficient calculation unit 211 and the conversion coefficient determination unit 212. Details of the redetermination process will be described with reference to the flowchart of FIG.

S2300
変換係数算出部211は、再判定処理を行うと決定された被写体グループ領域を複数のグループに再グループ化する。
例えば変換係数算出部211は、対応する距離情報のヒストグラムにおいて、離散的に頻度の高い距離を代表距離とする複数の被写体グループ領域を生成する。あるいは、処理対象の被写体グループ領域が、S1501において複数の被写体グループをまとめたものである場合には、S1501における被写体グループの検出結果を用いてもよい。
S2300
The conversion coefficient calculation unit 211 regroups the subject group areas determined to be redetermined into a plurality of groups.
For example, the conversion coefficient calculation unit 211 generates a plurality of subject group areas having discrete distances as representative distances in the corresponding distance information histogram. Alternatively, if the subject group area to be processed is a group of a plurality of subject groups in S1501, the subject group detection result in S1501 may be used.

例えば、距離情報のヒストグラムを、頻度が予め定めた閾値以上である極大値に対応する距離を代表距離とした複数の距離範囲に分割することで、再グループ化することができる。
図7〜図8の例では、被写体グループC(被写体グループ領域502)の正規化代表動きベクトルが推定グローバルベクトルと大きさ、方向において大きく異なる。そのため、S1512の判定処理では、被写体グループ領域502はグローバルな動きでないと判定される。
For example, the distance information histogram can be regrouped by dividing the histogram into a plurality of distance ranges with the distance corresponding to the maximum value having a frequency equal to or higher than a predetermined threshold as a representative distance.
7 to 8, the normalized representative motion vector of the subject group C (subject group region 502) is greatly different in magnitude and direction from the estimated global vector. Therefore, in the determination process of S1512, it is determined that the subject group area 502 is not a global movement.

被写体グループ領域502に対応する距離情報のヒストグラム(図6(b))には、移動被写体a 104に対応する部分と、静止被写体C 102に対応する部分が含まれている。そのため、変換係数算出部211は、被写体グループ領域502に対応する距離情報のヒストグラムをそれぞれの被写体に対応する被写体グループCA,CBに再グループ化する。   The histogram of distance information corresponding to the subject group area 502 (FIG. 6B) includes a portion corresponding to the moving subject a 104 and a portion corresponding to the stationary subject C102. Therefore, the conversion coefficient calculation unit 211 regroups the histogram of distance information corresponding to the subject group area 502 into subject groups CA and CB corresponding to the respective subjects.

再グループ化の結果を図12(a)に示す。移動被写体a 104は被写体グループCAとして、静止被写体C 102は被写体グループCBとして再グループ化される。その結果、被写体グループ領域502は、2つの被写体グループ領域1100、1101に分かれる。
以後、変換係数算出部211および変換係数判定部212は、個々の被写体グループ領域について、図4AのS1503〜S1510,図4BのS1512と同じ処理を行い、処理をS1515へ進める。推定グローバルベクトルは既に算出されているため、再判定処理ではS1511に相当する処理は行わない。
The result of regrouping is shown in FIG. The moving subject a 104 is regrouped as a subject group CA, and the stationary subject C 102 is regrouped as a subject group CB. As a result, the subject group area 502 is divided into two subject group areas 1100 and 1101.
Thereafter, the conversion coefficient calculation unit 211 and the conversion coefficient determination unit 212 perform the same processing as S1503 to S1510 in FIG. 4A and S1512 in FIG. 4B for each subject group region, and the process proceeds to S1515. Since the estimated global vector has already been calculated, the re-determination process does not perform the process corresponding to S1511.

図12(b),(c)は被写体グループ領域1100、1101(被写体グループCA、CB)の代表動きベクトル1200,1201を、図12(d),(e)は正規化代表動きベクトル1202,1203をそれぞれ示している。また、1203,1204は正規化領域動きベクトル1202,1203がx軸となす角である。   12B and 12C show the representative motion vectors 1200 and 1201 of the subject group areas 1100 and 1101 (subject groups CA and CB), and FIGS. 12D and 12E show the normalized representative motion vectors 1202 and 1203, respectively. Respectively. Reference numerals 1203 and 1204 denote angles formed by the normalized region motion vectors 1202 and 1203 with the x axis.

S1515
システム制御部201は、幾何変換係数が算出されていない被写体グループ領域があるか判定し、ある場合はS1516へ、ない場合はS1518へ処理を進める。
S1515
The system control unit 201 determines whether there is a subject group area for which a geometric transformation coefficient has not been calculated. If there is, the process proceeds to S1516, and if not, the process proceeds to S1518.

S1516
システム制御部201は、幾何変換係数が算出されていない被写体グループ領域に対する幾何変換係数を変換係数算出部211によって生成する。本実施形態で変換係数算出部211は、算出済みの幾何変換係数から、被写体グループ領域の距離の関係に基づいて、幾何変換係数が算出されていない被写体グループ領域に対する幾何変換係数を生成する。
S1516
The system control unit 201 uses the conversion coefficient calculation unit 211 to generate a geometric conversion coefficient for a subject group region for which no geometric conversion coefficient has been calculated. In this embodiment, the conversion coefficient calculation unit 211 generates a geometric conversion coefficient for a subject group area for which no geometric conversion coefficient has been calculated based on the relationship between the distances of the subject group areas from the calculated geometric conversion coefficient.

まず変換係数算出部211は、幾何変換係数が算出された被写体グループ領域のうち、グローバルな動きと判定されたものを2つ以上選択する。ここでは2つ選択するものとし、代表距離がデジタルカメラ200から近い順に被写体グループ領域1、被写体グループ領域2とし、それぞれの幾何変換係数をPi,Pjとする。   First, the conversion coefficient calculation unit 211 selects two or more subject group areas for which a geometric conversion coefficient has been calculated that have been determined to be global motion. Here, it is assumed that two are selected, the subject group region 1 and the subject group region 2 are represented in order from the closest representative distance from the digital camera 200, and the respective geometric transformation coefficients are Pi and Pj.

図13(a)は、幾何変換係数が算出されていない被写体グループ領域、被写体グループ領域1、被写体グループ領域2の距離関係と、幾何変換係数の関係例を模式的に示す。変換係数算出部211は、幾何変換係数Pi 1301,Pj 1302を取得する。
次に変換係数算出部211は、被写体グループ領域1と被写体グループ領域2の代表距離の差Δdist 1303と、対応する幾何変換係数の差分Δparam 1304を算出する。
FIG. 13A schematically shows an example of the relationship between the distance relationship between the subject group region, the subject group region 1 and the subject group region 2 for which the geometric transformation coefficient is not calculated, and the geometric transformation coefficient. The conversion coefficient calculation unit 211 acquires geometric conversion coefficients Pi 1301 and Pj 1302.
Next, the conversion coefficient calculation unit 211 calculates a difference Δdist 1303 of the representative distance between the subject group area 1 and the subject group area 2 and a difference Δparam 1304 of the corresponding geometric conversion coefficient.

変換係数算出部211は、幾何変換係数が算出できなかった被写体グループ領域の代表距離と、選択した被写体グループ領域のうち、デジタルカメラ200に最も近いものの代表距離との差dist 1305を算出する。
そして、変換係数算出部211は、幾何変換係数が算出されていない被写体グループ領域の幾何変換係数P 1300を、以下の式(5)によって算出する。
P=Pi+dist×Δparam/Δdist ・・・式(5)
なお、式(5)による算出は、式(1)に示した幾何変換係数a〜iの各々について行う。
The conversion coefficient calculation unit 211 calculates a difference dist 1305 between the representative distance of the subject group area for which the geometric conversion coefficient could not be calculated and the representative distance of the selected subject group area closest to the digital camera 200.
Then, the conversion coefficient calculation unit 211 calculates the geometric conversion coefficient P 1300 of the subject group area for which the geometric conversion coefficient has not been calculated, using the following equation (5).
P = Pi + dist × Δparam / Δdist (5)
Note that the calculation using the equation (5) is performed for each of the geometric transformation coefficients a to i shown in the equation (1).

ここでは、幾何変換係数が算出できなかった被写体グループ領域よりデジタルカメラ200に近い、幾何変換係数が算出された被写体グループ領域を2つ選択した場合について例示した。しかし、幾何変換係数が算出できなかった被写体グループ領域より近いものと遠いものを1つずつ選択した場合や、遠いものを2つ選択した場合も、同様にして算出することができる。   Here, the case where two subject group regions with calculated geometric transformation coefficients that are closer to the digital camera 200 than the subject group region for which the geometric transformation coefficients could not be calculated has been illustrated. However, the calculation can be performed in the same manner even when one closer and farther than the subject group region for which the geometric transformation coefficient could not be calculated are selected one by one, or when two far away are selected.

S1517
変換係数判定部212は、S1516で幾何変換係数を算出した被写体グループ領域がグローバルな動きなのか判定する。基本的な判定方法は図10を用いて説明した動きの判定処理と同様であるが、大きさおよび方向(角度)を比較するベクトルが異なる。
S1517
The conversion coefficient determination unit 212 determines whether the subject group area for which the geometric conversion coefficient is calculated in S1516 is a global motion. The basic determination method is the same as the motion determination process described with reference to FIG. 10, but the vectors for comparing the magnitude and direction (angle) are different.

具体的な方法について図13(b)を用いて説明する。図13(b)は、S1516で幾何変換係数を算出した被写体グループ領域1400と、算出されている動きベクトル1402を示している。なお、ここでは1つの動きベクトル1402しか示していないが、他の動きベクトルが算出されていてもよい。   A specific method will be described with reference to FIG. FIG. 13B shows the subject group region 1400 for which the geometric transformation coefficient has been calculated in S1516, and the calculated motion vector 1402. Although only one motion vector 1402 is shown here, other motion vectors may be calculated.

変換係数判定部212は、算出されている1つの動きベクトル(ここでは動きベクトル1402とする)の始点1401を基準点として、S1516で算出した幾何変換係数を用いてS1506と同様にして動きベクトル1405を算出する。ここでは、幾何変換係数により、始点1401、終点1404の動きベクトル1405が算出されたものとする。   The transformation coefficient determination unit 212 uses the geometric transformation coefficient calculated in S1516 using the start point 1401 of one calculated motion vector (here, motion vector 1402) as a reference point, and performs the motion vector 1405 in the same manner as in S1506. Is calculated. Here, it is assumed that the motion vector 1405 of the start point 1401 and the end point 1404 is calculated by the geometric transformation coefficient.

次に変換係数判定部212は、動きベクトル1402と、動きベクトル1405について、S1601〜S1604と同様に大きさと方向(角度)の差を判定する。具体的には、変換係数判定部212は、大きさの差分絶対値が第4の所定値未満で、かつ方向(角度)の差分絶対値が第5の所定値未満であれば、被写体グループ領域1400がグローバルな動きをしている(静止被写体)と判定する。一方、いずれかの条件を満たさなければ、変換係数判定部212は、被写体グループ領域1400が個別な動きをしている(移動被写体)と判定する。例えば第4の所定値を1[画素]、第5の所定値を1[度]とする。   Next, the transform coefficient determination unit 212 determines the difference between the magnitude and direction (angle) of the motion vector 1402 and the motion vector 1405 as in S1601 to S1604. Specifically, the transform coefficient determination unit 212 determines that the subject group area is the absolute value of the magnitude difference is less than the fourth predetermined value and the absolute value of the direction (angle) is less than the fifth predetermined value. It is determined that 1400 is moving globally (stationary subject). On the other hand, if any of the conditions is not satisfied, the conversion coefficient determination unit 212 determines that the subject group area 1400 is moving individually (moving subject). For example, the fourth predetermined value is 1 [pixel], and the fifth predetermined value is 1 [degree].

S1516で幾何変換係数を算出した全ての被写体グループ領域について判定処理が行われたら、システム制御部201は個々の被写体グループ領域についての判定結果を表す情報を例えばRAM203に保存し、処理をS1518へ進める。   When the determination process is performed for all the subject group areas for which the geometric transformation coefficients have been calculated in S1516, the system control unit 201 stores information representing the determination result for each subject group area in, for example, the RAM 203, and the process proceeds to S1518. .

S1518
システム制御部201は、被合成画像に対して幾何変換部213で幾何変換処理を適用し、基準画像へ位置合わせされた画像を生成する。幾何変換処理は以下の方法のいずれかであってよい。
(第1の方法)
被合成画像の被写体グループ領域ごとに、それぞれに対して算出された幾何変換係数を用いて幾何変換処理を適用する。
(第2の方法)
被合成画像の被写体グループ領域のうち、グローバルな動きをしていると判定されたものについて得られている動きベクトルから1つの幾何変換係数を算出し、被合成画像全体に適用する。なお、この場合、S1505と同様にして、変換係数算出部211で幾何変換係数を求めることができる。
S1518
The system control unit 201 applies a geometric transformation process to the synthesized image by the geometric transformation unit 213 to generate an image aligned with the reference image. The geometric transformation process may be any of the following methods.
(First method)
A geometric transformation process is applied to each subject group region of the composite image using the geometric transformation coefficient calculated for each.
(Second method)
One geometric transformation coefficient is calculated from a motion vector obtained for a subject group region of the composite image that is determined to have a global motion, and is applied to the entire composite image. In this case, the geometric transformation coefficient can be obtained by the transformation coefficient calculation unit 211 as in S1505.

第1の方法は被写体領域ごとの幾何変換係数を用いるため、位置合わせの精度は第2の方法より高いが、被写体領域ごとに幾何変換係数を切り替え、変換を行う必要があるため処理負荷および処理時間の点で第2の方法より不利である。
第2の方法は、1回の変換処理で済むため、処理負荷および処理時間の点で第1の方法より有利であるが、位置合わせの精度は第1の方法より低くなる。特に、移動被写体の位置合わせの精度低下が大きくなる可能性がある。
Since the first method uses a geometric transformation coefficient for each subject area, the alignment accuracy is higher than that of the second method. However, since it is necessary to switch the geometric transformation coefficient for each subject area and perform transformation, the processing load and processing It is disadvantageous over the second method in terms of time.
Since the second method requires only one conversion process, the second method is more advantageous than the first method in terms of processing load and processing time, but the accuracy of alignment is lower than that of the first method. In particular, there is a possibility that the accuracy of positioning of the moving subject will be greatly reduced.

これらの方法のどちらを用いるかは、画像処理装置の性能や利用可能なリソース、処理負荷などに応じて適宜決定すれば良く、動的に切り替えて用いてもよい。   Which of these methods is used may be determined as appropriate according to the performance of the image processing apparatus, available resources, processing load, and the like, and may be switched dynamically.

本実施形態では距離情報を用いて正規化した動きベクトルを用いて画像間の全体的な動きを推定し、各被写体領域がグローバルな動きをしている(静止被写体)かグローバルな動きをしていない(移動被写体)かを判定する。そのため、被写体距離に応じた画像中の移動量の差や、画像中に占める移動被写体の影響を抑制し、静止被写体か否かを精度良く判定でき、グローバル動きベクトルの推定精度が向上する。そのため、位置合わせの精度を向上させることができる。   In this embodiment, the overall motion between images is estimated using a motion vector normalized using distance information, and each subject region is moving globally (a stationary subject) or moving globally. It is determined whether it is present (moving subject). Therefore, the difference in the amount of movement in the image according to the subject distance and the influence of the moving subject in the image can be suppressed, and it can be accurately determined whether or not the subject is a stationary subject, and the global motion vector estimation accuracy is improved. Therefore, the alignment accuracy can be improved.

●(第2の実施形態)
次に、本発明の第2の実施形態について説明する。本実施形態は、第1の実施形態における被写体グループの複数に跨るような大きな奥行きを有する静止被写体が存在し、また同一距離に静止被写体と移動被写体が存在するシーンにおける位置合わせ処理に関する。位置合わせ処理の内容以外は第1の実施形態と同様で良いため、本実施形態もデジタルカメラ200の構成を用いて説明する。
● (Second Embodiment)
Next, a second embodiment of the present invention will be described. The present embodiment relates to an alignment process in a scene in which there are still subjects having a large depth straddling a plurality of subject groups in the first embodiment, and there are still subjects and moving subjects at the same distance. Since the contents other than the contents of the alignment process may be the same as those in the first embodiment, this embodiment will also be described using the configuration of the digital camera 200.

図14は本実施形態における撮影シーンの一例を模式的に示す図であり、図5(a)に示したシーンに移動被写体b 1700と移動被写体c 1701とが加わっている。移動被写体b 1700は静止被写体A 100およびB 101の距離範囲に跨がる奥行きを有し、移動被写体c 1701は静止被写体D 103と同じ距離に存在する。なお、背景部分についても1つ以上の被写体として取り扱ってよいが、以下の説明では省略する。   FIG. 14 is a diagram schematically showing an example of a shooting scene in the present embodiment. A moving subject b 1700 and a moving subject c 1701 are added to the scene shown in FIG. The moving subject b 1700 has a depth that spans the distance range of the stationary subjects A 100 and B 101, and the moving subject c 1701 exists at the same distance as the stationary subject D 103. The background portion may also be handled as one or more subjects, but will be omitted in the following description.

次に、本実施形態における位置合わせ処理について、図15のフローチャートを用いて説明する。なお、図15において第1の実施形態と同様の処理を行う工程には図4A、図4Bと同じ参照数字を付し、説明は省略する。   Next, the alignment process in this embodiment is demonstrated using the flowchart of FIG. In FIG. 15, the same reference numerals as those in FIG. 4A and FIG.

S2400
変換係数算出部211は、距離情報に基づいて被合成画像内の被写体をグループ化する。本実施形態においては2段階のグループ化を行うが、この工程で行うグループ化は基本的にS1501におけるグループ化と同様である。
図16は、図6と同様に、図14の撮影シーンに含まれる被写体の、デジタルカメラ200からの距離と、被合成画像の距離情報の頻度分布とを模式的に表している。
変換係数算出部211は、被合成画像の距離情報の頻度分布(ヒストグラム)において、極大となる頻度を含む、予め定めた閾値以上の頻度が連続する距離情報のまとまりを1つの被写体グループとして、被写体をグループ化する。
S2400
The conversion coefficient calculation unit 211 groups subjects in the combined image based on the distance information. In this embodiment, two-stage grouping is performed. The grouping performed in this step is basically the same as the grouping in S1501.
FIG. 16 schematically shows the distance from the digital camera 200 of the subject included in the shooting scene of FIG. 14 and the frequency distribution of the distance information of the combined image, as in FIG.
The conversion coefficient calculation unit 211 uses a group of distance information including a frequency that is a maximum in the frequency distribution (histogram) of the distance information of the combined image as a subject group, Group.

被写体グループCは、第1の実施形態と同一である。被写体グループDは、新たに移動被写体c 1701を含んでいる。一方、奥行きの大きな移動被写体b 1700が加わったことにより、静止被写体A 100、B 101に対応する距離情報の区切りが明確で無くなり、被写体グループA,Bは一連の頻度分布の極小値を境界としてグループ化されている。   The subject group C is the same as in the first embodiment. The subject group D newly includes a moving subject c 1701. On the other hand, the addition of the moving subject b 1700 having a large depth makes the separation of the distance information corresponding to the stationary subjects A 100 and B 101 unclear, and the subject groups A and B use the minimum value of a series of frequency distributions as a boundary. Grouped.

S2401
次に変換係数算出部211は、本実施形態に特徴的な2段階目のグループ化を行う。具体的には変換係数算出部211は、各被写体グループに対応する画像中の領域に基づいてグループ化する。
S2401
Next, the transform coefficient calculation unit 211 performs second-stage grouping that is characteristic of the present embodiment. Specifically, the conversion coefficient calculation unit 211 performs grouping based on regions in the image corresponding to each subject group.

例えば、変換係数算出部211(グループ化手段)は、各被写体グループに対応する距離情報から画素座標を特定し、被写体グループに対応する閉領域を抽出する。閉領域の抽出は、例えば動的輪郭モデル(Snake法)など公知の手法を用いることができる。抽出した閉領域のうち、隣接している、もしくは間隔が閾値以内の領域はまとめて1つの被写体グループとする。   For example, the conversion coefficient calculation unit 211 (grouping unit) specifies pixel coordinates from distance information corresponding to each subject group, and extracts a closed region corresponding to the subject group. For extraction of the closed region, for example, a known method such as a dynamic contour model (Snake method) can be used. Of the extracted closed regions, the adjacent regions or the regions whose intervals are within the threshold are collectively set as one subject group.

図17は、S2401におけるグループ化の結果を模式的に示している。S2400でグループ化された被写体グループA〜Dの各々は、S2401でさらに2つの被写体グループにグループ化されている。具体的には、被写体グループAは、静止被写体A 100に対応する被写体グループAAと、移動被写体b 1700の近距離側の一部に対応する被写体グループABとに再グループ化されている。2000,2001は対応する被写体グループ領域である。   FIG. 17 schematically shows the result of grouping in S2401. Each of the subject groups A to D grouped in S2400 is further grouped into two subject groups in S2401. Specifically, the subject group A is regrouped into a subject group AA corresponding to the stationary subject A 100 and a subject group AB corresponding to a part on the short distance side of the moving subject b 1700. Reference numerals 2000 and 2001 denote corresponding subject group areas.

同様に、被写体グループBは、静止被写体B 101に対応する被写体グループBAと、移動被写体b 1700の遠距離側の一部に対応する被写体グループBBとに再グループ化されている。2002,2003は対応する被写体グループ領域である。   Similarly, the subject group B is regrouped into a subject group BA corresponding to the stationary subject B 101 and a subject group BB corresponding to a part of the moving subject b 1700 on the far side. Reference numerals 2002 and 2003 denote corresponding subject group areas.

被写体グループCは、移動被写体a 104に対応する被写体グループCAと、静止被写体C 101に対応する被写体グループCBとに再グループ化されている。2004,2005は対応する被写体グループ領域である。
被写体グループDは、静止被写体D 103に対応する被写体グループDAと、移動被写体c 1701に対応する被写体グループDBとに再グループ化されている。2006,2007は対応する被写体グループ領域である。
The subject group C is regrouped into a subject group CA corresponding to the moving subject a 104 and a subject group CB corresponding to the stationary subject C 101. Reference numerals 2004 and 2005 denote corresponding subject group areas.
The subject group D is regrouped into a subject group DA corresponding to the stationary subject D 103 and a subject group DB corresponding to the moving subject c 1701. Reference numerals 2006 and 2007 denote corresponding subject group areas.

次に、変換係数判定部212は、被写体グループAA〜DBについて第1の実施形態と同様にして正規化動きベクトルを算出する。   Next, the transform coefficient determination unit 212 calculates normalized motion vectors for the subject groups AA to DB in the same manner as in the first embodiment.

S2402
変換係数判定部212は、まず最初の被写体グループ(i=0番目)を選択する。説明のためグループAAは0番目、グループABは1番目のように、グループのアルファベット順(あるいは距離の近い順)に番号が割り当てられるものとする。
S2402
The conversion coefficient determination unit 212 first selects the first subject group (i = 0th). For the sake of explanation, it is assumed that numbers are assigned in alphabetical order (or in order of distance) of the group AA as 0th and the group AB as 1st.

S2403
変換係数判定部212は、S1505で変換係数算出部211が算出した幾何変換係数を用いて基準点の座標変換を行い、変換前の座標を始点、変換後の座標を終点とする動きベクトルを作成する。処理の内容はS1506と同一である。この動きベクトルを、i番目の被写体グループ領域の代表動きベクトルと呼ぶ。なお、本実施形態では基準点を座標原点(0,0)とする。図18(a)〜(h)に、被写体グループAA〜DBの領域について算出した代表動きベクトル2100〜2107を示している。
S2403
The conversion coefficient determination unit 212 performs coordinate conversion of the reference point using the geometric conversion coefficient calculated by the conversion coefficient calculation unit 211 in S1505, and creates a motion vector having the coordinates before conversion as the start point and the coordinates after conversion as the end point. To do. The content of the process is the same as S1506. This motion vector is called a representative motion vector of the i-th subject group region. In the present embodiment, the reference point is the coordinate origin (0, 0). 18A to 18H show representative motion vectors 2100 to 2107 calculated for the areas of the subject groups AA to DB.

S2404
変換係数判定部212は、i番目の被写体グループ領域の代表動きベクトルを、特定の被写体グループの距離情報に基づいて正規化し、正規化代表動きベクトルを生成する。処理の内容はS1507と同一である。本実施形態では、デジタルカメラ200からの被写体グループAAの距離(被写体グループAAの代表距離)を正規化距離DAとし、S1507と同様にする。
S2404
The conversion coefficient determination unit 212 normalizes the representative motion vector of the i-th subject group region based on the distance information of the specific subject group, and generates a normalized representative motion vector. The content of the process is the same as S1507. In this embodiment, the distance of the subject group AA from the digital camera 200 (representative distance of the subject group AA) is set as the normalized distance DA, which is the same as S1507.

図19(a)〜(h)は、図18(a)〜(h)に示した各被写体グループの代表動きベクトル2100〜2107の正規化代表動きベクトル2200〜2207を示している。ここでは、被写体グループAAの距離で正規化しているため、図18(a)に示す被写体グループAAの正規化代表動きベクトル2200は、正規化前の代表動きベクトル2100と等しい。なお、図19(a)〜(h)における2208〜2215は、正規化領域動きベクトル2200〜2207がx軸となす角(動きの方向)である。   FIGS. 19A to 19H show normalized representative motion vectors 2200 to 2207 of the representative motion vectors 2100 to 2107 of the subject groups shown in FIGS. 18A to 18H. Here, since normalization is performed by the distance of the subject group AA, the normalized representative motion vector 2200 of the subject group AA shown in FIG. 18A is equal to the representative motion vector 2100 before normalization. Note that 2208 to 2215 in FIGS. 19A to 19H are angles (directions of motion) formed by the normalized region motion vectors 2200 to 2207 with the x axis.

S2405
変換係数判定部212は、算出した正規化代表動きベクトルから、基準画像と被合成画像の撮影位置の変化量および変化方向に関する推定グローバル動きベクトルを生成する。ここでは、幾何変換係数が算出された被写体グループ領域のみを処理対象とする。処理の内容はS1511と同一であるため、詳細の説明は省略する。
S1512の判定処理以下は第1実施形態と同一の処理であるため説明を省略する。
S2405
The transform coefficient determination unit 212 generates an estimated global motion vector related to the change amount and change direction of the shooting position of the reference image and the combined image from the calculated normalized representative motion vector. Here, only the subject group region for which the geometric transformation coefficient is calculated is set as the processing target. Since the content of the process is the same as S1511, detailed description is omitted.
Since the determination processing in S1512 and subsequent steps are the same as those in the first embodiment, description thereof will be omitted.

以上説明したように、本実施形態によれば、距離情報の頻度分布に基づいて被写体をグループ化した後、各グループを、対応する画像領域に基づいてさらにグループ化する。そのため、奥行きの大きな被写体が存在する場合や、同一距離に静止被写体と移動被写体が存在するようなシーンであっても、静止被写体か否かを精度良く判定でき、グローバル動きベクトルの推定精度が向上する。そのため、位置合わせの精度を向上させることができる。   As described above, according to the present embodiment, the subjects are grouped based on the frequency distribution of distance information, and then each group is further grouped based on the corresponding image region. Therefore, even when there is a subject with a large depth, or even in a scene where a stationary subject and a moving subject exist at the same distance, it is possible to accurately determine whether or not the subject is a stationary subject, improving the accuracy of global motion vector estimation. To do. Therefore, the alignment accuracy can be improved.

(その他の実施形態)
本発明は、上述の実施形態の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 a 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.

200…デジタルカメラ、201…システム制御部、204…光学系、205…撮像部、206…変換部、207…画像処理部、208…記録媒体、209…バス、210…距離情報算出部、211…変換係数算出部、212…変換係数判定部、213…幾何変換部 DESCRIPTION OF SYMBOLS 200 ... Digital camera, 201 ... System control part, 204 ... Optical system, 205 ... Imaging part, 206 ... Conversion part, 207 ... Image processing part, 208 ... Recording medium, 209 ... Bus, 210 ... Distance information calculation part, 211 ... Conversion coefficient calculation unit 212, conversion coefficient determination unit, 213, geometric conversion unit

Claims (15)

距離情報を用いて、画像の領域をグループ化するグループ化手段と、
前記グループごとに、他の画像に対する動きを検出する検出手段と、
前記動きの大きさを、特定の距離に基づいて正規化する正規化手段と、
前記大きさが正規化された動きに基づいて、前記グループごとに、静止被写体の領域か移動被写体の領域かを判定する判定手段と、
を有することを特徴とする画像処理装置。
Grouping means for grouping image regions using distance information;
Detecting means for detecting movement relative to other images for each group;
Normalizing means for normalizing the magnitude of the movement based on a specific distance;
Determining means for determining, for each of the groups, a region of a stationary subject or a region of a moving subject based on the movement whose size has been normalized;
An image processing apparatus comprising:
前記検出手段が、
前記グループごとに、前記他の画像に位置合わせするための変換係数を算出する第1の算出手段と、
前記変換係数を用いて、前記グループごとに、前記動きを表す代表動きベクトルを生成する生成手段と、
を有し、
前記正規化手段が、前記代表動きベクトルの大きさを、前記特定の距離とグループに対応する距離との比で正規化することにより、前記動きの大きさを正規化する、
ことを特徴とする請求項1記載の画像処理装置。
The detecting means;
First calculation means for calculating a conversion coefficient for aligning with the other image for each group;
Generating means for generating a representative motion vector representing the motion for each of the groups using the transform coefficient;
Have
The normalizing means normalizes the magnitude of the motion by normalizing the magnitude of the representative motion vector by a ratio of the specific distance to a distance corresponding to a group.
The image processing apparatus according to claim 1.
前記検出手段が、前記グループごとに前記動きを表す動きベクトルを検出し、
前記第1の算出手段は、
検出された前記動きベクトルの数が予め定められた定めた所定値未満であるグループに対しては前記変換係数を算出せず、
検出された前記動きベクトルの数が予め定められた定めた所定値以上であるグループに対しては前記動きベクトルに基づいて前記変換係数を算出する、
ことを特徴とする請求項2に記載の画像処理装置。
The detecting means detects a motion vector representing the motion for each group;
The first calculation means includes
For the group in which the number of detected motion vectors is less than a predetermined value determined in advance, the conversion coefficient is not calculated,
For the group in which the number of detected motion vectors is equal to or greater than a predetermined value, the conversion coefficient is calculated based on the motion vectors.
The image processing apparatus according to claim 2.
さらに、前記第1の算出手段によって前記変換係数が算出されなかったグループについて、前記第1の算出手段によって算出された他のグループについての前記変換係数を用いて算出する第2の算出手段を有することを特徴とする請求項3記載の画像処理装置。   Furthermore, it has the 2nd calculation means which calculates using the said conversion coefficient about the other group calculated by the said 1st calculation means about the group in which the said conversion coefficient was not calculated by the said 1st calculation means. The image processing apparatus according to claim 3. 前記グループごとに前記変換係数を適用し、前記他の画像に位置合わせされた画像を生成する変換手段と、
前記他の画像に位置合わせされた画像を前記他の画像に合成する合成手段と、
をさらに有することを特徴とする請求項2から4のいずれか1項に記載の画像処理装置。
Transform means for applying the transform coefficient for each group and generating an image aligned with the other image;
Synthesizing means for synthesizing the image aligned with the other image with the other image;
The image processing apparatus according to claim 2, further comprising:
前記判定手段により静止被写体の領域と判定されたグループについて前記検出手段が検出した前記動きベクトルに基づいて、前記画像の全体を前記他の画像に位置合わせするための変換係数を算出する第3の算出手段と、
前記画像の全体に前記変換係数を適用し、前記他の画像に位置合わせされた画像を生成する変換手段と、
前記他の画像に位置合わせされた画像を前記他の画像に合成する合成手段と、
をさらに有することを特徴とする請求項2から4のいずれか1項に記載の画像処理装置。
Based on the motion vector detected by the detection means for the group determined as the area of the stationary subject by the determination means, a third conversion coefficient is calculated for aligning the entire image with the other image. A calculation means;
Transform means for applying the transform coefficient to the entire image and generating an image aligned with the other image;
Synthesizing means for synthesizing the image aligned with the other image with the other image;
The image processing apparatus according to claim 2, further comprising:
前記判定手段が、
前記グループごとの前記大きさが正規化された動きに基づいて、前記他の画像に対する前記画像の全体の動きを推定する推定手段を有し、
前記大きさが正規化された動きと、前記全体の動きとの差が所定値未満であるグループを静止被写体の領域と判定し、前記大きさが正規化された動きと、前記全体の動きとの差が所定値以上であるグループを移動被写体の領域と判定する、
ことを特徴とする請求項1から6のいずれか1項に記載の画像処理装置。
The determination means is
Estimating means for estimating the overall motion of the image relative to the other image based on the normalized motion of the group for each group;
A group in which the difference between the motion with the normalized size and the overall motion is less than a predetermined value is determined as a still subject region, and the motion with the normalized size and the overall motion are A group in which the difference between the two is greater than or equal to a predetermined value is determined as a moving subject area;
The image processing apparatus according to claim 1, wherein the image processing apparatus is an image processing apparatus.
前記推定手段は、前記グループごとの前記大きさが正規化された動きの大きさおよび方向の頻度に基づいて、前記画像の全体の動きを推定することを特徴とする請求項7記載の画像処理装置。   The image processing according to claim 7, wherein the estimation unit estimates an overall motion of the image based on a motion magnitude and a direction frequency in which the size is normalized for each group. apparatus. 前記グループ化手段は、同じ距離範囲に含まれる領域が同じグループに属するように前記グループ化を行うことを特徴とする請求項1から8のいずれか1項に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein the grouping unit performs the grouping so that regions included in the same distance range belong to the same group. 前記グループ化手段は、前記距離情報の頻度分布に基づいて前記グループ化を行うことを特徴とする請求項1から9のいずれか1項に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein the grouping unit performs the grouping based on a frequency distribution of the distance information. 前記グループ化手段は、前記グループ化された領域を、閉領域ごとにさらにグループ化することを特徴とする請求項10に記載の画像処理装置。   The image processing apparatus according to claim 10, wherein the grouping unit further groups the grouped areas for each closed area. 前記距離情報が、前記画像の画素ごとの距離を表す情報であることを特徴とする請求項1から11のいずれか1項に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein the distance information is information representing a distance for each pixel of the image. 視差画像を取得可能な撮像手段と、
前記視差画像から前記距離情報を生成する第4の算出手段と、
前記視差画像から前記画像を生成する画像処理手段と、
請求項1から12のいずれか1項に記載の画像処理装置と、
を有することを特徴とする撮像装置。
Imaging means capable of acquiring parallax images;
Fourth calculation means for generating the distance information from the parallax image;
Image processing means for generating the image from the parallax image;
The image processing apparatus according to any one of claims 1 to 12,
An imaging device comprising:
グループ化手段が、距離情報を用いて、画像の領域をグループ化するグループ化工程と、
検出手段が、前記グループごとに、他の画像に対する動きを検出する検出工程と、
正規化手段が、前記動きの大きさを、特定の距離に基づいて正規化する正規化工程と、
判定手段が、前記大きさが正規化された動きに基づいて、前記グループごとに、静止被写体の領域か移動被写体の領域かを判定する判定工程と、
を有することを特徴とする画像処理装置の制御方法。
A grouping means for grouping image regions using distance information;
A detecting step for detecting movement of the other image for each of the groups;
A normalizing step in which normalizing means normalizes the magnitude of the movement based on a specific distance;
A determination step of determining, for each of the groups, a region of a stationary subject or a region of a moving subject based on the movement whose size has been normalized;
A control method for an image processing apparatus, comprising:
コンピュータを、請求項1から12のいずれか1項に記載の画像処理装置の各手段として機能させるためのプログラム。   The program for functioning a computer as each means of the image processing apparatus of any one of Claim 1 to 12.
JP2015023544A 2015-02-09 2015-02-09 Image processing apparatus and control method thereof Active JP6452481B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2015023544A JP6452481B2 (en) 2015-02-09 2015-02-09 Image processing apparatus and control method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2015023544A JP6452481B2 (en) 2015-02-09 2015-02-09 Image processing apparatus and control method thereof

Publications (2)

Publication Number Publication Date
JP2016146601A JP2016146601A (en) 2016-08-12
JP6452481B2 true JP6452481B2 (en) 2019-01-16

Family

ID=56685654

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2015023544A Active JP6452481B2 (en) 2015-02-09 2015-02-09 Image processing apparatus and control method thereof

Country Status (1)

Country Link
JP (1) JP6452481B2 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6602286B2 (en) * 2016-12-07 2019-11-06 キヤノン株式会社 Image processing apparatus, image processing method, and program
JP7030431B2 (en) * 2017-06-26 2022-03-07 株式会社東芝 Inspection support system and inspection support control program
JP2019168886A (en) * 2018-03-23 2019-10-03 カシオ計算機株式会社 Detection body region detecting device, imaging device, flying device, detection body region detecting method, imaging method and program
WO2023089706A1 (en) * 2021-11-17 2023-05-25 日本電信電話株式会社 Image processing device, image processing method, and program

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2600504B2 (en) * 1991-01-25 1997-04-16 日本ビクター株式会社 Motion vector detection circuit
JP2008294785A (en) * 2007-05-25 2008-12-04 Sanyo Electric Co Ltd Image processor, imaging apparatus, image file, and image processing method
JP4506875B2 (en) * 2008-05-19 2010-07-21 ソニー株式会社 Image processing apparatus and image processing method
JP5155110B2 (en) * 2008-11-17 2013-02-27 株式会社日立国際電気 Monitoring device

Also Published As

Publication number Publication date
JP2016146601A (en) 2016-08-12

Similar Documents

Publication Publication Date Title
JP5954668B2 (en) Image processing apparatus, imaging apparatus, and image processing method
US9253377B2 (en) Image processing device and image processing system where de-mosaic image is generated based on shift amount estimation of pixels of captured images
US9025862B2 (en) Range image pixel matching method
US8144974B2 (en) Image processing apparatus, method, and program
US9619886B2 (en) Image processing apparatus, imaging apparatus, image processing method and program
JP6561512B2 (en) Parallax value deriving device, moving body, robot, parallax value deriving method, parallax value producing method, and program
JP2017531976A (en) System and method for dynamically calibrating an array camera
JP6452481B2 (en) Image processing apparatus and control method thereof
US8836765B2 (en) Apparatus and method for generating a fully focused image by using a camera equipped with a multi-color filter aperture
US9483825B2 (en) Apparatus and method for estimating distance using dual off-axis color filter aperture
JP7024736B2 (en) Image processing equipment, image processing method, and program
US20170034436A1 (en) Image capturing apparatus
JPWO2012176556A1 (en) Corresponding point search device and distance measurement device
JP6544978B2 (en) Image output apparatus, control method therefor, imaging apparatus, program
JP7195801B2 (en) Image processing device and its control method, distance detection device, imaging device, program
JP2016070774A (en) Parallax value derivation device, moving body, robot, parallax value production method and program
WO2019216229A1 (en) Data processing device, data processing method, and program
US20130076868A1 (en) Stereoscopic imaging apparatus, face detection apparatus and methods of controlling operation of same
JP6648916B2 (en) Imaging device
JP7293100B2 (en) camera system
US10332259B2 (en) Image processing apparatus, image processing method, and program
JP7013205B2 (en) Image shake correction device and its control method, image pickup device
JP2016099322A (en) Imaging device, control method of imaging device, and program
JP6292785B2 (en) Image processing apparatus, image processing method, and program
JP7346021B2 (en) Image processing device, image processing method, imaging device, program and recording medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20180205

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20181105

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20181112

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20181211

R151 Written notification of patent or utility model registration

Ref document number: 6452481

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151