JP2018197873A - Image processor and image processing program - Google Patents

Image processor and image processing program Download PDF

Info

Publication number
JP2018197873A
JP2018197873A JP2018146063A JP2018146063A JP2018197873A JP 2018197873 A JP2018197873 A JP 2018197873A JP 2018146063 A JP2018146063 A JP 2018146063A JP 2018146063 A JP2018146063 A JP 2018146063A JP 2018197873 A JP2018197873 A JP 2018197873A
Authority
JP
Japan
Prior art keywords
image
mask
distance
area
distribution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2018146063A
Other languages
Japanese (ja)
Inventor
鉾井 逸人
Hayato Hokoi
逸人 鉾井
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nikon Corp
Original Assignee
Nikon Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nikon Corp filed Critical Nikon Corp
Priority to JP2018146063A priority Critical patent/JP2018197873A/en
Publication of JP2018197873A publication Critical patent/JP2018197873A/en
Pending legal-status Critical Current

Links

Landscapes

  • Focusing (AREA)
  • Automatic Focus Adjustment (AREA)
  • Image Analysis (AREA)

Abstract

To provide an image processor and an image processing program which can set a region as the focus in an image diversely.SOLUTION: A MPU16 of an image processing engine 14 functions as: a region extraction unit 24 for extracting a plurality of masks from an image acquired from an imaging element 13; a position acquisition unit 25 for acquiring the relative positions of the masks extracted by the region extraction unit 24 in the depth direction of the image; and a focus region setting unit 26 for setting a focus mask to be the target of a focus from the masks extracted by the region extraction unit 24 on the basis of the relative positions of the masks extracted by the position acquisition unit 25 in the depth direction of the image.SELECTED DRAWING: Figure 1

Description

本発明は、画像処理装置及び画像処理プログラムに関する。   The present invention relates to an image processing apparatus and an image processing program.

従来、フォーカスレンズを光軸方向に移動させつつ各位置における画像の測距エリア内に位置する被写体のエッジのコントラスト値を求め、コントラスト値が最も高くなるレンズ位置をフォーカス位置(合焦位置)として検出するオートフォーカス装置が知られている(例えば、特許文献1参照)。   Conventionally, the contrast value of the edge of the subject located within the distance measuring area of the image at each position is calculated while moving the focus lens in the optical axis direction, and the lens position where the contrast value is the highest is set as the focus position (focus position). An autofocus device for detection is known (see, for example, Patent Document 1).

特開平4−274405号公報JP-A-4-274405

しかしながら、従来のオートフォーカス装置では、測距エリア内に複数の被写体が含まれる場合、これらの被写体のうち近接側に位置する被写体が合焦の対象となる被写体として一律に設定されるのが一般的である。そのため、画像において合焦の対象となる被写体を多様に設定することができないという問題があった。   However, in the conventional autofocus device, when a plurality of subjects are included in the distance measurement area, the subject located on the near side among these subjects is generally set as the subject to be focused. Is. For this reason, there is a problem in that it is impossible to set various subjects to be focused in the image.

本発明は、このような事情に鑑みてなされたものであり、その目的は、画像において合焦の対象となる領域を多様に設定することができる画像処理装置及び画像処理プログラムを提供することにある。   The present invention has been made in view of such circumstances, and an object of the present invention is to provide an image processing apparatus and an image processing program capable of setting various areas to be focused in an image. is there.

上記課題を解決する画像処理装置は、外部から取得した画像から複数の特定領域を抽出する領域抽出部と、前記領域抽出部が抽出した前記特定領域同士における前記画像の奥行方向の相対位置を取得する位置取得部と、前記位置取得部が取得した前記特定領域同士における前記画像の奥行方向の相対位置に基づいて、前記領域抽出部が抽出した前記特定領域の中から合焦の対象となる合焦領域を設定する合焦領域設定部とを備えたことを特徴とする。   An image processing apparatus that solves the above problem obtains a region extracting unit that extracts a plurality of specific regions from an image acquired from the outside, and a relative position in the depth direction of the image between the specific regions extracted by the region extracting unit. Based on the relative position in the depth direction of the image between the specific areas acquired by the position acquisition unit and the specific areas acquired by the position acquisition unit, the focus to be focused from among the specific areas extracted by the area extraction unit. And a focusing area setting unit for setting a focusing area.

また、上記画像処理装置において、前記位置取得部は、前記特定領域同士における画像の奥行方向の相対位置として前記特定領域の距離の分布を取得し、前記合焦領域設定部は、前記位置取得部が取得した前記特定領域の距離の分布に基づいて前記合焦領域を設定することが好ましい。   In the image processing apparatus, the position acquisition unit acquires a distance distribution of the specific region as a relative position in the depth direction of the images between the specific regions, and the focus region setting unit includes the position acquisition unit. It is preferable to set the in-focus area based on the distance distribution of the specific area acquired.

また、上記画像処理装置において、前記位置取得部は、前記特定領域の距離の分布を、該分布を構成する前記特定領域の前記画像内での配置と組み合わせて取得し、前記合焦領域設定部は、前記位置取得部が前記特定領域の前記画像内での配置と組み合わせて取得した前記特定領域の距離の分布に基づいて前記合焦領域を設定することが好ましい。   In the image processing apparatus, the position acquisition unit acquires the distance distribution of the specific area in combination with the arrangement of the specific area constituting the distribution in the image, and the focusing area setting unit Preferably, the in-focus area is set based on a distance distribution of the specific area acquired in combination with the arrangement of the specific area in the image.

また、上記画像処理装置において、データベースには、前記位置取得部が取得した前記特定領域の距離の分布との比較対象となる比較要素の距離の分布と、前記合焦領域設定部が前記合焦領域を設定する際の基準として前記分布を構成する前記比較要素の中から設定される基準合焦要素とが関連付けられて記憶されており、前記合焦領域設定部は、前記位置取得部によって取得された前記特定領域の距離の分布を前記データベースに記憶された前記比較要素の距離の分布に対して照合することにより、前記データベースにおいて照合された分布に関連付けられた前記基準合焦要素に基づいて前記合焦領域を設定することが好ましい。   Further, in the image processing apparatus, the database includes a distance distribution of a comparison element to be compared with a distance distribution of the specific area acquired by the position acquisition unit, and the focus area setting unit includes the focus area setting unit. Reference focusing elements set from among the comparison elements constituting the distribution are stored in association with each other as a reference for setting an area, and the focusing area setting unit is acquired by the position acquisition unit Based on the reference focusing element associated with the distribution collated in the database, by collating the distance distribution of the specific region that has been identified against the distance distribution of the comparison element stored in the database It is preferable to set the focusing area.

また、上記画像処理装置において、前記データベースには、前記比較要素の距離の分布に対して前記比較要素の配置が組み合わされて記憶されており、前記合焦領域設定部は、前記位置取得部によって取得された前記特定領域の距離の分布を前記特定領域の前記画像内での配置と組み合わせて前記データベースに記憶された前記比較要素の距離及び配置の組み合わせの分布に対して照合することにより、前記データベースにおいて照合された分布に関連付けられた前記基準合焦要素に基づいて前記合焦領域を設定することが好ましい。   In the image processing apparatus, the database stores a combination of the comparison elements with respect to the distance distribution of the comparison elements, and the focusing area setting unit is controlled by the position acquisition unit. By collating the obtained distance distribution of the specific area with the distribution of the comparison element distance and arrangement stored in the database in combination with the arrangement of the specific area in the image, Preferably, the in-focus area is set based on the reference in-focus element associated with the distribution collated in the database.

また、上記画像処理装置において、前記合焦領域設定部は、前記位置取得部によって取得された前記特定領域の距離の分布が、一部の特定領域が他の特定領域と比較して距離の大きさが外れた分布である場合、該一部の特定領域の中から前記合焦領域を設定することが好ましい。   In the image processing apparatus, the focusing area setting unit may be configured such that the distance distribution of the specific area acquired by the position acquisition unit is larger in distance than a part of specific areas compared to other specific areas. When the distribution is out of the range, it is preferable to set the in-focus area from the partial specific area.

また、上記画像処理装置において、前記特定領域の距離の分布には、前記特定領域ごとの距離が前記画像の奥行方向において分割された複数の距離範囲に分類された態様で含まれることが好ましい。   In the image processing apparatus, it is preferable that the distance distribution of the specific area includes the distance for each specific area classified into a plurality of distance ranges divided in the depth direction of the image.

また、上記画像処理装置において、前記位置取得部は、前記領域抽出部が抽出した前記特定領域のエッジの色成分量に基づいて前記特定領域の距離を前記特定領域ごとに検出することにより、前記特定領域同士の前記画像の奥行方向における相対位置を取得することが好ましい。   In the image processing apparatus, the position acquisition unit detects the distance of the specific region for each specific region based on the color component amount of the edge of the specific region extracted by the region extraction unit, It is preferable to acquire a relative position in the depth direction of the image between the specific regions.

また、上記画像処理装置において、前記位置取得部は、前記領域抽出部が抽出した前記特定領域の距離を位相差検出方式によって前記特定領域ごとに検出することにより、前記領域同士の前記画像の奥行方向における相対位置を取得することが好ましい。   Further, in the image processing device, the position acquisition unit detects the distance between the specific regions extracted by the region extraction unit for each specific region by a phase difference detection method, and thereby the depth of the image between the regions. It is preferable to obtain the relative position in the direction.

また、上記画像処理装置において、前記位置取得部は、前記領域抽出部が抽出した前記特定領域の距離をコントラスト検出方式によって前記特定領域ごとに検出することにより、前記特定領域同士の前記画像の奥行方向における相対位置を取得することが好ましい。   Further, in the image processing apparatus, the position acquisition unit detects the distance between the specific regions extracted by the region extraction unit for each specific region using a contrast detection method, and thereby the depth of the image between the specific regions. It is preferable to obtain the relative position in the direction.

また、上記課題を解決する画像処理プログラムは、コンピュータに、外部から取得した画像から複数の特定領域を抽出する領域抽出ステップと、前記領域抽出ステップにおいて抽出した前記特定領域同士における前記画像の奥行方向の相対位置を取得する位置取得ステップと、前記位置取得ステップにおいて取得した前記特定領域同士における前記画像の奥行方向の相対位置に基づいて、前記領域抽出ステップにおいて抽出した前記特定領域の中から合焦の対象となる合焦領域を設定する合焦領域設定ステップとを実行させることを特徴とする。   An image processing program that solves the above-described problem is a computer-extracted region extracting step for extracting a plurality of specific regions from an image acquired from the outside, and a depth direction of the image in the specific regions extracted in the region extracting step. A position acquisition step of acquiring a relative position of the image, and a focus from the specific region extracted in the region extraction step based on a relative position in the depth direction of the image between the specific regions acquired in the position acquisition step. And a focusing area setting step for setting a focusing area as a target of the focusing.

本発明によれば、画像において合焦の対象となる領域を多様に設定することができる。   According to the present invention, it is possible to set various regions to be focused in an image.

第1の実施形態のデジタルカメラのブロック図。1 is a block diagram of a digital camera according to a first embodiment. 同実施形態の画像処理エンジンが実行する合焦制御処理ルーチンのフローチャート。6 is a flowchart of a focus control processing routine executed by the image processing engine of the embodiment. 同実施形態の画像処理エンジンが実行するマスクの分離・統合処理ルーチンのフローチャート。6 is a flowchart of a mask separation / integration processing routine executed by the image processing engine of the embodiment. 同実施形態の画像処理エンジンが実行する分布照合処理ルーチンのフローチャート。6 is a flowchart of a distribution matching process routine executed by the image processing engine of the embodiment. スルー画の画像内容の一例を示す模式図。The schematic diagram which shows an example of the image content of a through image. フォーカスマップの一例を示す模式図。The schematic diagram which shows an example of a focus map. スルー画の画像内容の一例を示す模式図。The schematic diagram which shows an example of the image content of a through image. (a)、(b)は、マスクに設定された評価値の一例を示す模式図。(A), (b) is a schematic diagram which shows an example of the evaluation value set to the mask. 比較要素の距離の分布、及び、フォーカスマップの一例を示す模式図。The schematic diagram which shows an example of distribution of the distance of a comparison element, and a focus map. 第2の実施形態の画像処理エンジンが実行する合焦制御処理ルーチンのフローチャート。10 is a flowchart of a focusing control processing routine executed by the image processing engine of the second embodiment. スルー画の画像内容の一例を示す模式図。The schematic diagram which shows an example of the image content of a through image. フォーカスマップの一例を示すグラフ。The graph which shows an example of a focus map. 第3の実施形態の画像処理エンジンが実行する合焦制御処理ルーチンのフローチャート。10 is a flowchart of a focus control processing routine executed by the image processing engine of the third embodiment. (a)、(b)は、スルー画の画像内容の一例を示す模式図。(A), (b) is a schematic diagram which shows an example of the image content of a through image. 第4の実施形態の画像処理エンジンが実行する合焦制御処理ルーチンのフローチャート。10 is a flowchart of a focus control processing routine executed by the image processing engine of the fourth embodiment. スルー画の画像内容の一例を示す模式図。The schematic diagram which shows an example of the image content of a through image. フォーカスマップの一例を示す模式図。The schematic diagram which shows an example of a focus map.

(第1の実施形態)
以下、本発明を具体化した第1の実施形態を図面に従って説明する。
図1に示すように、デジタルカメラ(以下、「カメラ10」という)は、焦点調節を行うためのフォーカスレンズ11などの複数のレンズからなるレンズ部12(図1ではフォーカスレンズ11のみ図示)と、レンズ部12を通過した光をレンズ部12の像空間側において結像させて撮像する撮像素子13とを備えている。なお、撮像素子13は、CMOS(Complementary Metal Oxide Semiconductor)型、又は、CCD(Charge Coupled Device)型のイメージセンサからなる。
(First embodiment)
Hereinafter, a first embodiment of the present invention will be described with reference to the drawings.
As shown in FIG. 1, a digital camera (hereinafter referred to as “camera 10”) includes a lens unit 12 (only the focus lens 11 is shown in FIG. 1) and a plurality of lenses such as a focus lens 11 for focus adjustment. And an image sensor 13 that images the light passing through the lens unit 12 by forming an image on the image space side of the lens unit 12. Note that the image sensor 13 is a CMOS (Complementary Metal Oxide Semiconductor) type or CCD (Charge Coupled Device) type image sensor.

撮像素子13の出力側には、画像処理エンジン14がA/D変換回路15を介して接続されている。そして、撮像素子13からアナログ信号として出力される画素信号は、A/D変換回路15においてデジタル信号に変換された後に画像処理エンジン14に入力される。   An image processing engine 14 is connected to the output side of the image sensor 13 via an A / D conversion circuit 15. The pixel signal output as an analog signal from the image sensor 13 is converted into a digital signal by the A / D conversion circuit 15 and then input to the image processing engine 14.

画像処理エンジン14は、カメラ10の各種の動作を統括的に制御するMPU16(Micro Processing Unit)を備えている。そして、MPU16は、撮像素子13から入力された画素信号に対し、色補間処理、階調補正、ホワイトバランス処理及び輪郭補償等の画像処理を施すことにより所定の画像を生成する。   The image processing engine 14 includes an MPU 16 (Micro Processing Unit) that comprehensively controls various operations of the camera 10. The MPU 16 generates a predetermined image by performing image processing such as color interpolation processing, gradation correction, white balance processing, and contour compensation on the pixel signal input from the image sensor 13.

画像処理エンジン14には、データバス17を介して不揮発性メモリ18、バッファメモリ19、インターフェース部(以下、「I/F部20」という)及びモニタ21が接続されている。   A non-volatile memory 18, a buffer memory 19, an interface unit (hereinafter referred to as “I / F unit 20”) and a monitor 21 are connected to the image processing engine 14 via a data bus 17.

不揮発性メモリ18は、画像処理エンジン14を動作させるためにMPU16が実行するプログラムを格納している。なお、本実施形態では、不揮発性メモリ18は、図2にフローチャートで示す合焦制御用の画像処理プログラムなどを格納している。そして、MPU16は、不揮発性メモリ18に格納された合焦制御用の画像処理プログラムを実行することにより、領域抽出部24、位置取得部25、合焦領域設定部26及びモード設定部27として機能する。また、不揮発性メモリ18は、MPU16が合焦制御用の画像処理プログラムを実行する際に使用するデータベース30を格納している。   The nonvolatile memory 18 stores a program executed by the MPU 16 for operating the image processing engine 14. In the present embodiment, the non-volatile memory 18 stores an image processing program for focusing control shown in the flowchart of FIG. The MPU 16 functions as an area extraction unit 24, a position acquisition unit 25, a focusing area setting unit 26, and a mode setting unit 27 by executing an image processing program for focusing control stored in the nonvolatile memory 18. To do. The nonvolatile memory 18 stores a database 30 that is used when the MPU 16 executes an image processing program for focusing control.

バッファメモリ19は、例えば、撮影画像、画像処理過程の画像、画像処理後の画像及び画像圧縮後の画像などを一時的に格納している。
I/F部20は、メモリカード31が着脱自在に装着されるカードスロット(図示略)を有している。そして、I/F部20は、画像処理エンジン14によって生成された画像をI/F部20に装着されたメモリカード31に出力したり、メモリカード31に記憶されている画像を画像処理エンジン14に出力したりする機能を有している。
The buffer memory 19 temporarily stores, for example, photographed images, images in the image processing process, images after image processing, images after image compression, and the like.
The I / F unit 20 has a card slot (not shown) in which the memory card 31 is detachably mounted. Then, the I / F unit 20 outputs the image generated by the image processing engine 14 to the memory card 31 attached to the I / F unit 20, and the image stored in the memory card 31 is output to the image processing engine 14. Or has a function to output to

モニタ21には、バッファメモリ19に一時的に格納されている画像や、I/F部20に装着されたメモリカード31に格納されている画像が画像処理エンジン14によって出力されて表示される。   On the monitor 21, an image temporarily stored in the buffer memory 19 and an image stored in the memory card 31 attached to the I / F unit 20 are output and displayed by the image processing engine 14.

また、画像処理エンジン14には、レリーズボタン32及び操作部33が接続されている。レリーズボタン32は、半押し操作又は全押し操作がなされた際に操作信号を画像処理エンジン14に入力する。操作部33は、メニューボタン、セレクトボタン、決定ボタン及び電源ボタン等により構成されており、押圧操作がなされた際に操作信号を画像処理エンジン14に入力する。   Further, a release button 32 and an operation unit 33 are connected to the image processing engine 14. The release button 32 inputs an operation signal to the image processing engine 14 when a half-press operation or a full-press operation is performed. The operation unit 33 includes a menu button, a select button, a determination button, a power button, and the like, and inputs an operation signal to the image processing engine 14 when a pressing operation is performed.

次に、本実施形態の画像処理エンジン14のMPU16が実行する合焦制御処理ルーチンの概要を図2のフローチャートを参照しながら説明する。
さて、MPU16は、カメラ10が電源ON状態となると、図2に示す合焦制御処理ルーチンを開始する。そして、ステップS10において、MPU16は、撮像素子13から出力された画素信号を取り込んでスルー画を生成し、生成したスルー画をモニタ21に表示させる。
Next, an overview of the focus control processing routine executed by the MPU 16 of the image processing engine 14 of the present embodiment will be described with reference to the flowchart of FIG.
Now, when the camera 10 is turned on, the MPU 16 starts a focus control processing routine shown in FIG. In step S <b> 10, the MPU 16 takes in the pixel signal output from the image sensor 13 to generate a through image, and displays the generated through image on the monitor 21.

続いて、ステップS11において、MPU16の領域抽出部24は、領域抽出ステップとして、先のステップS10において生成したスルー画のうち、人が注目されることが想定される領域となる特定領域の一例としてマスクを抽出する。この場合、スルー画に対してラベリング処理を行うことにより、スルー画からマスクが抽出される。ここで、ラベリング技術とは、スルー画から特徴量ごとに画素データを検出し、検出された画素データが互いに近接した画素領域のうちスルー画内での位置が隣接する画素領域を順次検出してグループ化することにより、スルー画からマスクを抽出する技術である。そして、本実施形態では、ラベリング処理に用いる特徴量としては、動きベクトル、色相、彩度、明度、テクスチャ(模様)、コントラスト等が含まれる。   Subsequently, in step S11, the area extraction unit 24 of the MPU 16 as an area extraction step, as an example of a specific area that is an area that is expected to receive attention from the through image generated in the previous step S10. Extract the mask. In this case, a mask is extracted from the through image by performing a labeling process on the through image. Here, the labeling technique detects pixel data for each feature amount from a through image, and sequentially detects pixel regions whose positions in the through image are adjacent among pixel regions where the detected pixel data are close to each other. This is a technique for extracting a mask from a through image by grouping. In the present embodiment, the feature amount used for the labeling process includes a motion vector, hue, saturation, brightness, texture (pattern), contrast, and the like.

なお、MPU16の領域抽出部24は、スルー画に対してパターン認識処理を行うことにより、スルー画からマスクを抽出してもよい。例えば、MPU16の領域抽出部24がパターン認識処理の一種である顔認識処理をスルー画に対して行うことによりスルー画から人物の顔を認識し、認識された人物の顔をマスクとして抽出してもよい。   Note that the area extraction unit 24 of the MPU 16 may extract a mask from a through image by performing pattern recognition processing on the through image. For example, the region extraction unit 24 of the MPU 16 performs face recognition processing, which is a type of pattern recognition processing, on the through image, thereby recognizing a human face from the through image and extracting the recognized human face as a mask. Also good.

そして、MPU16の領域抽出部24は、スルー画から抽出したマスクの画像を、例えばExif(Exchangeable Image File Format)形式でバッファメモリ19に格納する。
そして次に、ステップS12において、MPU16は、先のステップS11において抽出されたマスクのマスク評価値を算出する。この場合、MPU16は、例えば、先のステップS11においてラベリング処理で用いた特徴量を評価項目としてマスクの評点を算出し、算出した評点の合計値に基づいてマスク評価値を算出する。なお、図7に示す例では、スルー画から3つのマスクa3,b3,c3が抽出されている。そして、図8(a)において「測定値3」として示すように、これらのマスクa3,b3,c3のマスク評価値として、「4」、「5」、「3」という数値がそれぞれ算出されている。また、図8(b)において「測定値4」として示す例では、スルー画に含まれる3つのマスクa4,b4,c4のマスク評価値として、「3」、「4」、「2」という数値がそれぞれ算出されている。そして、MPU16は、算出したマスク評価値を、マスクの画像の付加情報としてバッファメモリ19に格納する。
Then, the area extraction unit 24 of the MPU 16 stores the mask image extracted from the through image in the buffer memory 19 in, for example, the Exif (Exchangeable Image File Format) format.
Next, in step S12, the MPU 16 calculates a mask evaluation value of the mask extracted in the previous step S11. In this case, for example, the MPU 16 calculates a score of the mask using the feature amount used in the labeling process in the previous step S11 as an evaluation item, and calculates a mask evaluation value based on the total value of the calculated scores. In the example shown in FIG. 7, three masks a3, b3, and c3 are extracted from the through image. Then, as shown as “measured value 3” in FIG. 8A, numerical values “4”, “5”, and “3” are calculated as mask evaluation values of these masks a3, b3, and c3, respectively. Yes. In the example shown as “measurement value 4” in FIG. 8B, the mask evaluation values of the three masks a4, b4, and c4 included in the through image are numerical values “3”, “4”, and “2”. Are calculated respectively. Then, the MPU 16 stores the calculated mask evaluation value in the buffer memory 19 as additional information of the mask image.

続いて、ステップS13において、MPU16の位置取得部25は、位置取得ステップとして、先のステップS11においてスルー画から抽出されたマスクのデフォーカス量に基づいてマスクの距離を取得し、取得したマスクの距離をマスクの画像の付加情報としてバッファメモリ19に格納する。なお、マスクのデフォーカス量は、例えば特開2011−186452号公報に記載のように、マスクのエッジにおける軸上色収差の評価値に基づいて算出される。   Subsequently, in step S13, the position acquisition unit 25 of the MPU 16 acquires the mask distance based on the defocus amount of the mask extracted from the through image in the previous step S11 as the position acquisition step. The distance is stored in the buffer memory 19 as additional information of the mask image. The defocus amount of the mask is calculated based on the evaluation value of the longitudinal chromatic aberration at the edge of the mask as described in, for example, Japanese Patent Application Laid-Open No. 2011-186442.

そして次に、ステップS14において、MPU16の領域抽出部24は、先のステップS11において抽出されたマスクの分離・統合処理ルーチンを行う。
ここで、マスクの分離・統合処理ルーチンの詳細を図3に示すフローチャートを用いて説明する。
Next, in step S14, the area extracting unit 24 of the MPU 16 performs a mask separation / integration processing routine extracted in the previous step S11.
Details of the mask separation / integration processing routine will be described with reference to the flowchart shown in FIG.

図3に示すように、ステップS40において、MPU16の領域抽出部24は、先のステップS11において抽出されたマスクの中に、距離の異なる複数の小領域を含むマスクがあるか否かを判定する。具体的には、MPU16の領域抽出部24は、マスクのエッジの中に他のエッジと比較して距離が異なるエッジがあるか否かを判定する。そして、MPU16の領域抽出部24は、距離の異なる複数の小領域を含むマスクがある(ステップS40=YES)と判定した場合、その処理をステップS41に移行する。   As shown in FIG. 3, in step S40, the region extracting unit 24 of the MPU 16 determines whether there is a mask including a plurality of small regions having different distances in the mask extracted in the previous step S11. . Specifically, the region extraction unit 24 of the MPU 16 determines whether there is an edge having a different distance from the other edges in the mask edge. If the area extracting unit 24 of the MPU 16 determines that there is a mask including a plurality of small areas with different distances (step S40 = YES), the process proceeds to step S41.

そして次に、ステップS41において、MPU16の領域抽出部24は、先のステップS40において複数の小領域を含むと判定されたマスクを複数の小領域に分割し、分割した各々の小領域を新たなマスクとして抽出する。そして、MPU16の領域抽出部24は、新たに抽出したマスクの画像を、例えばExif形式でバッファメモリ19に格納する。また、MPU16の領域抽出部24は、先のステップS13において取得された小領域の距離を、各々が対応する新たなマスクの距離として取得する。さらに、MPU16の領域抽出部24は、取得された新たなマスクの距離を該マスクの付加情報としてバッファメモリ19に格納した上で、その処理をステップS42に移行する。   Next, in step S41, the area extracting unit 24 of the MPU 16 divides the mask determined to include a plurality of small areas in the previous step S40 into a plurality of small areas, and each of the divided small areas is newly set. Extract as a mask. Then, the area extracting unit 24 of the MPU 16 stores the newly extracted mask image in the buffer memory 19 in, for example, the Exif format. Further, the area extracting unit 24 of the MPU 16 acquires the distance of the small area acquired in the previous step S13 as the distance of the new mask to which each corresponds. Further, the area extracting unit 24 of the MPU 16 stores the acquired new mask distance in the buffer memory 19 as additional information of the mask, and then proceeds to step S42.

一方、MPU16の領域抽出部24は、先のステップS40において距離の異なる複数の小領域を含むマスクがない(ステップS40=NO)と判定した場合、ステップS41の処理を経ることなく、その処理をステップS42に移行する。   On the other hand, if the area extraction unit 24 of the MPU 16 determines that there is no mask including a plurality of small areas with different distances in the previous step S40 (step S40 = NO), the process is performed without performing the process of step S41. Control goes to step S42.

そして、ステップS42において、MPU16の領域抽出部24は、先のステップS11において抽出されたマスクの中に、スルー画内での配置が隣り合うとともに距離が近接したマスクの組み合わせがあるか否かを判定する。具体的には、MPU16の領域抽出部24は、まず、先のステップS11において抽出されたマスクの重心位置を算出し、スルー画内における重心位置同士の距離が閾値未満であるマスクの組み合わせを抽出する。そして、MPU16の領域抽出部24は、抽出された組み合わせにおけるマスク同士の距離の差を算出し、算出された差が閾値未満であるか否かを判定する。   In step S42, the area extracting unit 24 of the MPU 16 determines whether there is a combination of masks that are adjacent in the through image and close to each other in the mask extracted in the previous step S11. judge. Specifically, the area extracting unit 24 of the MPU 16 first calculates the centroid position of the mask extracted in the previous step S11, and extracts a combination of masks in which the distance between the centroid positions in the through image is less than the threshold value. To do. Then, the region extraction unit 24 of the MPU 16 calculates the difference in the distance between the masks in the extracted combination, and determines whether or not the calculated difference is less than the threshold value.

そして、MPU16の領域抽出部24は、スルー画内での配置が隣り合うとともに距離が近接したマスクの組み合わせがある(ステップS42=YES)と判定した場合、判定された組み合わせのマスクがスルー画における同一の被写体に含まれる領域であると判断し、その処理をステップS44に移行する。   If the area extraction unit 24 of the MPU 16 determines that there is a combination of masks that are adjacent to each other in the through image and are close in distance (step S42 = YES), the determined combination of masks is included in the through image. It is determined that the areas are included in the same subject, and the process proceeds to step S44.

一方、MPU16の領域抽出部24は、スルー画内での配置が隣り合うとともに距離が近接したマスクの組み合わせがない(ステップS42=NO)と判定した場合、その処理をステップS43に移行する。   On the other hand, if the region extraction unit 24 of the MPU 16 determines that there is no combination of masks that are adjacent to each other in the through image and are close in distance (step S42 = NO), the process proceeds to step S43.

そして、ステップS43において、MPU16の領域抽出部24は、先のステップS11において抽出されたマスクの中に、動きベクトルが近接するとともに距離が近接したマスクの組み合わせがあるか否かを判定する。具体的には、MPU16の領域抽出部24は、まず、撮影周期ごとに撮像素子13に繰り返し撮影されるスルー画のフレーム画像の中から先のステップS11において抽出されたマスクの位置を随時検出する。続いて、MPU16の領域抽出部24は、前後のフレーム画像におけるマスクの位置の変化量を動きベクトルとして算出する。さらに、MPU16の領域抽出部24は、先のステップS11において抽出されたマスクの中から、動きベクトルの差分が閾値未満であるマスクの組み合わせを抽出する。そして、MPU16の領域抽出部24は、抽出された組み合わせにおけるマスク同士の距離の差を算出し、算出された差が閾値未満であるか否かを判定する。   In step S43, the region extracting unit 24 of the MPU 16 determines whether there is a combination of masks in which the motion vectors are close and the distances are close in the mask extracted in the previous step S11. Specifically, the area extraction unit 24 of the MPU 16 first detects the position of the mask extracted in the previous step S11 from the through image frame image repeatedly photographed by the image sensor 13 at every photographing cycle. . Subsequently, the area extraction unit 24 of the MPU 16 calculates the amount of change in the position of the mask in the previous and next frame images as a motion vector. Further, the region extraction unit 24 of the MPU 16 extracts a combination of masks whose motion vector difference is less than the threshold value from the masks extracted in the previous step S11. Then, the region extraction unit 24 of the MPU 16 calculates the difference in the distance between the masks in the extracted combination, and determines whether or not the calculated difference is less than the threshold value.

そして、MPU16の領域抽出部24は、動きベクトルが近接するとともに距離が近接したマスクの組み合わせがある(ステップS43=YES)と判定した場合、判定された組み合わせのマスクがスルー画における同一の被写体に含まれる領域であると判断し、その処理をステップS44に移行する。   When the region extraction unit 24 of the MPU 16 determines that there is a combination of masks in which the motion vectors are close and the distances are close (step S43 = YES), the determined combination of masks is applied to the same subject in the through image. It is determined that the area is included, and the process proceeds to step S44.

そして、ステップS44において、MPU16の領域抽出部24は、先のステップS42又は先のステップS43において、スルー画における同一の被写体に含まれる領域であると判断された組み合わせのマスクを統合して一つの新たなマスクを抽出する。そして、MPU16の領域抽出部24は、新たに抽出したマスクの画像を、例えばExif形式でバッファメモリ19に格納する。また、MPU16の領域抽出部24は、先のステップS13において取得された統合前の複数のマスクの距離の平均値を、統合された新たなマスクの距離として取得する。さらに、MPU16の領域抽出部24は、取得された新たなマスクの距離を該マスクの付加情報としてバッファメモリ19に格納した上で、図3に示すマスクの分離・統合処理ルーチンを終了し、その処理を図2に示す合焦制御処理ルーチンに戻す。   In step S44, the area extracting unit 24 of the MPU 16 integrates the combination masks determined to be areas included in the same subject in the through image in the previous step S42 or the previous step S43. A new mask is extracted. Then, the area extracting unit 24 of the MPU 16 stores the newly extracted mask image in the buffer memory 19 in, for example, the Exif format. Further, the area extracting unit 24 of the MPU 16 acquires the average value of the distances of the plurality of masks before integration acquired in the previous step S13 as the integrated new mask distance. Further, the area extracting unit 24 of the MPU 16 stores the acquired new mask distance in the buffer memory 19 as additional information of the mask, and then ends the mask separation / integration processing routine shown in FIG. The processing returns to the focus control processing routine shown in FIG.

一方、MPU16の領域抽出部24は、動きベクトルが近接するとともに距離が近接したマスクの組み合わせがない(ステップS43=NO)と判定した場合、ステップS44の処理を経ることなく図3に示すマスクの分離・統合処理ルーチンを終了し、その処理を図2に示す合焦制御処理ルーチンに戻す。   On the other hand, when the region extraction unit 24 of the MPU 16 determines that there is no combination of masks in which the motion vectors are close and the distances are close (step S43 = NO), the processing of the mask shown in FIG. The separation / integration processing routine is terminated, and the processing returns to the focus control processing routine shown in FIG.

そして次に、図2に示すように、ステップS15において、MPU16の位置取得部25は、先のステップS13、ステップS41又はステップS43において取得したマスクの距離に基づいてフォーカスマップを算出する。ここで、フォーカスマップとは、スルー画に含まれる各々のマスクのデフォーカス量に基づいて算出されるマスクの距離の分布を意味している。また、マスクの距離の分布とは、マスクの全体における各々のマスクの距離のばらつきを意味しており、スルー画に含まれる複数のマスクの相対的な位置関係によって規定される。   Then, as shown in FIG. 2, in step S15, the position acquisition unit 25 of the MPU 16 calculates a focus map based on the mask distance acquired in the previous step S13, step S41, or step S43. Here, the focus map means a distribution of mask distances calculated based on the defocus amount of each mask included in the through image. The distribution of the mask distance means a variation in the distance of each mask in the entire mask, and is defined by the relative positional relationship of a plurality of masks included in the through image.

具体的には、MPU16の位置取得部25は、まず、スルー画の奥行方向における近接側から無限遠側にかけてのマスクの距離を複数の距離範囲に分割する。本実施形態では、これらの距離範囲が、スルー画の奥行方向における近接側から順に、「近接域」、「至近域」、「中景域」、「遠景域」及び「無限遠域」としてそれぞれ設定されている。そして、MPU16の位置取得部25は、各々のマスクの距離を、スルー画の奥行方向において分割されたこれらの距離範囲に分類する。   Specifically, the position acquisition unit 25 of the MPU 16 first divides the mask distance from the near side to the infinity side in the depth direction of the through image into a plurality of distance ranges. In the present embodiment, these distance ranges are respectively “proximity area”, “close-range area”, “middle scene area”, “distant view area”, and “infinite distance area” in order from the close side in the depth direction of the through image. Is set. And the position acquisition part 25 of MPU16 classify | categorizes the distance of each mask into these distance ranges divided | segmented in the depth direction of the through image.

図5に示す例では、スルー画に含まれる3つのマスクa1,b1,c1の距離が何れも比較的小さな値となっており、全てのマスクa1,b1,c1がスルー画の奥行方向における近接側に位置していることを示している。この場合、図6において「測定値1」として示すように、カメラ10からの距離が最も近い距離範囲である「近接域」に対し、全てのマスクa1,b1,c1の距離が偏った状態で分類されている。また、図6において「測定値2」として示す例では、カメラ10からの距離が最も遠い距離範囲である「無限遠域」に対し、全てのマスクa2,b2,c2の距離が偏った状態で分類されている。   In the example shown in FIG. 5, the distances between the three masks a1, b1, and c1 included in the through image are all relatively small, and all the masks a1, b1, and c1 are close in the depth direction of the through image. It is located on the side. In this case, as shown as “measured value 1” in FIG. 6, the distances of all the masks a1, b1, and c1 are biased with respect to the “close range” that is the closest distance range from the camera 10. It is classified. In the example shown as “measured value 2” in FIG. 6, the distances of all the masks a2, b2, and c2 are biased with respect to the “infinity range” that is the farthest distance range from the camera 10. It is classified.

続いて、ステップS16において、MPU16のモード設定部27は、先のステップS15において算出されたフォーカスマップに基づいて画像の撮影モードが判定可能であるか否かを判定する。そして、MPU16のモード設定部27は、スルー画から算出したフォーカスマップに基づいて画像の撮影モードが判定可能である(ステップS16=YES)と判定した場合には、その処理をステップS17に移行する。   Subsequently, in step S16, the mode setting unit 27 of the MPU 16 determines whether or not the image shooting mode can be determined based on the focus map calculated in the previous step S15. When the mode setting unit 27 of the MPU 16 determines that the image shooting mode can be determined based on the focus map calculated from the through image (step S16 = YES), the process proceeds to step S17. .

そして次に、ステップS17において、MPU16のモード設定部27は、先のステップS16において判定された撮影モードを、カメラ10における画像の撮影モードとして設定する。そして、MPU16は、焦点調整(AF)の設定、露出調整(AE)の設定、及び、ホワイトバランス調整(AWB)に関するカメラ10の設定を制御した上で、その処理をステップS18に移行する。   Next, in step S17, the mode setting unit 27 of the MPU 16 sets the shooting mode determined in the previous step S16 as the image shooting mode in the camera 10. Then, the MPU 16 controls the setting of the camera 10 related to the focus adjustment (AF) setting, the exposure adjustment (AE) setting, and the white balance adjustment (AWB), and the process proceeds to step S18.

具体的には、図6において「測定値1」として示す例では、スルー画に含まれる全てのマスクの距離が「近接域」に偏った状態のフォーカスマップがスルー画から算出される。そのため、MPU16のモード設定部27は、スルー画に含まれる全てのマスクの距離が「近接域」に偏った状態のフォーカスマップに基づいて、その時点においてカメラ10が被写体を接写していると判断し、カメラ10における画像の撮影モードとして「マクロモード」を設定する。   Specifically, in the example shown as “measurement value 1” in FIG. 6, a focus map in which the distances of all the masks included in the through image are biased toward the “near area” is calculated from the through image. Therefore, the mode setting unit 27 of the MPU 16 determines that the camera 10 is photographing the subject at that time based on the focus map in a state where the distances of all the masks included in the through image are biased to the “close range”. Then, the “macro mode” is set as the image shooting mode in the camera 10.

また、図6において「測定値2」として示す例では、スルー画に含まれる全てのマスクの距離が「無限遠域」に偏った状態のフォーカスマップがスルー画から算出される。そのため、MPU16のモード設定部27は、スルー画に含まれる全てのマスクの距離が「無限遠域」に偏った状態のフォーカスマップに基づいて、その時点においてカメラ10が風景を撮影していると判断し、カメラ10における画像の撮影モードとして「風景モード」を設定する。   In the example shown as “measurement value 2” in FIG. 6, a focus map in which the distances of all the masks included in the through image are biased toward “infinity” is calculated from the through image. For this reason, the mode setting unit 27 of the MPU 16 assumes that the camera 10 is shooting a landscape at that time based on a focus map in which the distances of all the masks included in the through image are biased toward “infinity”. Judgment is made, and “landscape mode” is set as the image capturing mode of the camera 10.

一方、MPU16のモード設定部27は、スルー画から算出したフォーカスマップに基づいて画像の撮影モードが判定可能ではない(ステップS16=NO)と判定した場合には、ステップS17の処理を経ることなく、その処理をステップS18に移行する。   On the other hand, if the mode setting unit 27 of the MPU 16 determines that the image shooting mode cannot be determined based on the focus map calculated from the through image (step S16 = NO), the process of step S17 is not performed. Then, the process proceeds to step S18.

そして、ステップS18において、MPU16の合焦領域設定部26は、不揮発性メモリ18に格納されているデータベース30を読み出す。このデータベース30には、スルー画から算出されるフォーカスマップに対する比較対象となる比較要素の距離の分布と、スルー画に含まれるマスクの中から合焦の対象となる合焦マスクを設定する際の基準として比較要素の中から設定される基準合焦要素とが関連付けられて格納されている。   In step S <b> 18, the focusing area setting unit 26 of the MPU 16 reads the database 30 stored in the nonvolatile memory 18. In this database 30, the distance distribution of the comparison element to be compared with the focus map calculated from the through image and the focusing mask to be focused from among the masks included in the through image are set. As a reference, a reference focusing element set from comparison elements is stored in association with each other.

具体的には、図9において「基準分布1」として示す比較要素の距離の分布では、3つの比較要素ra1,rb1,rc1の距離が「近接域」、「至近域」及び「中景域」にそれぞれ位置している。また、この分布では、3つの比較要素ra1,rb1,rc1のうち、スルー画の奥行方向において相対的に無限遠側となる「中景域」に位置する比較要素rc1が基準合焦要素として設定されている。   Specifically, in the distribution of the distances of the comparison elements shown as “reference distribution 1” in FIG. 9, the distances of the three comparison elements ra1, rb1, rc1 are “close area”, “closest area”, and “middle scene area”. Is located in each. In this distribution, of the three comparison elements ra1, rb1, and rc1, the comparison element rc1 located in the “middle scene area” that is relatively infinite in the depth direction of the through image is set as the reference focusing element. Has been.

また、図9において「基準分布2」として示す比較要素の距離の分布では、3つの比較要素ra2,rb2,rc2の距離が「至近域」、「中景域」及び「遠景域」にそれぞれ位置している。また、この分布では、3つの比較要素ra2,rb2,rc2のうち、スルー画の奥行方向において相対的に近接側となる「至近域」に位置する比較要素ra2が基準合焦要素として設定されている。   Further, in the distribution of the distances of the comparison elements shown as “reference distribution 2” in FIG. 9, the distances of the three comparison elements ra2, rb2, and rc2 are respectively positioned in the “closest area”, “middle scene area”, and “far scene area”. doing. Also, in this distribution, of the three comparison elements ra2, rb2, and rc2, the comparison element ra2 located in the “closest area” that is relatively close to the depth direction of the through image is set as the reference focusing element. Yes.

また、図9において「基準分布3」として示す比較要素の距離の分布では、3つの比較要素ra3,rb3,rc3の距離が「中景域」、「遠景域」及び「無限遠域」にそれぞれ位置している。また、この分布では、3つの比較要素ra3,rb3,rc3のうち、スルー画の奥行方向において相対的に近接側に位置する「中景域」と、相対的に無限遠側に位置する「無限遠域」との間となる「遠景域」に位置する比較要素rb3が基準合焦要素として設定されている。   Further, in the distribution of the distances of the comparison elements shown as “reference distribution 3” in FIG. 9, the distances of the three comparison elements ra3, rb3, and rc3 are “middle scene area”, “far scene area”, and “infinity area”, respectively. positioned. Also, in this distribution, among the three comparison elements ra3, rb3, and rc3, the “middle scene area” that is relatively located in the depth direction of the through image and the “infinity” that is relatively located on the infinity side. The comparison element rb3 positioned in the “far-field area” between the “far-field” is set as the reference focusing element.

すなわち、本実施形態では、比較要素のうち最も近接側に位置する比較要素が基準合焦要素として一律に設定されておらず、比較要素の分布に応じて該分布を構成する比較要素のうち基準合焦要素として設定される比較要素が多様に設定されている。なお、図9に示す例では、分布を構成する比較要素の数が3つとなっているが、分布を構成する比較要素の数としては、複数であれば任意の数を採用できる。   That is, in the present embodiment, the comparison element located closest to the comparison elements is not uniformly set as the reference focusing element, and the reference element among the comparison elements constituting the distribution according to the distribution of the comparison elements Various comparison elements are set as focusing elements. In the example shown in FIG. 9, the number of comparison elements constituting the distribution is three, but any number of comparison elements constituting the distribution can be adopted as long as it is plural.

そして次に、ステップS19において、MPU16の合焦領域設定部26は、先のステップS15において算出したフォーカスマップと、先のステップS18において読み出した比較要素の距離の分布とを照合する分布照合処理ルーチンを行う。   Next, in step S19, the focusing area setting unit 26 of the MPU 16 collates the focus map calculated in the previous step S15 with the distance distribution of the comparison element read in the previous step S18. I do.

ここで、分布照合処理ルーチンの詳細を図4に示すフローチャートを用いて説明する。
図4に示すように、ステップS60において、MPU16の合焦領域設定部26は、先のステップS15において算出したフォーカスマップを構成する各々のマスクの距離と、先のステップS18において読み出した分布を構成する各々の比較要素の距離との差分を算出する。
Here, the details of the distribution matching processing routine will be described with reference to the flowchart shown in FIG.
As shown in FIG. 4, in step S60, the focusing area setting unit 26 of the MPU 16 configures the distance of each mask constituting the focus map calculated in the previous step S15 and the distribution read in the previous step S18. The difference with the distance of each comparison element is calculated.

なお、図7に示す例では、スルー画に含まれる3つのマスクa3,b3,c3の距離が離散した値となっており、これらマスクa3,b3,c3がスルー画の奥行方向に距離を隔てて配置されている。この場合、図9において「測定値3」として示すように、フォーカスマップは、3つのマスクa3,b3,c3の距離が「近接域」、「至近域」及び「中景域」にそれぞれ位置している。そして、MPU16の合焦領域設定部26は、図9において「測定値3」として示すフォーカスマップと、図9において「基準分布1」として示す比較要素の距離の分布とを比較する場合には、ステップS60において以下のような処理を行う。すなわち、MPU16の合焦領域設定部26は、マスクa3,b3,c3及び比較要素ra1,rb1,rc1の間における1対1の全ての組み合わせについて、マスクの距離と比較要素の距離との差分を算出する。   In the example shown in FIG. 7, the distances of the three masks a3, b3, and c3 included in the through image are discrete values, and these masks a3, b3, and c3 are spaced apart in the depth direction of the through image. Are arranged. In this case, as shown as “measured value 3” in FIG. 9, the distances of the three masks a3, b3, and c3 are located in the “near area”, “closest area”, and “middle scene area”, respectively. ing. Then, the focusing area setting unit 26 of the MPU 16 compares the focus map shown as “measured value 3” in FIG. 9 with the distance distribution of the comparison element shown as “reference distribution 1” in FIG. In step S60, the following processing is performed. That is, the in-focus area setting unit 26 of the MPU 16 calculates the difference between the mask distance and the comparison element distance for all the one-to-one combinations between the masks a3, b3, and c3 and the comparison elements ra1, rb1, and rc1. calculate.

そして次に、ステップS61において、MPU16の合焦領域設定部26は、先のステップS60において算出した距離の差分が最小となるマスクと比較要素との組み合わせを抽出する。なお、MPU16の合焦領域設定部26は、図9における上記の例では、各々のマスクa3,b3,c3について3つの比較要素ra1,rb1,rc1との距離の差分をそれぞれ算出し、算出された距離の差分が最小となる比較要素を各々のマスクa3,b3,c3との組み合わせの対象として抽出する。この場合、「近接域」に位置するマスクa3と、「近接域」に位置する比較要素ra1とが組み合わされる。また、「至近域」に位置するマスクb3と、「至近域」に位置する比較要素rb1とが組み合わされる。また、「中景域」に位置するマスクc3と、「中景域」に位置する比較要素rc1とが組み合わされる。   In step S61, the focusing area setting unit 26 of the MPU 16 extracts a combination of a mask and a comparison element that minimizes the difference in distance calculated in the previous step S60. In the above example in FIG. 9, the in-focus area setting unit 26 of the MPU 16 calculates the difference in distance between the three comparison elements ra1, rb1, and rc1 for each of the masks a3, b3, and c3. The comparison element that minimizes the difference in distance is extracted as a combination target with each of the masks a3, b3, and c3. In this case, the mask a3 located in the “near area” and the comparison element ra1 located in the “near area” are combined. Further, the mask b3 positioned in the “closest area” and the comparison element rb1 positioned in the “closest area” are combined. Further, the mask c3 located in the “middle scene area” and the comparison element rc1 located in the “middle scene area” are combined.

続いて、ステップS62において、MPU16の合焦領域設定部26は、先のステップS61において抽出された全ての組み合わせについて、マスクと比較要素との距離の差分が閾値未満であるか否かを判定する。この閾値は、フォーカスマップと比較要素の距離の分布とを照合する上で、各々のマスクに対応する比較要素があるか否かを判定する際の基準値となっている。なお、MPU16の合焦領域設定部26は、図9における上記の例では、全てのマスクa3,b3,c3について各々の距離範囲が一致する比較要素ra1,rb1,rc1が存在するため、先のステップS61において抽出された全ての組み合わせについて、マスクa3,b3,c3と比較要素ra1,rb1,rc1との距離の差分が閾値未満であると判定する。そして、MPU16の合焦領域設定部26は、先のステップS61において抽出された全ての組み合わせについて、マスクと比較要素との距離の差分が閾値未満である(ステップS62=YES)と判定した場合には、その処理をステップS63に移行する。   Subsequently, in step S62, the focusing area setting unit 26 of the MPU 16 determines whether or not the difference in distance between the mask and the comparison element is less than the threshold for all combinations extracted in the previous step S61. . This threshold value is a reference value for determining whether or not there is a comparison element corresponding to each mask when collating the focus map with the distance distribution of the comparison element. In the above example in FIG. 9, the focus area setting unit 26 of the MPU 16 includes the comparison elements ra1, rb1, and rc1 that match the distance ranges for all the masks a3, b3, and c3. For all combinations extracted in step S61, it is determined that the difference in distance between the masks a3, b3, and c3 and the comparison elements ra1, rb1, and rc1 is less than the threshold value. When the focus area setting unit 26 of the MPU 16 determines that the difference in distance between the mask and the comparison element is less than the threshold value (step S62 = YES) for all combinations extracted in the previous step S61. Shifts the processing to step S63.

そして、ステップS63において、MPU16の合焦領域設定部26は、不揮発性メモリ18にデータベース30として格納された比較要素の距離の分布のうち、その時点で比較の対象とされている比較要素の距離の分布が、先のステップS15において算出されたフォーカスマップに対して照合可能であると判定する。なお、MPU16の合焦領域設定部26は、図9における上記の例では、「基準分布1」として示す比較要素の距離の分布が、「測定値3」として示すフォーカスマップに対して照合可能であると判定する。その後、MPU16の合焦領域設定部26は、図4に示す分布照合処理ルーチンを終了し、その処理を図2に示す合焦制御処理ルーチンに戻す。   In step S63, the focusing area setting unit 26 of the MPU 16 determines the distance of the comparison element that is the comparison target at that time in the distribution of the distance of the comparison element stored as the database 30 in the nonvolatile memory 18. Is determined to be collable with the focus map calculated in the previous step S15. In the above example in FIG. 9, the focus area setting unit 26 of the MPU 16 can collate the distance distribution of the comparison element indicated as “reference distribution 1” with the focus map indicated as “measured value 3”. Judge that there is. Thereafter, the focusing area setting unit 26 of the MPU 16 ends the distribution matching processing routine shown in FIG. 4 and returns the processing to the focusing control processing routine shown in FIG.

一方、MPU16の合焦領域設定部26は、先のステップS62において抽出された全ての組み合わせについて、マスクと比較要素との距離の差分が閾値未満でない(ステップS=NO)と判定した場合には、その処理をステップS64に移行する。   On the other hand, when the focusing area setting unit 26 of the MPU 16 determines that the distance difference between the mask and the comparison element is not less than the threshold (step S = NO) for all combinations extracted in the previous step S62. Then, the process proceeds to step S64.

そして、ステップS64において、MPU16の合焦領域設定部26は、不揮発性メモリ18にデータベース30として格納された全ての比較要素の距離の分布が、先のステップS15において算出されたフォーカスマップとの比較のために読み出されたか否かを判定する。そして、MPU16の合焦領域設定部26は、不揮発性メモリ18にデータベース30として格納された全ての比較要素の距離の分布が読み出されていない(ステップS64=NO)と判定した場合、その処理をステップS65に移行する。   In step S64, the focusing area setting unit 26 of the MPU 16 compares the distance distribution of all comparison elements stored as the database 30 in the nonvolatile memory 18 with the focus map calculated in the previous step S15. It is determined whether or not it has been read for. If the in-focus area setting unit 26 of the MPU 16 determines that the distribution of the distances of all the comparison elements stored in the nonvolatile memory 18 as the database 30 has not been read (step S64 = NO), the process To step S65.

そして、ステップS65において、MPU16の合焦領域設定部26は、不揮発性メモリ18にデータベース30として格納された比較要素の距離の分布のうち、先のステップS15において算出されたフォーカスマップとの比較のために読み出す分布を変更する。なお、MPU16の合焦領域設定部26は、図9に示す例では、フォーカスマップとの比較のために読み出される比較要素の距離の分布を「基準分布1」から「基準分布2」に変更する。その後、MPU16の合焦領域設定部26は、その処理をステップS60に戻し、ステップS60〜ステップS62、ステップS64、ステップS65の処理を繰り返す。   In step S65, the focusing area setting unit 26 of the MPU 16 compares the comparison element distance distribution stored in the nonvolatile memory 18 as the database 30 with the focus map calculated in the previous step S15. The distribution to be read out is changed. In the example shown in FIG. 9, the focus area setting unit 26 of the MPU 16 changes the distance distribution of the comparison elements read for comparison with the focus map from “reference distribution 1” to “reference distribution 2”. . Thereafter, the focus area setting unit 26 of the MPU 16 returns the process to step S60, and repeats the processes of step S60 to step S62, step S64, and step S65.

一方、MPU16の合焦領域設定部26は、不揮発性メモリ18にデータベース30として格納された全ての比較要素の距離の分布が、先のステップS15において算出されたフォーカスマップとの比較のために読み出された(ステップS64=YES)と判定した場合、その処理をステップS66に移行する。   On the other hand, the focusing area setting unit 26 of the MPU 16 reads the distance distributions of all the comparison elements stored as the database 30 in the nonvolatile memory 18 for comparison with the focus map calculated in the previous step S15. If it is determined that it has been issued (step S64 = YES), the process proceeds to step S66.

そして、ステップS66において、MPU16の合焦領域設定部26は、不揮発性メモリ18にデータベース30として格納された比較要素の距離の分布の中に、先のステップS15において算出されたフォーカスマップに対して照合可能な分布は存在しないと判定する。   Then, in step S66, the focusing area setting unit 26 of the MPU 16 adds the comparison element distance distribution stored as the database 30 in the nonvolatile memory 18 to the focus map calculated in the previous step S15. It is determined that there is no collable distribution.

なお、図9において「測定値4」として示すフォーカスマップでは、3つのマスクa4.b4,c4の距離が「近接域」、「中景域」及び「遠景域」にそれぞれ位置している。そして、この分布は、不揮発性メモリ18に格納された全ての比較要素の距離の分布(図9において「基準分布1」、「基準分布2」及び「基準分布3」として示す)に対して照合可能となっていない。すなわち、不揮発性メモリ18に格納された何れの分布も、「測定値4」として示すフォーカスマップにおける全てのマスクa4,b4,c4について、各々の距離範囲が一致する比較要素が存在する分布とはなっていない。そのため、MPU16の合焦領域設定部26は、不揮発性メモリ18にデータベース30として格納された比較要素の距離の分布の中に、図9において「測定値4」として示すフォーカスマップに対して照合可能な分布は存在しないと判定する。その後、MPU16の合焦領域設定部26は、図4に示す分布照合処理ルーチンを終了し、その処理を図2に示す合焦制御処理ルーチンに戻す。   In the focus map shown as “measured value 4” in FIG. 9, three masks a4. The distances b4 and c4 are located in the “near area”, “middle scene area”, and “far scene area”, respectively. This distribution is compared with the distance distributions of all the comparison elements stored in the nonvolatile memory 18 (shown as “reference distribution 1”, “reference distribution 2”, and “reference distribution 3” in FIG. 9). Not possible. That is, any distribution stored in the non-volatile memory 18 is a distribution in which there are comparison elements having the same distance ranges for all the masks a4, b4, and c4 in the focus map shown as “measured value 4”. is not. Therefore, the focusing area setting unit 26 of the MPU 16 can collate with the focus map indicated as “measured value 4” in FIG. 9 in the distance distribution of the comparison elements stored as the database 30 in the nonvolatile memory 18. It is determined that there is no distribution. Thereafter, the focusing area setting unit 26 of the MPU 16 ends the distribution matching processing routine shown in FIG. 4 and returns the processing to the focusing control processing routine shown in FIG.

そして次に、ステップS20において、MPU16の合焦領域設定部26は、先のステップS19において、不揮発性メモリ18にデータベース30として格納された比較要素の距離の分布の中に、スルー画から算出されたフォーカスマップに対して照合された分布があったか否かを判定する。そして、MPU16の合焦領域設定部26は、スルー画から算出されたフォーカスマップに対して照合された比較要素の距離の分布がある(ステップS20=YES)と判定した場合には、その処理をステップS21に移行する。   Then, in step S20, the focusing area setting unit 26 of the MPU 16 is calculated from the through image in the distance distribution of the comparison elements stored as the database 30 in the nonvolatile memory 18 in the previous step S19. It is determined whether or not there is a distribution collated with respect to the focus map. If the in-focus area setting unit 26 of the MPU 16 determines that there is a distribution of distances of comparison elements collated with respect to the focus map calculated from the through image (step S20 = YES), the process is performed. The process proceeds to step S21.

そして次に、ステップS21において、MPU16の合焦領域設定部26は、先のステップS19においてフォーカスマップに対して照合された比較要素の距離の分布の中から基準合焦要素を読み出す。図9において「測定値3」として示すフォーカスマップでは、図9において「基準分布1」として示す比較要素の距離の分布における基準合焦要素として比較要素rc1が読み出される。   Next, in step S21, the focusing area setting unit 26 of the MPU 16 reads the reference focusing element from the distribution of the distances of the comparison elements collated with respect to the focus map in the previous step S19. In the focus map shown as “measured value 3” in FIG. 9, the comparison element rc1 is read as the reference focusing element in the distance distribution of the comparison element shown as “reference distribution 1” in FIG.

続いて、ステップS22において、MPU16の合焦領域設定部26は、スルー画から算出されたフォーカスマップを構成するマスクの中から、先のステップS21において読み出した基準合焦要素と対応するマスクの画像の付加情報としてフラグ情報を書き込んだ上で、その処理をステップS24に移行する。すなわち、MPU16の合焦領域設定部26は、スルー画から算出されたフォーカスマップを構成するマスクの中から、先のステップS19において基準合焦要素と対応付けられたマスクの画像の付加情報としてフラグ情報を書き込む。図9において「測定値3」として示すフォーカスマップでは、先のステップS19において比較要素rc1と対応付けられたマスクc3の画像の付加情報に対してフラグ情報が書き込まれる。   Subsequently, in step S22, the focusing area setting unit 26 of the MPU 16 selects an image of a mask corresponding to the reference focusing element read in the previous step S21 from the masks constituting the focus map calculated from the through image. After the flag information is written as additional information, the process proceeds to step S24. That is, the focusing area setting unit 26 of the MPU 16 sets the flag as additional information of the mask image associated with the reference focusing element in the previous step S19 from among the masks constituting the focus map calculated from the through image. Write information. In the focus map indicated as “measured value 3” in FIG. 9, flag information is written in the additional information of the image of the mask c3 associated with the comparison element rc1 in the previous step S19.

一方、MPU16の合焦領域設定部26は、スルー画から算出されたフォーカスマップに対して照合された比較要素の距離の分布がない(ステップS20=NO)と判定した場合には、その処理をステップS23に移行する。   On the other hand, when the in-focus area setting unit 26 of the MPU 16 determines that there is no distribution of comparison element distances compared with the focus map calculated from the through image (step S20 = NO), the process is performed. Control goes to step S23.

そして、ステップS23において、MPU16の合焦領域設定部26は、スルー画に含まれるマスクの距離の大小関係に基づいてマスクの画像の付加情報に対してフラグ情報を書き込んだ上で、その処理をステップS24に移行する。具体的には、MPU16の合焦領域設定部26は、一例として、スルー画に含まれるマスクのうち、距離が最も小さいマスク、即ち、スルー画の奥行方向において最も近接側に位置するマスクの画像の付加情報に対してフラグ情報を書き込む。図9において「測定値4」として示すフォーカスマップでは、このフォーカスマップを構成するマスクa4,b4,c4のうち、距離が最も小さいマスクa4の画像の付加情報に対してフラグ情報が書き込まれる。   In step S23, the focusing area setting unit 26 of the MPU 16 writes the flag information to the additional information of the mask image based on the relationship between the mask distances included in the through image, and then performs the processing. Control goes to step S24. Specifically, for example, the focusing area setting unit 26 of the MPU 16 has an image of a mask having the shortest distance among masks included in the through image, that is, a mask positioned closest to the through image in the depth direction. Flag information is written to the additional information. In the focus map shown as “measured value 4” in FIG. 9, flag information is written in the additional information of the image of the mask a4 having the shortest distance among the masks a4, b4, and c4 constituting the focus map.

そして次に、ステップS24において、MPU16の合焦領域設定部26は、先のステップS22又はステップS23においてフラグ情報が書き込まれたマスクのマスク評価値に対して距離評価値を加算する。なお、図8(a)において「測定値3」として示す例では、フォーカスマップを構成するマスクa3,b3,c3のうち、マスクc3の画像の付加情報に対してフラグ情報が書き込まれている。そのため、先のステップS12において算出したマスクc3のマスク評価値である「3」に対し、距離評価値として「5」という数値が加算される。その結果、マスクc3の評価値は、「8」という数値となる。また、図8(b)において「測定値4」として示す例では、フォーカスマップを構成するマスクa4,b4,c4のうち、マスクa4の画像の付加情報に対してフラグ情報が書き込まれている。そのため、先のステップS12において算出したマスクa4のマスク評価値である「3」に対し、距離評価値として「5」という数値が加算される。その結果、マスクa4の評価値は「8」という数値となる。   Then, in step S24, the focusing area setting unit 26 of the MPU 16 adds the distance evaluation value to the mask evaluation value of the mask in which the flag information has been written in the previous step S22 or step S23. In the example shown as “measured value 3” in FIG. 8A, flag information is written in the additional information of the image of the mask c3 among the masks a3, b3, and c3 constituting the focus map. Therefore, a numerical value “5” is added as a distance evaluation value to “3” which is the mask evaluation value of the mask c3 calculated in the previous step S12. As a result, the evaluation value of the mask c3 is a numerical value “8”. In the example shown as “measured value 4” in FIG. 8B, flag information is written in the additional information of the image of the mask a4 out of the masks a4, b4, and c4 constituting the focus map. Therefore, a numerical value “5” is added as a distance evaluation value to “3” which is the mask evaluation value of the mask a4 calculated in the previous step S12. As a result, the evaluation value of the mask a4 is a numerical value “8”.

続いて、ステップS25において、MPU16の合焦領域設定部26は、合焦領域設定ステップとして、スルー画から算出されたフォーカスマップを構成するマスクのうち、先のステップS25において算出されるマスクの評価値の合計が最も高いマスクを、スルー画において合焦の対象となる合焦マスクとして設定する。なお、図8(a)において「測定値3」として示す例では、フォーカスマップを構成するマスクa3,b3,c3のうち、先のステップS24において距離評価値が加算されたマスクc3が合焦マスクとして設定される。また、図8(b)において「測定値4」として示す例では、フォーカスマップを構成するマスクa4,b4,c4のうち、先のステップS24において距離評価値が加算されたマスクa4が合焦マスクとして設定される。   Subsequently, in step S25, the focusing area setting unit 26 of the MPU 16 evaluates the mask calculated in the previous step S25 among the masks constituting the focus map calculated from the through image as the focusing area setting step. The mask having the highest value is set as a focusing mask to be focused in the through image. In the example shown as “measured value 3” in FIG. 8A, out of the masks a3, b3, and c3 constituting the focus map, the mask c3 to which the distance evaluation value is added in the previous step S24 is the focusing mask. Set as Further, in the example shown as “measurement value 4” in FIG. 8B, the mask a4 to which the distance evaluation value is added in the previous step S24 among the masks a4, b4, and c4 constituting the focus map is the focusing mask. Set as

そして次に、ステップS26において、MPU16は、レリーズボタン32の半押し操作がなされたか否かを判定する。そして、MPU16は、レリーズボタン32の半押し操作がなされた(ステップS26=YES)と判定した場合、その処理をステップS27に移行する。   Next, in step S26, the MPU 16 determines whether or not the release button 32 is half-pressed. If the MPU 16 determines that the release button 32 is half-pressed (step S26 = YES), the process proceeds to step S27.

そして、ステップS27において、スルー画のうち、先のステップS25において設定された合焦マスクを対象としたコントラストAFを実行した上で、その処理をステップS28に移行する。その結果、スルー画が合焦マスクにおいて合焦された状態となる。   In step S27, after performing contrast AF for the focus mask set in step S25 of the through image, the process proceeds to step S28. As a result, the through image is focused on the focusing mask.

一方、MPU16は、レリーズボタン32の半押し操作がなされていない(ステップS26=NO)と判定した場合、ステップS27の処理を経ることなく、その処理をステップS28に移行する。   On the other hand, if the MPU 16 determines that the release button 32 is not half-pressed (step S26 = NO), the process proceeds to step S28 without passing through the process of step S27.

そして、ステップS28において、MPU16は、撮影指示信号が入力されたか否かを判定する。この撮影指示信号は、レリーズボタン32が全押しされた際に画像処理エンジン14に操作信号として入力される。なお、モニタ21がタッチパネルである場合には、モニタ21が画像の撮影のためにタッチ操作された際に撮影指示信号が操作信号として画像処理エンジン14に入力される。そして、MPU16は、撮影指示信号が入力されていない(ステップS28=NO)と判定した場合、その処理をステップS10に戻し、撮影指示信号が入力されるまでステップS10〜ステップS28の処理を繰り返す。一方、MPU16は、撮影指示信号が入力された(ステップS28=YES)と判定した場合、その処理をステップS29に移行する。   In step S28, the MPU 16 determines whether or not a shooting instruction signal is input. This shooting instruction signal is input as an operation signal to the image processing engine 14 when the release button 32 is fully pressed. When the monitor 21 is a touch panel, a shooting instruction signal is input to the image processing engine 14 as an operation signal when the monitor 21 is touched for shooting an image. If the MPU 16 determines that the shooting instruction signal is not input (step S28 = NO), the MPU 16 returns the process to step S10, and repeats the processes of steps S10 to S28 until the shooting instruction signal is input. On the other hand, if the MPU 16 determines that the imaging instruction signal has been input (step S28 = YES), the process proceeds to step S29.

そして、ステップS29において、MPU16は、その時点で撮像素子13から出力された画素信号に基づいて生成している静止画を撮影画像として不揮発性メモリ18に格納する。   In step S29, the MPU 16 stores the still image generated based on the pixel signal output from the image sensor 13 at that time in the nonvolatile memory 18 as a captured image.

次に、上記のように構成されたカメラ10の作用について、特に、MPU16がスルー画に含まれるマスクの中から合焦の対象となる合焦マスクを設定する際の作用に着目して以下説明する。   Next, the operation of the camera 10 configured as described above will be described below, particularly focusing on the operation when the MPU 16 sets a focusing mask to be focused from among the masks included in the through image. To do.

さて、本実施形態では、MPU16は、スルー画に含まれるマスクの距離の分布としてフォーカスマップを算出し、算出されたフォーカスマップを不揮発性メモリ18にデータベース30として格納された比較要素の距離の分布と比較する。そして、MPU16は、フォーカスマップと照合された分布における比較要素のうち、基準合焦要素として設定された比較要素に対応するマスクのマスク評価値に対して距離評価値を加算する。   In the present embodiment, the MPU 16 calculates a focus map as the distribution of the distances of the masks included in the through image, and the distribution of the distances of the comparison elements stored as the database 30 in the nonvolatile memory 18 as the calculated focus map. Compare with Then, the MPU 16 adds the distance evaluation value to the mask evaluation value of the mask corresponding to the comparison element set as the reference focusing element among the comparison elements in the distribution collated with the focus map.

すなわち、MPU16は、スルー画に含まれるマスクについて、人が注目することが想定される度合の指標としてマスク評価値を算出した上で、基準合焦要素に対応する一部のマスクのマスク評価値に対して距離評価値を加算する。   That is, the MPU 16 calculates a mask evaluation value as an index of the degree that a person is expected to pay attention to the mask included in the through image, and then mask evaluation values of some masks corresponding to the reference focusing element The distance evaluation value is added to.

特に、本実施形態では、MPU16は、マスクの全体における各々のマスクの距離のばらつきを意味するフォーカスマップに基づいて、距離評価値が加算されるマスクを設定する。そのため、MPU16は、必ずしも、マスク評価値が最も高いマスクを合焦マスクとして設定するわけではなく、スルー画の奥行方向におけるマスク同士の相対的な位置関係を考慮した上で合焦マスクを設定する。   In particular, in the present embodiment, the MPU 16 sets a mask to which a distance evaluation value is added based on a focus map that means variation in the distance of each mask in the entire mask. Therefore, the MPU 16 does not necessarily set the mask having the highest mask evaluation value as the focusing mask, but sets the focusing mask in consideration of the relative positional relationship between the masks in the depth direction of the through image. .

また、本実施形態では、不揮発性メモリ18にデータベース30として格納されている比較要素の距離の分布は、比較要素の分布に応じて該分布を構成する比較要素のうち基準合焦要素として設定される比較要素が多様に設定されている。すなわち、不揮発性メモリ18にデータベース30として格納されている比較要素の距離の分布は、比較要素のうち最も近接側に位置する比較要素が基準合焦要素として一律に設定されていない。   In the present embodiment, the distance distribution of the comparison elements stored as the database 30 in the nonvolatile memory 18 is set as a reference focusing element among the comparison elements constituting the distribution according to the distribution of the comparison elements. Various comparison elements are set. That is, the comparison element distance distribution stored as the database 30 in the non-volatile memory 18 does not uniformly set the comparison element located closest to the comparison elements as the reference focusing element.

そのため、MPU16は、スルー画から算出したフォーカスマップを、不揮発性メモリ18にデータベース30として格納された比較要素の距離の分布のうち何れの分布に対して照合したかに応じて、スルー画に含まれるマスクのうち合焦マスクとして設定するマスクを多様に変更する。したがって、MPU16は、スルー画のうち人が注目することが想定される領域の候補として複数のマスクを抽出した場合であっても、これらのマスクのうち最も近接側に位置するマスクを合焦マスクとして一律に設定することはない。   For this reason, the MPU 16 includes the focus map calculated from the through image in the through image depending on which of the distance distributions of the comparison elements stored as the database 30 in the nonvolatile memory 18 is collated. Various masks to be set as focusing masks are changed. Therefore, even when the MPU 16 extracts a plurality of masks as candidate regions that are expected to be noticed by a person in the through image, the mask located closest to the mask is selected as the focus mask. Is not set uniformly.

上記第1の実施形態によれば、以下に示す効果を得ることができる。
(1)スルー画に含まれるマスク同士におけるスルー画の奥行方向の相対位置に基づいて合焦マスクが設定される。そのため、スルー画において合焦対象となる領域を多様に設定することができる。
According to the first embodiment, the following effects can be obtained.
(1) A focusing mask is set based on the relative position in the depth direction of the through image between the masks included in the through image. Therefore, it is possible to set various areas to be focused on in the through image.

(2)スルー画に含まれるマスクの全体の距離のばらつきに基づいて合焦マスクが設定される。そのため、スルー画において合焦対象となる領域を更に多様に設定することができる。   (2) A focusing mask is set based on variations in the overall distance of the mask included in the through image. For this reason, it is possible to set more various areas to be focused in the through image.

(3)スルー画から算出されるフォーカスマップを、不揮発性メモリ18にデータベース30として格納された比較要素の距離の分布に対して照合する。そのため、スルー画から算出されたフォーカスマップに適した態様で、スルー画において合焦対象となる領域を多様に設定することができる。   (3) The focus map calculated from the through image is collated with the distance distribution of the comparison elements stored as the database 30 in the nonvolatile memory 18. Therefore, it is possible to set various regions to be focused on in the through image in a manner suitable for the focus map calculated from the through image.

(4)マスクのエッジにおける軸上色収差の評価値に基づいてマスクの距離が取得されるため、スルー画の焦点調節のためにフォーカスレンズ11を動かすことなく、マスク同士のスルー画の奥行方向における相対位置を取得することができる。   (4) Since the distance of the mask is acquired based on the evaluation value of the axial chromatic aberration at the edge of the mask, the depth of the through image between the masks in the depth direction without moving the focus lens 11 to adjust the focus of the through image The relative position can be acquired.

(5)スルー画からのマスクの抽出結果に対してマスクの距離のデータを組み合わせることにより、スルー画から抽出された複数のマスクが一つの被写体から抽出されたマスクであると判定された場合には、これらのマスクが統合される。そのため、スルー画に含まれる各々の被写体を一つのマスクとして抽出する精度が高められる。したがって、スルー画の奥行方向におけるマスク同士の相対位置を、スルー画の奥行方向における被写体同士の相対位置として正確に取得することができる。   (5) When it is determined that a plurality of masks extracted from a through image are masks extracted from one subject by combining mask distance data with a mask extraction result from the through image These masks are integrated. Therefore, the accuracy of extracting each subject included in the through image as one mask is improved. Therefore, the relative position of the masks in the depth direction of the through image can be accurately acquired as the relative position of the subjects in the depth direction of the through image.

(6)スルー画からのマスクの抽出結果に対してマスクの距離のデータを組み合わせることにより、スルー画から抽出した一つのマスクに複数の被写体から抽出された小領域が含まれると判定された場合には、マスクが複数の小領域に分割される。そのため、スルー画に含まれる各々の被写体を一つのマスクとして抽出する精度が高められる。したがって、スルー画の奥行方向におけるマスク同士の相対位置を、スルー画の奥行方向における被写体同士の相対位置として正確に取得することができる。   (6) When it is determined that a small area extracted from a plurality of subjects is included in one mask extracted from a through image by combining mask distance data with a mask extraction result from the through image The mask is divided into a plurality of small regions. Therefore, the accuracy of extracting each subject included in the through image as one mask is improved. Therefore, the relative position of the masks in the depth direction of the through image can be accurately acquired as the relative position of the subjects in the depth direction of the through image.

(7)スルー画から算出されたフォーカスマップに基づいて、画像の撮影に適した撮影モードを自動的に設定することができる。
(8)スルー画から算出したフォーカスマップが、スルー画に含まれる全てのマスクがスルー画の奥行方向における近接側に偏っている状態を示している場合、カメラ10が被写体を接写した状態であると判定される。そして、その撮影に適した撮影モードであるマクロモードにカメラ10の撮影モードを自動的に設定することができる。
(7) A shooting mode suitable for shooting an image can be automatically set based on the focus map calculated from the through image.
(8) When the focus map calculated from the through image shows a state where all the masks included in the through image are biased to the close side in the depth direction of the through image, the camera 10 is in a state of taking a close-up image of the subject. It is determined. Then, the shooting mode of the camera 10 can be automatically set to a macro mode that is a shooting mode suitable for the shooting.

(9)スルー画から算出したフォーカスマップが、スルー画に含まれる全てのマスクがスルー画の奥行方向における無限遠側に偏っている状態を示している場合、カメラ10が風景を撮影していると判定される。そして、その撮影に適した撮影モードである風景モードにカメラ10の撮影モードを自動的に設定することができる。   (9) When the focus map calculated from the live view indicates that all the masks included in the live view are biased toward the infinity side in the depth direction of the live view, the camera 10 is shooting a landscape. It is determined. Then, the shooting mode of the camera 10 can be automatically set to a landscape mode which is a shooting mode suitable for the shooting.

(第2の実施形態)
次に、第2の実施形態について説明する。なお、第2の実施形態は、マスクの距離及び配置の組み合わせの分布に基づいて合焦マスクが設定される点が第1の実施形態と異なる。したがって、以下の説明においては、第1の実施形態と相違する構成について主に説明し、第1の実施形態と同一又は相当する構成については同一符号を付して重複説明を省略する。
(Second Embodiment)
Next, a second embodiment will be described. The second embodiment is different from the first embodiment in that a focusing mask is set based on a distribution of combinations of mask distances and arrangements. Therefore, in the following description, a configuration that is different from the first embodiment will be mainly described, and a configuration that is the same as or equivalent to that of the first embodiment will be denoted by the same reference numeral, and redundant description will be omitted.

図10に示すように、本実施形態のMPU16が実行する合焦制御処理ルーチンにおいて、ステップS100〜ステップS103の各処理は第1の実施形態における図2のステップS10、ステップS11、ステップS13、ステップS14の各処理と同様である。   As shown in FIG. 10, in the focus control processing routine executed by the MPU 16 of this embodiment, the processes in steps S100 to S103 are performed in steps S10, S11, S13, and steps in FIG. 2 in the first embodiment. It is the same as each process of S14.

そして、ステップS104において、MPU16の位置取得部25は、先のステップS101において抽出されたマスクの重心位置を算出した上で、算出された重心位置とスルー画の画角の中心点とのずれ量をマスクの配置として取得する。   In step S104, the position acquisition unit 25 of the MPU 16 calculates the centroid position of the mask extracted in the previous step S101, and then the amount of deviation between the calculated centroid position and the center point of the view angle of the through image. Is acquired as the mask arrangement.

図11及び図12に示す例では、スルー画に含まれる6つのマスクa21〜f21の重心位置Ga〜Gfとスルー画の画角の中心点Pとのずれ量Ra〜Rfがマスクa21〜f21の配置としてそれぞれ取得される。そして、MPU16の位置取得部25は、取得したマスクの配置をマスクの画像の付加情報としてバッファメモリ19に格納する。   In the example shown in FIGS. 11 and 12, the shift amounts Ra to Rf between the gravity center positions Ga to Gf of the six masks a21 to f21 included in the through image and the center point P of the view angle of the through image are the masks a21 to f21. Each is acquired as an arrangement. Then, the position acquisition unit 25 of the MPU 16 stores the acquired mask arrangement in the buffer memory 19 as additional information of the mask image.

続いて、ステップS105において、MPU16の位置取得部25は、先のステップ102において取得されたマスクの距離と、先のステップS104において取得されたマスクの配置とに基づいてフォーカスマップを算出する。ここで、本実施形態のフォーカスマップは、スルー画に含まれる各々のマスクの距離及び配置の組み合わせの分布を意味している。この場合、マスクの距離及び配置の組み合わせの分布とは、マスクの全体における各々のマスクの距離及び配置の組み合わせのばらつきを意味している。なお、図12に示す例では、横軸を画角の中心点からのずれ量とし、縦軸をマスクの距離とした座標系において、各々のマスクの距離及び配置の組み合わせを座標系においてプロットした場合に、プロットした座標から求まる近似曲線Sがフォーカスマップとして算出される。   Subsequently, in step S105, the position acquisition unit 25 of the MPU 16 calculates a focus map based on the mask distance acquired in the previous step 102 and the mask arrangement acquired in the previous step S104. Here, the focus map of the present embodiment means a distribution of combinations of distances and arrangements of the respective masks included in the through image. In this case, the distribution of the combination of the distance and the arrangement of the mask means the variation of the combination of the distance and the arrangement of each mask in the entire mask. In the example shown in FIG. 12, in the coordinate system in which the horizontal axis is the amount of deviation from the center point of the angle of view and the vertical axis is the mask distance, the combinations of the distance and the arrangement of each mask are plotted in the coordinate system. In this case, the approximate curve S obtained from the plotted coordinates is calculated as the focus map.

そして次に、ステップS106において、MPU16のモード設定部27は、第1の実施形態における図2のステップS16の処理と同様にして、先のステップS105において算出されたフォーカスマップに含まれるマスクの距離の分布に基づいて、画像の撮影モードが判定可能であるか否かを判定する。なお、MPU16のモード設定部27は、先のステップS105においてフォーカスマップとして算出したマスクの距離及び配置の組み合わせの分布に基づいて、画像の撮影モードが判定可能であるか否かを判定してもよい。   Next, in step S106, the mode setting unit 27 of the MPU 16 performs a mask distance included in the focus map calculated in the previous step S105 in the same manner as in step S16 of FIG. 2 in the first embodiment. Based on the distribution of the image, it is determined whether or not the image shooting mode can be determined. The mode setting unit 27 of the MPU 16 may determine whether or not the image capturing mode can be determined based on the distribution of the mask distance and the arrangement combination calculated as the focus map in the previous step S105. Good.

そして、MPU16のモード設定部27は、スルー画から算出したフォーカスマップに基づいて画像の撮影モードが判定可能である(ステップS106=YES)と判定した場合には、その処理をステップS107に移行する。   When the mode setting unit 27 of the MPU 16 determines that the image shooting mode can be determined based on the focus map calculated from the through image (step S106 = YES), the process proceeds to step S107. .

そして次に、ステップS107において、MPU16のモード設定部27は、第1の実施形態における図2のステップS17の処理と同様にして、先のステップS106において判定された撮影モードを、カメラ10における画像の撮影モードとして設定した上で、その処理をステップS108に移行する。   Then, in step S107, the mode setting unit 27 of the MPU 16 sets the shooting mode determined in the previous step S106 as the image in the camera 10 in the same manner as the process in step S17 of FIG. 2 in the first embodiment. Is set as the shooting mode, and the process proceeds to step S108.

一方、MPU16のモード設定部27は、スルー画から算出したフォーカスマップに基づいて画像の撮影モードが判定可能ではない(ステップS106=NO)と判定した場合には、ステップS107の処理を経ることなく、その処理をステップS108に移行する。   On the other hand, if the mode setting unit 27 of the MPU 16 determines that the shooting mode of the image cannot be determined based on the focus map calculated from the through image (step S106 = NO), the process of step S107 is not performed. Then, the process proceeds to step S108.

そして、ステップS108において、MPU16の合焦領域設定部26は、先のステップS101において抽出されたマスクのうち、スルー画の画角の中心点からのずれ量が相対的に小さいマスク群を第1マスク群として設定し、スルー画の画角の中心点からのずれ量が相対的に大きいマスク群を第2マスク群として設定する。なお、図11及び図12に示す例では、スルー画に含まれる6つのマスクa21〜f21のうち、マスクa21〜c21が第1マスク群として設定されるとともに、マスクd21〜f21が第2マスク群として設定される。   In step S108, the focusing area setting unit 26 of the MPU 16 selects the first mask group having a relatively small deviation amount from the center point of the angle of view of the through image among the masks extracted in the previous step S101. A mask group is set as a mask group, and a mask group having a relatively large shift amount from the center point of the angle of view of the through image is set as the second mask group. In the example shown in FIGS. 11 and 12, among the six masks a21 to f21 included in the through image, the masks a21 to c21 are set as the first mask group, and the masks d21 to f21 are the second mask group. Set as

そして次に、ステップS109において、MPU16の合焦領域設定部26は、先のステップS108において設定された第1マスク群及び第2マスク群の距離の平均値T1及び平均値T2をそれぞれ算出する。なお、図12に示す例では、第1マスク群の距離の平均値T1が「(La+Lb+Lc)/3」として算出されるとともに、第2マスク群の距離の平均値T2が「(Ld+Le+Lf)/3」として算出される。   Then, in step S109, the focusing area setting unit 26 of the MPU 16 calculates the average value T1 and the average value T2 of the distances of the first mask group and the second mask group set in the previous step S108, respectively. In the example shown in FIG. 12, the average distance T1 of the first mask group is calculated as “(La + Lb + Lc) / 3”, and the average distance T2 of the second mask group is “(Ld + Le + Lf) / 3”. Is calculated.

続いて、ステップS110において、MPU16の合焦領域設定部26は、先のステップS109において算出された第1マスク群の距離の平均値T1が第2マスク群の距離の平均値T2よりも大きいか否かを判定する。そして、MPU16の合焦領域設定部26は、第1マスク群の距離の平均値T1が第2マスク群の距離の平均値T2よりも大きい(ステップS110=YES)と判定した場合には、その処理をステップS111に移行する。   Subsequently, in step S110, the focusing area setting unit 26 of the MPU 16 determines whether the average distance T1 of the first mask group calculated in the previous step S109 is greater than the average distance T2 of the second mask group. Determine whether or not. When the focusing area setting unit 26 of the MPU 16 determines that the average distance T1 of the first mask group is larger than the average distance T2 of the second mask group (step S110 = YES), The process proceeds to step S111.

そして、ステップS111において、MPU16の合焦領域設定部26は、先のステップS108において設定された第1マスク群のうち、距離が最も大きいマスクをスルー画において合焦の対象となる合焦マスクとして設定する。すなわち、MPU16の合焦領域設定部26は、第1マスク群の距離の平均値T1が第2マスク群の距離の平均値T2よりも大きい場合には、スルー画に含まれるマスクの配置パターンが、スルー画の画角の周辺側から中心側にかけてマスクの距離が次第に大きくなるように連続的に配置される「パースペクティブパターン」であると判断する。そして、MPU16の合焦領域設定部26は、「パースペクティブパターン」において人が注目することが想定される領域として、スルー画に含まれるマスクのうち最奥側のマスクを合焦マスクとして設定する。   In step S111, the focusing area setting unit 26 of the MPU 16 sets the mask having the longest distance among the first mask groups set in the previous step S108 as the focusing mask to be focused in the through image. Set. That is, when the average distance T1 of the first mask group is larger than the average distance T2 of the second mask group, the focusing area setting unit 26 of the MPU 16 sets the mask arrangement pattern included in the through image. Then, it is determined that the “perspective pattern” is continuously arranged so that the distance of the mask gradually increases from the peripheral side to the center side of the angle of view of the through image. Then, the in-focus area setting unit 26 of the MPU 16 sets, as an in-focus mask, the innermost mask among the masks included in the through image as an area that is expected to be noticed by a person in the “perspective pattern”.

一方、MPU16の合焦領域設定部26は、第1マスク群の距離の平均値T1が第2マスク群の距離の平均値T2以下である(ステップS110=NO)と判定した場合には、その処理をステップS112に移行する。   On the other hand, if the focusing area setting unit 26 of the MPU 16 determines that the average distance T1 of the first mask group is equal to or less than the average distance T2 of the second mask group (step S110 = NO), The process proceeds to step S112.

そして、ステップS112において、MPU16の合焦領域設定部26は、スルー画に含まれるマスクの距離の大小関係に基づいて合焦マスクを設定する。具体的には、MPU16の合焦領域設定部26は、一例として、スルー画に含まれるマスクのうち、距離が最も小さいマスク、即ち、スルー画の奥行方向において最も近接側に位置するマスクを合焦マスクとして設定する。   In step S112, the focusing area setting unit 26 of the MPU 16 sets the focusing mask based on the relationship between the mask distances included in the through image. Specifically, for example, the focusing area setting unit 26 of the MPU 16 aligns a mask having the smallest distance among the masks included in the through image, that is, a mask positioned closest to the through image in the depth direction. Set as a focus mask.

そして以後、MPU16は、ステップS113〜ステップS116において、第1の実施形態における図2のステップS26〜ステップS29の各処理と同様の処理を経て、撮影画像を生成する。   Thereafter, in step S113 to step S116, the MPU 16 generates a captured image through the same processing as the processing in step S26 to step S29 in FIG. 2 in the first embodiment.

上記第2の実施形態によれば、上記第1の実施形態の効果(1)、(4)〜(9)に加え、以下に示す効果を得ることができる。
(10)スルー画内での配置と組み合わされたマスクの全体の距離のばらつきに基づいて合焦マスクが設定される。そのため、スルー画において合焦の対象となる領域を更に多様に設定することができる。
According to the second embodiment, in addition to the effects (1) and (4) to (9) of the first embodiment, the following effects can be obtained.
(10) A focusing mask is set based on the variation in the overall distance of the mask combined with the arrangement in the through image. For this reason, it is possible to set more various regions to be focused in the through image.

(第3の実施形態)
次に、第3の実施形態について説明する。なお、第3の実施形態は、マスクの距離及び配置の組み合わせの分布に基づく合焦マスクの設定の態様が第2の実施形態と異なる。したがって、以下の説明においては、第2の実施形態と相違する構成について主に説明し、第2の実施形態と同一又は相当する構成については同一符号を付して重複説明を省略する。
(Third embodiment)
Next, a third embodiment will be described. The third embodiment is different from the second embodiment in the manner of setting a focusing mask based on the distribution of combinations of mask distances and arrangements. Therefore, in the following description, a configuration that is different from the second embodiment will be mainly described, and a configuration that is the same as or equivalent to that of the second embodiment is denoted by the same reference numeral, and redundant description is omitted.

図13に示すように、本実施形態のMPU16が実行する合焦制御処理ルーチンにおいて、ステップS200〜ステップS203の各処理は第2の実施形態における図10のステップS100〜S103の各処理と同様である。   As shown in FIG. 13, in the focus control processing routine executed by the MPU 16 of this embodiment, each processing in steps S200 to S203 is the same as each processing in steps S100 to S103 in FIG. 10 in the second embodiment. is there.

そして、ステップS204において、MPU16の位置取得部25は、先のステップ202において取得されたマスクの距離、及び、マスクの配置に基づいてフォーカスマップを算出する。この場合、MPU16の位置取得部25は、スルー画内におけるマスクの重心位置をマスクの配置として取得し、取得した重心位置をマスクの距離と組み合わせることによりフォーカスマップを算出する。   In step S204, the position acquisition unit 25 of the MPU 16 calculates a focus map based on the mask distance and the mask arrangement acquired in the previous step 202. In this case, the position acquisition unit 25 of the MPU 16 acquires the centroid position of the mask in the through image as the mask arrangement, and calculates the focus map by combining the acquired centroid position with the mask distance.

そして次に、ステップS205において、MPU16のモード設定部27は、第2の実施形態における図10のステップS106の処理と同様にして、先のステップS204において算出されたフォーカスマップに含まれるマスクの距離の分布に基づいて画像の撮影モードが判定可能であるか否かを判定する。そして、MPU16のモード設定部27は、スルー画から算出したフォーカスマップに基づいて画像の撮影モードが判定可能である(ステップS205=YES)と判定した場合には、その処理をステップS206に移行する。   Then, in step S205, the mode setting unit 27 of the MPU 16 performs the mask distance included in the focus map calculated in the previous step S204 in the same manner as the process in step S106 of FIG. 10 in the second embodiment. It is determined whether or not the image shooting mode can be determined based on the distribution of. If the mode setting unit 27 of the MPU 16 determines that the image shooting mode can be determined based on the focus map calculated from the through image (step S205 = YES), the process proceeds to step S206. .

続いて、ステップS206において、MPU16のモード設定部27は、第2の実施形態における図10のステップS107の処理と同様にして、先のステップS205において判定された撮影モードを、カメラ10における画像の撮影モードとして設定した上で、その処理をステップS207に移行する。   Subsequently, in step S206, the mode setting unit 27 of the MPU 16 changes the shooting mode determined in the previous step S205 to the image mode in the camera 10 in the same manner as the processing in step S107 in FIG. 10 in the second embodiment. After setting as a photographing mode, the process proceeds to step S207.

一方、MPU16のモード設定部27は、スルー画から算出したフォーカスマップに基づいて画像の撮影モードが判定可能ではない(ステップS205=NO)と判定した場合には、ステップS206の処理を経ることなく、その処理をステップS207に移行する。   On the other hand, if the mode setting unit 27 of the MPU 16 determines that the shooting mode of the image cannot be determined based on the focus map calculated from the through image (step S205 = NO), the process of step S206 is not performed. Then, the process proceeds to step S207.

そして、ステップS207において、MPU16の合焦領域設定部26は、先のステップS201において抽出されたマスクのうち、上下に並列したマスクの数Nが3つ以上であるか否かを判定する。この場合、MPU16の合焦領域設定部26は、一例として、左右方向におけるマスク同士の重心位置のずれ量が所定の閾値未満であって、且つ、上下方向におけるマスク同士の輪郭の距離が所定の閾値未満である場合に、判定対象のマスクが上下に並列していると判定する。そして、MPU16の合焦領域設定部26は、上下に並列したマスクの数Nが3つ以上である(ステップS207=YES)と判定した場合、その処理をステップS208に移行する。   In step S207, the focusing area setting unit 26 of the MPU 16 determines whether or not the number N of the masks arranged in the vertical direction among the masks extracted in the previous step S201 is three or more. In this case, as an example, the focusing area setting unit 26 of the MPU 16 has a deviation amount of the center of gravity position of the masks in the left-right direction that is less than a predetermined threshold value, and the distance between the contours of the masks in the vertical direction is a predetermined value. When it is less than the threshold, it is determined that the determination target masks are arranged in parallel vertically. If the in-focus area setting unit 26 of the MPU 16 determines that the number N of the masks arranged in the vertical direction is three or more (step S207 = YES), the process proceeds to step S208.

そして次に、ステップS208において、MPU16の合焦領域設定部26は、上下に並列したN個のマスクを、最下端側から順に第1〜第Nマスクとして設定する。
続いて、ステップS209において、MPU16の合焦領域設定部26は、上下に並列したマスクのうち、最下端側から数えて何番目のマスクの距離を比較対象とすべきかを示す番号Mを初期値M=「1」に設定する。
Next, in step S208, the focusing area setting unit 26 of the MPU 16 sets N masks arranged in the vertical direction as first to Nth masks in order from the lowermost side.
Subsequently, in step S209, the focusing area setting unit 26 of the MPU 16 sets, as an initial value, a number M indicating how many mask distances from the lowermost side of the masks arranged vertically are to be compared. Set M = “1”.

次に、ステップS210において、MPU16の合焦領域設定部26は、上下に並列したマスクのうち、最下端側から数えてM番目に位置するマスクの距離が、その上方に隣り合う(M+1)番目のマスクの距離よりも小さいか否かを判定する。すなわち、MPU16の合焦領域設定部26は、M=「1」に設定した状態では、上下に並列したマスクのうち、最下端のマスクの距離がその上方に隣り合うマスクの距離よりも小さいか否かを判定する。そして、MPU16の合焦領域設定部26は、M番目に位置するマスクの距離が、その上方に隣り合うマスクの距離よりも小さい(ステップS210=YES)と判定した場合、その処理をステップS211に移行する。   Next, in step S210, the in-focus area setting unit 26 of the MPU 16 sets the distance of the M-th mask counted from the lowermost side among the masks arranged in the vertical direction to the (M + 1) th adjacent to the upper side. It is determined whether it is smaller than the mask distance. In other words, in the state where M = “1”, the focus area setting unit 26 of the MPU 16 determines whether the distance of the lowermost mask among the masks arranged in the vertical direction is smaller than the distance of the adjacent masks above it. Determine whether or not. When the focusing area setting unit 26 of the MPU 16 determines that the distance of the Mth mask is smaller than the distance of the adjacent mask above (step S210 = YES), the process proceeds to step S211. Transition.

そして次に、ステップS211において、MPU16の合焦領域設定部26は、「M<N−1」という関係式を満たすか否かを判定する。そして、MPU16の合焦領域設定部26は、「M<N−1」という関係式を満たす(ステップS211=YES)と判定した場合には、その処理をステップS212に移行する。   In step S211, the in-focus area setting unit 26 of the MPU 16 determines whether or not the relational expression “M <N−1” is satisfied. If the in-focus area setting unit 26 of the MPU 16 determines that the relational expression “M <N−1” is satisfied (step S211 = YES), the process proceeds to step S212.

続いて、ステップS212において、MPU16の合焦領域設定部26は、MをM+1にインクリメントした後に、その処理をステップS210に戻す。
そして、MPU16の合焦領域設定部26は、M=「2」に設定した状態でステップS210の処理を再び行う。この場合、MPU16の合焦領域設定部26は、上下に並列したマスクのうち、最下端側から二番目のマスクの距離がその上方に隣り合うマスクの距離よりも小さいか否かを判定する。
Subsequently, in step S212, the focusing area setting unit 26 of the MPU 16 increments M to M + 1, and then returns the process to step S210.
Then, the focusing area setting unit 26 of the MPU 16 performs the process of step S <b> 210 again with M = “2”. In this case, the focusing area setting unit 26 of the MPU 16 determines whether or not the distance of the second mask from the lowermost side among the masks arranged in the vertical direction is smaller than the distance of the adjacent mask above it.

すなわち、MPU16の合焦領域設定部26は、M番目に位置するマスクの距離が、その上方に隣り合うマスクの距離よりも小さいという条件を満たす限り、Mをインクリメントする。そして、Mがインクリメントされる度に、上下に並列したマスクのうち、比較の対象となるマスクの組み合わせが最下端側から一つずつ上方にずれていく。   In other words, the focusing area setting unit 26 of the MPU 16 increments M as long as the condition that the distance of the Mth mask is smaller than the distance of the adjacent mask above it is satisfied. Each time M is incremented, the mask combination to be compared among the masks arranged in the vertical direction is shifted upward one by one from the lowest end side.

そして、MPU16の合焦領域設定部26は、先のステップS210における条件を満たす間に、「M<N−1」という条件を満たさなくなった(ステップS211=NO)時点で、上下に並列した全てのマスクの組み合わせについて距離の比較が完了したと判断し、その処理をステップS213に移行する。   Then, the in-focus area setting unit 26 of the MPU 16 does not satisfy the condition “M <N−1” while satisfying the condition in the previous step S210 (step S211 = NO). It is determined that the comparison of the distances for the combination of masks has been completed, and the process proceeds to step S213.

そして次に、ステップS213において、MPU16の合焦領域設定部26は、上下に並列したマスクのうち最上端のマスクとなる第Nマスクをスルー画において合焦の対象となる合焦マスクとして設定した上で、その処理をステップS217に移行する。すなわち、MPU16の合焦領域設定部26は、上下に並列した全てのマスクについて先のステップS210における条件を満たす場合には、スルー画に含まれるマスクの配置パターンが、台座の上に物体が載置された配置パターンであると判断する。そして、MPU16の合焦領域設定部26は、この配置パターンにおいて上下に並列したマスクのうち最上端のマスクが台座の上に載置された物体であると想定し、この最上端のマスクを合焦マスクとして設定する。   Next, in step S213, the focusing area setting unit 26 of the MPU 16 sets the Nth mask, which is the uppermost mask among the masks arranged in the vertical direction, as the focusing mask to be focused in the through image. Then, the process proceeds to step S217. That is, if the focus area setting unit 26 of the MPU 16 satisfies the conditions in the previous step S210 for all the masks arranged in parallel vertically, the arrangement pattern of the masks included in the through image is displayed on the pedestal. It is determined that the placement pattern is placed. Then, the focusing area setting unit 26 of the MPU 16 assumes that the uppermost mask among the masks arranged in the vertical direction in this arrangement pattern is an object placed on the pedestal, and aligns the uppermost mask. Set as a focus mask.

なお、図14(a)に示す例では、スルー画に含まれる3つのマスクa31〜c31が上下に並列しており、これらのマスクa31〜c31の距離は、最下端のマスクa31、中央のマスクb31、最上端のマスクc31の順に次第に大きくなる。そのため、これらのマスクa31〜c31の配置パターンは、台座の上に物体が載置された配置パターンであると判断され、これらのマスクa31〜c31のうち最上端のマスクc31が合焦マスクとして設定される。   In the example shown in FIG. 14A, three masks a31 to c31 included in the through image are vertically arranged in parallel, and the distance between these masks a31 to c31 is the lowermost mask a31 and the center mask. The size gradually increases in the order of b31 and the uppermost mask c31. Therefore, the arrangement pattern of these masks a31 to c31 is determined to be an arrangement pattern in which an object is placed on the pedestal, and the uppermost mask c31 among these masks a31 to c31 is set as the focusing mask. Is done.

一方、MPU16の合焦領域設定部26は、先のステップS211における「M<N−1」という条件を満たさなくなる前時点で、先のステップS210における条件を満たさなくなった(ステップS210=NO)場合、その処理をステップS214に移行する。   On the other hand, the in-focus area setting unit 26 of the MPU 16 does not satisfy the condition in the previous step S210 (step S210 = NO) before the condition “M <N−1” in the previous step S211 is not satisfied. Then, the process proceeds to step S214.

そして、ステップS214において、MPU16の合焦領域設定部26は、上下に並列したマスクのうち、第M〜第Nマスクを合焦マスクの候補として設定する。すなわち、MPU16の合焦領域設定部26は、上下に並列したマスクのうち、一部のマスクについては先のステップS210における条件を満たしていたことを根拠に、スルー画に含まれるマスクの配置パターンが台座の上に物体が載置された配置パターンの可能性があると推定する。そのため、MPU16の合焦領域設定部26は、上下に並列したマスクのうち上端側に位置する第M〜第Nマスクを、台座の上に載置された物体の可能性があるマスクの候補として設定する。   In step S214, the focusing area setting unit 26 of the MPU 16 sets the Mth to Nth masks as candidates for the focusing mask among the masks arranged vertically. That is, the focus area setting unit 26 of the MPU 16 sets the arrangement pattern of the masks included in the through image on the basis that some of the masks arranged in the vertical direction satisfy the condition in the previous step S210. It is estimated that there is a possibility of an arrangement pattern in which an object is placed on a pedestal. Therefore, the in-focus area setting unit 26 of the MPU 16 uses the Mth to Nth masks positioned on the upper end side among the masks arranged vertically as mask candidates that may be objects placed on the pedestal. Set.

なお、図14(b)に示す例では、スルー画に含まれる3つのマスクa32〜c32が上下に並列しており、これらのマスクa32〜c32の距離は、最下端のマスクa32、最上端のマスクc32、中央のマスクb32の順に次第に大きくなる。そのため、最下端のマスクa32の距離が中央のマスクb32よりも小さいものの、中央のマスクb32の距離が最上端のマスクc32よりも距離が大きい。そのため、上下に並列したマスクa32〜c32のうち、中央のマスクb32及び最上端のマスクc32が合焦マスクの候補として設定される。   In the example shown in FIG. 14B, the three masks a32 to c32 included in the through image are arranged in parallel vertically, and the distance between these masks a32 to c32 is the lowermost mask a32 and the uppermost mask. The size gradually increases in the order of the mask c32 and the central mask b32. Therefore, although the distance of the lowermost mask a32 is smaller than the central mask b32, the distance of the central mask b32 is larger than the uppermost mask c32. Therefore, among the masks a32 to c32 arranged in parallel vertically, the center mask b32 and the uppermost mask c32 are set as candidates for the focus mask.

そして、MPU16の合焦領域設定部26は、候補となるマスクの中から合焦マスクが選択されたか否かを判定する。ここで、合焦マスクの選択の有無は、例えば、操作部33を構成するセレクトボタンや決定ボタンの押圧操作を通じて合焦マスクの選択及び決定がなされたか否かに基づいて判定される。なお、合焦マスクの選択の有無は、モニタ21がタッチパネルである場合には、モニタ21のタッチ操作を通じて合焦マスクの選択及及び決定がなされたか否かに基づいて判定されてもよい。そして、MPU16の合焦領域設定部26は、合焦マスクの選択がなされていない(ステップS214=NO)と判定した場合、合焦マスクの選択がなされるまでステップS214の処理を周期的に繰り返す。一方、MPU16の合焦領域設定部26は、合焦マスクの選択がなされた(ステップS214=YES)と判定した場合、その処理をステップS215に移行する。   Then, the focusing area setting unit 26 of the MPU 16 determines whether or not a focusing mask is selected from candidate masks. Here, whether or not the focus mask is selected is determined based on whether or not the focus mask is selected and determined through a pressing operation of a select button or a determination button constituting the operation unit 33, for example. Whether or not the focus mask is selected may be determined based on whether or not the focus mask is selected and determined through a touch operation on the monitor 21 when the monitor 21 is a touch panel. If the in-focus area setting unit 26 of the MPU 16 determines that the in-focus mask is not selected (step S214 = NO), the process in step S214 is periodically repeated until the in-focus mask is selected. . On the other hand, when the focusing area setting unit 26 of the MPU 16 determines that the focusing mask has been selected (step S214 = YES), the process proceeds to step S215.

そして、ステップS215において、MPU16の合焦領域設定部26は、先のステップS215において選択されたマスクを合焦マスクとして設定した上で、その処理をステップS217に移行する。   In step S215, the focusing area setting unit 26 of the MPU 16 sets the mask selected in the previous step S215 as the focusing mask, and then shifts the processing to step S217.

また、MPU16の合焦領域設定部26は、上下に並列したマスクの数Nが3つ未満である(ステップS207=NO)と判定した場合、その処理をステップS216に移行する。   If the focusing area setting unit 26 of the MPU 16 determines that the number N of masks arranged in parallel vertically is less than three (step S207 = NO), the process proceeds to step S216.

そして、ステップS216において、MPU16の合焦領域設定部26は、スルー画に含まれるマスクの距離の大小関係に基づいて合焦マスクを設定する。具体的には、MPU16の合焦領域設定部26は、一例として、スルー画に含まれるマスクのうち、距離が最も小さいマスク、即ち、スルー画の奥行方向において最も近接側に位置するマスクを合焦マスクとして設定する。   In step S216, the focusing area setting unit 26 of the MPU 16 sets the focusing mask based on the relationship between the mask distances included in the through image. Specifically, for example, the focusing area setting unit 26 of the MPU 16 aligns a mask having the smallest distance among the masks included in the through image, that is, a mask positioned closest to the through image in the depth direction. Set as a focus mask.

そして以後、MPU16は、ステップS217〜ステップS220において、第2の実施形態における図10のステップS113〜ステップS116の各処理と同様の処理を経て、撮影画像を生成する。   Thereafter, in step S217 to step S220, the MPU 16 generates a captured image through processes similar to the processes in steps S113 to S116 of FIG. 10 in the second embodiment.

上記第3の実施形態によれば、上記各実施形態の効果(1)、(4)〜(10)に示す効果を得ることができる。
(第4の実施形態)
次に、第4の実施形態について説明する。なお、第4の実施形態は、マスクの距離の分布を比較要素の距離の分布に照合することなく合焦マスクを設定する点が第1の実施形態と異なる。したがって、以下の説明においては、第1の実施形態と相違する構成について主に説明し、第1の実施形態と同一又は相当する構成については同一符号を付して重複説明を省略する。
According to the third embodiment, the effects (1) and (4) to (10) of the above embodiments can be obtained.
(Fourth embodiment)
Next, a fourth embodiment will be described. The fourth embodiment is different from the first embodiment in that the focusing mask is set without matching the distance distribution of the mask with the distance distribution of the comparison element. Therefore, in the following description, a configuration that is different from the first embodiment will be mainly described, and a configuration that is the same as or equivalent to that of the first embodiment will be denoted by the same reference numeral, and redundant description will be omitted.

図15に示すように、本実施形態のMPU16が実行する合焦制御処理ルーチンにおいて、ステップS300〜ステップS306の各処理は第1の実施形態における図2のステップS10、ステップS11、ステップS13〜ステップS17の各処理と同様である。   As shown in FIG. 15, in the focus control processing routine executed by the MPU 16 of this embodiment, each processing of Step S300 to Step S306 is performed in Step S10, Step S11, and Step S13 to Step of FIG. 2 in the first embodiment. It is the same as each process of S17.

そして、ステップS307において、MPU16の合焦領域設定部26は、先のステップS304において算出されたフォーカスマップが、他のマスクと比較して距離が大きく外れたマスクを含むか否かを判定する。この場合、一例として、MPU16の合焦領域設定部26は、フォーカスマップを構成するマスクの中に、他の全てのマスクとの距離の差が閾値以上となるマスクが含まれるか否かを判定する。   In step S307, the in-focus area setting unit 26 of the MPU 16 determines whether or not the focus map calculated in the previous step S304 includes a mask whose distance is significantly different from other masks. In this case, as an example, the focusing area setting unit 26 of the MPU 16 determines whether or not the masks constituting the focus map include a mask whose distance difference from all other masks is equal to or greater than a threshold value. To do.

なお、図16及び図17に示す例では、スルー画に含まれる8つのマスクa41〜h41のうち、7つのマスクa41〜g41の距離が「近接域」又は「至近域」に分類される一方で、他の一つのマスクh41の距離が「遠景域」に分類されている。そして、「遠景域」に分類されたマスクh41は、「近接域」又は「至近域」に分類された他のマスクa41〜g41と比較して距離が大きく外れたマスクとして判定される。   In the example shown in FIGS. 16 and 17, among the eight masks a41 to h41 included in the through image, the distances of the seven masks a41 to g41 are classified as “proximity region” or “closest region”. The distance of the other one mask h41 is classified as a “far view area”. Then, the mask h41 classified as “distant view area” is determined as a mask whose distance is greatly deviated from the other masks a41 to g41 classified as “close area” or “closest area”.

そして、MPU16の合焦領域設定部26は、他のマスクと比較して距離が大きく外れたマスクを含む(ステップS307=YES)と判定した場合、その処理をステップS308に移行する。   If the in-focus area setting unit 26 of the MPU 16 determines that it includes a mask whose distance is significantly different from that of other masks (step S307 = YES), the process proceeds to step S308.

そして次に、ステップS308において、MPU16の合焦領域設定部26は、先のステップS307において他のマスクと比較して距離が大きく外れていると判定されたマスクを合焦マスクとして設定する。なお、図16及び図17に示す例では、「遠景域」に分類されたマスクh41が合焦マスクとして設定される。   Next, in step S308, the focusing area setting unit 26 of the MPU 16 sets a mask determined to have a large distance compared to other masks in the previous step S307 as a focusing mask. In the example shown in FIGS. 16 and 17, the mask h41 classified as “distant view area” is set as the focusing mask.

一方、MPU16の合焦領域設定部26は、他のマスクと比較して距離が大きく外れたマスクを含まない(ステップS307=NO)と判定した場合、その処理をステップS309に移行する。   On the other hand, if the in-focus area setting unit 26 of the MPU 16 determines that it does not include a mask whose distance is significantly different from other masks (step S307 = NO), the process proceeds to step S309.

そして、ステップS309において、MPU16の合焦領域設定部26は、スルー画に含まれるマスクの距離の大小関係に基づいて合焦マスクを設定する。具体的には、MPU16の合焦領域設定部26は、一例として、スルー画に含まれるマスクのうち、距離が最も小さいマスク、即ち、スルー画の奥行方向において最も近接側に位置するマスクを合焦マスクとして設定する。   In step S309, the focusing area setting unit 26 of the MPU 16 sets the focusing mask based on the relationship between the mask distances included in the through image. Specifically, for example, the focusing area setting unit 26 of the MPU 16 aligns a mask having the smallest distance among the masks included in the through image, that is, a mask positioned closest to the through image in the depth direction. Set as a focus mask.

そして以後、MPU16は、ステップS310〜ステップS313において、第1の実施形態における図2のステップS26〜ステップS29の各処理と同様の処理を経て、撮影画像を生成する。   Thereafter, in step S310 to step S313, the MPU 16 generates a captured image through the same processing as the processing in step S26 to step S29 in FIG. 2 in the first embodiment.

上記第4の実施形態によれば、上記第1の実施形態の効果(1)、(2)、(4)〜(9)に加え、以下に示す効果を得ることができる。
(11)スルー画から抽出されたマスクのうち、他のマスクと比較して距離の大きさが外れたマスクが合焦マスクとして設定される。そのため、スルー画において人が注目することが想定される領域を、スルー画において合焦の対象となる領域として好適に設定することができる。
According to the fourth embodiment, in addition to the effects (1), (2), and (4) to (9) of the first embodiment, the following effects can be obtained.
(11) Among the masks extracted from the through image, a mask whose distance is out of comparison with other masks is set as a focusing mask. For this reason, it is possible to suitably set a region that is expected to be noticed by a person in the through image as a region to be focused in the through image.

なお、上記各実施形態は、以下のような別の実施形態に変更してもよい。
・上記第1の実施形態において、MPU16の合焦領域設定部26は、スルー画から算出したフォーカスマップを、不揮発性メモリ18に格納された比較要素の距離の分布と比較することにより分布の近似度を算出し、算出した近似度が所定の閾値以上である場合に、フォーカスマップと比較要素の距離の分布とが照合されたと判定してもよい。
In addition, you may change said each embodiment into another embodiment as follows.
In the first embodiment, the focusing area setting unit 26 of the MPU 16 approximates the distribution by comparing the focus map calculated from the through image with the distance distribution of the comparison elements stored in the nonvolatile memory 18. The degree may be calculated, and when the calculated degree of approximation is equal to or greater than a predetermined threshold, it may be determined that the focus map and the distance distribution of the comparison element have been collated.

・上記第2の実施形態において、MPU16の合焦領域設定部26は、以下のようにしてマスクa21〜f21の配置パターンが「パースペクティブパターン」であるか否かを判定してもよい。   In the second embodiment, the focusing area setting unit 26 of the MPU 16 may determine whether or not the arrangement pattern of the masks a21 to f21 is a “perspective pattern” as follows.

すなわち、第1の変更例として、MPU16の合焦領域設定部26は、スルー画に含まれるマスクa21〜f21のうち、スルー画の画角の中心点からのずれ量が隣り合うマスク同士の距離の差分を算出し、算出された差分の正負が一定であるか否かを判定してもよい。   That is, as a first modification example, the focusing area setting unit 26 of the MPU 16 determines the distance between masks adjacent to each other in the amount of deviation from the center point of the angle of view of the through image among the masks a21 to f21 included in the through image. May be calculated, and it may be determined whether the calculated difference is constant or not.

また、第2の変更例として、MPU16の合焦領域設定部26は、スルー画から算出したフォーカスマップを、不揮発性メモリ18に格納された比較要素の距離及び配置の組み合わせの分布と比較することにより分布の近似度を算出し、算出された近似度が所定の閾値以上であるか否かを判定してもよい。   As a second modification, the focusing area setting unit 26 of the MPU 16 compares the focus map calculated from the through image with the distribution of combinations of distances and arrangements of the comparison elements stored in the nonvolatile memory 18. The degree of approximation of the distribution may be calculated using the above, and it may be determined whether or not the calculated degree of approximation is equal to or greater than a predetermined threshold.

・上記第2の実施形態において、MPU16の位置取得部25は、スルー画に含まれるマスクa21〜f21の重心位置Ga〜Gfとスルー画における任意の位置に設定される点とのずれ量をマスクa21〜f21の配置としてそれぞれ取得してもよい。   In the second embodiment, the position acquisition unit 25 of the MPU 16 masks the amount of deviation between the barycentric positions Ga to Gf of the masks a21 to f21 included in the through image and the point set at an arbitrary position in the through image. You may acquire as arrangement | positioning of a21-f21, respectively.

・上記第3の実施形態において、MPU16の合焦領域設定部26は、左右方向におけるマスク同士の重心位置のずれ量が閾値未満であって、且つ、上下方向におけるマスク同士の重心位置のずれ量が閾値未満である場合、判定対象のマスクが上下に並列していると判定してもよい。   In the third embodiment, the focusing area setting unit 26 of the MPU 16 has a shift amount of the center of gravity position between the masks in the left-right direction that is less than the threshold value, and a shift amount of the center of gravity position between the masks in the vertical direction. If is less than the threshold value, it may be determined that the determination target masks are arranged in parallel vertically.

・上記第3の実施形態において、MPU16は、上下に並列したマスクのうち、一部のマスクについては、上下に隣り合うマスクのうち下方のマスクの距離が上方のマスクの距離よりも大きいという条件を満たしている場合、台座の上に載置された物体の可能性があるマスクの候補にそれぞれ合焦させた複数の撮影画像を生成してもよい。   In the third embodiment, the MPU 16 is configured such that, with respect to some of the masks arranged in the vertical direction, for some masks, the distance between the lower masks among the masks adjacent in the vertical direction is greater than the distance between the upper masks If the above condition is satisfied, a plurality of captured images may be generated, each focused on a mask candidate that may be an object placed on the pedestal.

・上記第3の実施形態において、MPU16の合焦領域設定部26は、以下のようにしてマスクの配置パターンが台座の上に物体が載置された配置パターンであるか否かを判定してもよい。すなわち、MPU16の合焦領域設定部26は、スルー画から算出したフォーカスマップを、不揮発性メモリ18に格納された比較要素の距離及び配置の組み合わせの分布と比較することにより分布の近似度を算出し、算出された近似度が所定の閾値以上であるか否かを判定してもよい。   In the third embodiment, the focusing area setting unit 26 of the MPU 16 determines whether the mask arrangement pattern is an arrangement pattern in which an object is placed on the pedestal as follows. Also good. In other words, the focusing area setting unit 26 of the MPU 16 calculates the degree of distribution approximation by comparing the focus map calculated from the through image with the distribution of combinations of distances and arrangements of the comparison elements stored in the nonvolatile memory 18. Then, it may be determined whether the calculated degree of approximation is equal to or greater than a predetermined threshold.

・上記各実施形態において、MPU16の位置取得部25は、例えば、位相差検出方式、コントラスト検出方式及びTOF(Time Of Flight)方式等の検出方式を用いてマスクの距離を取得してもよい。   In each of the above embodiments, the position acquisition unit 25 of the MPU 16 may acquire the mask distance using a detection method such as a phase difference detection method, a contrast detection method, and a TOF (Time Of Flight) method.

この構成では、検出方式として位相差検出方式を用いた場合には、マスクの距離を迅速に取得することができる。
また、検出方式としてコントラスト検出方式を用いた場合には、スルー画における任意の位置にマスクが位置する場合であっても、マスクの距離を取得することができる。
In this configuration, when the phase difference detection method is used as the detection method, the mask distance can be quickly acquired.
When the contrast detection method is used as the detection method, the mask distance can be acquired even when the mask is located at an arbitrary position in the through image.

・上記各実施形態において、MPU16の位置取得部25は、以下のようにしてマスクの距離を取得してもよい。すなわち、MPU16の位置取得部25は、まず、領域のボケ具合と該領域の距離とを対応付けて記憶したデフォーカスデータベースを予め不揮発性メモリ18に格納させる。そして、MPU16の位置取得部25は、スルー画におけるマスクのボケ具合を、デフォーカスデータベースに記憶された領域のボケ具合と照合することにより、マスクの距離を取得する。   In each of the above embodiments, the position acquisition unit 25 of the MPU 16 may acquire the mask distance as follows. That is, the position acquisition unit 25 of the MPU 16 first stores in the nonvolatile memory 18 a defocus database in which the degree of blur of the area and the distance of the area are stored in association with each other. Then, the position acquisition unit 25 of the MPU 16 acquires the mask distance by comparing the degree of blur of the mask in the through image with the degree of blur of the area stored in the defocus database.

この構成では、スルー画の焦点調節のためにフォーカスレンズ11を動かすことなく、マスクの距離を取得することができる。
・上記各実施形態において、スルー画から算出されるフォーカスマップは、マスクごとの距離が、数値データではなく、複数の距離範囲のうち何れの距離範囲に含まれるかを示す区分データで構成されてもよい。
In this configuration, the distance of the mask can be acquired without moving the focus lens 11 for adjusting the focus of the through image.
In each of the above embodiments, the focus map calculated from the through image is configured by segment data indicating which distance range is included in a plurality of distance ranges, instead of numerical data, for each mask. Also good.

この構成によれば、フォーカスマップがマスクごとの距離の数値データによって構成される場合と比較して、フォーカスマップのデータ量を低減することができる。
・上記各実施形態において、MPU16は、動画の撮影時において、各実施形態における合焦制御処理ルーチンと同様の処理を実行することにより、動画の合焦状態を制御してもよい。
According to this configuration, the data amount of the focus map can be reduced as compared with the case where the focus map is configured by numerical data of distances for each mask.
In each of the above embodiments, the MPU 16 may control the in-focus state of the moving image by executing a process similar to the focusing control processing routine in each embodiment during shooting of the moving image.

・上記各実施形態において、画像の撮影機能を搭載したカメラ10以外の電子機器に対し、画像における合焦領域を設定する画像処理装置として画像処理エンジン14が搭載されてもよい。なお、画像の撮影機能を搭載した電子機器としては、例えば、ビデオカメラ、パーソナルコンピュータ、携帯電話機、携帯ゲーム機等が挙げられる。   In each of the above-described embodiments, the image processing engine 14 may be mounted as an image processing apparatus that sets an in-focus area in an image with respect to an electronic device other than the camera 10 having an image shooting function. Note that examples of the electronic device having an image shooting function include a video camera, a personal computer, a mobile phone, and a portable game machine.

10…電子カメラの一例としてのデジタルカメラ、13…撮像素子、14…画像処理装置の一例としての画像処理エンジン、24…領域抽出部、25…位置取得部、26…合焦領域設定部、27…モード設定部、30…データベース、a1〜c1,a2〜c2,a3〜c3,a4〜c4,a21〜f21,a31〜c31,a32〜c32,a41〜h41…特定領域の一例としてのマスク、ra1〜rc1,ra2〜rc2,ra3〜rc3…比較要素。
DESCRIPTION OF SYMBOLS 10 ... Digital camera as an example of an electronic camera, 13 ... Image sensor, 14 ... Image processing engine as an example of an image processing device, 24 ... Area extraction part, 25 ... Position acquisition part, 26 ... Focus area setting part, 27 ... mode setting unit, 30 ... database, a1 to c1, a2 to c2, a3 to c3, a4 to c4, a21 to f21, a31 to c31, a32 to c32, a41 to h41 ... mask as an example of a specific region, ra1 ~ Rc1, ra2-rc2, ra3-rc3 ... comparison elements.

Claims (11)

外部から取得した画像から複数の特定領域を抽出する領域抽出部と、
前記領域抽出部が抽出した前記特定領域同士における前記画像の奥行方向の相対位置を取得する位置取得部と、
前記位置取得部が取得した前記特定領域同士における前記画像の奥行方向の相対位置に基づいて、前記領域抽出部が抽出した前記特定領域の中から合焦の対象となる合焦領域を設定する合焦領域設定部と
を備えたことを特徴とする画像処理装置。
An area extraction unit that extracts a plurality of specific areas from an image acquired from the outside;
A position acquisition unit that acquires a relative position in the depth direction of the images in the specific regions extracted by the region extraction unit;
Based on the relative positions in the depth direction of the images between the specific areas acquired by the position acquisition unit, an in-focus area to be focused is set from the specific areas extracted by the area extraction unit. An image processing apparatus comprising: a focal region setting unit.
前記位置取得部は、前記特定領域同士における画像の奥行方向の相対位置として前記特定領域の距離の分布を取得し、
前記合焦領域設定部は、前記位置取得部が取得した前記特定領域の距離の分布に基づいて前記合焦領域を設定することを特徴とする請求項1に記載の画像処理装置。
The position acquisition unit acquires a distance distribution of the specific area as a relative position in the depth direction of the images between the specific areas,
The image processing apparatus according to claim 1, wherein the focus area setting unit sets the focus area based on a distribution of distances of the specific area acquired by the position acquisition unit.
前記位置取得部は、前記特定領域の距離の分布を、該分布を構成する前記特定領域の前記画像内での配置と組み合わせて取得し、
前記合焦領域設定部は、前記位置取得部が前記特定領域の前記画像内での配置と組み合わせて取得した前記特定領域の距離の分布に基づいて前記合焦領域を設定することを特徴とする請求項2に記載の画像処理装置。
The position acquisition unit acquires the distance distribution of the specific area in combination with the arrangement of the specific area constituting the distribution in the image,
The focus area setting unit sets the focus area based on a distance distribution of the specific area acquired by the position acquisition unit in combination with an arrangement of the specific area in the image. The image processing apparatus according to claim 2.
データベースには、前記位置取得部が取得した前記特定領域の距離の分布との比較対象となる比較要素の距離の分布と、前記合焦領域設定部が前記合焦領域を設定する際の基準として前記分布を構成する前記比較要素の中から設定される基準合焦要素とが関連付けられて記憶されており、
前記合焦領域設定部は、前記位置取得部によって取得された前記特定領域の距離の分布を前記データベースに記憶された前記比較要素の距離の分布に対して照合することにより、前記データベースにおいて照合された分布に関連付けられた前記基準合焦要素に基づいて前記合焦領域を設定することを特徴とする請求項2又は請求項3に記載の画像処理装置。
In the database, the distance distribution of the comparison element to be compared with the distance distribution of the specific area acquired by the position acquisition unit, and the reference when the focusing area setting unit sets the focusing area A reference focusing element set from among the comparison elements constituting the distribution is stored in association with each other,
The in-focus area setting unit is collated in the database by collating the distance distribution of the specific area acquired by the position acquisition unit with the distance distribution of the comparison element stored in the database. The image processing apparatus according to claim 2, wherein the focus area is set based on the reference focus element associated with the distribution.
前記データベースには、前記比較要素の距離の分布に対して前記比較要素の配置が組み合わされて記憶されており、
前記合焦領域設定部は、前記位置取得部によって取得された前記特定領域の距離の分布を前記特定領域の前記画像内での配置と組み合わせて前記データベースに記憶された前記比較要素の距離及び配置の組み合わせの分布に対して照合することにより、前記データベースにおいて照合された分布に関連付けられた前記基準合焦要素に基づいて前記合焦領域を設定することを特徴とする請求項4に記載の画像処理装置。
In the database, the arrangement of the comparison elements is stored in combination with the distance distribution of the comparison elements, and
The in-focus area setting unit includes the distance and arrangement of the comparison elements stored in the database in combination with the distribution of the distance of the specific area acquired by the position acquisition unit in the arrangement of the specific area in the image. 5. The image according to claim 4, wherein the in-focus area is set based on the reference focus element associated with the distribution collated in the database by collating with a distribution of combinations of Processing equipment.
前記合焦領域設定部は、前記位置取得部によって取得された前記特定領域の距離の分布が、一部の特定領域が他の特定領域と比較して距離の大きさが外れた分布である場合、該一部の特定領域の中から前記合焦領域を設定することを特徴とする請求項2又は請求項3に記載の画像処理装置。   The focusing area setting unit is configured such that the distribution of the distance of the specific area acquired by the position acquisition unit is a distribution in which some of the specific areas are out of the distance compared to other specific areas. The image processing apparatus according to claim 2, wherein the focus area is set from the partial specific area. 前記特定領域の距離の分布には、前記特定領域ごとの距離が前記画像の奥行方向において分割された複数の距離範囲に分類された態様で含まれることを特徴とする請求項2〜請求項6のうち何れか一項に記載の画像処理装置。   The distance distribution of the specific area includes the distance for each specific area in a manner classified into a plurality of distance ranges divided in the depth direction of the image. The image processing device according to any one of the above. 前記位置取得部は、前記領域抽出部が抽出した前記特定領域のエッジの色成分量に基づいて前記特定領域の距離を前記特定領域ごとに検出することにより、前記特定領域同士の
前記画像の奥行方向における相対位置を取得することを特徴とする請求項1〜請求項7のうち何れか一項に記載の画像処理装置。
The position acquisition unit detects the distance of the specific region for each specific region based on the color component amount of the edge of the specific region extracted by the region extraction unit, thereby the depth of the image between the specific regions. The image processing apparatus according to claim 1, wherein a relative position in a direction is acquired.
前記位置取得部は、前記領域抽出部が抽出した前記特定領域の距離を位相差検出方式によって前記特定領域ごとに検出することにより、前記特定領域同士の前記画像の奥行方向における相対位置を取得することを特徴とする請求項1〜請求項7のうち何れか一項に記載の画像処理装置。   The position acquisition unit acquires a relative position in the depth direction of the image between the specific regions by detecting the distance between the specific regions extracted by the region extraction unit for each specific region using a phase difference detection method. The image processing apparatus according to claim 1, wherein the image processing apparatus is an image processing apparatus. 前記位置取得部は、前記領域抽出部が抽出した前記特定領域の距離をコントラスト検出方式によって前記特定領域ごとに検出することにより、前記特定領域同士の前記画像の奥行方向における相対位置を取得することを特徴とする請求項1〜請求項7のうち何れか一項に記載の画像処理装置。   The position acquisition unit acquires a relative position in the depth direction of the image between the specific regions by detecting the distance between the specific regions extracted by the region extraction unit for each specific region using a contrast detection method. The image processing apparatus according to claim 1, wherein the image processing apparatus is an image processing apparatus. コンピュータに、
外部から取得した画像から複数の特定領域を抽出する領域抽出ステップと、
前記領域抽出ステップにおいて抽出した前記特定領域同士における前記画像の奥行方向の相対位置を取得する位置取得ステップと、
前記位置取得ステップにおいて取得した前記特定領域同士における前記画像の奥行方向の相対位置に基づいて、前記領域抽出ステップにおいて抽出した前記特定領域の中から合焦の対象となる合焦領域を設定する合焦領域設定ステップと
を実行させることを特徴とする画像処理プログラム。
On the computer,
An area extraction step for extracting a plurality of specific areas from an image acquired from the outside;
A position acquisition step of acquiring a relative position in the depth direction of the images in the specific areas extracted in the area extraction step;
Based on the relative positions in the depth direction of the images in the specific areas acquired in the position acquisition step, an in-focus area to be focused is set from the specific areas extracted in the area extraction step. An image processing program that executes a focal region setting step.
JP2018146063A 2018-08-02 2018-08-02 Image processor and image processing program Pending JP2018197873A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2018146063A JP2018197873A (en) 2018-08-02 2018-08-02 Image processor and image processing program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2018146063A JP2018197873A (en) 2018-08-02 2018-08-02 Image processor and image processing program

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2013245993A Division JP6379478B2 (en) 2013-11-28 2013-11-28 Image processing apparatus, electronic camera, and image processing program

Publications (1)

Publication Number Publication Date
JP2018197873A true JP2018197873A (en) 2018-12-13

Family

ID=64662602

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2018146063A Pending JP2018197873A (en) 2018-08-02 2018-08-02 Image processor and image processing program

Country Status (1)

Country Link
JP (1) JP2018197873A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002051255A (en) * 2000-07-31 2002-02-15 Olympus Optical Co Ltd Main object detectable camera
JP2012049628A (en) * 2010-08-24 2012-03-08 Nikon Corp Image processing apparatus, imaging apparatus and image processing program
WO2013047641A1 (en) * 2011-09-29 2013-04-04 富士フイルム株式会社 Three-dimensional image processing device and three-dimensional image processing method
JP2013245993A (en) * 2012-05-24 2013-12-09 Shin Corporation:Kk Filtering device and examination kit

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002051255A (en) * 2000-07-31 2002-02-15 Olympus Optical Co Ltd Main object detectable camera
JP2012049628A (en) * 2010-08-24 2012-03-08 Nikon Corp Image processing apparatus, imaging apparatus and image processing program
WO2013047641A1 (en) * 2011-09-29 2013-04-04 富士フイルム株式会社 Three-dimensional image processing device and three-dimensional image processing method
JP2013245993A (en) * 2012-05-24 2013-12-09 Shin Corporation:Kk Filtering device and examination kit

Similar Documents

Publication Publication Date Title
US20230206685A1 (en) Decreasing lighting-induced false facial recognition
CN101783877B (en) Image pickup device and flash image generating method
US7756408B2 (en) Focus control amount determination apparatus, method, and imaging apparatus
US8538075B2 (en) Classifying pixels for target tracking, apparatus and method
JP5074322B2 (en) Image processing apparatus, image processing method, image processing program, and imaging apparatus
JP6132490B2 (en) Authentication apparatus, authentication method, and program
CN102761706A (en) Imaging device and imaging method and program
US9070008B2 (en) Object recognition apparatus and dictionary data registration method
JP5419585B2 (en) Image processing apparatus, image processing method, and program
EP2282224A2 (en) Image processing apparatus, image processing method, and computer program
JP6379478B2 (en) Image processing apparatus, electronic camera, and image processing program
US20160316134A1 (en) Image pickup apparatus for taking static image, control method therefor, and storage medium storing control program therefor
JP4771536B2 (en) Imaging device and method of selecting face as main subject
JP2018163365A (en) Image processing apparatus
JP5888986B2 (en) Image processing apparatus and control method thereof
JP2018197873A (en) Image processor and image processing program
US11546502B2 (en) Image processing apparatus and method of controlling the same
JP6349703B2 (en) Electronic camera and image processing program
JP6579764B2 (en) Image processing apparatus, image processing method, and program
US9049382B2 (en) Image processing apparatus and image processing method
JP5463688B2 (en) Focus evaluation device, camera and program
JP6512938B2 (en) Imaging apparatus and image processing method
JP5562479B2 (en) Image processing apparatus, image processing method, and program
KR101579107B1 (en) Apparatus and method for recognizing flower in digital image processing device
JP2009017134A (en) Image device, imaging method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20180806

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20191001

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20200401