[go: up one dir, main page]

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

Image processing apparatus, image processing method, and program Download PDF

Info

Publication number
JP5928024B2
JP5928024B2 JP2012057968A JP2012057968A JP5928024B2 JP 5928024 B2 JP5928024 B2 JP 5928024B2 JP 2012057968 A JP2012057968 A JP 2012057968A JP 2012057968 A JP2012057968 A JP 2012057968A JP 5928024 B2 JP5928024 B2 JP 5928024B2
Authority
JP
Japan
Prior art keywords
subject
area
depth value
background
region
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
JP2012057968A
Other languages
Japanese (ja)
Other versions
JP2013192115A5 (en
JP2013192115A (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.)
Casio Computer Co Ltd
Original Assignee
Casio Computer Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Casio Computer Co Ltd filed Critical Casio Computer Co Ltd
Priority to JP2012057968A priority Critical patent/JP5928024B2/en
Publication of JP2013192115A publication Critical patent/JP2013192115A/en
Publication of JP2013192115A5 publication Critical patent/JP2013192115A5/ja
Application granted granted Critical
Publication of JP5928024B2 publication Critical patent/JP5928024B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Description

本発明は、撮像画像のデプスマップを生成する画像処理装置、画像処理方法及びプログラムに関する。   The present invention relates to an image processing apparatus, an image processing method, and a program for generating a depth map of a captured image.

従来、同一の画角でフォーカス位置を変えて撮像した複数の撮像画像から、被写体の奥行きの情報を表すデプスマップを生成する画像処理装置が知られている(例えば、特許文献1参照)。デプスマップが生成される場合、被写体に合焦させた画像と背景側に焦点をずらした画像とを撮像し、エッジの強さ等に基づいて各領域の合焦の状態を比較することにより、被写体の画像領域であるか背景の画像領域であるかを判定する。そして、その判定結果に基づいて、それぞれの領域内の各画素に奥行きの情報が割り当てられる。   2. Description of the Related Art Conventionally, there is known an image processing apparatus that generates a depth map representing depth information of a subject from a plurality of captured images captured by changing the focus position at the same angle of view (see, for example, Patent Document 1). When a depth map is generated, by capturing an image focused on the subject and an image shifted in focus on the background side, and comparing the focus state of each area based on the strength of the edge, etc. It is determined whether the image area is a subject image area or a background image area. Then, based on the determination result, depth information is assigned to each pixel in each region.

特開2009−232382号公報JP 2009-232382 A

しかしながら、移動する被写体を撮像した場合、移動により被写体が消えて背景となった領域は、被写体の画像領域であるか背景の画像領域であるかについての判定を適切に行うことが困難である。
また、模様のない壁のような平坦な被写体が写った領域についても、合焦状態を明確に区別できず、被写体の画像領域であるか背景の画像領域であるかについての判定を適切に行うことができない場合がある。
However, when a moving subject is imaged, it is difficult to appropriately determine whether the region that has disappeared due to the movement and becomes a background is the image region of the subject or the background image region.
In addition, even for an area where a flat subject such as an unpatterned wall is shown, the in-focus state cannot be clearly distinguished, and an appropriate determination is made as to whether it is the subject image area or the background image area. It may not be possible.

従来、このように被写体の画像領域であるか背景の画像領域であるかが明確に判定できない領域については、被写体の画像領域と背景の画像領域との中間値の奥行きを有する領域としており、この場合、正確なデプスマップとはならない。
このように、デプスマップを生成する従来の技術においては、正確なデプスマップを生成することが困難であった。
Conventionally, an area where it is not possible to clearly determine whether the image area of the subject or the background image area is an area having an intermediate depth between the image area of the subject and the background image area. If not, it will not be an accurate depth map.
Thus, in the conventional technique for generating a depth map, it is difficult to generate an accurate depth map.

本発明は、このような状況に鑑みてなされたものであり、より正確なデプスマップを生成することを目的とする。   The present invention has been made in view of such a situation, and an object thereof is to generate a more accurate depth map.

上記目的を達成するため、本発明に係る画像処理装置の一様態は、特定の被写体に合焦して撮像された被写体合焦画像のデータと、前記特定の被写体の背景側に焦点をずらして撮像された背景合焦画像のデータとを取得する画像取得手段と、前記被写体合焦画像のデータと前記背景合焦画像のデータとに基づいて、前記被写体合焦画像に含まれる領域それぞれが、前記特定の被写体に対応する奥行きを有する被写体領域と、前記背景に対応する奥行きを有する背景領域と、前記被写体領域及び前記背景領域以外の非特定領域とのいずれの領域であるかを判定する領域判定手段と、前記領域判定手段の判定結果に基づいて、前記被写体領域に前記特定の被写体に対応する奥行きを表すデプス値を設定し、前記背景領域に前記背景に対応する奥行きを表すデプス値を設定するデプス値設定手段と、前記被写体合焦画像と前記背景合焦画像とにおける前記非特定領域の画像に基づいて、前記デプス値設定手段によって設定された前記被写体領域のデプス値あるいは前記背景領域のデプス値のいずれかを基に決定された値を、前記非特定領域の奥行きを表すデプス値として設定するデプス値拡張処理手段と、を備え、前記デプス値設定手段は、前記被写体領域、前記背景領域及び前記非特定領域のそれぞれの画素に仮デプス値を設定し、前記デプス値拡張処理手段は、前記非特定領域内の各画素を対象として、前記非特定領域に隣接する前記非特定領域以外の周辺領域から所定の条件を満たす少なくとも1以上の拡張元画素の仮デプス値に基づいて拡張デプス値を求め、前記拡張デプス値を前記非特定領域内の各画素のデプス値としてそれぞれ設定する、ことを特徴とする。
また、上記目的を達成するため、本発明に係る画像処理方法の一様態は、特定の被写体に合焦して撮像された被写体合焦画像のデータと、前記特定の被写体の背景側に焦点をずらして撮像された背景合焦画像のデータと、を取得する画像取得ステップと、前記被写体合焦画像のデータと前記背景合焦画像のデータとに基づいて、前記被写体合焦画像に含まれる領域それぞれが、前記特定の被写体に対応する奥行きを有する被写体領域と、前記背景に対応する奥行きを有する背景領域と、前記被写体領域及び前記背景領域以外の非特定領域と、のいずれの領域であるかを判定する領域判定ステップと、前記領域判定ステップにおける判定結果に基づいて、前記被写体領域に前記特定の被写体に対応する奥行きを表すデプス値を設定し、前記背景領域に前記背景に対応する奥行きを表すデプス値を設定するデプス値設定ステップと、前記被写体合焦画像と前記背景合焦画像とにおける前記非特定領域の画像に基づいて、前記デプス値設定ステップにおいて設定された前記被写体領域のデプス値あるいは前記背景領域のデプス値のいずれかを基に決定された値を、前記非特定領域の奥行きを表すデプス値として設定するデプス値拡張処理ステップと、を含み、前記デプス値設定ステップにおいては、前記被写体領域、前記背景領域及び前記非特定領域のそれぞれの画素に仮デプス値を設定し、前記デプス値拡張処理ステップにおいては、前記非特定領域内の各画素を対象として、前記非特定領域に隣接する前記非特定領域以外の周辺領域から所定の条件を満たす少なくとも1以上の拡張元画素の仮デプス値に基づいて拡張デプス値を求め、前記拡張デプス値を前記非特定領域内の各画素のデプス値としてそれぞれ設定する、ことを特徴とする。
また、上記目的を達成するため、本発明に係るプログラムの一様態は、コンピュータに、特定の被写体に合焦して撮像された被写体合焦画像のデータと、前記特定の被写体の背景側に焦点をずらして撮像された背景合焦画像のデータと、を取得する画像取得機能と、前記被写体合焦画像のデータと前記背景合焦画像のデータとに基づいて、前記被写体合焦画像に含まれる領域それぞれが、前記特定の被写体に対応する奥行きを有する被写体領域と、前記背景に対応する奥行きを有する背景領域と、前記被写体領域及び前記背景領域以外の非特定領域と、のいずれの領域であるかを判定する領域判定機能と、前記領域判定機能の判定結果に基づいて、前記被写体領域に前記特定の被写体に対応する奥行きを表すデプス値を設定し、前記背景領域に前記背景に対応する奥行きを表すデプス値を設定するデプス値設定機能と、前記被写体合焦画像と前記背景合焦画像とにおける前記非特定領域の画像に基づいて、前記デプス値設定機能によって設定された前記被写体領域のデプス値あるいは前記背景領域のデプス値のいずれかを基に決定された値を、前記非特定領域の奥行きを表すデプス値として設定するデプス値拡張処理機能と、を実現させ、前記デプス値設定機能は、前記被写体領域、前記背景領域及び前記非特定領域のそれぞれの画素に仮デプス値を設定し、前記デプス値拡張処理機能は、前記非特定領域内の各画素を対象として、前記非特定領域に隣接する前記非特定領域以外の周辺領域から所定の条件を満たす少なくとも1以上の拡張元画素の仮デプス値に基づいて拡張デプス値を求め、前記拡張デプス値を前記非特定領域内の各画素のデプス値としてそれぞれ設定する、ことを特徴とする。
In order to achieve the above object, one aspect of the image processing apparatus according to the present invention is to shift the focus to the data of a subject focused image captured by focusing on a specific subject and the background side of the specific subject. Each of the regions included in the subject in-focus image is based on the image acquisition means for acquiring the data of the captured background in-focus image, and the data of the subject in-focus image and the data of the background in-focus image. , determination and subject area having a depth corresponding to the specific object, and a background region having a depth corresponding to the background, and the object area and the non-specific region other than the background area, which one of the regions of A depth value representing a depth corresponding to the specific subject is set in the subject region, and the background region corresponds to the background based on a determination result of the region determining unit A depth value setting means for setting a depth value representative of the go, based on the image of the non-specific region of said subject focused image and the background focus image, of the object area set by the depth value setting means the determined value based on any of the depth value of the depth value or the background region, wherein the depth value expansion processing means for setting a depth value representing the depth of the non-specific region, Bei example, said depth value setting means Sets a tentative depth value for each pixel in the subject area, the background area, and the non-specific area, and the depth value expansion processing means targets each pixel in the non-specific area for the non-specific area. An extended depth value is obtained based on a temporary depth value of at least one extended source pixel that satisfies a predetermined condition from a peripheral region other than the non-specific region adjacent to the extended depth value; Respectively set as the depth value of each pixel of the non-specific region, and wherein the.
In order to achieve the above object, according to one aspect of the image processing method of the present invention, a subject focused image data picked up by focusing on a specific subject and a focus on the background side of the specific subject. A region included in the subject in-focus image based on the image acquisition step of acquiring the data of the background in-focus image captured by shifting, the data of the subject in-focus image and the data of the background in-focus image Whether each of the subject region has a depth corresponding to the specific subject, a background region having a depth corresponding to the background, or a non-specific region other than the subject region and the background region And a depth value representing a depth corresponding to the specific subject is set in the subject region based on the judgment result in the region judging step, and the background In the depth value setting step for setting a depth value representing the depth corresponding to the background in the area, and in the depth value setting step based on the image of the non-specific area in the subject focused image and the background focused image A depth value expansion processing step for setting a value determined based on either the set depth value of the subject area or the depth value of the background area as a depth value representing the depth of the non-specific area, In the depth value setting step, a temporary depth value is set for each pixel in the subject area, the background area, and the non-specific area, and in the depth value expansion processing step, each pixel in the non-specific area is set. And at least one extension source that satisfies a predetermined condition from a peripheral region other than the non-specific region adjacent to the non-specific region It obtains an extended depth value based on the temporary depth value of the unit, respectively set the extended depth value as the depth value of each pixel of the non-specific region, and wherein the.
In order to achieve the above object, an aspect of the program according to the present invention is that a computer focuses on data of a subject in-focus image captured by focusing on a specific subject and on the background side of the specific subject. Included in the subject in-focus image based on the image acquisition function for acquiring the background in-focus image data captured by shifting the image, the subject in-focus image data, and the background in-focus image data Each region is any one of a subject region having a depth corresponding to the specific subject, a background region having a depth corresponding to the background, and a non-specific region other than the subject region and the background region. A depth value representing a depth corresponding to the specific subject is set in the subject region based on a judgment result of the region judgment function and the judgment result of the region judgment function, and the background region A depth value setting function for setting a depth value representing the depth corresponding to the background, and a depth value setting function based on the image of the non-specific region in the subject focused image and the background focused image. A depth value expansion processing function for setting a value determined based on either the depth value of the subject area or the depth value of the background area as a depth value representing the depth of the non-specific area, and The depth value setting function sets a temporary depth value for each pixel in the subject area, the background area, and the non-specific area, and the depth value expansion processing function targets each pixel in the non-specific area. The extended depth based on a temporary depth value of at least one extension source pixel that satisfies a predetermined condition from a peripheral region adjacent to the non-specific region that is adjacent to the non-specific region The calculated, respectively set the extended depth value as the depth value of each pixel of the non-specific region, and wherein the.

本発明によれば、より正確なデプスマップを生成することが可能となる。   According to the present invention, it is possible to generate a more accurate depth map.

本発明の一実施形態に係る画像処理装置のハードウェアの構成を示すブロック図である。1 is a block diagram illustrating a hardware configuration of an image processing apparatus according to an embodiment of the present invention. 図1の画像処理装置の機能的構成のうち、デプスマップ生成処理を実行するための機能的構成を示す機能ブロック図である。It is a functional block diagram which shows the functional structure for performing a depth map production | generation process among the functional structures of the image processing apparatus of FIG. デプスマップ生成処理において参照される画像の具体例を示す模式図である。It is a schematic diagram which shows the specific example of the image referred in a depth map production | generation process. 図2の機能的構成を有する図1の画像処理装置1が実行するデプスマップ生成処理の流れの一例を説明するフローチャートである。3 is a flowchart for explaining an example of a flow of depth map generation processing executed by the image processing apparatus 1 of FIG. 1 having the functional configuration of FIG. 2.

以下、本発明の実施形態について、図面を用いて説明する。   Hereinafter, embodiments of the present invention will be described with reference to the drawings.

(構成)
図1は、本発明の一実施形態に係る画像処理装置のハードウェアの構成を示すブロック図である。
画像処理装置1は、例えばデジタルカメラにより構成することができる。
(Constitution)
FIG. 1 is a block diagram showing a hardware configuration of an image processing apparatus according to an embodiment of the present invention.
The image processing apparatus 1 can be configured by a digital camera, for example.

画像処理装置1は、CPU(Central Processing Unit)11と、ROM(Read Only Memory)12と、RAM(Random Access Memory)13と、バス14と、入出力インターフェース15と、撮像部16と、操作部17と、表示部18と、記憶部19と、通信部20と、メディアドライブ21と、を備えている。   The image processing apparatus 1 includes a CPU (Central Processing Unit) 11, a ROM (Read Only Memory) 12, a RAM (Random Access Memory) 13, a bus 14, an input / output interface 15, an imaging unit 16, and an operation unit. 17, a display unit 18, a storage unit 19, a communication unit 20, and a media drive 21.

CPU11は、ROM12に記録されているプログラム、または、記憶部19からRAM13にロードされたプログラムに従って各種の処理を実行する。   The CPU 11 executes various processes according to a program recorded in the ROM 12 or a program loaded from the storage unit 19 to the RAM 13.

RAM13には、CPU11が各種の処理を実行する上において必要なデータ等も適宜記憶される。   The RAM 13 appropriately stores data necessary for the CPU 11 to execute various processes.

CPU11、ROM12及びRAM13は、バス14を介して相互に接続されている。このバス14にはまた、入出力インターフェース15も接続されている。入出力インターフェース15には、撮像部16、操作部17、表示部18、記憶部19、通信部20及びメディアドライブ21が接続されている。   The CPU 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output interface 15 is also connected to the bus 14. An imaging unit 16, an operation unit 17, a display unit 18, a storage unit 19, a communication unit 20, and a media drive 21 are connected to the input / output interface 15.

撮像部16は、図示はしないが、光学レンズ部と、イメージセンサと、を備えている。   Although not shown, the imaging unit 16 includes an optical lens unit and an image sensor.

光学レンズ部は、被写体を撮影するために、光を集光するレンズ、例えばフォーカスレンズやズームレンズ等で構成される。
フォーカスレンズは、イメージセンサの受光面に被写体像を結像させるレンズである。ズームレンズは、焦点距離を一定の範囲で自在に変化させるレンズである。
光学レンズ部にはまた、必要に応じて、焦点、露出、ホワイトバランス等の設定パラメータを調整する周辺回路が設けられる。
The optical lens unit is configured by a lens that collects light, for example, a focus lens or a zoom lens, in order to photograph a subject.
The focus lens is a lens that forms a subject image on the light receiving surface of the image sensor. The zoom lens is a lens that freely changes the focal length within a certain range.
The optical lens unit is also provided with a peripheral circuit for adjusting setting parameters such as focus, exposure, and white balance as necessary.

イメージセンサは、光電変換素子や、AFE(Analog Front End)等から構成される。
光電変換素子は、例えばCMOS(Complementary Metal Oxide Semiconductor)型の光電変換素子等から構成される。光電変換素子には、光学レンズ部から被写体像が入射される。そこで、光電変換素子は、被写体像を光電変換(撮像)して画像信号を一定時間蓄積し、蓄積した画像信号をアナログ信号としてAFEに順次供給する。
AFEは、このアナログの画像信号に対して、A/D(Analog/Digital)変換処理等の各種信号処理を実行する。各種信号処理によって、ディジタル信号が生成され、撮像部16の出力信号として出力される。
このような撮像部16の出力信号を、以下、「撮像画像のデータ」と呼ぶ。撮像画像のデータは、CPU11等に適宜供給される。
The image sensor includes a photoelectric conversion element, AFE (Analog Front End), and the like.
The photoelectric conversion element is composed of, for example, a CMOS (Complementary Metal Oxide Semiconductor) type photoelectric conversion element or the like. A subject image is incident on the photoelectric conversion element from the optical lens unit. Therefore, the photoelectric conversion element photoelectrically converts (captures) the subject image, accumulates the image signal for a predetermined time, and sequentially supplies the accumulated image signal as an analog signal to the AFE.
The AFE performs various signal processing such as A / D (Analog / Digital) conversion processing on the analog image signal. Through various signal processing, a digital signal is generated and output as an output signal of the imaging unit 16.
Hereinafter, the output signal of the imaging unit 16 is referred to as “captured image data”. The captured image data is appropriately supplied to the CPU 11 or the like.

操作部17は、各種ボタン等で構成され、ユーザの指示操作に応じて各種情報を入力する。
表示部18は、ディスプレイやスピーカ等で構成され、画像や音声を出力する。
記憶部19は、ハードディスクあるいはDRAM(Dynamic Random Access Memory)等で構成され、各種画像のデータを記憶する。
通信部20は、USB(Universal Serial Bus)や赤外線通信等の通信インターフェースを有し、インターネット等のネットワークを介して他の装置(図示せず)との間で行う通信を制御する。
The operation unit 17 is configured with various buttons and the like, and inputs various information according to user instruction operations.
The display unit 18 includes a display, a speaker, and the like, and outputs an image and sound.
The storage unit 19 is composed of a hard disk or a DRAM (Dynamic Random Access Memory) or the like, and stores various image data.
The communication unit 20 has a communication interface such as USB (Universal Serial Bus) or infrared communication, and controls communication performed with other devices (not shown) via a network such as the Internet.

メディアドライブ21には、磁気ディスク、光ディスク、光磁気ディスク、あるいは半導体メモリ等よりなる、リムーバブルメディア31が適宜装着される。メディアドライブ21によってリムーバブルメディア31から読み出されたプログラムは、必要に応じて記憶部19にインストールされる。また、リムーバブルメディア31は、記憶部19に記憶されている画像のデータ等の各種データも、記憶部19と同様に記憶することができる。   A removable medium 31 made of a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is appropriately attached to the media drive 21. The program read from the removable medium 31 by the media drive 21 is installed in the storage unit 19 as necessary. The removable medium 31 can also store various data such as image data stored in the storage unit 19 in the same manner as the storage unit 19.

図2は、このような画像処理装置1の機能的構成のうち、デプスマップ生成処理を実行するための機能的構成を示す機能ブロック図である。
デプスマップ生成処理とは、被写体に合焦した撮像画像と背景側に焦点をずらした撮像画像とを撮像し、被写体の領域と背景の領域とを判定して、いずれにも判定されない領域に、被写体の領域あるいは背景の領域の奥行きの情報(デプス値)を基に決定した奥行きの情報を設定することにより、画像における各領域内の奥行きの分布を表すデプスマップを生成するまでの一連の処理をいう。
FIG. 2 is a functional block diagram showing a functional configuration for executing the depth map generation process among the functional configurations of the image processing apparatus 1.
Depth map generation processing is to capture a captured image focused on a subject and a captured image shifted in focus on the background side, determine a subject region and a background region, A series of processing until a depth map is generated that represents the depth distribution in each area in the image by setting the depth information determined based on the depth information (depth value) of the subject area or the background area Say.

デプスマップ生成処理が実行される場合、CPU11においては、撮像制御部51と、画像取得部52と、画像変形処理部53と、領域判定部54と、拡張元領域特定部55と、デプス値拡張処理部56と、が機能する。
なお、撮像制御部51乃至デプス値拡張処理部56の機能の少なくとも一部を、CPU11以外の他の構成要素(例えば、図示しないグラフィックアクセラレータ等)に移譲させてもよい。
When the depth map generation process is executed, in the CPU 11, the imaging control unit 51, the image acquisition unit 52, the image deformation processing unit 53, the region determination unit 54, the expansion source region specification unit 55, and the depth value extension The processing unit 56 functions.
Note that at least some of the functions of the imaging control unit 51 to the depth value expansion processing unit 56 may be transferred to other components (for example, a graphic accelerator (not shown)) other than the CPU 11.

撮像制御部51は、操作部17のシャッタボタン等の操作を契機として、撮像部16を制御する。例えば、撮像制御部51は、シャッタボタンの途中(下限に至らない所定の位置)まで押下する操作(以下、「半押し操作」または単に「半押し」と呼ぶ)があった場合や、シャッタボタンを下限まで押下する操作(以下、「全押し操作」または単に「全押し」と呼ぶ)があった場合に、撮像部16における合焦及び露光等を制御する。
即ち、撮像制御部51は、半押し操作があった場合には、フォーカスレンズを被写体に合焦させるよう撮像部16を制御する。
また、撮像制御部51は、全押し操作があった場合には、撮像指示の情報を撮像部16に通知し、フォーカスレンズを被写体に合焦させた画像及び背景側に焦点をずらした画像を連続して撮像するよう撮像部16を制御する。
The imaging control unit 51 controls the imaging unit 16 triggered by the operation of the shutter button or the like of the operation unit 17. For example, the imaging control unit 51 performs an operation of pressing down to the middle of the shutter button (a predetermined position that does not reach the lower limit) (hereinafter referred to as “half-pressing operation” or simply “half-pressing”), or the shutter button When there is an operation of pressing down to the lower limit (hereinafter referred to as “full press operation” or simply “full press”), the focusing and exposure in the imaging unit 16 are controlled.
In other words, the imaging control unit 51 controls the imaging unit 16 to focus the focus lens on the subject when a half-press operation is performed.
In addition, when there is a full-press operation, the imaging control unit 51 notifies the imaging unit 16 of imaging instruction information, and an image in which the focus lens is focused on the subject and an image in which the focus is shifted to the background side are displayed. The imaging unit 16 is controlled to continuously capture images.

撮像部16は、撮像制御部51から撮像指示の情報を受け取るとフォーカスレンズを被写体に合焦させた撮像画像(以下、「被写体合焦画像」という)と背景側に焦点をずらした撮像画像(以下、「背景合焦画像」という)とを連続して撮像し、被写体合焦画像及び背景合焦画像のデータを画像取得部52に供給する。   When the imaging unit 16 receives information on the imaging instruction from the imaging control unit 51, the imaging image in which the focus lens is focused on the subject (hereinafter referred to as “subject focused image”) and the captured image in which the focus is shifted toward the background side ( (Hereinafter referred to as “background focused image”) and the data of the subject focused image and the background focused image are supplied to the image acquisition unit 52.

画像取得部52は、撮像部16から被写体合焦画像及び背景合焦画像のデータが供給されると、記憶部19に記憶させるとともに、被写体合焦画像及び背景合焦画像のデータを画像変形処理部53に供給する。   When the image of the subject in-focus image and the background in-focus image is supplied from the image capturing unit 16, the image acquisition unit 52 stores the data in the storage unit 19 and performs image transformation processing on the data of the object in-focus image and the background in-focus image. To the unit 53.

画像変形処理部53は、画像取得部52から、被写体合焦画像及び背景合焦画像のデータが供給されると、2つの画像のずれを整合させるための画像変形処理を実行する。即ち、画像変形処理部53は、被写体合焦画像と背景合焦画像との特徴点が重なるように位置合わせを行う。さらに、画像変形処理部53は、被写体合焦画像と背景合焦画像とがより正確に重なり合うようアフィン変換等により画像の変形を行う。
画像変形処理部53により、画像変形処理が施された被写体合焦画像及び背景合焦画像のデータは、領域判定部54に供給される。
When the image focus processing unit 53 receives data of the subject focused image and the background focused image from the image acquisition unit 52, the image deformation processing unit 53 executes image deformation processing for matching the shift between the two images. That is, the image deformation processing unit 53 performs alignment so that the feature points of the subject focused image and the background focused image overlap. Further, the image deformation processing unit 53 performs image deformation by affine transformation or the like so that the subject focused image and the background focused image overlap more accurately.
Data of the subject focused image and the background focused image subjected to the image deformation processing by the image deformation processing unit 53 is supplied to the region determination unit 54.

領域判定部54は、動体領域抽出部54aと、エッジ強度算出部54bと、領域種別決定部54cと、を備えている。
動体領域抽出部54aは、画像変形処理部53から、画像変形処理後の被写体合焦画像及び背景合焦画像のデータが供給されると、被写体合焦画像及び背景合焦画像の輝度及び色差等の情報に基づいて、動体領域を抽出する。
ここで、動体領域とは、被写体合焦画像の撮像タイミングから背景合焦画像の撮像タイミングまでに被写体が移動することにより、撮像された物体が異なっている領域をいう。例えば、動体領域は、被写体合焦画像においては被写体が撮像され、背景合焦画像においては背景が撮像されている領域等である。動体領域の画素は、被写体合焦画像及び背景合焦画像のうち一方では被写体の画素値(輝度及び色差の値)、他方では背景の画素値をもつため、被写体合焦画像と背景合焦画像とで画素値の差が大きい。そこで、本実施形態では、動体領域抽出部54aは、被写体合焦画像及び背景合焦画像の対応する位置の画素値の差異に基づいて、動体領域を判別することとする。即ち、被写体合焦画像と背景合焦画像の対応する位置における画素の画素値を比較し、画素値の差が設定された閾値よりも大きい場合、当該画素は動体領域の画素であると判断する。
上記の処理を全ての画素に対して繰返すことにより、動体領域が抽出される。
そして、上記の処理の結果、動体領域を特定するための情報(以下、「動体領域データ」と呼ぶ)が生成される。
動体領域抽出部54aは、動体領域データを領域種別決定部54cに供給する。
The region determination unit 54 includes a moving body region extraction unit 54a, an edge strength calculation unit 54b, and a region type determination unit 54c.
When the moving object region extraction unit 54a receives the data of the subject focused image and the background focused image after the image transformation processing from the image transformation processing unit 53, the luminance and color difference of the subject focused image and the background focused image, etc. Based on the information, the moving object region is extracted.
Here, the moving object region refers to a region in which an imaged object is different as the subject moves from the imaging timing of the subject focused image to the imaging timing of the background focused image. For example, the moving object region is a region where the subject is captured in the subject focused image and the background is captured in the background focused image. Since the pixels in the moving object region have the pixel value (luminance and color difference values) of the subject on one side of the subject focused image and the background focused image and the background pixel value on the other side, the subject focused image and the background focused image There is a large difference in pixel values. Therefore, in the present embodiment, the moving object region extraction unit 54a determines the moving object region based on the difference between the pixel values at corresponding positions of the subject focused image and the background focused image. That is, the pixel values of the pixels at corresponding positions of the subject focused image and the background focused image are compared, and if the pixel value difference is larger than the set threshold value, it is determined that the pixel is a moving object region pixel. .
The moving object region is extracted by repeating the above processing for all the pixels.
As a result of the above processing, information for specifying the moving object region (hereinafter referred to as “moving object region data”) is generated.
The moving body region extraction unit 54a supplies the moving body region data to the region type determination unit 54c.

エッジ強度算出部54bは、画像変形処理部53から供給される画像変形処理後の被写体合焦画像及び背景合焦画像のエッジ強度を算出する。
エッジ強度は、画像における輝度や色差の変化の度合いを表す指標であり、エッジ強度算出部54bは、被写体合焦画像及び背景合焦画像におけるエッジ強度の分布を抽出する。本実施形態においては、処理対象となる注目画素及びその周辺画素の輝度のデータに対して、ハイパスフィルタ等のエッジを検出可能なフィルタを施すことによりエッジ強度を算出する。
エッジ強度算出部54bにより算出された被写体合焦画像及び背景合焦画像のエッジ強度を示すデータは、領域種別決定部54cに供給される。
The edge strength calculation unit 54 b calculates the edge strength of the subject focused image and the background focused image after the image deformation processing supplied from the image deformation processing unit 53.
The edge strength is an index representing the degree of change in luminance and color difference in the image, and the edge strength calculation unit 54b extracts the distribution of the edge strength in the subject focused image and the background focused image. In the present embodiment, the edge strength is calculated by applying a filter capable of detecting an edge, such as a high-pass filter, to the luminance data of the target pixel to be processed and its surrounding pixels.
Data indicating the edge strength of the subject focused image and the background focused image calculated by the edge strength calculating unit 54b is supplied to the region type determining unit 54c.

領域種別決定部54cは、動体領域抽出部54aから供給された動体領域データと、エッジ強度算出部54bから取得した被写体合焦画像及び背景合焦画像のエッジ強度のデータとに基づいて、被写体合焦画像及び背景合焦画像に含まれる各領域の種別を決定する。
具体的には、領域種別決定部54cは、被写体合焦画像及び背景合焦画像に含まれる各領域が、動体領域、被写体の画像領域(以下、「被写体領域」と呼ぶ)、背景の画像領域(以下、「背景領域」と呼ぶ)、平坦部の画像領域(以下、「平坦領域」と呼ぶ)のいずれであるかを判定する。
ここで、合焦している物体像のエッジ強度は、合焦していない場合の物体像のエッジ強度に比べて大きくなる。したがって、被写体合焦画像の方が背景合焦画像よりもエッジ強度が大きい領域は被写体領域と判定でき、背景合焦画像の方が被写体合焦画像よりもエッジ強度が大きい領域は背景領域と判定できる。また、被写体合焦領域と背景合焦領域とでエッジ強度の差が小さく、エッジ強度の絶対値が小さい領域は平坦領域と判定できる。
The region type determination unit 54c performs subject alignment based on the moving object region data supplied from the moving object region extraction unit 54a and the edge strength data of the subject focused image and the background focused image acquired from the edge strength calculation unit 54b. The type of each area included in the focused image and the background focused image is determined.
Specifically, the area type determination unit 54c determines that each area included in the subject focused image and the background focused image includes a moving object area, a subject image area (hereinafter referred to as a “subject area”), and a background image area. (Hereinafter referred to as “background region”) or an image region of a flat part (hereinafter referred to as “flat region”).
Here, the edge strength of the focused object image is larger than the edge strength of the object image when not focused. Therefore, it is possible to determine that the region in which the subject focused image has a higher edge strength than the background focused image is the subject region, and the background focused image has a higher edge strength than the subject focused image is determined to be the background region. it can. Further, it is possible to determine that a region having a small difference in edge strength between the subject focused region and the background focused region and a small absolute value of the edge strength is a flat region.

そのため、本実施形態では、領域種別決定部54cは、各画素について被写体合焦画像のエッジ強度と背景合焦画像のエッジ強度とを比較して、被写体合焦画像のエッジ強度の方が大きい(例えば設定された閾値より大きい)場合は、当該画素は被写体領域であると判定する。同様に、領域種別決定部54cは、被写体合焦画像のエッジ強度と背景合焦画素のエッジ強度とを比較して、背景合焦画像のエッジ強度の方が大きい(例えば設定された閾値より大きい)場合は、当該画素は背景領域と判定する。さらに、被写体合焦画像のエッジ強度と背景合焦画素のエッジ強度との差が小さい(例えば設定された閾値以下である)場合であって、エッジ強度の絶対値が設定された閾値以下である場合には、当該画素は平坦領域であると判定する。なお、領域種別決定部54cは、動体領域データによって動体領域であることが示されている領域については、動体領域であるものと判定する。
上記の判定を全ての画素に対して繰返すことにより、全ての画素に対して被写体領域、背景領域、動体領域及び平坦領域のいずれか1つが対応付けられた情報(以下、「判定領域データ」と呼ぶ)が生成される。
領域種別決定部54cは、判定領域データを拡張元領域特定部55に供給する。
Therefore, in this embodiment, the region type determination unit 54c compares the edge strength of the subject focused image with the edge strength of the background focused image for each pixel, and the edge strength of the subject focused image is larger ( For example, if it is larger than a set threshold value, the pixel is determined to be a subject area. Similarly, the region type determination unit 54c compares the edge strength of the subject focused image with the edge strength of the background focused pixel, and the edge strength of the background focused image is larger (for example, larger than the set threshold value). ), The pixel is determined to be a background area. Furthermore, when the difference between the edge intensity of the subject focused image and the edge intensity of the background focused pixel is small (for example, below the set threshold), the absolute value of the edge intensity is below the set threshold. In this case, it is determined that the pixel is a flat region. Note that the region type determination unit 54c determines that the region indicated by the moving region data as the moving region is a moving region.
By repeating the above determination for all pixels, information (hereinafter referred to as “determination area data”) in which any one of the subject area, background area, moving object area, and flat area is associated with all pixels. Is generated).
The area type determination unit 54 c supplies the determination area data to the extension source area specifying unit 55.

拡張元領域特定部55は、領域種別決定部54cから判定領域データを取得する。
拡張元領域特定部55は、仮デプス値設定部55aと、色距離算定部55bと、関連領域判定部55cと、を備えている。
The extension source area specifying unit 55 acquires the determination area data from the area type determining unit 54c.
The extension source region specifying unit 55 includes a provisional depth value setting unit 55a, a color distance calculation unit 55b, and a related region determination unit 55c.

仮デプス値設定部55aは、動体領域データ及び判定領域データに基づいて、各画素の仮のデプス値(以下、適宜「仮デプス値」と呼ぶ)によって構成した仮デプスマップを生成する。仮デプスマップでは、例えば、動体領域の画素は128、被写体領域の画素は255、背景領域の画素は0、平坦領域の画素は128の値を仮デプス値として各画素に対応付ける。ここで、動体領域と平坦領域とは、共に、被写体領域であるか背景領域であるかの判定が困難な領域であるため、仮デプス値をこれらの中間の値としている。この動体領域と平坦領域とは、被写体領域であるか背景領域であるか、即ち、デプス値の特定が共に困難な領域であることから、以下、動体領域と平坦領域とを総称して、適宜「非特定領域」と呼ぶ。
なお、仮デプスマップのデータは、RAM13に格納され、必要に応じて参照することができる。
The provisional depth value setting unit 55a generates a provisional depth map composed of provisional depth values of each pixel (hereinafter, referred to as “temporary depth values” as appropriate) based on the moving object region data and the determination region data. In the temporary depth map, for example, the pixel of the moving object region is 128, the pixel of the subject region is 255, the pixel of the background region is 0, and the pixel of the flat region is associated with each pixel as a temporary depth value. Here, since both the moving object region and the flat region are regions where it is difficult to determine whether the object region is a subject region or a background region, the provisional depth value is an intermediate value between them. Since the moving body area and the flat area are subject areas or background areas, that is, it is difficult to specify the depth value, the moving body area and the flat area are hereinafter collectively referred to as appropriate. This is called “non-specific area”.
The data of the temporary depth map is stored in the RAM 13 and can be referred to as necessary.

関連領域判定部55cは、被写体合焦画像における動体領域及び平坦領域(非特定領域)内の画素を対象として、動体領域及び平坦領域以外の周辺画素から、色距離が設定された閾値以内である関連する領域の画素を検索する。ここで、色距離とは、2つの画素の画素値の色空間における距離をいう。例えば、画素値が輝度及び色差で表されている場合、2つの画素の輝度の差の2乗と色差の差の2乗とを加算することにより色距離とすることができる。   The related area determination unit 55c targets pixels in the moving object area and the flat area (non-specific area) in the subject in-focus image, and the color distance is within a set threshold from surrounding pixels other than the moving object area and the flat area. Search for pixels in the relevant area. Here, the color distance refers to the distance in the color space of the pixel values of two pixels. For example, when the pixel value is represented by luminance and color difference, the color distance can be obtained by adding the square of the luminance difference between two pixels and the square of the color difference difference.

そして、関連領域判定部55cは、被写体合焦画像における動体領域及び平坦領域内の画素にデプス値を拡張する元となる画素として、検索された色距離が閾値以内の画素を特定する。
具体的には、関連領域判定部55cは、被写体合焦画像において、動体領域及び平坦領域内の注目画素の周辺に位置する動体領域及び平坦領域以外の画素であって、色距離が閾値以下の少なくとも1以上の画素(以下、「拡張元画素」と呼ぶ)を特定する。
なお、拡張元画素の特定条件として、色距離が閾値以下の画素としているのは、動体領域及び平坦領域に近い色の画素は動体領域及び平坦領域と同一物である可能性が高いため、動体領域及び平坦領域のデプス値に拡張する元となる画素として適切と考えられるためである。
Then, the related area determination unit 55c specifies a pixel whose searched color distance is within a threshold as a pixel from which the depth value is extended to the pixels in the moving object area and the flat area in the subject focused image.
Specifically, the related area determination unit 55c is a pixel other than the moving object area and the flat area located around the target pixel in the moving object area and the flat area in the subject focused image, and the color distance is equal to or less than the threshold value. At least one or more pixels (hereinafter referred to as “extension source pixels”) are identified.
In addition, as a specific condition of the extension source pixel, the pixel whose color distance is equal to or smaller than the threshold is that a pixel having a color close to the moving object region and the flat region is likely to be the same as the moving object region and the flat region. This is because it is considered appropriate as a pixel from which to expand the depth value of the region and the flat region.

デプス値拡張処理部56は、関連領域判定部55cから、拡張元画素の情報を取得し、動体領域及び平坦領域内の注目画素のデプス値を、特定された拡張元画素の仮デプス値によって算出される値(以下、適宜「拡張デプス値」と呼ぶ)に置き換える。
本実施形態では、デプス値拡張処理部56は、関連領域判定部55cから、拡張元画素の情報を取得すると、動体領域及び平坦領域内の注目画素のデプス値を、当該注目画素ついて特定された拡張元画素の仮デプス値の平均値に置き換える。
デプス値拡張処理部56によって、動体領域及び平坦領域内の全ての画素について、上記のデプス値の置き換え処理が終了すると、被写体領域または背景領域内の拡張元画素の仮デプス値に基づく拡張デプス値が動体領域に拡張されて、動体領域の仮デプス値が置き換えられることになる。
即ち、被写体領域及び背景領域では仮デプス値がデプス値となり、動体領域及び平坦領域では、拡張デプス値がデプス値となる。
デプス値拡張処理部56は、被写体領域、背景領域、動体領域及び平坦領域についてのデプス値が設定されたデプスマップのデータを記憶部19に記憶させる。
The depth value expansion processing unit 56 acquires information on the expansion source pixel from the related region determination unit 55c, and calculates the depth value of the pixel of interest in the moving object region and the flat region based on the provisional depth value of the identified expansion source pixel. (Hereinafter referred to as “extended depth value” as appropriate).
In the present embodiment, when the depth value expansion processing unit 56 acquires the information of the expansion source pixel from the related region determination unit 55c, the depth value of the target pixel in the moving object region and the flat region is specified for the target pixel. Replace with the average of the temporary depth values of the expansion source pixels.
When the above depth value replacement processing is completed for all the pixels in the moving object region and the flat region by the depth value expansion processing unit 56, the expanded depth value based on the temporary depth value of the expansion source pixel in the subject region or the background region Is expanded to the moving object region, and the temporary depth value of the moving object region is replaced.
In other words, the temporary depth value becomes the depth value in the subject area and the background area, and the extended depth value becomes the depth value in the moving object area and the flat area.
The depth value expansion processing unit 56 causes the storage unit 19 to store depth map data in which depth values for the subject area, the background area, the moving object area, and the flat area are set.

以下、デプスマップ生成処理において参照される各種画像について、図3を参照して説明する。
図3は、デプスマップ生成処理において参照される画像の具体例を示す模式図である。
なお、図3においては、説明を簡単にするため、撮像画像に被写体領域、背景領域及び動体領域が含まれ、平坦領域が含まれていない場合を例に挙げて説明する。
Hereinafter, various images referred to in the depth map generation processing will be described with reference to FIG.
FIG. 3 is a schematic diagram illustrating a specific example of an image referred to in the depth map generation process.
In FIG. 3, for the sake of simplicity, a case where the captured image includes a subject area, a background area, and a moving object area, but does not include a flat area will be described as an example.

図3(A)は、被写体合焦画像81を示す模式図である。
図3(A)において、被写体合焦画像81は、画像処理装置1のフォーカスレンズが、被写体である人の顔92に合焦し、背景の森林91には合焦していない状態で撮像されている。
図3(B)は、背景合焦画像82を示す模式図である。
背景合焦画像82は、画像処理装置1のフォーカスレンズが、背景の森林91に合焦し、人の顔92には合焦していない状態で撮像されている。ここで、図3(B)においては、図3(A)の被写体合焦画像81の撮像時から人の顔92が右に移動している。
FIG. 3A is a schematic diagram showing a subject focused image 81.
In FIG. 3A, a subject focused image 81 is captured in a state where the focus lens of the image processing apparatus 1 is focused on the face 92 of the person who is the subject and is not focused on the background forest 91. ing.
FIG. 3B is a schematic diagram showing the background focused image 82.
The background focused image 82 is captured in a state where the focus lens of the image processing apparatus 1 focuses on the background forest 91 and does not focus on the human face 92. Here, in FIG. 3B, the human face 92 has moved to the right since the subject in-focus image 81 in FIG.

図3(C)は、仮デプスマップ83を示す模式図である。
動体領域抽出部54aは、図3(A)の被写体合焦画像81及び図3(B)の背景合焦画像82を参照し、画素値(例えば、輝度、色差)の差が閾値以上の画素の集合を図3(C)の動体領域A2,A4(非特定領域)として抽出する。また、領域種別決定部54cが図3(C)の背景領域A1と被写体領域A3とを決定する。そして、仮デプス値設定部55aが、動体領域、背景領域、被写体領域の各画素に仮デプス値を設定する。
例えば、図3(C)の背景領域A1にはデプス値0が、被写体領域A3にはデプス値255が、動体領域A2,A4にはデプス値128が設定される。
これにより、図3(C)に示すような仮のデプスマップとなる。
FIG. 3C is a schematic diagram showing a provisional depth map 83.
The moving object region extraction unit 54a refers to the subject focused image 81 in FIG. 3A and the background focused image 82 in FIG. 3B, and a pixel whose difference in pixel values (for example, luminance and color difference) is greater than or equal to a threshold value. Are extracted as moving object areas A2 and A4 (non-specific areas) in FIG. Further, the region type determination unit 54c determines the background region A1 and the subject region A3 in FIG. Then, the temporary depth value setting unit 55a sets a temporary depth value for each pixel of the moving object region, the background region, and the subject region.
For example, a depth value 0 is set in the background area A1 in FIG. 3C, a depth value 255 is set in the subject area A3, and a depth value 128 is set in the moving object areas A2 and A4.
As a result, a temporary depth map as shown in FIG.

図3(D)は、デプスマップ84を示す模式図である。
関連領域判定部55cは、図3(A)の被写体合焦画像81において、動体領域A2,A4の各画素の画素値と色距離が近い当該画素の周辺の動体領域以外の画素を拡張元画素と判定する。
即ち、図3(A)に示す例では、関連領域判定部55cは、動体領域A2の画素の画素値と色距離が近い拡張元画素を、被写体領域(人の顔92の領域)であると判定する。そのため、デプス値拡張処理部56は、動体領域A2内の各画素のデプス値を、被写体領域A3内の拡張元画素のデプス値の平均値に設定する。また、関連領域判定部55cは、動体領域A4の画素の画素値と色距離が近い拡張元画素が、背景領域(背景の森林91の領域)であると判定する。そのため、デプス値拡張処理部56は、動体領域A4内の各画素のデプス値を、背景領域A1内の拡張元画素のデプス値の平均値に設定する。
その結果、仮デプスマップ83から、デプスマップ84が生成される。即ち、動体領域A2のデプス値は被写体領域A3のデプス値の平均値となり、動体領域A4のデプス値は背景領域A1のデプス値の平均値となる結果、被写体領域あるいは背景領域のデプス値が拡張され、動体領域A5となる。
従来、動体領域は、背景と被写体の中間値等のデプス値が設定されていたところ、上記の処理により、動体領域のデプス値として、より正確なデプス値が設定されることになる。
FIG. 3D is a schematic diagram showing the depth map 84.
The related area determination unit 55c adds pixels other than the moving object area around the pixel whose color distance is close to the pixel values of the moving object areas A2 and A4 in the subject focused image 81 of FIG. Is determined.
That is, in the example illustrated in FIG. 3A, the related area determination unit 55c determines that the extension source pixel whose color distance is close to the pixel value of the pixel in the moving object area A2 is the subject area (the area of the human face 92). judge. Therefore, the depth value expansion processing unit 56 sets the depth value of each pixel in the moving object region A2 to the average value of the depth values of the expansion source pixels in the subject region A3. Further, the related area determination unit 55c determines that the extension source pixel whose color distance is close to the pixel value of the pixel of the moving object area A4 is the background area (the area of the background forest 91). Therefore, the depth value expansion processing unit 56 sets the depth value of each pixel in the moving object region A4 to the average value of the depth values of the expansion source pixels in the background region A1.
As a result, a depth map 84 is generated from the temporary depth map 83. That is, the depth value of the moving object area A2 is an average value of the depth values of the subject area A3, and the depth value of the moving object area A4 is the average value of the depth values of the background area A1, so that the depth value of the object area or the background area is expanded. And becomes a moving body region A5.
Conventionally, a depth value such as an intermediate value between the background and the subject has been set in the moving object region, but a more accurate depth value is set as the depth value of the moving object region by the above processing.

(動作)
次に、動作を説明する。
図4は、図2の機能的構成を有する図1の画像処理装置1が実行するデプスマップ生成処理の流れの一例を説明するフローチャートである。
(Operation)
Next, the operation will be described.
FIG. 4 is a flowchart for explaining an example of the flow of depth map generation processing executed by the image processing apparatus 1 of FIG. 1 having the functional configuration of FIG.

デプスマップ生成処理は、ユーザにより操作部17に対するデプスマップ生成のための操作がなされたことを契機として開始され、次のような処理が実行される。   The depth map generation process is started when an operation for generating a depth map is performed on the operation unit 17 by the user, and the following process is executed.

ステップS1において、撮像制御部51は、ユーザによるシャッタボタンの操作があったか否か判定する。
ユーザによるシャッタボタンの操作がない場合、ステップS1においてNOであると判定されて、処理はステップS1に戻る。
これに対して、ユーザによるシャッタボタンの操作がある場合、ステップS1においてYESであると判定されて、処理はステップS2に進む。
In step S1, the imaging control unit 51 determines whether or not the user has operated the shutter button.
If the user does not operate the shutter button, it is determined as NO in Step S1, and the process returns to Step S1.
On the other hand, when the user operates the shutter button, it is determined as YES in Step S1, and the process proceeds to Step S2.

ステップS2において、撮像制御部51は、ユーザによるシャッタボタンの操作が半押しであるか否か判定する。
ユーザによるシャッタボタンの操作が半押しである場合には、ステップS2においてYESと判定されて、処理はステップS3に進む。
ユーザによるシャッタボタンの操作が半押しでない、即ち、全押しである場合には、ステップS2においてNOと判定されて、処理はステップS4に進む。
In step S2, the imaging control unit 51 determines whether or not the operation of the shutter button by the user is half-pressed.
If the user operates the shutter button halfway, YES is determined in step S2, and the process proceeds to step S3.
If the shutter button operation by the user is not half-pressed, that is, if it is fully pressed, NO is determined in step S2, and the process proceeds to step S4.

ステップS3において、撮像制御部51は、撮像部16に対し、被写体に追従して合焦させるように制御を行う。その後、処理は、ステップS1に戻る。   In step S <b> 3, the imaging control unit 51 controls the imaging unit 16 so as to follow and focus on the subject. Thereafter, the process returns to step S1.

ステップS4において、撮像部16は、被写体に合焦させた被写体合焦画像を撮像するとともに、画像取得部52に被写体合焦画像のデータを供給する。   In step S <b> 4, the imaging unit 16 captures the subject focused image focused on the subject and supplies the subject focused image data to the image acquisition unit 52.

ステップS5において、撮像部16は、背景側に焦点をずらした背景合焦画像を撮像するとともに、画像取得部52に背景合焦画像のデータを供給する。   In step S <b> 5, the imaging unit 16 captures the background focused image with the focus shifted to the background side, and supplies the background acquisition image data to the image acquisition unit 52.

ステップS6において、画像変形処理部53は、画像取得部52から供給された被写体合焦画像と背景合焦画像の背景のずれを整合させるための画像変形処理を行う。   In step S <b> 6, the image transformation processing unit 53 performs image transformation processing for matching the background shift between the subject focused image and the background focused image supplied from the image acquisition unit 52.

ステップS7において、動体領域抽出部54aは、被写体合焦画像と背景合焦画像の輝度及び色差等の情報に基づいて動体領域(非特定領域)を抽出する。   In step S7, the moving object region extraction unit 54a extracts a moving object region (non-specific region) based on information such as luminance and color difference between the subject focused image and the background focused image.

ステップS8において、エッジ強度算出部54bは、被写体合焦画像と背景合焦画像とのエッジ強度を画素ごとに算出する。   In step S8, the edge strength calculation unit 54b calculates the edge strength of the subject focused image and the background focused image for each pixel.

ステップS9において、領域種別決定部54cは、被写体合焦画像と背景合焦画像とにおける各画素のエッジ強度を比較する。
被写体合焦画像のエッジ強度が背景合焦画像のエッジ強度よりも大きい(例えば設定された閾値より大きい)場合、ステップS9においてYESと判定されて、処理はステップS10に進む。
被写体合焦画像のエッジ強度が背景合焦画像のエッジ強度よりも大きくない場合、ステップS9においてNOと判定されて、処理はステップS11に進む。
In step S9, the region type determination unit 54c compares the edge strength of each pixel in the subject focused image and the background focused image.
When the edge strength of the subject focused image is larger than the edge strength of the background focused image (for example, larger than the set threshold value), YES is determined in step S9, and the process proceeds to step S10.
If the edge strength of the subject focused image is not greater than the edge strength of the background focused image, NO is determined in step S9, and the process proceeds to step S11.

ステップS10において、領域種別決定部54cは、注目画素を被写体領域に設定する。   In step S10, the region type determination unit 54c sets the target pixel as a subject region.

ステップS11において、領域種別決定部54cは、被写体合焦画像と背景合焦画像とにおける各画素のエッジ強度を比較する。
被写体合焦画像のエッジ強度が背景合焦画像のエッジ強度よりも小さい(例えば設定された閾値より小さい)場合、ステップS11においてYESと判定されて、処理はステップS12に進む。
被写体合焦画像のエッジ強度が背景合焦画像のエッジ強度よりも小さくない場合、ステップS11においてNOと判定されて、処理はステップS13に進む。
In step S11, the region type determination unit 54c compares the edge strength of each pixel in the subject focused image and the background focused image.
When the edge strength of the subject focused image is smaller than the edge strength of the background focused image (for example, smaller than the set threshold value), YES is determined in step S11, and the process proceeds to step S12.
If the edge strength of the subject focused image is not smaller than the edge strength of the background focused image, NO is determined in step S11, and the process proceeds to step S13.

ステップS12において、領域種別決定部54cは、注目画素を背景領域に設定する。   In step S12, the region type determination unit 54c sets the target pixel as a background region.

ステップS13において、領域種別決定部54cは、被写体合焦画像と背景合焦画像のエッジ強度を画素ごとに判定する。
被写体合焦画像のエッジ強度及び背景合焦画像のエッジ強度が閾値以下である場合、ステップS13においてYESと判定されて、処理はステップS14に進む。
被写体合焦画像のエッジ強度及び背景合焦画像のエッジ強度が閾値以下でない場合、ステップS13においてNOと判定されて、処理はステップS15に進む。
In step S13, the region type determination unit 54c determines the edge strength of the subject focused image and the background focused image for each pixel.
If the edge strength of the subject focused image and the edge strength of the background focused image are equal to or less than the threshold value, YES is determined in step S13, and the process proceeds to step S14.
If the edge intensity of the subject focused image and the edge intensity of the background focused image are not less than or equal to the threshold value, NO is determined in step S13, and the process proceeds to step S15.

ステップS14において、領域種別決定部54cは、注目画素を平坦領域(非特定領域)に設定する。   In step S14, the region type determination unit 54c sets the target pixel as a flat region (non-specific region).

ステップS15において、関連領域判定部55cは、動体領域及び平坦領域(非特定領域)内の画素の仮デプス値に、拡張デプス値を拡張するための元となる拡張元画素を特定する。   In step S <b> 15, the related area determination unit 55 c specifies an expansion source pixel that is a source for extending the expansion depth value, as the temporary depth value of the pixels in the moving object area and the flat area (non-specific area).

ステップS16において、デプス値拡張処理部56は、動体領域及び平坦領域内の注目画素の仮デプス値を、当該注目画素に対応する拡張元画素のデプス値から得られる拡張デプス値に設定して、デプスマップを生成する。
ステップS17において、デプス値拡張処理部56は、生成されたデプスマップのデータを記憶部19に記憶させる。その後、デプスマップ生成処理が終了となる。
In step S16, the depth value expansion processing unit 56 sets the temporary depth value of the target pixel in the moving object region and the flat region to the extended depth value obtained from the depth value of the expansion source pixel corresponding to the target pixel. Generate a depth map.
In step S <b> 17, the depth value expansion processing unit 56 causes the storage unit 19 to store the generated depth map data. Thereafter, the depth map generation process ends.

以上説明したように、本実施形態では、ユーザによる操作部17の所定の操作(シャッタボタンの全押し操作)が行われると、撮像制御部51が、撮像部16に対して、被写体合焦画像及び背景合焦画像を撮像するよう制御する。
画像取得部52は、被写体合焦画像及び背景合焦画像のデータを撮像部16から取得すると、画像変形処理部53に供給する。
画像変形処理部53は、被写体合焦画像及び背景合焦画像のデータのずれを整合させるように画像変形処理を行う。
動体領域抽出部54aは、画像変形処理部53から、画像変形処理後の被写体合焦画像及び背景合焦画像のデータが供給されると、被写体合焦画像及び背景合焦画像の輝度、色差等の情報に基づいて、動体領域を抽出する。
As described above, in the present embodiment, when a predetermined operation of the operation unit 17 by the user (a full press operation of the shutter button) is performed, the imaging control unit 51 causes the imaging unit 16 to focus on the subject. And control to capture a background focused image.
When the image acquisition unit 52 acquires the data of the subject focused image and the background focused image from the imaging unit 16, the image acquisition unit 52 supplies the data to the image deformation processing unit 53.
The image deformation processing unit 53 performs image deformation processing so as to match the data shift of the subject focused image and the background focused image.
When the moving object region extraction unit 54a receives the data of the subject focused image and the background focused image after the image transformation processing from the image transformation processing unit 53, the luminance, the color difference, and the like of the subject focused image and the background focused image, etc. Based on the information, the moving object region is extracted.

エッジ強度算出部54bは、被写体合焦画像及び背景合焦画像のエッジ強度を算出する。
領域種別決定部54cは、エッジ強度算出部54bから取得した被写体合焦画像及び背景合焦画像のエッジ強度のデータに基づいて、全ての画素について、被写体領域、背景領域、平坦領域のいずれの領域であるかを判定する。
関連領域判定部55cは、動体領域及び平坦領域(非特定領域)内の画素のデプス値を、動体領域及び平坦領域以外の周辺画素のデプス値から算出される拡張デプス値に置き換えるための、拡張元画素を特定する。
デプス値拡張処理部56は、動体領域及び平坦領域内の注目画素の仮デプス値を、当該注目画素について特定された拡張元画素のデプス値の平均値(拡張デプス値)に置き換える。
The edge strength calculation unit 54b calculates the edge strength of the subject focused image and the background focused image.
The region type determination unit 54c selects any one of the subject region, the background region, and the flat region for all pixels based on the edge strength data of the subject focused image and the background focused image acquired from the edge strength calculation unit 54b. It is determined whether it is.
The related area determination unit 55c replaces the depth values of the pixels in the moving object area and the flat area (non-specific area) with the extended depth values calculated from the depth values of surrounding pixels other than the moving object area and the flat area. Specify the original pixel.
The depth value expansion processing unit 56 replaces the provisional depth value of the pixel of interest in the moving object region and the flat region with the average value (expansion depth value) of the depth value of the expansion source pixel specified for the pixel of interest.

要するに、本実施形態では、被写体合焦画像と背景合焦画像とから動体領域、被写体領域、背景領域、平坦領域を抽出し、動体領域及び平坦領域(非特定領域)のデプス値を、周辺の被写体領域または背景領域のデプス値から算出される情報(拡張デプス値)に設定する。
これにより、従来、動体領域や平坦領域等、被写体領域であるか背景領域であるかが明確に判定できない領域のデプス値として、実際の奥行きに関わらず、信頼性のない値が格納されていたのに対し、被写体領域または背景領域のデプス値を用いて信頼性の高いデプス値を設定することができる。
したがって、本発明によれば、より正確なデプスマップを生成することが可能になる。
In short, in the present embodiment, the moving object region, the subject region, the background region, and the flat region are extracted from the subject focused image and the background focused image, and the depth values of the moving object region and the flat region (non-specific region) are set to the peripheral values. This is set to information (extended depth value) calculated from the depth value of the subject area or the background area.
As a result, conventionally, an unreliable value is stored as a depth value of a region that cannot be clearly determined as a subject region or a background region, such as a moving object region or a flat region, regardless of the actual depth. On the other hand, a highly reliable depth value can be set using the depth value of the subject area or the background area.
Therefore, according to the present invention, it is possible to generate a more accurate depth map.

なお、本発明は、上述の実施形態に限定されるものではなく、本発明の目的を達成できる範囲での変形、改良等は本発明に含まれるものである。例えば、上記実施形態においては、背景合焦画像は、被写体の背景に合焦させて撮影した撮影画像であってよく、また、被写体の背景側に焦点をずらして撮影した撮像画像であってもよい。
また、動体領域及び平坦領域の仮デプス値を拡張元画素のデプス値から算出される拡張デプス値に置き換える場合、注目画素について特定された拡張元画素のデプス値の平均値を用いることとしたが、平均値以外であっても、最大値、最小値あるいは最頻値等の代表値で置き換えることも可能である。
また、動体領域及び平坦領域の仮デプス値を、注目画素の周辺の動体領域及び平坦領域以外の画素のデプス値から算出した値で置き換えることとしたが、注目画素の周辺ではなく、被写体領域全体あるいは動体領域全体の平均値としてもよい。
また、上述の実施形態において、関連領域判定部55cは、色距離を算出する際に、輝度及び色差によって表される色空間で表されたデータを用いることとしたが、RGB色空間等の他の色空間で表されたデータを用いることとしてもよい。
In addition, this invention is not limited to the above-mentioned embodiment, The deformation | transformation in the range which can achieve the objective of this invention, improvement, etc. are included in this invention. For example, in the above-described embodiment, the background focused image may be a captured image that is captured while being focused on the background of the subject, or may be a captured image that is captured while shifting the focus on the background side of the subject. Good.
In addition, when replacing the temporary depth values of the moving object region and the flat region with the extended depth value calculated from the depth value of the extension source pixel, the average value of the depth values of the extension source pixel specified for the target pixel is used. Even a value other than the average value can be replaced with a representative value such as a maximum value, a minimum value, or a mode value.
In addition, the provisional depth values of the moving object region and the flat region are replaced with values calculated from the depth values of pixels other than the moving object region and the flat region around the target pixel. Or it is good also as an average value of the whole moving body area | region.
In the above-described embodiment, the related area determination unit 55c uses the data represented by the color space represented by the luminance and the color difference when calculating the color distance. It is also possible to use data expressed in the color space.

また、上述の実施形態では、本発明が適用される画像処理装置1として、デジタルカメラを例に挙げて説明したが、特にこれに限定されない。
例えば、本発明は、画像処理機能を有する電子機器一般に適用することができる。具体的には、例えば、本発明は、ノート型のパーソナルコンピュータ、テレビジョン受像機、ビデオカメラ、携帯型ナビゲーション装置、携帯電話機、ポータブルゲーム機等に適用可能である。
In the above-described embodiment, a digital camera has been described as an example of the image processing apparatus 1 to which the present invention is applied. However, the present invention is not particularly limited thereto.
For example, the present invention can be applied to general electronic devices having an image processing function. Specifically, for example, the present invention can be applied to a notebook personal computer, a television receiver, a video camera, a portable navigation device, a mobile phone, a portable game machine, and the like.

上述した一連の処理は、ハードウェアにより実行させることもできるし、ソフトウェアにより実行させることもできる。
換言すると、図2の機能的構成は例示に過ぎず、特に限定されない。即ち、上述した一連の処理を全体として実行できる機能が画像処理装置1に備えられていれば足り、この機能を実現するためにどのような機能ブロックを用いるのかは特に図2の例に限定されない。
また、1つの機能ブロックは、ハードウェア単体で構成してもよいし、ソフトウェア単体で構成してもよいし、それらの組み合わせで構成してもよい。
The series of processes described above can be executed by hardware or can be executed by software.
In other words, the functional configuration of FIG. 2 is merely an example and is not particularly limited. That is, it is sufficient that the image processing apparatus 1 has a function capable of executing the above-described series of processing as a whole, and what functional blocks are used to realize this function is not particularly limited to the example of FIG. .
In addition, one functional block may be constituted by hardware alone, software alone, or a combination thereof.

一連の処理をソフトウェアにより実行させる場合には、そのソフトウェアを構成するプログラムが、コンピュータ等にネットワークや記録媒体からインストールされる。
コンピュータは、専用のハードウェアに組み込まれているコンピュータであってもよい。また、コンピュータは、各種のプログラムをインストールすることで、各種の機能を実行することが可能なコンピュータ、例えば汎用のパーソナルコンピュータであってもよい。
When a series of processing is executed by software, a program constituting the software is installed on a computer or the like from a network or a recording medium.
The computer may be a computer incorporated in dedicated hardware. The computer may be a computer capable of executing various functions by installing various programs, for example, a general-purpose personal computer.

このようなプログラムを含む記録媒体は、ユーザにプログラムを提供するために装置本体とは別に配布される図1のリムーバブルメディア31により構成されるだけでなく、装置本体に予め組み込まれた状態でユーザに提供される記録媒体等で構成される。リムーバブルメディア31は、例えば、磁気ディスク(フロッピディスクを含む)、光ディスク、または光磁気ディスク等により構成される。光ディスクは、例えば、CD−ROM(Compact Disk−Read Only Memory),DVD(Digital Versatile Disk)等により構成される。光磁気ディスクは、MD(Mini−Disk)等により構成される。また、装置本体に予め組み込まれた状態でユーザに提供される記録媒体は、例えば、プログラムが記録されている図1のROM12や、図1の記憶部19に含まれるハードディスク等で構成される。   The recording medium including such a program is not only constituted by the removable medium 31 of FIG. 1 distributed separately from the apparatus main body in order to provide the program to the user, but also in a state of being incorporated in the apparatus main body in advance. It is comprised with the recording medium etc. which are provided in this. The removable medium 31 is composed of, for example, a magnetic disk (including a floppy disk), an optical disk, a magneto-optical disk, or the like. The optical disk is composed of, for example, a CD-ROM (Compact Disk-Read Only Memory), a DVD (Digital Versatile Disk), or the like. The magneto-optical disk is configured by an MD (Mini-Disk) or the like. In addition, the recording medium provided to the user in a state of being preliminarily incorporated in the apparatus main body includes, for example, the ROM 12 in FIG. 1 in which a program is recorded, the hard disk included in the storage unit 19 in FIG.

なお、本明細書において、記録媒体に記録されるプログラムを記述するステップは、その順序に沿って時系列的に行われる処理はもちろん、必ずしも時系列的に処理されなくとも、並列的あるいは個別に実行される処理をも含むものである。
また、本明細書において、システムの用語は、複数の装置や複数の手段等より構成される全体的な装置を意味するものとする。
In the present specification, the step of describing the program recorded on the recording medium is not limited to the processing performed in chronological order according to the order, but is not necessarily performed in chronological order, either in parallel or individually. The process to be executed is also included.
Further, in the present specification, the term “system” means an overall apparatus configured by a plurality of devices, a plurality of means, and the like.

以上、本発明のいくつかの実施形態について説明したが、これらの実施形態は、例示に過ぎず、本発明の技術的範囲を限定するものではない。本発明はその他の様々な実施形態を取ることが可能であり、さらに、本発明の要旨を逸脱しない範囲で、省略や置換等種々の変更を行うことができる。これら実施形態やその変形は、本明細書等に記載された発明の範囲や要旨に含まれるとともに、特許請求の範囲に記載された発明とその均等の範囲に含まれる。   As mentioned above, although several embodiment of this invention was described, these embodiment is only an illustration and does not limit the technical scope of this invention. The present invention can take other various embodiments, and various modifications such as omission and replacement can be made without departing from the gist of the present invention. These embodiments and modifications thereof are included in the scope and gist of the invention described in this specification and the like, and are included in the invention described in the claims and the equivalent scope thereof.

以下に、本願の出願当初の特許請求の範囲に記載された発明を付記する。
[付記1]
特定の被写体に合焦して撮像された被写体合焦画像のデータと、前記特定の被写体の背景側に焦点をずらして撮像された背景合焦画像のデータとを取得する画像取得手段と、
前記被写体合焦画像のデータと前記背景合焦画像のデータとに基づいて、前記被写体合焦画像に含まれる領域それぞれが、前記特定の被写体に対応する奥行きを有する被写体領域と、前記背景に対応する奥行きを有する背景領域と、前記被写体領域及び前記背景領域以外の非特定領域とのいずれの領域であるかを判定する領域判定手段と、
前記領域判定手段の判定結果に基づいて、前記被写体領域に前記特定の被写体に対応する奥行きを表すデプス値を設定し、前記背景領域に前記背景に対応する奥行きを表すデプス値を設定するデプス値設定手段と、
前記被写体合焦画像と前記背景合焦画像とにおける前記非特定領域の画像に基づいて、前記非特定領域が前記被写体領域と前記背景領域とのいずれに関連するかを判定する関連領域判定手段と、
前記関連領域判定手段の判定結果に基づいて、前記デプス値設定手段によって設定された前記被写体領域あるいは前記背景領域の前記デプス値のいずれかを基に決定された値を、前記非特定領域の奥行きを表すデプス値として設定するデプス値拡張処理手段と、
を備えることを特徴とする画像処理装置。
[付記2]
前記領域判定手段は、前記被写体合焦画像と前記背景合焦画像とで移動した移動物体の領域及び平坦な被写体が撮像されている平坦領域との少なくともいずれかを前記非特定領域として特定することを特徴とする付記1に記載の画像処理装置。
[付記3]
前記関連領域判定手段は、前記非特定領域における画素のデータと、前記非特定領域に隣接する前記被写体領域及び前記背景領域における画素のデータとの近似度合いを比較し、前記非特定領域における画素のデータにより近い画素のデータが属する領域の前記デプス値を基に、前記非特定領域の前記デプス値を決定することを特徴とする付記1または2に記載の画像処理装置。
[付記4]
前記関連領域判定手段は、前記非特定領域における画素と、前記非特定領域に隣接する前記被写体領域及び前記背景領域における画素との色距離に基づいて、前記近似度合いを比較することを特徴とする付記3に記載の画像処理装置。
[付記5]
特定の被写体に合焦して撮像された被写体合焦画像のデータと、前記特定の被写体の背景側に焦点をずらして撮像された背景合焦画像のデータとを取得する画像取得ステップと、
前記被写体合焦画像のデータと前記背景合焦画像のデータとに基づいて、前記被写体合焦画像に含まれる領域それぞれが、前記特定の被写体に対応する奥行きを有する被写体領域と、前記背景に対応する奥行きを有する背景領域と、前記被写体領域及び前記背景領域以外の非特定領域とのいずれの領域であるかを判定する領域判定ステップと、
前記領域判定ステップにおける判定結果に基づいて、前記被写体領域に前記特定の被写体に対応する奥行きを表すデプス値を設定し、前記背景領域に前記背景に対応する奥行きを表すデプス値を設定するデプス値設定ステップと、
前記被写体合焦画像と前記背景合焦画像とにおける前記非特定領域の画像に基づいて、前記非特定領域が前記被写体領域と前記背景領域とのいずれに関連するかを判定する関連領域判定ステップと、
前記関連領域判定ステップにおける判定結果に基づいて、前記デプス値設定ステップにおいて設定された前記被写体領域あるいは前記背景領域の前記デプス値のいずれかを基に決定された値を、前記非特定領域の奥行きを表すデプス値として設定するデプス値拡張処理ステップと、
を含むことを特徴とする画像処理方法。
[付記6]
コンピュータに、
特定の被写体に合焦して撮像された被写体合焦画像のデータと、前記特定の被写体の背景側に焦点をずらして撮像された背景合焦画像のデータとを取得する画像取得機能と、
前記被写体合焦画像のデータと前記背景合焦画像のデータとに基づいて、前記被写体合焦画像に含まれる領域それぞれが、前記特定の被写体に対応する奥行きを有する被写体領域と、前記背景に対応する奥行きを有する背景領域と、前記被写体領域及び前記背景領域以外の非特定領域とのいずれの領域であるかを判定する領域判定機能と、
前記領域判定機能の判定結果に基づいて、前記被写体領域に前記特定の被写体に対応する奥行きを表すデプス値を設定し、前記背景領域に前記背景に対応する奥行きを表すデプス値を設定するデプス値設定機能と、
前記被写体合焦画像と前記背景合焦画像とにおける前記非特定領域の画像に基づいて、前記非特定領域が前記被写体領域と前記背景領域とのいずれに関連するかを判定する関連領域判定機能と、
前記関連領域判定機能の判定結果に基づいて、前記デプス値設定機能によって設定された前記被写体領域あるいは前記背景領域の前記デプス値のいずれかを基に決定された値を、前記非特定領域の奥行きを表すデプス値として設定するデプス値拡張処理機能と、
を実現させることを特徴とするプログラム。
The invention described in the scope of claims at the beginning of the filing of the present application will be appended.
[Appendix 1]
Image acquisition means for acquiring data of a subject in-focus image captured by focusing on a specific subject, and data of a background in-focus image captured by shifting the focus to the background side of the specific subject;
Based on the data of the subject focused image and the data of the background focused image, each of the areas included in the focused subject image corresponds to a subject area having a depth corresponding to the specific subject and the background. Area determining means for determining which area is a background area having a depth to be determined and an area of the subject area and a non-specific area other than the background area;
Based on the determination result of the area determination unit, a depth value representing a depth corresponding to the specific subject is set in the subject area, and a depth value representing a depth corresponding to the background is set in the background area. Setting means;
Related area determination means for determining whether the non-specific area is related to the subject area or the background area based on the image of the non-specific area in the subject focused image and the background focused image; ,
Based on the determination result of the related area determination means, a value determined based on either the subject area set by the depth value setting means or the depth value of the background area is set as the depth of the non-specific area. Depth value expansion processing means for setting as a depth value representing
An image processing apparatus comprising:
[Appendix 2]
The area determination unit specifies, as the non-specific area, at least one of a moving object area moved by the subject focused image and the background focused image and a flat area where a flat subject is imaged. The image processing apparatus according to appendix 1, characterized by:
[Appendix 3]
The related area determination means compares the degree of approximation between the pixel data in the non-specific area and the pixel data in the subject area and the background area adjacent to the non-specific area. The image processing apparatus according to appendix 1 or 2, wherein the depth value of the non-specific region is determined based on the depth value of a region to which pixel data closer to the data belongs.
[Appendix 4]
The related area determination unit compares the degree of approximation based on a color distance between a pixel in the non-specific area and a pixel area in the subject area and the background area adjacent to the non-specific area. The image processing apparatus according to appendix 3.
[Appendix 5]
An image acquisition step of acquiring data of a subject in-focus image captured by focusing on a specific subject, and data of a background in-focus image captured by shifting the focus to the background side of the specific subject;
Based on the data of the subject focused image and the data of the background focused image, each of the areas included in the focused subject image corresponds to a subject area having a depth corresponding to the specific subject and the background. A region determination step for determining which region is a background region having a depth to be determined and a non-specific region other than the subject region and the background region;
Based on the determination result in the region determination step, a depth value representing a depth corresponding to the specific subject is set in the subject region, and a depth value representing a depth corresponding to the background is set in the background region. Configuration steps;
A related region determination step for determining whether the non-specific region is related to the subject region or the background region based on the image of the non-specific region in the subject focused image and the background focused image; ,
Based on the determination result in the related area determination step, a value determined based on either the subject area set in the depth value setting step or the depth value of the background area is set to the depth of the non-specific area. A depth value expansion processing step to set as a depth value representing
An image processing method comprising:
[Appendix 6]
On the computer,
An image acquisition function for acquiring data of a subject in-focus image captured by focusing on a specific subject and data of a background in-focus image captured by shifting the focus to the background side of the specific subject;
Based on the data of the subject focused image and the data of the background focused image, each of the areas included in the focused subject image corresponds to a subject area having a depth corresponding to the specific subject and the background. A region determination function for determining whether the region is a background region having a depth to be determined, and a non-specific region other than the subject region and the background region;
Based on the determination result of the area determination function, a depth value representing a depth corresponding to the specific subject is set in the subject area, and a depth value representing a depth corresponding to the background is set in the background area. Setting function,
A related region determination function for determining whether the non-specific region is related to the subject region or the background region based on the image of the non-specific region in the subject focused image and the background focused image; ,
Based on the determination result of the related area determination function, a value determined based on either the subject area set by the depth value setting function or the depth value of the background area is set to the depth of the non-specific area. Depth value expansion processing function to be set as a depth value representing
A program characterized by realizing.

1・・・画像処理装置、11・・・CPU、12・・・ROM、13・・・RAM、14・・・バス、15・・・入出力インターフェース、16・・・撮像部、17・・・操作部、18・・・表示部、19・・・記憶部、20・・・通信部、21・・・メディアドライブ、31・・・リムーバブルメディア、51・・・撮像制御部、52・・・画像取得部、53・・・画像変形処理部、54・・・領域判定部、54a・・・動体領域抽出部、54b・・・エッジ強度算出部、54c・・・領域種別決定部、55・・・拡張元領域特定部、55a・・・仮デプス値設定部、55b・・・色距離算定部、55c・・・関連領域判定部、56・・・デプス値拡張処理部   DESCRIPTION OF SYMBOLS 1 ... Image processing apparatus, 11 ... CPU, 12 ... ROM, 13 ... RAM, 14 ... Bus, 15 ... Input / output interface, 16 ... Imaging part, 17 ... Operation unit, 18 ... display unit, 19 ... storage unit, 20 ... communication unit, 21 ... media drive, 31 ... removable media, 51 ... imaging control unit, 52 ... Image acquisition unit, 53... Image deformation processing unit, 54... Region determination unit, 54 a... Moving object region extraction unit, 54 b. ... Extension source area specifying section, 55a ... Temporary depth value setting section, 55b ... Color distance calculation section, 55c ... Related area determination section, 56 ... Depth value expansion processing section

Claims (8)

特定の被写体に合焦して撮像された被写体合焦画像のデータと、前記特定の被写体の背景側に焦点をずらして撮像された背景合焦画像のデータとを取得する画像取得手段と、
前記被写体合焦画像のデータと前記背景合焦画像のデータとに基づいて、前記被写体合焦画像に含まれる領域それぞれが、前記特定の被写体に対応する奥行きを有する被写体領域と、前記背景に対応する奥行きを有する背景領域と、前記被写体領域及び前記背景領域以外の非特定領域とのいずれの領域であるかを判定する領域判定手段と、
前記領域判定手段の判定結果に基づいて、前記被写体領域に前記特定の被写体に対応する奥行きを表すデプス値を設定し、前記背景領域に前記背景に対応する奥行きを表すデプス値を設定するデプス値設定手段と、
前記被写体合焦画像と前記背景合焦画像とにおける前記非特定領域の画像に基づいて、前記デプス値設定手段によって設定された前記被写体領域のデプス値あるいは前記背景領域のデプス値のいずれかを基に決定された値を、前記非特定領域の奥行きを表すデプス値として設定するデプス値拡張処理手段と、
を備え、
前記デプス値設定手段は、前記被写体領域、前記背景領域及び前記非特定領域のそれぞれの画素に仮デプス値を設定し、
前記デプス値拡張処理手段は、前記非特定領域内の各画素を対象として、前記非特定領域に隣接する前記非特定領域以外の周辺領域から所定の条件を満たす少なくとも1以上の拡張元画素の仮デプス値に基づいて拡張デプス値を求め、前記拡張デプス値を前記非特定領域内の各画素のデプス値としてそれぞれ設定する、
ことを特徴とする画像処理装置。
Image acquisition means for acquiring data of a subject in-focus image captured by focusing on a specific subject , and data of a background in-focus image captured by shifting the focus to the background side of the specific subject;
Based on the data of the subject focused image and the data of the background focused image, each of the areas included in the focused subject image corresponds to a subject area having a depth corresponding to the specific subject and the background. and a background area having a depth of, said object area and the non-specific region other than the background area, and the determining area determination means for determining which of the areas of,
Based on the determination result of the area determination unit, a depth value representing a depth corresponding to the specific subject is set in the subject area, and a depth value representing a depth corresponding to the background is set in the background area. Setting means;
Based on either the depth value of the subject region or the depth value of the background region set by the depth value setting means based on the image of the non-specific region in the subject focused image and the background focused image. a depth value expansion processing means for the determined value is set as a depth value representing the depth of the non-specific region,
Bei to give a,
The depth value setting means sets a temporary depth value for each pixel of the subject area, the background area, and the non-specific area,
The depth value expansion processing unit targets at least one pixel in the non-specific region as a target of at least one extension source pixel satisfying a predetermined condition from a peripheral region adjacent to the non-specific region other than the non-specific region. Obtaining an extended depth value based on the depth value, and setting the extended depth value as the depth value of each pixel in the non-specific region,
An image processing apparatus.
前記領域判定手段は、前記被写体合焦画像と前記背景合焦画像との間で移動した移動物体の領域と、平坦な被写体が撮像されている平坦領域と、の少なくともいずれかを前記非特定領域として特定することを特徴とする請求項1に記載の画像処理装置。 The region determination means determines at least one of a region of a moving object moved between the subject focused image and the background focused image and a flat region where a flat subject is captured as the non-specific region. The image processing apparatus according to claim 1, characterized by: 前記デプス値拡張処理手段は、前記非特定領域が前記被写体領域と前記背景領域とのいずれに関連するかを判定する関連領域判定手段を、さらに備え、
前記関連領域判定手段の判定結果に基づいて、前記デプス値設定手段によって設定された前記被写体領域のデプス値あるいは前記背景領域のデプス値のいずれかを基に決定された値を、前記非特定領域の奥行きを表すデプス値として設定することを特徴とする請求項1又は2に記載の画像処理装置。
The depth value expansion processing means further includes related area determination means for determining whether the non-specific area is related to the subject area or the background area,
The related area determining unit based on the determination result, the value determined based on either the de TOPS of the depth value or the background region of the object region set by the depth value setting means, wherein the non-specific The image processing apparatus according to claim 1, wherein the image processing apparatus is set as a depth value representing a depth of the region.
前記関連領域判定手段は、前記非特定領域内の各画素のデータと、前記非特定領域に隣接する前記非特定領域以外の前記周辺領域の画素のデータと、の近似度合いを比較し、前記近似度合いが前記所定の条件を満たす少なくとも1以上の前記拡張元画素をそれぞれ特定することを特徴とする請求項3に記載の画像処理装置。 The related area determination means compares the degree of approximation between the data of each pixel in the non-specific area and the data of pixels in the peripheral area other than the non-specific area adjacent to the non-specific area, and the approximation The image processing apparatus according to claim 3, wherein at least one or more extension source pixels whose degree satisfies the predetermined condition are specified . 前記関連領域判定手段は、前記非特定領域内の各画素のデータと、前記非特定領域に隣接する前記非特定領域以外の前記周辺領域の画素のデータと、の色距離に基づいて、前記近似度合いを比較することを特徴とする請求項4に記載の画像処理装置。 The related area determination unit is configured to calculate the approximation based on a color distance between data of each pixel in the non-specific area and data of pixels in the peripheral area other than the non-specific area adjacent to the non-specific area. The image processing apparatus according to claim 4, wherein the degrees are compared. 前記デプス値拡張処理手段は、前記拡張元画素の仮デプス値の平均値を前記拡張デプス値とすることを特徴とする請求項1乃至5のいずれかに記載の画像処理装置。6. The image processing apparatus according to claim 1, wherein the depth value expansion processing unit sets an average value of provisional depth values of the expansion source pixels as the extended depth value. 特定の被写体に合焦して撮像された被写体合焦画像のデータと、前記特定の被写体の背景側に焦点をずらして撮像された背景合焦画像のデータとを取得する画像取得ステップと、
前記被写体合焦画像のデータと前記背景合焦画像のデータとに基づいて、前記被写体合焦画像に含まれる領域それぞれが、前記特定の被写体に対応する奥行きを有する被写体領域と、前記背景に対応する奥行きを有する背景領域と、前記被写体領域及び前記背景領域以外の非特定領域とのいずれの領域であるかを判定する領域判定ステップと、
前記領域判定ステップにおける判定結果に基づいて、前記被写体領域に前記特定の被写体に対応する奥行きを表すデプス値を設定し、前記背景領域に前記背景に対応する奥行きを表すデプス値を設定するデプス値設定ステップと、
前記被写体合焦画像と前記背景合焦画像とにおける前記非特定領域の画像に基づいて、前記デプス値設定ステップにおいて設定された前記被写体領域のデプス値あるいは前記背景領域のデプス値のいずれかを基に決定された値を、前記非特定領域の奥行きを表すデプス値として設定するデプス値拡張処理ステップと、
を含み、
前記デプス値設定ステップにおいては、前記被写体領域、前記背景領域及び前記非特定領域のそれぞれの画素に仮デプス値を設定し、
前記デプス値拡張処理ステップにおいては、前記非特定領域内の各画素を対象として、前記非特定領域に隣接する前記非特定領域以外の周辺領域から所定の条件を満たす少なくとも1以上の拡張元画素の仮デプス値に基づいて拡張デプス値を求め、前記拡張デプス値を前記非特定領域内の各画素のデプス値としてそれぞれ設定する、
ことを特徴とする画像処理方法。
An image acquisition step of acquiring data of a focused subject image captured by focusing on a specific subject and data of a focused background image captured with a focus shifted to the background side of the specific subject;
Based on the data of the subject focused image and the data of the background focused image, each of the areas included in the focused subject image corresponds to a subject area having a depth corresponding to the specific subject and the background. and a background area having a depth of, said object area and the non-specific region other than the background area, and the determining area determination step of determining which of the areas of,
Based on the determination result in the region determination step, a depth value representing a depth corresponding to the specific subject is set in the subject region, and a depth value representing a depth corresponding to the background is set in the background region. Configuration steps;
Based on either the depth value of the subject region or the depth value of the background region set in the depth value setting step based on the image of the non-specific region in the subject focused image and the background focused image. a depth value expansion processing step of a determined value is set as a depth value representing the depth of the non-specific region,
Only including,
In the depth value setting step, a temporary depth value is set for each pixel of the subject area, the background area, and the non-specific area,
In the depth value expansion processing step, for each pixel in the non-specific region, at least one or more expansion source pixels satisfying a predetermined condition from a peripheral region other than the non-specific region adjacent to the non-specific region. Obtaining an extended depth value based on the provisional depth value, and setting the extended depth value as a depth value of each pixel in the non-specific region,
An image processing method.
コンピュータに、
特定の被写体に合焦して撮像された被写体合焦画像のデータと、前記特定の被写体の背景側に焦点をずらして撮像された背景合焦画像のデータとを取得する画像取得機能と、
前記被写体合焦画像のデータと前記背景合焦画像のデータとに基づいて、前記被写体合焦画像に含まれる領域それぞれが、前記特定の被写体に対応する奥行きを有する被写体領域と、前記背景に対応する奥行きを有する背景領域と、前記被写体領域及び前記背景領域以外の非特定領域とのいずれの領域であるかを判定する領域判定機能と、
前記領域判定機能の判定結果に基づいて、前記被写体領域に前記特定の被写体に対応する奥行きを表すデプス値を設定し、前記背景領域に前記背景に対応する奥行きを表すデプス値を設定するデプス値設定機能と、
前記被写体合焦画像と前記背景合焦画像とにおける前記非特定領域の画像に基づいて、前記デプス値設定機能によって設定された前記被写体領域のデプス値あるいは前記背景領域のデプス値のいずれかを基に決定された値を、前記非特定領域の奥行きを表すデプス値として設定するデプス値拡張処理機能と、
を実現させ、
前記デプス値設定機能は、前記被写体領域、前記背景領域及び前記非特定領域のそれぞれの画素に仮デプス値を設定し、
前記デプス値拡張処理機能は、前記非特定領域内の各画素を対象として、前記非特定領域に隣接する前記非特定領域以外の周辺領域から所定の条件を満たす少なくとも1以上の拡張元画素の仮デプス値に基づいて拡張デプス値を求め、前記拡張デプス値を前記非特定領域内の各画素のデプス値としてそれぞれ設定する、
ことを特徴とするプログラム。
On the computer,
An image acquisition function for acquiring data of an in- focus image captured by focusing on a specific subject and data of a background in-focus image captured by shifting the focus to the background side of the specific subject;
Based on the data of the subject focused image and the data of the background focused image, each of the areas included in the focused subject image corresponds to a subject area having a depth corresponding to the specific subject and the background. and a background area having a depth of, said object area and the non-specific region other than the background area, and determines the area judgment function which one of the areas of,
Based on the determination result of the area determination function, a depth value representing a depth corresponding to the specific subject is set in the subject area, and a depth value representing a depth corresponding to the background is set in the background area. Setting function,
Based on either the depth value of the subject region or the depth value of the background region set by the depth value setting function based on the image of the non-specific region in the subject focused image and the background focused image. a depth value expansion processing function of the determined value is set as a depth value representing the depth of the non-specific region,
Realized ,
The depth value setting function sets a temporary depth value for each pixel of the subject area, the background area, and the non-specific area,
The depth value extension processing function targets at least one extension source pixel that satisfies a predetermined condition from a peripheral region other than the non-specific region adjacent to the non-specific region for each pixel in the non-specific region. Obtaining an extended depth value based on the depth value, and setting the extended depth value as the depth value of each pixel in the non-specific region,
A program characterized by that.
JP2012057968A 2012-03-14 2012-03-14 Image processing apparatus, image processing method, and program Active JP5928024B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012057968A JP5928024B2 (en) 2012-03-14 2012-03-14 Image processing apparatus, image processing method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012057968A JP5928024B2 (en) 2012-03-14 2012-03-14 Image processing apparatus, image processing method, and program

Publications (3)

Publication Number Publication Date
JP2013192115A JP2013192115A (en) 2013-09-26
JP2013192115A5 JP2013192115A5 (en) 2015-04-16
JP5928024B2 true JP5928024B2 (en) 2016-06-01

Family

ID=49391941

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012057968A Active JP5928024B2 (en) 2012-03-14 2012-03-14 Image processing apparatus, image processing method, and program

Country Status (1)

Country Link
JP (1) JP5928024B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5927265B2 (en) * 2014-10-28 2016-06-01 シャープ株式会社 Image processing apparatus and program
CN115272718A (en) * 2022-07-26 2022-11-01 Oppo广东移动通信有限公司 Image processing method, image processing device, storage medium and electronic equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3372096B2 (en) * 1993-12-28 2003-01-27 株式会社東芝 Image information access device
JP3849817B2 (en) * 1996-11-21 2006-11-22 ソニー株式会社 Image processing apparatus and image processing method
JP5369729B2 (en) * 2009-02-03 2013-12-18 株式会社ニコン Image processing apparatus, imaging apparatus, and program
JP2011039918A (en) * 2009-08-17 2011-02-24 Sony Corp Apparatus and method for processing image and program
JP5510094B2 (en) * 2010-06-14 2014-06-04 株式会社ニコン Image processing apparatus and image processing program

Also Published As

Publication number Publication date
JP2013192115A (en) 2013-09-26

Similar Documents

Publication Publication Date Title
JP5251215B2 (en) Digital camera
JP5507014B2 (en) Moving object detection apparatus and method
JP5804138B1 (en) Detection apparatus, detection method, and program
JP5374119B2 (en) Distance information acquisition device, imaging device, and program
KR20140047533A (en) Image processing apparatus, image processing method, and storage medium
US11627245B2 (en) Focus adjustment device and focus adjustment method
JP5619124B2 (en) Image processing apparatus, imaging apparatus, image processing program, and image processing method
CN104641625A (en) Image processing device, imaging device, image processing method and image processing program
JP2009111716A (en) Imaging apparatus, program, and template generation method
JP2011066827A (en) Image processing apparatus, image processing method and program
JP6320053B2 (en) Image processing apparatus, image processing method, and computer program
JP2010279054A (en) Imaging apparatus, image processing apparatus, imaging method, and image processing method
JP2010160297A (en) Imaging apparatus, automatic focusing method, and computer program
JP2017011451A (en) Detection apparatus, detection method, and program
JP2010154306A (en) Device, program and method for imaging control
JP5928024B2 (en) Image processing apparatus, image processing method, and program
JP2017147498A (en) Image processing apparatus, image processing method and program
JP2010134309A (en) Autofocus device, autofocus method and imaging apparatus
JP6272099B2 (en) Image processing apparatus, control method, and program
JP5965654B2 (en) TRACKING DEVICE, IMAGING DEVICE, TRACKING METHOD USED FOR IMAGING DEVICE
JP5625499B2 (en) Image processing apparatus and program
JP2011193496A (en) Imaging apparatus, imaging method, and imaging program
JP2011182341A (en) Imaging device and method of controlling imaging device
JP2017098637A (en) Image identification device, image identification method, and program
JP2014138378A (en) Image pickup device, control method thereof, and control program thereof

Legal Events

Date Code Title Description
A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20150227

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20150227

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20151109

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20151117

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20160118

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20160411

R150 Certificate of patent or registration of utility model

Ref document number: 5928024

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150