JP2017138355A - Imaging device and imaging device control method - Google Patents

Imaging device and imaging device control method Download PDF

Info

Publication number
JP2017138355A
JP2017138355A JP2016017097A JP2016017097A JP2017138355A JP 2017138355 A JP2017138355 A JP 2017138355A JP 2016017097 A JP2016017097 A JP 2016017097A JP 2016017097 A JP2016017097 A JP 2016017097A JP 2017138355 A JP2017138355 A JP 2017138355A
Authority
JP
Japan
Prior art keywords
phase difference
pair
error
images
calculation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2016017097A
Other languages
Japanese (ja)
Inventor
恵 近野
Megumi Konno
恵 近野
昌平 中潟
Shohei Nakagata
昌平 中潟
田中 竜太
Ryuta Tanaka
竜太 田中
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2016017097A priority Critical patent/JP2017138355A/en
Publication of JP2017138355A publication Critical patent/JP2017138355A/en
Pending legal-status Critical Current

Links

Images

Landscapes

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

Abstract

PROBLEM TO BE SOLVED: To improve estimation accuracy of a reliability degree of a phase difference to be calculated by a phase difference detection method.SOLUTION: An imaging device includes: an image pick-up element that contains a row of a pair of pixels creating a pair of images for phase difference calculation; a metering device that calculates a phase difference between the pair of images; and a fucus adjustment unit that adjusts focus on the basis of the phase difference between the pair of images. The metering device includes: a phase difference calculation unit that calculates a phase difference between the pair of images; a characteristic calculation unit that calculates a steepness degree of an edge serving as a degree of a change in pixel value between mutually adjacent pixels in the pair of images on the basis of a difference of the pixel value between the pixels in the row of the pixel; a storage unit that stores preliminarily acquired accuracy information indicative of a relation between the steepness degree of the edge and an error of a calculated value of the phase difference; and a first error estimation unit that estimates a calculation error serving as the error of the calculation value of the phase difference between the pair images from the steepness degree of the edge, using the accuracy information. The focus adjustment unit is notified of the calculation value between the pair of images and calculation error.SELECTED DRAWING: Figure 1

Description

本発明は、撮像装置および撮像装置の制御方法に関する。   The present invention relates to an imaging apparatus and a method for controlling the imaging apparatus.

デジタルカメラ等の撮像装置のオートフォーカス方法の1つである位相差検出方式では、レンズを通過した位相差検出用の一対の光束に基づいて一対の画像を生成する。そして、一対の画像間の位相差を検出し、検出した位相差に基づいて焦点を調整する。なお、一対の画像の一方を生成する画素群からの信号レベルと一対の画像の他方を生成する画素群からの信号レベルとに差(以下、ゲイン差とも称する)が発生する場合がある。一対の画像間にゲイン差が発生すると、ゲイン差が発生しない場合に比べて、位相差の検出結果の精度および位相差の検出結果に対する信頼度の推定精度等が低下する場合がある。このため、一対の画像において互いに対応する画素毎の比較結果の統計的ばらつきに基づいて、一対の画像の信号レベルを補正する位相差検出装置が提案されている(例えば、特許文献1参照)。   In a phase difference detection method that is one of autofocus methods for an imaging apparatus such as a digital camera, a pair of images is generated based on a pair of light beams for phase difference detection that have passed through a lens. Then, the phase difference between the pair of images is detected, and the focus is adjusted based on the detected phase difference. Note that there may be a difference (hereinafter also referred to as a gain difference) between the signal level from the pixel group that generates one of the pair of images and the signal level from the pixel group that generates the other of the pair of images. When a gain difference occurs between a pair of images, the accuracy of the phase difference detection result and the reliability estimation accuracy for the phase difference detection result may be lower than when no gain difference occurs. For this reason, there has been proposed a phase difference detection device that corrects the signal level of a pair of images based on the statistical variation of the comparison results for each pixel corresponding to each other in the pair of images (see, for example, Patent Document 1).

また、焦点検出用の画素(以下、瞳分割画素とも称する)と、撮像用と焦点検出用とを兼用する画素(以下、全瞳画素とも称する)とを用いて、焦点を調整するカメラが提案されている(例えば、特許文献2参照)。瞳分割画素により生成される画像(以下、瞳分割画像とも称する)と全瞳画素により生成される画像(以下、全瞳画像とも称する)とでは、像形状が異なる場合がある。このため、瞳分割画素と全瞳画素とを用いて焦点を調整するカメラは、瞳分割画像と全瞳画像との像形状の差異を補正した後、瞳分割画像と全瞳画像との位相差を検出する。   Also, a camera that adjusts the focus by using pixels for focus detection (hereinafter also referred to as pupil division pixels) and pixels that are used for both imaging and focus detection (hereinafter also referred to as all pupil pixels) is proposed. (For example, see Patent Document 2). An image shape may be different between an image generated by pupil-divided pixels (hereinafter also referred to as pupil-divided image) and an image generated by all-pupil pixels (hereinafter also referred to as all-pupil image). For this reason, a camera that adjusts the focus using pupil-divided pixels and all-pupil pixels corrects the difference in image shape between the pupil-divided image and all-pupil image, and then the phase difference between the pupil-divided image and all-pupil image. Is detected.

特開2010−26178号公報JP 2010-26178 A 特開2013−214048号公報JP 2013-214048 A

位相差検出用の画素が連続して配置されていない場合、すなわち、位相差検出用の画素が所定の画素間隔で配置されている場合、一対の位相差検出用の画素の列から生成される一対の画像間で、画素の位置と画素値との関係を示すグラフの形状が異なる場合がある。この場合、一対の画像間の位相差の算出値に誤差が発生する。また、画素の位置と画素値との関係を示すグラフの形状が一対の画像間で異なる場合、画素の位置と画素値との関係を示すグラフの形状が一対の画像間で一致する場合に比べて、位相差の検出結果に対する信頼度の推定精度が低下するおそれがある。   When the phase difference detection pixels are not continuously arranged, that is, when the phase difference detection pixels are arranged at a predetermined pixel interval, the phase difference detection pixels are generated from a pair of phase difference detection pixel columns. The shape of a graph showing the relationship between the pixel position and the pixel value may be different between a pair of images. In this case, an error occurs in the calculated value of the phase difference between the pair of images. Also, when the shape of the graph indicating the relationship between the pixel position and the pixel value is different between the pair of images, compared to the case where the shape of the graph indicating the relationship between the pixel position and the pixel value is identical between the pair of images. Thus, there is a risk that the estimation accuracy of the reliability with respect to the detection result of the phase difference is lowered.

1つの側面では、本発明は、位相差検出方式により算出される位相差の信頼度の推定精度を向上させることを目的とする。   In one aspect, an object of the present invention is to improve the estimation accuracy of the reliability of the phase difference calculated by the phase difference detection method.

一観点によれば、撮像装置は、レンズの互いに異なる領域を通過した被写体からの光束に基づいて位相差算出用の一対の画像を生成する一対の画素の列を含む撮像素子と、レンズの合焦時の位置からのずれ量に応じて発生する一対の画像間の位相差を算出する測距装置と、測距装置により算出された一対の画像間の位相差に基づいて焦点を調整する焦点調整部とを有し、測距装置は、一対の画像間の位相差を算出する位相差算出部と、一対の画像における互いに隣接する画素間での画素値の変化の度合いであるエッジの急峻度を、画素の列における画素間の画素値の差に基づいて算出する特徴算出部と、エッジの急峻度と位相差の算出値の誤差との関係を示す情報であって、予め取得された精度情報を記憶する記憶部と、一対の画像間の位相差の算出値の誤差である算出誤差を、精度情報を用いて、一対の画像のエッジの急峻度から推定する第1誤差推定部とを有し、一対の画像間の位相差の算出値および算出誤差を焦点調整部に通知する。   According to one aspect, an imaging apparatus includes an imaging device including a pair of pixels that generate a pair of images for calculating a phase difference based on a light flux from a subject that has passed through different regions of the lens, and a lens. A distance measuring device that calculates a phase difference between a pair of images generated according to a deviation amount from the position at the time of focus, and a focus that adjusts the focus based on the phase difference between the pair of images calculated by the distance measuring device The distance measuring apparatus includes a phase difference calculating unit that calculates a phase difference between a pair of images, and a steep edge that is a degree of change in pixel value between adjacent pixels in the pair of images. Information indicating the relationship between the feature calculation unit for calculating the degree based on the pixel value difference between the pixels in the pixel column, and the error between the sharpness of the edge and the calculated value of the phase difference, and obtained in advance Storage unit for storing accuracy information and phase between a pair of images A first error estimator that estimates the calculation error, which is an error of the calculated value, from the steepness of the edges of the pair of images using the accuracy information, and the calculated value and calculation of the phase difference between the pair of images The error is notified to the focus adjustment unit.

別の観点によれば、レンズの互いに異なる領域を通過した被写体からの光束に基づいて位相差算出用の一対の画像を生成する一対の画素の列を含む撮像素子と、レンズの合焦時の位置からのずれ量に応じて発生する一対の画像間の位相差を算出する測距装置と、測距装置により算出された一対の画像間の位相差に基づいて焦点を調整する焦点調整部とを有する撮像装置の制御方法では、測距装置が、一対の画像間の位相差を算出し、一対の画像における互いに隣接する画素間での画素値の変化の度合いであるエッジの急峻度を、画素の列における画素間の画素値の差に基づいて算出し、エッジの急峻度と位相差の算出値の誤差との関係を示す情報であって、予め取得された精度情報を用いて、一対の画像間の位相差の算出値の誤差である算出誤差を一対の画像のエッジの急峻度から推定し、一対の画像間の位相差の算出値および算出誤差を焦点調整部に通知する。   According to another aspect, an imaging device including a pair of pixels that generate a pair of images for phase difference calculation based on light beams from subjects that have passed through different regions of the lens, and a lens at the time of focusing A distance measuring device that calculates a phase difference between a pair of images generated according to a deviation amount from the position, and a focus adjustment unit that adjusts a focus based on the phase difference between the pair of images calculated by the distance measuring device; In the control method of the image pickup apparatus having the above, the distance measuring device calculates the phase difference between the pair of images, and determines the steepness of the edge, which is the degree of change in the pixel value between adjacent pixels in the pair of images. Information calculated based on a difference in pixel values between pixels in a pixel column and indicating the relationship between the sharpness of the edge and the error in the calculated value of the phase difference, and using the accuracy information acquired in advance, Calculation that is the error of the calculated value of phase difference between images Estimating the difference from steepness of the edges of the pair of images, and notifies the focusing unit a calculated value and the calculation error of the phase difference between the pair of images.

位相差検出方式により算出される位相差の信頼度の推定精度を向上させることができる。   The estimation accuracy of the reliability of the phase difference calculated by the phase difference detection method can be improved.

撮像装置および撮像装置の制御方法の一実施形態を示す図である。It is a figure which shows one Embodiment of the imaging device and the control method of an imaging device. 撮像装置および撮像装置の制御方法の別の実施形態を示す図である。It is a figure which shows another embodiment of the imaging device and the control method of an imaging device. 位相差検出方式による焦点調整の概要を示す図である。It is a figure which shows the outline | summary of the focus adjustment by a phase difference detection system. エッジの急峻度と推定位相差の誤差との関係の一例を示す図である。It is a figure which shows an example of the relationship between the steepness of an edge, and the difference | error of an estimated phase difference. オフセットと推定位相差の誤差との関係の一例を示す図である。It is a figure which shows an example of the relationship between an offset and the error of an estimated phase difference. 精度情報の生成方法の一例を示す図である。It is a figure which shows an example of the production | generation method of precision information. 図2に示した撮像装置の動作の一例を示す図である。FIG. 3 is a diagram illustrating an example of an operation of the imaging device illustrated in FIG. 2. 図7に示した位相差算出処理の一例を示す図である。It is a figure which shows an example of the phase difference calculation process shown in FIG. 焦点の調整方法の一例を示す図である。It is a figure which shows an example of the adjustment method of a focus. 撮像装置および撮像装置の制御方法の別の実施形態を示す図である。It is a figure which shows another embodiment of the imaging device and the control method of an imaging device. 図10に示した測距装置の動作の一例を示す図である。It is a figure which shows an example of operation | movement of the ranging apparatus shown in FIG.

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

図1は、撮像装置および撮像装置の制御方法の一実施形態を示す。図1に示す撮像装置10は、例えば、レンズ20と撮像素子30と測距装置100と焦点調整部200とを有するデジタルカメラである。レンズ20は、被写体の像を撮像素子30の撮像領域(受光面)に結像する。撮像素子30は、CCD(Charge Coupled Device)またはCMOS(Complementary Metal Oxide Semiconductor)等を用いたイメージセンサである。例えば、撮像素子30は、複数の画像表示用の画素PX10と、一対の位相差算出用の画素PX2(PX21、PX22)の列とを有し、レンズ20を介して受ける光束に基づいて画像IMGを生成する。図1では、位相差算出用の画素PX21の列および画素PX22の列の一例と、位相差算出用の一対の画像IMGf(IMGfl、IMGfr)の各画素値の一例とを括弧内に示す。   FIG. 1 shows an embodiment of an imaging apparatus and a method for controlling the imaging apparatus. An imaging apparatus 10 illustrated in FIG. 1 is a digital camera including, for example, a lens 20, an imaging element 30, a distance measuring apparatus 100, and a focus adjustment unit 200. The lens 20 forms an image of the subject on the imaging region (light receiving surface) of the imaging device 30. The image sensor 30 is an image sensor using a CCD (Charge Coupled Device) or a CMOS (Complementary Metal Oxide Semiconductor). For example, the imaging element 30 includes a plurality of image display pixels PX10 and a pair of phase difference calculation pixels PX2 (PX21, PX22), and an image IMG based on a light flux received through the lens 20. Is generated. In FIG. 1, an example of the column of the pixel PX21 and the column of the pixel PX22 for calculating the phase difference and an example of each pixel value of the pair of images IMGf (IMGfl, IMGfr) for calculating the phase difference are shown in parentheses.

図1に示す例では、一対の位相差算出用の画素PX21、PX22は、撮像素子30の中央付近の領域AR1に左右方向沿って2画素置きに配置される。すなわち、一対の位相差算出用の画素PX2の列は、撮像素子30の中央付近の領域AR1に配置される。なお、一対の位相差算出用の画素PX2の列は、撮像素子30の中央付近以外の領域に配置されてもよい。また、撮像素子30は、一対の位相差算出用の画素PX2の列を複数有してもよい。各画素PX(PX10、PX21、PX22)の受光面上には図示しないマイクロレンズが配置される。各画素PXは、レンズ20およびマイクロレンズを介して入射される被写体からの光束を、画素値を示す電気信号に変換する。   In the example illustrated in FIG. 1, the pair of phase difference calculation pixels PX21 and PX22 are arranged in the region AR1 near the center of the image sensor 30 every two pixels along the left-right direction. That is, the pair of phase difference calculation pixels PX <b> 2 is arranged in the area AR <b> 1 near the center of the image sensor 30. Note that the column of the pair of phase difference calculation pixels PX <b> 2 may be arranged in a region other than the vicinity of the center of the image sensor 30. Further, the imaging element 30 may include a plurality of columns of a pair of phase difference calculation pixels PX2. A microlens (not shown) is disposed on the light receiving surface of each pixel PX (PX10, PX21, PX22). Each pixel PX converts a light beam from a subject incident through the lens 20 and the microlens into an electric signal indicating a pixel value.

位相差算出用の各画素PX21は、例えば、受光面の右半分が遮光用の部材により遮光され、レンズ20の右半分を通過した被写体からの光束を受ける。これにより、画素PX21の列は、レンズ20の右半分を通過した被写体からの光束に基づいて、位相差算出用の一対の画像IMGf(IMGfl、IMGfr)のうちの画像IMGfrを生成する。以下、画像IMGfrは、右画像IMGfrとも称される。図1等の図面では、遮光される受光面を黒色で示す。   In each pixel PX21 for phase difference calculation, for example, the right half of the light receiving surface is shielded by a light shielding member, and receives a light beam from a subject that has passed through the right half of the lens 20. Thereby, the column of the pixels PX21 generates an image IMGfr of the pair of images IMGf (IMGfl, IMGfr) for phase difference calculation based on the light flux from the subject that has passed through the right half of the lens 20. Hereinafter, the image IMGfr is also referred to as a right image IMGfr. In the drawings such as FIG. 1, the light receiving surface that is shielded from light is shown in black.

位相差算出用の各画素PX22は、例えば、受光面の左半分が遮光用の部材により遮光され、レンズ20の左半分を通過した被写体からの光束を受ける。これにより、画素PX22の列は、レンズ20の左半分を通過した被写体からの光束に基づいて、位相差算出用の一対の画像IMGfのうちの画像IMGflを生成する。以下、画像IMGflは、左画像IMGflとも称される。   In each pixel PX22 for phase difference calculation, for example, the left half of the light receiving surface is shielded by a light shielding member and receives a light beam from a subject that has passed through the left half of the lens 20. Thereby, the column of the pixels PX22 generates an image IMGfl of the pair of images IMGf for phase difference calculation based on the light flux from the subject that has passed through the left half of the lens 20. Hereinafter, the image IMGfl is also referred to as a left image IMGfl.

このように、撮像素子30は、レンズ20の互いに異なる領域を通過した被写体からの光束に基づいて、位相差算出用の一対の画像IMGf(図1に示す例では、左右に瞳分割した一対の像)を生成する。そして、焦点が調整された後、撮像素子30は、位相差算出用の各画素PX21、PX22の画素値を周辺の画素PX10の画素値等を用いて補間して、表示用の画像IMGを生成する。   As described above, the image sensor 30 is based on the light flux from the subject that has passed through different areas of the lens 20 and a pair of images IMGf for phase difference calculation (in the example shown in FIG. Image). After the focus is adjusted, the imaging device 30 generates a display image IMG by interpolating the pixel values of the pixels PX21 and PX22 for calculating the phase difference using the pixel values of the surrounding pixels PX10 and the like. To do.

ここで、図1に示す例では、一対の位相差算出用の画素PX2の列から生成される一対の画像IMGf間で、画素PX2の位置と画素値との関係を示すグラフの形状(以下、画素値列の形状とも称する)が異なる。図1の括弧内のグラフの横軸は、撮像素子30における左右方向の画素PX2の位置を示し、縦軸は、画素PX2の画素値を示す。例えば、グラフの○印は、右画像IMGfrの各画素PX21の画素値を示し、グラフの×印は、左画像IMGflの各画素PX22の画素値を示す。また、破線は、画素PX21が画素PX10を挟まずに連続して配置された場合の理想的な画素値列の形状を示し、点線は、画素PX22が画素PX10を挟まずに連続して配置された場合の理想的な画素値列の形状を示す。画素PX21、PX22の各々が左右方向に連続して配置される場合、画素値列の形状は、右画像IMGfrと左画像IMGflとでほぼ同じである(図1のグラフの破線および点線)。   Here, in the example illustrated in FIG. 1, a graph shape (hereinafter, referred to as a relationship between the position of the pixel PX2 and the pixel value between the pair of images IMGf generated from the column of the pair of phase difference calculation pixels PX2). The shape of the pixel value sequence is also different). The horizontal axis of the graph in parentheses in FIG. 1 indicates the position of the pixel PX2 in the left-right direction in the image sensor 30, and the vertical axis indicates the pixel value of the pixel PX2. For example, a circle in the graph indicates the pixel value of each pixel PX21 in the right image IMGfr, and a cross in the graph indicates the pixel value of each pixel PX22 in the left image IMGfl. A broken line indicates an ideal pixel value sequence when the pixels PX21 are continuously arranged without sandwiching the pixel PX10, and a dotted line indicates that the pixel PX22 is continuously arranged without sandwiching the pixel PX10. In this case, an ideal pixel value string shape is shown. When each of the pixels PX21 and PX22 is continuously arranged in the left-right direction, the shape of the pixel value sequence is substantially the same in the right image IMGfr and the left image IMGfl (broken line and dotted line in the graph of FIG. 1).

これに対し、画素PX21、PX22の各々が離散的(図1に示す例では、2画素置き)に配置される場合、画素値列の形状は、右画像IMGfrと左画像IMGflとで異なる(図1のグラフの実線)。一対の画像IMGf間で画素値列の形状が異なる場合、一対の画像IMGf間で画素値列の形状に差異がない場合に比べて、一対の画像IMGf間の位相差の算出値の誤差の推定精度が低下するおそれがある。このため、図1に示す撮像装置10の測距装置100は、後述するように、画像IMGfの画素値列の形状を考慮して、一対の画像IMGf間の位相差の算出値の誤差を推定する。   On the other hand, when the pixels PX21 and PX22 are discretely arranged (every two pixels in the example shown in FIG. 1), the shape of the pixel value sequence differs between the right image IMGfr and the left image IMGfl (FIG. The solid line in the graph of 1). When the shape of the pixel value sequence is different between the pair of images IMGf, the error of the calculated value of the phase difference between the pair of images IMGf is estimated compared to the case where the shape of the pixel value sequence is not different between the pair of images IMGf. The accuracy may be reduced. Therefore, the distance measuring device 100 of the imaging device 10 shown in FIG. 1 estimates the error of the calculated value of the phase difference between the pair of images IMGf in consideration of the shape of the pixel value sequence of the image IMGf, as will be described later. To do.

測距装置100は、レンズ20の合焦時の位置からのずれ量に応じて発生する一対の画像IMGf間の位相差を算出する。例えば、測距装置100は、記憶部110、位相差算出部120、特徴算出部130および誤差推定部140を有する。   The distance measuring device 100 calculates a phase difference between the pair of images IMGf that is generated according to the amount of deviation of the lens 20 from the in-focus position. For example, the distance measuring device 100 includes a storage unit 110, a phase difference calculation unit 120, a feature calculation unit 130, and an error estimation unit 140.

記憶部110は、画素の列における互いに隣接する画素間での画素値の変化の度合いであるエッジの急峻度と位相差の算出値の誤差との関係を示す情報であって、予め取得された精度情報AINFを記憶する。位相差の算出値の誤差は、例えば、位相差検出方式により算出される位相差(以下、推定位相差とも称する)の誤差である。   The storage unit 110 is information indicating the relationship between the sharpness of the edge, which is the degree of change in the pixel value between adjacent pixels in the pixel column, and the error in the calculated value of the phase difference, and is acquired in advance. The accuracy information AINF is stored. The error of the calculated value of the phase difference is, for example, an error of the phase difference calculated by the phase difference detection method (hereinafter also referred to as the estimated phase difference).

例えば、エッジの急峻度と推定位相差の誤差との関係は、直線または誤差関数等により表され、画素の位置と画素値との関係を示す基準グラフを用いて生成される一対の画素値列(以下、擬似画素値列とも称する)を用いて、予め算出される。一対の擬似画素値列は、基準グラフに対し、所定の位相差に対応する画素数分だけ異なる位置から互いに同じ画素間隔で画素値をそれぞれ取得することにより生成される。この場合、位相差算出部120と同一または同様の方法により算出される一対の擬似画素値列の推定位相差と、一対の擬似画素値列を生成する際の所定の位相差との差は、推定位相差の誤差に対応する。エッジの急峻度に対応する基準グラフの傾きを様々に変化させて一対の擬似画素値列を生成することにより、一対の擬似画素値列を用いて算出される推定位相差の誤差とエッジの急峻度との関係を示す精度情報AINFは、予め算出される。例えば、精度情報AINFは、測距装置100の設計時等に算出され、測距装置100の製造時等に記憶部110に格納される。   For example, the relationship between the steepness of the edge and the error of the estimated phase difference is represented by a straight line or an error function or the like, and a pair of pixel value sequences generated using a reference graph indicating the relationship between the pixel position and the pixel value (Hereinafter, also referred to as a pseudo pixel value sequence). The pair of pseudo pixel value sequences is generated by acquiring pixel values at the same pixel interval from positions different from each other by the number of pixels corresponding to a predetermined phase difference with respect to the reference graph. In this case, the difference between the estimated phase difference of the pair of pseudo pixel value sequences calculated by the same or similar method as the phase difference calculation unit 120 and the predetermined phase difference when generating the pair of pseudo pixel value sequences is: Corresponds to the error of the estimated phase difference. By generating a pair of pseudo pixel value sequences by varying the slope of the reference graph corresponding to the edge steepness, an error in the estimated phase difference calculated using the pair of pseudo pixel value sequences and the edge steepness are generated. The accuracy information AINF indicating the relationship with the degree is calculated in advance. For example, the accuracy information AINF is calculated when the distance measuring device 100 is designed, and stored in the storage unit 110 when the distance measuring device 100 is manufactured.

位相差算出部120は、位相差算出用の一対の画像IMGfを示す信号を撮像素子30から受け、一対の画像IMGf間の位相差を算出する。例えば、位相差算出部120は、左画像IMGflに対して右画像IMGfrの位置をシフトしながら、画像IMGfl、IMGfrの互いに対応する位置の画素PX2の値の差分絶対値和を逐次算出する。そして、位相差算出部120は、差分絶対値和が最小になるシフト量を、一対の画像IMGf間の位相差として算出する。位相差算出部120は、一対の画像IMGf間の位相差の算出値を示す情報PDINFを、誤差推定部140および焦点調整部200に出力する。以下、差分絶対値和は、SAD(Sum of Absolute Difference)とも称される。   The phase difference calculation unit 120 receives a signal indicating a pair of images IMGf for phase difference calculation from the image sensor 30 and calculates a phase difference between the pair of images IMGf. For example, the phase difference calculation unit 120 sequentially calculates the sum of absolute differences between the values of the pixels PX2 at positions corresponding to the images IMGfl and IMGfr while shifting the position of the right image IMGfr with respect to the left image IMGfl. Then, the phase difference calculation unit 120 calculates the shift amount that minimizes the sum of absolute differences as the phase difference between the pair of images IMGf. The phase difference calculation unit 120 outputs information PDINF indicating the calculated value of the phase difference between the pair of images IMGf to the error estimation unit 140 and the focus adjustment unit 200. Hereinafter, the sum of absolute differences is also referred to as SAD (Sum of Absolute Difference).

特徴算出部130は、位相差算出用の一対の画像IMGfを示す信号を撮像素子30から受ける。そして、特徴算出部130は、一対の画像IMGfの形状の特徴として、一対の画像IMGfのエッジの急峻度を、位相差算出用の画素PX2の列における画素間の画素値の差に基づいて算出する。例えば、特徴算出部130は、互いに隣接する画素PX21の画素値の差分を互いに隣接する画素PX21の組毎に算出する。そして、特徴算出部130は、互いに隣接する画素PX21の画素値の差分の二乗和を互いに隣接する画素PX21の画素値の差分の総和で除算し、除算結果を一対の画像IMGfのエッジの急峻度として算出する。特徴算出部130は、一対の画像IMGfのエッジの急峻度を示す情報EGINFを、誤差推定部140に出力する。   The feature calculation unit 130 receives a signal indicating the pair of images IMGf for calculating the phase difference from the image sensor 30. Then, the feature calculation unit 130 calculates the steepness of the edges of the pair of images IMGf as the feature of the shape of the pair of images IMGf based on the pixel value difference between the pixels in the column of the phase difference calculation pixels PX2. To do. For example, the feature calculation unit 130 calculates a difference between pixel values of adjacent pixels PX21 for each set of adjacent pixels PX21. Then, the feature calculation unit 130 divides the sum of squares of the pixel value differences of the adjacent pixels PX21 by the sum of the difference of the pixel values of the adjacent pixels PX21, and the division result is the steepness of the edges of the pair of images IMGf. Calculate as The feature calculation unit 130 outputs information EGINF indicating the steepness of the edges of the pair of images IMGf to the error estimation unit 140.

なお、特徴算出部130は、互いに隣接する画素PX22の画素値の差分の二乗和を互いに隣接する画素PX22の画素値の差分の総和で除算した結果を、一対の画像IMGfのエッジの急峻度として算出してよい。あるいは、特徴算出部130は、互いに隣接する画素PX21の画素値の差分を用いて算出したエッジの急峻度と互いに隣接する画素PX22の画素値の差分を用いて算出したエッジの急峻度との平均を、一対の画像IMGfのエッジの急峻度として算出してもよい。   The feature calculation unit 130 divides the sum of the squares of the pixel values of the adjacent pixels PX22 by the sum of the differences of the pixel values of the adjacent pixels PX22 as the steepness of the edges of the pair of images IMGf. It may be calculated. Alternatively, the feature calculation unit 130 calculates the average of the edge steepness calculated using the difference between the pixel values of the adjacent pixels PX21 and the edge steepness calculated using the difference between the pixel values of the adjacent pixels PX22. May be calculated as the steepness of the edges of the pair of images IMGf.

一対の画像IMGfのエッジの急峻度の算出方法は、画素値の差分の二乗和を画素値の差分の総和で除算する方法に限定されない。例えば、特徴算出部130は、画素値の差分の二乗和を画素値の差分の総和で除算する代わりに画素値の差分の平均を算出し、画素値の差分の平均を一対の画像IMGfのエッジの急峻度としてもよい。一対の画像IMGfのエッジの急峻度の算出方法は、精度情報AINFに用いるエッジの急峻度の算出方法と一致していればよい。   The method for calculating the steepness of the edges of the pair of images IMGf is not limited to the method of dividing the square sum of the pixel value differences by the sum of the pixel value differences. For example, the feature calculation unit 130 calculates the average of the pixel value differences instead of dividing the square sum of the pixel value differences by the sum of the pixel value differences, and calculates the average of the pixel value differences as the edges of the pair of images IMGf. It may be a steepness of. The method for calculating the edge steepness of the pair of images IMGf only needs to match the method for calculating the edge steepness used for the accuracy information AINF.

誤差推定部140は、一対の画像IMGf間の位相差の算出値の誤差である算出誤差を、精度情報AINFと一対の画像IMGfのエッジの急峻度とに基づいて推定する。例えば、誤差推定部140は、記憶部110から受ける精度情報AINFが示す推定位相差の誤差とエッジの急峻度との関係を参照し、特徴算出部130により算出されたエッジの急峻度に対応する推定位相差の誤差を位相差の算出誤差として推定する。そして、誤差推定部140は、位相差の算出誤差を示す情報ERINFを、焦点調整部200に出力する。すなわち、誤差推定部140は、一対の画像IMGf間の位相差の算出値の誤差である算出誤差を、精度情報AINFを用いて、一対の画像IMGfのエッジの急峻度から推定する第1誤差推定部の一例である。   The error estimation unit 140 estimates a calculation error that is an error of a calculated value of the phase difference between the pair of images IMGf based on the accuracy information AINF and the steepness of the edges of the pair of images IMGf. For example, the error estimation unit 140 refers to the relationship between the error of the estimated phase difference indicated by the accuracy information AINF received from the storage unit 110 and the steepness of the edge, and corresponds to the steepness of the edge calculated by the feature calculation unit 130. The estimated phase difference error is estimated as a phase difference calculation error. Then, the error estimation unit 140 outputs information ERINF indicating the phase difference calculation error to the focus adjustment unit 200. That is, the error estimation unit 140 estimates a calculation error, which is an error of a calculated value of the phase difference between the pair of images IMGf, from the steepness of the edges of the pair of images IMGf using the accuracy information AINF. It is an example of a part.

このように、測距装置100は、一対の画像IMGf間の位相差の算出値および算出誤差を焦点調整部200に通知する。   As described above, the distance measuring device 100 notifies the focus adjustment unit 200 of the calculated value and calculation error of the phase difference between the pair of images IMGf.

ここで、画素PX21、PX22の各々が離散的(図1に示す例では、2画素間隔)に配置される場合、一対の画像IMGf間の画素値列の形状の差異は、一対の画像IMGfのエッジの急峻度が大きくなるほど大きくなる傾向がある。また、一対の画像間の画素値列の形状の差異が大きくなるほど、位相差の算出値に対する信頼度の推定精度が低下するおそれがある。すなわち、一対の画像IMGf間の位相差の算出値の誤差は、一対の画像IMGfのエッジの急峻度が大きくなるほど大きくなる傾向がある。したがって、一対の画像IMGfのエッジの急峻度を考慮しない従来の位相差検出方法では、一対の画像IMGfのエッジの急峻度が大きくなるほど、位相差の算出値に対する信頼度の推定精度が低下するおそれがある。   Here, when each of the pixels PX21 and PX22 is discretely arranged (in the example illustrated in FIG. 1, at intervals of two pixels), the difference in the shape of the pixel value sequence between the pair of images IMGf is the difference between the pair of images IMGf. As the steepness of the edge increases, it tends to increase. In addition, as the difference in the shape of the pixel value sequence between the pair of images increases, the reliability estimation accuracy for the calculated value of the phase difference may decrease. That is, the error in the calculated value of the phase difference between the pair of images IMGf tends to increase as the steepness of the edges of the pair of images IMGf increases. Therefore, in the conventional phase difference detection method that does not consider the steepness of the edges of the pair of images IMGf, the estimation accuracy of the reliability with respect to the calculated value of the phase difference may decrease as the steepness of the edges of the pair of images IMGf increases. There is.

これに対し、測距装置100は、推定位相差の誤差とエッジの急峻度との関係を示す精度情報AINFに基づいて、一対の画像IMGfのエッジの急峻度に応じた推定位相差の誤差を位相差の算出誤差として推定する。これにより、測距装置100は、一対の画像IMGfのエッジの急峻度に拘わらず、すなわち、被写体によらず、一対の画像IMGf間の位相差の算出値の誤差を精度よく推定できる。すなわち、測距装置100は、位相差検出方式により算出される位相差の信頼度の推定精度を向上させることができる。   On the other hand, the distance measuring apparatus 100 calculates the error of the estimated phase difference corresponding to the edge steepness of the pair of images IMGf based on the accuracy information AINF indicating the relationship between the error of the estimated phase difference and the steepness of the edge. Estimated as phase difference calculation error. As a result, the distance measuring apparatus 100 can accurately estimate the error of the calculated value of the phase difference between the pair of images IMGf regardless of the steepness of the edges of the pair of images IMGf, that is, regardless of the subject. That is, the distance measuring device 100 can improve the accuracy of estimation of the reliability of the phase difference calculated by the phase difference detection method.

焦点調整部200は、測距装置100により算出された一対の画像IMGf間の位相差等に基づいて焦点を調整する。例えば、焦点調整部200は、一対の画像IMGf間の位相差の算出値に基づいて合焦位置を推定し、推定した合焦位置を中心として位相差の算出誤差に対応する範囲を、オートフォーカス方法の1つであるコントラスト方式の探索範囲に設定する。コントラスト方式では、コントラストの最も高い画像を検出するまでレンズの位置を移動させて画像のコントラストを逐次解析するため、探索範囲が狭いほど、合焦までの時間を短縮することができる。なお、位相差の算出誤差の推定精度が低下すると、算出誤差に対応して設定される探索範囲内に合焦位置が存在しない場合がある。また、探索範囲内に合焦位置が存在しない状態を避けるために、位相差の算出誤差に対応した範囲より探索範囲を広く設定すると、合焦までの時間が長くなる。   The focus adjustment unit 200 adjusts the focus based on the phase difference between the pair of images IMGf calculated by the distance measuring device 100. For example, the focus adjustment unit 200 estimates the focus position based on the calculated value of the phase difference between the pair of images IMGf, and sets a range corresponding to the phase difference calculation error around the estimated focus position as an autofocus. The search range is set to a contrast method which is one of the methods. In the contrast method, the lens position is moved until the image with the highest contrast is detected, and the contrast of the image is sequentially analyzed. Therefore, the narrower the search range, the shorter the time to focus. Note that when the estimation accuracy of the phase difference calculation error decreases, there may be no in-focus position within the search range set corresponding to the calculation error. In addition, in order to avoid a state where the in-focus position does not exist within the search range, if the search range is set wider than the range corresponding to the phase difference calculation error, the time until in-focus becomes longer.

図1に示す撮像装置10は、位相差の算出誤差の推定精度を向上させることができるため、算出誤差に対応した範囲を探索範囲に設定した場合でも、探索範囲内に合焦位置が存在しない状態が発生することを抑止できる。したがって、撮像装置10は、位相差の算出誤差に対応した範囲より探索範囲を広く設定する場合に比べて、合焦までの時間を短縮できる。なお、撮像装置10の構成は、図1に示す例に限定されない。   Since the imaging apparatus 10 shown in FIG. 1 can improve the estimation accuracy of the phase difference calculation error, there is no in-focus position in the search range even when the range corresponding to the calculation error is set as the search range. The occurrence of a situation can be suppressed. Therefore, the imaging apparatus 10 can shorten the time until focusing as compared with the case where the search range is set wider than the range corresponding to the phase difference calculation error. Note that the configuration of the imaging apparatus 10 is not limited to the example illustrated in FIG.

以上、図1に示す実施形態では、測距装置100は、一対の画像IMGf間の位相差を算出するとともに、一対の画像IMGfのエッジの急峻度を位相差算出用の画素PX2の列により定まる画素間の画素値の差に基づいて算出する。そして、測距装置100は、一対の画像IMGfのエッジの急峻度に対応する位相差の算出誤差を、エッジの急峻度と推定位相差の誤差との関係を示す精度情報AINFに基づいて推定する。このように、測距装置100は、一対の画像IMGf間の位相差の算出値の誤差である算出誤差を、一対の画像IMGfのエッジの急峻度に応じて推定する。この結果、測距装置100は、一対の画像IMGfのエッジの急峻度に拘わらず、すなわち、被写体によらず、一対の画像IMGf間の位相差の算出値の誤差を精度よく推定できる。すなわち、測距装置100は、位相差検出方式により算出される位相差の信頼度の推定精度を向上させることができる。これにより、撮像装置10は、例えば、コントラスト方式における探索範囲を適切に設定でき、合焦までの時間を短縮できる。   As described above, in the embodiment shown in FIG. 1, the distance measuring device 100 calculates the phase difference between the pair of images IMGf and determines the steepness of the edges of the pair of images IMGf by the column of the pixels PX2 for calculating the phase difference. It calculates based on the difference of the pixel value between pixels. Then, the distance measuring apparatus 100 estimates the phase difference calculation error corresponding to the edge steepness of the pair of images IMGf based on the accuracy information AINF indicating the relationship between the edge steepness and the estimated phase difference error. . As described above, the distance measuring apparatus 100 estimates a calculation error, which is an error of a calculated value of the phase difference between the pair of images IMGf, according to the steepness of the edges of the pair of images IMGf. As a result, the distance measuring apparatus 100 can accurately estimate the error of the calculated value of the phase difference between the pair of images IMGf regardless of the steepness of the edges of the pair of images IMGf, that is, regardless of the subject. That is, the distance measuring device 100 can improve the accuracy of estimation of the reliability of the phase difference calculated by the phase difference detection method. Thereby, the imaging device 10 can appropriately set the search range in the contrast method, for example, and can shorten the time until focusing.

図2は、撮像装置および撮像装置の制御方法の別の実施形態を示す。図1で説明した要素と同一または同様の要素については、同一または同様の符号を付し、これ等については、詳細な説明を省略する。図2に示す撮像装置12は、図1に示した測距装置100の代わりに測距装置102を有することを除いて、図1に示した撮像装置10と同一または同様である。例えば、撮像装置10は、レンズ20と撮像素子30と測距装置102と焦点調整部200とを有するデジタルカメラである。   FIG. 2 shows another embodiment of the imaging device and the control method of the imaging device. The same or similar elements as those described in FIG. 1 are denoted by the same or similar reference numerals, and detailed description thereof will be omitted. The imaging device 12 illustrated in FIG. 2 is the same as or similar to the imaging device 10 illustrated in FIG. 1 except that the ranging device 102 is included instead of the ranging device 100 illustrated in FIG. For example, the imaging apparatus 10 is a digital camera that includes a lens 20, an imaging element 30, a distance measuring apparatus 102, and a focus adjustment unit 200.

なお、図2に示す撮像素子30は、一対の位相差算出用の画素PX2の列を複数有する。図2の括弧内に示す例では、一対の位相差算出用の画素PX2の列を含む9つの局所領域LAR1、LAR2、LAR3、LAR4、LAR5、LAR6、LAR7、LAR8、LAR9が測距領域RAR内に設定される。すなわち、撮像素子30は、一対の位相差算出用の画素PX2の列が配置される局所領域LARを複数有する。一対の画像IMGfは、複数の局所領域LAR毎に生成される。したがって、図2に示す例では、一対の画像IMGfは、9つ生成される。なお、局所領域LARの数は、図2に示す例に限定されない。   2 includes a plurality of columns of a pair of phase difference calculation pixels PX2. In the example shown in parentheses in FIG. 2, nine local areas LAR1, LAR2, LAR3, LAR4, LAR5, LAR6, LAR7, LAR8, and LAR9 including a pair of phase difference calculation pixels PX2 are included in the ranging area RAR. Set to In other words, the imaging device 30 has a plurality of local regions LAR in which a column of a pair of phase difference calculation pixels PX2 is arranged. A pair of images IMGf is generated for each of a plurality of local regions LAR. Therefore, in the example illustrated in FIG. 2, nine pairs of images IMGf are generated. The number of local regions LAR is not limited to the example shown in FIG.

測距装置102は、図1に示した位相差算出部120、特徴算出部130および誤差推定部140の代わりに、位相差算出部122、特徴算出部132および誤差推定部142を有する。さらに、測距装置102では、測距領域選択部112、局所領域設定部114および代表位相差算出部150が図1に示した測距装置100に追加される。測距装置102のその他の構成は、測距装置100と同一または同様である。例えば、測距装置102は、記憶部110、測距領域選択部112、局所領域設定部114、位相差算出部122、特徴算出部132、誤差推定部142および代表位相差算出部150を有する。そして、測距装置102は、レンズ20の合焦時の位置からのずれ量に応じて発生する一対の画像IMGf間の位相差を算出する。   The distance measuring apparatus 102 includes a phase difference calculator 122, a feature calculator 132, and an error estimator 142 instead of the phase difference calculator 120, the feature calculator 130, and the error estimator 140 shown in FIG. Further, in the distance measuring device 102, a distance measuring region selecting unit 112, a local region setting unit 114, and a representative phase difference calculating unit 150 are added to the distance measuring device 100 shown in FIG. The other configuration of the distance measuring device 102 is the same as or similar to that of the distance measuring device 100. For example, the distance measuring apparatus 102 includes a storage unit 110, a distance measurement region selection unit 112, a local region setting unit 114, a phase difference calculation unit 122, a feature calculation unit 132, an error estimation unit 142, and a representative phase difference calculation unit 150. Then, the distance measuring device 102 calculates a phase difference between the pair of images IMGf that is generated according to the shift amount of the lens 20 from the in-focus position.

記憶部110は、予め取得された精度情報AINFを記憶する。精度情報AINFは、例えば、エッジの急峻度と推定位相差の誤差との関係を示す情報と、画素PX2の列の画素間隔を基準単位として位相差を表した場合の位相差の端数と推定位相差の誤差との関係を示す情報とを有する。以下、画素PX2の列の画素間隔を基準単位として位相差を表した場合の位相差の端数は、オフセットとも称される。エッジの急峻度と推定位相差の誤差との関係は、図4で説明し、オフセットと推定位相差の誤差との関係は、図5で説明する。   The storage unit 110 stores accuracy information AINF acquired in advance. The accuracy information AINF includes, for example, information indicating the relationship between the steepness of the edge and the error of the estimated phase difference, and the fraction and the estimated position of the phase difference when the phase difference is expressed using the pixel interval of the column of the pixel PX2 as a reference unit. And information indicating a relationship with a phase difference error. Hereinafter, the fraction of the phase difference when the phase difference is expressed using the pixel interval of the column of the pixels PX2 as a reference unit is also referred to as an offset. The relationship between the edge steepness and the estimated phase difference error will be described with reference to FIG. 4, and the relationship between the offset and the estimated phase difference error will be described with reference to FIG.

測距領域選択部112は、撮像素子30により撮像された画像IMGを示す情報を受け、測距に使用する領域RAR(以下、測距領域RARとも称する)を画像IMGから選択する。例えば、測距領域選択部112は、顔検出により検出された顔を含む領域(図の点線で囲んだ領域)を測距領域RARとして選択する。そして、測距領域選択部112は、測距領域RARを示す情報を局所領域設定部114に出力する。以下、測距領域選択部112により選択された画像IMG内の測距領域RARに対応する撮像素子30内の領域も、測距領域RARと称される。   The ranging area selection unit 112 receives information indicating the image IMG captured by the imaging element 30, and selects an area RAR (hereinafter also referred to as a ranging area RAR) used for ranging from the image IMG. For example, the distance measurement area selection unit 112 selects an area including a face detected by face detection (an area surrounded by a dotted line in the drawing) as the distance measurement area RAR. Then, the ranging area selection unit 112 outputs information indicating the ranging area RAR to the local area setting unit 114. Hereinafter, an area in the image sensor 30 corresponding to the distance measurement area RAR in the image IMG selected by the distance measurement area selection unit 112 is also referred to as a distance measurement area RAR.

局所領域設定部114は、測距領域RARに配置された一対の位相差算出用の画素PX2の列に基づいて、位相差を算出する際の単位領域である局所領域LARを測距領域RAR内に設定する。図2に示す例では、局所領域設定部114は、測距領域RAR内に、9つの局所領域LAR1、LAR2、LAR3、LAR4、LAR5、LAR6、LAR7、LAR8、LAR9を設定する。そして、局所領域設定部114は、局所領域LARを示す情報を位相差算出部122および特徴算出部132に出力する。   The local region setting unit 114 sets the local region LAR, which is a unit region for calculating the phase difference, in the distance measurement region RAR based on the column of the pair of phase difference calculation pixels PX2 arranged in the distance measurement region RAR. Set to. In the example illustrated in FIG. 2, the local region setting unit 114 sets nine local regions LAR1, LAR2, LAR3, LAR4, LAR5, LAR6, LAR7, LAR8, and LAR9 in the ranging region RAR. Then, the local region setting unit 114 outputs information indicating the local region LAR to the phase difference calculation unit 122 and the feature calculation unit 132.

位相差算出部122は、一対の画像IMGf間の位相差を、複数の局所領域LAR毎に算出する。そして、位相差算出部122は、各局所領域LARにおける一対の画像IMGf間の位相差の算出値を示す情報PDINF1を、誤差推定部140および代表位相差算出部150に出力する。なお、位相差算出部122の動作は、一対の画像IMGf間の位相差を複数の局所領域LAR毎に算出することを除いて、図1に示した位相差算出部120と同一または同様である。   The phase difference calculation unit 122 calculates the phase difference between the pair of images IMGf for each of the plurality of local regions LAR. Then, the phase difference calculation unit 122 outputs information PDINF1 indicating the calculated value of the phase difference between the pair of images IMGf in each local region LAR to the error estimation unit 140 and the representative phase difference calculation unit 150. The operation of the phase difference calculation unit 122 is the same as or similar to that of the phase difference calculation unit 120 illustrated in FIG. 1 except that the phase difference between the pair of images IMGf is calculated for each of the plurality of local regions LAR. .

特徴算出部132は、一対の画像IMGfのエッジの急峻度を複数の局所領域LAR毎に算出する。そして、特徴算出部132は、各局所領域LARにおける一対の画像IMGfのエッジの急峻度を示す情報EGINF1を、誤差推定部140および代表位相差算出部150に出力する。なお、特徴算出部132の動作は、一対の画像IMGfのエッジの急峻度を複数の局所領域LAR毎に算出することを除いて、図1に示した特徴算出部130と同一または同様である。   The feature calculation unit 132 calculates the steepness of the edges of the pair of images IMGf for each of the plurality of local regions LAR. Then, the feature calculation unit 132 outputs information EGINF1 indicating the steepness of the edges of the pair of images IMGf in each local region LAR to the error estimation unit 140 and the representative phase difference calculation unit 150. The operation of the feature calculation unit 132 is the same as or similar to that of the feature calculation unit 130 illustrated in FIG. 1 except that the sharpness of the edges of the pair of images IMGf is calculated for each of the plurality of local regions LAR.

誤差推定部142は、記憶部110から受ける精度情報AINFを用いて、一対の画像IMGf間の位相差の算出値の誤差を複数の局所領域LAR毎に推定する。例えば、誤差推定部142は、一対の画像IMGf間の位相差の算出値に基づくオフセットと一対の画像IMGfのエッジの急峻度との組み合わせに対応する推定位相差の誤差を、精度情報AINFを用いて、複数の局所領域LAR毎に推定する。これにより、各局所領域LARにおける位相差の算出誤差が推定される。そして、誤差推定部142は、各局所領域LARにおける位相差の算出誤差を示す情報ERINF1を、代表位相差算出部150に出力する。   The error estimation unit 142 uses the accuracy information AINF received from the storage unit 110 to estimate an error in the calculated value of the phase difference between the pair of images IMGf for each of the plurality of local regions LAR. For example, the error estimation unit 142 uses the accuracy information AINF to calculate the error of the estimated phase difference corresponding to the combination of the offset based on the calculated value of the phase difference between the pair of images IMGf and the steepness of the edges of the pair of images IMGf. Thus, estimation is performed for each of the plurality of local regions LAR. Thereby, the phase difference calculation error in each local region LAR is estimated. Then, the error estimation unit 142 outputs information ERINF1 indicating the phase difference calculation error in each local region LAR to the representative phase difference calculation unit 150.

このように、誤差推定部142は、一対の画像IMGf間の位相差の算出値を画素PX2の列における画素間隔を基準単位として表した場合の位相差の端数と一対の画像IMGfのエッジの急峻度と精度情報AINFとに基づいて、位相差の算出誤差を推定する。すなわち、誤差推定部142は、一対の画像IMGf間の位相差の算出値の誤差を、精度情報AINFを用いて、一対の画像IMGfのエッジの急峻度から推定する第1誤差推定部の一例である。   As described above, the error estimation unit 142 calculates the phase difference between the pair of images IMGf when the pixel interval in the column of the pixels PX2 is expressed as a reference unit, and the sharpness of the edges of the pair of images IMGf. The phase difference calculation error is estimated based on the degree and the accuracy information AINF. That is, the error estimator 142 is an example of a first error estimator that estimates the error of the calculated value of the phase difference between the pair of images IMGf from the steepness of the edges of the pair of images IMGf using the accuracy information AINF. is there.

代表位相差算出部150は、測距領域RAR内の位相差の代表値である代表位相差を算出するとともに、代表位相差の誤差を推定する。例えば、代表位相差算出部150は、位相差の算出誤差が大きくなるにしたがい小さくなる重み付け係数を複数の局所領域LAR毎に算出する。そして、代表位相差算出部150は、位相差算出部122により複数の局所領域LAR毎に算出された一対の画像IMGf間の位相差を、重み付け係数で加重平均して代表位相差を算出する。   The representative phase difference calculation unit 150 calculates a representative phase difference, which is a representative value of the phase difference in the ranging area RAR, and estimates an error of the representative phase difference. For example, the representative phase difference calculation unit 150 calculates a weighting coefficient that decreases as the phase difference calculation error increases for each of the plurality of local regions LAR. Then, the representative phase difference calculation unit 150 calculates the representative phase difference by performing weighted averaging of the phase difference between the pair of images IMGf calculated by the phase difference calculation unit 122 for each of the plurality of local regions LAR using a weighting coefficient.

また、代表位相差算出部150は、誤差推定部142により複数の局所領域LAR毎に推定された複数の位相差の算出誤差に基づいて、代表位相差の誤差を推定する。例えば、代表位相差算出部150は、誤差推定部142により複数の局所領域LAR毎に推定された複数の位相差の算出誤差の平均を、代表位相差の誤差として推定する。なお、代表位相差算出部150は、誤差推定部142により複数の局所領域LAR毎に推定された複数の位相差の算出誤差を加重平均して代表位相差の誤差を推定してもよい。   Further, the representative phase difference calculation unit 150 estimates a representative phase difference error based on a plurality of phase difference calculation errors estimated by the error estimation unit 142 for each of the plurality of local regions LAR. For example, the representative phase difference calculation unit 150 estimates an average of a plurality of phase difference calculation errors estimated by the error estimation unit 142 for each of the plurality of local regions LAR as a representative phase difference error. Note that the representative phase difference calculation unit 150 may estimate the error of the representative phase difference by weighted averaging the calculation errors of the plurality of phase differences estimated for each of the plurality of local regions LAR by the error estimation unit 142.

そして、代表位相差算出部150は、代表位相差を示す情報PDINF2と代表位相差の誤差を示す情報ERINF2とを、焦点調整部200に出力する。すなわち、代表位相差算出部150は、代表位相差および代表位相差の誤差を、一対の画像IMGf間の位相差の算出値および算出値誤差として焦点調整部200に通知する。   Then, the representative phase difference calculation unit 150 outputs information PDINF2 indicating the representative phase difference and information ERINF2 indicating the error of the representative phase difference to the focus adjustment unit 200. That is, the representative phase difference calculation unit 150 notifies the focus adjustment unit 200 of the representative phase difference and the error of the representative phase difference as the calculated value of the phase difference between the pair of images IMGf and the calculated value error.

このように、測距装置102は、複数の局所領域LARの位相差を、各局所領域LARの算出誤差に基づく重み付け係数で加重平均する。そして、測距装置102は、加重平均の結果を測距領域RAR内の位相差の代表値である代表位相差とする。測距装置102は、加重平均に用いる重み付け係数を精度の高い算出誤差に基づいて決定するため、加重平均の結果である代表位相差を精度よく算出できる。   As described above, the distance measuring apparatus 102 weights and averages the phase differences of the plurality of local regions LAR with the weighting coefficient based on the calculation error of each local region LAR. Then, the distance measuring apparatus 102 sets the weighted average result as a representative phase difference that is a representative value of the phase difference in the distance measuring area RAR. Since the distance measuring device 102 determines the weighting coefficient used for the weighted average based on a highly accurate calculation error, the representative phase difference that is the result of the weighted average can be calculated with high accuracy.

焦点調整部200は、測距装置102により算出された代表位相差等に基づいて焦点を調整する。焦点調整部200の動作は、一対の画像IMGf間の位相差の算出値および算出誤差として代表位相差および代表位相差の誤差を用いることを除いて、図1に示した焦点調整部200と同一または同様である。   The focus adjustment unit 200 adjusts the focus based on the representative phase difference calculated by the distance measuring device 102. The operation of the focus adjustment unit 200 is the same as that of the focus adjustment unit 200 shown in FIG. 1 except that the calculated value of the phase difference between the pair of images IMGf and the error of the representative phase difference are used as the calculation errors. Or the same.

なお、撮像装置12の構成は、図2に示す例に限定されない。例えば、撮像装置12は、精度情報AINFを生成する精度情報生成部を有してもよい。この場合、精度情報生成部は、例えば、図6で説明する精度情報AINFの生成方法にしたがって、精度情報AINFを生成し、生成した精度情報AINFを記憶部110に格納する。   The configuration of the imaging device 12 is not limited to the example illustrated in FIG. For example, the imaging device 12 may include an accuracy information generation unit that generates accuracy information AINF. In this case, for example, the accuracy information generation unit generates the accuracy information AINF according to the generation method of the accuracy information AINF described in FIG. 6 and stores the generated accuracy information AINF in the storage unit 110.

図3は、位相差検出方式による焦点調整の概要を示す。図3は、合焦位置が結像面(撮像素子30)よりレンズ20側に位置する前ピンの状態を示している。結像面で焦点が合わない場合、被写体OBJが左右に分散されて投影され、ぼけた画像が生成される。レンズ20の左半分および右半分をそれぞれ通過した光(以下、左右の光とも称する)の結像位置は、合焦位置と結像面のずれに依存する。例えば、前ピンの場合では、左右の光は、逆位置に投影され、結像面が合焦位置よりレンズ20側に位置する後ピンの場合では、左右の光は、順位置に投影される。レンズ20の左半分および右半分をそれぞれ通過した光の結像位置のずれ(位相差)を検出できれば焦点のずれを調整できるが、1つのレンズ20のみでは結像面で左右の光が重なるため、位相差を検出することは困難である。   FIG. 3 shows an outline of focus adjustment by the phase difference detection method. FIG. 3 shows a state of the front pin where the in-focus position is located closer to the lens 20 than the imaging plane (imaging device 30). When the image plane is not in focus, the subject OBJ is dispersed and projected from side to side, and a blurred image is generated. The imaging position of light (hereinafter also referred to as left and right light) that has passed through the left half and the right half of the lens 20 depends on the shift between the in-focus position and the imaging plane. For example, in the case of the front pin, the left and right lights are projected at opposite positions, and in the case of the rear pin whose image plane is located closer to the lens 20 than the in-focus position, the left and right lights are projected at the forward position. . If the deviation (phase difference) of the imaging position of the light that has passed through the left half and the right half of the lens 20 can be detected, the focal deviation can be adjusted. However, the right and left lights overlap on the imaging plane with only one lens 20. It is difficult to detect the phase difference.

このため、撮像装置12では、図2に示したように、レンズ20の右半分を通過した被写体からの光束を受ける画素PX21とレンズ20の左半分を通過した被写体からの光束を受ける画素PX22とを用いて、右画像IMGfrと左画像IMGflとを生成する。なお、図3では、説明を分かりやすくするために、画素PX21、PX22における遮光された領域に対応するレンズ20の領域を黒色で示している。すなわち、画素PX21、PX22が受ける光が通過するレンズ20の領域を白抜きで示している。   Therefore, in the imaging device 12, as shown in FIG. 2, a pixel PX21 that receives a light beam from a subject that has passed through the right half of the lens 20 and a pixel PX22 that receives a light beam from a subject that has passed through the left half of the lens 20 Are used to generate the right image IMGfr and the left image IMGfl. In FIG. 3, for easy understanding, the region of the lens 20 corresponding to the light-shielded region in the pixels PX21 and PX22 is shown in black. That is, the area of the lens 20 through which the light received by the pixels PX21 and PX22 passes is shown in white.

位相差検出用の画素PX21、22を用いることにより、結像位置の異なる左画像IMGflと右画像IMGfrとを分離でき、一対の画像IMGf間の位相差を求めることで焦点がどの程度ずれているかを観測することができる。例えば、位相差算出部122は、左画像IMGflに対して右画像IMGfrの位置をシフトしながら、画像IMGfl、IMGfrの互いに対応する位置の画素値の差分絶対値和を逐次算出する。   By using the pixels PX21 and PX22 for detecting the phase difference, the left image IMGfl and the right image IMGfr having different imaging positions can be separated, and how much the focus is shifted by obtaining the phase difference between the pair of images IMGf. Can be observed. For example, the phase difference calculation unit 122 sequentially calculates a sum of absolute differences of pixel values at positions corresponding to the images IMGfl and IMGfr while shifting the position of the right image IMGfr with respect to the left image IMGfl.

例えば、シフト量sに対応する差分絶対値和をSAD(s)と表した場合、差分絶対値和SAD(s)が最小となるシフト量sを求めることにより、被写体OBJのぼけの程度を推定することができる。位相差算出部122は、差分絶対値和SAD(s)が最小になるシフト量sを位相差として算出する。なお、右画像IMGfrを1画素単位でシフトした場合、算出される位相差は、整数単位となる。このため、位相差算出部122は、等角直線フィッティングと呼ばれるフィッティング方法等により、差分絶対値和SAD(s)が最小となるシフト量sを小数画素精度で推定する(図3の推定シフト量)。なお、フィッティング方法は、等角直線フィッティングに限定されない。   For example, when the difference absolute value sum corresponding to the shift amount s is expressed as SAD (s), the degree of blur of the subject OBJ is estimated by obtaining the shift amount s that minimizes the difference absolute value sum SAD (s). can do. The phase difference calculation unit 122 calculates the shift amount s that minimizes the difference absolute value sum SAD (s) as the phase difference. When the right image IMGfr is shifted in units of one pixel, the calculated phase difference is an integer unit. Therefore, the phase difference calculation unit 122 estimates the shift amount s that minimizes the difference absolute value sum SAD (s) with a fractional pixel accuracy by a fitting method called equiangular straight line fitting (the estimated shift amount in FIG. 3). ). The fitting method is not limited to equiangular straight line fitting.

図4は、エッジの急峻度σと推定位相差の誤差eとの関係の一例を示す。図4の横軸は、エッジの急峻度σを示し、縦軸は、推定位相差の誤差e(単位は、画素数)を示す。なお、エッジの急峻度σは、値が大きくなるほどエッジが鋭くなることを示す。例えば、エッジの急峻度σは、位相差算出用の画素P2の列の”i”番目の画素P2と”i+1”番目の画素P2との画素値の差分d(i)を用いて、式(1)で表される。   FIG. 4 shows an example of the relationship between the edge steepness σ and the estimated phase difference error e. The horizontal axis of FIG. 4 represents the edge steepness σ, and the vertical axis represents the error e (in units of pixels) of the estimated phase difference. The edge steepness σ indicates that the edge becomes sharper as the value increases. For example, the steepness σ of the edge is expressed by using the difference d (i) between the pixel values of the “i” -th pixel P2 and the “i + 1” -th pixel P2 in the column of the phase difference calculation pixel P2, using the formula ( 1).

σ=Σ(d(i)×d(i))/(Σ|d(i)|) ・・・(1)
式(1)の”i”は、例えば、画素P2の列の画素数が”n”の場合、”1”から”n−1”までの整数である。なお、エッジの急峻度σは、式(1)以外の計算式により算出されてもよい。例えば、エッジの急峻度σは、差分d(i)の平均でもよい。推定位相差の誤差eは、図4に示すように、エッジの急峻度σが大きくなるにしたがい大きくなる。
σ = Σ (d (i) × d (i)) / (Σ | d (i) |) (1)
“I” in Expression (1) is, for example, an integer from “1” to “n−1” when the number of pixels in the column of the pixel P2 is “n”. Note that the edge steepness σ may be calculated by a calculation formula other than the formula (1). For example, the edge steepness σ may be an average of the differences d (i). As shown in FIG. 4, the estimated phase difference error e increases as the edge steepness σ increases.

例えば、画素PX21、PX22の各々が離散的に配置される場合、図1で説明したように、画素値列の形状は、右画像IMGfrと左画像IMGflとで異なる(図4の括弧内のグラフの実線)。なお、図4の括弧内のグラフは、位相差算出用の一対の画像IMGf(IMGfl、IMGfr)における画素PX2の位置と画素値との関係の一例を示す。括弧内のグラフの破線、点線、○印および×印の意味は、図1の括弧内に示したグラフと同じである。   For example, when each of the pixels PX21 and PX22 is discretely arranged, the shape of the pixel value sequence differs between the right image IMGfr and the left image IMGfl as illustrated in FIG. 1 (graph in parentheses in FIG. 4). Solid line). The graph in parentheses in FIG. 4 shows an example of the relationship between the position of the pixel PX2 and the pixel value in a pair of images IMGf (IMGfl, IMGfr) for phase difference calculation. The meanings of the broken line, the dotted line, the circle mark, and the x mark in the graph in parentheses are the same as those in the graph shown in parentheses in FIG.

図4の括弧内のグラフに示すように、なだらかのエッジの場合(すなわち、エッジの急峻度σが小さい場合)、右画像IMGfrと左画像IMGflとの画素値列の形状の差異は、鋭いエッジの場合(すなわち、エッジの急峻度σが大きい場合)に比べて、小さい。すなわち、エッジの急峻度σが大きくなるにしたがい、右画像IMGfrと左画像IMGflとの画素値列の形状の差異が大きくなる。右画像IMGfrと左画像IMGflとの画素値列の形状の差異が大きくなるにしたがい推定位相差の誤差eが大きくなるため、推定位相差の誤差eは、エッジの急峻度σが大きくなるにしたがい大きくなる。エッジの急峻度σと推定位相差の誤差eとの関係を示す情報は、予め取得され、精度情報AINFの一部として記憶部110に格納される。   As shown in the graph in parentheses in FIG. 4, in the case of a gentle edge (that is, when the edge steepness σ is small), the difference in the shape of the pixel value sequence between the right image IMGfr and the left image IMGfl is a sharp edge. This is smaller than the case (that is, the case where the edge steepness σ is large). That is, as the steepness σ of the edge increases, the difference in the shape of the pixel value sequence between the right image IMGfr and the left image IMGfl increases. Since the error e of the estimated phase difference increases as the difference in the shape of the pixel value sequence between the right image IMGfr and the left image IMGfl increases, the error e of the estimated phase difference increases as the edge steepness σ increases. growing. Information indicating the relationship between the edge steepness σ and the estimated phase difference error e is acquired in advance and stored in the storage unit 110 as part of the accuracy information AINF.

図5は、オフセットOFと推定位相差の誤差eとの関係の一例を示す。図5の横軸は、オフセットOF(単位は、画素数)を示し、縦軸は、推定位相差の誤差e(単位は、画素数)を示す。図5に示す例では、画素PX2の列における画素間隔pは”8”である。すなわち、図5は、画素PX2が7画素置きに配置される場合のオフセットOFと推定位相差の誤差eとの関係の一例を示す。なお、オフセットOFは、一対の画像IMGf間の位相差s(画素数)を画素PX2の列における画素間隔pを基準単位として表した場合の位相差sの端数に対応し、式(2)で表される。   FIG. 5 shows an example of the relationship between the offset OF and the estimated phase difference error e. The horizontal axis in FIG. 5 indicates the offset OF (unit is the number of pixels), and the vertical axis indicates the estimated phase difference error e (the unit is the number of pixels). In the example shown in FIG. 5, the pixel interval p in the column of the pixels PX2 is “8”. That is, FIG. 5 shows an example of the relationship between the offset OF and the estimated phase difference error e when the pixels PX2 are arranged every seven pixels. The offset OF corresponds to the fraction of the phase difference s when the phase difference s (number of pixels) between the pair of images IMGf is expressed using the pixel interval p in the column of the pixels PX2 as a reference unit. expressed.

OF=|s|−|k×p| ・・・(2)
式(2)の”k”は、オフセットOFを0以上で画素間隔p未満にする0以上の整数である。例えば、位相差sが”0”以上”p”未満である場合、”k”は”0”であり、位相差sが”p”以上”2×p”未満である場合、”k”は”1”である。推定位相差の誤差eは、図5に示すように、画素PX2の列における画素間隔pで周期的に変化する。オフセットOFが画素間隔pの2分の1の値に近づくにしたがい、推定位相差の誤差eは大きくなる。
OF = | s | − | k × p | (2)
“K” in Expression (2) is an integer of 0 or more that makes the offset OF 0 or more and less than the pixel interval p. For example, when the phase difference s is “0” or more and less than “p”, “k” is “0”, and when the phase difference s is “p” or more and less than “2 × p”, “k” is “1”. As shown in FIG. 5, the estimated phase difference error e periodically changes at the pixel interval p in the column of the pixels PX2. As the offset OF approaches half the value of the pixel interval p, the estimated phase difference error e increases.

なお、図5では、位相差s(画素数)と画素間隔pとの関係を4つのケースに分けて、位相差算出用の一対の画像IMGf(IMGfl、IMGfr)における画素PX2の位置と画素値との関係の一例を括弧内に示す。括弧内のグラフの破線、点線、○印および×印の意味は、図1の括弧内に示したグラフと同じである。   In FIG. 5, the relationship between the phase difference s (number of pixels) and the pixel interval p is divided into four cases, and the position and pixel value of the pixel PX2 in the pair of images IMGf (IMGfl, IMGfr) for phase difference calculation. An example of the relationship is shown in parentheses. The meanings of the broken line, the dotted line, the circle mark, and the x mark in the graph in parentheses are the same as those in the graph shown in parentheses in FIG.

ケース1では、位相差sは、”0”である。この場合、画素値列の形状は、右画像IMGfrと左画像IMGflとでほぼ一致する。このため、推定位相差の誤差eは、”0”またはほぼ”0”になる。   In case 1, the phase difference s is “0”. In this case, the shape of the pixel value sequence is substantially the same between the right image IMGfr and the left image IMGfl. Therefore, the error e of the estimated phase difference is “0” or almost “0”.

ケース2では、位相差sは、”0”より大きく、画素間隔p未満である。この場合、画素値列の形状は、右画像IMGfrと左画像IMGflとで異なる。このため、推定位相差の誤差eは、ケース1に比べて、大きくなる。   In Case 2, the phase difference s is greater than “0” and less than the pixel interval p. In this case, the shape of the pixel value sequence differs between the right image IMGfr and the left image IMGfl. For this reason, the error e of the estimated phase difference is larger than that in case 1.

ケース3では、位相差sは、画素間隔pと同じである。この場合、画素値列の形状は、右画像IMGfrと左画像IMGflとでほぼ一致する。このため、推定位相差の誤差eは、”0”またはほぼ”0”になる。すなわち、ケース3とケース1とでは、推定位相差の誤差eは、同じまたはほぼ同じになる。   In case 3, the phase difference s is the same as the pixel interval p. In this case, the shape of the pixel value sequence is substantially the same between the right image IMGfr and the left image IMGfl. Therefore, the error e of the estimated phase difference is “0” or almost “0”. That is, in case 3 and case 1, the error e of the estimated phase difference is the same or substantially the same.

ケース4では、位相差sは、画素間隔pより大きく、画素間隔pの2倍より小さい。この場合、画素値列の形状は、右画像IMGfrと左画像IMGflとで異なる。このため、推定位相差の誤差eは、ケース1およびケース3に比べて、大きくなる。   In Case 4, the phase difference s is larger than the pixel interval p and smaller than twice the pixel interval p. In this case, the shape of the pixel value sequence differs between the right image IMGfr and the left image IMGfl. For this reason, the error e of the estimated phase difference is larger than in case 1 and case 3.

このように、推定位相差の誤差eは、画素PX2の列における画素間隔pで周期的に変化する。オフセットOFと推定位相差の誤差eとの関係を示す情報は、予め取得され、精度情報AINFの一部として記憶部110に格納される。   As described above, the estimated phase difference error e periodically changes at the pixel interval p in the column of the pixels PX2. Information indicating the relationship between the offset OF and the error e of the estimated phase difference is acquired in advance and stored in the storage unit 110 as part of the accuracy information AINF.

図6は、精度情報AINFの生成方法の一例を示す。図6のグラフの破線は、画素の位置と画素値との関係を示す基準グラフ(以下、基準の画素値列とも称する)を示す。例えば、基準の画素値列は、直線または誤差関数等により表される。また、グラフの○印は、基準の画素値列から生成される一対の擬似画素値列QPL(QPLr、QPLl)のうちの右の擬似画素値列QPLrを示す。グラフの×印は、基準の画素値列から生成される一対の擬似画素値列QPL(QPLr、QPLl)のうちの左の擬似画素値列QPLlを示す。また、図6に示す誤差テーブルは、画素間隔pが”8”の場合を示す。   FIG. 6 shows an example of a method for generating the accuracy information AINF. The broken line in the graph of FIG. 6 shows a reference graph (hereinafter also referred to as a reference pixel value string) showing the relationship between the pixel position and the pixel value. For example, the reference pixel value sequence is represented by a straight line or an error function. Further, the circles in the graph indicate the right pseudo pixel value sequence QPLr of the pair of pseudo pixel value sequences QPL (QPLr, QPLl) generated from the reference pixel value sequence. The x mark in the graph indicates the left pseudo pixel value sequence QPLl of the pair of pseudo pixel value sequences QPL (QPLr, QPLl) generated from the reference pixel value sequence. The error table shown in FIG. 6 shows a case where the pixel interval p is “8”.

先ず、図6の基準の画素値列に示すように、所定のエッジの急峻度σを有する基準グラフ(図6のグラフの破線)から、一対の擬似画素値列QPLの各々の画素値が取得される。例えば、一対の擬似画素値列QPLのうちの右の擬似画素値列QPLrの各画素値は、基準の画素値列から画素間隔p毎に取得される。そして、一対の擬似画素値列QPLのうちの左の擬似画素値列QPLrの各画素値は、右の擬似画素値列QPLrの各画素との間隔を所定の位相差st(画素数)に維持して、基準の画素値列から画素間隔p毎に取得される。   First, as shown in the reference pixel value sequence in FIG. 6, each pixel value of the pair of pseudo pixel value sequences QPL is obtained from a reference graph having a predetermined edge steepness σ (broken line in the graph in FIG. 6). Is done. For example, each pixel value of the right pseudo pixel value sequence QPLr of the pair of pseudo pixel value sequences QPL is acquired from the reference pixel value sequence for each pixel interval p. And each pixel value of the left pseudo pixel value sequence QPLr of the pair of pseudo pixel value sequences QPL maintains an interval between each pixel of the right pseudo pixel value sequence QPLr at a predetermined phase difference st (number of pixels). Then, it is acquired for each pixel interval p from the reference pixel value sequence.

これにより、図6の左右の擬似画素値列に示すように、一対の擬似画素値列QPLr、QPLlが生成される。なお、位相差stが画素間隔pより小さい場合、位相差stは、オフセットOFに対応する。   As a result, a pair of pseudo pixel value sequences QPLr and QPLl are generated as shown in the left and right pseudo pixel value sequences in FIG. When the phase difference st is smaller than the pixel interval p, the phase difference st corresponds to the offset OF.

次に、一対の擬似画素値列QPLr、QPLl間の推定位相差sが、位相差算出部120と同一または同様の方法により算出される。そして、エッジが急峻度σでオフセットOFが所定の位相差stである場合の推定位相差の誤差eが、推定位相差sおよび所定の位相差stに基づいて算出される。推定位相差の誤差eは、式(3)で表される。   Next, the estimated phase difference s between the pair of pseudo pixel value sequences QPLr and QPLl is calculated by the same or similar method as the phase difference calculating unit 120. Then, an error e of the estimated phase difference when the edge is steepness σ and the offset OF is the predetermined phase difference st is calculated based on the estimated phase difference s and the predetermined phase difference st. The error e of the estimated phase difference is expressed by Expression (3).

e=s−st ・・・(3)
エッジが急峻度σでオフセットOFが所定の位相差stである場合の推定位相差の誤差eは、誤差テーブルの対応する場所に格納される。
e = s−st (3)
The error e of the estimated phase difference in the case where the edge is steepness σ and the offset OF is the predetermined phase difference st is stored in the corresponding location of the error table.

基準の画素値列のエッジの急峻度σ、所定の位相差stを様々に変化させて、推定位相差の誤差eを算出することにより、誤差テーブルが生成される。例えば、図4に示したエッジの急峻度σと推定位相差の誤差eとの関係を示すグラフは、図6に示す誤差テーブルのオフセットOFが”4”の列をグラフ化した場合に対応する。また、例えば、図5に示したオフセットOFと推定位相差の誤差eとの関係を示すグラフは、図6に示す誤差テーブルのエッジの急峻度σが”1”の行をグラフ化した場合に対応する。   An error table is generated by calculating the error e of the estimated phase difference by varying the steepness σ of the edge of the reference pixel value sequence and the predetermined phase difference st in various ways. For example, the graph showing the relationship between the edge steepness σ and the estimated phase difference error e shown in FIG. 4 corresponds to the case where the column of the error table offset OF “4” shown in FIG. 6 is graphed. . Further, for example, the graph showing the relationship between the offset OF and the estimated phase difference error e shown in FIG. 5 is a graph in the case where the line in which the steepness σ of the edge of the error table shown in FIG. 6 is “1” is graphed. Correspond.

誤差テーブルは、精度情報AINFとして、記憶部110に格納される。誤差推定部142は、位相差算出部122により算出された位相差からオフセットOFを算出し、算出したオフセットOFと特徴算出部132により算出されたエッジの急峻度σとの組み合わせに対応する推定位相差の誤差eを誤差テーブルから推定する。これにより、位相差の算出誤差が推定される。例えば、位相差算出部122により算出された位相差が”9”(すなわち、オフセットOFが”1”)で、特徴算出部132により算出されたエッジの急峻度σが”0.5”に対応する推定位相差の誤差eは、”0.010”である。   The error table is stored in the storage unit 110 as accuracy information AINF. The error estimation unit 142 calculates the offset OF from the phase difference calculated by the phase difference calculation unit 122, and the estimated position corresponding to the combination of the calculated offset OF and the edge steepness σ calculated by the feature calculation unit 132. The phase difference error e is estimated from the error table. Thereby, the phase difference calculation error is estimated. For example, the phase difference calculated by the phase difference calculator 122 corresponds to “9” (that is, the offset OF is “1”), and the edge steepness σ calculated by the feature calculator 132 corresponds to “0.5”. The estimated phase difference error e is “0.010”.

なお、誤差推定部142は、算出したオフセットOFとエッジの急峻度σとの組み合わせが誤差テーブルに存在しない場合、算出したオフセットOFとエッジの急峻度σとの組み合わせの周辺の組み合わせに基づいて、推定位相差の誤差eを補間してもよい。あるいは、誤差推定部142は、算出したオフセットOFとエッジの急峻度σとの組み合わせに最も近い組み合わせを誤差テーブルから選択し、選択した組み合わせの推定位相差の誤差eを、位相差の算出誤差として推定してもよい。   Note that, when the combination of the calculated offset OF and the edge steepness σ does not exist in the error table, the error estimation unit 142, based on the combination around the combination of the calculated offset OF and the edge steepness σ, The estimated phase difference error e may be interpolated. Alternatively, the error estimation unit 142 selects a combination closest to the combination of the calculated offset OF and the edge steepness σ from the error table, and uses the estimated phase difference error e of the selected combination as a phase difference calculation error. It may be estimated.

誤差テーブルの構成は、図6に示す例に限定されない。例えば、オフセットOFは、画素間隔pに対する比率で表されてもよい。あるいは、オフセットOFの項目は、省かれてもよい。すなわち、誤差テーブルは、エッジの急峻度σと推定位相差の誤差eとの関係を示すテーブルでもよい。この場合、例えば、エッジの急峻度σ毎に、複数のオフセットOFにおける推定位相差の誤差eの平均を算出し、複数のオフセットOFにおける推定位相差の誤差eの平均をエッジの急峻度σの推定位相差の誤差eとしてもよい。あるいは、複数のオフセットOFのうちの1つ(例えば、オフセットOF=4)の推定位相差の誤差eを、エッジの急峻度σの推定位相差の誤差eとしてもよい。   The configuration of the error table is not limited to the example shown in FIG. For example, the offset OF may be expressed as a ratio to the pixel interval p. Alternatively, the item of offset OF may be omitted. In other words, the error table may be a table showing the relationship between the edge steepness σ and the estimated phase difference error e. In this case, for example, for each edge steepness σ, the average of the estimated phase difference errors e at the plurality of offsets OF is calculated, and the average of the estimated phase difference errors e at the plurality of offsets OF is calculated as the edge steepness σ. An error e of the estimated phase difference may be used. Alternatively, the estimated phase difference error e of one of the plurality of offsets OF (for example, offset OF = 4) may be used as the estimated phase difference error e of the edge steepness σ.

図7は、図2に示した撮像装置12の動作の一例を示す。図7に示す動作は、撮像装置の制御方法の一態様である。なお、図7は、位相差検出方式とコントラスト方式との両方を採用したハイブリット方式におけるオートフォーカス制御を実行する場合の撮像装置12の動作の一例を示す。ステップS200、S300、S400の処理は、位相差検出方式の1つである像面位相差方式のオートフォーカス制御に対応し、ステップS500、S600、S700、S800、S900の処理は、コントラスト方式のオートフォーカス制御に対応する。以下、像面位相差方式のオートフォーカス制御は、像面位相差AF(Auto Focus)とも称され、コントラスト方式のオートフォーカス制御は、コントラストAFとも称される。   FIG. 7 shows an example of the operation of the imaging device 12 shown in FIG. The operation illustrated in FIG. 7 is an aspect of a method for controlling the imaging apparatus. FIG. 7 shows an example of the operation of the imaging device 12 when performing autofocus control in the hybrid method employing both the phase difference detection method and the contrast method. The processes in steps S200, S300, and S400 correspond to autofocus control in the image plane phase difference method, which is one of the phase difference detection methods, and the processes in steps S500, S600, S700, S800, and S900 are performed in the contrast method. Corresponds to focus control. Hereinafter, the image plane phase difference type autofocus control is also referred to as image plane phase difference AF (Auto Focus), and the contrast type autofocus control is also referred to as contrast AF.

ステップS100では、測距領域選択部112は、図2で説明したように、撮像素子30から受けた入力画像IMGから、測距領域RARを選択する。以下、入力画像IMGを撮像したときのレンズ20の位置は、レンズ20の開始位置とも称される。   In step S100, the distance measurement area selection unit 112 selects the distance measurement area RAR from the input image IMG received from the image sensor 30, as described with reference to FIG. Hereinafter, the position of the lens 20 when the input image IMG is captured is also referred to as the start position of the lens 20.

次に、ステップS200では、測距装置102は、位相差算出処理を実行する。なお、位相差算出処理の詳細は、図8で説明する。位相差算出処理により、測距領域RAR内の位相差の代表値である代表位相差が算出されるとともに、代表位相差の誤差が推定される。   Next, in step S200, the distance measuring apparatus 102 performs a phase difference calculation process. Details of the phase difference calculation process will be described with reference to FIG. By the phase difference calculation process, a representative phase difference that is a representative value of the phase difference in the ranging area RAR is calculated, and an error of the representative phase difference is estimated.

次に、ステップS300では、焦点調整部200は、測距領域RARにおける位相差の算出値および算出誤差に基づいて、コントラストAFの探索範囲を決定する。すなわち、焦点調整部200は、ステップS200の位相差算出処理により算出される代表位相差および代表位相差の誤差に基づいて、コントラストAFの探索範囲を決定する。例えば、焦点調整部200は、代表位相差に基づいて合焦位置を推定し、推定した合焦位置を中心にして代表位相差の誤差に対応する範囲をコントラストAFの探索範囲に決定する。   Next, in step S300, the focus adjustment unit 200 determines a search range for contrast AF based on the calculated value and calculation error of the phase difference in the ranging area RAR. That is, the focus adjustment unit 200 determines the contrast AF search range based on the representative phase difference calculated by the phase difference calculation process in step S200 and the error of the representative phase difference. For example, the focus adjustment unit 200 estimates the focus position based on the representative phase difference, and determines a range corresponding to the error of the representative phase difference around the estimated focus position as a search range for contrast AF.

次に、ステップS400では、焦点調整部200は、合焦位置付近までレンズ20を駆動する。例えば、焦点調整部200は、ステップS300で決定した探索範囲の端のうち、レンズ20の開始位置からの距離が短い方にレンズ20を駆動する。以下、探索範囲の端のうち、レンズ20の開始位置からの距離が短い方は探索範囲の始点とも称され、レンズ20の開始位置からの距離が長い方は探索範囲の終点とも称される。   Next, in step S400, the focus adjustment unit 200 drives the lens 20 to near the in-focus position. For example, the focus adjustment unit 200 drives the lens 20 to the shorter end of the search range determined in step S300 from the start position of the lens 20. Hereinafter, of the ends of the search range, the shorter distance from the start position of the lens 20 is also referred to as the start point of the search range, and the longer distance from the start position of the lens 20 is also referred to as the end point of the search range.

次に、ステップS500では、焦点調整部200は、ステップS400で駆動されたレンズ20の位置で撮像された画像における測距領域RARのコントラストを算出する。   Next, in step S500, the focus adjustment unit 200 calculates the contrast of the ranging area RAR in the image captured at the position of the lens 20 driven in step S400.

次に、ステップS600では、焦点調整部200は、レンズ20を駆動する。例えば、焦点調整部200は、探索範囲の終点方向に所定の量だけレンズ20を駆動する。   Next, in step S600, the focus adjustment unit 200 drives the lens 20. For example, the focus adjustment unit 200 drives the lens 20 by a predetermined amount in the end point direction of the search range.

次に、ステップS700では、焦点調整部200は、ステップS600で駆動されたレンズ20の位置で撮像された画像における測距領域RARのコントラストを算出する。   Next, in step S700, the focus adjustment unit 200 calculates the contrast of the ranging area RAR in the image captured at the position of the lens 20 driven in step S600.

次に、ステップS800では、焦点調整部200は、コントラストのピークを検出したか否かを判定する。コントラストのピークが検出された場合、撮像装置12の動作は、ステップS900に移る。一方、コントラストのピークが検出されない場合、撮像装置12の動作は、ステップS600に戻る。このように、コントラストAFでは、コントラストの最も高い画像を検出するまでレンズ20の位置を移動させて画像のコントラストを逐次解析する。   In step S800, the focus adjustment unit 200 determines whether a contrast peak has been detected. When the contrast peak is detected, the operation of the imaging device 12 proceeds to step S900. On the other hand, when the contrast peak is not detected, the operation of the imaging device 12 returns to step S600. Thus, in contrast AF, the position of the lens 20 is moved until the image with the highest contrast is detected, and the contrast of the image is sequentially analyzed.

ステップS900では、焦点調整部200は、コントラストがピークになるレンズ20の位置までレンズ20を駆動する。これにより、レンズ20が合焦位置まで移動し、焦点の調整が終了する。   In step S900, the focus adjustment unit 200 drives the lens 20 to the position of the lens 20 where the contrast reaches a peak. As a result, the lens 20 moves to the in-focus position, and the focus adjustment is completed.

なお、撮像装置12の動作は、図7に示す例に限定されない。例えば、撮像装置12は、像面位相差AFのみを実行して焦点を調整してもよい。この場合、焦点調整部200は、ステップ400において、ステップS300で推定した合焦位置にレンズ20を駆動して、焦点の調整を終了する。   Note that the operation of the imaging device 12 is not limited to the example shown in FIG. For example, the imaging device 12 may adjust the focus by executing only the image plane phase difference AF. In this case, in step 400, the focus adjustment unit 200 drives the lens 20 to the in-focus position estimated in step S300, and ends the focus adjustment.

図8は、図7に示した位相差算出処理の一例を示す。なお、図8に示す動作は、図2に示した測距装置102の動作に対応する。また、位相差算出処理、すなわち、測距装置102の動作は、図8に示す例に限定されない。   FIG. 8 shows an example of the phase difference calculation process shown in FIG. Note that the operation shown in FIG. 8 corresponds to the operation of the distance measuring apparatus 102 shown in FIG. Further, the phase difference calculation process, that is, the operation of the distance measuring apparatus 102 is not limited to the example shown in FIG.

ステップS210では、局所領域設定部114は、図2で説明したように、図7に示したステップS100で選択された測距領域RAR内に、局所領域LARを設定する。   In step S210, the local area setting unit 114 sets the local area LAR in the distance measurement area RAR selected in step S100 shown in FIG. 7 as described in FIG.

次に、ステップS220では、位相差算出部122は、ステップS220で設定された局所領域LARのうち、位相差が算出されていない局所領域LARを1つ選択する。   Next, in step S220, the phase difference calculation unit 122 selects one local region LAR for which the phase difference is not calculated from the local regions LAR set in step S220.

次に、ステップS230では、位相差算出部122は、位相差算出用の一対の画像IMGfを、ステップS220で選択した局所領域LARから取得する。   Next, in step S230, the phase difference calculation unit 122 acquires a pair of images IMGf for phase difference calculation from the local region LAR selected in step S220.

次に、ステップS240では、位相差算出部122は、ステップS220で選択した局所領域LARの位相差を算出する。すなわち、位相差算出部122は、ステップS230で取得した一対の画像IMGf間の位相差を算出する。   Next, in step S240, the phase difference calculation unit 122 calculates the phase difference of the local region LAR selected in step S220. That is, the phase difference calculation unit 122 calculates the phase difference between the pair of images IMGf acquired in step S230.

次に、ステップS250では、特徴算出部132は、ステップS230で取得した一対の画像IMGfの形状の特徴として、一対の画像IMGfのエッジの急峻度σを算出する。例えば、特徴算出部132は、図4で説明したように、一対の画像IMGfのエッジの急峻度σを、位相差算出用の画素P2の列における互いに隣接する画素P2の画素値の差分dを用いて算出する。   Next, in step S250, the feature calculation unit 132 calculates the steepness σ of the edges of the pair of images IMGf as the feature of the shape of the pair of images IMGf acquired in step S230. For example, as described with reference to FIG. 4, the feature calculation unit 132 calculates the steepness σ of the edges of the pair of images IMGf, and the difference d between the pixel values of the adjacent pixels P2 in the column of the phase difference calculation pixels P2. Use to calculate.

次に、ステップS260では、誤差推定部142は、図2および図6で説明したように、精度情報AINF(例えば、図6に示した誤差テーブル)を用いて、位相差の算出誤差を推定する。例えば、誤差推定部142は、ステップS240で算出された位相差からオフセットOFを算出する。オフセットは、図5で説明した式(2)を用いて算出されてもよいし、フィッティング前後の差分絶対値和SADの分布を比較することにより算出されてもよい。   Next, in step S260, the error estimation unit 142 estimates the calculation error of the phase difference using the accuracy information AINF (for example, the error table shown in FIG. 6) as described with reference to FIGS. . For example, the error estimation unit 142 calculates the offset OF from the phase difference calculated in step S240. The offset may be calculated using the equation (2) described with reference to FIG. 5 or may be calculated by comparing the distribution of the sum of absolute differences SAD before and after the fitting.

例えば、フィッティング前後の差分絶対値和SADの分布を比較する方法では、フィッティング前(整数単位)の差分絶対値和SADのうち、小さい方から2つの差分絶対値和SADを特定する。そして、フィッティング前後の差分絶対値和SADの分布を比較する方法では、特定した2つの差分絶対値和SADにそれぞれ対応する位相差を”s1”、”s2”と定義する(s1<s2)。また、フィッティング後(小数単位)の差分絶対値和SADの最小値に対応する位相差(図3に示した推定シフト量)は、”s0”と定義される。この場合、オフセットOFは、位相差s1、s0の差分と位相差s2、s0の差分との比(|s0−s1|:|s2−s0|)から算出される。なお、位相差s2から位相差s1を減算した結果は、図5で説明した式(2)の画素間隔pに対応する。また、位相差s1は、式(2)の“k×p”に対応し、位相差s0は、式(2)の位相差sに対応する。   For example, in the method of comparing the distribution of the difference absolute value sum SAD before and after the fitting, two difference absolute value sums SAD are specified from the smaller one of the difference absolute value sums SAD before fitting (integer unit). Then, in the method of comparing the distribution of the difference absolute value sum SAD before and after the fitting, the phase differences corresponding to the two specified difference absolute value sums SAD are defined as “s1” and “s2” (s1 <s2). Further, the phase difference (estimated shift amount shown in FIG. 3) corresponding to the minimum value of the sum of absolute differences SAD after fitting (decimal unit) is defined as “s0”. In this case, the offset OF is calculated from the ratio (| s0−s1 |: | s2−s0 |) of the difference between the phase differences s1 and s0 and the difference between the phase differences s2 and s0. Note that the result of subtracting the phase difference s1 from the phase difference s2 corresponds to the pixel interval p in Expression (2) described with reference to FIG. Further, the phase difference s1 corresponds to “k × p” in Expression (2), and the phase difference s0 corresponds to the phase difference s in Expression (2).

誤差推定部142は、算出したオフセットOFとステップS250で算出されたエッジの急峻度σとの組み合わせに対応する推定位相差の誤差eを精度情報AINF(誤差テーブル)から推定する。これにより、ステップS220で選択した局所領域LARにおける位相差の算出誤差が推定される。ステップS260の処理が実行された後、測距装置102の動作は、ステップS270に移る。   The error estimation unit 142 estimates an error e of the estimated phase difference corresponding to the combination of the calculated offset OF and the edge steepness σ calculated in step S250 from the accuracy information AINF (error table). Thereby, the calculation error of the phase difference in the local region LAR selected in step S220 is estimated. After the process of step S260 is executed, the operation of the distance measuring apparatus 102 proceeds to step S270.

ステップS270では、位相差算出部122は、ステップS220で設定された全ての局所領域LARに対して、位相差を算出したか否かを判定する。全ての局所領域LARに対して位相差が算出された場合、測距装置102の動作は、ステップS280に移る。一方、位相差が算出されていない局所領域LARが存在する場合、測距装置102の動作は、ステップS220に戻る。   In step S270, the phase difference calculation unit 122 determines whether or not the phase difference has been calculated for all the local regions LAR set in step S220. When the phase difference is calculated for all the local regions LAR, the operation of the distance measuring apparatus 102 proceeds to step S280. On the other hand, when there is a local region LAR for which the phase difference is not calculated, the operation of the distance measuring apparatus 102 returns to step S220.

ステップS280では、代表位相差算出部150は、図2で説明したように、測距領域RAR内の位相差の代表値である代表位相差を算出する。例えば、ステップS210において、局所領域LARが図2に示したように設定された場合、代表位相差算出部150は、図2に示した局所領域LAR1−LAR9の位相差を、局所領域LAR1−LAR9の算出誤差に基づく重み付け係数で加重平均する。そして、代表位相差算出部150は、加重平均の結果を代表位相差とする。ステップS280の処理が実行された後、測距装置102の動作は、ステップS290に移る。   In step S280, the representative phase difference calculation unit 150 calculates a representative phase difference, which is a representative value of the phase difference in the ranging area RAR, as described with reference to FIG. For example, when the local region LAR is set as shown in FIG. 2 in step S210, the representative phase difference calculation unit 150 calculates the phase difference of the local regions LAR1-LAR9 shown in FIG. 2 as the local regions LAR1-LAR9. The weighted average is calculated using a weighting coefficient based on the calculation error. Then, the representative phase difference calculation unit 150 sets the weighted average result as the representative phase difference. After the process of step S280 is executed, the operation of the distance measuring apparatus 102 proceeds to step S290.

ステップS290では、代表位相差算出部150は、図2で説明したように、測距領域RAR内の位相差の代表値の誤差(代表位相差の誤差)を推定する。これにより、位相差算出処理が終了し、撮像装置12の動作は、図7に示したステップS300に移る。   In step S290, the representative phase difference calculation unit 150 estimates a representative value difference (representative phase difference error) in the ranging area RAR as described with reference to FIG. Thereby, the phase difference calculation process ends, and the operation of the imaging apparatus 12 proceeds to step S300 illustrated in FIG.

図9は、焦点の調整方法の一例を示す。なお、図9では、比較例として、位相差の算出誤差の推定精度が測距装置102に比べて低い測距装置を用いた場合を括弧内に示す。図9に示す例では、像面位相差AFは、レンズ20が開始位置のときに撮像された位相差算出用の一対の画像IMGfを用いて実行される。   FIG. 9 shows an example of a focus adjustment method. In FIG. 9, as a comparative example, a case where a distance measuring device whose estimation accuracy of the phase difference calculation error is lower than that of the distance measuring device 102 is used is shown in parentheses. In the example shown in FIG. 9, the image plane phase difference AF is executed using a pair of images IMGf for phase difference calculation captured when the lens 20 is at the start position.

例えば、撮像装置12は、位相差算出用の一対の画像IMGfを用いて像面位相差AFを実行し、コントラストAFの探索範囲を決定する。そして、撮像装置12は、探索範囲の始点までレンズ20を駆動して撮像し、撮像した画像のコントラストを算出する。次に、撮像装置12は、探索範囲の終点方向に所定の量だけレンズ20を駆動して撮像し、撮像した画像のコントラストを算出する。撮像装置12は、コントラストの最も高い画像を検出するまでレンズ20の位置を探索範囲の終点方向に所定の量だけ移動させて画像のコントラストを逐次解析する。   For example, the imaging device 12 executes the image plane phase difference AF using the pair of images IMGf for calculating the phase difference, and determines the contrast AF search range. Then, the imaging device 12 drives the lens 20 to the start point of the search range for imaging, and calculates the contrast of the captured image. Next, the imaging device 12 drives the lens 20 by a predetermined amount in the end point direction of the search range to capture an image, and calculates the contrast of the captured image. The imaging device 12 sequentially analyzes the contrast of the image by moving the position of the lens 20 by a predetermined amount toward the end point of the search range until an image with the highest contrast is detected.

そして、撮像装置12は、コントラストのピークを検出した場合、コントラストがピークになるレンズ20の位置、すなわち、合焦位置までレンズ20を戻す。これにより、焦点の調整が終了する。   When the imaging device 12 detects a contrast peak, the imaging device 12 returns the lens 20 to the position of the lens 20 where the contrast reaches the peak, that is, the in-focus position. Thereby, the focus adjustment is completed.

なお、比較例では、位相差の算出誤差の推定精度が測距装置102に比べて低い測距装置が用いられる。このため、比較例の像面位相差AFで推定された算出誤差が測距装置102による像面位相差AFで推定された算出誤差と同じ場合でも、探索範囲は、測距装置102で推定された算出誤差に基づいて設定される探索範囲より広く設定される。このように、比較例では、探索範囲を広く設定することにより、探索範囲内に合焦位置が存在しない状態が発生することを抑止する。しかしながら、探索範囲を広く設定すると、合焦までの時間が長くなる。   In the comparative example, a distance measuring device whose estimation accuracy of the phase difference calculation error is lower than that of the distance measuring device 102 is used. Therefore, even if the calculation error estimated by the image plane phase difference AF of the comparative example is the same as the calculation error estimated by the image plane phase difference AF by the distance measuring device 102, the search range is estimated by the distance measuring device 102. It is set wider than the search range set based on the calculated error. As described above, in the comparative example, by setting a wide search range, it is possible to prevent the occurrence of a state in which no in-focus position exists in the search range. However, if the search range is set wide, the time until focusing is increased.

これに対し、図2に示す撮像装置12は、位相差の算出誤差の推定精度を向上させることができるため、比較例に比べて探索範囲を狭くでき、合焦までの時間を短縮できる。   On the other hand, since the imaging device 12 shown in FIG. 2 can improve the estimation accuracy of the phase difference calculation error, the search range can be narrowed compared to the comparative example, and the time until focusing can be shortened.

以上、図2から図9に示す実施形態においても、図1に示した実施形態と同様の効果を得ることができる。例えば、測距装置102は、一対の画像IMGf間の位相差を算出するとともに、一対の画像IMGfのエッジの急峻度σを位相差算出用の画素PX2の列により定まる画素間の画素値の差dに基づいて算出する。さらに、測距装置102は、位相差の算出値と位相差算出用の画素PX2の列における画素間隔pとのオフセットOFを算出する。   As described above, also in the embodiment shown in FIG. 2 to FIG. 9, the same effect as that of the embodiment shown in FIG. 1 can be obtained. For example, the distance measuring device 102 calculates the phase difference between the pair of images IMGf, and the pixel value difference between the pixels determined by the column of the phase difference calculation pixels PX2 as the steepness σ of the edges of the pair of images IMGf. Calculate based on d. Further, the distance measuring device 102 calculates an offset OF between the calculated value of the phase difference and the pixel interval p in the column of the pixels PX2 for calculating the phase difference.

そして、測距装置102は、一対の画像IMGfのエッジの急峻度σとオフセットOFとの組み合わせに対応する推定位相差の誤差eを精度情報AINFから推定する。これにより、一対の画像IMGf間の位相差の算出値の誤差である算出誤差が推定される。この結果、測距装置102は、一対の画像IMGfのエッジの急峻度σおよび位相差算出用の画素PX2の列における画素間隔pに拘わらず、すなわち、被写体および撮像素子30によらず、一対の画像IMGf間の位相差の算出値の誤差を精度よく推定できる。すなわち、測距装置102は、位相差検出方式により算出される位相差の信頼度の推定精度を向上させることができる。これにより、撮像装置12は、例えば、コントラスト方式における探索範囲を適切に設定でき、合焦までの時間を短縮できる。   Then, the distance measuring apparatus 102 estimates the error e of the estimated phase difference corresponding to the combination of the edge steepness σ and the offset OF of the pair of images IMGf from the accuracy information AINF. As a result, a calculation error that is an error in the calculated value of the phase difference between the pair of images IMGf is estimated. As a result, the distance measuring apparatus 102 does not depend on the steepness σ of the edge of the pair of images IMGf and the pixel interval p in the column of the pixel PX2 for phase difference calculation, that is, regardless of the subject and the image sensor 30, The error of the calculated value of the phase difference between the images IMGf can be accurately estimated. That is, the distance measuring apparatus 102 can improve the estimation accuracy of the reliability of the phase difference calculated by the phase difference detection method. Thereby, the imaging device 12 can appropriately set the search range in the contrast method, for example, and can shorten the time until focusing.

さらに、撮像装置12は、複数の局所領域LARの位相差を、各局所領域LARの算出誤差に基づく重み付け係数で加重平均する。そして、撮像装置12は、加重平均の結果を複数の局所領域LARの位相差の代表値である代表位相差とする。加重平均に用いる重み付け係数が精度の高い算出誤差に基づいて決定されるため、加重平均の結果である代表位相差の算出精度を向上させることができる。この場合、位相差検出方式のオートフォーカス制御による焦点の調整精度を向上させることができる。   Furthermore, the imaging device 12 weights and averages the phase differences of the plurality of local regions LAR with a weighting coefficient based on the calculation error of each local region LAR. Then, the imaging apparatus 12 sets the weighted average result as a representative phase difference that is a representative value of the phase differences of the plurality of local regions LAR. Since the weighting coefficient used for the weighted average is determined based on a highly accurate calculation error, the calculation accuracy of the representative phase difference, which is the result of the weighted average, can be improved. In this case, it is possible to improve the focus adjustment accuracy by the phase difference detection type autofocus control.

図10は、撮像装置および撮像装置の制御方法の別の実施形態を示す。図1から図9で説明した要素と同一または同様の要素については、同一または同様の符号を付し、これ等については、詳細な説明を省略する。図10に示す撮像装置14は、図2に示した測距装置102の代わりに測距装置104を有することを除いて、図2に示した撮像装置12と同一または同様である。例えば、撮像装置14は、レンズ20と撮像素子30と測距装置104と焦点調整部200とを有するデジタルカメラである。   FIG. 10 shows another embodiment of the imaging device and the control method of the imaging device. Elements that are the same as or similar to those described in FIGS. 1 to 9 are given the same or similar reference numerals, and detailed descriptions thereof are omitted. The imaging device 14 illustrated in FIG. 10 is the same as or similar to the imaging device 12 illustrated in FIG. 2 except that the ranging device 104 is included instead of the ranging device 102 illustrated in FIG. For example, the imaging device 14 is a digital camera including a lens 20, an imaging element 30, a distance measuring device 104, and a focus adjustment unit 200.

測距装置104では、図2に示した誤差推定部142の代わりに第1誤差推定部142aが設けられ、第2誤差推定部160および誤差設定部170が図2に示した測距装置102に追加される。測距装置104のその他の構成は、測距装置102と同一または同様である。例えば、測距装置104は、記憶部110、測距領域選択部112、局所領域設定部114、位相差算出部122、特徴算出部132、第1誤差推定部142a、代表位相差算出部150、第2誤差推定部160および誤差設定部170を有する。そして、測距装置104は、レンズ20の合焦時の位置からのずれ量に応じて発生する一対の画像IMGf間の位相差を算出する。   In the distance measuring device 104, a first error estimating unit 142a is provided instead of the error estimating unit 142 shown in FIG. 2, and the second error estimating unit 160 and the error setting unit 170 are added to the distance measuring device 102 shown in FIG. Added. The other configuration of the distance measuring device 104 is the same as or similar to that of the distance measuring device 102. For example, the distance measuring device 104 includes a storage unit 110, a distance measurement region selection unit 112, a local region setting unit 114, a phase difference calculation unit 122, a feature calculation unit 132, a first error estimation unit 142a, a representative phase difference calculation unit 150, A second error estimation unit 160 and an error setting unit 170 are included. Then, the distance measuring device 104 calculates a phase difference between the pair of images IMGf that is generated according to the amount of deviation of the lens 20 from the in-focus position.

第1誤差推定部142aは、各局所領域LARにおける位相差の算出誤差を示す情報ERINF1aの出力先を除いて、図2に示した誤差推定部142と同一または同様である。例えば、第1誤差推定部142aは、各局所領域LARにおける位相差の算出誤差を示す情報ERINF1aを、誤差設定部170に出力する。   The first error estimator 142a is the same as or similar to the error estimator 142 shown in FIG. 2 except for the output destination of the information ERINF1a indicating the phase difference calculation error in each local region LAR. For example, the first error estimation unit 142a outputs information ERINF1a indicating the phase difference calculation error in each local region LAR to the error setting unit 170.

第2誤差推定部160は、撮像素子30により撮像された画像IMGを示す情報を受け、各局所領域LARにおける一対の画像IMGf間の位相差の算出値を示す情報PDINF1を位相差算出部122から受ける。そして、第2誤差推定部160は、一対の画像IMGf間の位相差の算出値に基づいて一対の画像IMGfの一方をシフトした場合の一対の画像IMGf間の差分に基づく相関値を用いて、位相差の算出誤差を複数の局所領域LAR毎に推定する。相関値は、例えば、位相差算出部122により算出された位相差に対応する差分絶対値和SADである。   The second error estimator 160 receives information indicating the image IMG captured by the image sensor 30, and receives information PDINF1 indicating the calculated value of the phase difference between the pair of images IMGf in each local region LAR from the phase difference calculator 122. receive. Then, the second error estimation unit 160 uses the correlation value based on the difference between the pair of images IMGf when one of the pair of images IMGf is shifted based on the calculated value of the phase difference between the pair of images IMGf. The phase difference calculation error is estimated for each of the plurality of local regions LAR. The correlation value is, for example, a difference absolute value sum SAD corresponding to the phase difference calculated by the phase difference calculation unit 122.

例えば、第2誤差推定部160は、位相差算出部122により算出された位相差に対応する差分絶対値和SADと、画素P2の列における画像のコントラストαとを用いて、信頼度rを算出する。コントラストαは、画素P2の列における最大の画素値と最小の画素値との差分である。また、信頼度rは、差分絶対値和SAD、コントラストαおよび係数cを用いて、式(4)で表される。   For example, the second error estimating unit 160 calculates the reliability r using the difference absolute value sum SAD corresponding to the phase difference calculated by the phase difference calculating unit 122 and the image contrast α in the column of the pixels P2. To do. The contrast α is a difference between the maximum pixel value and the minimum pixel value in the column of the pixels P2. Further, the reliability r is expressed by Expression (4) using the difference absolute value sum SAD, the contrast α, and the coefficient c.

r=c×α×(1/SAD) ・・・(4)
式(4)の係数cは、例えば、信頼度rから推定される算出誤差と第1誤差推定部142aで推定される位相差の算出誤差とのスケールを合わせるための係数であり、予め推定された値が用いられる。
r = c × α × (1 / SAD) (4)
The coefficient c in the equation (4) is a coefficient for adjusting the scale of the calculation error estimated from the reliability r and the calculation error of the phase difference estimated by the first error estimation unit 142a, and is estimated in advance. Values are used.

第2誤差推定部160は、位相差の算出誤差と信頼度rとの関係を示す情報であって、予め取得された変換情報を用いて、信頼度rから算出誤差を推定する。そして、第2誤差推定部160は、各局所領域LARにおける位相差の算出誤差を示す情報ERINF1bを、誤差設定部170に出力する。なお、第2誤差推定部160は、情報PDINF1の代わりに、一対の画像IMGf間の位相差に対応する差分絶対値和SADを示す情報を位相差算出部122から受けてもよい。   The second error estimator 160 is information indicating the relationship between the phase difference calculation error and the reliability r, and estimates the calculation error from the reliability r using previously acquired conversion information. Then, the second error estimation unit 160 outputs information ERINF1b indicating the phase difference calculation error in each local region LAR to the error setting unit 170. Note that the second error estimating unit 160 may receive information indicating the difference absolute value sum SAD corresponding to the phase difference between the pair of images IMGf from the phase difference calculating unit 122 instead of the information PDINF1.

誤差設定部170は、第1誤差推定部142aで推定した位相差の算出誤差と第2誤差推定部160で推定した位相差の算出誤差とのうちの大きい方を、代表位相差算出部150で使用する算出誤差に設定する。例えば、誤差設定部170は、第1誤差推定部142aで推定した位相差の算出誤差と第2誤差推定部160で推定した位相差の算出誤差とのうちの大きい方の算出誤差を示す情報ERINF1cを、代表位相差算出部150に出力する。そして、代表位相差算出部150は、情報ERINF1cで示される位相差の算出誤差に基づいて、代表位相差の誤差を推定する。   The error setting unit 170 uses the representative phase difference calculation unit 150 to calculate a larger one of the phase difference calculation error estimated by the first error estimation unit 142a and the phase difference calculation error estimated by the second error estimation unit 160. Set the calculation error to be used. For example, the error setting unit 170 may include information ERINF1c indicating a larger calculation error of the phase difference calculation error estimated by the first error estimation unit 142a and the phase difference calculation error estimated by the second error estimation unit 160. Is output to the representative phase difference calculation unit 150. Then, the representative phase difference calculation unit 150 estimates a representative phase difference error based on the phase difference calculation error indicated by the information ERINF1c.

なお、撮像装置14の構成は、図10に示す例に限定されない。例えば、図1に示した測距装置100に第2誤差推定部160および誤差設定部170が追加されてもよい。この場合、誤差設定部170は、図1に示した誤差推定部140で推定した位相差の算出誤差と第2誤差推定部160で推定した位相差の算出誤差とのうちの大きい方の算出誤差を示す情報ERINF1cを、焦点調整部200に出力する。また、例えば、撮像装置14は、精度情報AINFを生成する精度情報生成部を有してもよい。   The configuration of the imaging device 14 is not limited to the example illustrated in FIG. For example, the second error estimation unit 160 and the error setting unit 170 may be added to the distance measuring apparatus 100 illustrated in FIG. In this case, the error setting unit 170 calculates the larger one of the phase difference calculation error estimated by the error estimation unit 140 and the phase difference calculation error estimated by the second error estimation unit 160 shown in FIG. Is output to the focus adjustment unit 200. For example, the imaging device 14 may include an accuracy information generation unit that generates accuracy information AINF.

図11は、図10に示した測距装置104の動作の一例を示す。図11に示す動作は、撮像装置の制御方法の一態様である。なお、撮像装置14の動作は、図7に示した動作と同一または同様である。図7に示した位相差算出処理として、図11に示す動作が実行される。図11に示す動作は、ステップ242およびステップS262が図8に示す動作に追加されることを除いて、図8に示す動作と同一または同様である。ステップ242およびステップS262以外の処理については、詳細な説明を省略する。   FIG. 11 shows an example of the operation of the distance measuring apparatus 104 shown in FIG. The operation illustrated in FIG. 11 is an aspect of a method for controlling the imaging apparatus. Note that the operation of the imaging device 14 is the same as or similar to the operation shown in FIG. As the phase difference calculation process shown in FIG. 7, the operation shown in FIG. 11 is executed. The operation shown in FIG. 11 is the same as or similar to the operation shown in FIG. 8 except that step 242 and step S262 are added to the operation shown in FIG. Detailed descriptions of processes other than step 242 and step S262 are omitted.

ステップS242の処理は、例えば、ステップS240の処理が実行された後、実行され、ステップS262の処理は、ステップS260の処理が実行された後、実行される。   The process of step S242 is executed after the process of step S240 is executed, for example, and the process of step S262 is executed after the process of step S260 is executed.

ステップS242では、第2誤差推定部160は、図10で説明したように、一対の画像IMGfにおける差分絶対値和SAD等の一対の画像IMGf間の相関値から位相差の算出誤差を推定する。ステップS242の処理が実行された後、測距装置104の動作は、ステップS250に移る。   In step S242, as described with reference to FIG. 10, the second error estimation unit 160 estimates the phase difference calculation error from the correlation value between the pair of images IMGf such as the sum of absolute differences SAD in the pair of images IMGf. After the process of step S242 is executed, the operation of the distance measuring apparatus 104 proceeds to step S250.

ステップS262では、誤差設定部170は、図10で説明したように、第1誤差推定部142aで推定した位相差の算出誤差と第2誤差推定部160で推定した位相差の算出誤差とのうちの大きい方の算出誤差を、所領域LARの位相差の算出誤差に決定する。すなわち、誤差設定部170は、ステップS260で推定された位相差の算出誤差とステップS242で推定された位相差の算出誤差とのうちの大きい方の算出誤差を、所領域LARの位相差の算出誤差に決定する。ステップS262の処理が実行された後、測距装置104の動作は、ステップS270に移る。   In step S262, as described with reference to FIG. 10, the error setting unit 170 includes the phase difference calculation error estimated by the first error estimation unit 142a and the phase difference calculation error estimated by the second error estimation unit 160. The larger calculation error is determined as the calculation error of the phase difference of the area LAR. That is, the error setting unit 170 calculates a larger calculation error of the phase difference calculation error estimated in step S260 and the phase difference calculation error estimated in step S242 to calculate the phase difference of the region LAR. Decide on error. After the process of step S262 is executed, the operation of the distance measuring apparatus 104 proceeds to step S270.

なお、測距装置104の動作、すなわち、位相差算出処理は、図11に示す例に限定されない。例えば、ステップS242の処理は、ステップS260の処理が実行された後、実行されてもよい。   Note that the operation of the distance measuring device 104, that is, the phase difference calculation process is not limited to the example shown in FIG. For example, the process of step S242 may be executed after the process of step S260 is executed.

以上、図10から図11に示す実施形態においても、図2から図9に示した実施形態と同様の効果を得ることができる。例えば、測距装置104は、一対の画像IMGfのエッジの急峻度σとオフセットOFとの組み合わせに対応する推定位相差の誤差eを精度情報AINFから推定する。これにより、一対の画像IMGf間の位相差の算出値の誤差である算出誤差が推定される。この結果、測距装置104は、一対の画像IMGfのエッジの急峻度σおよび位相差算出用の画素PX2の列における画素間隔pに拘わらず、すなわち、被写体および撮像素子30によらず、一対の画像IMGf間の位相差の算出値の誤差を精度よく推定できる。すなわち、測距装置104は、位相差検出方式により算出される位相差の信頼度の推定精度を向上させることができる。これにより、撮像装置14は、例えば、コントラスト方式における探索範囲を適切に設定でき、合焦までの時間を短縮できる。   As described above, also in the embodiment shown in FIGS. 10 to 11, the same effect as that of the embodiment shown in FIGS. 2 to 9 can be obtained. For example, the distance measuring apparatus 104 estimates the estimated phase difference error e corresponding to the combination of the edge steepness σ and the offset OF of the pair of images IMGf from the accuracy information AINF. As a result, a calculation error that is an error in the calculated value of the phase difference between the pair of images IMGf is estimated. As a result, the distance measuring apparatus 104 does not depend on the edge steepness σ of the pair of images IMGf and the pixel interval p in the column of the phase difference calculation pixels PX2, that is, regardless of the subject and the image sensor 30. The error of the calculated value of the phase difference between the images IMGf can be accurately estimated. That is, the distance measuring device 104 can improve the accuracy of estimation of the reliability of the phase difference calculated by the phase difference detection method. Thereby, the imaging device 14 can appropriately set the search range in the contrast method, for example, and can shorten the time until focusing.

さらに、測距装置104は、2通りの方法で推定した位相差の算出誤差のうち、算出誤差が大きい方を局所領域LARにおける位相差の算出誤差として推定する。これにより、位相差の算出誤差の推定精度を向上させることができる。この結果、例えば、撮像装置14は、算出誤差に対応した範囲をコントラストAFの探索範囲に設定した場合に、探索範囲内に合焦位置が存在しない状態が発生することを抑止できる。   Further, the distance measuring apparatus 104 estimates a larger calculation error as a phase difference calculation error in the local region LAR among the phase difference calculation errors estimated by the two methods. Thereby, the estimation accuracy of the phase difference calculation error can be improved. As a result, for example, when the range corresponding to the calculation error is set as the contrast AF search range, the imaging device 14 can suppress the occurrence of a state in which the in-focus position does not exist within the search range.

以上の実施形態において説明した発明を整理して、付記として開示する。
(付記1)
レンズの互いに異なる領域を通過した被写体からの光束に基づいて位相差算出用の一対の画像を生成する一対の画素の列を含む撮像素子と、前記レンズの合焦時の位置からのずれ量に応じて発生する前記一対の画像間の位相差を算出する測距装置と、前記測距装置により算出された前記一対の画像間の位相差に基づいて焦点を調整する焦点調整部とを備え、
前記測距装置は、
前記一対の画像間の位相差を算出する位相差算出部と、
前記一対の画像における互いに隣接する画素間での画素値の変化の度合いであるエッジの急峻度を、前記画素の列における画素間の画素値の差に基づいて算出する特徴算出部と、
エッジの急峻度と位相差の算出値の誤差との関係を示す情報であって、予め取得された精度情報を記憶する記憶部と、
前記一対の画像間の位相差の算出値の誤差である算出誤差を、前記精度情報を用いて、前記一対の画像のエッジの急峻度から推定する第1誤差推定部とを有し、
前記一対の画像間の位相差の算出値および前記算出誤差を前記焦点調整部に通知する
ことを特徴とする撮像装置。
(付記2)
付記1に記載の撮像装置において、
前記撮像素子は、前記一対の画素の列が配置される局所領域を複数有し、
前記位相差算出部は、前記一対の画像間の位相差を、複数の前記局所領域毎に算出し、
前記特徴算出部は、前記一対の画像のエッジの急峻度を複数の前記局所領域毎に算出し、
前記第1誤差推定部は、前記算出誤差を複数の前記局所領域毎に推定し、
前記測距装置は、
前記算出誤差が大きくなるにしたがい小さくなる重み付け係数を複数の前記局所領域毎に算出し、複数の前記局所領域毎に算出された前記一対の画像間の位相差を前記重み付け係数で加重平均して代表位相差を算出し、前記代表位相差の誤差を複数の前記局所領域毎に推定された複数の前記算出誤差に基づいて推定し、前記代表位相差および前記代表位相差の誤差を前記一対の画像間の位相差の算出値および前記算出誤差として前記焦点調整部に通知する代表位相差算出部をさらに有する
ことを特徴とする撮像装置。
(付記3)
付記2に記載の撮像装置において、
前記測距装置は、
前記一対の画像間の位相差の算出値に基づいて前記一対の画像の一方をシフトした場合の前記一対の画像間の差分に基づく相関値を用いて、前記算出誤差を複数の前記局所領域毎に推定する第2誤差推定部と、
前記第1誤差推定部で推定した前記算出誤差と前記第2誤差推定部で推定した前記算出誤差とのうちの大きい方を、前記代表位相差算出部で使用する前記算出誤差に設定する誤差設定部とをさらに有する
ことを特徴とする撮像装置。
(付記4)
付記1ないし付記3のいずれか1項に記載の撮像装置において、
前記精度情報は、前記画素の列の画素間隔を基準単位として位相差を表した場合の位相差の端数と、位相差の算出値の誤差との関係を示す情報をさらに含み、
前記第1誤差推定部は、前記一対の画像間の位相差の算出値における前記端数と前記一対の画像のエッジの急峻度と前記精度情報とに基づいて、前記算出誤差を推定する
ことを特徴とする撮像装置。
(付記5)
付記1に記載の撮像装置において、
前記測距装置は、
前記一対の画像間の位相差の算出値に基づいて前記一対の画像の一方をシフトした場合の前記一対の画像間の差分に基づく相関値を用いて、前記算出誤差を推定する第2誤差推定部と、
前記第1誤差推定部で推定した前記算出誤差と前記第2誤差推定部で推定した前記算出誤差とのうちの大きい方を、前記焦点調整部に通知する前記算出誤差に設定する誤差設定部とをさらに有する
ことを特徴とする撮像装置。
(付記6)
レンズの互いに異なる領域を通過した被写体からの光束に基づいて位相差算出用の一対の画像を生成する一対の画素の列を含む撮像素子と、前記レンズの合焦時の位置からのずれ量に応じて発生する前記一対の画像間の位相差を算出する測距装置と、前記測距装置により算出された前記一対の画像間の位相差に基づいて焦点を調整する焦点調整部とを有する撮像装置の制御方法において、
前記測距装置が、
前記一対の画像間の位相差を算出し、
前記一対の画像における互いに隣接する画素間での画素値の変化の度合いであるエッジの急峻度を、前記画素の列における画素間の画素値の差に基づいて算出し、
エッジの急峻度と位相差の算出値の誤差との関係を示す情報であって、予め取得された精度情報を用いて、前記一対の画像間の位相差の算出値の誤差である算出誤差を前記一対の画像のエッジの急峻度から推定し、
前記一対の画像間の位相差の算出値および前記算出誤差を前記焦点調整部に通知する
ことを特徴とする撮像装置の制御方法。
The invention described in the above embodiments is organized and disclosed as an appendix.
(Appendix 1)
An imaging element including a pair of pixels that generate a pair of images for calculating a phase difference based on light beams from subjects that have passed through different areas of the lens, and an amount of deviation from the focusing position of the lens A distance measuring device that calculates a phase difference between the pair of images generated according to the method, and a focus adjustment unit that adjusts a focus based on the phase difference between the pair of images calculated by the distance measuring device;
The distance measuring device is
A phase difference calculating unit for calculating a phase difference between the pair of images;
A feature calculation unit that calculates a steepness of an edge, which is a degree of change in pixel value between adjacent pixels in the pair of images, based on a difference in pixel value between pixels in the column of pixels;
Information indicating the relationship between the steepness of the edge and the error of the calculated value of the phase difference, a storage unit that stores accuracy information acquired in advance,
A first error estimator that estimates a calculation error, which is an error of a calculated value of a phase difference between the pair of images, from the steepness of edges of the pair of images using the accuracy information;
The imaging apparatus, wherein the focus adjustment unit is notified of the calculated value of the phase difference between the pair of images and the calculation error.
(Appendix 2)
In the imaging device according to attachment 1,
The imaging device has a plurality of local regions where the pair of pixel columns are arranged,
The phase difference calculating unit calculates a phase difference between the pair of images for each of the plurality of local regions;
The feature calculation unit calculates the steepness of the edges of the pair of images for each of the plurality of local regions,
The first error estimation unit estimates the calculation error for each of the plurality of local regions,
The distance measuring device is
A weighting coefficient that decreases as the calculation error increases is calculated for each of the plurality of local areas, and a phase difference between the pair of images calculated for each of the plurality of local areas is weighted and averaged by the weighting coefficient. A representative phase difference is calculated, an error of the representative phase difference is estimated based on the plurality of calculation errors estimated for each of the plurality of local regions, and the representative phase difference and the error of the representative phase difference are An imaging apparatus, further comprising: a representative phase difference calculation unit that notifies a calculation value of a phase difference between images and the focus adjustment unit as the calculation error.
(Appendix 3)
In the imaging device according to attachment 2,
The distance measuring device is
Using the correlation value based on the difference between the pair of images when one of the pair of images is shifted based on the calculated value of the phase difference between the pair of images, the calculation error is calculated for each of the plurality of local regions. A second error estimator for estimating
An error setting for setting a larger one of the calculation error estimated by the first error estimation unit and the calculation error estimated by the second error estimation unit as the calculation error used by the representative phase difference calculation unit An imaging device.
(Appendix 4)
In the imaging device according to any one of supplementary notes 1 to 3,
The accuracy information further includes information indicating a relationship between a fraction of the phase difference when a phase difference is expressed with a pixel interval of the column of pixels as a reference unit, and an error of a calculated value of the phase difference,
The first error estimation unit estimates the calculation error based on the fraction in the calculated value of the phase difference between the pair of images, the steepness of the edge of the pair of images, and the accuracy information. An imaging device.
(Appendix 5)
In the imaging device according to attachment 1,
The distance measuring device is
A second error estimation that estimates the calculation error using a correlation value based on a difference between the pair of images when one of the pair of images is shifted based on a calculated value of a phase difference between the pair of images. And
An error setting unit that sets a larger one of the calculation error estimated by the first error estimation unit and the calculation error estimated by the second error estimation unit to the calculation error to be notified to the focus adjustment unit; An imaging apparatus, further comprising:
(Appendix 6)
An imaging element including a pair of pixels that generate a pair of images for calculating a phase difference based on light beams from subjects that have passed through different areas of the lens, and an amount of deviation from the focusing position of the lens An imaging apparatus comprising: a distance measuring device that calculates a phase difference between the pair of images generated according to the response; and a focus adjustment unit that adjusts a focus based on the phase difference between the pair of images calculated by the distance measuring device. In the device control method,
The distance measuring device is
Calculating a phase difference between the pair of images;
A steepness of an edge, which is a degree of change in pixel value between adjacent pixels in the pair of images, is calculated based on a difference in pixel value between pixels in the pixel column;
Information indicating the relationship between the steepness of the edge and the error of the calculated value of the phase difference, and using the accuracy information acquired in advance, a calculation error that is an error of the calculated value of the phase difference between the pair of images is calculated. Estimated from the steepness of the edges of the pair of images,
A control method for an imaging apparatus, wherein the focus adjustment unit is notified of a calculated value of a phase difference between the pair of images and the calculation error.

以上の詳細な説明により、実施形態の特徴点および利点は明らかになるであろう。これは、特許請求の範囲がその精神および権利範囲を逸脱しない範囲で前述のような実施形態の特徴点および利点にまで及ぶことを意図するものである。また、当該技術分野において通常の知識を有する者であれば、あらゆる改良および変更に容易に想到できるはずである。したがって、発明性を有する実施形態の範囲を前述したものに限定する意図はなく、実施形態に開示された範囲に含まれる適当な改良物および均等物に拠ることも可能である。   From the above detailed description, features and advantages of the embodiments will become apparent. This is intended to cover the features and advantages of the embodiments described above without departing from the spirit and scope of the claims. Also, any improvement and modification should be readily conceivable by those having ordinary knowledge in the art. Therefore, there is no intention to limit the scope of the inventive embodiments to those described above, and appropriate modifications and equivalents included in the scope disclosed in the embodiments can be used.

10、12、14‥撮像装置;20‥レンズ;30‥撮像素子;100、102、104‥測距装置;110‥記憶部;112‥測距領域選択部;114‥局所領域設定部;120、122‥位相差算出部;130、132‥特徴算出部;140、142‥誤差推定部;142a‥第1誤差推定部;150‥代表位相差算出部;160‥第2誤差推定部;170‥誤差設定部;200‥焦点調整部   DESCRIPTION OF SYMBOLS 10, 12, 14 ... Imaging device; 20 ... Lens; 30 ... Imaging element; 100, 102, 104 ... Ranging device; 110 ... Storage part; 112 ... Ranging area selection part; 122, phase difference calculation unit; 130, 132, feature calculation unit; 140, 142, error estimation unit; 142a, first error estimation unit; 150, representative phase difference calculation unit; 160, second error estimation unit; Setting part: 200 ... Focus adjustment part

Claims (5)

レンズの互いに異なる領域を通過した被写体からの光束に基づいて位相差算出用の一対の画像を生成する一対の画素の列を含む撮像素子と、前記レンズの合焦時の位置からのずれ量に応じて発生する前記一対の画像間の位相差を算出する測距装置と、前記測距装置により算出された前記一対の画像間の位相差に基づいて焦点を調整する焦点調整部とを備え、
前記測距装置は、
前記一対の画像間の位相差を算出する位相差算出部と、
前記一対の画像における互いに隣接する画素間での画素値の変化の度合いであるエッジの急峻度を、前記画素の列における画素間の画素値の差に基づいて算出する特徴算出部と、
エッジの急峻度と位相差の算出値の誤差との関係を示す情報であって、予め取得された精度情報を記憶する記憶部と、
前記一対の画像間の位相差の算出値の誤差である算出誤差を、前記精度情報を用いて、前記一対の画像のエッジの急峻度から推定する第1誤差推定部とを有し、
前記一対の画像間の位相差の算出値および前記算出誤差を前記焦点調整部に通知する
ことを特徴とする撮像装置。
An imaging element including a pair of pixels that generate a pair of images for calculating a phase difference based on light beams from subjects that have passed through different areas of the lens, and an amount of deviation from the focusing position of the lens A distance measuring device that calculates a phase difference between the pair of images generated according to the method, and a focus adjustment unit that adjusts a focus based on the phase difference between the pair of images calculated by the distance measuring device;
The distance measuring device is
A phase difference calculating unit for calculating a phase difference between the pair of images;
A feature calculation unit that calculates a steepness of an edge, which is a degree of change in pixel value between adjacent pixels in the pair of images, based on a difference in pixel value between pixels in the column of pixels;
Information indicating the relationship between the steepness of the edge and the error of the calculated value of the phase difference, a storage unit that stores accuracy information acquired in advance,
A first error estimator that estimates a calculation error, which is an error of a calculated value of a phase difference between the pair of images, from the steepness of edges of the pair of images using the accuracy information;
The imaging apparatus, wherein the focus adjustment unit is notified of the calculated value of the phase difference between the pair of images and the calculation error.
請求項1に記載の撮像装置において、
前記撮像素子は、前記一対の画素の列が配置される局所領域を複数有し、
前記位相差算出部は、前記一対の画像間の位相差を、複数の前記局所領域毎に算出し、
前記特徴算出部は、前記一対の画像のエッジの急峻度を複数の前記局所領域毎に算出し、
前記第1誤差推定部は、前記算出誤差を複数の前記局所領域毎に推定し、
前記測距装置は、
前記算出誤差が大きくなるにしたがい小さくなる重み付け係数を複数の前記局所領域毎に算出し、複数の前記局所領域毎に算出された前記一対の画像間の位相差を前記重み付け係数で加重平均して代表位相差を算出し、前記代表位相差の誤差を複数の前記局所領域毎に推定された複数の前記算出誤差に基づいて推定し、前記代表位相差および前記代表位相差の誤差を前記一対の画像間の位相差の算出値および前記算出誤差として前記焦点調整部に通知する代表位相差算出部をさらに有する
ことを特徴とする撮像装置。
The imaging device according to claim 1,
The imaging device has a plurality of local regions where the pair of pixel columns are arranged,
The phase difference calculating unit calculates a phase difference between the pair of images for each of the plurality of local regions;
The feature calculation unit calculates the steepness of the edges of the pair of images for each of the plurality of local regions,
The first error estimation unit estimates the calculation error for each of the plurality of local regions,
The distance measuring device is
A weighting coefficient that decreases as the calculation error increases is calculated for each of the plurality of local areas, and a phase difference between the pair of images calculated for each of the plurality of local areas is weighted and averaged by the weighting coefficient. A representative phase difference is calculated, an error of the representative phase difference is estimated based on the plurality of calculation errors estimated for each of the plurality of local regions, and the representative phase difference and the error of the representative phase difference are An imaging apparatus, further comprising: a representative phase difference calculation unit that notifies a calculation value of a phase difference between images and the focus adjustment unit as the calculation error.
請求項2に記載の撮像装置において、
前記測距装置は、
前記一対の画像間の位相差の算出値に基づいて前記一対の画像の一方をシフトした場合の前記一対の画像間の差分に基づく相関値を用いて、前記算出誤差を複数の前記局所領域毎に推定する第2誤差推定部と、
前記第1誤差推定部で推定した前記算出誤差と前記第2誤差推定部で推定した前記算出誤差とのうちの大きい方を、前記代表位相差算出部で使用する前記算出誤差に設定する誤差設定部とをさらに有する
ことを特徴とする撮像装置。
The imaging device according to claim 2,
The distance measuring device is
Using the correlation value based on the difference between the pair of images when one of the pair of images is shifted based on the calculated value of the phase difference between the pair of images, the calculation error is calculated for each of the plurality of local regions. A second error estimator for estimating
An error setting for setting a larger one of the calculation error estimated by the first error estimation unit and the calculation error estimated by the second error estimation unit as the calculation error used by the representative phase difference calculation unit An imaging device.
請求項1ないし請求項3のいずれか1項に記載の撮像装置において、
前記精度情報は、前記画素の列の画素間隔を基準単位として位相差を表した場合の位相差の端数と、位相差の算出値の誤差との関係を示す情報をさらに含み、
前記第1誤差推定部は、前記一対の画像間の位相差の算出値における前記端数と前記一対の画像のエッジの急峻度と前記精度情報とに基づいて、前記算出誤差を推定する
ことを特徴とする撮像装置。
The imaging apparatus according to any one of claims 1 to 3,
The accuracy information further includes information indicating a relationship between a fraction of the phase difference when a phase difference is expressed with a pixel interval of the column of pixels as a reference unit, and an error of a calculated value of the phase difference,
The first error estimation unit estimates the calculation error based on the fraction in the calculated value of the phase difference between the pair of images, the steepness of the edge of the pair of images, and the accuracy information. An imaging device.
レンズの互いに異なる領域を通過した被写体からの光束に基づいて位相差算出用の一対の画像を生成する一対の画素の列を含む撮像素子と、前記レンズの合焦時の位置からのずれ量に応じて発生する前記一対の画像間の位相差を算出する測距装置と、前記測距装置により算出された前記一対の画像間の位相差に基づいて焦点を調整する焦点調整部とを有する撮像装置の制御方法において、
前記測距装置が、
前記一対の画像間の位相差を算出し、
前記一対の画像における互いに隣接する画素間での画素値の変化の度合いであるエッジの急峻度を、前記画素の列における画素間の画素値の差に基づいて算出し、
エッジの急峻度と位相差の算出値の誤差との関係を示す情報であって、予め取得された精度情報を用いて、前記一対の画像間の位相差の算出値の誤差である算出誤差を前記一対の画像のエッジの急峻度から推定し、
前記一対の画像間の位相差の算出値および前記算出誤差を前記焦点調整部に通知する
ことを特徴とする撮像装置の制御方法。
An imaging element including a pair of pixels that generate a pair of images for calculating a phase difference based on light beams from subjects that have passed through different areas of the lens, and an amount of deviation from the focusing position of the lens An imaging apparatus comprising: a distance measuring device that calculates a phase difference between the pair of images generated according to the response; and a focus adjustment unit that adjusts a focus based on the phase difference between the pair of images calculated by the distance measuring device. In the device control method,
The distance measuring device is
Calculating a phase difference between the pair of images;
A steepness of an edge, which is a degree of change in pixel value between adjacent pixels in the pair of images, is calculated based on a difference in pixel value between pixels in the pixel column;
Information indicating the relationship between the steepness of the edge and the error of the calculated value of the phase difference, and using the accuracy information acquired in advance, a calculation error that is an error of the calculated value of the phase difference between the pair of images is calculated. Estimated from the steepness of the edges of the pair of images,
A control method for an imaging apparatus, wherein the focus adjustment unit is notified of a calculated value of a phase difference between the pair of images and the calculation error.
JP2016017097A 2016-02-01 2016-02-01 Imaging device and imaging device control method Pending JP2017138355A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2016017097A JP2017138355A (en) 2016-02-01 2016-02-01 Imaging device and imaging device control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2016017097A JP2017138355A (en) 2016-02-01 2016-02-01 Imaging device and imaging device control method

Publications (1)

Publication Number Publication Date
JP2017138355A true JP2017138355A (en) 2017-08-10

Family

ID=59566805

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2016017097A Pending JP2017138355A (en) 2016-02-01 2016-02-01 Imaging device and imaging device control method

Country Status (1)

Country Link
JP (1) JP2017138355A (en)

Similar Documents

Publication Publication Date Title
JP5066893B2 (en) Correlation calculation method, correlation calculation device, focus detection device, and imaging device
JP6489932B2 (en) Image processing apparatus, imaging apparatus, image processing method, and program
JP6021780B2 (en) Image data processing device, distance calculation device, imaging device, and image data processing method
KR101774167B1 (en) Focus position detection device, focus position detection method, and computer program for focus position detection
JP5845023B2 (en) FOCUS DETECTION DEVICE, LENS DEVICE HAVING THE SAME, AND IMAGING DEVICE
JP5157084B2 (en) Correlation calculation device, focus detection device, and imaging device
JP6014452B2 (en) FOCUS DETECTION DEVICE, LENS DEVICE HAVING THE SAME, AND IMAGING DEVICE
US10999491B2 (en) Control apparatus, image capturing apparatus, control method, and storage medium
KR101715553B1 (en) Focus position detection device, focus position detection method and a computer program for focus position detection
JP4926993B2 (en) Focus detection apparatus and imaging apparatus
EP3276944B1 (en) Image processing apparatus, image capturing apparatus, image processing method, and image processing program
JP6173549B2 (en) Image data processing device, distance calculation device, imaging device, and image data processing method
JP2017049412A (en) Imaging device, focus position detection device, focus position detection method and focus position detection computer program
JP2013218082A (en) Imaging apparatus and control method for the same
JP4817552B2 (en) Phase difference detection method, phase difference detection device, distance measuring device, and imaging device
JP2017138355A (en) Imaging device and imaging device control method
JP6746738B2 (en) Image processing device, imaging device, image processing method, and program
US20200294261A1 (en) Three-dimensional measurement apparatus, image capturing apparatus, control method, and recording medium
JP2017116723A (en) Imaging device, focus adjustment device, and focus adjustment program
JP2017083401A (en) Distance detection device, imaging apparatus, and distance detection method
JP2023069386A (en) Image measurement device, method and program
JP6598550B2 (en) Image processing apparatus, imaging apparatus, image processing method, and program
JP5932361B2 (en) Distance information detection apparatus, distance information detection method, and camera
JP2014038191A (en) Correlation calculation device and focus detection device
JP2021096320A (en) Control device and control method thereof

Legal Events

Date Code Title Description
RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7426

Effective date: 20170803

RD03 Notification of appointment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7423

Effective date: 20170803

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20170804