JP2012128287A - Focus detection device and focus detection method - Google Patents

Focus detection device and focus detection method Download PDF

Info

Publication number
JP2012128287A
JP2012128287A JP2010281052A JP2010281052A JP2012128287A JP 2012128287 A JP2012128287 A JP 2012128287A JP 2010281052 A JP2010281052 A JP 2010281052A JP 2010281052 A JP2010281052 A JP 2010281052A JP 2012128287 A JP2012128287 A JP 2012128287A
Authority
JP
Japan
Prior art keywords
face
focus
focus detection
frame
size
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
JP2010281052A
Other languages
Japanese (ja)
Other versions
JP5765931B2 (en
Inventor
Genshiro Shibaue
玄志郎 芝上
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 JP2010281052A priority Critical patent/JP5765931B2/en
Publication of JP2012128287A publication Critical patent/JP2012128287A/en
Application granted granted Critical
Publication of JP5765931B2 publication Critical patent/JP5765931B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

PROBLEM TO BE SOLVED: To solve such problems that, in a low illuminance or when a subject is a low contrast, an S/N ratio of an AF evaluation value is deteriorated to lower the focusing accuracy, or, when a subject looks away or the like and the subject and a background are mixed in an AF frame, the background may be omitted.SOLUTION: When the size of the detected face is smaller than a prescribed size, a focus detection device makes the AF frame set to a body region larger than the AF frame set to the position of the face. The AF frame set to the body region is horizontally divided with respect to the body according to the condition of the face, hence the plurality of AF frames are set.

Description

本発明は焦点調節機能を有するデジタルカメラなどに適用される焦点検出装置、および焦点検出方法に関するものである。   The present invention relates to a focus detection apparatus and a focus detection method applied to a digital camera or the like having a focus adjustment function.

従来から、電子スチルカメラやビデオカメラなどではオートフォーカス(以下、AFという)を行う場合、CCD(電荷結合素子)などを用いた撮像素子から得られる輝度信号の高域周波数成分が最大になるレンズ位置を合焦位置とする方式が用いられている。   Conventionally, when auto-focusing (hereinafter referred to as AF) is performed in an electronic still camera, a video camera, or the like, a lens that maximizes a high frequency component of a luminance signal obtained from an image sensor using a CCD (charge coupled device) or the like. A system in which the position is the in-focus position is used.

この方式の一つとして次のスキャン方式が知られている。焦点検出範囲においてレンズを移動させながら撮像素子内の焦点検出領域(以下、AF枠という)から得られる輝度信号の高域周波数成分に基づく評価値(以下、AF評価値と言う)をその都度に記憶していく。AF枠内のコントラストが高い、また、AF枠のサイズが大きい場合は、AF評価値は大きくなる。そして、記憶した値のうち、その極大値に相当するレンズ位置(以下、ピーク位置という)を合焦位置とするスキャン方式である。ここで、合焦位置とは被写体にピントがあうと想定されるレンズ位置のことである。   As one of these methods, the following scan method is known. Each time an evaluation value (hereinafter referred to as an AF evaluation value) based on a high frequency component of a luminance signal obtained from a focus detection area (hereinafter referred to as an AF frame) in the image sensor while moving the lens in the focus detection range. I will remember it. When the contrast in the AF frame is high and the size of the AF frame is large, the AF evaluation value becomes large. In the stored method, a lens position corresponding to the maximum value (hereinafter referred to as a peak position) is used as a focus position. Here, the in-focus position is a lens position where the subject is assumed to be in focus.

しかし、低照度の場合や被写体のコントラストが低い場合にはS/N比が悪化するため、ノイズの影響によってAF評価値の値がランダムに変動し、それに伴いAF評価値のピーク位置の算出精度も悪化するという問題がある。また、AF枠内に合焦させたい被写体(以下、主被写体という)と背景が混在する場合は、背景の影響によってピーク位置が遠側寄りになってしまうという問題もある。このような状況を背景抜けという。   However, since the S / N ratio deteriorates when the illumination is low or when the contrast of the subject is low, the AF evaluation value fluctuates randomly due to the influence of noise, and accordingly the calculation accuracy of the peak position of the AF evaluation value is increased. There is also the problem of getting worse. In addition, when a subject to be focused (hereinafter referred to as a main subject) and the background are mixed in the AF frame, there is a problem that the peak position becomes closer to the far side due to the influence of the background. This situation is called background loss.

そこで、S/N比の悪化による影響を抑える為の対策として特許文献1の方法が開示されている。特許文献1では、まず被写体の顔領域を含む領域や、顔内部の一部領域を含む領域、体領域を含む領域などにAF枠を設定する。そして、顔領域や、顔内部の一部領域を含む領域のAF評価値のレベルが低い場合においては、顔よりもコントラストが高いであろう体領域など含むAF枠でのピーク位置から合焦位置を決定する。   Therefore, the method of Patent Document 1 is disclosed as a countermeasure for suppressing the influence due to the deterioration of the S / N ratio. In Patent Document 1, first, an AF frame is set in an area including a face area of a subject, an area including a partial area inside the face, an area including a body area, or the like. When the level of the AF evaluation value of the face area or an area including a partial area inside the face is low, the in-focus position is determined from the peak position in the AF frame including the body area that may have a higher contrast than the face. decide.

また、背景抜けの影響を抑えるための対策として次の方法がある。被写体の顔の角度やサイズに応じて顔領域に設定するAF枠の傾きや形状を変えることにより、AF枠内に主被写体と背景が混在することを避ける特許文献2が開示されている。   In addition, there are the following methods as measures for suppressing the influence of background loss. Japanese Patent Application Laid-Open No. 2004-228867 discloses that the main subject and the background are prevented from being mixed in the AF frame by changing the inclination and shape of the AF frame set in the face area in accordance with the face angle and size of the subject.

特開2008−076786号公報JP 2008-077686 A 特開2007−034261号公報JP 2007-034261 A

しかし特許文献1においては、被写体が横を向くなどして、体領域に設定したAF枠に被写体と背景が混在してしまった場合は、背景抜けを起こしてしまう、という問題がある。   However, in Patent Document 1, there is a problem in that background missing occurs when the subject and the background are mixed in the AF frame set in the body region because the subject faces sideways.

また、特許文献2においては、顔は低コントラストである場合が多いので、顔の位置だけでAF評価値を取得するとS/Nが悪くなる、という問題がある。また、被写体小さい、もしくは遠くにいる場合などで、顔のサイズが小さくなると、その位置に設定するAF枠のサイズが小さくなり、それに伴いAF評価値が小さくなり、AFの合焦性能が悪化するという問題がある。   Further, in Patent Document 2, since the face often has a low contrast, there is a problem that the S / N is deteriorated when the AF evaluation value is acquired only from the position of the face. Also, when the size of the face is small, such as when the subject is small or far away, the size of the AF frame set at that position decreases, and the AF evaluation value decreases accordingly, and the AF focusing performance deteriorates. There is a problem.

本発明は上述した課題に鑑みてなされたものであり、その目的は、低照度時や被写体が低コントラスト時でのS/N比の悪化による影響および背景抜けの影響を軽減し合焦位置の精度を向上させることである。   The present invention has been made in view of the above-described problems, and an object of the present invention is to reduce the influence of the deterioration of the S / N ratio when the illuminance is low or when the subject is low contrast and the influence of background omission and the focus position. It is to improve accuracy.

上記目的を達成するために、本発明の技術的特徴としては、撮像画像から人物の顔が存在する位置とサイズを検出する顔検出工程と、撮像光学系の合焦状態を検出する際の焦点検出領域として、前記人物の顔が存在する第1の焦点検出領域と、前記人物の顔の位置から見て前記人物の体が位置すると予測される第2の焦点検出領域とを設定する設定工程と、前記焦点検出領域における信号出力に基づいて前記撮像光学系を移動させて焦点調節を行う焦点調節工程とを有し、前記設定工程では、前記顔検出工程により検出された顔のサイズが所定サイズよりも小さい場合、前記第2の焦点検出領域の大きさを前記第1の焦点検出領域の大きさよりも大きくなるように設定することを特徴とする。   In order to achieve the above object, the technical features of the present invention include a face detection step for detecting the position and size of a person's face from a captured image, and a focus for detecting the in-focus state of the imaging optical system. A setting step of setting a first focus detection area where the person's face is present and a second focus detection area where the person's body is predicted to be located when viewed from the position of the person's face as detection areas And a focus adjustment step of adjusting the focus by moving the imaging optical system based on a signal output in the focus detection region, and the setting step determines whether the face size detected by the face detection step is a predetermined size. When the size is smaller than the size, the size of the second focus detection region is set to be larger than the size of the first focus detection region.

また、別の本発明の技術的特徴としては、撮像画像から人物の顔が存在する位置を検出する顔検出工程と、撮像光学系の合焦状態を検出する際の焦点検出領域として、前記人物の顔が存在する第1の焦点検出領域と、前記人物の顔の位置から見て前記人物の体が位置すると予測される第2の焦点検出領域とを設定する設定工程と、前記焦点検出領域における信号出力に基づいて前記撮像光学系を移動させて焦点調節を行う焦点調節工程とを有し、前記設定工程では、前記第2の焦点検出領域を前記体に対して水平方向に分割して複数の焦点検出領域とすることを特徴とする。   Another technical feature of the present invention is that the person is used as a face detection step for detecting a position where a person's face is present from a captured image, and as a focus detection region when detecting the in-focus state of the imaging optical system. A setting step for setting a first focus detection area where the face of the person exists and a second focus detection area where the person's body is predicted to be located when viewed from the position of the face of the person; and the focus detection area A focus adjustment step of adjusting the focus by moving the imaging optical system based on the signal output in the step, and in the setting step, the second focus detection region is divided horizontally with respect to the body A plurality of focus detection areas are provided.

本発明によれば、低照度時・低コントラスト時のS/N比による悪化の影響および背景抜けの影響を軽減して合焦位置の精度を向上させることができる。   According to the present invention, it is possible to improve the accuracy of the in-focus position by reducing the influence of deterioration due to the S / N ratio at the time of low illuminance and low contrast and the influence of background loss.

本発明を適用した焦点調節装置の構成を示すブロック図である。It is a block diagram which shows the structure of the focus adjustment apparatus to which this invention is applied. AF動作を表すフローチャート図である。It is a flowchart figure showing AF operation. 図2における枠設定のサブルーチンを説明するフローチャート図である。FIG. 3 is a flowchart illustrating a frame setting subroutine in FIG. 2. 顔未検出時のAF枠設定を説明する図である。It is a figure explaining AF frame setting at the time of face non-detection. 顔検出時のカメラ横位置撮影時のAF枠設定を説明する図である。It is a figure explaining AF frame setting at the time of camera side position photography at the time of face detection. 顔検出時のカメラ横位置撮影時のAF枠設定を説明する図である。It is a figure explaining AF frame setting at the time of camera side position photography at the time of face detection. 顔検出時のカメラ横位置撮影時のAF枠設定を説明する図である。It is a figure explaining AF frame setting at the time of camera side position photography at the time of face detection. 顔検出時のカメラ横位置撮影時のAF枠設定を説明する図である。It is a figure explaining AF frame setting at the time of camera side position photography at the time of face detection. 顔検出時のカメラ横位置撮影時のAF枠設定を説明する図である。It is a figure explaining AF frame setting at the time of camera side position photography at the time of face detection. 顔検出時のカメラ縦位置撮影時のAF枠設定を説明する図である。It is a figure explaining AF frame setting at the time of camera vertical position photography at the time of face detection. 顔検出時のカメラ縦位置撮影時のAF枠設定を説明する図である。It is a figure explaining AF frame setting at the time of camera vertical position photography at the time of face detection. 顔検出時のカメラ縦位置撮影時のAF枠設定を説明する図である。It is a figure explaining AF frame setting at the time of camera vertical position photography at the time of face detection. 顔検出時のカメラ縦位置撮影時のAF枠設定を説明する図である。It is a figure explaining AF frame setting at the time of camera vertical position photography at the time of face detection. 顔検出時のカメラ縦位置撮影時のAF枠設定を説明する図である。It is a figure explaining AF frame setting at the time of camera vertical position photography at the time of face detection. 顔検出時のカメラ縦位置撮影時のAF枠設定を説明する図である。It is a figure explaining AF frame setting at the time of camera vertical position photography at the time of face detection. 顔検出時のカメラ縦位置撮影時のAF枠設定を説明する図である。It is a figure explaining AF frame setting at the time of camera vertical position photography at the time of face detection. 図2、12における合焦判定のサブルーチンを説明する図である。It is a figure explaining the subroutine of a focus determination in FIG. 図2における合焦位置の決定のサブルーチンを説明するフローチャート図である。FIG. 3 is a flowchart for explaining a subroutine for determining an in-focus position in FIG. 2. 図8における基準選択のサブルーチンを説明するフローチャート図である。FIG. 9 is a flowchart illustrating a reference selection subroutine in FIG. 8. 図9における大外れ時信頼性判定・中外れ時信頼性判定について説明する図である。It is a figure explaining the reliability determination at the time of big deviation in FIG. 9, and reliability determination at the time of middle deviation. 図8における枠選択のサブルーチンを説明するフローチャート図である。FIG. 9 is a flowchart for explaining a frame selection subroutine in FIG. 8. 図8における枠加算のサブルーチンを説明するフローチャート図である。FIG. 9 is a flowchart for explaining a frame addition subroutine in FIG. 8.

以下、図面を用いながら実施例を説明する。図1は本発明を適用した焦点調節装置の構成を示すブロック図である。   Embodiments will be described below with reference to the drawings. FIG. 1 is a block diagram showing a configuration of a focus adjusting apparatus to which the present invention is applied.

<装置の構成>
101はズーム機構を含む撮影レンズである。102は後述する撮像素子上に焦点をあわせるためのフォーカスレンズである。101、102は撮像光学系ともいう。103はAF処理部である。104は被写体からの反射光を電気信号に変換し撮像画像を出力する撮像素子である。105は撮像素子104の出力ノイズを除去するCDS回路やA/D変換前に行う非線形増幅回路を含むA/D変換部である。106は画像処理部である。この画像処理部を用いて、画像の所定領域における色情報などを取得することが可能である。107は撮影シーケンスなどシステムを制御するシステム制御部(以下CPUと記す)である。108は顔検出モードをONまたはOFFに切り替える等の設定を行う撮影モードスイッチである。109はシステムに電源を投入するためのメインスイッチ、110はAFやAE等の撮影スタンバイ動作を行うためのスイッチ(以下SW1と記す)である。111はSW1の操作後、撮影を行う撮影スイッチ(以下SW2と記す)である。112は前記画像処理部106で処理された画像信号を用いて顔検出を行い、検出した一つ又は複数の顔情報(位置・サイズ・信頼度)をCPU107に送る顔検出モジュールである。なお、顔の検出方法は、本発明の主眼点ではないため詳細な説明は省略する。
<Device configuration>
Reference numeral 101 denotes a photographing lens including a zoom mechanism. Reference numeral 102 denotes a focus lens for focusing on an image sensor described later. Reference numerals 101 and 102 are also referred to as imaging optical systems. Reference numeral 103 denotes an AF processing unit. An image sensor 104 converts reflected light from the subject into an electrical signal and outputs a captured image. Reference numeral 105 denotes an A / D converter including a CDS circuit that removes output noise from the image sensor 104 and a non-linear amplifier circuit that is executed before A / D conversion. Reference numeral 106 denotes an image processing unit. Using this image processing unit, it is possible to acquire color information and the like in a predetermined area of the image. Reference numeral 107 denotes a system control unit (hereinafter referred to as CPU) that controls the system such as a photographing sequence. Reference numeral 108 denotes a shooting mode switch for performing settings such as switching the face detection mode to ON or OFF. Reference numeral 109 denotes a main switch for turning on power to the system, and reference numeral 110 denotes a switch (hereinafter referred to as SW1) for performing a shooting standby operation such as AF or AE. Reference numeral 111 denotes a photographing switch (hereinafter referred to as SW2) that performs photographing after the operation of SW1. A face detection module 112 performs face detection using the image signal processed by the image processing unit 106 and sends one or more pieces of detected face information (position / size / reliability) to the CPU 107. Since the face detection method is not the main point of the present invention, detailed description thereof is omitted.

113は、前記画像処理部106で処理された画像信号の色情報や輝度情報をもとに、検出した一つまたは複数の被写体情報(位置・サイズ・信頼度)をCPU107に送る被写体検出部である。なお、被写体の検出方法は、本発明の主眼点ではないため詳細な説明は省略する。   A subject detection unit 113 sends one or more pieces of detected subject information (position / size / reliability) to the CPU 107 based on color information and luminance information of the image signal processed by the image processing unit 106. is there. It should be noted that the subject detection method is not the main point of the present invention and will not be described in detail.

114は、カメラ自体の角速度を検出してカメラ動き情報をCPU107に送る角速度センサ部である。この角速度センサ部を用いてカメラの構え方が縦位置の状態で構えられているのか、横位置の状態で構えられているのかを検出することも可能である。115は、カメラ自体の加速度を検出してカメラの動き情報をCPU107に送る加速度センサ部である。この加速度センサ部を用いて、カメラが撮影レンズ101が上向きに構えられているのか、撮影レンズ101が下向きに構えられているのかを検出することも可能である。116は、高速な内蔵メモリ(例えばランダムアクセスメモリなど、以下DRAMと記す)である。117は画像表示の他、操作補助のための表示やカメラ状態の表示の他、撮影時には撮影画面とAF枠を表示する操作表示部である。   An angular velocity sensor unit 114 detects the angular velocity of the camera itself and sends camera motion information to the CPU 107. It is also possible to detect whether the camera is held in a vertical position or a horizontal position by using the angular velocity sensor unit. An acceleration sensor unit 115 detects the acceleration of the camera itself and sends camera movement information to the CPU 107. Using this acceleration sensor unit, the camera can detect whether the taking lens 101 is held upward or whether the taking lens 101 is held downward. Reference numeral 116 denotes a high-speed built-in memory (for example, a random access memory, hereinafter referred to as a DRAM). Reference numeral 117 denotes an operation display unit that displays not only an image display but also a display for assisting operation and a display of a camera state, and a shooting screen and an AF frame at the time of shooting.

<AF動作>
次に、図2のフローチャートを用いて、本発明の電子カメラでの顔検出時のAF動作について説明する。
<AF operation>
Next, the AF operation at the time of face detection by the electronic camera of the present invention will be described using the flowchart of FIG.

ステップS201では、顔検出モジュール112から得られる顔情報(位置・大きさ・顔の検出数)に基づきAF枠を設定する。ステップS201の手順については、図3から図6を用いて後述する。   In step S201, an AF frame is set based on the face information (position, size, number of detected faces) obtained from the face detection module 112. The procedure of step S201 will be described later with reference to FIGS.

ステップS202では、ステップS201で設定した各AF枠でAFスキャンを行い、ステップS203へと進む。AFスキャンでは、フォーカスレンズ102をスキャン開始位置からスキャン終了位置まで所定量ずつ移動させながら、各フォーカスレンズ位置におけるAF評価値をCPU107へ記憶していく。例えば、スキャン開始位置を無限遠、スキャン終了位置をAFスキャン可能な範囲の至近端とする。   In step S202, AF scanning is performed with each AF frame set in step S201, and the process proceeds to step S203. In the AF scan, the AF evaluation value at each focus lens position is stored in the CPU 107 while moving the focus lens 102 by a predetermined amount from the scan start position to the scan end position. For example, the scan start position is set to infinity, and the scan end position is set to the closest end of the range where AF scanning is possible.

ステップS203では、ステップS202で得られたAF評価値のピーク位置を演算により求めて、ステップS204へと進む。   In step S203, the peak position of the AF evaluation value obtained in step S202 is obtained by calculation, and the process proceeds to step S204.

ステップS204では各AF枠のピーク位置の合焦判定を行い、ステップS205へ進む。ステップS204の手順については、図7を用いて後述する。   In step S204, focus determination of the peak position of each AF frame is performed, and the process proceeds to step S205. The procedure of step S204 will be described later with reference to FIG.

ステップS205では、顔が検出されている場合は、顔領域に設定したAF枠(以下、顔枠と記す)のピーク位置および検出した顔のサイズに基づいて算出した推定距離のうちから基準位置を選択する。そして、基準位置と各AF枠のピーク位置を照合して合焦位置の決定を行い、ステップS206へ進む。ステップS205の手順については図8を用いて後述する。   In step S205, if a face is detected, a reference position is determined from the estimated distance calculated based on the peak position of the AF frame (hereinafter referred to as a face frame) set in the face area and the detected face size. select. Then, the focus position is determined by comparing the reference position with the peak position of each AF frame, and the process proceeds to step S206. The procedure of step S205 will be described later with reference to FIG.

顔が検出されていない場合は、ステップS201の手順で後述するが、画面内の所定領域にAF枠を設定する。その時の合焦判定や、合焦位置の決定などは本発明の主眼点ではないため説明は省略する。   If no face is detected, an AF frame is set in a predetermined area in the screen, as will be described later in the procedure of step S201. The focus determination at that time, determination of the focus position, and the like are not the main points of the present invention and will not be described.

ステップS206では、ステップS205で合焦位置が決定したかどうかを調べ、合焦位置が決定していればステップS207へ、合焦位置が決定していなければステップS209へ進む。   In step S206, it is checked whether or not the focus position has been determined in step S205. If the focus position has been determined, the process proceeds to step S207, and if the focus position has not been determined, the process proceeds to step S209.

ステップS207ではステップS205で決定した合焦位置にフォーカスレンズ102を移動させてステップS208へ進む。   In step S207, the focus lens 102 is moved to the in-focus position determined in step S205, and the process proceeds to step S208.

ステップS208では、操作表示部117の画像表示部に、合焦枠を表示してAF動作を終了する。ここで、合焦枠とは画像領域内でどこの領域が合焦しているかを示すための枠である。例えば、顔が合焦している場合は顔の領域に枠を表示する。また、合焦しているという状態が判別しやすいように枠に合焦を示す色(例えば緑色など)をつけて表示する。   In step S208, the focusing frame is displayed on the image display unit of the operation display unit 117, and the AF operation is terminated. Here, the in-focus frame is a frame for indicating which region in the image region is in focus. For example, when the face is in focus, a frame is displayed in the face area. In addition, the frame is displayed with an in-focus color (for example, green) so that the state of being in focus can be easily identified.

ステップS209は、フォーカスレンズ102をステップS205で決定した基準位置へ移動させ、ステップS210へ進む。   In step S209, the focus lens 102 is moved to the reference position determined in step S205, and the process proceeds to step S210.

ステップS210では、操作表示部117の画像表示部に、非合焦枠を表示してAF動作を終了する。ここで、非合焦枠とは非合焦時に画像領域内で被写体の存在する領域または所定の領域に表示する枠であり、非合焦しているという状態が判別しやすいように合焦枠とは異なる色の枠(例えば黄色など)を設定する。   In step S210, an in-focus frame is displayed on the image display unit of the operation display unit 117, and the AF operation is terminated. Here, the out-of-focus frame is a frame that is displayed in a region where a subject is present or a predetermined region in the image region at the time of out-of-focus, so that it can be easily discriminated that it is out of focus. A frame of a color different from (for example, yellow) is set.

<枠設定>
次に、図3のフローチャート、並びに、図4から図6を用いて、図2のステップS201におけるAF枠設定について説明する。
<Frame setting>
Next, the AF frame setting in step S201 of FIG. 2 will be described with reference to the flowchart of FIG. 3 and FIGS.

ステップS301では、顔検出モジュール112から得られる顔情報(位置・大きさ・顔の検出数)から、顔が検出されたかを調べ、顔が検出されていなければ、ステップS302へ進み、顔が検出されていれば、ステップS303へ進む。
ステップS302では、画面の所定範囲に、所定数のAF枠を設定する。
In step S301, it is checked whether or not a face has been detected from the face information (position, size, and number of detected faces) obtained from the face detection module 112. If no face has been detected, the process proceeds to step S302 to detect the face. If so, the process proceeds to step S303.
In step S302, a predetermined number of AF frames are set in a predetermined range of the screen.

例えば、図4のように、画面中央部に、画面に対して縦方向に、横方向に3つずつのAF枠を設定しても良いし、他の設定でも良いとする。
図4の401は、AF枠である。
For example, as shown in FIG. 4, three AF frames may be set at the center of the screen in the vertical direction and in the horizontal direction with respect to the screen, or other settings may be used.
Reference numeral 401 in FIG. 4 denotes an AF frame.

ステップS303では、まず顔枠を設定し、ステップS304へ進む。顔枠は、カメラの構え方が横位置の撮影でもカメラの構え方が縦位置の撮影でも顔検出モジュール112から得られる顔情報の位置に顔検出モジュール112から得られた顔のサイズの所定倍率で設定する。   In step S303, a face frame is first set, and the process proceeds to step S304. The face frame is a predetermined magnification of the size of the face obtained from the face detection module 112 at the position of the face information obtained from the face detection module 112 regardless of whether the camera is held in the horizontal position or the camera is held in the vertical position. Set with.

ステップS304では、顔の左右にAF枠(以下、顔補助枠と記す)を設定し、ステップS305へ進む。左右に設定するAF枠は、カメラの構え方が横位置の撮影(図5−aから図5−e)でも、カメラの構え方縦位置の撮影(図6−aから図6−g)でも、顔位置の左右に、顔サイズの所定倍率で設定する。   In step S304, AF frames (hereinafter referred to as face assist frames) are set on the left and right sides of the face, and the process proceeds to step S305. The AF frame to be set to the left and right can be used when the camera is held horizontally (FIGS. 5-a to 5-e) or the camera is held vertically (FIGS. 6a to 6-g). The left and right sides of the face position are set at a predetermined magnification of the face size.

これは、顔の左右に配置することで、顔でコントラストを取りやすい髪の位置を、AF枠の中に収める為である。   This is because the position of the hair that is easily contrasted with the face is placed in the AF frame by arranging it on the left and right sides of the face.

ステップS305では、顔と体領域の位置が、画面に対して縦の方向に並んでいる場合(以下、顔が縦の場合と記す)なのかを調べる。そして、顔が縦の場合であれば、ステップS306へ進む。また、顔と体領域の位置が、画面に対して横の方向に並んでいる場合(以下、顔が横の場合と記す)なのであれば、ステップS309へと進む。   In step S305, it is checked whether the positions of the face and the body region are aligned in the vertical direction with respect to the screen (hereinafter referred to as a case where the face is vertical). If the face is vertical, the process proceeds to step S306. If the position of the face and body region is aligned in the horizontal direction with respect to the screen (hereinafter referred to as a case where the face is horizontal), the process proceeds to step S309.

図5−aから図5−eは、顔が縦の場合での人物の顔の位置から見て人物の体が位置すると予測される体領域に設定されるAF枠(以下、体枠と記す)設定方法について説明するための図である。   FIGS. 5A to 5E show an AF frame (hereinafter referred to as a body frame) set in a body region where the human body is predicted to be located when viewed from the position of the human face when the face is vertical. It is a figure for demonstrating the setting method.

図5−aの501は、カメラの構え方が横位置の撮影の際の撮影画面である。502は、顔枠である。503は、顔補助枠である。504は、体枠である。505は、体枠の横サイズである。506は、体枠の縦サイズである。図のように体枠は、人物の顔の位置から見て人物の体が位置すると予測される位置に対して水平方向に分割して、複数のAF枠として設定される。後述のように、この分割数は、顔の位置、大きさ、角度などにより変更される。   Reference numeral 501 in FIG. 5A denotes a shooting screen when shooting with the camera held in the horizontal position. Reference numeral 502 denotes a face frame. Reference numeral 503 denotes a face assist frame. Reference numeral 504 denotes a body frame. 505 is the horizontal size of the body frame. Reference numeral 506 denotes the vertical size of the body frame. As shown in the figure, the body frame is set as a plurality of AF frames by dividing the body frame in the horizontal direction with respect to the position where the human body is predicted to be located from the position of the human face. As will be described later, the number of divisions is changed depending on the position, size, angle, and the like of the face.

ステップS306では、顔サイズから、体枠の横サイズを決定し、ステップS307へ進む。横サイズはAF枠が、体領域の外の領域まで設定されないように、顔サイズに対して所定の倍率で設定する。この倍率は、設定すべき画面に対して横方向の体枠の数と、顔サイズに対する体領域サイズの倍率から決めても良いし、被写体検出部113から得られる体領域の位置・サイズから、設定すべき画面に対して横方向の体枠の数に応じて、サイズを変えても良い。   In step S306, the horizontal size of the body frame is determined from the face size, and the process proceeds to step S307. The horizontal size is set at a predetermined magnification with respect to the face size so that the AF frame is not set to an area outside the body area. This magnification may be determined from the number of body frames in the horizontal direction with respect to the screen to be set and the magnification of the body region size with respect to the face size, or from the position / size of the body region obtained from the subject detection unit 113, The size may be changed according to the number of body frames in the horizontal direction with respect to the screen to be set.

ただし、被写体が小さい、もしくは遠方にある場合、体領域サイズは小さくなるので、体枠が所定の横サイズが確保出来るよう、図5−bに対して、図5−cのように設定する焦点検領域の数を少なくする。   However, when the subject is small or far away, the body region size becomes small, so that the focus set as shown in FIG. 5-c with respect to FIG. Reduce the number of inspection areas.

ステップS307では、体枠の作成開始位置を設定し、ステップS308へと進む。顔検出モジュール112から得られる顔位置に対して、所定量、下の位置に体枠の開始点を設定する。これは、顔のすぐ下、つまり首の位置に体枠を設定すると背景も体枠に入り、背景抜けしてしまう可能性がある為である。   In step S307, a body frame creation start position is set, and the process proceeds to step S308. The body frame start point is set at a position below the face position obtained from the face detection module 112 by a predetermined amount. This is because if the body frame is set immediately below the face, that is, at the neck position, the background may enter the body frame and the background may be lost.

この所定量は予め顔サイズの数倍と設定しても良いし、被写体検出部113から得られる体領域の位置から決めても良い。   This predetermined amount may be set in advance as several times the face size, or may be determined from the position of the body region obtained from the subject detection unit 113.

ステップS308では、体枠の縦サイズを設定し、体枠設定を完了する。顔位置が、画面に対しての上部付近にあり、かつ、顔サイズが所定以上大きい場合は、体領域の上部までで縦サイズを設定する(図5−a)。これは、下部まで設定すると、主被写体以外の被写体が体枠の中に入ってしまう可能性が高まる為である。   In step S308, the vertical size of the body frame is set, and the body frame setting is completed. If the face position is near the top of the screen and the face size is larger than a predetermined size, the vertical size is set up to the top of the body area (FIG. 5-a). This is because if the setting is made to the lower part, there is a high possibility that subjects other than the main subject will enter the body frame.

顔位置が画面に対しての中央、もしくは下部にあり、かつ顔サイズが所定以上大きい場合は、画面の端までを体枠の縦サイズとする(図5−d)。顔サイズが所定より小さい場合は、腰にあたる位置付近までの位置を縦サイズとして設定する(図5−b)。   When the face position is at the center or the lower part of the screen and the face size is larger than a predetermined size, the vertical size of the body frame is set to the end of the screen (FIG. 5-d). If the face size is smaller than the predetermined size, the position up to the position corresponding to the waist is set as the vertical size (FIG. 5-b).

これは、顔のサイズによらず、AF評価値の出力を確保する為である。このようにAF枠の縦横比を自在に変えることにより、AF評価値のS/Nを良くし、また、被写体が横を向いたような場合であっても、背景抜けを起こさないAF枠を設定することが可能である。   This is to ensure the output of the AF evaluation value regardless of the face size. By freely changing the aspect ratio of the AF frame in this way, the S / N of the AF evaluation value is improved, and an AF frame that does not cause background omission even when the subject faces sideways is provided. It is possible to set.

また、図5−eのように、主被写体の前に、他の顔があり、その顔が主被写体の体領域にかかっている場合は、他の顔に体枠が重ならないように他の顔までを体枠の縦サイズとする。なお、ここでは他の被写体として人物の顔を示したが、これに限定されない。例えば、パターンマッチングなどの被写体認識により他の被写体が認識された場合に、体枠の縦サイズを調整するようにする。   Also, as shown in FIG. 5E, when there is another face in front of the main subject and the face is on the body area of the main subject, the other body frame is not overlapped with the other face. The body frame is the vertical size of the body frame. Here, the face of a person is shown as another subject, but the present invention is not limited to this. For example, when another subject is recognized by subject recognition such as pattern matching, the vertical size of the body frame is adjusted.

図6−aから図6−gは、顔が縦の場合での体領域における体枠設定方法を説明する図である。   FIG. 6A to FIG. 6G are diagrams for explaining a body frame setting method in the body region when the face is vertical.

図6−aの601は、カメラの構え方が縦位置の撮影の際の撮影画面である。602は、顔枠である。603は、顔補助枠である。604から606は、体枠である。607は、体枠の横サイズである。608は、体枠の縦サイズである。   Reference numeral 601 in FIG. 6A denotes a shooting screen when shooting with the camera held in the vertical position. Reference numeral 602 denotes a face frame. Reference numeral 603 denotes a face assist frame. Reference numerals 604 to 606 denote body frames. Reference numeral 607 denotes the horizontal size of the body frame. Reference numeral 608 denotes the vertical size of the body frame.

ステップS309では、顔サイズから、体領域のサイズを計算し、その中に所定サイズ以上の体枠を図6−aの604と605のように、画面に対して縦に並べて設定出来るかを判断する。   In step S309, the size of the body region is calculated from the face size, and it is determined whether or not a body frame larger than a predetermined size can be set vertically on the screen as indicated by 604 and 605 in FIG. To do.

設定出来る場合は、図6−aのように設定し、体領域のサイズに応じて、体枠の縦サイズを計算する。   If it can be set, the setting is made as shown in FIG. 6A, and the vertical size of the body frame is calculated according to the size of the body region.

並べて設定出来ないと判断された場合は、体枠の縦サイズを所定サイズにして、図6−bのように画面に対して横方向に並べて設定する。   If it is determined that they cannot be set side by side, the vertical size of the body frame is set to a predetermined size and set side by side with respect to the screen as shown in FIG. 6B.

体領域のサイズは、被写体検出部113から得られる体領域のサイズから求めても良い。   The size of the body region may be obtained from the size of the body region obtained from the subject detection unit 113.

また、図6−gのように、主被写体の前に、他の顔があり、その顔が主被写体の体領域にかかっている場合は、他の顔に体領域の体枠が重ならなうように他の顔までを体枠の縦サイズとする。なお、ここでは他の被写体として人物の顔を示したが、これに限定されない。例えば、パターンマッチングなどの被写体認識により他の被写体が認識された場合に、体枠の縦サイズを調整するようにする。   Also, as shown in FIG. 6G, when there is another face in front of the main subject and the face covers the body area of the main subject, the body frame of the body area must overlap the other face. In this way, the vertical size of the body frame is set up to other faces. Here, the face of a person is shown as another subject, but the present invention is not limited to this. For example, when another subject is recognized by subject recognition such as pattern matching, the vertical size of the body frame is adjusted.

ステップS310では、体枠の作成開始位置を設定し、ステップS311へと進む。体枠は、顔が縦の場合と同様に、顔位置に対して所定量、下の位置とする。また、ステップS309で、体領域に所定サイズ以上の体枠を画面に対して縦方向に並べて設定出来る場合は、画面に対して横方向にも、並べて設定する。これは、図6−aの604や、605の体枠に、主となる被写体以外の被写体が入ってしまった場合でも、606の体枠の情報を用いて合焦させることを可能とさせる為である。   In step S310, the creation start position of the body frame is set, and the process proceeds to step S311. The body frame is set to a position below the face position by a predetermined amount, as in the case where the face is vertical. In step S309, if a body frame of a predetermined size or more can be set in the body region in the vertical direction with respect to the screen, it is also set in the horizontal direction with respect to the screen. This is because even if a subject other than the main subject enters the body frame 604 or 605 in FIG. 6A, it is possible to focus using the information on the body frame 606. It is.

また、被写体が小さい、もしくは遠方にある場合、体領域サイズは小さくなるので、体枠が所定のサイズを確保出来るように、図6−bに対して、図6−cのように設定する体枠の重なり量を多くする。   Further, when the subject is small or far away, the body region size is small, so that the body frame is set as shown in FIG. 6-c with respect to FIG. 6-b so that the body frame can secure a predetermined size. Increase the amount of frame overlap.

ステップS311では、体枠の横サイズを設定し、体枠設定を完了する。顔位置が画面に対して横方向の中央付近にあるような場合、つまり図6−aのような場合は、被写体の腹部にあたる位置付近までに、被写体検出領域が二つ設定出来る横サイズに設定する。被写体検出領域の数は、本実施例では、二つとしているが、複数であれば良い。この横サイズは、予め顔サイズからの倍率を計算しておいても良いし、被写体検出部113から検出される体領域の位置・サイズから設定しても良い。   In step S311, the horizontal size of the body frame is set, and the body frame setting is completed. When the face position is near the center in the horizontal direction with respect to the screen, that is, as shown in FIG. 6A, the horizontal size is set so that two subject detection areas can be set near the position corresponding to the abdomen of the subject. To do. Although the number of subject detection areas is two in this embodiment, it may be plural. The horizontal size may be calculated in advance from the face size, or may be set from the position / size of the body region detected by the subject detection unit 113.

顔位置が、画面に対して横方向の下部付近にあるような場合、つまり、図6−dや、図6−eのような場合は、所定サイズまで、被写体検出領域の横サイズを縮小する。所定サイズよりも横サイズが小さくなる場合は、図6−eのように、体枠の設定を二つとする。   When the face position is near the lower part in the horizontal direction with respect to the screen, that is, in the case of FIG. 6D or FIG. 6E, the horizontal size of the subject detection area is reduced to a predetermined size. . When the horizontal size is smaller than the predetermined size, two body frames are set as shown in FIG.

また、被写体が小さい、もしくは、遠方にある場合、かつ、被写体が画面に対し、横方向の下部にあるような場合は、図6−fのように、体枠を一つ設定する。   If the subject is small or far away and the subject is at the lower side in the horizontal direction with respect to the screen, one body frame is set as shown in FIG.

以上のように、画面内における顔の位置や、サイズ、角度に応じて、体枠のサイズや位置を変更することで、体枠のサイズを確保しS/Nを良くし、また、被写体が横を向いたような場合であっても、背景抜けを起こさない体枠を設定することが可能である。   As described above, by changing the size and position of the body frame in accordance with the position, size, and angle of the face in the screen, the size of the body frame is secured, the S / N is improved, and the subject is It is possible to set a body frame that does not cause background loss even when facing sideways.

<合焦判定>
次に、図7を用いて図2のステップS204における合焦判定について説明する。
AF評価値は、AFスキャンを行った際のフォーカスレンズの移動位置に対応する被写体距離範囲内に被写体が1つしか存在しない場合においては、横軸にフォーカスレンズ位置、縦軸にAF評価値をとると、その形は図7に示すような山状になる。そこでAF評価値の、最大値と最小値の差、一定値(SlopeThr)以上の傾きで傾斜している部分の長さ、傾斜している部分の勾配から、山の形状を判断することにより、合焦判定を行うことができる。
<Focus determination>
Next, focusing determination in step S204 in FIG. 2 will be described with reference to FIG.
When there is only one subject within the subject distance range corresponding to the moving position of the focus lens at the time of AF scanning, the AF evaluation value is the focus lens position on the horizontal axis and the AF evaluation value on the vertical axis. If it takes, the shape will become a mountain shape as shown in FIG. Therefore, by determining the shape of the mountain from the difference between the maximum value and the minimum value of the AF evaluation value, the length of the inclined portion with a slope equal to or greater than a certain value (SlopeThr), and the slope of the inclined portion, In-focus determination can be performed.

山の形状を判断する為の、一定値以上の傾きで傾斜している部分の長さL、傾斜している部分の勾配SL/Lを、図7を用いて説明する。   The length L of the inclined part and the slope SL / L of the inclined part for judging the shape of the mountain will be described with reference to FIG.

山の頂上(A点)から傾斜が続いていると認められる点をD点、E点とし、D点とE点の幅を山の幅Lとする。傾斜が続いていると認める範囲は、A点から、所定量(SlopeThr)以上、AF評価値が下がったスキャンポイントが続く範囲とする。スキャンポイントとは、連続的にフォーカスレンズを動かして、スキャン開始点から、スキャン終了点まで移動する間に、AF評価値を取得するポイントのことである。A点とD点のAF評価値の差SL1とA点とE点のAF評価値の差SL2の和SL1+SL2をSLとする。   Points that are recognized to be inclined from the top of the mountain (point A) are defined as points D and E, and the width between points D and E is defined as the width L of the mountain. The range in which it is recognized that the inclination continues is a range in which a scan point whose AF evaluation value has decreased by a predetermined amount (SlopeThr) or more continues from point A. The scan point is a point at which the AF evaluation value is acquired while moving the focus lens continuously and moving from the scan start point to the scan end point. The sum SL1 + SL2 of the difference SL1 between the AF evaluation values at the points A and D and the difference SL2 between the AF evaluation values at the points A and E is defined as SL.

山の形状から合焦判定を行うには、次の条件について確認をする。
[1]一定値以上の傾きで傾斜している部分の長さLが所定値(L0)以上であるか
[2]傾斜している部分の傾斜の平均値ステップSL/Lが所定値(SL0/L0)以上であるか
[3]AF評価値の最大値(Max)と最小値(Min)の差が所定値(defmaxmin)以上であるか
以上の条件を満たす場合かどうかにより、合焦判定における判定結果は、以下に示すように○判定、×判定で出力される。
○判定:被写体のコントラストが十分、かつスキャンした際のフォーカスレンズの移動位置に対応する被写体距離範囲内の距離に被写体が存在する。
×判定:被写体のコントラストが不十分、もしくはスキャンした際のフォーカスレンズの移動位置に対応する被写体距離範囲外の距離に被写体が位置する。
ここで、所定値L0、SL0、defmaxminを合焦条件といい、これらの値の設定によって合焦判定を厳しくしたり緩くしたりすることができる。
To determine the focus from the shape of the mountain, check the following conditions.
[1] Whether the length L of the inclined portion is equal to or larger than a predetermined value (L0) or more. [2] The average value step SL / L of the inclined portion is predetermined value (SL0). / L0) or more [3] Whether the difference between the maximum value (Max) and the minimum value (Min) of the AF evaluation value is a predetermined value (defmaxmin) or more The determination result in is output in a ○ determination and a × determination as shown below.
○ Determination: The subject exists at a distance within the subject distance range corresponding to the moving position of the focus lens when the subject has sufficient contrast and is scanned.
X determination: The subject is insufficient in contrast, or the subject is located at a distance outside the subject distance range corresponding to the moving position of the focus lens when scanned.
Here, the predetermined values L0, SL0, and defmaxmin are referred to as in-focus conditions, and the focus determination can be tightened or loosened by setting these values.

<合焦位置の決定>
次に、図8のフローチャートを用いて図2のステップS205における合焦位置の決定の動作を説明する。
ステップS801では、顔枠でのピーク位置および顔サイズにより算出した推定距離の中から基準位置を選択し、ステップS802へ進む。ステップS801の手順については、図9、10を用いて後述する。
<Determining the in-focus position>
Next, the operation for determining the in-focus position in step S205 in FIG. 2 will be described using the flowchart in FIG.
In step S801, a reference position is selected from the estimated distance calculated from the peak position in the face frame and the face size, and the process proceeds to step S802. The procedure of step S801 will be described later with reference to FIGS.

ステップS802ではステップS801で選択した基準位置に基づいて合焦位置決定に使用するAF枠を顔枠/補助枠/体枠の中からを選択し、ステップS803へ進む。ステップS802の手順については、図11を用いて後述する。   In step S802, the AF frame used for determining the in-focus position is selected from the face frame / auxiliary frame / body frame based on the reference position selected in step S801, and the process proceeds to step S803. The procedure of step S802 will be described later with reference to FIG.

ステップS803では、ステップS802で選択したAF枠があるかどうかを調べ、選択したAF枠がない場合はステップS804へ進む。   In step S803, it is checked whether there is an AF frame selected in step S802. If there is no AF frame selected, the process proceeds to step S804.

ステップS804では、ステップS801で決定した基準位置に基づき、AF評価値加算処理を行い、合焦位置決定の動作を終了する。ステップS804の手順については、図12を用いて後述する。   In step S804, AF evaluation value addition processing is performed based on the reference position determined in step S801, and the operation for determining the in-focus position ends. The procedure of step S804 will be described later with reference to FIG.

<基準位置の選択>
次に、図9のフローチャートを用いて図8のステップS801における基準選択の動作を説明する。
<Selection of reference position>
Next, the reference selection operation in step S801 of FIG. 8 will be described using the flowchart of FIG.

ステップS901では、予め決められた顔サイズの上限・下限の値に対して、顔検出モジュール112により検出した顔のサイズを比較し、顔サイズが上限・下限の範囲内であればステップS902へ、顔サイズが上限・下限の範囲外であればステップS911へ進む。ここで、顔サイズの上限・下限の範囲とは推定距離の精度を考慮して決めており、顔の検出サイズが上限値よりも大きい場合は顔の検出結果の誤差に伴う推定距離の誤差が大きく、顔の検出サイズが下限値よりも小さい場合は顔の検出精度が低い。そのため、この上限・下限の範囲外の顔のサイズを検出した場合は推定距離の信頼性が低いため、推定距離は基準位置の候補から外すこととする。   In step S901, the size of the face detected by the face detection module 112 is compared with predetermined upper and lower limit values of the face size. If the face size is within the upper and lower limits, the process proceeds to step S902. If the face size is outside the upper and lower limits, the process proceeds to step S911. Here, the range of the upper and lower limits of the face size is determined in consideration of the accuracy of the estimated distance.If the face detection size is larger than the upper limit value, the error of the estimated distance accompanying the error of the face detection result is If it is large and the face detection size is smaller than the lower limit value, the face detection accuracy is low. For this reason, when the face size outside the upper and lower limits is detected, the estimated distance is not reliable, so the estimated distance is excluded from the reference position candidates.

ステップS902では顔枠でのAF評価値の図2のステップS204における合焦判定の結果を調べ、○判定であった場合はステップS903へ、×判定であった場合はステップS910へ進む。   In step S902, the result of the focus determination in step S204 in FIG. 2 of the AF evaluation value in the face frame is checked. If YES, the process proceeds to step S903, and if NO, the process proceeds to step S910.

ステップS903では顔枠のピーク位置と推定距離が所定深度(以下、大外れ深度と記す)内であるかを調べる大外れ判定を行う。大外れ深度外である場合は大外れと判定してステップS905へ進み、大外れ深度内である場合は大外れでないと判定してステップS904へ進む。ここで「大外れ深度」とは、デバイスの個体差による誤差/顔検出精度のばらつきによる誤差/顔サイズの個体差といった想定される推定距離の誤差量を加味して決めた値である。顔枠に対応する合焦位置が正しく取得できている場合でも推定距離と顔枠のピーク位置の間に大外れ深度内の差は発生しうる。しかし、顔枠のピーク位置と推定距離の差が大外れ深度以上である場合は、以下の状況のいずれかが発生していると考えられ、顔のピーク位置と推定距離のうちでどちらが信頼できるかの判定を行う必要がある。
[1]顔枠のピーク位置が実際の合焦位置よりも大きく外れた状況
[2]人形やポスターなどが被写体となっており、人間の顔サイズから大きく外れた顔サイズに基づいて推定距離を算出しており推定距離の誤差が大きい状況
In step S903, an outlier determination is performed to check whether the peak position of the face frame and the estimated distance are within a predetermined depth (hereinafter, referred to as a large outlier depth). If it is out of the large out-of-out depth, it is determined that it is out-of-out, and the process proceeds to step S905. Here, the “large deviation depth” is a value determined in consideration of an error amount of an estimated distance such as an error due to an individual difference of devices / an error due to variations in face detection accuracy / an individual difference of face size. Even when the in-focus position corresponding to the face frame can be acquired correctly, a difference in the outlier depth may occur between the estimated distance and the peak position of the face frame. However, if the difference between the peak position of the face frame and the estimated distance is greater than or equal to the depth of deviation, it is considered that one of the following situations has occurred, and which of the face peak position and the estimated distance is reliable It is necessary to make a judgment.
[1] The situation where the peak position of the face frame deviates significantly from the actual in-focus position [2] The subject is a doll or a poster, and the estimated distance is calculated based on the face size deviating greatly from the human face size. The situation where the error of the estimated distance is large

ステップS904では顔枠のピーク位置と推定距離が大外れ深度よりは小さい所定深度(以下、中外れ深度と記す)内であるかを調べる中外れ判定を行う。中外れ深度外である場合は中外れと判定してステップS908へ進み、中外れ深度内である場合は中外れではないと判定してステップS911へ進む。ここで「中外れ深度」とは、大外れ深度よりは小さい値があらかじめ設定してあり、顔枠のピーク位置と推定距離の差が中外れ深度内であれば顔枠のピーク位置と推定距離の両方の信頼性が高いものと考える。その一方で、顔枠のピーク位置と推定距離の差が中外れ深度外である場合は、顔枠のピーク位置と推定距離のどちらがより信頼できるかを判定する必要がある。   In step S904, an out-of-phase determination is performed to check whether the peak position of the face frame and the estimated distance are within a predetermined depth (hereinafter referred to as an out-of-center depth) smaller than the out-of-range depth. If it is outside the mid-out depth, it is determined that it is out-of-center, and the process proceeds to step S908. If it is within the mid-out depth, it is determined that it is not out-of-center, and the process proceeds to step S911. Here, the “out-of-center depth” is set to a value smaller than the maximum out-of-field depth, and if the difference between the peak position of the face frame and the estimated distance is within the out-of-center depth, the peak position of the face frame and the estimated distance Both are considered reliable. On the other hand, if the difference between the peak position of the face frame and the estimated distance is out of the middle depth, it is necessary to determine which of the face frame peak position and the estimated distance is more reliable.

ステップS905では大外れ時信頼性判定を行い、顔枠のピーク位置と推定距離のどちらが信頼できるかを判定し、ステップS906へ進む。ここで、大外れ時信頼性判定の内容について図10を用いて説明する。図10の(a)は推定距離が信頼できない場合について、図10の(b)は顔枠のピーク位置が信頼できない場合について、各AF枠でのAF評価値のピーク位置と推定距離の関係を簡略化して示した図である。1101a〜1101fおよび1102a〜1102fは各AF枠の配置およびAF評価値のピーク位置を、1101gおよび1102gは推定距離の位置を、それぞれ示している。   In step S905, reliability determination at the time of large deviation is performed to determine which of the face frame peak position and the estimated distance is reliable, and the process proceeds to step S906. Here, the content of the reliability determination at the time of large deviation will be described with reference to FIG. FIG. 10A shows the relationship between the peak position of the AF evaluation value in each AF frame and the estimated distance when the estimated distance is unreliable, and FIG. 10B shows the case where the peak position of the face frame is unreliable. It is the figure shown simplified. 1101a to 1101f and 1102a to 1102f indicate the positions of the AF frames and the peak positions of the AF evaluation values, and 1101g and 1102g indicate the positions of the estimated distances, respectively.

大外れ時に推定距離が信頼できない場合とは、図10(a)に示すように人を象ったオブジェやポスターなどで実際の人物の顔よりも極端に大きな顔を検出した場合、もしくは、人形や写真などで人物の顔よりも極端に小さな顔を検出した場合であると考えられる。また、その際に顔枠では正しい合焦位置を検出できたものと仮定する。そのような場合、顔補助枠や体枠において正しい合焦位置を検出できた場合は、そのピーク位置1001b〜1001dは顔枠のピーク位置1001a付近に分布する。また、正しい合焦位置を検出できない顔補助枠や体枠があったとしてもそのピーク位置1001e〜fが推定距離1001gと近くなる可能性は低い。そこで、推定距離から所定深度内(以下、推定信頼深度と記す)に顔補助枠や体枠のピーク位置がない場合は、推定距離が信頼できないと判定する。   When the estimated distance is unreliable at the time of large deviation, the case where a face extremely larger than the face of an actual person is detected by an object or poster representing a person as shown in FIG. This is considered to be a case where a face extremely smaller than the face of a person is detected in a photograph or a photograph. In this case, it is assumed that a correct in-focus position can be detected in the face frame. In such a case, when the correct focus position can be detected in the face auxiliary frame or the body frame, the peak positions 1001b to 1001d are distributed in the vicinity of the peak position 1001a of the face frame. Further, even if there are face assist frames and body frames for which a correct in-focus position cannot be detected, there is a low possibility that the peak positions 1001e to f are close to the estimated distance 1001g. Therefore, if there is no peak position of the face assist frame or the body frame within a predetermined depth from the estimated distance (hereinafter referred to as an estimated reliability depth), it is determined that the estimated distance is not reliable.

次に、大外れ時に顔枠のピーク位置が信頼できない場合とは、図10(b)に示すように横を向いて背景抜けした場合などのAF評価値に偽のピークが発生してしまった場合であると考えられる。また、その際に推定距離は正しい値であると仮定する。そのような場合、背景抜けせずに正しい合焦位置を検出できたAF枠のピーク位置1002c、1002fは推定距離1002gの付近に分布する。そこで、推定距離から推定信頼深度内に顔補助枠や体枠のピーク位置が存在する場合は、推定距離が信頼できると判定する。   Next, the case where the peak position of the face frame is unreliable at the time of large deviation means that a false peak has occurred in the AF evaluation value when the background is turned sideways as shown in FIG. 10B. This is considered to be the case. In this case, it is assumed that the estimated distance is a correct value. In such a case, the peak positions 1002c and 1002f of the AF frame in which the correct focus position can be detected without missing the background are distributed in the vicinity of the estimated distance 1002g. Therefore, when the peak position of the face assist frame or the body frame exists within the estimated reliability depth from the estimated distance, it is determined that the estimated distance is reliable.

以上のようにして、大外れ時信頼性判定では、推定距離から推定信頼深度内に補助枠または体枠のピーク位置が存在する場合は推定距離が信頼できると判定する。また、推定距離から推定信頼深度内に補助枠および体枠のピーク位置が存在しない場合は推定距離が信頼できないと判定する。   As described above, in the out-of-bounds reliability determination, when the peak position of the auxiliary frame or the body frame exists within the estimated reliability depth from the estimated distance, it is determined that the estimated distance is reliable. Further, when the peak positions of the auxiliary frame and the body frame do not exist within the estimated reliability depth from the estimated distance, it is determined that the estimated distance is not reliable.

ステップS906では、ステップS905の大外れ時信頼性判定で推定距離の方が信頼性が高い、と判定した場合はステップS907へ進み、推定距離の方が低いと判定した場合はステップS911へ進む。   In step S906, if it is determined that the estimated distance is more reliable in the out-of-shift reliability determination in step S905, the process proceeds to step S907. If it is determined that the estimated distance is lower, the process proceeds to step S911.

ステップS907では、図8のステップS802での枠選択およびステップS804での枠加算の処理時に顔枠を使用しないように設定をして、S910へ進む。   In step S907, setting is made so that the face frame is not used during the frame selection process in step S802 and the frame addition process in step S804 in FIG. 8, and the process proceeds to S910.

ステップS908では、中外れ時信頼性判定を行い、顔枠のピーク位置と推定距離のどちらが信頼できるかを判定し、ステップS909へ進む。ここでは、大外れ時信頼性判定と同様の判定を行うが、推定信頼深度の値を大外れ時とは異ならせてもよい。   In step S908, reliability determination for out-of-center is performed to determine which of the face frame peak position and the estimated distance is reliable, and the process proceeds to step S909. Here, although the determination similar to the reliability determination at the time of large deviation is performed, the value of the estimated reliability depth may be different from that at the time of large deviation.

ステップS909では推定距離がステップS908の中外れ時信頼性判定で推定距離の方が信頼性が高いと判定した場合はステップS910へ進み、推定距離の方が信頼性が低いと判定した場合はステップS911へ進む。   In step S909, if it is determined that the estimated distance is more reliable in the determination of reliability when the estimated distance is out of step S908, the process proceeds to step S910, and if it is determined that the estimated distance is less reliable, step S909 is performed. The process proceeds to S911.

ステップS910では推定距離を基準位置として設定し、ステップS911では顔枠のピーク位置を基準位置として設定し、基準選択の動作を終了する。   In step S910, the estimated distance is set as the reference position. In step S911, the peak position of the face frame is set as the reference position, and the reference selection operation is terminated.

以上のように、顔枠のピーク位置と推定距離の中から顔の合焦位置としてより信頼できる方を基準位置として選択する。特に、顔枠のピーク位置と推定距離の差が大きく、顔枠での合焦位置が間違っているか推定距離の誤差が大きいような場合においても、より信頼できる方を基準位置として選択することができる。   As described above, the more reliable face focus position is selected as the reference position from the peak position of the face frame and the estimated distance. In particular, even when the difference between the peak position of the face frame and the estimated distance is large and the focus position in the face frame is wrong or the estimated distance error is large, the more reliable one can be selected as the reference position. it can.

<枠選択>
次に、図11のフローチャートを用いて図8のステップS802における枠選択の動作を説明する。
<Frame selection>
Next, the frame selection operation in step S802 in FIG. 8 will be described using the flowchart in FIG.

ステップS1101では、顔枠が使用可能であるかどうかを調べ、図8のS807において顔枠を使用不可とした場合はステップS1104へ進み、顔枠が使用可能である場合はステップS1102へ進む。   In step S1101, whether or not the face frame can be used is checked. If the face frame cannot be used in step S807 in FIG. 8, the process proceeds to step S1104. If the face frame is usable, the process proceeds to step S1102.

ステップS1102では、顔枠での図2のS204における合焦判定の結果を調べ、○判定だった場合はステップS1103へ進み、×判定だった場合はステップS1104へ進む。   In step S1102, the result of the focus determination in step S204 in FIG. 2 in the face frame is checked. If yes, the process proceeds to step S1103, and if x, the process proceeds to step S1104.

ステップS1103では顔枠のピーク位置を合焦位置として、枠選択の動作を終了する。   In step S1103, the peak position of the face frame is set as the in-focus position, and the frame selection operation ends.

ステップS1104では、図2のステップS201において、顔補助枠や体枠が設定されているかを調べ、設定されている場合はステップS1105へ進み、設定されていない場合は枠選択の動作を終了する。   In step S1104, it is checked in step S201 in FIG. 2 whether a face auxiliary frame or body frame is set. If it is set, the process proceeds to step S1105. If it is not set, the frame selection operation is terminated.

ステップS1105では顔補助枠や体枠に対して以下の2条件を満たすかどうかを調べ、満たしている場合は枠選択の候補枠と判定する。
条件1:図2のS204における合焦判定が○判定
条件2:図8のS801において設定した基準位置とピーク位置が所定深度内
全てのAF枠について判定を行ったら、ステップS1106へ進む。
In step S1105, it is checked whether or not the following two conditions are satisfied for the face assist frame and the body frame.
Condition 1: In-focus determination at S204 in FIG. 2 is ◯. Determination condition 2: When the determination is made for all AF frames within the predetermined depth of the reference position and peak position set in S801 in FIG. 8, the process proceeds to step S1106.

ステップS1106では、ステップS1105において枠選択の候補枠として設定したAF枠があるかどうかを調べ、ある場合はステップS1107へ進み、ない場合は枠選択の動作を終了する。   In step S1106, it is checked whether there is an AF frame set as a frame selection candidate frame in step S1105. If there is, the process proceeds to step S1107, and if not, the frame selection operation is terminated.

ステップS1107では、枠選択の候補として設定したAF枠の中から、ピーク位置が基準位置に最も近いAF枠を選択して、ステップS1108へ進む。   In step S1107, an AF frame whose peak position is closest to the reference position is selected from the AF frames set as frame selection candidates, and the process proceeds to step S1108.

ステップS1108では、ステップS1107で選択したAF枠のピーク位置を合焦位置として、枠選択の動作を終了する。   In step S1108, the frame selection operation is terminated with the peak position of the AF frame selected in step S1107 as the in-focus position.

また、ステップS1107、S1108に関しては、
・枠選択の候補枠を全て選択し、選択したAF枠のピーク位置の平均位置を合焦位置とする
・枠選択の候補枠の中からピーク位置が最も至近にあるAF枠を選択し、選択したAF枠のピーク位置を合焦位置とする
という方法をとってもよい。
Regarding steps S1107 and S1108,
・ Select all candidate frames for frame selection and use the average position of the peak positions of the selected AF frames as the in-focus position. ・ Select and select the AF frame with the closest peak position from the candidate frames for frame selection. A method may be used in which the peak position of the AF frame is used as the in-focus position.

以上のように、顔枠が使用可能かつ合焦判定が○判定である場合は顔枠を選択し、顔枠が選択できなかった場合は基準位置に近い顔補助枠または体枠を選択する。それにより、顔の合焦位置としてより信頼できるAF枠を合焦位置として選択でき、合焦精度を上げることができる。   As described above, when the face frame is usable and the focus determination is “good”, the face frame is selected, and when the face frame cannot be selected, the face auxiliary frame or body frame close to the reference position is selected. Thereby, a more reliable AF frame can be selected as the focus position of the face, and the focus accuracy can be improved.

<枠加算部>
次に、図12のフローチャートを用いて図8のステップS804における枠加算の動作を説明する。
ステップS1201では、全てのAF枠に対して合焦判定を行い、ステップS1202へ進む。ここで、合焦条件L0、SL0、defmaxminの値を図2のステップS204で設定した値から変更して、より緩い判定を行う。より緩い合焦判定で○判定となるのは、AF評価値のピークは出ているものの、出力が低いためにそのまま合焦位置として使用するには信頼性が低いような場合である。
<Frame addition unit>
Next, the frame addition operation in step S804 in FIG. 8 will be described using the flowchart in FIG.
In step S1201, focus determination is performed for all AF frames, and the process proceeds to step S1202. Here, the values of the focusing conditions L0, SL0, and defmaxmin are changed from the values set in step S204 in FIG. The case where the focus is judged to be less ◯ is when the AF evaluation value has a peak, but the output is low and the reliability is low when used as it is as the in-focus position.

ステップS1202では、全てのAF枠に対して以下の2つの条件を満たすかどうかを調べ、満たす場合は枠加算の対象枠(以下、加算対象枠と記す)と判定する。
条件1:ステップS1201における合焦判定が○判定
条件2:ピーク位置が基準位置から所定深度内である
全てのAF枠に対して判定を行ったら、ステップS1203へ進む
ステップS1203ではステップS1202において加算対象枠として判定したAF枠が2つ以上あるかどうかを調べ、2つ以上ある場合はステップS1204へ進み、2つ未満の場合はステップS1212へ進む。
In step S1202, it is checked whether or not the following two conditions are satisfied for all AF frames, and if they are satisfied, it is determined as a frame addition target frame (hereinafter referred to as an addition target frame).
Condition 1: In-focus determination in step S1201 is ◯. Determination condition 2: When determination is made for all AF frames whose peak positions are within the predetermined depth from the reference position, the process proceeds to step S1203. In step S1203, the object to be added in step S1202 It is checked whether or not there are two or more AF frames determined as frames. If there are two or more AF frames, the process proceeds to step S1204. If it is less than two, the process proceeds to step S1212.

ステップS1204ではAF枠の数をカウントする変数iを1に初期化して、ステップS1205へ進む。
ステップS1205では、変数iをインクリメントしてステップS1206へ進む。
In step S1204, a variable i for counting the number of AF frames is initialized to 1, and the process proceeds to step S1205.
In step S1205, the variable i is incremented and the process proceeds to step S1206.

ステップS1206では、基準位置に対してもっとも近い加算対象枠のAF評価値に対して、i番目の加算対象枠のAF評価値を加算して、ステップS1207へ進む。ここで、各AF枠はサイズが異なる場合もあり、AF評価値の出力もサイズによって変わる。そこで、あらかじめ決められた正規化用のAF枠のサイズに合わせてAF評価値を正規化してから加算を行う。   In step S1206, the AF evaluation value of the i-th addition target frame is added to the AF evaluation value of the addition target frame closest to the reference position, and the process proceeds to step S1207. Here, the size of each AF frame may be different, and the output of the AF evaluation value varies depending on the size. Therefore, the AF evaluation value is normalized in accordance with a predetermined AF frame size for normalization and then added.

ステップS1207では、加算したAF評価値に対して正規化用のAF枠のサイズに合わせた合焦条件L0、SL0、defmaxminの値における合焦判定を行い、ステップS1208へ進む。   In step S1207, focus determination is performed with respect to the values of the focusing conditions L0, SL0, and defmaxmin according to the size of the AF frame for normalization with respect to the added AF evaluation value, and the process proceeds to step S1208.

ステップS1208では加算したAF評価値に対してステップS1207の合焦判定結果を調べ、○判定であればステップS1210へ進み、×判定であればステップS1209へ進む。   In step S1208, the in-focus determination result in step S1207 is checked with respect to the added AF evaluation value. If YES, the process proceeds to step S1210, and if X, the process proceeds to step S1209.

ステップS1209では全ての加算対象枠に対して加算を行ったかどうかを調べ、全ての加算対象枠に対して加算を行った場合はステップS1212へ進む。また、まだ加算していない加算対象枠がある場合は、ステップS1205へ戻り、加算対象枠のAF評価値をさらに加算していく。   In step S1209, it is checked whether or not addition has been performed for all addition target frames. If addition has been performed for all addition target frames, the process proceeds to step S1212. If there is an addition target frame that has not yet been added, the process returns to step S1205, and the AF evaluation value of the addition target frame is further added.

ステップS1210では、加算したAF評価値のピーク位置を演算により求めて、ステップS1211へと進む。   In step S1210, the peak position of the added AF evaluation value is obtained by calculation, and the process proceeds to step S1211.

ステップS1211では加算後のAF評価値のピーク位置が基準位置から所定深度内であるかどうかを調べ、所定深度内である場合はステップS1222へ進み、所定深度内ではない場合はステップS1212へ進む。   In step S1211, it is checked whether the peak position of the AF evaluation value after addition is within a predetermined depth from the reference position. If it is within the predetermined depth, the process proceeds to step S1222, and if not within the predetermined depth, the process proceeds to step S1212.

ステップS1212では、合焦判定は考慮せずに、全てのAF枠を対象として、ピーク位置が基準位置から所定深度内である場合は、加算対象枠として判定し、ステップS1213へ進む。   In step S1212, focusing determination is not taken into consideration, and if all AF frames are targeted, and the peak position is within a predetermined depth from the reference position, it is determined as an addition target frame, and the process proceeds to step S1213.

ステップS1213ではステップS1212において加算対象枠として判定したAF枠が2つ以上あるかどうかを調べ、2つ以上ある場合はステップS1214へ進み、2つ未満の場合は枠加算の動作を終了する。   In step S1213, it is checked whether or not there are two or more AF frames determined as addition target frames in step S1212. If there are two or more AF frames, the process proceeds to step S1214. If there are less than two, the frame addition operation is terminated.

ステップS1214ではAF枠の数をカウントする変数iを1に初期化して、ステップS1215へ進む。
ステップS1215では、変数iをインクリメントしてステップS1216へ進む。
In step S1214, a variable i for counting the number of AF frames is initialized to 1, and the process proceeds to step S1215.
In step S1215, the variable i is incremented and the process proceeds to step S1216.

ステップS1216では、ステップS1206と同様にして基準位置に対してもっとも近い加算対象枠のAF評価値に対して、i番目の加算対象枠のAF評価値を正規化して加算して、ステップS1217へ進む。   In step S1216, the AF evaluation value of the i-th addition target frame is normalized and added to the AF evaluation value of the addition target frame closest to the reference position in the same manner as in step S1206, and the process proceeds to step S1217. .

ステップS1217では、ステップS1207と同様にして、加算したAF評価値に対して正規化用のAF枠のサイズに合わせた合焦条件(所定値L0、SL0、defmaxmin)に基づく合焦判定を行い、ステップS1218へ進む。   In step S1217, in the same manner as in step S1207, a focus determination based on a focus condition (predetermined values L0, SL0, defmaxmin) that matches the size of the AF frame for normalization is performed on the added AF evaluation value. The process proceeds to step S1218.

ステップS1218では加算したAF評価値に対してステップS1217の合焦判定における判定結果を調べ、○判定であればステップS1220へ進み、×判定であればステップS1219へ進む。   In step S1218, the determination result in the focus determination in step S1217 is checked with respect to the added AF evaluation value, and if it is ◯, the process proceeds to step S1220, and if it is x, the process proceeds to step S1219.

ステップS1219では全ての加算対象枠に対して加算を行ったかどうかを調べ、全ての加算対象枠に対して加算を行った場合は枠加算の動作を終了する。また、まだ加算していない加算対象枠がある場合は、ステップS1215へ戻り加算対象枠のAF評価値をさらに加算していく。   In step S1219, it is checked whether or not addition has been performed for all the addition target frames. If addition has been performed for all the addition target frames, the frame addition operation is terminated. If there is an addition target frame that has not yet been added, the process returns to step S1215 to further add the AF evaluation value of the addition target frame.

ステップS1220では、加算したAF評価値のピーク位置を演算により求めて、ステップS1221へと進む。   In step S1220, the peak position of the added AF evaluation value is obtained by calculation, and the process proceeds to step S1221.

ステップS1221では加算後のAF評価値のピーク位置が基準位置から所定深度内であるかどうかを調べ、所定深度内である場合はステップS1222へ進み、所定深度内ではない場合は枠加算の動作を終了する。
ステップS1222では加算したAF評価値のピーク位置を合焦位置として決定し、枠加算の動作を終了する。
In step S1221, it is checked whether or not the peak position of the AF evaluation value after addition is within a predetermined depth from the reference position. If it is within the predetermined depth, the process proceeds to step S1222, and if it is not within the predetermined depth, a frame addition operation is performed. finish.
In step S1222, the peak position of the added AF evaluation value is determined as the in-focus position, and the frame addition operation ends.

以上のように、ピーク位置が基準位置から所定深度内にあるAF枠に対して、基準位置に近いAF枠から順に加算を行うことによって、加算後のAF評価値のピーク位置の精度を保証することができる。   As described above, the accuracy of the peak position of the AF evaluation value after the addition is assured by performing the addition in order from the AF frame close to the reference position with respect to the AF frame whose peak position is within the predetermined depth from the reference position. be able to.

以上により、顔検出時に顔領域においてAFを行う際に、ノイズによるS/N比の悪化の影響および背景抜けの影響を軽減してより高い精度で顔にピントを合わせることができる。   As described above, when performing AF on the face area at the time of face detection, it is possible to reduce the influence of the deterioration of the S / N ratio due to noise and the influence of background omission and focus on the face with higher accuracy.

なお、上述の実施例では、被写体の顔を、人物の顔として説明したが、これに限らず、例えば動物の顔と体をパターンマッチングなどの被写体認識により抽出して、顔領域および体領域へAF枠を設定するようにしてもよい。   In the above-described embodiments, the face of the subject has been described as a person's face. However, the present invention is not limited to this. For example, an animal's face and body are extracted by subject recognition such as pattern matching, and the face region and body region are extracted. An AF frame may be set.

また、上記実施の形態では、所定の移動範囲においてフォーカスレンズを移動させてスキャン動作を行う、所謂、スキャン方式のAF動作について説明した。しかしながら、AF評価値が増加する方向にフォーカスレンズを動かし、AF評価値が最大になる位置を合焦位置とする山登り方式(コンティニュアスAFともいう)におけるAF枠の設定を上述のように行ってもよい。   In the above-described embodiment, the so-called scan-type AF operation in which the focus lens is moved within a predetermined movement range to perform the scan operation has been described. However, the focus lens is moved in the direction in which the AF evaluation value increases, and the AF frame is set as described above in the hill-climbing method (also referred to as continuous AF) in which the position where the AF evaluation value is maximum is the in-focus position. May be.

(他の実施形態)
また、各実施形態の目的は、次のような方法によっても達成される。すなわち、前述した実施形態の機能を実現するソフトウェアのプログラムコードを記録した記憶媒体(または記録媒体)を、システムあるいは装置に供給する。そして、そのシステムあるいは装置のコンピュータ(またはCPUやMPU)が記憶媒体に格納されたプログラムコードを読み出し実行する。この場合、記憶媒体から読み出されたプログラムコード自体が前述した実施形態の機能を実現することになり、そのプログラムコードを記憶した記憶媒体は本発明を構成することになる。また、コンピュータが読み出したプログラムコードを実行することにより、前述した実施形態の機能が実現されるだけでなく、本発明には次のような場合も含まれる。すなわち、プログラムコードの指示に基づき、コンピュータ上で稼働しているオペレーティングシステム(OS)などが実際の処理の一部または全部を行い、その処理によって前述した実施形態の機能が実現される。
(Other embodiments)
The object of each embodiment is also achieved by the following method. That is, a storage medium (or recording medium) in which a program code of software that realizes the functions of the above-described embodiments is recorded is supplied to the system or apparatus. Then, the computer (or CPU or MPU) of the system or apparatus reads and executes the program code stored in the storage medium. In this case, the program code itself read from the storage medium realizes the functions of the above-described embodiments, and the storage medium storing the program code constitutes the present invention. Further, by executing the program code read by the computer, not only the functions of the above-described embodiments are realized, but the present invention includes the following cases. That is, based on the instruction of the program code, an operating system (OS) running on the computer performs part or all of the actual processing, and the functions of the above-described embodiments are realized by the processing.

さらに、次のような場合も本発明に含まれる。すなわち、記憶媒体から読み出されたプログラムコードが、コンピュータに挿入された機能拡張カードやコンピュータに接続された機能拡張ユニットに備わるメモリに書込まれる。その後、そのプログラムコードの指示に基づき、その機能拡張カードや機能拡張ユニットに備わるCPUなどが実際の処理の一部または全部を行い、その処理によって前述した実施形態の機能が実現される。   Furthermore, the following cases are also included in the present invention. That is, the program code read from the storage medium is written in a memory provided in a function expansion card inserted into the computer or a function expansion unit connected to the computer. Thereafter, based on the instruction of the program code, the CPU or the like provided in the function expansion card or function expansion unit performs part or all of the actual processing, and the functions of the above-described embodiments are realized by the processing.

本発明を上記記憶媒体に適用する場合、その記憶媒体には、先に説明した手順に対応するプログラムコードが格納されることになる。   When the present invention is applied to the above storage medium, the storage medium stores program codes corresponding to the procedure described above.

101 撮影レンズ
102 フォーカスレンズ
103 AF処理部
104 撮像素子
105 A/D変換部
106 画像処理部
107 システム制御部
108 撮影モードスイッチ
109 メインスイッチ
110 撮影スタンバイスイッチ
111 撮影スイッチ
112 顔検出モジュール
113 動体検出部
114 角速度センサ部
115 加速度センサ部
116 DRAM
DESCRIPTION OF SYMBOLS 101 Shooting lens 102 Focus lens 103 AF process part 104 Image pick-up element 105 A / D conversion part 106 Image processing part 107 System control part 108 Shooting mode switch 109 Main switch 110 Shooting standby switch 111 Shooting switch 112 Face detection module 113 Moving body detection part 114 Angular velocity sensor unit 115 Acceleration sensor unit 116 DRAM

Claims (9)

撮像画像から人物の顔が存在する位置とサイズを検出する顔検出手段と、
撮像光学系の合焦状態を検出する際の焦点検出領域として、前記人物の顔が存在する第1の焦点検出領域と、前記人物の顔の位置から見て前記人物の体が位置すると予測される第2の焦点検出領域とを設定する設定手段と、
前記焦点検出領域における信号出力に基づいて前記撮像光学系を移動させて焦点調節を行う焦点調節手段とを有し、
前記設定手段は、前記顔検出手段により検出された顔のサイズが所定サイズよりも小さい場合、前記第2の焦点検出領域の大きさを前記第1の焦点検出領域の大きさよりも大きくなるように設定することを特徴とする焦点検出装置。
Face detection means for detecting the position and size of a human face from a captured image;
As a focus detection area for detecting the in-focus state of the imaging optical system, the first focus detection area where the person's face exists and the person's body are predicted to be located as seen from the position of the person's face. Setting means for setting a second focus detection area;
Focus adjusting means for adjusting the focus by moving the imaging optical system based on the signal output in the focus detection region;
The setting means is configured to make the size of the second focus detection area larger than the size of the first focus detection area when the size of the face detected by the face detection means is smaller than a predetermined size. A focus detection device characterized by setting.
前記設定手段は、前記第2の焦点検出領域を前記体に対して水平方向に分割して複数の焦点検出領域とすることを特徴とする請求項1に記載の焦点検出装置。   The focus detection apparatus according to claim 1, wherein the setting unit divides the second focus detection region in a horizontal direction with respect to the body to form a plurality of focus detection regions. 撮像画像から人物の顔が存在する位置を検出する顔検出手段と、
撮像光学系の合焦状態を検出する際の焦点検出領域として、前記人物の顔が存在する第1の焦点検出領域と、前記人物の顔の位置から見て前記人物の体が位置すると予測される第2の焦点検出領域とを設定する設定手段と、
前記焦点検出領域における信号出力に基づいて前記撮像光学系を移動させて焦点調節を行う焦点調節手段とを有し、
前記設定手段は、前記第2の焦点検出領域を前記体に対して水平方向に分割して複数の焦点検出領域とすることを特徴とする焦点検出装置。
Face detection means for detecting a position where a human face is present from a captured image;
As a focus detection area for detecting the in-focus state of the imaging optical system, the first focus detection area where the person's face exists and the person's body are predicted to be located as seen from the position of the person's face. Setting means for setting a second focus detection area;
Focus adjusting means for adjusting the focus by moving the imaging optical system based on the signal output in the focus detection region;
The focus detection apparatus, wherein the setting means divides the second focus detection region in a horizontal direction with respect to the body to form a plurality of focus detection regions.
前記顔検出手段は、さらに顔の角度を検出し、
前記設定手段は、前記顔の角度に応じて前記第2の焦点検出領域の分割する方向を変えることを特徴とする請求項2又は請求項3に記載の焦点検出装置。
The face detection means further detects the angle of the face,
4. The focus detection apparatus according to claim 2, wherein the setting unit changes a direction in which the second focus detection area is divided in accordance with an angle of the face. 5.
前記設定手段は、前記顔検出手段により検出された顔のサイズに応じて前記第2の焦点検出領域の分割数を変更することを特徴とする請求項2乃至請求項4のいずれか1項に記載の焦点検出装置。   The said setting means changes the division | segmentation number of a said 2nd focus detection area according to the size of the face detected by the said face detection means, The any one of Claim 2 thru | or 4 characterized by the above-mentioned. The focus detection apparatus described. 前記設定手段は、前記顔検出手段により検出された顔の位置に応じて前記第2の焦点検出領域の縦横比を変更することを特徴とする請求項2乃至5のいずれか1項に記載の焦点検出装置。   The said setting means changes the aspect ratio of the said 2nd focus detection area according to the position of the face detected by the said face detection means, The any one of Claim 2 thru | or 5 characterized by the above-mentioned. Focus detection device. 前記設定手段は、前記人物の顔の位置から見て前記人物の体が位置すると予測される位置に、前記顔検出手段により他の顔が検出された場合には、前記第2の焦点検出領域の設定を変更することを特徴とする請求項2乃至請求項6のいずれか1項に記載の焦点検出装置。   The setting means, when another face is detected by the face detection means at a position where the body of the person is predicted to be seen from the position of the face of the person, the second focus detection area The focus detection apparatus according to claim 2, wherein the setting is changed. 撮像画像から人物の顔が存在する位置とサイズを検出する顔検出工程と、
撮像光学系の合焦状態を検出する際の焦点検出領域として、前記人物の顔が存在する第1の焦点検出領域と、前記人物の顔の位置から見て前記人物の体が位置すると予測される第2の焦点検出領域とを設定する設定工程と、
前記焦点検出領域における信号出力に基づいて前記撮像光学系を移動させて焦点調節を行う焦点調節工程とを有し、
前記設定工程では、前記顔検出工程により検出された顔のサイズが所定サイズよりも小さい場合、前記第2の焦点検出領域の大きさを前記第1の焦点検出領域の大きさよりも大きくなるように設定することを特徴とする焦点検出方法。
A face detection step of detecting the position and size of a human face from a captured image;
As a focus detection area for detecting the in-focus state of the imaging optical system, the first focus detection area where the person's face exists and the person's body are predicted to be located as seen from the position of the person's face. A setting step for setting the second focus detection area,
A focus adjustment step of performing focus adjustment by moving the imaging optical system based on a signal output in the focus detection region,
In the setting step, when the size of the face detected in the face detection step is smaller than a predetermined size, the size of the second focus detection region is made larger than the size of the first focus detection region. A focus detection method comprising: setting.
撮像画像から人物の顔が存在する位置を検出する顔検出工程と、
撮像光学系の合焦状態を検出する際の焦点検出領域として、前記人物の顔が存在する第1の焦点検出領域と、前記人物の顔の位置から見て前記人物の体が位置すると予測される第2の焦点検出領域とを設定する設定工程と、
前記焦点検出領域における信号出力に基づいて前記撮像光学系を移動させて焦点調節を行う焦点調節工程とを有し、
前記設定工程では、前記第2の焦点検出領域を前記体に対して水平方向に分割して複数の焦点検出領域とすることを特徴とする焦点検出方法。
A face detection step of detecting a position where a human face exists from the captured image;
As a focus detection area for detecting the in-focus state of the imaging optical system, the first focus detection area where the person's face exists and the person's body are predicted to be located as seen from the position of the person's face. A setting step for setting the second focus detection area,
A focus adjustment step of performing focus adjustment by moving the imaging optical system based on a signal output in the focus detection region,
In the setting step, the second focus detection region is divided in a horizontal direction with respect to the body to form a plurality of focus detection regions.
JP2010281052A 2010-12-16 2010-12-16 Focus detection apparatus and focus detection method Active JP5765931B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010281052A JP5765931B2 (en) 2010-12-16 2010-12-16 Focus detection apparatus and focus detection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010281052A JP5765931B2 (en) 2010-12-16 2010-12-16 Focus detection apparatus and focus detection method

Publications (2)

Publication Number Publication Date
JP2012128287A true JP2012128287A (en) 2012-07-05
JP5765931B2 JP5765931B2 (en) 2015-08-19

Family

ID=46645347

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010281052A Active JP5765931B2 (en) 2010-12-16 2010-12-16 Focus detection apparatus and focus detection method

Country Status (1)

Country Link
JP (1) JP5765931B2 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014035516A (en) * 2012-08-10 2014-02-24 Canon Inc Image pickup device and control method thereof
JP2015114465A (en) * 2013-12-11 2015-06-22 キヤノン株式会社 Imaging device, control method therefor, and control program
JP2016090838A (en) * 2014-11-06 2016-05-23 株式会社ソシオネクスト Image processor and image processing method
JP2016090904A (en) * 2014-11-07 2016-05-23 株式会社ニコン Focus adjustment device and camera
US10003735B2 (en) 2015-08-31 2018-06-19 Canon Kabushiki Kaisha Calculation device and image pickup device using calculation device and calculation method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005321621A (en) * 2004-05-10 2005-11-17 Fujinon Corp Autofocus system
JP2008070640A (en) * 2006-05-10 2008-03-27 Canon Inc Point adjustment apparatus, imaging apparatus, control method for focus adjustment apparatus and program and recording medium
JP2008076786A (en) * 2006-09-22 2008-04-03 Sony Corp Imaging apparatus, imaging apparatus control method, and computer program
JP2009037263A (en) * 2008-11-04 2009-02-19 Canon Inc Point adjusting device, imaging device, control method for focus adjusting device, program, and recording medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005321621A (en) * 2004-05-10 2005-11-17 Fujinon Corp Autofocus system
JP2008070640A (en) * 2006-05-10 2008-03-27 Canon Inc Point adjustment apparatus, imaging apparatus, control method for focus adjustment apparatus and program and recording medium
JP2008076786A (en) * 2006-09-22 2008-04-03 Sony Corp Imaging apparatus, imaging apparatus control method, and computer program
JP2009037263A (en) * 2008-11-04 2009-02-19 Canon Inc Point adjusting device, imaging device, control method for focus adjusting device, program, and recording medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014035516A (en) * 2012-08-10 2014-02-24 Canon Inc Image pickup device and control method thereof
JP2015114465A (en) * 2013-12-11 2015-06-22 キヤノン株式会社 Imaging device, control method therefor, and control program
JP2016090838A (en) * 2014-11-06 2016-05-23 株式会社ソシオネクスト Image processor and image processing method
JP2016090904A (en) * 2014-11-07 2016-05-23 株式会社ニコン Focus adjustment device and camera
US10003735B2 (en) 2015-08-31 2018-06-19 Canon Kabushiki Kaisha Calculation device and image pickup device using calculation device and calculation method

Also Published As

Publication number Publication date
JP5765931B2 (en) 2015-08-19

Similar Documents

Publication Publication Date Title
JP6029309B2 (en) Focus detection device
WO2012144195A1 (en) Image capture device, image capture device focus control method, and integrated circuit
JP4578334B2 (en) In-focus position determining apparatus and method for imaging lens
JP2010015024A (en) Image pickup apparatus, control method thereof, program and storage medium
CN109391768B (en) Focus control apparatus, focus control method, and storage medium
JP5765931B2 (en) Focus detection apparatus and focus detection method
JP6116277B2 (en) Imaging apparatus and control method thereof
US20040223073A1 (en) Focal length detecting method and focusing device
JP2011028048A (en) Image capturing apparatus, and method of controlling the same
JP2017129788A (en) Focus detection device and imaging device
JP2017229061A (en) Image processing apparatus, control method for the same, and imaging apparatus
JPH10142490A (en) Environment recognition device and camera
JP2019121860A (en) Image processing apparatus and control method therefor
JP2010160297A (en) Imaging apparatus, automatic focusing method, and computer program
US9357124B2 (en) Focusing control device and controlling method of the same
US7830445B2 (en) Image-pickup apparatus and focus control method for the same
JP2007240877A (en) Imaging apparatus and control method therefor
JP2012058724A (en) Imaging apparatus
JP2021132362A (en) Subject tracking device, subject tracking method, computer program, and storage medium
JP2018031966A (en) Focus detection device, focus adjustment device, imaging apparatus, and focus detection method
JP5761984B2 (en) Imaging apparatus and control method thereof
US6700651B2 (en) Ranging device
JP4935380B2 (en) Image tracking device and imaging device
JP2007251636A (en) Object tracking system
JP2021148841A (en) Automatic focus detector, automatic focus detection method, and automatic focus detection program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20131216

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20140924

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20140930

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20141201

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20150616

R151 Written notification of patent or utility model registration

Ref document number: 5765931

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151