JP2018116225A - Focus adjustment device, control method therefor, program, and imaging apparatus - Google Patents

Focus adjustment device, control method therefor, program, and imaging apparatus Download PDF

Info

Publication number
JP2018116225A
JP2018116225A JP2017008579A JP2017008579A JP2018116225A JP 2018116225 A JP2018116225 A JP 2018116225A JP 2017008579 A JP2017008579 A JP 2017008579A JP 2017008579 A JP2017008579 A JP 2017008579A JP 2018116225 A JP2018116225 A JP 2018116225A
Authority
JP
Japan
Prior art keywords
focus
defocus amount
area
phase difference
value
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.)
Granted
Application number
JP2017008579A
Other languages
Japanese (ja)
Other versions
JP6858022B2 (en
JP2018116225A5 (en
Inventor
小西 一樹
Kazuki Konishi
一樹 小西
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2017008579A priority Critical patent/JP6858022B2/en
Publication of JP2018116225A publication Critical patent/JP2018116225A/en
Publication of JP2018116225A5 publication Critical patent/JP2018116225A5/en
Application granted granted Critical
Publication of JP6858022B2 publication Critical patent/JP6858022B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Studio Devices (AREA)
  • Focusing (AREA)
  • Automatic Focus Adjustment (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a focus adjustment device capable of accurately performing focus adjustment operation on an object intended, and also to provide a control method therefor, a program, and an imaging apparatus.SOLUTION: A CPU 15 of an imaging apparatus 1 adjusts a focus position of a focus lens group 3 by a first motor drive circuit 18 based on a defocus amount calculated by a phase difference AF processing circuit 37. At that time, the defocus amount is estimated from an area including a subject detected by a subject detection circuit 36 and a focal distance of a photographing optical system, and a range in a horizontal direction of an AF area is set in accordance with the estimated defocus amount.SELECTED DRAWING: Figure 4

Description

本発明は、焦点調節装置、その制御方法およびプログラム、並びに撮像装置、詳しくは、自動焦点調節動作を行う焦点調節装置、その制御方法およびプログラム、並びに撮像装置に関するものである。   The present invention relates to a focus adjustment apparatus, a control method and program thereof, and an imaging apparatus, and more particularly to a focus adjustment apparatus that performs an automatic focus adjustment operation, a control method and program thereof, and an imaging apparatus.

従来より、自動焦点調節動作(AF)として、撮像光学系の異なる瞳位置を通過した光束により生成される複数の領域の画像信号を使用して焦点調節を行う自動焦点調節装置が存在する。   2. Description of the Related Art Conventionally, as an automatic focus adjustment operation (AF), there is an automatic focus adjustment device that performs focus adjustment using image signals of a plurality of regions generated by light beams that have passed through different pupil positions of an imaging optical system.

例えば、特許文献1に記載の装置においては、撮像素子により撮像が行われる毎に、複数の位相差検出用画素により撮像して得られる画像信号を用いてデフォーカス量を演算する。   For example, in the apparatus described in Patent Document 1, every time imaging is performed by an imaging device, a defocus amount is calculated using image signals obtained by imaging with a plurality of phase difference detection pixels.

具体的には、連続して行われる撮像により得られたデフォーカス量のそれぞれについて、その直後に行われた撮像により得られたデフォーカス量との差分を求め、求められた複数の差分の分散を算出する。算出された分散が閾値より小さい場合、フォーカスレンズを合焦位置に移動させ、算出された分散が前記閾値以上の場合、フォーカスレンズの位置を不変とする。   Specifically, for each defocus amount obtained by continuous imaging, the difference from the defocus amount obtained by imaging performed immediately after that is obtained, and the variance of the obtained plural differences is obtained. Is calculated. When the calculated dispersion is smaller than the threshold, the focus lens is moved to the in-focus position, and when the calculated dispersion is greater than or equal to the threshold, the position of the focus lens is not changed.

特許文献2に記載の装置においては、デフォーカス量を検出するために撮像画面上に中央測距領域を含む複数の測距領域を設定する。各測距領域から検出されたデフォーカス量に従って中央測距領域での遠近競合の有無を判定する。中央測距領域に遠近競合が有る場合は、各測距領域から検出されたデフォーカス量に従って焦点調節に用いる領域を、中央測距領域から他の測距領域に変更する。   In the apparatus described in Patent Document 2, a plurality of distance measurement areas including a central distance measurement area are set on an imaging screen in order to detect a defocus amount. In accordance with the defocus amount detected from each ranging area, it is determined whether or not there is a perspective conflict in the central ranging area. When there is a perspective conflict in the central ranging area, the area used for focus adjustment is changed from the central ranging area to another ranging area according to the defocus amount detected from each ranging area.

特許第5789725号公報Japanese Patent No. 5789725 特開2015−232604号公報Japanese Patent Laying-Open No. 2015-232604

しかしながら、特許文献1においては、小さい顔など主被写体の占める領域が狭い場合には、連続して行われる撮像により得られた複数のデフォーカス量の差分の分散が閾値より小さくならない。このため、フォーカスレンズの位置を不変となり、フォーカスレンズを合焦位置へ制御することができない場合がある。   However, in Patent Document 1, when the area occupied by the main subject is small, such as a small face, the variance of a plurality of defocus amount differences obtained by consecutive imaging is not smaller than a threshold value. For this reason, the position of the focus lens remains unchanged, and the focus lens may not be controlled to the in-focus position.

また上述特許文献2においては、遠近競合が有る場合は、焦点調節に用いる領域を中央測距領域から他の測距領域に変更するため、意図しない被写体に対して焦点調節動作が行われる場合がある。   In Patent Document 2, when there is a perspective conflict, the focus adjustment operation may be performed on an unintended subject because the region used for focus adjustment is changed from the central distance measurement region to another distance measurement region. is there.

本発明は、意図する被写体に正確に焦点調節動作を行うことができる焦点調節装置、その制御方法およびプログラム、並びに撮像装置を提供することである。   An object of the present invention is to provide a focus adjustment device capable of accurately performing a focus adjustment operation on an intended subject, a control method and program thereof, and an imaging device.

本発明の焦点調節装置は、位相差AF方式によりデフォーカス量を検出する焦点検出手段と、前記デフォーカス量に基づき撮影光学系を駆動させて焦点位置を調節する焦点調節手段と、被写体を含む領域を検出する第1の検出手段と、前記検出された領域及び前記撮影光学系の焦点距離に基づいてデフォーカス量を推定する推定手段と、前記焦点検出手段におけるAF領域の水平方向の範囲を、前記推定されたデフォーカス量に応じて設定する設定手段とを備えることを特徴とする。   The focus adjustment apparatus of the present invention includes a focus detection unit that detects a defocus amount by a phase difference AF method, a focus adjustment unit that drives a photographing optical system based on the defocus amount to adjust a focus position, and a subject. First detection means for detecting an area, estimation means for estimating a defocus amount based on the detected area and a focal length of the photographing optical system, and a horizontal range of the AF area in the focus detection means And setting means for setting according to the estimated defocus amount.

本発明によれば、意図する被写体に正確に焦点調節動作を行うことができる。   According to the present invention, it is possible to accurately perform a focus adjustment operation on an intended subject.

本発明の実施形態に係る撮像装置のハードウェア構成を示すブロック図である。It is a block diagram which shows the hardware constitutions of the imaging device which concerns on embodiment of this invention. 図1のセンサに含まれる撮像素子を構成する各画素の構造を示す模式図である。It is a schematic diagram which shows the structure of each pixel which comprises the image pick-up element contained in the sensor of FIG. 本発明の実施例1に係る撮像処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of the imaging process which concerns on Example 1 of this invention. 図3のステップS4のAF領域設定処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of AF area | region setting process of step S4 of FIG. 図3のステップS7の位相差AF処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of the phase difference AF process of step S7 of FIG. 本発明の実施例2に係る撮像処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of the imaging process which concerns on Example 2 of this invention.

図1は、本発明の実施形態に係る撮像装置のハードウェア構成を示すブロック図である。尚、以下のハードウェア構成のうち、後述する図3〜図5の処理を実施する構成により本発明の焦点調節装置が構成される。   FIG. 1 is a block diagram showing a hardware configuration of an imaging apparatus according to an embodiment of the present invention. Of the following hardware configurations, the focus adjustment apparatus of the present invention is configured by a configuration that performs the processes of FIGS.

1は撮像装置、2はズームレンズ群、3はフォーカスレンズ群、4はズームレンズ群2やフォーカスレンズ群3等からなる撮影光学系を透過する光束の量を制御する光量調節手段であり露出手段である絞りである。31はズームレンズ群2、フォーカスレンズ群3、及び絞り4等を保持する撮影レンズ鏡筒、5は撮影光学系を透過した被写体像が結像しこれを光電変換する撮像素子(以下「センサ」という。)である。   Reference numeral 1 denotes an image pickup apparatus, 2 denotes a zoom lens group, 3 denotes a focus lens group, 4 denotes a light amount adjusting means for controlling the amount of light transmitted through a photographing optical system including the zoom lens group 2 and the focus lens group 3, and exposure means This is the aperture. Reference numeral 31 denotes a photographic lens barrel that holds the zoom lens group 2, the focus lens group 3, the diaphragm 4, and the like. It is said.)

6はこのセンサ5によって光電変換された電気信号を受けて各種の画像処理を施すことにより所定の画像信号を生成する撮像回路、7はこの撮像回路6により生成されたアナログ画像信号をデジタル画像信号に変化するA/D変換回路である。8はこのA/D変換回路7の出力を受けてこの画像信号を一時的に記憶するバッファメモリ等のメモリ(VRAM)である。9はこのVRAM8に記憶された画像信号を読み出してこれをアナログ信号に変換するとともに再生出力に適する形態の画像信号に変換するD/A変換回路である。10はこの画像信号を表示する液晶表示装置(LCD)等の画像表示装置(以下「LCD」という。)、12は半導体メモリ等からなる画像データを記憶する記憶用メモリである。   Reference numeral 6 denotes an image pickup circuit that receives an electric signal photoelectrically converted by the sensor 5 and performs various image processing to generate a predetermined image signal. Reference numeral 7 denotes an analog image signal generated by the image pickup circuit 6 as a digital image signal. This is an A / D conversion circuit that changes to. Reference numeral 8 denotes a memory (VRAM) such as a buffer memory that receives the output of the A / D conversion circuit 7 and temporarily stores the image signal. Reference numeral 9 denotes a D / A conversion circuit which reads out an image signal stored in the VRAM 8 and converts it into an analog signal and converts it into an image signal in a form suitable for reproduction output. Reference numeral 10 denotes an image display device (hereinafter referred to as “LCD”) such as a liquid crystal display device (LCD) for displaying the image signal, and reference numeral 12 denotes a memory for storing image data such as a semiconductor memory.

11は、圧縮回路及び伸張回路からなる圧縮/伸長回路である。具体的には、圧縮/伸長回路11は、VRAM8に一時記憶された画像信号を読み出して記憶用メモリ12に対する記憶に適した形態にするために画像データの圧縮処理や符号化処理を施す圧縮回路として機能する。また、圧縮/伸長回路11は、記憶用メモリ12に記憶された画像データを再生表示等をするのに最適な形態とするための復号化処理や伸長処理等を施す伸長回路としても機能する。   A compression / decompression circuit 11 includes a compression circuit and a decompression circuit. Specifically, the compression / decompression circuit 11 reads the image signal temporarily stored in the VRAM 8 and performs a compression process or an encoding process on the image data in order to make it suitable for storage in the storage memory 12. Function as. The compression / decompression circuit 11 also functions as a decompression circuit that performs a decoding process, a decompression process, or the like for making the image data stored in the storage memory 12 an optimum form for reproducing and displaying.

13はA/D変換回路7からの出力を受けて自動露出(AE)処理を行うAE処理回路、14はA/D変換回路7からの出力を受けてAF評価値生成する自動焦点調節(AF)処理を行うスキャンAF処理回路である。15は撮像装置1の制御を行う演算用のメモリを内蔵したCPU、16は所定のタイミング信号を発生するタイミングジェネレータ(以下TG)である。   Reference numeral 13 denotes an AE processing circuit that receives an output from the A / D conversion circuit 7 and performs automatic exposure (AE) processing. Reference numeral 14 denotes an automatic focus adjustment (AF that receives an output from the A / D conversion circuit 7 and generates an AF evaluation value) This is a scan AF processing circuit that performs processing. Reference numeral 15 denotes a CPU incorporating a calculation memory for controlling the image pickup apparatus 1, and reference numeral 16 denotes a timing generator (hereinafter referred to as TG) that generates a predetermined timing signal.

17はセンサドライバ、21は絞り4を駆動する絞り駆動モータ、18は絞り駆動モータ21を駆動制御する第一モータ駆動回路である。22はフォーカスレンズ群3を駆動するフォーカス駆動モータ、19はフォーカス駆動モータ22を駆動制御する第二モータ駆動回路である(焦点調節手段)。23はズームレンズ群2を駆動するズーム駆動モータ、20はズーム駆動モータ23を駆動制御する第三モータ駆動回路である。   Reference numeral 17 denotes a sensor driver, 21 denotes a diaphragm drive motor that drives the diaphragm 4, and 18 denotes a first motor drive circuit that drives and controls the diaphragm drive motor 21. Reference numeral 22 denotes a focus drive motor that drives the focus lens group 3, and 19 denotes a second motor drive circuit that drives and controls the focus drive motor 22 (focus adjustment means). Reference numeral 23 denotes a zoom drive motor that drives the zoom lens group 2, and reference numeral 20 denotes a third motor drive circuit that drives and controls the zoom drive motor 23.

24は各種のスイッチ群からなる操作スイッチ、25は各種制御等を行うプログラムや各種動作を行わせるために使用するデータ等が予め記憶されている電気的に書き換え可能な読み出し専用メモリであるEEPROMである。26は電池、28はストロボ発光部、27はストロボ発光部28の閃光発光を制御するスイッチング回路、29は警告表示などを行うLEDなどの表示素子(以下LED)である。30は音声によるガイダンスや警告などを行うためのスピーカー、33はAF評価値を取得する際に被写体の全部又は一部を照明する照明手段であるLEDなどの光源で構成されるAF補助光である。32はAF補助光33を駆動するためのAF補助光駆動回路、35は手振れなどを検出する振れ検出センサ、34は振れ検出センサ35の信号を処理する振れ検出回路である(第2の検出手段)。36はA/D変換回路7からの出力を受けて画面上での被写***置やその大きさなどを検出する被写体検出回路(第1の検出手段,第4の検出手段)である。37は位相差AF用の画像信号の生成及び基準画像(A像)用の信号と参照画像(B像)用の信号の相関演算等を行う位相差AF処理回路である。   Reference numeral 24 denotes an operation switch including various switch groups. Reference numeral 25 denotes an EEPROM which is an electrically rewritable read-only memory in which programs for performing various controls and data used for performing various operations are stored in advance. is there. Reference numeral 26 denotes a battery, 28 denotes a strobe light emitting unit, 27 denotes a switching circuit for controlling flash light emission of the strobe light emitting unit 28, and 29 denotes a display element (hereinafter referred to as an LED) such as an LED for displaying a warning. 30 is a speaker for performing voice guidance and warnings, and 33 is an AF auxiliary light composed of a light source such as an LED, which is an illuminating means for illuminating all or part of the subject when an AF evaluation value is acquired. . Reference numeral 32 denotes an AF auxiliary light drive circuit for driving the AF auxiliary light 33, 35 denotes a shake detection sensor for detecting camera shake and the like, and 34 denotes a shake detection circuit for processing a signal of the shake detection sensor 35 (second detection means). ). Reference numeral 36 denotes a subject detection circuit (first detection means, fourth detection means) that receives the output from the A / D conversion circuit 7 and detects the position and size of the subject on the screen. Reference numeral 37 denotes a phase difference AF processing circuit that generates an image signal for phase difference AF and performs a correlation calculation between a signal for a reference image (A image) and a signal for a reference image (B image).

なお、画像データ等の記憶媒体である記憶用メモリは、図1において不図示であるが、様々な形態のものが適用される。例えば、フラッシュメモリ等の固定型の半導体メモリや、カード形状やスティック形状からなり装置に対して着脱自在に形成されるカード型フラッシュメモリ等の半導体メモリの他、ハードディスクやフロッピィ−ディスク等の磁気記憶媒体等である。   A storage memory, which is a storage medium for image data and the like, is not shown in FIG. 1, but various forms are applied. For example, in addition to a fixed type semiconductor memory such as a flash memory, a semiconductor memory such as a card type flash memory that has a card shape or a stick shape and is detachable from a device, a magnetic storage such as a hard disk or a floppy disk Media.

また、操作スイッチ24としては、本撮像装置1を起動させ電源供給を行うための主電源スイッチ、撮影動作(記憶動作)等を開始させるレリーズスイッチ、再生動作を開始させる再生スイッチがある。その他にも、操作スイッチ24としては、撮影光学系のズームレンズ群2を移動させズームを行わせるズームスイッチ、光学式ファインダー(OVF)電子ビューファインダー(EVF)切り替えスイッチ等がある。   The operation switch 24 includes a main power switch for starting up the imaging apparatus 1 and supplying power, a release switch for starting a photographing operation (storage operation), and a reproduction switch for starting a reproduction operation. In addition, the operation switch 24 includes a zoom switch that moves the zoom lens group 2 of the photographing optical system to perform zooming, an optical viewfinder (OVF) electronic viewfinder (EVF) changeover switch, and the like.

そしてレリーズスイッチは撮影動作に先立ち行われるAE処理、AF処理等を開始させる指示信号を発生する第一ストローク(以下SW1)と実際の露光動作を開始させる指示信号を発生する第二ストローク(以下SW2)との二段スイッチにより構成される。   The release switch has a first stroke (hereinafter referred to as SW1) for generating an instruction signal for starting AE processing, AF processing and the like performed prior to the photographing operation and a second stroke (hereinafter referred to as SW2) for generating an instruction signal for starting an actual exposure operation. ) And a two-stage switch.

このように構成された本実施例における撮像装置1の動作を以下に説明する。   The operation of the imaging apparatus 1 in the present embodiment configured as described above will be described below.

まず、撮影レンズ鏡筒31を透過した被写体光束は絞り部4によってその光量が調整された後、センサ5の受光面に結像される。この被写体像は、センサ5による光電変換処理により電気的な信号に変換され撮像回路6に出力される。撮像回路6では、入力した信号に対して各種の信号処理が施され、所定の画像信号が生成される。この画像信号はA/D変換回路7に出力されデジタル信号(画像データ)に変換された後、VRAM8に一時的に格納される。VRAM8に格納された画像データはD/A変換回路9へ出力されアナログ信号に変換され表示するのに適した形態の画像信号に変換された後、LCD10に画像として表示される。また、VRAM8に格納された画像データは圧縮/伸長回路11にも出力される。この圧縮/伸長回路11における圧縮回路によって圧縮処理が行われた後、記憶に適した形態の画像データに変換され、記憶用メモリ12に記憶される。   First, the light flux of the subject transmitted through the taking lens barrel 31 is adjusted on the light amount by the diaphragm 4 and then imaged on the light receiving surface of the sensor 5. This subject image is converted into an electrical signal by photoelectric conversion processing by the sensor 5 and output to the imaging circuit 6. In the imaging circuit 6, various signal processing is performed on the input signal, and a predetermined image signal is generated. The image signal is output to the A / D conversion circuit 7 and converted into a digital signal (image data), and then temporarily stored in the VRAM 8. The image data stored in the VRAM 8 is output to the D / A conversion circuit 9, converted into an analog signal, converted into an image signal in a form suitable for display, and then displayed on the LCD 10 as an image. The image data stored in the VRAM 8 is also output to the compression / decompression circuit 11. After compression processing is performed by the compression circuit in the compression / decompression circuit 11, it is converted into image data in a form suitable for storage and stored in the storage memory 12.

また、例えば操作スイッチ24のうち不図示の再生スイッチが操作されオン状態になると、再生動作が開始される。すると記憶用メモリ12に圧縮された形で記憶された画像データは圧縮/伸長回路11に出力され、その伸長回路において復号化処理や伸長処理等が施された後、VRAM8に出力され一時的に記憶される。更に、この画像データはその後D/A変換回路9へ出力されアナログ信号に変換され表示するのに適した形態の画像信号に変換された後、LCD10に画像として表示される。   For example, when a reproduction switch (not shown) of the operation switches 24 is operated and turned on, a reproduction operation is started. Then, the image data stored in a compressed form in the storage memory 12 is output to the compression / expansion circuit 11, subjected to decoding processing, expansion processing, and the like in the expansion circuit, and then output to the VRAM 8 and temporarily. Remembered. Further, the image data is then output to the D / A conversion circuit 9, converted into an analog signal, converted into an image signal in a form suitable for display, and then displayed on the LCD 10 as an image.

他方、A/D変換回路7によってデジタル化された画像データは、上述のVRAM8とは別にAE処理回路13、スキャンAF処理回路14、位相差AF処理回路37及び被写体検出回路36に対しても出力される。まずAE処理回路13においては、入力されたデジタル画像信号を受けて、一画面分の画像データの輝度値に対して累積加算等の演算処理が行われる。これにより、被写体の明るさに応じたAE評価値が算出される。このAE評価値はCPU15に出力される。   On the other hand, the image data digitized by the A / D conversion circuit 7 is output to the AE processing circuit 13, the scan AF processing circuit 14, the phase difference AF processing circuit 37 and the subject detection circuit 36 separately from the VRAM 8 described above. Is done. First, the AE processing circuit 13 receives the input digital image signal and performs arithmetic processing such as cumulative addition on the luminance value of the image data for one screen. Thereby, the AE evaluation value corresponding to the brightness of the subject is calculated. This AE evaluation value is output to the CPU 15.

またスキャンAF処理回路14においては、入力されたデジタル画像信号を受けて、画像データの高周波成分がハイパスフィルター(HPF)等を介して抽出される。更にスキャンAF処理回路14において、その高周波成分に対する累積加算等の演算処理が行われ、高周波成分における輪郭成分量等に対応するAF評価値信号が算出される。   The scan AF processing circuit 14 receives the input digital image signal and extracts a high frequency component of the image data through a high pass filter (HPF) or the like. Further, the scan AF processing circuit 14 performs arithmetic processing such as cumulative addition with respect to the high frequency component, and calculates an AF evaluation value signal corresponding to the contour component amount and the like in the high frequency component.

位相差AF処理回路37においては、まず、センサ5から読み出された信号から位相差AF方式の演算処理に用いられる基準画像(A像)用の信号と参照画像(B像)用の信号を生成し、その生成された両画像用の信号の像修正を行う。その後、像修正後の両画像用の信号の相関演算を行い、二像の信号が一致する像ずれ量(二像の位相差)を計算する。センサ5は、その撮像面に位相差AFを行う画素を配置している。このため、二次結像光学系で再結像させる場合のように像高による光束の違いにより生じる像の歪みを修正するフィールドレンズや、センサ5へ入射する光束の瞳位置を制限する絞り、不要な光束を遮断するマスクを撮像面とセンサ5の間に配置できない。したがって、位相差AF用の画像信号は画素毎にシェーディング・オフセットが異なり、その補正が必要である。   In the phase difference AF processing circuit 37, first, a signal for a reference image (A image) and a signal for a reference image (B image) used for the calculation processing of the phase difference AF method are obtained from the signal read from the sensor 5. And the image correction of the generated signals for both images is performed. Thereafter, the correlation calculation of the signals for both images after image correction is performed, and an image shift amount (phase difference between the two images) in which the signals of the two images coincide is calculated. The sensor 5 has pixels that perform phase difference AF on its imaging surface. For this reason, a field lens that corrects image distortion caused by a difference in light flux due to image height as in the case of re-imaging with a secondary imaging optical system, a diaphragm that restricts the pupil position of the light flux incident on the sensor 5, A mask that blocks unnecessary light flux cannot be disposed between the imaging surface and the sensor 5. Accordingly, the image signal for phase difference AF has a different shading offset for each pixel and needs to be corrected.

よって位相差AF処理回路37は、基準画像(A像)の信号及び参照画像(B像)用の信号の生成機能、これらの画像用の信号の像修正機能及び相関演算を行いデフォーカス量を求める機能を担っている。   Therefore, the phase difference AF processing circuit 37 performs a function for generating a signal for the reference image (A image) and a signal for the reference image (B image), an image correcting function for the signals for these images, and a correlation operation, thereby reducing the defocus amount. It is responsible for the desired function.

そしてCPU15において、位相差AF処理回路37で求められた二像の位相差からデフォーカス量・合焦させるためのフォーカスレンズ群3の駆動量を求めることで位相差AFが行われる。   Then, the CPU 15 performs the phase difference AF by obtaining the defocus amount and the driving amount of the focus lens group 3 for focusing from the phase difference between the two images obtained by the phase difference AF processing circuit 37.

被写体検出回路36においては、入力されたデジタル画像信号を受けて画像上の被写体を検出する。例えば人物が被写体である場合は、目、眉などの顔を特徴付ける部分を画像上で探索し、人物の顔の画像上での位置を求める。更に顔の大きさや傾きなどを、顔を特徴付ける部分の間隔などの位置関係から求める。顔以外の物体の場合は、Deep Learningなど一般公知技術でその物体を画像信号から抽出した後どのような物体なのか認識することで検出が実現できる。また大きさが既知の物体に関しては、その大きさを被写体検出回路36内に記録しておいても良い。   The subject detection circuit 36 receives the input digital image signal and detects a subject on the image. For example, when a person is a subject, a part characterizing a face such as eyes and eyebrows is searched on the image, and the position of the person's face on the image is obtained. Further, the size and inclination of the face are obtained from the positional relationship such as the interval between the parts characterizing the face. In the case of an object other than a face, detection can be realized by recognizing what kind of object it is after extracting the object from the image signal by a generally known technique such as Deep Learning. For an object with a known size, the size may be recorded in the subject detection circuit 36.

一方、TG16からは所定のタイミング信号がCPU15、撮像回路6、センサドライバ17へ出力されており、CPU15はこのタイミング信号に同期させて各種の制御を行う。また撮像回路6は、TG16からのタイミング信号を受け、これに同期させて色信号の分離等の各種画像処理を行う。さらにセンサドライバ17は、TG16のタイミング信号を受けこれに同期してセンサ5を駆動する。   On the other hand, a predetermined timing signal is output from the TG 16 to the CPU 15, the image pickup circuit 6, and the sensor driver 17, and the CPU 15 performs various controls in synchronization with the timing signal. The imaging circuit 6 receives the timing signal from the TG 16 and performs various image processing such as separation of color signals in synchronization with the timing signal. Further, the sensor driver 17 receives the timing signal of the TG 16 and drives the sensor 5 in synchronization therewith.

またCPU15は、第一モータ駆動回路18、第二モータ駆動回路19、第三モータ駆動回路20をそれぞれ制御する。これにより、絞り駆動モータ21、フォーカス駆動モータ22、ズーム駆動モータ23を介して、絞り4、フォーカスレンズ群3、ズームレンズ群2が駆動制御される。すなわちCPU15はAE処理回路13において算出されたAE評価値等に基づき適正な露光量になる露光時間・絞り値を求め、第一モータ駆動回路18を制御して絞り駆動モータ21を駆動し、絞り4の絞り量を適正になるように調整する制御を行う。またCPU15はスキャンAF処理回路14・位相差AF処理回路37の処理結果に基づき第二モータ駆動回路19を制御してフォーカス駆動モータ22を駆動し、フォーカスレンズ群3を合焦位置に移動させるAF制御を行う。また操作スイッチ24のうち不図示のズームスイッチが操作された場合は、これを受けてCPU15は、第三モータ駆動回路20を制御してズーム駆動モータ23を駆動制御する。これによりズームレンズ群2が移動し、撮影光学系の変倍動作(ズーム動作)が行われる。   The CPU 15 controls the first motor drive circuit 18, the second motor drive circuit 19, and the third motor drive circuit 20, respectively. Thereby, the diaphragm 4, the focus lens group 3, and the zoom lens group 2 are driven and controlled via the diaphragm drive motor 21, the focus drive motor 22, and the zoom drive motor 23. That is, the CPU 15 obtains an exposure time / aperture value at which an appropriate exposure amount is obtained based on the AE evaluation value calculated by the AE processing circuit 13, etc., controls the first motor drive circuit 18 to drive the aperture drive motor 21, and Control is performed to adjust the aperture amount of 4 so as to be appropriate. The CPU 15 also controls the second motor drive circuit 19 based on the processing results of the scan AF processing circuit 14 and the phase difference AF processing circuit 37 to drive the focus drive motor 22 to move the focus lens group 3 to the in-focus position. Take control. When a zoom switch (not shown) of the operation switches 24 is operated, the CPU 15 controls the third motor drive circuit 20 and controls the zoom drive motor 23 in response to the operation. As a result, the zoom lens group 2 moves, and a zooming operation (zooming operation) of the photographing optical system is performed.

次に図1のセンサ5に含まれる撮像素子を構成する各画素の構成を図2に示す。   Next, FIG. 2 shows the configuration of each pixel constituting the image sensor included in the sensor 5 of FIG.

二次元的に配置される画素には、通常の撮像用画素と位相差AF用の画素としての機能を持たせるために、図2に示すような構造をしている。すなわち、ひとつのマイクロレンズに対して長方形の二つのフォトダイオードが配置され、一方のフォトダイオードが基準画像用の画素(以下「基準画素」という。)の信号出力用、他方が参照画像用の画素(以下「参照画素」という。)の信号出力用となっている。このように、二つのフォトダイオードは、撮影光学系の異なる瞳領域を通過した光束を光電変換して、一対の焦点検出用信号を出力することが可能である。   The two-dimensionally arranged pixels have a structure as shown in FIG. 2 in order to have functions as normal imaging pixels and phase difference AF pixels. That is, two rectangular photodiodes are arranged for one microlens, one photodiode is used for signal output of a reference image pixel (hereinafter referred to as “reference pixel”), and the other is a reference image pixel. (Hereinafter referred to as “reference pixel”) for signal output. As described above, the two photodiodes can photoelectrically convert a light beam that has passed through different pupil regions of the photographing optical system and output a pair of focus detection signals.

位相差AFを行うための画素行は間欠的に配置されており、この行のみ、一対のフォトダイオードの出力を加算して読み出すだけでなく、基準画素の信号出力用のフォトダイオードから信号を独立で読み出すことが可能である。   The pixel rows for performing the phase difference AF are intermittently arranged. In this row alone, not only the outputs of the pair of photodiodes are added and read, but also the signals are independent from the photodiodes for signal output of the reference pixels. Can be read.

その他の画素行はこの一対のフォトダイオードの出力を加算して読み出す。   The other pixel rows are read by adding the outputs of the pair of photodiodes.

またセンサ5は、各フォトダイオードから読みだされた信号を増幅することができる。   The sensor 5 can amplify the signal read from each photodiode.

実際には先頭の行から行ごとに読み出しを開始し、位相差AFを行うための行においては、一対のフォトダイオードの出力を加算した信号とその片方のみからの出力の信号(すなわち、基準画素の信号)が読み出される。また、その他の行においては一対のフォトダイオードの出力を加算した信号が読み出される。   Actually, reading is started for each row from the first row, and in a row for performing phase difference AF, a signal obtained by adding the outputs of a pair of photodiodes and an output signal from only one of them (that is, a reference pixel) Signal) is read out. In other rows, a signal obtained by adding the outputs of the pair of photodiodes is read out.

位相差演算を行う際には一対のフォトダイオードの出力を加算した信号と基準画素の信号からその差分をとることで参照画素の信号を生成する。この処理も位相差AF処理回路37で行われる。   When performing the phase difference calculation, the reference pixel signal is generated by taking the difference between the signal obtained by adding the outputs of the pair of photodiodes and the reference pixel signal. This processing is also performed by the phase difference AF processing circuit 37.

そしてこの一対のフォトダイオードの出力を加算した信号はそのまま動画記録や、LCD10への表示に用いられる。   A signal obtained by adding the outputs of the pair of photodiodes is directly used for moving image recording or display on the LCD 10.

次いで、撮像装置1による撮像処理を図3に示すフローチャートを用いて説明する。   Next, imaging processing by the imaging apparatus 1 will be described using the flowchart shown in FIG.

図3は、本発明の実施例1に係る撮像処理の手順を示すフローチャートである。本処理では、被写体が人物であり被写体検出回路36で人物の顔が検出する場合の例を説明する。   FIG. 3 is a flowchart illustrating the procedure of the imaging process according to the first embodiment of the present invention. In this processing, an example in which the subject is a person and the face of the person is detected by the subject detection circuit 36 will be described.

撮像装置1の主電源スイッチがオン状態であり、かつ撮像装置1の動作モードが撮影(録画)モードにあるときに、センサ5等への電源を供給やセンサ5の駆動モードの設定等が行われ、以下の撮像処理を開始する。   When the main power switch of the image pickup apparatus 1 is in the on state and the operation mode of the image pickup apparatus 1 is in the shooting (recording) mode, power is supplied to the sensor 5 and the drive mode of the sensor 5 is set. The following imaging process is started.

まずステップS1においてCPU15は、AE処理を行って、露光条件を設定する。この処理はAE処理回路13において算出された被写体の明るさに応じたAE評価値を用いて、センサ5の電荷蓄積時間や絞り5の絞り値等を決定する処理である。ここではLCD10への表示及び被写体検出回路36における顔検出に適した値になるように露光条件を決定していく。LCD10への表示を見て撮影者はフレーミング等を行い、また決定された露光条件でA/D変換回路7により生成されたデジタル画像信号に基づき被写体検出回路36は顔検出を行う。したがって、LCD10への表示や顔検出を行うのに必要なピント(大ボケにはならない)を考慮して、あまり深度の浅い絞りにならないように、また像がずれない電荷蓄積時間になる様に、ステップS1では画像の増幅度も同時に設定される。   First, in step S1, the CPU 15 performs AE processing to set exposure conditions. This process is a process for determining the charge accumulation time of the sensor 5, the aperture value of the aperture 5, etc., using the AE evaluation value corresponding to the brightness of the subject calculated in the AE processing circuit 13. Here, the exposure condition is determined so as to be a value suitable for display on the LCD 10 and face detection in the subject detection circuit 36. The photographer performs framing and the like while viewing the display on the LCD 10, and the subject detection circuit 36 performs face detection based on the digital image signal generated by the A / D conversion circuit 7 under the determined exposure conditions. Therefore, in consideration of the focus necessary for performing display on the LCD 10 and face detection (not to be out of focus), the aperture is not so shallow that the charge accumulation time is such that the image does not shift. In step S1, the amplification degree of the image is also set at the same time.

次いでステップS2において顔検出処理が行われる。具体的には、被写体検出回路36において、人物の顔の画像上での位置と顔の大きさ(撮像画面内の顔領域)が求められる。   Next, face detection processing is performed in step S2. Specifically, the subject detection circuit 36 obtains the position of the person's face on the image and the size of the face (face area in the imaging screen).

その後ステップS3において撮像画面内の焦点検出を行うための領域(以下「AF領域」という。)の初期設定を行う。すなわち、ステップS2において求められた顔領域をAF領域の初期設定とする。その後、その初期設定された領域内の画像信号を用いて合焦状態に応じたコントラストを表すAF評価値をスキャンAF処理回路14で、位相差AFに用いる信号のPB値(信号の最大値と最小値の比)を位相差AF処理回路37で求める。   Thereafter, in step S3, initial setting of an area for focus detection in the imaging screen (hereinafter referred to as “AF area”) is performed. That is, the face area obtained in step S2 is set as the initial setting of the AF area. Thereafter, an AF evaluation value representing the contrast corresponding to the in-focus state is used by the scan AF processing circuit 14 using the image signal in the initially set area, and the PB value (the maximum value of the signal and the signal value) used for the phase difference AF is obtained. The phase difference AF processing circuit 37 obtains the ratio of the minimum values.

そしてステップS4において、AF領域設定処理を実行する。以下図4において具体的に説明するように、この処理では、AF評価値、位相差AFに用いる信号のPB値(信号の最大値と最小値の比)、顔検出結果を用いて、実際に撮像処理を行うAF領域を設定する。   In step S4, AF area setting processing is executed. As will be described in detail below with reference to FIG. 4, in this process, the AF evaluation value, the PB value of the signal used for the phase difference AF (the ratio between the maximum value and the minimum value of the signal), and the face detection result are actually used. An AF area for performing imaging processing is set.

図4は、図3のステップS4のAF領域設定処理の手順を示すフローチャートである。尚、本処理ではステップS401〜S405の処理により、まず、水平方向のAF領域の範囲をデフォーカス量検出が可能な範囲となるよう決定する。しかし、後述のステップS406以降の処理で行われる、垂直方向のAF領域の範囲の決定を先に行うようにしてもよい。   FIG. 4 is a flowchart showing the procedure of the AF area setting process in step S4 of FIG. In this process, first, it is determined by the processes in steps S401 to S405 that the range of the horizontal AF area is a range in which the defocus amount can be detected. However, the determination of the range of the AF area in the vertical direction, which is performed in the processing after step S406 described later, may be performed first.

まずステップS401にて、ステップS2で行われた顔検出の結果と現在の撮影レンズ鏡筒31の焦点距離から得られる概ねの被写体距離に基づき、概ねのデフォーカス量を推定する(推定手段)。次いでこの推定された概ねのデフォーカス量をK値で割ることで、後述するステップS402で水平方向の所定値を算出するために必要な画素ずらし量を求める。なおK値とは相関演算により求められた基準画像(A像)の信号と参照画像(B像)の信号との像ずれ量(二像の位相差)をデフォーカス量に変換する係数である。   First, in step S401, an approximate defocus amount is estimated based on the result of the face detection performed in step S2 and the approximate subject distance obtained from the current focal length of the taking lens barrel 31 (estimating means). Next, by dividing the estimated approximate defocus amount by the K value, a pixel shift amount necessary for calculating a predetermined value in the horizontal direction is obtained in step S402 described later. The K value is a coefficient for converting the image shift amount (phase difference between two images) between the signal of the reference image (A image) and the signal of the reference image (B image) obtained by the correlation calculation into a defocus amount. .

その後ステップS402にて基準画像(A像)の信号にステップS401で求めた画素ずらし量を加え、AF領域の水平方向の範囲の初期値を表す水平所定値を求める。   Thereafter, in step S402, the pixel shift amount obtained in step S401 is added to the reference image (A image) signal to obtain a predetermined horizontal value representing the initial value of the horizontal range of the AF area.

ステップS403にて、ステップS2で検出された顔の水平方向の大きさがステップS402で求めた水平所定値より大きいか判別する。この判別の結果、水平所定値より大きい場合はステップS404に進み、顔検出の結果から求められる顔の水平方向の範囲を水平方向のAF領域の範囲とする。一方、水平所定値以下の場合はステップS405にて、水平所定値を水平方向のAF領域の範囲とする(設定手段)。   In step S403, it is determined whether the horizontal size of the face detected in step S2 is larger than the predetermined horizontal value obtained in step S402. If the result of this determination is that it is greater than the predetermined horizontal value, the process proceeds to step S404, and the horizontal range of the face obtained from the face detection result is set as the horizontal AF area range. On the other hand, if it is equal to or smaller than the horizontal predetermined value, in step S405, the horizontal predetermined value is set as the range of the AF area in the horizontal direction (setting means).

次いで垂直方向のAF領域の範囲を求める。具体的には、位相差AF処理回路37において生成される位相差AF用の画像信号のS/N比を考慮し、位相差AFの精度を確保できる範囲をAF領域の垂直方向の範囲とする。   Next, the range of the vertical AF area is obtained. Specifically, in consideration of the S / N ratio of the image signal for phase difference AF generated in the phase difference AF processing circuit 37, the range in which the accuracy of the phase difference AF can be secured is set as the range in the vertical direction of the AF area. .

まずステップS406にて垂直所定値1を求める。ここで、垂直所定値1とは、AF領域の垂直方向の範囲をこの値に設定すると、センサ5において間欠的に配置され位相差AFを行うための画素行が予め設定された所定行以上となるような値を指す。位相差AFを行うための画素行がこの所定行以上となれば位相差AFの精度を確保することが可能となる。   First, in step S406, a predetermined vertical value 1 is obtained. Here, the vertical predetermined value 1 means that when the vertical range of the AF area is set to this value, the pixel rows intermittently arranged in the sensor 5 for performing phase difference AF are equal to or more than a predetermined predetermined row. Points to such a value. If the number of pixel rows for performing the phase difference AF is equal to or greater than the predetermined row, the accuracy of the phase difference AF can be ensured.

次いでステップS407において垂直所定値2を求める。ここで、AF領域内の信号のコントラスト(PB値)が高いなどその信頼性が高い場合は、ステップS406で説明した予め設定された所定行より少ない画素行から画像信号のみで位相差AFの精度を確保することが可能となる。そこで、ステップS2において求められたAF評価値と位相差AFに用いる信号の信頼性に基づき、以下後述する方法で垂直所定値1より小さい値である垂直所定値2を求める。   Next, in step S407, a predetermined vertical value 2 is obtained. Here, when the reliability of the signal in the AF area is high, such as a high contrast (PB value), the accuracy of the phase difference AF using only the image signal from the pixel rows smaller than the predetermined row set in step S406. Can be secured. Therefore, based on the AF evaluation value obtained in step S2 and the reliability of the signal used for the phase difference AF, a predetermined vertical value 2 that is smaller than the predetermined vertical value 1 is obtained by a method described later.

本実施例においては、垂直所定値2は、PB値・AF評価値やそれぞれの標準偏差値、及び垂直所定値1を用いて計算される。より具体的には、PB値・AF評価値やそれぞれの標準偏差値から、垂直所定値1との比率や差分を定めることで垂直所定値2は求められる。   In the present embodiment, the vertical predetermined value 2 is calculated using the PB value / AF evaluation value, each standard deviation value, and the vertical predetermined value 1. More specifically, the vertical predetermined value 2 is obtained by determining the ratio and difference from the vertical predetermined value 1 from the PB value / AF evaluation value and the respective standard deviation values.

例えば以下の式によって垂直所定値2は求められる。   For example, the vertical predetermined value 2 is obtained by the following equation.

垂直所定値2=(垂直所定値1×位相差AF信頼性の標準偏差値×AF評価値の信頼性の標準偏差値)/(位相差AF信頼性×AF評価値)
但し、上記式により算出された垂直所定値2が垂直所定値1の半分(1/2)の値未満となる場合は、垂直所定値2の値を垂直所定値1の半分(1/2)の値とする。
Vertical predetermined value 2 = (vertical predetermined value 1 × standard deviation value of phase difference AF reliability × standard deviation value of reliability of AF evaluation value) / (phase difference AF reliability × AF evaluation value)
However, when the vertical predetermined value 2 calculated by the above formula is less than half (1/2) of the vertical predetermined value 1, the value of the vertical predetermined value 2 is reduced to half of the vertical predetermined value 1 (1/2). The value of

また、上記式の位相差AF信頼性とは、位相差AFに用いる画像信号のPB値(信号の最大値と最小値の比)であり、AF評価値はスキャンAF処理回路14で算出される。PB値は位相差AFに使用する基準画像と参照画像の像修正前の信号、及び像修正後の信号の4つの信号から求めた比の平均値、もしくは比の最小値を用いる。また、相関演算を行う際にローパスフィルター処理を行うのであれば、基準画像と参照画像について像修正及びローパス処理をともに行った後の2つの信号をさらに追加した6つの信号から求めた比の平均値、もしくは比の最小値を用いる。   The phase difference AF reliability in the above equation is the PB value (ratio between the maximum value and the minimum value of the signal) of the image signal used for the phase difference AF, and the AF evaluation value is calculated by the scan AF processing circuit 14. . As the PB value, the average value of the ratio obtained from the four signals of the base image used for the phase difference AF and the signal before image correction of the reference image and the signal after image correction, or the minimum value of the ratio is used. In addition, if low-pass filter processing is performed when performing correlation calculation, an average of ratios obtained from six signals obtained by further adding two signals after performing both image correction and low-pass processing on the standard image and the reference image Use the minimum value or ratio.

本実施例において、位相差AF信頼性の標準偏差値は、反射率32%のグレーの地に反射率90%の二本の縦線を配した二本バーチャートに合焦した際の値である。また、AF評価値信頼性の標準偏差値は、左右に反射率32%のグレーの地と反射率90%の地を配したエッジチャートに合焦した際の値である。   In this embodiment, the standard deviation value of the phase difference AF reliability is a value obtained when focusing on a two-bar chart in which two vertical lines having a reflectance of 90% are arranged on a gray ground having a reflectance of 32%. is there. The standard deviation value of the AF evaluation value reliability is a value when focusing on an edge chart in which a gray ground with a reflectance of 32% and a ground with a reflectance of 90% are arranged on the left and right.

次に、ステップS408において、検出された顔の垂直方向大きさがステップS407で求めた垂直所定値2より大きいか判別する。この判別の結果、垂直所定値2より大きい場合はステップS410へ進み、顔検出の結果から求められる顔の垂直方向の範囲を垂直方向のAF領域の範囲とする。一方、垂直所定値2以下の場合はステップS409において、以下の方法で求められる信頼性指標の値が、1以上か否かを判別する。   Next, in step S408, it is determined whether the detected vertical size of the face is larger than the predetermined vertical value 2 obtained in step S407. If it is determined that the vertical predetermined value is greater than 2, the process proceeds to step S410, and the vertical range of the face obtained from the face detection result is set as the vertical AF area range. On the other hand, if the vertical predetermined value is 2 or less, it is determined in step S409 whether or not the reliability index value obtained by the following method is 1 or more.

信頼性指標は、PB値・AF評価値やそれぞれの標準偏差値を用いて計算される。具体的には、PB値・AF評価値やそれぞれの標準偏差値の比率や差分を求めることで例えば以下のような式で信頼性指標を定めることが出来る。   The reliability index is calculated using the PB value / AF evaluation value and each standard deviation value. Specifically, the reliability index can be determined by, for example, the following formula by obtaining the PB value / AF evaluation value and the ratio or difference between the standard deviation values.

信頼性指標=(位相差AF信頼性×AF評価値信頼性)/(位相差AF信頼性の標準偏差値×AF評価値信頼性の標準偏差値)
この式においても、位相差AF信頼性はPB値を指す。
Reliability index = (Phase difference AF reliability × AF evaluation value reliability) / (Standard deviation value of phase difference AF reliability × Standard deviation value of AF evaluation value reliability)
Also in this equation, the phase difference AF reliability indicates the PB value.

この信頼性指標の値が1以上の場合は、ステップS410に進み、垂直所定値2を垂直方向のAF領域の範囲とし、図4の処理を終了する。一方、この信頼性指標の値が1未満の場合は、ステップS411に進み、垂直所定値1を垂直方向のAF領域の範囲とし、図4の処理を終了する。   If the value of the reliability index is 1 or more, the process proceeds to step S410, the vertical predetermined value 2 is set as the range of the AF area in the vertical direction, and the process of FIG. On the other hand, if the value of the reliability index is less than 1, the process proceeds to step S411, where the vertical predetermined value 1 is set as the range of the AF area in the vertical direction, and the process of FIG.

このように、垂直方向のAF領域の範囲の設定は、図4のステップS406〜S411の処理(第1の判定手段)に基づき行われる。尚、垂直方向のAF領域の範囲の設定は、上記処理に限定されるわけではなく、例えば、信頼性指標の値に応じて設定される垂直所定値1と垂直所定値2の間の値を垂直方向のAF領域の範囲としても良い。   As described above, the setting of the range of the AF area in the vertical direction is performed based on the processing (first determination unit) in steps S406 to S411 in FIG. The setting of the range of the AF area in the vertical direction is not limited to the above processing. For example, a value between the vertical predetermined value 1 and the vertical predetermined value 2 set according to the value of the reliability index is set. The range of the AF area in the vertical direction may be used.

図4のAF領域設定処理が終了すると、図3に戻り、ステップS5にて、撮影レンズ鏡筒31を透過し、センサ5の撮影画素に結像した像(被写体像)、及びステップS4で設定されたAF領域をLCD10に画像として表示する。具体的には、センサ5上に結像した被写体像は、センサ5による光電変換処理され電気的な信号に変換された後、撮像回路6に出力される。撮像回路6は、センサ5から入力された信号に対して各種の信号処理を施し、所定の画像信号を生成した後、A/D変換回路7に出力する。A/D変換回路7は、その撮像回路6から出力された画像信号をデジタル信号(画像データ)に変換し、VRAM8に一時的に格納する。またVRAM8にはステップS4で設定されたAF領域を示すための矩形の枠を描画する為の信号(AF領域を示すデータ)がCPU15から出力される。これによりVRAM8上で被写体像を示す画像データにAF領域を示すデータが重畳される。その後、VRAM8からこのAF領域を示すデータが重畳された画像データがD/A変換回路9へ出力され、表示するのに適した形態のアナログ画像信号に変換され、LCD10に画像として出力表示される。   When the AF area setting process in FIG. 4 is completed, the process returns to FIG. 3, and in step S5, the image (subject image) that has passed through the photographic lens barrel 31 and formed on the photographic pixel of the sensor 5 is set in step S4. The performed AF area is displayed on the LCD 10 as an image. Specifically, the subject image formed on the sensor 5 is photoelectrically converted by the sensor 5 and converted into an electrical signal, and then output to the imaging circuit 6. The imaging circuit 6 performs various signal processing on the signal input from the sensor 5, generates a predetermined image signal, and then outputs the image signal to the A / D conversion circuit 7. The A / D conversion circuit 7 converts the image signal output from the imaging circuit 6 into a digital signal (image data) and temporarily stores it in the VRAM 8. Further, the CPU 15 outputs a signal (data indicating the AF area) for drawing a rectangular frame for indicating the AF area set in step S <b> 4 to the VRAM 8. Thereby, the data indicating the AF area is superimposed on the image data indicating the subject image on the VRAM 8. Thereafter, the image data on which the data indicating the AF area is superimposed is output from the VRAM 8 to the D / A conversion circuit 9, converted into an analog image signal in a form suitable for display, and output and displayed as an image on the LCD 10. .

次いでステップS6において、レリーズスイッチの状態を確認する。撮影者によってレリーズスイッチが操作され、SW1(レリーズスイッチの第一ストローク)がオン状態になったことをCPU15が確認すると(ステップS6でYES)、次のステップS7に進み、位相差AF処理を行う。   Next, in step S6, the state of the release switch is confirmed. When the photographer operates the release switch and the CPU 15 confirms that SW1 (the first stroke of the release switch) is turned on (YES in step S6), the process proceeds to the next step S7 to perform the phase difference AF process. .

ステップS7の位相差AF処理の動作を、以下に図5のフローチャートを用いて説明する。   The operation of the phase difference AF process in step S7 will be described below using the flowchart of FIG.

図5は、図3のステップS7の位相差AF処理の手順を示すフローチャートである。   FIG. 5 is a flowchart showing the procedure of the phase difference AF process in step S7 of FIG.

まずステップS501において、A/D変換回路7より出力された位相差AF用の画像信号を位相差AF処理回路37の所定の記録領域に記録する。なおSW1がオン状態である場合に、二回目以降の位相差AF処理に用いられる画像信号は、後述するステップS19で再設定されたAF領域内の画像信号となる。   First, in step S 501, the phase difference AF image signal output from the A / D conversion circuit 7 is recorded in a predetermined recording area of the phase difference AF processing circuit 37. When SW1 is in the ON state, the image signal used for the second and subsequent phase difference AF processing is an image signal in the AF area reset in step S19 described later.

その後、ステップS502において、基準画素と参照画素の信号が加算された状態でセンサ5の一対のフォトダイオードから出力された信号と、その片方のフォトダイオードのみから出力された基準画素の信号とからその差分を取り、参照画素の信号を作成する。そして位相差AF用の画素の並び替えを行い、基準画像と参照画像を生成する。   Thereafter, in step S502, the signal output from the pair of photodiodes of the sensor 5 in a state where the signals of the reference pixel and the reference pixel are added, and the signal of the reference pixel output from only one of the photodiodes. The difference is taken and a reference pixel signal is created. Then, the pixels for phase difference AF are rearranged to generate a standard image and a reference image.

前述のとおり、センサ5ではひとつのマイクロレンズに対して長方形の二つのフォトダイオードが配置されている。一方のフォトダイオードが基準画素の信号出力に用いられ、他方が参照画素の信号出力に用いられる。また、センサ5からの信号の読み出し順序は「基準画素+参照画素」→「基準画素」→「基準画素+参照画素」→「基準画素」→・・・・・・・→「基準画素+参照画素」→「基準画素」となっている。この読出し順序でセンサ5からの信号は位相差AF処理回路37の所定の第1の記録領域にデータとして記録される。   As described above, in the sensor 5, two rectangular photodiodes are arranged for one microlens. One photodiode is used for signal output of the reference pixel, and the other is used for signal output of the reference pixel. In addition, the signal reading order from the sensor 5 is “reference pixel + reference pixel” → “reference pixel” → “reference pixel + reference pixel” → “reference pixel” →... → “reference pixel + reference” Pixel "→" reference pixel ". In this reading order, the signal from the sensor 5 is recorded as data in a predetermined first recording area of the phase difference AF processing circuit 37.

そこで、上記所定の記録領域から基準画素の信号のデータだけを抽出して、抽出した順序に並べ基準画像用の信号のデータとし、位相差AF処理回路37の所定の第2の記録領域に記録する。   Therefore, only reference pixel signal data is extracted from the predetermined recording area, arranged in the extracted order, and used as reference image signal data, and recorded in a predetermined second recording area of the phase difference AF processing circuit 37. To do.

また、上記所定の記録領域から、基準画素の信号と参照画素の信号が加算された状態でセンサ5の一対のフォトダイオードから出力された信号のデータと基準画素の信号のデータを抽出してその差分を求める。この求めた順序に並べて参照画像用の信号のデータとし、位相差AF処理回路37の所定の第3の記録領域に記録する。   Further, the signal data output from the pair of photodiodes of the sensor 5 and the data of the signal of the reference pixel are extracted from the predetermined recording area in a state where the signal of the reference pixel and the signal of the reference pixel are added. Find the difference. The reference image signal data is arranged in the obtained order and recorded in a predetermined third recording area of the phase difference AF processing circuit 37.

次いでステップS503において、位相差AF処理回路37記録された基準画像及び参照画像の両像の修正を行う。   In step S503, both the standard image and the reference image recorded in the phase difference AF processing circuit 37 are corrected.

撮像面に位相差AFを行う画素を配置している。このため、二次結像光学系で再結像させる場合のように像高による光束の違いにより生じる像の歪みを修正するフィールドレンズや、センサ5へ入射する光束の瞳位置を制限する絞り、不要な光束を遮断するマスクを撮像面とセンサ5の間に配置できない。したがって、位相差AF用の画像信号は画素毎にシェーディング・オフセットが異なるためその補正が必要である。   Pixels that perform phase difference AF are arranged on the imaging surface. For this reason, a field lens that corrects image distortion caused by a difference in light flux due to image height as in the case of re-imaging with a secondary imaging optical system, a diaphragm that restricts the pupil position of the light flux incident on the sensor 5, A mask that blocks unnecessary light flux cannot be disposed between the imaging surface and the sensor 5. Therefore, since the image signal for phase difference AF has a different shading offset for each pixel, it needs to be corrected.

このシェーディングは光軸中心からの画素の位置(像高)・撮影レンズの射出瞳位置・絞りによって異なるため、それぞれの要因に関して像修正量を持ち要因に応じて、位相差AF用の画像信号を画素毎に修正する。   Since this shading varies depending on the pixel position (image height) from the optical axis center, the exit pupil position of the taking lens, and the aperture, each image has an image correction amount, and an image signal for phase difference AF is selected according to the factor. Modify every pixel.

またオフセットは位相差AF用の画像信号の増幅率等によって異なるため、それぞれの要因に関して像修正量を持ち要因に応じて、位相差AF用の画像信号を画素毎に修正する。   Further, since the offset varies depending on the amplification factor of the image signal for phase difference AF and the like, an image correction amount is provided for each factor, and the image signal for phase difference AF is corrected for each pixel according to the factor.

像修正方法の詳細に関しては特開2012−252280等で公知なので、説明は割愛する。   The details of the image correction method are well known in Japanese Patent Application Laid-Open No. 2012-252280 and the like, and thus will not be described.

その後ステップS504において相関演算を行う際の下記式(1)のパラメータK,Jの初期値を設定する。   Thereafter, in step S504, initial values of parameters K and J in the following equation (1) for performing correlation calculation are set.

位相差AF処理回路37は、その後ステップS505において、式(1)に従い基準画像と参照画像の相関値を求める。すなわち、N番目の基準画素の信号値aと参照画素の信号値bの相関値の和を求める(N=1〜Jまでの整数)。 Thereafter, in step S505, the phase difference AF processing circuit 37 obtains a correlation value between the standard image and the reference image according to the equation (1). That is, the sum of the correlation values of the N-th signal value b N of the reference pixel and the signal value a N of the reference pixel (an integer of N = 1 to J).

=Σmax(aN+1,bN+K)−Σmax(a,bN+K+1)(式1)
ここで、max(a,b)はa,bのうち大きい方をとるという意味である。
U K = Σmax (a N + 1 , b N + K ) −Σmax (a N , b N + K + 1 ) (Formula 1)
Here, max (a, b) means that the larger of a and b is taken.

またKは相関演算を行う像ずらし量、Jは相関演算を行う画素数であり、ステップS504で初期化されている。   K is an image shift amount for performing correlation calculation, J is the number of pixels for correlation calculation, and is initialized in step S504.

そして、ステップS506において、CPU15は基準画像と参照画像の相関値を位相差AF処理回路37から取得し一時記録する。そして既に一時記録されている他の相関値があれば、その他の相関値と符号が等しいか調べる。   In step S506, the CPU 15 acquires the correlation value between the standard image and the reference image from the phase difference AF processing circuit 37 and temporarily records the correlation value. If there is another correlation value that has already been temporarily recorded, it is checked whether the sign is the same as the other correlation value.

その結果、ステップS506で一時記録された相関値と他の相関値は、符号が反転している場合、ステップS507からステップS508へ進む。同様に、ステップS506で一時記録された相関値が零であり、かつ本位相差AF処理に使用する信号として、取得した基準画像用の信号及び参照画像用の信号が信頼性があると判断された場合も、ステップS507からステップS508へ進む。   As a result, when the sign of the correlation value temporarily recorded in step S506 and the other correlation values are inverted, the process proceeds from step S507 to step S508. Similarly, it is determined that the correlation value temporarily recorded in step S506 is zero, and the acquired standard image signal and reference image signal are reliable as signals used for the phase difference AF process. Also in this case, the process proceeds from step S507 to step S508.

この信頼性の判定にはPB値(信号の最大値と最小値の比)や基準画像と参照画像の類似性などを用いる。   For the determination of the reliability, the PB value (ratio between the maximum value and the minimum value of the signal), the similarity between the standard image and the reference image, and the like are used.

PB値は位相差AFに使用する基準画像と参照画像の像修正前の信号、及び像修正後の信号の4つの信号から求めた比の平均値、もしくは比の最小値を用いる。また、相関演算を行う際にローパスフィルター処理を行うのであれば、基準画像と参照画像について像修正とローパス処理をともに行った後の2つの信号をさらに追加した6つの信号から求めた比の平均値、もしくは比の最小値を用いる。   As the PB value, the average value of the ratio obtained from the four signals of the base image used for the phase difference AF and the signal before image correction of the reference image and the signal after image correction, or the minimum value of the ratio is used. In addition, if low-pass filter processing is performed when performing correlation calculation, an average of ratios obtained from six signals obtained by further adding two signals after performing both image correction and low-pass processing on the standard image and the reference image Use the minimum value or ratio.

また基準画像と参照画像の類似性は、相関値が最小になったずらし量Kにおける基準画像と参照画像の差分を(式2)で求め、類似性の評価値とする。   Further, the similarity between the standard image and the reference image is obtained by calculating the difference between the standard image and the reference image at the shift amount K at which the correlation value is minimized by (Equation 2) and using it as a similarity evaluation value.

類似性の評価値=Σabs(a−bJ+K) (式2)
そして、最大値と最小値の差が所定値以上、類似性の評価値が所定値以下の場合に、取得した基準画像用の信号及び参照画像用の信号が信頼性があると判定する。(式2)以外のものであっても両画像の類似性を評価するものであれば構わない。例えば相関値が最小になったずらし量Kにおける両画像の重なり部分の基準画像もしくは参照画像に対する比率を類似性の評価値としても良い。
Evaluation value of similarity = Σabs (a J −b J + K ) (Formula 2)
When the difference between the maximum value and the minimum value is greater than or equal to a predetermined value and the similarity evaluation value is less than or equal to a predetermined value, it is determined that the acquired reference image signal and reference image signal are reliable. Anything other than (Expression 2) may be used as long as the similarity between both images is evaluated. For example, the similarity evaluation value may be the ratio of the overlapping portion of both images to the standard image or reference image at the shift amount K at which the correlation value is minimized.

ステップS508では、相関値が零になる像ずらし量を演算する。   In step S508, an image shift amount at which the correlation value becomes zero is calculated.

相関値の演算は1画素づつずらして行われているため、位相差AF処理回路37において演算された相関値が零になることは稀である。そこで符号が異なるふたつの相関値と、その相関値を与えるずらし量から、相関値が零となる像ずらす量を求める。   Since the correlation value is calculated by shifting one pixel at a time, the correlation value calculated in the phase difference AF processing circuit 37 is rarely zero. Therefore, an image shift amount at which the correlation value becomes zero is obtained from two correlation values having different signs and a shift amount that gives the correlation value.

式(1)で相関値を計算した結果、K=LとK=L+1の間で相関値Uの符号が反転したとすると、直線補間により相関値が零となる像ずらす量δは以下のようになる。 Result of calculating the correlation value in the formula (1), the sign of K = L and K = L + 1 between the correlation value U K is the inverted, shifted image correlation value becomes zero by linear interpolation quantity δ is less It becomes like this.

δ=L+|U|÷[|U|+CU+1|]
但し、|z|はzの絶対値を意味する。
δ = L + | U L | ÷ [| U L | + CU L +1 |]
However, | z | means the absolute value of z.

次いでステップS509において、プレディクション量Pを像ずれ量δから以下のように求める。   Next, in step S509, the prediction amount P is obtained from the image shift amount δ as follows.

P=δ―Δ
但しΔは合焦時の像ずれ量である。
P = δ−Δ
However, Δ is an image shift amount at the time of focusing.

そして、撮影レンズ鏡筒31の特性から決まる基線長を用いることで、プレディクション量Pからデフォーカス量d(フォーカスレンズ群の移動量と方向)を以下のように求める。   Then, by using the base line length determined from the characteristics of the photographing lens barrel 31, the defocus amount d (the moving amount and direction of the focus lens group) is obtained from the prediction amount P as follows.

d=K・P
但しKはフォーカスに関する敏感度で、撮影レンズ鏡筒31の焦点距離・絞り4の値・像高等に依存する値なので、EEPROM25内にこれらをパラメータとするテーブルを用意しておき、そのテーブルを参照して値を求めている。
d = K ・ P
However, K is a sensitivity related to the focus, and is a value depending on the focal length of the taking lens barrel 31, the value of the diaphragm 4, the image height, etc., so a table with these as parameters is prepared in the EEPROM 25, and the table is referred to. And ask for the value.

次いでステップS510において、ステップS509で求められたデフォーカス量が妥当か判定する。具体的には、顔検出の結果から求まる概ねのデフォーカス量と略等しく、かつ以前に求められたデフォーカス量から算出される駆動目標位置と今回求められたデフォーカス量から算出される駆動目標位置が略等しい場合、妥当であると判定する。尚、ステップS509で求められたデフォーカス量から算出される駆動目標位置はステップS510の判定後も不図示のメモリ(保持手段)に一時保存され、新たにステップS510で判定が行われる際に以前に算出された駆動目標位置として用いられる。   Next, in step S510, it is determined whether or not the defocus amount obtained in step S509 is appropriate. Specifically, it is substantially equal to the approximate defocus amount obtained from the face detection result, and the drive target position calculated from the previously obtained defocus amount and the currently obtained defocus amount. If the positions are approximately equal, it is determined to be valid. The drive target position calculated from the defocus amount obtained in step S509 is temporarily stored in a memory (holding unit) (not shown) even after the determination in step S510, and before the determination is newly performed in step S510. Is used as the drive target position calculated in (1).

具体的には、まずステップS401と同様の方法で顔検出を行った結果、現在の撮影レンズ鏡筒31の焦点距離、フォーカスレンズ群3の位置から概ねのデフォーカス量を求める。その後、ステップS509で求めたデフォーカス量がこの概ねのデフォーカス量と略等しいか調べる。例えば両者の差が焦点深度の3倍以下の場合に両者が略等しいとみなす。また、過去に位相差AF成功と判定されたデフォーカス量が検出されている場合は、その値と比較して駆動目標位置が略等しければ妥当性があると判定する(第2の判定手段)。尚、過去に複数回、位相差AF成功と判定されたデフォーカス量が検出されている場合は、各デフォーカス量から複数の駆動目標位置を算出し(第1の算出手段)、不図示のメモリに保持されている。保持されている複数の駆動目標位置により、前回のステップS510の処理により保持された駆動目標値の重み付けを大きくした加重平均値が算出され(第2の算出手段)、この算出された加重平均値と駆動目標位置が略等しければ妥当性があると判定する。但し、過去に複数回、位相差AF成功と判定されたデフォーカス量が検出されている場合であっても、その検出されたデフォーカス量の履歴が単調減少しておらず、増減を繰り返す場合は往復運動している被写体と思われる。よって、この場合は過去のデフォーカス量を判定に用いないようにする。   Specifically, first, as a result of performing face detection in the same manner as in step S 401, an approximate defocus amount is obtained from the current focal length of the taking lens barrel 31 and the position of the focus lens group 3. Thereafter, it is checked whether or not the defocus amount obtained in step S509 is substantially equal to the approximate defocus amount. For example, when the difference between the two is not more than three times the depth of focus, the two are considered to be substantially equal. Further, when a defocus amount that has been determined to be successful in the phase difference AF has been detected in the past, it is determined that the drive target position is substantially equal to the value (second determination unit). . If a defocus amount that has been determined to be successful in phase difference AF has been detected a plurality of times in the past, a plurality of drive target positions are calculated from each defocus amount (first calculation means), not shown. Held in memory. A weighted average value obtained by increasing the weight of the drive target value held in the previous processing of step S510 is calculated from the plurality of held drive target positions (second calculation means), and the calculated weighted average value is calculated. If the driving target position is substantially equal, it is determined that the driving target position is appropriate. However, even when the defocus amount that has been determined to have been successful in the phase difference AF has been detected a plurality of times in the past, the history of the detected defocus amount has not monotonously decreased and the increase / decrease is repeated. Seems to be a reciprocating subject. Therefore, in this case, the past defocus amount is not used for the determination.

デフォーカス量が妥当と見なされた場合は(ステップS510でYES)、位相差AF成功として本処理を終了する。   If the defocus amount is deemed valid (YES in step S510), the processing is terminated as a phase difference AF success.

このように顔検出を並行して行いその結果から求まる概ねのデフォーカス量で、位相差AF処理で求まるデフォーカス量の妥当性を判断しながら本処理は動作を進める。   In this way, the face detection is performed in parallel, and the process proceeds while the validity of the defocus amount obtained by the phase difference AF process is determined based on the approximate defocus amount obtained from the result.

一方、ステップS507で符号が反転していない場合等は、ステップS507からステップS511へ進み、相関値を求める演算の終端の値に像ずらし量がなったか否かを調べる。   On the other hand, if the sign is not inverted in step S507, the process proceeds from step S507 to step S511, and it is checked whether or not the image shift amount has reached the end value of the calculation for obtaining the correlation value.

終端の値になっていなければ、ステップS520へ進み、取得した相関値を一時記録されていた相関値と差し替え、その後、像ずらし量KをK←K+1と更新する。   If not, the process proceeds to step S520 where the acquired correlation value is replaced with the temporarily recorded correlation value, and then the image shift amount K is updated as K ← K + 1.

終端の値になっていた場合はステップS512へ進み、それまでにデフォーカス量の検出が行われたかを調べる。   If the end value has been reached, the process advances to step S512 to check whether the defocus amount has been detected so far.

デフォーカス量の検出が行われていない場合は(ステップS512でNO)、ステップS516へ進んで位相差AFがNGと判定し、本処理を終了する。一方、デフォーカス量の検出が行われていた場合は(ステップS512でYES)、ステップS513へ進み、ステップS401と同様の方法で顔検出を行う。これにより、現在の撮影レンズ鏡筒31の焦点距離、フォーカスレンズ群3に位置から概ねのデフォーカス量を求め、ステップS514に進む。   If the defocus amount is not detected (NO in step S512), the process proceeds to step S516, where the phase difference AF is determined to be NG, and this process ends. On the other hand, if the defocus amount has been detected (YES in step S512), the process proceeds to step S513, and face detection is performed in the same manner as in step S401. Thereby, the approximate defocus amount is obtained from the focal length of the current taking lens barrel 31 and the position in the focus lens group 3, and the process proceeds to step S514.

そしてステップS514において、ステップS513で求めた概ねのデフォーカス量との差が所定値以内で略等しいと見なせるものがそれまでに検出が行われたかを調べる。もし複数該当するものがある場合は、フォーカスレンズ群3の移動量が最小となるデフォーカス量を選択する。この所定値はステップS510で用いる値より大きな値とする。例えば焦点深度の6倍程度の値にする。これにより、位相差AFで検出されたデフォーカス量と顔検出結果から求まるデフォーカス量を比較し、適当なものが選択される。   In step S514, a check is made to determine whether a difference between the approximate defocus amount obtained in step S513 and which can be regarded as substantially equal within a predetermined value has been detected so far. If there are a plurality of corresponding ones, a defocus amount that minimizes the amount of movement of the focus lens group 3 is selected. This predetermined value is a value larger than the value used in step S510. For example, the value is about 6 times the depth of focus. Thereby, the defocus amount detected by the phase difference AF is compared with the defocus amount obtained from the face detection result, and an appropriate one is selected.

ステップS514において、デフォーカス量が選択された場合は(ステップS515でYES)、その選択されたデフォーカス量を位相差AF処理結果とし、位相差AF成功として本処理を終了する。一方、ステップS514においてデフォーカス量が選択されなかった場合は(ステップS515でNO)、ステップS516に進み、位相差AFがNGと判定して、本処理を終了する。   If the defocus amount is selected in step S514 (YES in step S515), the selected defocus amount is set as the phase difference AF process result, and the process ends as the phase difference AF is successful. On the other hand, if the defocus amount is not selected in step S514 (NO in step S515), the process proceeds to step S516, the phase difference AF is determined to be NG, and this process is terminated.

ここで、以前のデフォーカス量に関して再び評価するのは、合焦位置に近づくにつれ顔検出の精度が向上し、それから求められるデフォーカス量の精度が上がるため以前の評価では不適切と判断されたものの中に適切なものがある可能性があるからである。   Here, the previous defocus amount was evaluated again because the accuracy of the face detection improved as the focus position was approached, and the accuracy of the defocus amount required thereafter increased. This is because there is a possibility that something is appropriate.

図3に戻り、ステップS7の位相差AF処理の結果に基づき合焦可能と判断された場合(ステップS8でYES)、ステップS10へ進み、位相差AF処理の結果を用いて、デフォーカス量が零になると判断される位置へフォーカスレンズ群3を移動する。その後ステップS11の処理へ進む。   Returning to FIG. 3, when it is determined that focusing is possible based on the result of the phase difference AF process in step S <b> 7 (YES in step S <b> 8), the process proceeds to step S <b> 10 and the defocus amount is determined using the result of the phase difference AF process. The focus lens group 3 is moved to a position determined to be zero. Thereafter, the process proceeds to step S11.

ここで正確なデフォーカス量検出が出来ていなくても合焦位置方向が検出可能な場合、ステップS10へ進み、その方向へフォーカスレンズ群3を駆動するようにしても良い。   If the in-focus position direction can be detected even if the accurate defocus amount is not detected, the process proceeds to step S10, and the focus lens group 3 may be driven in that direction.

またステップS8において、ステップS7の位相差AF処理の結果に基づき合焦可能とは判断されない場合には、ステップS9に進む。ステップS9では、ステップS2またはステップS19で行われた顔検出結果から得られる概ねのデフォーカス量に従いフォーカスレンズ群3を移動する。その後ステップS11の処理へ進む。   If it is not determined in step S8 that focusing is possible based on the result of the phase difference AF process in step S7, the process proceeds to step S9. In step S9, the focus lens group 3 is moved according to the approximate defocus amount obtained from the face detection result performed in step S2 or step S19. Thereafter, the process proceeds to step S11.

ステップS11においては、AF領域の読み出し完了を検知し、完了していなければステップS12へ進み、完了していれば、ステップS19でAF領域の再設定を行った後ステップS7に戻り位相差AF処理を行う。   In step S11, completion of AF area reading is detected. If not completed, the process proceeds to step S12. If completed, the AF area is reset in step S19, and then the process returns to step S7 to perform phase difference AF processing. I do.

AF領域の読み出し完了の検知は、TG16から出力されるセンサ駆動のための同期信号を計数することで行われる。具体的には、AF領域の最後の行の次の行の読み出し開始信号がTG16より出力される様にする。これにより、AF領域の読み出し完了を一定周期毎に検知する。   Detection of the AF area read completion is performed by counting the synchronization signal for driving the sensor output from the TG 16. Specifically, a read start signal for the next row after the last row in the AF area is output from the TG 16. Thereby, completion of reading of the AF area is detected at regular intervals.

ステップS19においては、ステップS2〜S4と同様の処理を実行しAF領域を更新する。   In step S19, the same processing as in steps S2 to S4 is executed to update the AF area.

まず顔検出処理を行い、人物の顔の画像上での位置と顔の大きさを求める。その後求められた顔領域内の画像信号を用いて合焦状態に応じたコントラストを表すAF評価値をスキャンAF処理回路14で、位相差AFに用いる信号のPB値を位相差AF処理回路37で求める。そして、このAF評価値、位相差AFに用いる信号のPB値、顔検出結果を用いて、実際に処理を行うAF領域を決定する。   First, face detection processing is performed to determine the position of the person's face on the image and the size of the face. Thereafter, an AF evaluation value representing the contrast according to the in-focus state using the image signal in the obtained face area is obtained by the scan AF processing circuit 14, and a PB value of a signal used for the phase difference AF is obtained by the phase difference AF processing circuit 37. Ask. Then, using this AF evaluation value, the PB value of the signal used for the phase difference AF, and the face detection result, an AF area to be actually processed is determined.

具体的な方法はステップS4と同様であるが、合焦状態に近づくにつれ検出されるデフォーカス量が小さくなるので、デフォーカス量検出のための水平方向の範囲は狭くなる。そのため水平方向のAF領域も狭くなり、被写体が小さな顔である場合であっても、その顔以外の被写体を含む領域はAF領域から少なくなっていき、合焦位置付近では顔の領域とAF領域とを一致することが期待できる。   The specific method is the same as in step S4, but the defocus amount to be detected becomes smaller as the focus state is approached, so the horizontal range for detecting the defocus amount becomes narrower. Therefore, the horizontal AF area is also narrowed, and even when the subject has a small face, the area including the subject other than the face is reduced from the AF area, and the face area and the AF area are near the in-focus position. Can be expected to match.

このようにフォーカスレンズ群3を駆動しながら(すなわち焦点位置の調節中に)顔検出を並行して行い、その結果から概ねのデフォーカス量を再推定し、水平方向のAF領域の範囲を設定している。   In this way, face detection is performed in parallel while driving the focus lens group 3 (that is, while adjusting the focal position), and the approximate defocus amount is re-estimated from the result, and the horizontal AF area range is set. doing.

また合焦状態に近づくにつれ位相差AF処理に用いる画像のコントラストも高くなるので、デフォーカス量検出のための信号のS/N比も高くなるためAF評価値とPB値が大きくなる。そのため、垂直方向のAF領域も狭くなり、被写体が小さな顔である場合であっても、その顔以外の被写体を含む領域はAF領域から少なくなっていき、合焦位置付近では顔の領域とAF領域とを一致することが期待できる。   Further, as the in-focus state is approached, the contrast of the image used for the phase difference AF process is also increased, so that the S / N ratio of the signal for detecting the defocus amount is also increased, so that the AF evaluation value and the PB value are increased. Therefore, the vertical AF area is also narrowed, and even when the subject is a small face, the area including the subject other than the face is reduced from the AF area, and the face area and the AF are in the vicinity of the in-focus position. It can be expected to match the area.

このようにフォーカスレンズ群3を駆動しながら信頼性指標の値の再判定を行い、その結果から垂直方向のAF領域の範囲を設定している。   In this way, the value of the reliability index is re-determined while driving the focus lens group 3, and the range of the AF area in the vertical direction is set based on the result.

ステップS12では、フォーカスレンズ群3がステップS7の位相差AF処理などで求められた駆動目標位置に到達したかを調べ、到達していなければステップS20に進み駆動を継続する。もし駆動目標位置が求められていない場合は、レンズの端位置に到達したか否を判定する。   In step S12, it is checked whether or not the focus lens group 3 has reached the drive target position obtained by the phase difference AF process in step S7. If not, the process proceeds to step S20 to continue driving. If the drive target position is not obtained, it is determined whether or not the lens end position has been reached.

ステップS12において、フォーカスレンズ群3が駆動目標位置へ到達した場合、ステップS13に進み、合焦動作が完了しているか否かの確認を行う。   In step S12, when the focus lens group 3 has reached the drive target position, the process proceeds to step S13 to check whether or not the focusing operation is completed.

これは駆動目標位置に到達した段階でフォーカスレンズ群3を停止し、その状態で位相差AF処理を行い検出されたデフォーカス量が所定値以下か否かで判定する。この所定値は、例えば焦点深度の3割にすれば良い。   The focus lens group 3 is stopped at the stage when the drive target position is reached, and the phase difference AF process is performed in this state to determine whether the detected defocus amount is equal to or less than a predetermined value. This predetermined value may be set to 30% of the focal depth, for example.

更に合焦精度を上げるために、例えば検出されたデフォーカス量が焦点深度の1割を超える場合は複数回デフォーカス量検出を行い、その平均値となるデフォーカス量に従いフォーカスレンズ群3の移動制御等を行っても良い。   In order to further improve the focusing accuracy, for example, when the detected defocus amount exceeds 10% of the focal depth, the defocus amount is detected multiple times, and the focus lens group 3 is moved according to the average defocus amount. Control or the like may be performed.

ステップS13で合焦動作が完了し合焦となった場合、ステップS14へ進みAF表示にOK(合焦)の表示を行う。これはLED29を点灯することなどにより行うと同時にLCD10上に緑の枠を表示するなどの処理を行う。   If the in-focus operation is completed in step S13, the process proceeds to step S14, and OK (in-focus) is displayed on the AF display. This is performed by turning on the LED 29 or the like, and at the same time, processing such as displaying a green frame on the LCD 10 is performed.

一方、ステップS13で合焦動作が完了しない(デフォーカス量が所定値を超える)場合は、ステップS19からステップS7へ進み、再度位相差AF処理を行う。   On the other hand, if the focusing operation is not completed in step S13 (the defocus amount exceeds a predetermined value), the process proceeds from step S19 to step S7, and the phase difference AF process is performed again.

また、ステップS13で合焦動作が完了しない(NG)状態が所定回以上発生した場合は合焦不可能と判断し、ステップS17にてフォーカスレンズ群3を定点と呼ばれるあらかじめ定められた位置へ移動する。その後ステップS18においてAF表示にNG(非合焦)表示を行う。これはLED29を点滅表示することなどにより行うと同時にLCD10上に黄色の枠を表示するなどの処理を行う。   Further, if the focusing operation is not completed (NG) in step S13 for a predetermined number of times, it is determined that focusing is impossible, and the focus lens group 3 is moved to a predetermined position called a fixed point in step S17. To do. Thereafter, in step S18, NG (non-focused) display is performed on the AF display. This is performed by displaying the LED 29 in a blinking manner, and at the same time, processing such as displaying a yellow frame on the LCD 10 is performed.

CPU15はステップS15において、SW2(レリーズスイッチの第二ストローク)の確認を行い、SW2がオンになっていた場合、ステップS16に進み、撮影時の露光量を決定する最終のAE処理を実行し、実際の露光処理を実行する。動画撮影の場合は動画記録釦が押された場合に記録を開始し、再度釦が押されたら記録を停止する。   In step S15, the CPU 15 confirms SW2 (second stroke of the release switch). If SW2 is on, the CPU 15 proceeds to step S16 and executes a final AE process for determining the exposure amount at the time of shooting. The actual exposure process is executed. In the case of moving image shooting, recording is started when the moving image recording button is pressed, and recording is stopped when the button is pressed again.

なお、風景撮影など人物撮影以外の場合や、人物撮影でも何らかの理由で顔が検出されなかった場合は、AF領域を画面中央部に大きさが水平垂直とも画面の18%程度に相当する領域としてもよい。あるいは、被写体が人物以外である場合、AF領域を検出された大きさに合わせるようにしてもよい。またこれらの場合はステップS9等顔検出結果を用いた処理は行わない。ステップS9ではレンズの至近側もしくは遠側のいずれかの端位置に駆動し、ステップS7では信頼性のある位相差AF処理結果が得られるか否かで制御を切り替えるようにする。   In cases other than portrait photography, such as landscape photography, or when a face is not detected for some reason even in portrait photography, the AF area is an area equivalent to about 18% of the screen in both the horizontal and vertical sizes. Also good. Alternatively, when the subject is other than a person, the AF area may be adjusted to the detected size. In these cases, the process using the face detection result such as step S9 is not performed. In step S9, the lens is driven to an end position on either the near side or the far side of the lens, and in step S7, the control is switched depending on whether or not a reliable phase difference AF processing result is obtained.

このように、被写体(顔)検出に基づく概ねのデフォーカス量から、位相差AF処理によるデフォーカス量の妥当性を判断する。また被写体(顔)検出結果に基づく概ねのデフォーカス量に近いデフォーカス量を選択する。これにより、正確なデフォーカス量を検出できる。   Thus, the validity of the defocus amount by the phase difference AF process is determined from the approximate defocus amount based on the subject (face) detection. Also, a defocus amount close to the approximate defocus amount based on the subject (face) detection result is selected. Thereby, an accurate defocus amount can be detected.

更に上記概ねのデフォーカス量に応じて水平方向のAF領域を設定し、AF領域内の信号の信頼性等に応じて垂直方向のAF領域を設定することで、意図する被写体に正確に焦点調節動作を行うことを可能にしている。   In addition, a horizontal AF area is set according to the above approximate defocus amount, and a vertical AF area is set according to the reliability of the signal in the AF area, thereby accurately adjusting the focus on the intended subject. It is possible to perform the operation.

本実施例の実施例1に対する違いは、主として3つである。一つ目は、親子の撮影など複数の大きさの異なる被写体が検出された場合に子供の顔に優先的にピントを合わせる処理を行う点である。二つ目は、手振れや被写体の移動を検出しその結果に応じてAF領域の大きさを変更する点である。三つ目は、絞り値を撮影者が指定しないモードで被写体検出結果を基に設定したAF領域で合焦が困難な場合は被写界深度を深くして撮影を行う点である。   There are mainly three differences between the present embodiment and the first embodiment. The first is that when a plurality of different-sized subjects are detected, such as photographing a parent and child, a process of focusing on the child's face preferentially is performed. Secondly, camera shake and movement of the subject are detected, and the size of the AF area is changed according to the result. Thirdly, when it is difficult to focus in an AF area set based on the subject detection result in a mode in which the photographer does not specify an aperture value, shooting is performed with a deep depth of field.

また実施例2の撮像処理も、被写体が人物であり被写体検出回路36で人物の顔が検出する場合の例を説明する。   In the imaging processing of the second embodiment, an example in which the subject is a person and the person's face is detected by the subject detection circuit 36 will be described.

図6は、本発明の実施例2に係る撮像処理の手順を示すフローチャートである。以下、実施例1と同様の処理を行う部分は図3のフローチャートと同じ番号を付し説明は割愛する。   FIG. 6 is a flowchart illustrating the procedure of the imaging process according to the second embodiment of the present invention. In the following, parts that perform the same processing as in the first embodiment are given the same numbers as in the flowchart of FIG. 3, and description thereof is omitted.

図6においてまず、ステップS1においてAE処理が行われ露光条件が設定された後、ステップS2aにおいて、複数の被写体に対してその顔領域が検出される顔検出処理が行われる。   In FIG. 6, first, after an AE process is performed in step S1 and an exposure condition is set, in step S2a, a face detection process is performed in which face areas are detected for a plurality of subjects.

その後ステップS3aにおいてAF領域の初期設定を行う。具体的には、まず、ステップS2aにおいて求められた複数の顔領域それぞれをAF領域の初期設定とする。次に、この初期設定された各領域内の画像信号を用いて合焦状態に応じたコントラストを表すAF評価値をスキャンAF処理回路14で、位相差AFに用いる信号のPB値を位相差AF処理回路37で求める。   In step S3a, the AF area is initially set. Specifically, first, each of the plurality of face areas obtained in step S2a is set as the initial setting of the AF area. Next, an AF evaluation value representing the contrast corresponding to the in-focus state is used by the scan AF processing circuit 14 using the image signals in the initially set regions, and the PB value of the signal used for the phase difference AF is converted to the phase difference AF. It is determined by the processing circuit 37.

次いでステップS4aにおいて、このAF評価値、位相差AFに用いる信号のPB値、顔検出結果を用いて、実際に処理を行うそれぞれの検出された顔に対応するAF領域を設定する。具体的には、ステップS3aで初期設定された各領域に対して、図4に示すAF領域設定処理が行われる。その後、図4の手順によって設定された各AF領域に対して手振れ量に応じたAF領域の拡大を行う。具体的には、振れ検出回路34で検出された水平方向の手振れ量φh・垂直方向の手振れ量φv・撮影レンズ鏡筒31の焦点距離fl・位相差AF処理の行われる間隔tpを用いて、手振れによる位相差AF処理が行われるタイミングでの顔の移動範囲を予測する。次にその予測した移動範囲を含む様にAF領域の範囲を拡大する。   In step S4a, an AF area corresponding to each detected face to be actually processed is set using the AF evaluation value, the PB value of the signal used for phase difference AF, and the face detection result. Specifically, the AF area setting process shown in FIG. 4 is performed for each area initially set in step S3a. Thereafter, the AF area is expanded according to the camera shake amount for each AF area set by the procedure of FIG. Specifically, using the horizontal direction shake amount φh, the vertical direction shake amount φv detected by the shake detection circuit 34, the focal length fl of the photographing lens barrel 31, and the interval tp at which the phase difference AF process is performed, The movement range of the face at the timing when the phase difference AF process due to camera shake is performed is predicted. Next, the range of the AF area is expanded to include the predicted movement range.

まず水平方向のAF領域の範囲を拡大する。   First, the horizontal AF area is expanded.

手振れにより顔領域の水平方向の変位量xsは以下のように表せる。   The amount of horizontal displacement xs of the face area due to camera shake can be expressed as follows.

xs=Rratio・tp・fl・tan(φh)
ここで、撮影者が意図的にカメラを揺らす等の特別な状況ではなく、手振れ補正による抑振率に3〜4段の補正効果が見込まれる場合は、Rratioを0.1程度の値にする。抑振率は手振れの周波数など個人差にも影響を受けるので、手振れ周波数や手振れ最大値などを考慮した関数にしても良い。またこのxsに上限値を設けても良い。例えば、元の顔領域の大きさに対して2割超は拡大しないようにする。
xs = R ratio , tp, fl, tan (φh)
Here, when the photographer intentionally shakes the camera, and when a correction effect of 3 to 4 steps is expected in the vibration reduction rate due to camera shake correction, R ratio is set to a value of about 0.1. To do. Since the suppression rate is affected by individual differences such as camera shake frequency, a function that takes into account the camera shake frequency and the maximum value of camera shake may be used. Further, an upper limit value may be provided for xs. For example, more than 20% of the size of the original face area is not enlarged.

顔領域の水平方向の両端の座標がxl、xrであった場合は、水平方向の顔の予測移動範囲xlp、xrpは、以下のようになる。   When the coordinates of both ends in the horizontal direction of the face area are xl and xr, the predicted movement ranges xlp and xrp of the face in the horizontal direction are as follows.

xlp=xl―xs
xrp=xr+xs
図4のステップS405において水平方向のAF領域が水平所定値に設定され、かつその設定された範囲内に上記のxlp、xrpが含まれていれば水平方向のAF領域の範囲を変更しない。一方、その設定された範囲内に含まれていない場合や図4のステップS404において水平方向のAF領域が顔の水平方向範囲に設定された場合は、xlp〜xrpに水平方向のAF領域の範囲を拡大する。なお拡大する場合は、常にxlp〜xrpにまで水平方向のAF領域の範囲を拡大するのではなく、xsの大きさに応じて拡大量を変更しても良い。例えば、xsに上限値を設けられている場合は、xsの二乗に拡大量が比例し、最大値が上限値Xslimとなるようにする。すなわち、xlp、xrpは、以下のように求められる。
xlp = xl-xs
xrp = xr + xs
If the horizontal AF area is set to a predetermined horizontal value in step S405 in FIG. 4 and the above xlp and xrp are included in the set range, the horizontal AF area range is not changed. On the other hand, if it is not included in the set range or if the horizontal AF area is set as the horizontal range of the face in step S404 in FIG. 4, the range of the horizontal AF area from xlp to xrp To enlarge. When enlarging, the amount of enlargement may be changed according to the size of xs instead of always enlarging the range of the horizontal AF area from xlp to xrp. For example, when an upper limit value is set for xs, the enlargement amount is proportional to the square of xs, and the maximum value is set to the upper limit value Xslim. That is, xlp and xrp are obtained as follows.

xlp=xl−(xs)・(xs)÷Xslim
xrp=xr+(xs)・(xs)÷Xslim
このようにするのは検出された手振れ量が小さい場合は、検出誤差などの可能性があり拡大することで弊害が起こる可能性があるためである。
xlp = xl− (xs) · (xs) ÷ Xslim
xrp = xr + (xs) · (xs) ÷ Xslim
This is because when the detected amount of camera shake is small, there is a possibility of a detection error or the like, and there is a possibility that an adverse effect may occur due to enlargement.

次いで垂直方向のAF領域の範囲を拡大する。   Next, the range of the vertical AF area is expanded.

手振れにより顔領域の垂直方向の変位量ysは以下のように表せる。   The amount of displacement ys in the vertical direction of the face area due to camera shake can be expressed as follows.

ys=Rratio・tp・fl・tan(φv)
この量が所定値を超える場合にAF領域の垂直方向の拡大を行い、上下の位相差AFを行うための画素行を含む様に垂直方向の範囲を拡大する。ここで閾値とする所定値は、例えば位相差AFを行うための画素行の配置される間隔Lintの2分の1とすれば良い。
ys = R ratio , tp, fl, tan (φv)
When this amount exceeds a predetermined value, the AF area is enlarged in the vertical direction, and the vertical range is enlarged so as to include the pixel rows for performing the upper and lower phase difference AF. Here, the predetermined value as the threshold value may be, for example, one half of the interval Lint at which the pixel rows for performing the phase difference AF are arranged.

実際に拡大する量yaddは、以下のように計算されたyadd′を四捨五入した値をLint倍した値である。   The amount yadd that is actually enlarged is a value obtained by multiplying a value obtained by rounding off yadd ′ calculated as follows by Lint.

yadd′=(ys÷Lint)
しかしながら、yaddの値の最大値は制限する。例えば最大垂直方向の画素数の5%程度を制限値とする。水平方向の場合と同様にysの二乗に拡大量が比例するなど、ysの大きさに応じて拡大量を変更しても良い。
yadd ′ = (ys ÷ Lint)
However, the maximum value of yadd is limited. For example, the limit value is about 5% of the maximum number of pixels in the vertical direction. As in the case of the horizontal direction, the enlargement amount may be changed according to the magnitude of ys, for example, the enlargement amount is proportional to the square of ys.

顔領域の垂直方向の両端の座標がyu、ybであった場合は、垂直方向の顔の予測移動範囲yup、ybpは、以下のようになる。   When the coordinates of both ends in the vertical direction of the face area are yu and yb, the predicted face movement ranges yup and ybp in the vertical direction are as follows.

yup=xl−yadd
ybp=xr+yadd
また、ステップS4aでは、ステップS8以降の処理の対象となるAF領域を、被写体検出回路36の出力に基づき選択する。
yup = xl-yadd
ybp = xr + yadd
In step S4a, an AF area to be processed in step S8 and subsequent steps is selected based on the output of the subject detection circuit 36.

具体的には、被写体検出回路36にはあらかじめ複数の被写体情報を登録し(登録手段)、優先して検出する被写体の順位付けをする。例えば家族全員の顔情報を登録し、子供を優先して検出するように順位付をすることができる。これにより登録された顔から優先順位の高い子供の顔を選択してステップS8以降のAF等の処理に反映することが可能になる。   Specifically, a plurality of pieces of subject information are registered in advance in the subject detection circuit 36 (registration means), and the subjects to be detected are prioritized. For example, it is possible to register face information of all family members and rank them so that children are detected with priority. This makes it possible to select a child's face having a higher priority from the registered faces and reflect it in processing such as AF after step S8.

被写体検出回路36の出力に従い優先順位の高い顔を選択して、その顔に対応するステップS4aで設定したAF領域をAF処理の対象とする。すなわち、スナップ撮影など親子での撮影においては、子供の顔に対応する領域がAF処理の対象となる。   A face with high priority is selected according to the output of the subject detection circuit 36, and the AF area set in step S4a corresponding to the face is set as the target of AF processing. That is, in parent-child photography such as snap photography, an area corresponding to a child's face is a target of AF processing.

但し、顔が小さいために優先順位の高い顔に対応する領域が図4に示す処理で領域拡大されると、その領域をAF処理の対象としてしまうとAF精度が落ちてしまう。そこで、優先順位の高い顔に対応する領域が拡大されている間は、優先順位の低い登録された顔が検出されその対応する領域が図4に示す処理で領域拡大されていないのであれば、その優先順位の低い登録された顔に対応する領域をAF処理の対象とする。これにより、例えばスナップ撮影など親子での撮影において、子供の顔に対応する領域がAF処理の対象となった場合、本処理においては、子供の顔に対応する領域でのAF精度が落ちる場合がある。このような場合、親の顔に対応する領域でAF処理を行い、子供の顔に対応する領域でのAF精度が上がるのを待つことができる。   However, since the face is small and the area corresponding to the face with high priority is enlarged by the process shown in FIG. 4, if the area is subjected to the AF process, the AF accuracy is lowered. Therefore, while a region corresponding to a face with a high priority is being expanded, if a registered face with a low priority is detected and the corresponding region is not expanded by the process shown in FIG. An area corresponding to a registered face with a low priority is set as an AF processing target. Thereby, for example, when shooting with a parent and child such as snap shooting, if the area corresponding to the child's face is subject to AF processing, the AF accuracy in the area corresponding to the child's face may be reduced in this processing. is there. In such a case, AF processing is performed in the area corresponding to the parent's face, and it is possible to wait for the AF accuracy in the area corresponding to the child's face to increase.

予め登録されている被写体情報が一つの場合は、実施例1と同じ動作になるため説明は割愛する。また、予め登録された被写体情報が無い場合は、ステップS2aで検出された顔のうち最も大きな顔に対するAF領域をステップS8以降の処理の対象として選択する。この場合も実施例1と同じ動作になるため説明は割愛する。   When there is only one subject information registered in advance, the operation is the same as that of the first embodiment, and the description is omitted. If there is no subject information registered in advance, the AF area for the largest face among the faces detected in step S2a is selected as a target for processing in step S8 and subsequent steps. In this case as well, the operation is the same as that of the first embodiment, and the description is omitted.

その後ステップS5→S6→S7aと進み位相差AF処理を行う。ステップS7aでは、複数のAF領域それぞれに関して、図5の手順に従って位相差AF処理を行い、それぞれのAF領域に関して、位相差AFで合焦可能か否か判定し、可能な場合は検出されたデフォーカス量を取得する。   Thereafter, the process proceeds in steps S5 → S6 → S7a to perform the phase difference AF process. In step S7a, phase difference AF processing is performed for each of the plurality of AF areas in accordance with the procedure of FIG. 5, and it is determined whether or not each AF area can be focused by phase difference AF. Get the focus amount.

ステップS8では、ステップS7において処理の対象に選択されたAF領域に関して位相差AFで合焦可能か判定し、その結果に従いステップS9、ステップS10の処理を行う。   In step S8, it is determined whether or not the AF area selected as the processing target in step S7 can be focused by phase difference AF, and the processing in steps S9 and S10 is performed according to the result.

ステップS11では、AF領域の読み出しが完了したかを調べ、結果に従い、実施例1と同様、分岐処理を行う。   In step S11, it is checked whether or not the AF area has been read, and branch processing is performed according to the result, as in the first embodiment.

具体的には、AF領域の読み出しが完了した場合(ステップS11でYES)、ステップS19aにおいてAF領域を更新する。ステップS19aでは、上記本実施例のステップS2a〜S4aと同様の処理を実行し、複数のAF領域に関して図4のAF領域設定処理を行いAF領域の更新を行う。   Specifically, when reading of the AF area is completed (YES in step S11), the AF area is updated in step S19a. In step S19a, processing similar to that in steps S2a to S4a of the present embodiment is executed, and AF region setting processing in FIG. 4 is performed for a plurality of AF regions to update the AF region.

そしてステップS4aと同様に設定されたAF領域に対して手振れ量と光軸方向の被写体移動に応じた領域の拡大を行う。すなわち、まずは手振れによる顔領域の水平方向の変位量xs・垂直方向の変位量ysを求め、次いで光軸方向の被写体移動による顔領域の拡大量を求める。   Then, enlargement of the area corresponding to the camera shake amount and subject movement in the optical axis direction is performed on the AF area set in the same manner as in step S4a. That is, first, a horizontal displacement amount xs and a vertical displacement amount ys of the face region due to camera shake are obtained, and then an enlargement amount of the face region due to subject movement in the optical axis direction is obtained.

このように、フォーカスレンズ群3を駆動しながら被写体(顔)検出処理を行う場合、被写体が光軸方向に移動していれば、被写体(顔)検出結果から得られる顔の大きさから次の位相差AF処理のタイミングにおける顔の大きさを予測することが出来る。   As described above, when the subject (face) detection process is performed while the focus lens group 3 is driven, if the subject is moving in the optical axis direction, the next size is obtained from the face size obtained from the subject (face) detection result. The face size at the timing of the phase difference AF process can be predicted.

位相差AF処理の行われる間隔がtp、処理タイミングがtのときに検出された顔の水平方向の大きさがFSh(t)である場合、ΔFShは以下のようになる。   When the interval in which the phase difference AF process is performed is tp and the horizontal size of the face detected when the processing timing is t is FSh (t), ΔFSh is as follows.

ΔFSh=FSh(t+tp)−FSh(t)=FSh(t)−FSh(t−tp)
これに手振れによる顔領域の変位量を加え、水平方向の予測移動範囲xlp、xrpは、以下のようになる。
ΔFSh = FSh (t + tp) −FSh (t) = FSh (t) −FSh (t−tp)
The amount of displacement of the face region due to camera shake is added to this, and the predicted movement ranges xlp and xrp in the horizontal direction are as follows.

xlp=xl−(xs+ΔFSh/2)
xrp=xr+(xs+ΔFSh/2)
図4のステップS405において水平方向のAF領域が水平所定値に設定され、かつその設定された範囲内に上記のxlp、xrpが含まれていない場合xlp〜xrpに水平方向のAF領域の範囲を拡大する。同様に、図4のステップS404において水平方向のAF領域が顔の水平方向範囲に設定された場合も、xlp〜xrpに水平方向のAF領域の範囲を拡大する。
xlp = xl− (xs + ΔFSh / 2)
xrp = xr + (xs + ΔFSh / 2)
If the horizontal AF area is set to a predetermined horizontal value in step S405 in FIG. 4 and the above xlp and xrp are not included in the set range, the horizontal AF area range is set to xlp to xrp. Expanding. Similarly, when the horizontal AF area is set to the horizontal range of the face in step S404 in FIG. 4, the horizontal AF area range is expanded to xlp to xrp.

垂直方向も同様に、位相差AF処理の行われる間隔がtp、処理タイミングがtのときに検出された顔の垂直方向の大きさがFSv(t)である場合、ΔFSvは以下のようになる。   Similarly, in the vertical direction, when the interval at which the phase difference AF process is performed is tp and the detected vertical size of the face is FSv (t), ΔFSv is as follows. .

ΔFSv=FSv(t)−FSv(t−tp)
これに垂直方向の変位量ysを加えた量(ys+ΔFSv/2)が所定値を超えた場合にAF領域の垂直方向の拡大を行う。
ΔFSv = FSv (t) −FSv (t−tp)
When the amount obtained by adding the displacement amount ys in the vertical direction (ys + ΔFSv / 2) exceeds a predetermined value, the AF area is expanded in the vertical direction.

実際に拡大する量yaddと垂直方向の顔の予測移動範囲yup、ybpはステップS4aと同様に計算される。   The amount yadd to be actually enlarged and the predicted movement ranges yup and ybp in the vertical direction are calculated in the same manner as in step S4a.

本実施例で実行される被写体(顔)検出処理及び位相差AF処理はいずれも、センサ5から読み出された画像信号を処理して行われるため、特殊な画像信号読み出し方式を採用しないかぎり、両者の処理タイミングは等しくなる。   Since both the subject (face) detection process and the phase difference AF process executed in the present embodiment are performed by processing the image signal read from the sensor 5, unless a special image signal reading method is employed, Both processing timings are equal.

なお遠ざかる場合は被写体移動に応じた領域の変更は行わない。   When moving away, the area is not changed according to the movement of the subject.

また拡大量は手振れ量に応じたAF領域の拡大の場合と同様に、ΔFShの二乗に拡大量が比例するなど、ΔFShの大きさに応じて拡大量を変更しても良い。   Further, the enlargement amount may be changed according to the magnitude of ΔFSh, for example, the enlargement amount is proportional to the square of ΔFSh, as in the case of enlargement of the AF area according to the camera shake amount.

また撮像面内で被写体が移動している場合も被写体(顔)検出結果などを参考にその移動量と位相差AF処理のタイミングで被写体の位置を予測する。   Even when the subject is moving within the imaging plane, the position of the subject is predicted based on the amount of movement and the timing of the phase difference AF processing with reference to the detection result of the subject (face).

被写体検出回路36に出力から検出された顔の代表座標(例えば両目の平均座標)を取得する。   The subject detection circuit 36 acquires the representative coordinates (for example, average coordinates of both eyes) of the face detected from the output.

位相差AF処理の行われる間隔がtp、処理タイミングがt、t−tpにおける顔の代表座標(x1、y1)(x2、y2)の場合、処理タイミングがt+tpにおける顔の代表座標の予測位置(x3、y3)は、(2・x2−x1、2・y2−y1)となる。よって、その差分はΔxFa、ΔyFaは、以下のようになる。   When the interval at which the phase difference AF process is performed is tp, the processing timing is t, and the face representative coordinates (x1, y1) (x2, y2) at t−tp, the predicted position of the face representative coordinates at the processing timing t + tp ( x3, y3) is (2 · x2-x1, 2 · y2-y1). Therefore, the differences are ΔxFa and ΔyFa as follows.

ΔxFa=x2−x1
ΔyFa=y2−y1
また、水平方向の予測移動範囲xlp、xrpは、以下のようになる。
ΔxFa = x2-x1
ΔyFa = y2−y1
The predicted movement ranges xlp and xrp in the horizontal direction are as follows.

xlp=xl−ΔxFa
xrp=xr+ΔxFa
ただし、移動方向にのみ拡大するので移動と反対方向のものの値は変化させない(xlp=xlまたはxrp=xrとする)。その後の処理はこれまでと同じである。
xlp = xl−ΔxFa
xrp = xr + ΔxFa
However, since the enlargement is performed only in the movement direction, the value in the direction opposite to the movement is not changed (xlp = xl or xrp = xr). The subsequent processing is the same as before.

垂直方向も同様に移動と反対方向のものの値は変化させず、移動する方向の値はΔyFaを基にこれまでと同様に求める。   Similarly, the value in the direction opposite to the movement is not changed in the vertical direction, and the value in the moving direction is obtained in the same manner as before based on ΔyFa.

また拡大量は手振れ量に応じたAF領域の拡大の場合と同様に、ΔFShやΔFSvの二乗に拡大量が比例するなど、その大きさに応じて拡大量を変更しても良い。   Further, the enlargement amount may be changed according to the size, for example, the enlargement amount is proportional to the square of ΔFSh or ΔFSv, as in the case of enlargement of the AF area according to the camera shake amount.

AF領域を更新が終了した場合、処理の対象とする領域の再選択を行う。   When the update of the AF area is completed, the area to be processed is reselected.

ステップS4aの処理を行った結果、優先順位の高い顔に対応する領域が拡大されなければ、優先順位の高い登録された顔に対応する領域を処理の対象とする。   If the area corresponding to the face with a high priority is not enlarged as a result of performing the process of step S4a, the area corresponding to the registered face with a high priority is set as the processing target.

また、ステップS4aの処理を行った結果、優先順位の高い顔に対応する領域が拡大した場合、優先順位の低い登録された顔に対応する領域を処理の対象とする。但しこの場合、後述するステップS13aの処理において、優先順位の高い顔に対応する領域のデフォーカス量が明らかに大きくなった場合は、以後SW1がオフされるまでは、優先順位の低い登録された顔に対応する領域を処理の対象とはしない。   In addition, as a result of performing the process of step S4a, when an area corresponding to a face with a high priority is enlarged, an area corresponding to a registered face with a low priority is set as a processing target. However, in this case, if the defocus amount of the area corresponding to the face with a high priority is clearly increased in the process of step S13a described later, the low priority is registered until SW1 is turned off thereafter. The area corresponding to the face is not a processing target.

ステップS12では、フォーカスレンズ群3が駆動目標位置に到達したと判断された場合、ステップS13aに進み、合焦動作が完了しているか否かの確認を行う。具体的には、フォーカスレンズ群3を駆動目標位置で停止した後、優先順位の高い顔に対応する領域に対してその状態で位相差AF処理を行う。この位相差AF処理の結果検出されたデフォーカス量が所定値以下の場合、合焦動作完了し、合焦と判定してステップS14へ進み、AF表示にOK(合焦)の表示を行う。   In step S12, when it is determined that the focus lens group 3 has reached the drive target position, the process proceeds to step S13a to check whether or not the focusing operation is completed. Specifically, after the focus lens group 3 is stopped at the drive target position, the phase difference AF process is performed in that state on the area corresponding to the face having a high priority. If the defocus amount detected as a result of the phase difference AF process is less than or equal to a predetermined value, the focusing operation is completed, it is determined that the focus is achieved, the process proceeds to step S14, and OK (focusing) is displayed on the AF display.

一方、ステップS13aで優先順位の高い顔に対応する領域に対して合焦状態と判定できない場合は、優先順位の低い登録された顔に対応する領域に対して、合焦動作が完了しているか否かの確認を行う。合焦と判定されかつ焦点深度を深くすることで優先順位の高い顔に対応する領域も合焦範囲内とみなせる場合は、そのために必要な絞り値に設定した後、ステップS14へ進みAF表示にOK(合焦)の表示を行う。尚、この絞り値の設定と同時に、シャッター速度・撮影時の感度も必要に応じて設定するようにしてもよい。   On the other hand, if it cannot be determined in step S13a that the area corresponding to the face with a higher priority is in focus, has the focusing operation been completed for the area corresponding to the registered face with a lower priority? Confirm whether or not. If it is determined that the subject is in focus and the area corresponding to the face with higher priority can be considered within the in-focus range by increasing the depth of focus, after setting the aperture value necessary for that, the process proceeds to step S14 and AF display is performed. OK (focusing) is displayed. Simultaneously with the setting of the aperture value, the shutter speed and the sensitivity at the time of shooting may be set as necessary.

この場合はステップS16の露光処理において、露光時の絞りを絞り焦点深度を深くすることで合焦範囲内とみなせる絞り値にし、その際のシャッター速度が所定値より遅くなる場合は撮影時に感度をその分高感度にする。例えば、位相差AF処理時の絞り値がF4で合焦範囲内と見なせる絞り値がF11の場合、露光量を変わらないように制御するとシャッター速度が3段遅くなり、1/250秒から1/30秒になる。もし撮影レンズの焦点距離が500mmの場合、シャッター速度を1/125秒より速くしなければならない。そこで撮影時の感度を2段(例えばISO200から800)上げて、シャッター速度を1/125秒とする。   In this case, in the exposure process of step S16, the aperture value at the time of exposure is set to an aperture value that can be regarded as being within the in-focus range by increasing the depth of focus, and if the shutter speed at that time is slower than a predetermined value, the sensitivity is set at the time of shooting. Increase the sensitivity accordingly. For example, when the aperture value at the time of phase difference AF processing is F4 and the aperture value that can be regarded as being within the in-focus range is F11, the shutter speed is reduced by three steps if the exposure amount is controlled so as not to change, and from 1/250 sec to 1 / It will be 30 seconds. If the focal length of the taking lens is 500 mm, the shutter speed must be faster than 1/125 seconds. Therefore, the sensitivity at the time of shooting is increased by two steps (for example, ISO 200 to 800), and the shutter speed is set to 1/125 seconds.

優先順位の低い登録された顔に対応する領域に対しても合焦と判定されない場合は(ステップS13でNO)、ステップS19からステップS7へ進み、再度位相差AF処理を行う。   If it is not determined that the region corresponding to the registered face with a low priority is in focus (NO in step S13), the process proceeds from step S19 to step S7, and the phase difference AF process is performed again.

さらに、ステップS13で優先順位の高い顔に対応する領域だけでなく、優先順位の低い登録された顔に対応する領域に対しても合焦と判定されない(NG)状態が所定回以上発生した場合は合焦不可能と判断し、ステップS21へ進む。   Further, in step S13, when not only a region corresponding to a face with a high priority but also a region corresponding to a registered face with a low priority is not determined to be in focus (NG) more than a predetermined number of times Determines that focusing is impossible, and proceeds to step S21.

ステップS21では、絞りを絞り焦点深度を深くすることで合焦範囲内とみなせるか否かを判定する。絞りを絞ることで合焦範囲内にあると見なせる場合は、露光処理(ステップS16)で所定の絞り値に絞ることを指示した後ステップS14に進む。但しステップS16での露光処理においては、ここで指示された絞り値と、それ以外の動作によって設定された絞り値(例えばAv優先モード等において撮影者によって指示された絞り値)と比較し、より絞る方の絞り値を採用する。   In step S <b> 21, it is determined whether or not the aperture can be regarded as within the in-focus range by increasing the aperture depth. If the aperture can be regarded as being within the in-focus range, the process proceeds to step S14 after instructing to reduce the aperture value to a predetermined aperture value in the exposure process (step S16). However, in the exposure process in step S16, the aperture value instructed here is compared with the aperture value set by the other operations (for example, the aperture value instructed by the photographer in the Av priority mode). The aperture value for the aperture is used.

また、ステップS21では合焦範囲内とみなせるか否かの判定は、位相差AFの結果を用いて行う。   In step S21, it is determined using the result of the phase difference AF whether or not it can be regarded as being within the focusing range.

ステップS13においてはフォーカスレンズ群3を停止し、その状態で位相差AF処理を行ってデフォーカス量を検出する。検出されたデフォーカス量では焦点深度が基準とする所定値を超えるので、絞り4を絞ることによって焦点深度を深くする。   In step S13, the focus lens group 3 is stopped, and in this state, the phase difference AF process is performed to detect the defocus amount. Since the depth of focus exceeds a predetermined reference value with the detected defocus amount, the depth of focus is increased by reducing the aperture 4.

この絞り4を絞ることによって合焦範囲内とみなせる絞り値Fdは以下のように求められる。   An aperture value Fd that can be regarded as being within the focusing range by reducing the aperture 4 is obtained as follows.

Fd= 検出されたデフォーカス量÷焦点深度を基準とする所定値×現在の絞り値
この値が絞り4の最小絞り値より開放よりであれば、それを実際に設定指示する絞り値とし、絞り4を絞ることで合焦範囲内と見なせると判定する。
Fd = detected defocus amount / predetermined value based on the depth of focus × current aperture value If this value is larger than the minimum aperture value of the aperture 4, it is set as an aperture value for actually setting and instructing the aperture. It is determined that it can be regarded as within the in-focus range by reducing 4.

また実際に設定指示する絞り値には上限を設け、上限を超えた場合は絞り値Fdに絞り4を絞っても合焦範囲内にあると見なせないと判断するようにしても良い。   Further, an upper limit may be provided for the aperture value that is actually instructed to set, and if the upper limit is exceeded, it may be determined that the aperture value Fd cannot be regarded as being within the in-focus range even if the aperture 4 is reduced.

この上限は、例えば、位相差AF処理実行時の絞り値の3倍の値とする。   This upper limit is, for example, a value that is three times the aperture value when the phase difference AF process is executed.

さらに、位相差AF処理で合焦可能と判断されていない場合は、ステップS21の判定は行わずに絞り4を絞っても合焦範囲内にあると見なせないと判断する。   Further, if it is not determined that focusing is possible in the phase difference AF process, it is determined that the in-focus range cannot be considered even if the aperture 4 is reduced without performing the determination in step S21.

ステップS13において絞り4を絞っても合焦範囲内にあると見なせない場合は、ステップS17にてフォーカスレンズ群3を定点と呼ばれるあらかじめ定められた位置へ移動する。その後ステップS18においてAF表示にNG(非合焦)表示を行う。これはLED29を点滅表示することなどにより行うと同時にLCD10上に黄色の枠を表示するなどの処理を行う。   In step S13, if the aperture 4 cannot be regarded as being within the in-focus range even when the aperture 4 is reduced, the focus lens group 3 is moved to a predetermined position called a fixed point in step S17. Thereafter, in step S18, NG (non-focused) display is performed on the AF display. This is performed by displaying the LED 29 in a blinking manner, and at the same time, processing such as displaying a yellow frame on the LCD 10 is performed.

本実施例においては定点を以下の順序で設定する。   In this embodiment, the fixed points are set in the following order.

優先順位の高い登録された顔に対応する領域で位相差AF処理した結果、ステップS8で一度でも合焦可能と判定された場合は、優先順位の高い登録された顔に対応する領域で位相差AF処理した結果得られた最終の駆動目標位置を定点とする。   As a result of the phase difference AF process in the area corresponding to the registered face having a high priority, if it is determined that focusing is possible even once in step S8, the phase difference is detected in the area corresponding to the registered face having a high priority. The final drive target position obtained as a result of the AF process is set as a fixed point.

また、優先順位の低い登録された顔に対応する領域で位相差AF処理した結果、この領域でのみステップS8で一度でも合焦可能と判定される場合がある。この場合は、優先順位の低い登録された顔に対応する領域で位相差AF処理した結果得られた最終の駆動目標位置を定点とする。   Further, as a result of the phase difference AF process in the area corresponding to the registered face having a low priority order, it may be determined that focusing can be performed only once in this area in step S8. In this case, the final drive target position obtained as a result of the phase difference AF process in the area corresponding to the registered face having a low priority is set as a fixed point.

登録された顔に対応する領域で位相差AF処理の結果、ステップS8で全て合焦不可能と判定された場合は、例えば無限遠に合焦する位置等あらかじめ定められた位置を定点とする。   As a result of the phase difference AF processing in the area corresponding to the registered face, if it is determined in step S8 that all in-focus is impossible, for example, a predetermined position such as a position focusing on infinity is set as a fixed point.

その後ステップS15におけるSW2(レリーズスイッチの第二ストローク)の確認、ステップS16における実際の露光処理を実行する。   After that, confirmation of SW2 (second stroke of the release switch) in step S15 and actual exposure processing in step S16 are executed.

なお、風景撮影など人物撮影以外の場合や、人物撮影でも何らかの理由で顔が検出されなかった場合は、AF領域を画面中央部に大きさが水平垂直とも画面の18%程度に相当する領域としてもよい。あるいは、被写体が人物以外である場合、AF領域を検出された大きさに合わせるようにしてもよい。またこれらの場合はステップS9等の顔検出結果を用いた処理は行わない。ステップS9ではレンズの至近側もしくは遠側のいずれかの端位置に駆動し、ステップS7aでは信頼性のある位相差AF処理結果が得られるか否かで制御を切り替えるようにする。   In cases other than portrait photography, such as landscape photography, or when a face is not detected for some reason even in portrait photography, the AF area is an area equivalent to about 18% of the screen in both the horizontal and vertical sizes. Also good. Alternatively, when the subject is other than a person, the AF area may be adjusted to the detected size. In these cases, the process using the face detection result in step S9 or the like is not performed. In step S9, the lens is driven to an end position on either the near side or the far side of the lens, and in step S7a, control is switched depending on whether or not a reliable phase difference AF processing result is obtained.

この場合のステップS4aにおけるAF領域の範囲の拡大は以下のように行う。   In this case, the range of the AF area in step S4a is expanded as follows.

まずは手振れによる顔領域の水平方向の変位量xs・垂直方向の変位量ysを顔が検出された場合と同様にして求める。   First, the horizontal displacement amount xs and the vertical displacement amount ys of the face region due to camera shake are obtained in the same manner as when a face is detected.

次いで被写体が近づく場合の光軸方向の被写体移動による領域の拡大量を求める。   Next, an enlargement amount of the region due to movement of the subject in the optical axis direction when the subject approaches is obtained.

3回以上のデフォーカス量の検出結果があれば二次関数で被写体の動きを近似し、その関数の時刻に関する変数に位相差AF処理の行われる間隔tpから得られる位相差AF処理のタイミングを代入する。これにより、次の位相差AF処理時のフォーカスレンズ群3の位置を知ることが出来る(第3の検出手段)。このフォーカスレンズ群3の位置から被写体の像倍率変化を予想し、その分位相差AF処理を行う領域を拡大する。   If there is a detection result of the defocus amount three times or more, the motion of the subject is approximated by a quadratic function, and the phase difference AF processing timing obtained from the interval tp at which the phase difference AF processing is performed is set as a variable related to the time of the function. substitute. Thereby, the position of the focus lens group 3 at the time of the next phase difference AF processing can be known (third detection means). A change in the image magnification of the subject is predicted from the position of the focus lens group 3, and an area for performing the phase difference AF process is enlarged accordingly.

位相差AF処理を行いデフォーカス量を検出した時点と次の位相差AF処理の時点でのフォーカスレンズ群3の位置p1・p2とする。この場合、フォーカスレンズ群3の位置p1・p2から被写体距離L1・L2が計算されるとすると、次の位相差AF処理時の画面上の被写体領域の水平方向の変化量ΔASh及び垂直方向の変化量ΔASvは、以下のように求められる。
ΔASh=ASh(L1)×{(L1×p2)/(L2×p1)−1}
ΔASv=ASv(L1)×{(L1×p2)/(L2×p1)−1}
ここで、ASh(L1)、ASv(L1)はそれぞれデフォーカス量を検出した時点の画面上にAF領域の水平方向の大きさ及び垂直方向の大きさである。
The positions p1 and p2 of the focus lens group 3 at the time when the phase difference AF process is performed and the defocus amount is detected and the next phase difference AF process are set. In this case, assuming that the subject distances L1 and L2 are calculated from the positions p1 and p2 of the focus lens group 3, the amount of change ΔASh in the horizontal direction and the change in the vertical direction of the subject area on the screen during the next phase difference AF process The amount ΔASv is obtained as follows.
ΔASh = ASh (L1) × {(L1 × p2) / (L2 × p1) −1}
ΔASv = ASv (L1) × {(L1 × p2) / (L2 × p1) −1}
Here, Ash (L1) and ASv (L1) are respectively the horizontal size and vertical size of the AF area on the screen when the defocus amount is detected.

そして撮像面内で被写体が移動している場合は、CPU15においてAF領域での動きベクトルを求める事で、画面上の動き量を検出する。   When the subject is moving within the imaging plane, the CPU 15 detects the motion vector in the AF area by detecting the motion vector in the AF area.

デフォーカス量を検出した時点での水平方向及び垂直方向それぞれの動きベクトル検出量Δmvh,Δmvvが、次の位相差AF処理時の撮像面内での移動による被写体領域の水平方向及び垂直方向の変化量となる。   The motion vector detection amounts Δmvh, Δmvv in the horizontal direction and the vertical direction at the time when the defocus amount is detected change in the horizontal direction and the vertical direction of the subject area due to the movement in the imaging surface during the next phase difference AF processing. Amount.

このようにして求めた各要因による被写体領域の水平方向の変化量から水平方向の予測移動範囲xlp、xrpは、以下のようになる。   The predicted movement ranges xlp and xrp in the horizontal direction from the amount of change in the horizontal direction of the subject area due to each factor thus obtained are as follows.

xlp=xl―√{(xs+ΔASh/2+Δmvh/2)・(xs+ΔASh/2+Δmvh/2)}
xrp=xr+√{(xs+ΔASh/2+Δmvh/2)・(xs+ΔASh/2+Δmvh/2)}
そして拡大前の設定値が図4のステップS405において水平所定値に設定され、かつその範囲内に上記のxlp、xrpが含まれていない場合は、xlp〜xrpに水平方向のAF領域の範囲を拡大する。同様に、拡大前の設定値が図4のステップS404において顔の水平方向範囲に設定された場合も、xlp〜xrpに水平方向のAF領域の範囲を拡大する。
xlp = xl−√ {(xs + ΔASh / 2 + Δmvh / 2) · (xs + ΔASh / 2 + Δmvh / 2)}
xrp = xr + √ {(xs + ΔASh / 2 + Δmvh / 2) · (xs + ΔASh / 2 + Δmvh / 2)}
If the set value before enlargement is set to a predetermined horizontal value in step S405 in FIG. 4 and the above xlp and xrp are not included in the range, the range of the horizontal AF area is set to xlp to xrp. Expanding. Similarly, when the setting value before enlargement is set in the horizontal range of the face in step S404 in FIG. 4, the range of the horizontal AF area is enlarged from xlp to xrp.

そして、RMS値(√{(ys+ΔASv/2+Δmvv/2)・(ys+ΔASv/2+Δmvv/2)})が所定値を超えた場合にAF領域の垂直方向の範囲の拡大を行う。   When the RMS value (√ {(ys + ΔASv / 2 + Δmvv / 2) · (ys + ΔASv / 2 + Δmvv / 2)}) exceeds a predetermined value, the range in the vertical direction of the AF area is expanded.

実際に拡大する量yaddと垂直方向の顔の予測移動範囲yup、ybpはステップS4と同様に計算される。   The amount yadd to be actually enlarged and the predicted movement ranges yup and ybp in the vertical direction are calculated in the same manner as in step S4.

但し、Δmvh・Δmvvに関しては移動方向にのみ拡大するので移動と反対方向のものの値は零とする。   However, since Δmvh · Δmvv is enlarged only in the movement direction, the value in the direction opposite to the movement is set to zero.

また拡大量は手振れ量に応じたAF領域の拡大の場合と同様に、ΔAShの二乗やΔASvの二乗に拡大量が比例するなど、その大きさに応じて拡大量を変更しても良い。   Further, the enlargement amount may be changed according to the size, for example, the enlargement amount is proportional to the square of ΔASh or the square of ΔASv, as in the case of the enlargement of the AF area according to the camera shake amount.

このようにすることにより、手振れや被写体の移動によって被写体の存在する画面上の位置が変わることによって生じる被写体の一部、特にコントラストの高い部分の消失を防ぐ事ができるので、常に安定した焦点調節動作が可能になる。   By doing this, it is possible to prevent the disappearance of a part of the subject, especially the high contrast part, caused by the change of the position on the screen where the subject exists due to camera shake or movement of the subject. Operation becomes possible.

実施例1〜実施例2はコンパクトタイプのデジタルカメラ等からなる撮像装置1による静止画撮影を例に説明した。しかしながら、本発明は、デジタルビデオカメラでの動画撮影やデジタル一眼レフのライブビュー時・携帯端末のカメラ機能を用いた際等のAFに適用可能である。また動画撮影の場合は、AFが不可能な場合はフォーカスレンズを動かさないなど静止画の場合とは異なる処理が必要な場合がある。   The first to second embodiments have been described by taking still image shooting by the imaging apparatus 1 including a compact digital camera as an example. However, the present invention can be applied to AF when shooting a moving image with a digital video camera, a live view of a digital single lens reflex camera, or using a camera function of a mobile terminal. In the case of moving image shooting, a process different from that for a still image may be required, such as not moving the focus lens when AF is impossible.

以上、本発明をその好適な実施形態に基づいて詳述してきたが、本発明はこれら特定の実施形態に限られるものではなく、この発明の要旨を逸脱しない範囲の様々な形態も本発明に含まれる。上述の実施形態の一部を適宜組み合わせてもよい。また、上述の実施形態の機能を実現するソフトウェアのプログラムを、記録媒体から直接、或いは有線/無線通信を用いてプログラムを実行可能なコンピュータを有するシステム又は装置に供給し、そのプログラムを実行する場合も本発明に含む。従って、本発明の機能処理をコンピュータで実現するために、該コンピュータに供給、インストールされるプログラムコード自体も本発明を実現するものである。つまり、本発明の機能処理を実現するためのコンピュータプログラム自体も本発明に含まれる。その場合、プログラムの機能を有していれば、オブジェクトコード、インタプリタにより実行されるプログラム、OステップSに供給するスクリプトデータ等、プログラムの形態を問わない。プログラムを供給するための記録媒体としては、例えば、ハードディスク、磁気テープ等の磁気記録媒体、光/光磁気記憶媒体、不揮発性の半導体メモリでもよい。また、プログラムの供給方法としては、コンピュータネットワーク上のサーバに本発明を形成するコンピュータプログラムを記憶し、接続のあったクライアントコンピュータがコンピュータプログラムをダウンロードしてプログラムするような方法も考えられる。   Although the present invention has been described in detail based on preferred embodiments thereof, the present invention is not limited to these specific embodiments, and various forms within the scope of the present invention are also included in the present invention. included. A part of the above-described embodiments may be appropriately combined. Also, when a software program that realizes the functions of the above-described embodiments is supplied from a recording medium directly to a system or apparatus having a computer that can execute the program using wired / wireless communication, and the program is executed Are also included in the present invention. Accordingly, the program code itself supplied and installed in the computer in order to implement the functional processing of the present invention by the computer also realizes the present invention. That is, the computer program itself for realizing the functional processing of the present invention is also included in the present invention. In this case, the program may be in any form, such as an object code, a program executed by an interpreter, or script data supplied to the O step S as long as it has a program function. As a recording medium for supplying the program, for example, a magnetic recording medium such as a hard disk or a magnetic tape, an optical / magneto-optical storage medium, or a nonvolatile semiconductor memory may be used. As a program supply method, a computer program that forms the present invention is stored in a server on a computer network, and a connected client computer downloads and programs the computer program.

1 撮像装置
3 フォーカスレンズ群
5 撮像素子(センサ)
6 撮像回路
14 スキャンAF処理回路
15 CPU
18 第一モータ駆動回路
22 フォーカス駆動モータ
36 被写体検出回路
37 位相差AF処理回路
DESCRIPTION OF SYMBOLS 1 Imaging device 3 Focus lens group 5 Imaging element (sensor)
6 Imaging circuit 14 Scan AF processing circuit 15 CPU
18 First motor drive circuit 22 Focus drive motor 36 Subject detection circuit 37 Phase difference AF processing circuit

Claims (16)

位相差AF方式によりデフォーカス量を検出する焦点検出手段と、
前記デフォーカス量に基づき撮影光学系を駆動させて焦点位置を調節する焦点調節手段と、
被写体を含む領域を検出する第1の検出手段と、
前記検出された領域及び前記撮影光学系の焦点距離に基づいてデフォーカス量を推定する推定手段と、
前記焦点検出手段におけるAF領域の水平方向の範囲を、前記推定されたデフォーカス量に応じて設定する設定手段とを備えることを特徴とする焦点調節装置。
Focus detection means for detecting the defocus amount by the phase difference AF method;
Focus adjusting means for adjusting the focal position by driving the photographing optical system based on the defocus amount;
First detecting means for detecting a region including a subject;
Estimating means for estimating a defocus amount based on the detected area and a focal length of the photographing optical system;
A focus adjustment apparatus comprising: setting means for setting a horizontal range of the AF area in the focus detection means in accordance with the estimated defocus amount.
前記焦点調節手段による焦点位置の調節中に前記推定手段は前記デフォーカス量を再推定し、前記再推定されたデフォーカス量に応じて前記AF領域の水平方向の範囲を狭くすることを特徴とする請求項1記載の焦点調節装置。   During the adjustment of the focus position by the focus adjustment unit, the estimation unit re-estimates the defocus amount, and narrows the horizontal range of the AF area according to the re-estimated defocus amount. The focus adjusting apparatus according to claim 1. 前記デフォーカス量の検出に用いられる画像信号の信頼性を判定する第1の判定手段を更に備え、
前記設定手段は、前記AF領域の垂直方向の大きさを、前記判定された信頼性に基づき設定することを特徴とする請求項1記載の焦点調節装置。
A first determination unit for determining reliability of an image signal used for detecting the defocus amount;
The focus adjustment apparatus according to claim 1, wherein the setting unit sets the vertical size of the AF area based on the determined reliability.
前記焦点調節手段による焦点位置の調節中に、前記第1の判定手段は前記信頼性を再判定し、前記再判定された信頼性に応じて前記AF領域の垂直方向の範囲を狭くすることを特徴とする請求項3記載の焦点調節装置。   During the adjustment of the focus position by the focus adjustment unit, the first determination unit re-determines the reliability, and narrows the vertical range of the AF area according to the re-determination reliability. 4. The focus adjustment apparatus according to claim 3, wherein 前記焦点検出手段により検出されたデフォーカス量のうち、前記推定されたデフォーカス量との差分が最小のもの選択することを特徴とする請求項1乃至4のいずれか1項に記載の焦点調節装置。   5. The focus adjustment according to claim 1, wherein a defocus amount detected by the focus detection unit is selected with a minimum difference from the estimated defocus amount. 6. apparatus. 前記焦点検出手段により検出されたデフォーカス量に基づいて前記焦点調節手段による前記撮影光学系の駆動目標位置を算出する第1の算出手段と、
以前に算出された前記駆動目標位置を保持する保持手段と、
前記算出された駆動目標位置と、前記以前に算出された駆動目標位置との差分が小さい程、前記位相差AF方式により検出されたデフォーカス量の妥当性が高いと判定する第2の判定手段とを更に備えることを特徴とする請求項1乃至5のいずれか1項に記載の焦点調節装置。
First calculation means for calculating a drive target position of the photographing optical system by the focus adjustment means based on a defocus amount detected by the focus detection means;
Holding means for holding the previously calculated driving target position;
Second determination means for determining that the defocus amount detected by the phase difference AF method is higher as the difference between the calculated drive target position and the previously calculated drive target position is smaller. The focus adjustment apparatus according to claim 1, further comprising:
前記以前に算出された駆動目標位置が前記保持手段に複数の駆動目標位置が存在する場合、前記複数の駆動目標位置により加重平均値を算出する第2の算出手段を更に備え、
前記第2の判定手段は、前記駆動目標位置と、前記算出された加重平均値の差分が小さい程、前記位相差AF方式により検出されたデフォーカス量の妥当性が高いと判定することを特徴とする請求項6記載の焦点調節装置。
A second calculating means for calculating a weighted average value based on the plurality of driving target positions when the previously calculated driving target position includes a plurality of driving target positions in the holding means;
The second determination means determines that the smaller the difference between the drive target position and the calculated weighted average value is, the higher the defocus amount detected by the phase difference AF method is. The focus adjusting apparatus according to claim 6.
前記保持手段は、前記第2の判定手段により妥当性が高いと判定されたデフォーカス量に基づき算出された駆動目標位置を、前記以前に算出された駆動目標位置として保持し、
前記第2の判定手段により妥当性が高いと判定されたデフォーカス量が単調減少していない場合、前記複数の駆動目標位置を前記第2の判定手段による前記位相差AF方式により検出されたデフォーカス量の妥当性の判定に用いないようにすることを特徴とする請求項7記載の焦点調節装置。
The holding unit holds the drive target position calculated based on the defocus amount determined to be highly valid by the second determination unit as the previously calculated drive target position;
When the defocus amount determined to be highly valid by the second determination unit has not monotonously decreased, the plurality of drive target positions are detected by the phase difference AF method detected by the second determination unit. 8. The focus adjusting apparatus according to claim 7, wherein the focus adjusting apparatus is not used for determining the validity of the focus amount.
優先順位を付けて複数の被写体の情報を登録する登録手段を更に備え、
前記複数の被写体のうち前記優先順位の高い被写体を含む領域において焦点調節動作を完了できない場合、前記優先順位の低い被写体を含む領域において焦点調節動作を完了させることを特徴とする請求項1乃至8のいずれか1項に記載の焦点調節装置。
A registration unit for registering information on a plurality of subjects with priorities;
9. The focus adjustment operation is completed in a region including the low priority subject when the focus adjustment operation cannot be completed in a region including the high priority subject among the plurality of subjects. The focus adjusting apparatus according to any one of the above.
手振れ量を検出する第2の検出手段を更に備え、
手振れが生じている場合は、前記第2の検出手段により検出された手振れ量が大きくなるにつれて水平方向または垂直方向について前記AF領域を拡大することを特徴とする請求項9記載の焦点調節装置。
A second detecting means for detecting the amount of camera shake;
10. The focus adjustment apparatus according to claim 9, wherein when camera shake occurs, the AF area is expanded in the horizontal direction or the vertical direction as the amount of camera shake detected by the second detection unit increases.
光軸方向の前記被写体の移動量及び移動方向を検出する第3の検出手段を更に備え、
前記被写体が光軸方向に近づいてくる場合は、前記第3の検出手段により検出された移動量が大きくなるにつれて水平方向及び垂直方向について前記AF領域を拡大することを特徴とする請求項9記載の焦点調節装置。
A third detecting means for detecting the moving amount and moving direction of the subject in the optical axis direction;
The AF area is expanded in the horizontal direction and the vertical direction as the amount of movement detected by the third detection unit increases when the subject approaches the optical axis direction. Focusing device.
撮像画面内の前記被写体の移動量及び移動方向を検出する第4の検出手段を更に備え、
前記撮像画面内で前記被写体が移動する場合は、前記第4の検出手段により検出された移動量が大きくなるにつれて前記AF領域を水平または垂直の移動方向に拡大することを特徴とする請求項9記載の焦点調節装置。
A fourth detecting means for detecting a moving amount and a moving direction of the subject in the imaging screen;
The AF area is expanded in a horizontal or vertical movement direction as the movement amount detected by the fourth detection unit increases when the subject moves in the imaging screen. The focusing device as described.
被写体を含む領域を検出する第1の検出ステップと、
前記検出された領域及び撮影光学系の焦点距離に基づいてデフォーカス量を推定する推定ステップと、
位相差AF方式によりデフォーカス量を検出する際のAF領域の水平方向の範囲を、前記推定されたデフォーカス量に応じて設定する設定ステップと、
前記位相差AF方式により検出されたデフォーカス量に基づき前記撮影光学系を駆動させて焦点位置を調節する焦点調節ステップとを有することを特徴とする制御方法。
A first detection step of detecting a region including a subject;
An estimation step of estimating a defocus amount based on the detected area and a focal length of the photographing optical system;
A setting step of setting a horizontal range of the AF area when detecting the defocus amount by the phase difference AF method according to the estimated defocus amount;
And a focus adjustment step of adjusting the focal position by driving the imaging optical system based on the defocus amount detected by the phase difference AF method.
請求項13の制御方法を実行することを特徴とするプログラム。   A program for executing the control method according to claim 13. 撮影光学系の異なる瞳領域を通過した光束を光電変換して、一対の焦点検出用信号を出力することが可能な複数の画素から成る撮像素子と、
前記撮像素子からの出力に基づいて、位相差AF方式によりデフォーカス量を検出する焦点検出手段と、
前記デフォーカス量に基づき撮影光学系を駆動させて焦点位置を調節する焦点調節手段と、
被写体を含む領域を検出する第1の検出手段と、
前記検出された領域及び前記撮影光学系の焦点距離に基づいてデフォーカス量を推定する推定手段と、
前記焦点検出手段におけるAF領域の水平方向の範囲を、前記推定されたデフォーカス量に応じて設定する設定手段とを備えることを特徴とする撮像装置。
An image sensor comprising a plurality of pixels capable of photoelectrically converting a light beam that has passed through different pupil regions of the photographing optical system and outputting a pair of focus detection signals;
A focus detection means for detecting a defocus amount by a phase difference AF method based on an output from the image sensor;
Focus adjusting means for adjusting the focal position by driving the photographing optical system based on the defocus amount;
First detecting means for detecting a region including a subject;
Estimating means for estimating a defocus amount based on the detected area and a focal length of the photographing optical system;
An imaging apparatus comprising: setting means for setting a horizontal range of the AF area in the focus detection means in accordance with the estimated defocus amount.
優先順位を付けて複数の被写体の情報を登録する登録手段を更に備え、
前記複数の被写体のうち前記優先順位の高い被写体を含む領域において焦点調節動作を完了できない場合、前記優先順位の低い被写体を含む領域において焦点調節動作を完了させた後、前記優先順位の高い被写体を含む領域をも合焦と見なせる焦点深度となるように絞り値を設定することを特徴とする請求項15記載の撮像装置。
A registration unit for registering information on a plurality of subjects with priorities;
If the focus adjustment operation cannot be completed in the region including the high priority subject among the plurality of subjects, the focus adjustment operation is completed in the region including the low priority subject, and then the high priority subject is selected. The imaging apparatus according to claim 15, wherein the aperture value is set so that a focal depth at which a region to be included can be regarded as in-focus is obtained.
JP2017008579A 2017-01-20 2017-01-20 Focus detector, its control method and program, and imaging device Active JP6858022B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017008579A JP6858022B2 (en) 2017-01-20 2017-01-20 Focus detector, its control method and program, and imaging device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017008579A JP6858022B2 (en) 2017-01-20 2017-01-20 Focus detector, its control method and program, and imaging device

Publications (3)

Publication Number Publication Date
JP2018116225A true JP2018116225A (en) 2018-07-26
JP2018116225A5 JP2018116225A5 (en) 2020-02-27
JP6858022B2 JP6858022B2 (en) 2021-04-14

Family

ID=62984167

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017008579A Active JP6858022B2 (en) 2017-01-20 2017-01-20 Focus detector, its control method and program, and imaging device

Country Status (1)

Country Link
JP (1) JP6858022B2 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008052225A (en) * 2006-08-28 2008-03-06 Olympus Imaging Corp Camera, focus control method, and program
JP2013072906A (en) * 2011-09-27 2013-04-22 Canon Inc Imaging apparatus
WO2013061939A1 (en) * 2011-10-26 2013-05-02 オリンパス株式会社 Endoscopic device and focus control method
JP2016057463A (en) * 2014-09-09 2016-04-21 キヤノン株式会社 Focus adjustment device and control method of the same
JP2016224277A (en) * 2015-05-29 2016-12-28 キヤノン株式会社 Image pickup apparatus, and control method for the same

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008052225A (en) * 2006-08-28 2008-03-06 Olympus Imaging Corp Camera, focus control method, and program
JP2013072906A (en) * 2011-09-27 2013-04-22 Canon Inc Imaging apparatus
WO2013061939A1 (en) * 2011-10-26 2013-05-02 オリンパス株式会社 Endoscopic device and focus control method
JP2016057463A (en) * 2014-09-09 2016-04-21 キヤノン株式会社 Focus adjustment device and control method of the same
JP2016224277A (en) * 2015-05-29 2016-12-28 キヤノン株式会社 Image pickup apparatus, and control method for the same

Also Published As

Publication number Publication date
JP6858022B2 (en) 2021-04-14

Similar Documents

Publication Publication Date Title
US9426350B2 (en) Image capturing apparatus and control method thereof
JP4674471B2 (en) Digital camera
US7747159B2 (en) Focusing device and image-capturing device provided with the same
US9083881B2 (en) Focus adjustment apparatus and focus adjustment method
JP7086571B2 (en) Image pickup device, lens device and control method thereof
US8447179B2 (en) Method and apparatus for applying multi-autofocusing (AF) using contrast AF
JP6518452B2 (en) Imaging apparatus and imaging method
US10187564B2 (en) Focus adjustment apparatus, imaging apparatus, focus adjustment method, and recording medium storing a focus adjustment program thereon
JP2012049773A (en) Imaging apparatus and method, and program
US20150172595A1 (en) Image processing apparatus capable of movie recording, image pickup apparatus, control method therefor, and storage medium
JP5100410B2 (en) Imaging apparatus and control method thereof
JP2006091915A (en) Imaging apparatus
US8737831B2 (en) Digital photographing apparatus and method that apply high-speed multi-autofocusing (AF)
JP2015152742A (en) Imaging device and control method thereof
JP6501536B2 (en) Imaging device, control method therefor, program, storage medium
JP2018006828A (en) Imaging apparatus, control method therefor and program
JP2011048265A (en) Focus detection device and focus detection method
JP4887840B2 (en) Imaging apparatus and program
JP6858022B2 (en) Focus detector, its control method and program, and imaging device
JP2015152830A (en) Imaging device and control method thereof, program, and storage medium
US11665438B2 (en) Electronic device capable of acquiring line-of-sight information
JP6346398B2 (en) Imaging apparatus and imaging method
JP4968389B2 (en) Imaging apparatus and program
JP6409083B2 (en) Imaging apparatus, imaging method, and imaging program
JP2023092143A (en) Image processing device, imaging apparatus, image processing method, program, and recording medium

Legal Events

Date Code Title Description
A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20200116

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200116

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20201106

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20201124

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210125

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20210222

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210323

R151 Written notification of patent or utility model registration

Ref document number: 6858022

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151