JP2014077830A - Imaging apparatus and focus control method - Google Patents

Imaging apparatus and focus control method Download PDF

Info

Publication number
JP2014077830A
JP2014077830A JP2012224055A JP2012224055A JP2014077830A JP 2014077830 A JP2014077830 A JP 2014077830A JP 2012224055 A JP2012224055 A JP 2012224055A JP 2012224055 A JP2012224055 A JP 2012224055A JP 2014077830 A JP2014077830 A JP 2014077830A
Authority
JP
Japan
Prior art keywords
phase difference
image
unit
detection
contrast value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2012224055A
Other languages
Japanese (ja)
Other versions
JP6045280B2 (en
Inventor
Shingo Kato
眞悟 加藤
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.)
Olympus Corp
Original Assignee
Olympus Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Olympus Corp filed Critical Olympus Corp
Priority to JP2012224055A priority Critical patent/JP6045280B2/en
Publication of JP2014077830A publication Critical patent/JP2014077830A/en
Application granted granted Critical
Publication of JP6045280B2 publication Critical patent/JP6045280B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Focusing (AREA)
  • Stereoscopic And Panoramic Photography (AREA)
  • Automatic Focus Adjustment (AREA)
  • Studio Devices (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide an imaging apparatus capable of detecting a phase difference with high reliability and to provide a focus control method or the like.SOLUTION: The imaging apparatus includes an imaging part 10, a contrast value calculation part 20, a detection position determination part 30, a phase difference detection part 40, and an AF control part 50. The imaging part 10 obtains a first image and a second image having parallax to the first image as parallax images. The contrast value calculation part 20 calculates a contrast value from at least one of the parallax images. The detection position determination part 30 determines a detection position where the phase difference is detected, based on the contrast value. The phase difference detection part 40 detects the phase difference between the first image and the second image in the detection position. The AF control part 50 performs the focus control of the imaging part 10 on the basis of the phase difference.

Description

本発明は、撮像装置及びフォーカス制御方法等に関する。   The present invention relates to an imaging apparatus, a focus control method, and the like.

代表的なオートフォーカス(AF: Auto-Focus)手法としてコントラストAF(例えば山登り法によるピント調整)と位相差AFが知られている。位相差AFはコントラストAFよりもスムーズで高速なAF動作が期待できるため、常にピントを合わせ続ける必要がある場合には、位相差AFが最適である。例えば、立体(3D)映像やステレオ映像は、視差を利用した対象物の奥行きに関する映像情報を有しているため、映像を見ながら物品を移動させる等の遠隔操作に好適であり、距離感覚を持ちつつ操作することができる。このような操作を行う際には、AFにより常にピントが合い続けていることが重要である。   As typical auto-focus (AF) methods, contrast AF (for example, focus adjustment by a hill-climbing method) and phase difference AF are known. Since the phase difference AF can be expected to be smoother and faster than the contrast AF, the phase difference AF is optimal when it is necessary to always keep focus. For example, stereoscopic (3D) video and stereo video have video information related to the depth of an object using parallax, and thus are suitable for remote operation such as moving an article while watching the video, and have a sense of distance. It can be operated while holding it. When performing such an operation, it is important that the AF is always in focus.

位相差AFの手法として、例えば特許文献1には、撮像素子の撮像用画素の中に位相差検出用画素を6行毎に設け、その位相差検出用画素により得られた信号に基づいて位相差を検出する手法が開示されている。   As a method of phase difference AF, for example, in Patent Document 1, phase difference detection pixels are provided for every six rows in the image pickup pixels of the image pickup element, and the phase difference AF is based on a signal obtained by the phase difference detection pixels. A technique for detecting a phase difference is disclosed.

特開2012−124766号公報JP 2012-124766 A

さて、位相差AFでは、位相差を適切に検出できないと被写体にフォーカスが合わない可能性があるため、高信頼度の位相差検出を行う必要があるという課題がある。   In the phase difference AF, there is a possibility that the subject cannot be focused if the phase difference cannot be detected properly, and thus there is a problem that it is necessary to perform highly reliable phase difference detection.

例えば、位相差検出は相関演算により行うが、その相関演算では画像の平坦部等で正しく位相差を算出できない場合がある。これを解決する手法として、例えば特許文献1のように複数の位相差検出ポイントを設け、各ポイントで検出された位相差の中から信頼度の高い位相差を選択する手法が考えられる。しかしながら、この手法では、位相差検出ポイントが離散的に設けられているため、例えばエッジ部のような位相差検出に適した部分がポイント上に結像するとは限らず、正しく位相差を算出できない可能性がある。   For example, although phase difference detection is performed by correlation calculation, there may be a case where the phase difference cannot be calculated correctly by a flat portion of an image or the like. As a method for solving this, for example, a method of providing a plurality of phase difference detection points as in Patent Document 1 and selecting a phase difference with high reliability from the phase differences detected at each point can be considered. However, in this method, since the phase difference detection points are provided discretely, a portion suitable for phase difference detection such as an edge portion does not always form an image on the point, and the phase difference cannot be calculated correctly. there is a possibility.

本発明の幾つかの態様によれば、高信頼度の位相差検出が可能な撮像装置及びフォーカス制御方法等を提供できる。   According to some aspects of the present invention, it is possible to provide an imaging apparatus, a focus control method, and the like that can detect a phase difference with high reliability.

本発明の一態様は、第1画像と、前記第1画像に対して視差を有する第2画像と、を視差画像として取得する撮像部と、前記視差画像のうち少なくとも一方の画像からコントラスト値を算出するコントラスト値算出部と、前記コントラスト値に基づいて、前記第1画像と前記第2画像との位相差を検出する検出位置を決定する検出位置決定部と、前記検出位置における前記第1画像と前記第2画像との前記位相差を検出する位相差検出部と、前記位相差に基づいて前記撮像部のフォーカス制御を行うフォーカス制御部と、を備える撮像装置に関係する。   According to one aspect of the present invention, an imaging unit that acquires a first image and a second image having a parallax with respect to the first image as a parallax image, and a contrast value from at least one of the parallax images. A contrast value calculation unit to calculate; a detection position determination unit for determining a detection position for detecting a phase difference between the first image and the second image based on the contrast value; and the first image at the detection position. And an image pickup apparatus comprising: a phase difference detection unit that detects the phase difference between the first image and the second image; and a focus control unit that performs focus control of the image pickup unit based on the phase difference.

また本発明の他の態様は、第1画像と、前記第1画像に対して視差を有する第2画像と、を視差画像として取得し、前記視差画像のうち少なくとも一方の画像からコントラスト値を算出し、前記コントラスト値に基づいて、前記第1の画像と前記第2の画像との位相差を検出する検出位置を決定し、前記検出位置における前記第1画像と前記第2画像の位相差を検出し、前記位相差に基づいて前記撮像部のフォーカス制御を行うフォーカス制御方法に関係する。   According to another aspect of the present invention, a first image and a second image having a parallax with respect to the first image are acquired as a parallax image, and a contrast value is calculated from at least one of the parallax images. And determining a detection position for detecting a phase difference between the first image and the second image based on the contrast value, and determining a phase difference between the first image and the second image at the detection position. The present invention relates to a focus control method that detects and performs focus control of the imaging unit based on the phase difference.

第1実施形態における撮像装置の構成例。1 is a configuration example of an imaging apparatus according to a first embodiment. 第1実施形態における撮像装置が行うAF制御処理のフローチャート。6 is a flowchart of AF control processing performed by the imaging apparatus according to the first embodiment. 第2実施形態におけるコントラストマップ生成部の動作説明図。Explanatory drawing of operation | movement of the contrast map production | generation part in 2nd Embodiment. 第2実施形態におけるコントラストマップ生成部の動作説明図。Explanatory drawing of operation | movement of the contrast map production | generation part in 2nd Embodiment. 第2実施形態における検出位置決定部の動作説明図。Explanatory drawing of operation | movement of the detection position determination part in 2nd Embodiment. 第2実施形態における検出位置決定部の動作説明図。Explanatory drawing of operation | movement of the detection position determination part in 2nd Embodiment. 第2実施形態における位相差検出部の詳細な構成例。The detailed structural example of the phase difference detection part in 2nd Embodiment. 第2実施形態における位相差検出部の動作説明図。Operation | movement explanatory drawing of the phase difference detection part in 2nd Embodiment. 第2実施形態における位相差検出部の動作説明図。Operation | movement explanatory drawing of the phase difference detection part in 2nd Embodiment. 第2実施形態における撮像装置が行うAF制御処理のフローチャート。10 is a flowchart of AF control processing performed by the imaging apparatus according to the second embodiment. 第3実施形態における撮像装置の構成例。The structural example of the imaging device in 3rd Embodiment. 第3実施形態におけるコントラストマップ生成部の動作説明図。Explanatory drawing of operation | movement of the contrast map production | generation part in 3rd Embodiment. 第3実施形態における表示制御部の動作説明図。Explanatory drawing of operation | movement of the display control part in 3rd Embodiment. 第3実施形態における撮像装置が行うAF制御処理のフローチャート。10 is a flowchart of AF control processing performed by the imaging apparatus according to the third embodiment. 第4実施形態における撮像装置の第1構成例。The 1st structural example of the imaging device in 4th Embodiment. 第4実施形態における撮像装置の第2構成例。10 is a second configuration example of an imaging apparatus according to a fourth embodiment. 第4実施形態における撮像部の詳細な構成例。The detailed structural example of the imaging part in 4th Embodiment.

以下、本発明の好適な実施の形態について詳細に説明する。なお以下に説明する本実施形態は特許請求の範囲に記載された本発明の内容を不当に限定するものではなく、本実施形態で説明される構成の全てが本発明の解決手段として必須であるとは限らない。   Hereinafter, preferred embodiments of the present invention will be described in detail. The present embodiment described below does not unduly limit the contents of the present invention described in the claims, and all the configurations described in the present embodiment are indispensable as means for solving the present invention. Not necessarily.

1.第1実施形態
位相差AF(AF: Auto-Focus)では、例えばSAD(Sum of Absolute Difference)演算等の相関演算により位相差を検出する。このような相関演算では、エッジ成分を含んだ部分では精度良く位相差が算出できるが、エッジ成分のないグラデーション部分や、スポンジのような空孔が密集している凹凸が連続する部分では、正しく位相差が算出できない場合がある。正しく位相差を算出できないと被写体にフォーカスが合わないため、位相差AFでは高信頼度の位相差検出を必要とするという課題がある。
1. First Embodiment In phase difference AF (AF: Auto-Focus), for example, a phase difference is detected by correlation calculation such as SAD (Sum of Absolute Difference) calculation. In such a correlation calculation, a phase difference can be accurately calculated in a portion including an edge component, but in a gradation portion without an edge component or a portion where unevenness having a dense hole such as a sponge continues, The phase difference may not be calculated. If the phase difference cannot be calculated correctly, the subject cannot be focused. Therefore, the phase difference AF requires a highly reliable phase difference detection.

このような課題を解決する手法として、位相差演算でのシフト値とそのシフト値におけるSAD値により表されるSADカーブの形状(信頼度)に基づいて、算出された位相差情報を使用してよいかを判断する手法がある。また、画像に位相差検出ポイントを多数設け、その各ポイントについて位相差を算出し、その多数の位相差の中から高い信頼度を有する位相差情報を選択する手法がある(例えば特許文献1)。この手法では、1回の撮像でより正確な位相差情報を得ることが可能である。   As a technique for solving such a problem, the phase difference information calculated based on the shift value in the phase difference calculation and the shape (reliability) of the SAD curve represented by the SAD value in the shift value is used. There is a method to judge whether it is good. In addition, there is a method of providing a number of phase difference detection points in an image, calculating a phase difference for each point, and selecting phase difference information having high reliability from the many phase differences (for example, Patent Document 1). . With this method, it is possible to obtain more accurate phase difference information with one imaging.

しかしながら、この手法では、複数の位相差検出ポイントを設けていても、あくまでもその配置は離散的であるため、位相差算出に適した画像部分が位相差検出ポイント上に結像するとは限らない。位相差算出に適した画像部分を位相差検出ポイント上に結像させるために、ポイントの個数を増やす手法が考えられるが、ポイントの個数を増やすと位相差算出回路のコストと算出時間が増えるという課題がある。   However, with this technique, even if a plurality of phase difference detection points are provided, the arrangement is discrete, and an image portion suitable for phase difference calculation is not always formed on the phase difference detection points. In order to form an image portion suitable for phase difference calculation on the phase difference detection point, a method of increasing the number of points can be considered, but increasing the number of points increases the cost and calculation time of the phase difference calculation circuit. There are challenges.

また、特許文献1のように撮像素子の撮像用画素の中に位相差検出用画素を設け、その位相差検出用画素を位相差検出ポイントとする手法では、位相差検出画素が画素欠陥となるという課題がある。即ち、撮像素子上には撮像用画素と位相差検出用画素が混在しているので、位相差検出画素を周囲の撮影画素から補間したデータに置き換える必要がある。そのため、通常の撮像素子よりも解像度的に不利であるという課題がある。また、撮像用画素と位相差検出用画素の混在する専用の撮像素子を使用しなければならない。   Further, in the method of providing a phase difference detection pixel in an imaging pixel of an image sensor as in Patent Document 1, and using the phase difference detection pixel as a phase difference detection point, the phase difference detection pixel becomes a pixel defect. There is a problem. That is, since the image pickup pixels and the phase difference detection pixels are mixed on the image pickup element, it is necessary to replace the phase difference detection pixels with data interpolated from surrounding photographing pixels. Therefore, there is a problem that it is disadvantageous in terms of resolution as compared with a normal image sensor. In addition, a dedicated imaging element in which imaging pixels and phase difference detection pixels are mixed must be used.

以上のような課題を解決できる本実施形態について、以下に説明する。まず第1実施形態について説明する。   This embodiment that can solve the above problems will be described below. First, the first embodiment will be described.

図1に第1実施形態における撮像装置の構成例を示す。この撮像装置は、撮像部10、コントラスト値算出部20、検出位置決定部30、位相差検出部40、AF制御部50、レンズ駆動部60を含む。   FIG. 1 shows a configuration example of an imaging apparatus according to the first embodiment. The imaging apparatus includes an imaging unit 10, a contrast value calculation unit 20, a detection position determination unit 30, a phase difference detection unit 40, an AF control unit 50, and a lens driving unit 60.

図2のフローチャートを用いて、この撮像装置が行う処理について説明する。図2に示すように、まず撮像部10が、視差を有する第1画像及び第2画像を視差画像として取得する(ステップS1)。なお以下では、撮像部10が有する撮像素子の水平走査方向に視差がある場合を例にとり、第1画像を左画像とし、第2画像を右画像として説明する。   Processing performed by the imaging apparatus will be described with reference to the flowchart of FIG. As shown in FIG. 2, first, the imaging unit 10 acquires a first image and a second image having parallax as parallax images (step S1). In the following description, an example in which there is parallax in the horizontal scanning direction of the imaging element included in the imaging unit 10 is described as a first image as a left image and a second image as a right image.

次に、コントラスト値算出部20が、左画像及び右画像の少なくとも一方の画像からコントラスト値を算出する(ステップS2)。なお以下では右画像からコントラスト値を算出する場合を例にとり説明する。例えば、コントラスト値算出部20は、右画像を複数のサブブロックに分割し、各サブブロックでのコントラスト値(例えばサブブロック内でのコントラスト平均値)を算出し、そのコントラスト値をコントラストマップとして不図示のメモリに記憶する。なお本実施形態ではこれに限定されず、例えば各画素位置でのコントラスト値を算出してもよい。また、必ずしもコントラスト値をコントラストマップとして保存する必要はなく、位相差の検出位置を決定するための統計値(例えば水平走査方向での最大値等)を求め、その統計値が求まったら順次コントラスト値をメモリから消去してもよい。   Next, the contrast value calculation unit 20 calculates a contrast value from at least one of the left image and the right image (step S2). In the following description, the case where the contrast value is calculated from the right image will be described as an example. For example, the contrast value calculation unit 20 divides the right image into a plurality of sub-blocks, calculates a contrast value in each sub-block (for example, a contrast average value in the sub-block), and sets the contrast value as a contrast map. Store in the illustrated memory. In the present embodiment, the present invention is not limited to this. For example, a contrast value at each pixel position may be calculated. In addition, it is not always necessary to store the contrast value as a contrast map, and a statistical value (for example, the maximum value in the horizontal scanning direction) for determining the detection position of the phase difference is obtained, and once the statistical value is obtained, the contrast value is sequentially obtained. May be deleted from the memory.

次に、検出位置決定部30が、コントラスト値に基づいて位相差の検出位置を決定する(ステップS3)。具体的には、コントラスト値が高い方が相関演算による位相差検出の精度が高いと考えられるため、右画像の中で相対的にコントラスト値が高いと判断される位置を位相差の検出位置に決定する。例えば後述のように、右画像の中でコントラスト値が最大の位置や、コントラスト値の重心位置等を、位相差の検出位置に決定する。   Next, the detection position determination unit 30 determines the detection position of the phase difference based on the contrast value (step S3). Specifically, it is considered that the higher the contrast value, the higher the accuracy of phase difference detection by correlation calculation. Therefore, the position where the contrast value is determined to be relatively high in the right image is set as the phase difference detection position. decide. For example, as will be described later, the position where the contrast value is maximum in the right image, the barycentric position of the contrast value, and the like are determined as the phase difference detection position.

次に、位相差検出部40が、決定された検出位置での右画像と左画像の位相差を検出する(ステップS4)。具体的には、検出位置の決定に用いた右画像を参照画像とし、左画像を探索画像として相関演算を行い、検出位置での位相差を検出する。相関演算では、例えば右画像から検出位置近傍の画像を取り出し、その画像を左画像上で検出位置を基準にシフトさせて各シフト量での相関値(例えばSAD値)を求め、相関値がピーク値(例えばSAD値の場合には最小値)となるシフト量を相関値として検出する。   Next, the phase difference detection unit 40 detects the phase difference between the right image and the left image at the determined detection position (step S4). Specifically, correlation calculation is performed using the right image used for determination of the detection position as a reference image and the left image as a search image, and a phase difference at the detection position is detected. In the correlation calculation, for example, an image near the detection position is extracted from the right image, the image is shifted on the left image with reference to the detection position, and a correlation value (for example, SAD value) at each shift amount is obtained. A shift amount that becomes a value (for example, a minimum value in the case of an SAD value) is detected as a correlation value.

次に、AF制御部50が、検出された位相差に基づいてレンズ駆動部60を制御し、撮像部10のフォーカスを調整する(ステップS5)。例えば、AF制御部50は、被写体にフォーカスが合うレンズ駆動量を位相差に基づいて算出し、そのレンズ駆動量で撮像部10のフォーカスレンズを駆動し、被写体にフォーカスを合わせる。或は、AF制御部50は、位相差のシフト方向に応じて、撮像部10のフォーカスレンズを被写体にフォーカスが合う方向に所定のレンズ駆動量だけ移動させ、複数回の位相差AFで被写体にフォーカスが合うようにしてもよい。   Next, the AF control unit 50 controls the lens driving unit 60 based on the detected phase difference to adjust the focus of the imaging unit 10 (step S5). For example, the AF control unit 50 calculates a lens driving amount that focuses on the subject based on the phase difference, drives the focus lens of the imaging unit 10 with the lens driving amount, and focuses the subject. Alternatively, the AF control unit 50 moves the focus lens of the imaging unit 10 by a predetermined lens driving amount in a direction in which the subject is focused according to the shift direction of the phase difference, and the subject is subjected to the phase difference AF multiple times. The focus may be adjusted.

以上の実施形態によれば、図1に示すように撮像装置は撮像部10とコントラスト値算出部20と検出位置決定部30と位相差検出部40とAF制御部50(フォーカス制御部)とを備える。図2で説明したように、撮像部10は、右画像(第1画像)と右画像に対して視差を有する左画像(第2画像)とを視差画像として取得する。コントラスト値算出部20は、その視差画像のうち少なくとも一方の画像(本実施形態の例では右画像)からコントラスト値CTVを算出する。検出位置決定部30は、そのコントラスト値CTVに基づいて、右画像と左画像との位相差を検出する検出位置を決定する。位相差検出部40は、その検出位置における右画像と左画像の位相差を検出する。AF制御部50は、その位相差に基づいて撮像部10のフォーカス制御を行う。   According to the above embodiment, as shown in FIG. 1, the imaging apparatus includes the imaging unit 10, the contrast value calculation unit 20, the detection position determination unit 30, the phase difference detection unit 40, and the AF control unit 50 (focus control unit). Prepare. As described with reference to FIG. 2, the imaging unit 10 acquires a right image (first image) and a left image (second image) having a parallax with respect to the right image as parallax images. The contrast value calculation unit 20 calculates the contrast value CTV from at least one of the parallax images (the right image in the example of the present embodiment). The detection position determination unit 30 determines a detection position for detecting a phase difference between the right image and the left image based on the contrast value CTV. The phase difference detection unit 40 detects the phase difference between the right image and the left image at the detection position. The AF control unit 50 performs focus control of the imaging unit 10 based on the phase difference.

さて、従来のように離散的な複数の位置を位相差の検出位置にした場合には、その離散的な位置に位相差検出に適した被写体領域が結像しない可能性があるという課題や、その複数の位置について相関演算を行うため処理負荷が大きいという課題がある。また、特許文献1のように撮像素子に位相差検出用画素を設ける手法では、位相差検出画素が画素欠陥となるという課題がある。   Now, in the case where a plurality of discrete positions are used as phase difference detection positions as in the prior art, there is a possibility that a subject area suitable for phase difference detection may not form an image at the discrete positions, There is a problem that the processing load is large because the correlation calculation is performed for the plurality of positions. Further, in the method of providing a phase difference detection pixel in the image sensor as in Patent Document 1, there is a problem that the phase difference detection pixel becomes a pixel defect.

この点、本実施形態では、コントラスト値CTVに基づいて位相差の検出位置を決定するため、画像内において位相差検出に適した任意の位置を位相差の検出位置として決定することができる。これにより、離散的でなく任意の画素位置で位相差を検出することができるため、位相差の検出信頼度が向上し、安定した高精度の位相差AFを実現できる。また、決定した検出位置でのみ相関演算を行うため、位相差検出回路のコストや演算時間を最小限に抑制できる。また、位相差検出画素を設ける必要がないため、画素補間を行う必要がなくなり、高精細な画像を撮像することができる。また、位相差検出画素を設けた特殊な撮像素子を用意する必要がなく、例えば一般的なRGB撮像素子等を用いることができる。   In this regard, in the present embodiment, since the phase difference detection position is determined based on the contrast value CTV, an arbitrary position suitable for phase difference detection in the image can be determined as the phase difference detection position. As a result, the phase difference can be detected at an arbitrary pixel position instead of being discrete, so that the detection reliability of the phase difference is improved, and a stable and highly accurate phase difference AF can be realized. Further, since the correlation calculation is performed only at the determined detection position, the cost and calculation time of the phase difference detection circuit can be minimized. In addition, since it is not necessary to provide a phase difference detection pixel, it is not necessary to perform pixel interpolation, and a high-definition image can be captured. Further, it is not necessary to prepare a special image sensor provided with phase difference detection pixels, and for example, a general RGB image sensor can be used.

また本実施形態では、コントラスト値算出部20は、視差画像のうち少なくとも一方の画像(本実施形態の例では右画像)にAF対象領域を設定し、そのAF対象領域におけるコントラスト値CTVを算出する。検出位置決定部30は、AF対象領域において相対的に高コントラスト値である位置を検出し、その相対的に高コントラスト値である位置を位相差の検出位置として決定する。例えば、相対的に高コントラスト値である位置は、AF対象領域内でのコントラスト値の最大値に対応する位置や、AF対象領域内でのコントラスト値の重心位置である。   In the present embodiment, the contrast value calculation unit 20 sets an AF target area in at least one of the parallax images (the right image in the example of the present embodiment), and calculates a contrast value CTV in the AF target area. . The detection position determination unit 30 detects a position having a relatively high contrast value in the AF target area, and determines the position having the relatively high contrast value as a detection position of the phase difference. For example, the position having a relatively high contrast value is a position corresponding to the maximum value of the contrast value in the AF target area or the barycentric position of the contrast value in the AF target area.

このようにすれば、例えばエッジ成分のないグラデーション部分などの低コントラスト領域ではなく、位相差検出に適していると考えられる高コントラスト領域に位相差の検出位置を設定することができる。これにより、高信頼度の位相差AFを実現することが可能になる。   In this way, the detection position of the phase difference can be set not in a low contrast region such as a gradation portion having no edge component but in a high contrast region considered suitable for phase difference detection. Thereby, highly reliable phase difference AF can be realized.

2.第2実施形態
次に、第2実施形態について説明する。なお、第1実施形態と同様の構成要素や動作・処理については適宜、説明を省略する。例えば、第2実施形態の撮像装置は図1の撮像装置と同様に構成できる。なお以下では視差方向が水平走査方向であり、右画像からコントラスト値を算出する場合を例に説明するが、視差方向は水平走査方向以外の方向であってもよいし、左画像からコントラスト値を算出してもよい。
2. Second Embodiment Next, a second embodiment will be described. Note that the description of the same components, operations, and processes as in the first embodiment will be omitted as appropriate. For example, the imaging apparatus of the second embodiment can be configured in the same manner as the imaging apparatus of FIG. In the following, the case where the parallax direction is the horizontal scanning direction and the contrast value is calculated from the right image will be described as an example, but the parallax direction may be a direction other than the horizontal scanning direction, or the contrast value may be calculated from the left image. It may be calculated.

図3に示すように、コントラスト値算出部20は、右画像に対してAF対象領域を設定し、そのAF対象領域をM×N個のサブブロックに分割する。各サブブロックは、n×m個の画素で構成される。図3には、水平走査方向であるx方向にM=10個、垂直走査方向であるy方向にN=6個のサブブロックに分割した例を示す。ここでAF対象領域は、例えば右画像内の所定領域であってもよいし、或は右画像全体であってもよい。   As shown in FIG. 3, the contrast value calculation unit 20 sets an AF target area for the right image, and divides the AF target area into M × N sub-blocks. Each sub-block is composed of n × m pixels. FIG. 3 shows an example of division into M = 10 sub-blocks in the x direction which is the horizontal scanning direction and N = 6 sub-blocks in the y direction which is the vertical scanning direction. Here, the AF target area may be, for example, a predetermined area in the right image or the entire right image.

コントラスト値算出部20は、各サブブロックについて下式(1)によりコントラスト値CTVを算出する。ここで、iはサブブロック内におけるx方向の画素位置を表し、jはサブブロック内におけるy方向の画素位置を表す。Dijは、位置(i,j)の画素での輝度値であり、下式(2)により求める。Rij、Gij、Bijは、それぞれ赤色、緑色、青色の画素値である。
The contrast value calculation unit 20 calculates the contrast value CTV for each sub-block using the following equation (1). Here, i represents the pixel position in the x direction within the sub-block, and j represents the pixel position in the y direction within the sub-block. D ij is a luminance value at the pixel at the position (i, j), and is obtained by the following equation (2). R ij , G ij , and B ij are red, green, and blue pixel values, respectively.

なおコントラスト値の算出手法は上記手法に限定されず、種々の手法を用いることが可能である。例えば、画像の高周波成分を抽出する種々のフィルタ処理(例えば1次元又は2次元のハイパスフィルタ処理やバンドパスフィルタ処理)によりコントラスト値を算出してもよいし、微分画像を求めることによりコントラスト値を算出してもよい。   The method for calculating the contrast value is not limited to the above method, and various methods can be used. For example, the contrast value may be calculated by various filter processes (for example, one-dimensional or two-dimensional high-pass filter process or band-pass filter process) that extract high-frequency components of the image, or the contrast value may be calculated by obtaining a differential image. It may be calculated.

図4に示すように、コントラスト値算出部20は、各サブブロックのコントラスト値CTVによりコントラストマップを生成する。コントラストマップは、サブブロックの位置(例えばサブブロックの中心のxy座標)とコントラスト値CTVを対応付けたデータを不図示のメモリに記憶したものである。なお図4では、コントラスト値CTVが高いサブブロックほど濃いハッチングで表している。   As shown in FIG. 4, the contrast value calculation unit 20 generates a contrast map based on the contrast value CTV of each sub-block. The contrast map is obtained by storing data in which a position of a sub block (for example, xy coordinates at the center of the sub block) and a contrast value CTV are associated with each other in a memory (not shown). In FIG. 4, sub-blocks with higher contrast values CTV are represented by darker hatching.

図5に示すように、検出位置決定部30は、コントラストマップにおいてx方向に並ぶコントラスト値の中からx方向最大値Dxmaxを検出する。図5の例では、x方向に10個のコントラスト値が並んでおり、y方向の各位置についてx方向最大値Dxmaxを求めることにより、6個のDxmaxが求められる。また検出位置決定部30は、コントラストマップにおいてy方向に並ぶコントラスト値の中からy方向最大値Dymaxを検出する。図5の例では、y方向に6個のコントラスト値が並んでおり、x方向の各位置についてy方向最大値Dymaxを求めることにより、10個のDymaxが求められる。   As illustrated in FIG. 5, the detection position determination unit 30 detects the maximum value Dxmax in the x direction from the contrast values arranged in the x direction in the contrast map. In the example of FIG. 5, ten contrast values are arranged in the x direction, and six Dxmax are obtained by obtaining the x direction maximum value Dxmax for each position in the y direction. Further, the detection position determination unit 30 detects the y-direction maximum value Dymax from the contrast values arranged in the y-direction in the contrast map. In the example of FIG. 5, six contrast values are arranged in the y direction, and ten Dymax are obtained by obtaining the y direction maximum value Dymax for each position in the x direction.

検出位置決定部30は、Dxmaxの中から最大値を検出し、その最大値に対応するy方向の位置(例えば最大値に対応するサブブロックの中心位置)を求める。また、Dymaxの中から最大値を検出し、その最大値に対応するx方向の位置(例えば最大値に対応するサブブロックの中心位置)を求める。そして、検出位置決定部30は、求めたx方向及びy方向の位置を、位相差の検出位置として出力する。   The detection position determination unit 30 detects the maximum value from Dxmax, and obtains the position in the y direction corresponding to the maximum value (for example, the center position of the sub-block corresponding to the maximum value). Further, the maximum value is detected from Dymax, and the position in the x direction corresponding to the maximum value (for example, the center position of the sub-block corresponding to the maximum value) is obtained. Then, the detection position determination unit 30 outputs the obtained positions in the x direction and the y direction as detection positions of the phase difference.

なお、上記ではコントラスト値が最大である位置を検出位置として採用する場合について説明したが、本実施形態ではこれに限定されない。例えば、コントラスト値の重心位置を検出位置として採用してもよい。   In the above description, the case where the position having the maximum contrast value is adopted as the detection position has been described. However, the present embodiment is not limited to this. For example, the barycentric position of the contrast value may be adopted as the detection position.

具体的には、図6に示すように、検出位置決定部30は下式(3)によりx方向の重心位置GPxを求め、下式(4)によりy方向の重心位置GPyを求め、位置(GPx,GPy)を位相差の検出位置として出力する。ここで、kは、x方向にM個並ぶサブブロックのナンバリングを表し、lはy方向にN個並ぶサブブロックのナンバリングを表す。Dyaddは、x方向にk番目でy方向にN個並ぶサブブロックのコントラスト値を加算した値であり、Dxaddは、y方向にl番目でx方向にM個並ぶサブブロックのコントラスト値を加算した値である。xは、x方向にk番目のサブブロックの位置(例えばサブブロックの中心位置)であり、yは、y方向にl番目のサブブロックの位置(例えばサブブロックの中心位置)である。
Specifically, as shown in FIG. 6, the detection position determination unit 30 obtains the center-of-gravity position GPx in the x direction by the following equation (3), obtains the center-of-gravity position GPy in the y-direction by the following equation (4), GPx, GPy) is output as a phase difference detection position. Here, k represents the numbering of M subblocks arranged in the x direction, and l represents the numbering of N subblocks arranged in the y direction. Dyadd k is a value obtained by adding the contrast value of the k th of N aligned sub-blocks in the y-direction in the x-direction, Dxadd l is the contrast value of the M aligned sub-blocks in the x direction in the l-th in the y-direction It is the added value. xk is the position of the kth subblock in the x direction (for example, the center position of the subblock), and yl is the position of the lth subblock in the y direction (for example, the center position of the subblock).

このようにコントラスト値の重心位置を位相差の検出位置とすることで、画像のノイズに対して強くなり、安定した位相差AFを実現することが可能となる。即ち、例えば平坦部等の実際には被写体のコントラストが低い部分でノイズにより画像のコントラスト値が局所的に高くなった場合であっても、コントラスト値の重心位置を求めることにより被写体の高コントラストな部分を位相差の検出位置として検出できる。   Thus, by setting the barycentric position of the contrast value as the phase difference detection position, it becomes strong against image noise, and it is possible to realize a stable phase difference AF. That is, even if the contrast value of the image is locally high due to noise in a portion where the contrast of the subject is actually low, such as a flat portion, the high contrast of the subject can be obtained by obtaining the center of gravity position of the contrast value. The portion can be detected as a phase difference detection position.

図7に、位相差検出部40の詳細な構成例を示す。この位相差検出部40は、読み出し位置シフト指示部200、画像取得部210(映像信号取得部)、SAD演算部220、最小値検出部230、シフト量保持部240、信頼度検出部250を含む。   FIG. 7 shows a detailed configuration example of the phase difference detection unit 40. The phase difference detection unit 40 includes a readout position shift instruction unit 200, an image acquisition unit 210 (video signal acquisition unit), a SAD calculation unit 220, a minimum value detection unit 230, a shift amount holding unit 240, and a reliability detection unit 250. .

画像取得部210は、図8に示すように、SAD演算に用いる探索画像を左画像から取得し、SAD演算に用いる参照画像を右画像から取得する。探索画像は、検出位置決定部30で決定された検出位置(xd,yd)を中心として水平走査方向(視差方向)に連続する128画素である。参照画像は、検出位置(xd,yd)を中心として水平走査方向(視差方向)に連続する64画素である。   As illustrated in FIG. 8, the image acquisition unit 210 acquires a search image used for the SAD calculation from the left image, and acquires a reference image used for the SAD calculation from the right image. The search image is 128 pixels continuous in the horizontal scanning direction (parallax direction) with the detection position (xd, yd) determined by the detection position determination unit 30 as the center. The reference image is 64 pixels continuous in the horizontal scanning direction (parallax direction) with the detection position (xd, yd) as the center.

SAD演算部220は、参照画像と探索画像から下式(5)によりSAD値を求める。ここで、sは、探索画像に対する参照画像のシフト量であり、探索画像の中心と参照画像の中心が一致する場合を基準(s=0)とする。SAD(s)は、シフト量sにおけるSAD値である。x’は、参照画像内での画素位置を表し、SPx’は、参照画像の画素位置x’での画素値を表す。x’+sは、探索画像内での画素位置を表し、参照画像と探索画像をシフト量sだけずらして重ねたときの、画素位置x’に対応する画素位置である。TPx’+sは、探索画像の画素位置x’+sでの画素値を表す。
The SAD calculation unit 220 obtains an SAD value from the reference image and the search image by the following equation (5). Here, s is a shift amount of the reference image with respect to the search image, and the case where the center of the search image matches the center of the reference image is set as a standard (s = 0). SAD (s) is the SAD value at the shift amount s. x ′ represents a pixel position in the reference image, and SP x ′ represents a pixel value at the pixel position x ′ of the reference image. x ′ + s represents a pixel position in the search image, and is a pixel position corresponding to the pixel position x ′ when the reference image and the search image are overlapped with a shift amount s. TP x ′ + s represents the pixel value at the pixel position x ′ + s of the search image.

図9に示すように、読み出し位置シフト指示部200は、シフト量sを1ずつ変化させながら出力し、SAD演算部220は、そのシフト量sでのSAD値SAD(s)を求める。最小値検出部230は、SAD(s)の最小値を検出し、シフト量保持部240は、検出された最小値のシフト量s’を保持し、そのシフト量s’を位相差として出力する。   As shown in FIG. 9, the read position shift instruction unit 200 outputs the shift amount s while changing the shift amount s by one, and the SAD operation unit 220 obtains the SAD value SAD (s) at the shift amount s. The minimum value detection unit 230 detects the minimum value of SAD (s), and the shift amount holding unit 240 holds the detected shift amount s ′ of the minimum value, and outputs the shift amount s ′ as a phase difference. .

信頼度検出部250は、SAD値カーブの谷の形状(鋭角さ)を数値化し、その数値を信頼度情報として出力する。例えば、信頼度検出部250は、SAD値の最小値SAD(s’)に対して差が2以上であるSAD値のSAD(s)を検出し、その検出したSAD(s)のシフト量sとシフト量s’との差pxn(ピクセル数)を信頼度として出力する。この場合、ピクセル数pxnが小さいほどSAD値カーブの谷の落ち方が鋭角であり、位相差s’の信頼度が高い。   The reliability detection unit 250 digitizes the valley shape (acute angle) of the SAD value curve and outputs the numerical value as reliability information. For example, the reliability detection unit 250 detects the SAD value SAD (s) having a difference of 2 or more with respect to the minimum value SAD (s ′) of the SAD value, and shift amount s of the detected SAD (s). And the difference pxn (number of pixels) between the shift amount s ′ and the shift amount s ′ are output as reliability. In this case, the smaller the number of pixels pxn, the sharper the fall of the valley of the SAD value curve, and the higher the reliability of the phase difference s ′.

AF制御部50は、映像の各フレームで検出される位相差s’に基づいて、各フレームで撮像部10のレンズ位置を位相差s’をゼロにする方向に少しずつ移動させる。具体的には、AF制御部50は、現在フレームでの位相差s’の符号がプラスの場合(例えばフォーカスの合っている位置が被写体よりも遠い場合)には、位相差s’を小さくする方向(フォーカスの合っている位置を近づける方向)にレンズ位置を所定量だけ移動させる。一方、現在フレームでの位相差s’の符号がマイナスの場合(例えばフォーカスの合っている位置が被写体よりも近い場合)には、位相差s’を大きくする方向(フォーカスの合っている位置を遠ざける方向)にレンズ位置を所定量だけ移動させる。そして、複数フレームをかけて、位相差s’がゼロとなるようにレンズ位置を制御する。この動作において、AF制御部50は、信頼度情報が表す信頼度が所定信頼度より低い(例えばピクセル数pxnが所定値より大きい)場合には、そのフレームでのレンズ位置移動を行わない。   The AF control unit 50 gradually moves the lens position of the imaging unit 10 in each frame in a direction in which the phase difference s ′ is zero based on the phase difference s ′ detected in each frame of the video. Specifically, the AF control unit 50 decreases the phase difference s ′ when the sign of the phase difference s ′ in the current frame is positive (for example, when the focused position is far from the subject). Move the lens position by a predetermined amount in the direction (the direction to bring the focused position closer). On the other hand, when the sign of the phase difference s ′ in the current frame is negative (for example, when the in-focus position is closer to the subject), the direction in which the phase difference s ′ is increased (the in-focus position is changed). The lens position is moved by a predetermined amount in the direction of moving away. Then, the lens position is controlled so that the phase difference s ′ becomes zero over a plurality of frames. In this operation, if the reliability represented by the reliability information is lower than the predetermined reliability (for example, the number of pixels pxn is larger than the predetermined value), the AF control unit 50 does not move the lens position in that frame.

このようにすれば、位相差AFの誤動作を抑制し、突然ピントがずれるような不自然な映像を表示させないようにできる。即ち、1回のレンズ移動で位相差s’をゼロにするようなAF制御を行った場合、位相差s’が誤検出されると、被写体にピントが合わないレンズ位置に間違って移動させる可能性がある。この点、本実施形態によれば、所定値ずつ複数フレームをかけてレンズを移動させるため、仮に位相差s’の誤検出があった場合であっても、少ししかレンズが移動せず、誤検出の影響を最小限にとどめることが可能である。   In this way, it is possible to suppress malfunction of phase difference AF and prevent an unnatural image that is suddenly out of focus from being displayed. In other words, when AF control is performed such that the phase difference s ′ is set to zero by one lens movement, if the phase difference s ′ is erroneously detected, the lens can be moved erroneously to a lens position where the subject is not in focus. There is sex. In this regard, according to the present embodiment, since the lens is moved over a plurality of frames by a predetermined value, even if there is an erroneous detection of the phase difference s ′, the lens moves only a little, and an error occurs. It is possible to minimize the influence of detection.

図10に、第2実施形態の撮像装置が行うAF制御処理のフローチャートを示す。図10に示すように、まず撮像部10が、視差画像(右画像、左画像)のRGB画素値データを取得する(ステップS20)。   FIG. 10 shows a flowchart of AF control processing performed by the imaging apparatus according to the second embodiment. As shown in FIG. 10, the imaging unit 10 first acquires RGB pixel value data of a parallax image (right image, left image) (step S20).

次に、コントラスト値算出部20が、視差画像のRGB画素値データを輝度値データに変換する(ステップS21)。次に、コントラスト値算出部20が、視差画像の少なくとも一方(例えば右画像)の輝度値データから各サブブロックのコントラスト値を算出する(ステップS22)。   Next, the contrast value calculation unit 20 converts the RGB pixel value data of the parallax image into luminance value data (step S21). Next, the contrast value calculation unit 20 calculates the contrast value of each sub-block from the luminance value data of at least one of the parallax images (for example, the right image) (step S22).

次に、検出位置決定部30が、コントラスト値のy方向最大値Dymaxを算出し、そのDymaxのうちの最大値を、x方向での最大値として検出し、そのx方向での最大値に対応するサブブロックのx位置を位相差の検出位置のx位置として出力する(ステップS23)。次に、検出位置決定部30が、コントラスト値のx方向最大値Dxmaxを算出し、そのDxmaxのうちの最大値を、y方向での最大値として検出し、そのy方向での最大値に対応するサブブロックのy位置を位相差の検出位置のy位置として出力する(ステップS24)。   Next, the detection position determination unit 30 calculates the maximum y-direction value Dymax of the contrast value, detects the maximum value of the Dymax as the maximum value in the x-direction, and corresponds to the maximum value in the x-direction. The x position of the sub block to be output is output as the x position of the phase difference detection position (step S23). Next, the detection position determination unit 30 calculates the maximum value Dxmax of the contrast value in the x direction, detects the maximum value of the Dxmax as the maximum value in the y direction, and corresponds to the maximum value in the y direction. The y position of the sub-block to be output is output as the y position of the phase difference detection position (step S24).

次に、位相差検出部40が、位相差の検出位置に基づいて左画像から探索画像(検出位置を中心とする128画素)を取得する(ステップS25)。次に、位相差検出部40が、位相差の検出位置に基づいて右画像から参照画像(検出位置を中心とする64画素)を取得する(ステップS26)。次に、位相差検出部40が、探索画像の読み出し開始位置(シフト量s)をシフトしながら、SAD値SAD(s)を算出し、SAD(s)が最小となるシフト量sを位相差s’として検出する(ステップS27)。   Next, the phase difference detection unit 40 acquires a search image (128 pixels centered on the detection position) from the left image based on the detection position of the phase difference (step S25). Next, the phase difference detection unit 40 acquires a reference image (64 pixels centered on the detection position) from the right image based on the detection position of the phase difference (step S26). Next, the phase difference detection unit 40 calculates the SAD value SAD (s) while shifting the read start position (shift amount s) of the search image, and calculates the shift amount s that minimizes SAD (s) as the phase difference. It detects as s' (step S27).

次に、AF制御部50が、位相差s’の符号がプラスの場合には、位相差s’を小さくする方向にレンズ位置を所定量だけ移動させ、位相差s’の符号がマイナスの場合には、位相差s’を大きくする方向にレンズ位置を所定量だけ移動させる(ステップS28)。   Next, when the sign of the phase difference s ′ is positive, the AF control unit 50 moves the lens position by a predetermined amount in the direction of decreasing the phase difference s ′, and the sign of the phase difference s ′ is negative. In order to increase the phase difference s ′, the lens position is moved by a predetermined amount (step S28).

以上の実施形態によれば、コントラスト値算出部20は、AF対象領域(オートフォーカス対象領域)のコントラストマップを生成する。検出位置決定部30は、そのコントラストマップにおけるコントラスト値CTVの最大値を検出し、その最大値に対応する位置を相対的に高コントラスト値である位置として検出する。或は、検出位置決定部30は、コントラストマップにおけるコントラスト値CTVの重心位置を求め、その重心位置を相対的に高コントラスト値である位置として検出する。   According to the above embodiment, the contrast value calculation unit 20 generates a contrast map of the AF target area (autofocus target area). The detection position determination unit 30 detects the maximum value of the contrast value CTV in the contrast map, and detects a position corresponding to the maximum value as a position having a relatively high contrast value. Alternatively, the detection position determination unit 30 obtains the centroid position of the contrast value CTV in the contrast map, and detects the centroid position as a position having a relatively high contrast value.

このようにすれば、AF対象領域において相対的に高コントラスト値である位置を検出でき、その相対的に高コントラスト値である位置を、視差画像の位相差を検出する検出位置として決定することができる。   In this way, a position having a relatively high contrast value can be detected in the AF target area, and the position having the relatively high contrast value can be determined as a detection position for detecting the phase difference of the parallax image. it can.

また本実施形態では、撮像部10は、視差画像を動画像として撮像する。位相差検出部40は、その動画像の各フレームについて位相差s’を検出する。AF制御部50(フォーカス制御部)は、撮像部10のフォーカスが合っている位置と被写体との遠近関係を位相差s’に基づいて判断し、その判断の結果に基づいて、撮像部10のフォーカスが合っている位置を被写体に近づける方向に撮像部10のフォーカスレンズを所定量だけ移動させる制御を行う。そして、その所定量だけ移動させる制御を各フレームで繰り返すことにより被写体にフォーカスを合わせる。   In the present embodiment, the imaging unit 10 captures a parallax image as a moving image. The phase difference detection unit 40 detects the phase difference s ′ for each frame of the moving image. The AF control unit 50 (focus control unit) determines the perspective relationship between the in-focus position of the imaging unit 10 and the subject based on the phase difference s ′, and based on the determination result, the AF control unit 50 (focus control unit). Control is performed to move the focus lens of the imaging unit 10 by a predetermined amount in a direction in which the in-focus position approaches the subject. Then, the subject is focused by repeating the control of moving by the predetermined amount in each frame.

このようにすれば、上述したように、位相差AFの誤動作を抑制し、突然ピントがずれるような不自然な映像を表示させないようにできる。   In this way, as described above, it is possible to suppress the malfunction of the phase difference AF and prevent the display of an unnatural image that is suddenly out of focus.

3.第3実施形態
次に、第3実施形態について説明する。なお、第1、第2実施形態と同様の構成要素や動作・処理については適宜、説明を省略する。
3. Third Embodiment Next, a third embodiment will be described. Note that description of components, operations, and processes similar to those in the first and second embodiments is omitted as appropriate.

図11に、第3実施形態における撮像装置の構成例を示す。この撮像装置は、撮像部10、コントラスト値算出部20、検出位置決定部30、位相差検出部40、AF制御部50、レンズ駆動部60、位相差選択部70、表示制御部80を含む。   FIG. 11 shows a configuration example of the imaging apparatus in the third embodiment. The imaging apparatus includes an imaging unit 10, a contrast value calculation unit 20, a detection position determination unit 30, a phase difference detection unit 40, an AF control unit 50, a lens driving unit 60, a phase difference selection unit 70, and a display control unit 80.

図12に示すように、コントラスト値算出部20は、AF対象領域を複数(a個)のブロックBL1〜BL6に分割する。図12には、a=2×3のブロックに分割する例を示す。各ブロックは、M×N個のサブブロックに分割され、各サブブロックはn×m画素で構成される。コントラスト値算出部20は、各ブロックについてコントラストマップを生成し、そのコントラストマップを検出位置決定部30に出力する。   As shown in FIG. 12, the contrast value calculation unit 20 divides the AF target area into a plurality (a) of blocks BL1 to BL6. FIG. 12 shows an example of division into a = 2 × 3 blocks. Each block is divided into M × N sub-blocks, and each sub-block is composed of n × m pixels. The contrast value calculation unit 20 generates a contrast map for each block and outputs the contrast map to the detection position determination unit 30.

検出位置決定部30は、コントラストマップに基づいて各ブロックについて位相差の検出位置を決定する。検出位置決定部30は、下式(6)により各ブロックについてy方向最大値Dymaxの分散値YDSを求め、その分散値YDSが小さい順に検出位置をソーティングする。ここで、kは、x方向にM個並ぶサブブロックのナンバリングを表す。Dymaxは、x方向にk番目でy方向にN個並ぶサブブロックのコントラスト値のうちの最大値である。
The detection position determination unit 30 determines the detection position of the phase difference for each block based on the contrast map. The detection position determination unit 30 obtains the variance value YDS of the maximum value Dymax in the y direction for each block by the following equation (6), and sorts the detection positions in ascending order of the variance value YDS. Here, k represents the numbering of M sub-blocks arranged in the x direction. Dymax k is the maximum value among the contrast values of the k sub blocks arranged in the x direction and N sub blocks arranged in the y direction.

検出位置決定部30は、分散値YDSが小さい方から順に複数(b個、b<a)の検出位置を選択し、位相差検出部40に出力する。図11には、b=3の検出位置を出力する例を示す。   The detection position determination unit 30 selects a plurality (b, b <a) of detection positions in order from the smallest variance value YDS, and outputs it to the phase difference detection unit 40. FIG. 11 shows an example of outputting a detection position of b = 3.

分散値YDSが小さいほどy方向最大値Dymaxの分布ばらつきが小さいので、位相差検出に適したブロックである可能性が高い。例えば、同じような形状が繰り返し並ぶ領域や、高ノイズの領域では、コントラスト値の山が複数並び、分散値YDSが大きいと考えられる。そのため、分散値YDSが小さい順にソーティングすることで、位相差検出により適した検出位置を選択することが可能となる。   The smaller the variance value YDS, the smaller the distribution variation of the y-direction maximum value Dymax, so there is a high possibility that the block is suitable for phase difference detection. For example, in a region where similar shapes are repeatedly arranged or in a high noise region, it is considered that a plurality of contrast value peaks are arranged and the variance value YDS is large. Therefore, it is possible to select a detection position that is more suitable for phase difference detection by sorting in order of increasing dispersion value YDS.

なお上記では分散値YDSが小さい順にソーティングする場合について説明したが、本実施形態ではこれに限定されない。例えば、分散値YDSの逆数とコントラスト値の最大値とを重み付け係数を掛けて加算し、その加算値が大きい順にソーティングし、加算値が大きい方から順に複数の検出位置を選択してもよい。   Although the case where sorting is performed in ascending order of the variance value YDS has been described above, the present embodiment is not limited to this. For example, the reciprocal of the variance value YDS and the maximum value of the contrast value may be added by multiplying by a weighting coefficient, sorted in descending order of the added value, and a plurality of detection positions may be selected in descending order of the added value.

位相差検出部40は、第1〜第3の検出部41〜43を含む。検出部41〜43には、検出位置決定部30で選択された3つの検出位置が1つずつ入力される。検出部41〜43は、入力された検出位置について位相差と信頼度を求め、その位相差と信頼度を位相差選択部70に出力する。   The phase difference detection unit 40 includes first to third detection units 41 to 43. Three detection positions selected by the detection position determination unit 30 are input to the detection units 41 to 43 one by one. The detectors 41 to 43 obtain a phase difference and reliability for the input detection position, and output the phase difference and reliability to the phase difference selector 70.

位相差選択部70は、3つの位相差の中から信頼度が最も高い位相差を選択し、その位相差をAF制御部50に出力する。   The phase difference selection unit 70 selects the phase difference having the highest reliability from the three phase differences and outputs the phase difference to the AF control unit 50.

なお上記では信頼度に基づいて自動的にフォーカス制御用の位相差を選択する場合について説明したが、本実施形態ではこれに限定されない。例えば、ユーザからの選択指示に基づいてフォーカス制御用の位相差を選択してもよい。具体的には、位相差選択部70は、位相差検出部40からの3つの位相差に対応する検出位置の情報を表示制御部80に出力する。図13に示すように、表示制御部80は、その3つの検出位置を表す表示AP1〜AP3(例えば矩形枠)を表示画像に重畳し、不図示の表示部に表示させる制御を行う。そして、不図示の操作部を介してユーザが検出位置を選択し、その選択された検出位置の位相差を位相差選択部70がAF制御部50に出力する。   In the above description, the case where the phase difference for focus control is automatically selected based on the reliability has been described. However, the present embodiment is not limited to this. For example, the phase difference for focus control may be selected based on a selection instruction from the user. Specifically, the phase difference selection unit 70 outputs information on detection positions corresponding to the three phase differences from the phase difference detection unit 40 to the display control unit 80. As illustrated in FIG. 13, the display control unit 80 performs control to superimpose display AP <b> 1 to AP <b> 3 (for example, a rectangular frame) representing the three detection positions on a display image and display the display image on a display unit (not illustrated). Then, the user selects a detection position via an operation unit (not shown), and the phase difference selection unit 70 outputs the phase difference of the selected detection position to the AF control unit 50.

このようにユーザ指示に基づいて検出位置を決定することで、ユーザが所望しない位置にオートフォーカスされることを防ぐことができる。また、分散値YDSが小さい順に複数の候補位置を表示させることで、位相差を高信頼度に検出できる候補の中からユーザが所望する適切な場所を選択することが可能になる。   By determining the detection position based on the user instruction in this way, it is possible to prevent autofocusing to a position not desired by the user. Further, by displaying a plurality of candidate positions in ascending order of the variance value YDS, it is possible to select an appropriate location desired by the user from candidates that can detect the phase difference with high reliability.

図14に、第3実施形態の撮像装置が行うAF制御処理のフローチャートを示す。図14に示すように、まず撮像部10が、視差画像(右画像、左画像)のRGB画素値データを取得する(ステップS40)。   FIG. 14 shows a flowchart of AF control processing performed by the imaging apparatus of the third embodiment. As shown in FIG. 14, first, the imaging unit 10 acquires RGB pixel value data of a parallax image (right image, left image) (step S40).

次に、コントラスト値算出部20が、視差画像のRGB画素値データを輝度値データに変換する(ステップS41)。次に、コントラスト値算出部20が、視差画像の少なくとも一方(例えば右画像)に複数のブロックBL1〜BL6を設定し、その複数のブロックBL1〜BL6のうち選択したブロックについて、各サブブロックのコントラスト値を輝度データから算出する(ステップS42)。   Next, the contrast value calculation unit 20 converts the RGB pixel value data of the parallax image into luminance value data (step S41). Next, the contrast value calculation unit 20 sets a plurality of blocks BL1 to BL6 in at least one of the parallax images (for example, the right image), and the contrast of each sub-block for the selected block among the plurality of blocks BL1 to BL6. A value is calculated from the luminance data (step S42).

次に、検出位置決定部30が、コントラスト値のy方向最大値Dymaxを算出し、そのDymaxのうちの最大値を、x方向での最大値として検出し、そのx方向での最大値に対応するサブブロックのx位置を位相差の検出位置のx位置として求める。また、分散値YDSを算出する(ステップS43)。次に、検出位置決定部30が、コントラスト値のx方向最大値Dxmaxを算出し、そのDxmaxのうちの最大値を、y方向での最大値として検出し、そのy方向での最大値に対応するサブブロックのy位置を位相差の検出位置のy位置として求める(ステップS44)。   Next, the detection position determination unit 30 calculates the maximum y-direction value Dymax of the contrast value, detects the maximum value of the Dymax as the maximum value in the x-direction, and corresponds to the maximum value in the x-direction. The x position of the sub block to be calculated is obtained as the x position of the phase difference detection position. Further, the variance value YDS is calculated (step S43). Next, the detection position determination unit 30 calculates the maximum value Dxmax of the contrast value in the x direction, detects the maximum value of the Dxmax as the maximum value in the y direction, and corresponds to the maximum value in the y direction. The y position of the sub-block to be obtained is obtained as the y position of the phase difference detection position (step S44).

次に、検出位置決定部30が、複数のブロックBL1〜BL6の全てについて位相差の検出位置と分散値YDSを求めたか否かを判断する(ステップS45)。位相差の検出位置と分散値YDSを求めていないブロックが存在する場合には、コントラスト値算出部20が、新たにブロックを選択し、ステップS42を再び実行する。全てのブロックについて位相差の検出位置と分散値YDSを求めていた場合には、検出位置決定部30が、複数のブロックBL1〜BL6の分散値YDSを小さい順にソーティングし、分散値YDSが小さい順に複数の検出位置を出力する(ステップS46)。   Next, the detection position determination unit 30 determines whether or not the phase difference detection position and the dispersion value YDS have been obtained for all of the plurality of blocks BL1 to BL6 (step S45). When there is a block for which the phase difference detection position and the variance value YDS are not obtained, the contrast value calculation unit 20 newly selects a block and executes step S42 again. When the phase difference detection position and the dispersion value YDS are obtained for all the blocks, the detection position determining unit 30 sorts the dispersion values YDS of the plurality of blocks BL1 to BL6 in ascending order, and the dispersion value YDS is in ascending order. A plurality of detection positions are output (step S46).

次に、位相差検出部40が、複数の検出位置から1つの検出位置を選択し、その選択した検出位置について左画像から探索画像(検出位置を中心とする128画素)を取得する(ステップS47)。次に、位相差検出部40が、選択した検出位置について右画像から参照画像(検出位置を中心とする64画素)を取得する(ステップS48)。次に、位相差検出部40が、探索画像の読み出し開始位置(シフト量s)をシフトしながら、SAD値SAD(s)を算出し、SAD(s)が最小となるシフト量sを位相差s’として検出する。また位相差検出部40が、SAD(s)のカーブ形状から信頼度を求める(ステップS49)。   Next, the phase difference detection unit 40 selects one detection position from a plurality of detection positions, and acquires a search image (128 pixels centered on the detection position) from the left image for the selected detection position (step S47). ). Next, the phase difference detection unit 40 acquires a reference image (64 pixels centered on the detection position) from the right image for the selected detection position (step S48). Next, the phase difference detection unit 40 calculates the SAD value SAD (s) while shifting the read start position (shift amount s) of the search image, and calculates the shift amount s that minimizes SAD (s) as the phase difference. Detect as s'. Further, the phase difference detection unit 40 obtains the reliability from the curve shape of SAD (s) (step S49).

次に、位相差検出部40が、ステップS46で出力された複数の検出位置の全てについて位相差と信頼度を求めたか否かを判断する(ステップS50)。位相差と信頼度を求めていない検出位置が存在する場合には、位相差検出部40が再びステップS47を実行する。全ての検出位置について位相差と信頼度を求めていた場合には、位相差選択部70が、複数の位相差の中から最も信頼度が高い1つの位相差を選択し、AF制御部50に出力する(ステップS51)。   Next, the phase difference detection unit 40 determines whether or not the phase difference and the reliability have been obtained for all of the plurality of detection positions output in step S46 (step S50). If there is a detection position for which the phase difference and the reliability are not obtained, the phase difference detection unit 40 executes step S47 again. When the phase difference and the reliability are obtained for all the detection positions, the phase difference selecting unit 70 selects one phase difference having the highest reliability from the plurality of phase differences, and sends it to the AF control unit 50. Output (step S51).

次に、AF制御部50が、位相差の符号がプラスの場合には、位相差を小さくする方向にレンズ位置を所定量だけ移動させ、位相差の符号がマイナスの場合には、位相差を大きくする方向にレンズ位置を所定量だけ移動させる(ステップS52)。   Next, when the sign of the phase difference is positive, the AF control unit 50 moves the lens position by a predetermined amount in the direction of decreasing the phase difference. When the sign of the phase difference is negative, the AF control unit 50 sets the phase difference. The lens position is moved by a predetermined amount in the increasing direction (step S52).

以上の実施形態によれば、検出位置決定部30は、視差画像のうち少なくとも一方の画像(本実施形態の例では右画像)に複数の領域BL1〜BL6を設定し、その複数の領域BL1〜BL6ごとの(各領域での)コントラスト値に基づいて、複数の領域BL1〜BL6ごとの検出位置を決定する。位相差検出部40は、その複数の検出位置ごとの複数の位相差s’を検出する。位相差選択部70は、その複数の位相差s’の中からフォーカス制御に用いる位相差を選択する。   According to the above embodiment, the detection position determination unit 30 sets a plurality of regions BL1 to BL6 in at least one of the parallax images (the right image in the example of the present embodiment), and the plurality of regions BL1 to BL1. Based on the contrast value (in each region) for each BL6, the detection position for each of the plurality of regions BL1 to BL6 is determined. The phase difference detection unit 40 detects a plurality of phase differences s ′ for each of the plurality of detection positions. The phase difference selector 70 selects a phase difference used for focus control from among the plurality of phase differences s ′.

このようにすれば、位相差の検出位置の候補として複数の位置を決定し、その複数の候補の中から位相差検出により適した検出位置を選択することが可能になる。これにより、位相差が検出不可となる可能性や、位相差の誤検出可能性を低下させることが可能となり、より安定的な位相差AFを実現できる。例えば、視差が大きい場合には、複数の領域BL1〜BL6のうち幾つかの領域において右画像と左画像に同一被写体が写らない可能性がある。このような場合であっても、各領域で検出位置を決定し、その中から適切な検出位置を選択できるため、位相差の検出が可能となる。   In this way, it is possible to determine a plurality of positions as candidates for the detection position of the phase difference and select a detection position more suitable for the phase difference detection from the plurality of candidates. As a result, the possibility that the phase difference cannot be detected and the possibility of erroneous detection of the phase difference can be reduced, and a more stable phase difference AF can be realized. For example, when the parallax is large, there is a possibility that the same subject is not captured in the right image and the left image in some of the plurality of regions BL1 to BL6. Even in such a case, a detection position can be determined in each region, and an appropriate detection position can be selected from among the detection positions, so that a phase difference can be detected.

また本実施形態では、検出位置決定部30は、複数の領域BL1〜BL6としてa個(本実施形態の例ではa=6)の領域を設定し、そのa個の領域の各領域におけるコントラスト値の分散値YDSを算出し、そのa個の領域のうち分散値YDSが小さい方からb個の領域(b<a、本実施形態の例ではb=3)を選択する。位相差検出部40は、そのb個の領域での検出位置に対応するb個の位相差を相関演算により算出する。   Further, in the present embodiment, the detection position determination unit 30 sets a region (a = 6 in the example of the present embodiment) as the plurality of regions BL1 to BL6, and the contrast value in each region of the a regions. The variance value YDS is calculated, and b regions (b <a, b = 3 in the example of the present embodiment) are selected from the a regions having the smallest variance value YDS. The phase difference detection unit 40 calculates b phase differences corresponding to the detection positions in the b regions by correlation calculation.

このようにすれば、位相差検出により適していると考えられる高分散値の検出位置だけ相関演算を行うことができ、位相差検出に適さない低分散値の検出位置について無駄な相関演算を省略できる。これにより、位相差検出部の回路規模縮小や演算時間の短縮を実現することが可能である。   In this way, correlation calculation can be performed only for detection positions with high dispersion values that are considered more suitable for phase difference detection, and useless correlation calculation is omitted for detection positions with low dispersion values that are not suitable for phase difference detection. it can. As a result, it is possible to reduce the circuit scale of the phase difference detection unit and the calculation time.

また本実施形態では、撮像装置は、複数の検出位置を表す情報AP1〜AP3を視差画像のうち少なくとも一方の画像(例えば第4実施形態のような3D画像や、或は右画像及び左画像の一方など)に重畳して表示部に表示する制御を行う表示制御部80を備える。位相差選択部70は、複数の検出位置のうち、ユーザにより選択された検出位置に対応する位相差をフォーカス制御に用いる位相差として選択する。   In the present embodiment, the imaging apparatus uses information AP1 to AP3 representing a plurality of detection positions as at least one of parallax images (for example, a 3D image as in the fourth embodiment, or a right image and a left image). And a display control unit 80 that performs control to display on the display unit. The phase difference selection unit 70 selects a phase difference corresponding to the detection position selected by the user from among a plurality of detection positions as a phase difference used for focus control.

このようにすれば、上述したように、ユーザ指示に基づいて検出位置を決定することで、ユーザが所望しない位置にオートフォーカスされることを防ぐことができる。   In this way, as described above, by determining the detection position based on the user instruction, it is possible to prevent the user from being autofocused at a position not desired by the user.

4.第4実施形態
次に、第4実施形態について説明する。なお、第1〜第3実施形態と同様の構成要素や動作・処理については適宜、説明を省略する。
4). Fourth Embodiment Next, a fourth embodiment will be described. Note that description of the same components, operations, and processes as those in the first to third embodiments will be omitted as appropriate.

図15に、第4実施形態における撮像装置の第1構成例を示す。この撮像装置は、撮像部10、検出位置決定部30、位相差検出部40、AF制御部50、レンズ駆動部60、コントラストマップ生成部100、3D化回路110、3D表示モニタ120を含む。   FIG. 15 shows a first configuration example of the imaging apparatus according to the fourth embodiment. The imaging apparatus includes an imaging unit 10, a detection position determination unit 30, a phase difference detection unit 40, an AF control unit 50, a lens driving unit 60, a contrast map generation unit 100, a 3D conversion circuit 110, and a 3D display monitor 120.

図16に、第4実施形態における撮像装置の第2構成例を示す。この撮像装置は、撮像部10、検出位置決定部30、位相差検出部40、AF制御部50、レンズ駆動部60、位相差選択部70、コントラストマップ生成部100、3D化回路110、3D表示モニタ120、文字重畳回路130、操作部150を含む。   FIG. 16 shows a second configuration example of the imaging apparatus according to the fourth embodiment. The imaging apparatus includes an imaging unit 10, a detection position determination unit 30, a phase difference detection unit 40, an AF control unit 50, a lens driving unit 60, a phase difference selection unit 70, a contrast map generation unit 100, a 3D conversion circuit 110, and a 3D display. A monitor 120, a character superimposing circuit 130, and an operation unit 150 are included.

コントラストマップ生成部100は、第2実施形態等で説明した手法と同様にして、右画像の輝度値からコントラストマップを生成し、そのコントラストマップを検出位置決定部30に出力する。   The contrast map generation unit 100 generates a contrast map from the luminance value of the right image and outputs the contrast map to the detection position determination unit 30 in the same manner as described in the second embodiment.

3D化回路110は、左画像と右画像に対して水平操作方向の位置調整を行い、その位置調整後の左画像と右画像を交互に切り替えて出力する。   The 3D conversion circuit 110 adjusts the position in the horizontal operation direction with respect to the left image and the right image, and alternately switches the left image and the right image after the position adjustment to output them.

3D表示モニタ120は、3D化回路110から交互に出力される左画像と右画像を表示する。3D表示モニタ120は、偏光メガネや液晶シャッタメガネ等の専用メガネをかけることで左画像(左視点画像)と右画像(右視点画像)とを個別に見ることができる表示装置である。なお、3D表示モニタ120は、立体視画像(左視点画像及び右視点画像)をパララックスバリアによりそれぞれ所定の指向性をもった指向性画像として表示できる立体表示装置や、レンチキュラレンズを使用する立体表示装置であってもよい。   The 3D display monitor 120 displays the left image and the right image that are alternately output from the 3D conversion circuit 110. The 3D display monitor 120 is a display device that can individually view a left image (left viewpoint image) and a right image (right viewpoint image) by wearing dedicated glasses such as polarized glasses and liquid crystal shutter glasses. The 3D display monitor 120 is a stereoscopic display device that can display a stereoscopic image (left viewpoint image and right viewpoint image) as a directional image having a predetermined directivity by a parallax barrier, or a stereoscopic display that uses a lenticular lens. It may be a display device.

文字重畳回路130は、3D化回路110から出力される画像に対して、位相差選択部70から出力される複数の検出位置を表す表示を、3D化回路110から出力される画像に対して重畳し、その重畳後の画像を3D表示モニタ120に出力する。   The character superimposing circuit 130 superimposes a display representing a plurality of detection positions output from the phase difference selecting unit 70 on the image output from the 3D conversion circuit 110 on the image output from the 3D conversion circuit 110. Then, the superimposed image is output to the 3D display monitor 120.

操作部150は、3D表示モニタ120に表示された複数の検出位置の中から、フォーカスを合わせる検出位置を選択する操作を行うための操作部である。例えば、操作部150は、マウスやボタン、タッチパネル等により構成できる。   The operation unit 150 is an operation unit for performing an operation of selecting a detection position to be focused from among a plurality of detection positions displayed on the 3D display monitor 120. For example, the operation unit 150 can be configured by a mouse, a button, a touch panel, or the like.

図17に、撮像部10の詳細な構成例を示す。撮像部10は、フォーカスレンズLN1と、左右一対のズーム光学系LN2、LN3と、左右一対の結像レンズLN4、LN5と、左右一対の撮像素子IS1、IS2と、左右一対の撮像制御部CU1、CU2(カメラコントロールユニット)と、を含む。撮像素子IS1、IS2は、CCD(Charge-Coupled Device)やCMOS(Complementary Metal-Oxide Semiconductor)イメージセンサにより構成され、例えばベイヤ配列のRGB撮像素子等の一般的な撮像素子を用いることができる。   FIG. 17 shows a detailed configuration example of the imaging unit 10. The imaging unit 10 includes a focus lens LN1, a pair of left and right zoom optical systems LN2 and LN3, a pair of left and right imaging lenses LN4 and LN5, a pair of left and right imaging elements IS1 and IS2, and a pair of left and right imaging control units CU1. CU2 (camera control unit). The imaging elements IS1 and IS2 are constituted by a CCD (Charge-Coupled Device) or a CMOS (Complementary Metal-Oxide Semiconductor) image sensor. For example, a general imaging element such as a Bayer array RGB imaging element can be used.

フォーカスレンズLN1、ズーム光学系LN2、LN3、結像レンズLN4、LN5により被写体像が撮像素子IS1、IS2に結像され、その結像された被写体像を撮像素子IS1、IS2が撮像する。撮像制御部CU1、CU2は、撮像素子IS1、IS2からの画像信号に対して、オフセット処理や、ホワイトバランス補正、感度補正を含むゲイン・コントロール処理、ガンマ補正処理、同時化処理、YC処理、シャープネス補正処理等の画像処理を行う。撮像制御部CU1、CU2は、画像処理後の画像を右画像、左画像として出力する。   A subject image is formed on the imaging elements IS1 and IS2 by the focus lens LN1, the zoom optical systems LN2 and LN3, and the imaging lenses LN4 and LN5, and the imaged subject images are captured by the imaging elements IS1 and IS2. The imaging control units CU1 and CU2 perform offset processing, white balance correction, gain control processing including sensitivity correction, gamma correction processing, synchronization processing, YC processing, sharpness on the image signals from the imaging elements IS1 and IS2. Image processing such as correction processing is performed. The imaging control units CU1 and CU2 output the image-processed images as a right image and a left image.

このような撮像部10では、ズーム倍率に関わらず、ピント状態に応じて結像位置の変位が生じる。即ち、ピントが被写体よりも前側の場合には、左画像の結像に対して右画像の結像が左側にシフトし、ピントが被写体よりも前側に移動するほどシフト量が大きくなる。一方、ピントが被写体よりも後側の場合には、左画像の結像に対して右画像の結像が右側にシフトし、ピントが被写体よりも後側に移動するほどシフト量が大きくなる。被写体にピントが合っている場合には右画像と左画像の結像位置は同じである。   In such an imaging unit 10, the imaging position is displaced according to the focus state regardless of the zoom magnification. That is, when the focus is in front of the subject, the right image is shifted to the left with respect to the left image, and the shift amount increases as the focus moves to the front. On the other hand, when the focus is behind the subject, the right image is shifted to the right with respect to the left image, and the shift amount increases as the focus moves rearward from the subject. When the subject is in focus, the right image and the left image have the same imaging position.

上記のような撮像装置は、例えば脳外科用の双眼顕微鏡等に適用することが想定される。脳外科用の双眼顕微鏡では、奥行き数cm程度の比較的狭い範囲内でピント調整できればよいため、右画像と左画像の視差が比較的小さいことが予想される。例えば、奥行き数cm内の手前側にピントがある場合に、奥行き数cm内の奥側にオートフォーカスしたいとする。このような場合であっても、奥側の被写体の視差はそれほど大きくならないため、右画像と左画像には、ほぼ同じ被写体領域が写っていると考えられる。   The imaging apparatus as described above is assumed to be applied to, for example, a binocular microscope for brain surgery. In a binocular microscope for brain surgery, it is only necessary to adjust the focus within a relatively narrow range of about several centimeters in depth, and therefore, the parallax between the right image and the left image is expected to be relatively small. For example, when there is a focus on the near side within a few centimeters of depth, suppose that it is desired to perform autofocus on the far side within a few centimeters of depth. Even in such a case, since the parallax of the subject on the back side does not increase so much, it is considered that almost the same subject area is shown in the right image and the left image.

位相差AFでは位相差の検出位置において右画像と左画像に同じ被写体が写っている必要があるが、視差が大きくない場合には、画像内の任意の位置を検出位置として選んだとしても、その位置において右画像と左画像に同じ被写体が写っている可能性が非常に高いと考えられる。そのため、本実施形態のようにコントラスト値が高い位置を画像内の任意の位置から選んだとしても、その任意の位置で位相差を検出することが可能であり、コントラスト値が高い位置で位相差AFを行うため、高品質な位相差AFを実現可能である。このように、本実施形態は、脳外科用の双眼顕微鏡等に適用した場合に非常に有効であると期待される。   In phase difference AF, the same subject needs to appear in the right image and the left image at the phase difference detection position, but if the parallax is not large, even if an arbitrary position in the image is selected as the detection position, It is very likely that the same subject appears in the right image and the left image at that position. Therefore, even if a position with a high contrast value is selected from an arbitrary position in the image as in this embodiment, it is possible to detect a phase difference at the arbitrary position, and a phase difference at a position with a high contrast value. Since AF is performed, high-quality phase difference AF can be realized. Thus, this embodiment is expected to be very effective when applied to a binocular microscope for brain surgery.

なお、本実施形態は脳外科用の双眼顕微鏡等に限定されず、例えば一般的な双眼カメラや双眼ビデオカメラ等にも適用できる。   The present embodiment is not limited to a binocular microscope for brain surgery or the like, and can be applied to, for example, a general binocular camera or a binocular video camera.

ここで、上記のように本実施形態について詳細に説明したが、本発明の新規事項および効果から実体的に逸脱しない多くの変形が可能であることは当業者には容易に理解できるであろう。従って、このような変形例はすべて本発明の範囲に含まれるものとする。例えば、明細書又は図面において、少なくとも一度、より広義又は同義な異なる用語と共に記載された用語は、明細書又は図面のいかなる箇所においても、その異なる用語に置き換えることができる。また撮像部、位相差検出部、撮像装置等の構成、動作や、コントラスト値算出手法、検出位置決定手法、位相差検出手法、AF制御手法等は、本実施形態で説明したものに限定されず、種々の変形実施が可能である。   Although the present embodiment has been described in detail as described above, it will be readily understood by those skilled in the art that many modifications can be made without departing from the novel matters and effects of the present invention. . Accordingly, all such modifications are intended to be included in the scope of the present invention. For example, a term described with a different term having a broader meaning or the same meaning at least once in the specification or the drawings can be replaced with the different term in any part of the specification or the drawings. In addition, the configuration, operation, contrast value calculation method, detection position determination method, phase difference detection method, AF control method, and the like of the imaging unit, the phase difference detection unit, and the imaging device are not limited to those described in this embodiment. Various modifications are possible.

10 撮像部、20 コントラスト値算出部、30 検出位置決定部、
40 位相差検出部、41〜43 検出部、
50 AF制御部(フォーカス制御部)、60 レンズ駆動部、
70 位相差選択部、80 表示制御部、
100 コントラストマップ生成部、110 3D化回路、
120 3D表示モニタ、130 文字重畳回路、150 操作部、
200 読み出し位置シフト指示部、210 画像取得部、
220 SAD演算部、230 最小値検出部、240 シフト量保持部、
250 信頼度検出部、
BL1〜BL6 複数のブロック(複数の領域)、CTV コントラスト値、
Dxmax x方向最大値、Dymax y方向最大値、
LN1 フォーカスレンズ、pxn ピクセル数(信頼度情報)、
s’ 位相差、x 水平走査方向、y 垂直走査方向、xd,yd 検出位置
10 imaging unit, 20 contrast value calculating unit, 30 detection position determining unit,
40 phase difference detection unit, 41 to 43 detection unit,
50 AF control unit (focus control unit), 60 lens drive unit,
70 phase difference selector, 80 display controller,
100 contrast map generation unit, 110 3D conversion circuit,
120 3D display monitor, 130 character superimposing circuit, 150 operation unit,
200 read position shift instruction unit, 210 image acquisition unit,
220 SAD calculation unit, 230 minimum value detection unit, 240 shift amount holding unit,
250 reliability detector,
BL1 to BL6 Multiple blocks (multiple areas), CTV contrast value,
Dxmax maximum value in x direction, Dymax maximum value in y direction,
LN1 focus lens, pxn number of pixels (reliability information),
s ′ phase difference, x horizontal scanning direction, y vertical scanning direction, xd, yd detection position

Claims (11)

第1画像と、前記第1画像に対して視差を有する第2画像と、を視差画像として取得する撮像部と、
前記視差画像のうち少なくとも一方の画像からコントラスト値を算出するコントラスト値算出部と、
前記コントラスト値に基づいて、前記第1画像と前記第2画像との位相差を検出する検出位置を決定する検出位置決定部と、
前記検出位置における前記第1画像と前記第2画像との前記位相差を検出する位相差検出部と、
前記位相差に基づいて前記撮像部のフォーカス制御を行うフォーカス制御部と、
を備えることを特徴とする撮像装置。
An imaging unit that acquires a first image and a second image having parallax with respect to the first image as a parallax image;
A contrast value calculator that calculates a contrast value from at least one of the parallax images;
A detection position determination unit that determines a detection position for detecting a phase difference between the first image and the second image based on the contrast value;
A phase difference detector that detects the phase difference between the first image and the second image at the detection position;
A focus control unit that performs focus control of the imaging unit based on the phase difference;
An imaging apparatus comprising:
請求項1において、
位相差選択部と、を備え、
前記検出位置決定部は、
前記視差画像のうち少なくとも一方の画像に対し複数の領域を設定し、複数の前記領域ごとの前記コントラスト値に基づいて、複数の前記領域ごとの前記検出位置を決定し、
前記位相差検出部は、
複数の前記検出位置ごとの複数の位相差を検出し、
前記位相差選択部は、
複数の前記位相差の中から前記フォーカス制御に用いる位相差を選択することを特徴とする撮像装置。
In claim 1,
A phase difference selector, and
The detection position determination unit
Setting a plurality of regions for at least one of the parallax images, determining the detection positions for each of the plurality of regions based on the contrast values for the plurality of regions,
The phase difference detector is
Detecting a plurality of phase differences for each of the plurality of detection positions;
The phase difference selector is
An imaging apparatus, wherein a phase difference used for the focus control is selected from a plurality of the phase differences.
請求項2において、
前記検出位置決定部は、
前記複数の前記領域ごとに相対的に高コントラスト値である位置を検出し、前記高コントラスト値である位置を前記検出位置として決定することを特徴とする撮像装置。
In claim 2,
The detection position determination unit
An imaging apparatus, wherein a position having a relatively high contrast value is detected for each of the plurality of regions, and a position having the high contrast value is determined as the detection position.
請求項2又は3において、
前記検出位置決定部は、
複数の前記領域としてa個の領域を設定し、前記a個の領域の各領域における前記コントラスト値の分散を算出し、前記a個の領域のうち前記分散が小さい方からb個の領域(b<a)を選択し、
前記位相差検出部は、
前記b個の領域での前記検出位置に対応するb個の位相差を相関演算により算出し、前記相関演算の信頼度情報を前記b個の位相差の各位相差について求め、
前記位相差選択部は、
前記b個の位相差のうち、前記信頼度情報が表す信頼度が最も高い位相差を前記フォーカス制御用の位相差として選択することを特徴とする撮像装置。
In claim 2 or 3,
The detection position determination unit
A regions are set as the plurality of regions, the variance of the contrast value in each of the a regions is calculated, and b regions (b Select <a)
The phase difference detector is
B phase differences corresponding to the detected positions in the b regions are calculated by correlation calculation, and reliability information of the correlation calculation is obtained for each phase difference of the b phase differences;
The phase difference selector is
An imaging apparatus, wherein a phase difference having the highest reliability represented by the reliability information among the b phase differences is selected as the phase difference for focus control.
請求項2乃至4のいずれかにおいて、
複数の前記検出位置を表す情報を前記視差画像の前記少なくとも一方の画像に重畳して表示部に表示する制御を行う表示制御部を備え、
前記位相差選択部は、
複数の前記検出位置のうち、ユーザにより選択された検出位置に対応する前記位相差を前記フォーカス制御用の位相差として選択することを特徴とする撮像装置。
In any of claims 2 to 4,
A display control unit that performs control to superimpose information representing a plurality of the detection positions on the at least one image of the parallax image and display the information on a display unit;
The phase difference selector is
An imaging apparatus, wherein the phase difference corresponding to a detection position selected by a user is selected as a phase difference for focus control among the plurality of detection positions.
請求項1において、
前記コントラスト値算出部は、
前記視差画像のうち少なくとも一方の画像にオートフォーカス対象領域を設定し、前記オートフォーカス対象領域におけるコントラスト値を算出し、
前記検出位置決定部は、
前記オートフォーカス対象領域において相対的に高コントラスト値である位置を検出し、前記高コントラスト値である位置を前記検出位置として決定することを特徴とする撮像装置。
In claim 1,
The contrast value calculation unit
Setting an autofocus target area on at least one of the parallax images, calculating a contrast value in the autofocus target area;
The detection position determination unit
An image pickup apparatus that detects a position having a relatively high contrast value in the autofocus target region and determines the position having the high contrast value as the detection position.
請求項6において、
前記コントラスト値算出部は、
前記オートフォーカス対象領域のコントラストマップを生成し、
前記検出位置決定部は、
前記コントラストマップにおける前記コントラスト値の最大値を検出し、前記最大値に対応する位置を前記相対的に高コントラスト値である位置として検出することを特徴とする撮像装置。
In claim 6,
The contrast value calculation unit
Generating a contrast map of the autofocus target area;
The detection position determination unit
An imaging apparatus, wherein a maximum value of the contrast value in the contrast map is detected, and a position corresponding to the maximum value is detected as a position having a relatively high contrast value.
請求項6において、
前記コントラスト値算出部は、
前記オートフォーカス対象領域のコントラストマップを生成し、
前記検出位置決定部は、
前記コントラストマップにおける前記コントラスト値の重心位置を求め、前記重心位置を前記相対的に高コントラスト値である位置として検出することを特徴とする撮像装置。
In claim 6,
The contrast value calculation unit
Generating a contrast map of the autofocus target area;
The detection position determination unit
An imaging apparatus, wherein a gravity center position of the contrast value in the contrast map is obtained, and the gravity center position is detected as a position having a relatively high contrast value.
請求項1乃至8のいずれかにおいて、
前記撮像部は、
前記視差画像を動画像として撮像し、
前記位相差検出部は、
前記動画像の各フレームについて前記位相差を検出し、
前記フォーカス制御部は、
前記撮像部のフォーカスが合っている位置と被写体との遠近関係を前記位相差に基づいて判断し、前記判断の結果に基づいて、前記撮像部のフォーカスが合っている位置を前記被写体に近づける方向に前記撮像部のフォーカスレンズを所定量だけ移動させる制御を行い、前記所定量だけ移動させる制御を前記各フレームで繰り返すことにより前記被写体にフォーカスを合わせることを特徴とする撮像装置。
In any one of Claims 1 thru | or 8.
The imaging unit
Capturing the parallax image as a moving image;
The phase difference detector is
Detecting the phase difference for each frame of the moving image;
The focus control unit
A direction in which the imaging unit is in focus and a subject is determined based on the phase difference, and a direction in which the imaging unit is in focus is brought closer to the subject based on the determination result. The image pickup apparatus is characterized in that the focus lens of the image pickup unit is controlled to move by a predetermined amount, and the control to move the focus lens by the predetermined amount is repeated for each frame to focus on the subject.
第1画像と、前記第1画像に対して視差を有する第2画像と、を視差画像として取得し、
前記視差画像のうち少なくとも一方の画像からコントラスト値を算出し、
前記コントラスト値に基づいて、前記第1の画像と前記第2の画像との位相差を検出する検出位置を決定し、
前記検出位置における前記第1画像と前記第2画像の位相差を検出し、
前記位相差に基づいて前記撮像部のフォーカス制御を行うことを特徴とするフォーカス制御方法。
Obtaining a first image and a second image having a parallax with respect to the first image as a parallax image;
A contrast value is calculated from at least one of the parallax images;
Determining a detection position for detecting a phase difference between the first image and the second image based on the contrast value;
Detecting a phase difference between the first image and the second image at the detection position;
A focus control method, wherein focus control of the imaging unit is performed based on the phase difference.
請求項10において、
前記視差画像のうち前記少なくとも一方の画像に対し複数の領域を設定し、複数の前記領域ごとの前記コントラスト値に基づいて、複数の前記領域ごとの前記検出位置を決定し、
決定した複数の前記検出位置に対応する複数の位相差を検出し、
複数の前記位相差の中からフォーカス制御に用いる位相差を選択し、
前記フォーカス制御に用いる位相差に基づいて前記撮像部のフォーカス制御を行うことを特徴とするフォーカス制御方法。
In claim 10,
Setting a plurality of regions for the at least one image of the parallax images, determining the detection positions for the plurality of regions based on the contrast values for the plurality of regions,
Detecting a plurality of phase differences corresponding to the plurality of determined detection positions;
Select a phase difference to be used for focus control from a plurality of the phase differences,
A focus control method comprising: performing focus control of the imaging unit based on a phase difference used for the focus control.
JP2012224055A 2012-10-09 2012-10-09 Imaging device Active JP6045280B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012224055A JP6045280B2 (en) 2012-10-09 2012-10-09 Imaging device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012224055A JP6045280B2 (en) 2012-10-09 2012-10-09 Imaging device

Publications (2)

Publication Number Publication Date
JP2014077830A true JP2014077830A (en) 2014-05-01
JP6045280B2 JP6045280B2 (en) 2016-12-14

Family

ID=50783192

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012224055A Active JP6045280B2 (en) 2012-10-09 2012-10-09 Imaging device

Country Status (1)

Country Link
JP (1) JP6045280B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015191163A1 (en) * 2014-06-13 2015-12-17 Intel Corporation Reliability measurements for phase based autofocus
JP2016095416A (en) * 2014-11-14 2016-05-26 キヤノン株式会社 Focus adjustment device, imaging apparatus, method for controlling focus adjustment device, and program

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0875985A (en) * 1994-09-06 1996-03-22 Nikon Corp Focus detector
JP2003007994A (en) * 2001-06-27 2003-01-10 Konica Corp Solid-state image pickup element, stereoscopic camera apparatus, and range finder
JP2006165601A (en) * 2004-12-02 2006-06-22 Sony Corp Imaging apparatus and imaging element
JP2008209762A (en) * 2007-02-27 2008-09-11 Nikon Corp Photoelectric detector of image forming optical system, focus detector, and imaging apparatus
JP2009109838A (en) * 2007-10-31 2009-05-21 Nikon Corp Focus detecting device and camera
JP2009192774A (en) * 2008-02-14 2009-08-27 Nikon Corp Focus adjustment device and imaging device
JP2012008370A (en) * 2010-06-25 2012-01-12 Nikon Corp Imaging device and interchangeable lens
JP2012063396A (en) * 2010-09-14 2012-03-29 Canon Inc Focus adjustment device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0875985A (en) * 1994-09-06 1996-03-22 Nikon Corp Focus detector
JP2003007994A (en) * 2001-06-27 2003-01-10 Konica Corp Solid-state image pickup element, stereoscopic camera apparatus, and range finder
JP2006165601A (en) * 2004-12-02 2006-06-22 Sony Corp Imaging apparatus and imaging element
JP2008209762A (en) * 2007-02-27 2008-09-11 Nikon Corp Photoelectric detector of image forming optical system, focus detector, and imaging apparatus
JP2009109838A (en) * 2007-10-31 2009-05-21 Nikon Corp Focus detecting device and camera
JP2009192774A (en) * 2008-02-14 2009-08-27 Nikon Corp Focus adjustment device and imaging device
JP2012008370A (en) * 2010-06-25 2012-01-12 Nikon Corp Imaging device and interchangeable lens
JP2012063396A (en) * 2010-09-14 2012-03-29 Canon Inc Focus adjustment device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015191163A1 (en) * 2014-06-13 2015-12-17 Intel Corporation Reliability measurements for phase based autofocus
CN106464807A (en) * 2014-06-13 2017-02-22 英特尔公司 Reliability measurements for phase based autofocus
KR101800995B1 (en) * 2014-06-13 2017-11-23 인텔 코포레이션 Reliability measurements for phase based autofocus
EP3155804A4 (en) * 2014-06-13 2018-02-07 Intel Corporation Reliability measurements for phase based autofocus
CN106464807B (en) * 2014-06-13 2019-12-24 英特尔公司 Reliability measurement for phase-based autofocus
JP2016095416A (en) * 2014-11-14 2016-05-26 キヤノン株式会社 Focus adjustment device, imaging apparatus, method for controlling focus adjustment device, and program

Also Published As

Publication number Publication date
JP6045280B2 (en) 2016-12-14

Similar Documents

Publication Publication Date Title
JP5544047B2 (en) Image processing apparatus, method and program, stereoscopic imaging apparatus, portable electronic device, printer, and stereoscopic image reproducing apparatus
US20140240471A1 (en) Method, device and apparatus for generating stereoscopic images using a non-stereoscopic camera
US8964104B2 (en) Image pickup apparatus
JP2009210840A (en) Stereoscopic image display device and method, and program
US20120194905A1 (en) Image display apparatus and image display method
JP2011197277A (en) Three-dimensional imaging apparatus
US20160021359A1 (en) Imaging processing apparatus, image processing method, and program
JP2021048560A (en) Image processing apparatus, image processing method, imaging apparatus, and program
JP6564284B2 (en) Image processing apparatus and image processing method
JP6690637B2 (en) Medical observation device, information processing method, program, and video microscope device
JP6045280B2 (en) Imaging device
JP2019168479A (en) Controller, imaging device, method for control, program, and, and storage medium
US10075639B2 (en) Image acquiring device and portable terminal comprising same and image acquiring method of the device
US9124866B2 (en) Image output device, method, and recording medium therefor
US9143761B2 (en) Image processing device, image processing method, recording medium, and imaging device
JP6728020B2 (en) Image processing apparatus, image processing method and program
JP2013201688A (en) Image processing apparatus, image processing method, and image processing program
JPWO2016158184A1 (en) Medical observation apparatus, lens drive control apparatus, lens drive control method, program, and video microscope apparatus
JP2020193820A (en) Measurement device, imaging device, control method, and program
KR101219859B1 (en) Apparatus and method for semi-auto convergence in 3d photographing apparatus
JP6648916B2 (en) Imaging device
JP2013074397A (en) Image processing system, image processing method, and image processing program
JP6961423B2 (en) Image processing equipment, imaging equipment, control methods for image processing equipment, programs and recording media
JP5351878B2 (en) Stereoscopic image display apparatus and method, and program
JP2008058279A (en) Apparatus and method for forming range image, and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20150806

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20160512

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20160524

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20160623

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20161025

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20161115

R151 Written notification of patent or utility model registration

Ref document number: 6045280

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250