Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP7163025B2 - Image measuring device, image measuring method, imaging device, program - Google Patents
[go: Go Back, main page]

JP7163025B2 - Image measuring device, image measuring method, imaging device, program - Google Patents

Image measuring device, image measuring method, imaging device, program Download PDF

Info

Publication number
JP7163025B2
JP7163025B2 JP2017253584A JP2017253584A JP7163025B2 JP 7163025 B2 JP7163025 B2 JP 7163025B2 JP 2017253584 A JP2017253584 A JP 2017253584A JP 2017253584 A JP2017253584 A JP 2017253584A JP 7163025 B2 JP7163025 B2 JP 7163025B2
Authority
JP
Japan
Prior art keywords
image
distance
image data
range
points
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.)
Active
Application number
JP2017253584A
Other languages
Japanese (ja)
Other versions
JP2019066451A (en
Inventor
拓也 石橋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to US16/138,136 priority Critical patent/US11004229B2/en
Publication of JP2019066451A publication Critical patent/JP2019066451A/en
Application granted granted Critical
Publication of JP7163025B2 publication Critical patent/JP7163025B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Length Measuring Devices By Optical Means (AREA)
  • Measurement Of Optical Distance (AREA)
  • Stereoscopic And Panoramic Photography (AREA)
  • Automatic Focus Adjustment (AREA)
  • Studio Devices (AREA)

Description

本発明は、画像計測装置における被写体の長さの算出処理技術に関する。 The present invention relates to a processing technique for calculating the length of a subject in an image measurement device.

立体視用画像を撮像するステレオカメラは、2つの撮像部によって同一の被写体を同時に撮像し、視差を有する2種類の画像を取得可能である。また、ステレオカメラ等によって撮像された2種類の画像のデータに基づき、画像の奥行き方向の長さを算出する方法がある。特許文献1には、立体視用の撮像装置を用いて、ユーザが指定した被写体画像上の2点間距離(3次元空間での長さ)を測定する技術が開示されている。 A stereo camera that captures images for stereoscopic viewing can simultaneously capture images of the same subject using two imaging units, and acquire two types of images having parallax. There is also a method of calculating the length of an image in the depth direction based on data of two types of images captured by a stereo camera or the like. Japanese Unexamined Patent Application Publication No. 2002-100000 discloses a technique of measuring the distance between two points (the length in a three-dimensional space) on a subject image specified by a user using a stereoscopic imaging device.

一方、1つの撮像部において、撮像光学系の異なる瞳部分領域をそれぞれ通過する、被写体からの光束を分割して、視差を有する複数の画像データを生成する瞳分割撮像方法が知られている。 On the other hand, there is known a pupil division imaging method in which a single imaging unit divides light beams from a subject that pass through different pupil partial regions of an imaging optical system to generate a plurality of pieces of image data having parallax.

特開2011-232330号公報Japanese Unexamined Patent Application Publication No. 2011-232330

瞳分割撮像方法で撮像された画像について奥行き方向の長さを算出する場合、デフォーカス量が所定値以上に大きい領域では奥行き方向の長さを算出するときの精度が低下する可能性がある。その理由は、デフォーカス量が大きくなることで対象となる画像が暈けてしまい、視差を有する複数の画像間で像信号の対称性が損なわれるからである。したがって、被写体画像上で指定された2点間の3次元空間での長さを、より高精度に測定するためには、測距対象である被写体に対し、同じ画角にてピント位置を変えて撮影した複数枚の画像が必要である。例えば、撮影された複数枚の画像を測距用画像として用いる場合、指定された2点に対してそれぞれ、どの測距用画像の奥行き方向の長さを利用すれば、より高精度な測距値が得られるかを判断する必要がある。
本発明は、画像データを取得して計測処理を行う画像計測装置において、より精度の高い測距値を算出することを目的とする。
When calculating the length in the depth direction of an image captured by the split-pupil imaging method, there is a possibility that the accuracy in calculating the length in the depth direction will decrease in regions where the defocus amount is greater than or equal to a predetermined value. The reason for this is that a large defocus amount blurs the target image and impairs the symmetry of image signals between a plurality of images having parallax. Therefore, in order to more accurately measure the length in the three-dimensional space between two points specified on the subject image, it is necessary to change the focus position at the same angle of view with respect to the subject to be measured. Multiple images taken by For example, when a plurality of captured images are used as images for distance measurement, the depth direction length of each image for distance measurement can be used for each of the two designated points for more accurate distance measurement. It is necessary to determine whether the value can be obtained.
SUMMARY OF THE INVENTION It is an object of the present invention to calculate a distance measurement value with higher accuracy in an image measuring apparatus that acquires image data and performs measurement processing.

本発明の一実施形態の装置は、複数のピント位置で、かつ異なる視点でそれぞれ撮像された複数の画像データを取得する第1の取得手段と、各ピント位置での異なる視点の画像データ対を用いて被写体の像ずれ量またはデフォーカス量を取得する第2の取得手段と、前記画像データにおける複数の測距点を指定する指定手段と、前記第2の取得手段により取得された像ずれ量またはデフォーカス量から前記指定手段により指定された各測距点に対応する第1の距離情報を算出し、該第1の距離情報を用いて、画像の奥行き方向を含む3次元空間における指定された前記測距点間の長さを算出する算出手段と、前記複数の画像データにおける前記指定手段により指定された各測距点に対応する信頼度を決定する信頼度決定手段と、を備える。前記算出手段は、前記信頼度決定手段により決定された前記信頼度を用いて選択された画像データにおける前記測距点の前記第1の距離情報から前記測距点間の長さを算出する。
An apparatus according to an embodiment of the present invention comprises first acquisition means for acquiring a plurality of image data captured at a plurality of focus positions and from different viewpoints, and image data pairs from different viewpoints at each focus position. second acquiring means for acquiring an image shift amount or defocus amount of a subject using a second acquiring means; designating means for specifying a plurality of distance measuring points in the image data; and the image deviation amount acquired by the second acquiring means . Alternatively, first distance information corresponding to each distance measuring point designated by the designation means is calculated from the defocus amount, and the first distance information is used to obtain the designated distance in a three-dimensional space including the depth direction of the image. calculating means for calculating the distance between the distance measuring points; and reliability determination means for determining reliability corresponding to each distance measuring point specified by the specifying means in the plurality of image data. The calculation means calculates the length between the distance measurement points from the first distance information of the distance measurement points in the selected image data using the reliability determined by the reliability determination means.

本発明によれば、画像データを取得して計測処理を行う画像計測装置において、より精度の高い測距値を算出することができる。 According to the present invention, an image measuring apparatus that acquires image data and performs measurement processing can calculate a distance measurement value with higher accuracy.

本実施形態に係る画像計測装置の全体構成を示すブロック図である。1 is a block diagram showing the overall configuration of an image measuring device according to this embodiment; FIG. 本実施形態における複数の画像を説明する図である。It is a figure explaining a plurality of images in this embodiment. 画像ごとの有効測距範囲の説明図である。FIG. 4 is an explanatory diagram of an effective ranging range for each image; 画像計測全体の処理を説明するフローチャートである。10 is a flowchart for explaining the processing of the entire image measurement; 測距点の選択処理を説明するフローチャートである。4 is a flow chart for explaining a process of selecting a focus detection point; 測距点の選択例を示す説明図である。FIG. 10 is an explanatory diagram showing an example of selection of distance measuring points; 評価値の決定方法を説明するフローチャートである。4 is a flowchart for explaining a method of determining an evaluation value; 対応点の探索方法を説明するフローチャートである。4 is a flowchart for explaining a method of searching for corresponding points; 対応点の探索方法を説明する模式図である。It is a schematic diagram explaining the search method of a corresponding point. デフォーカス量の算出方法を説明するフローチャートである。4 is a flowchart for explaining a method of calculating a defocus amount; 撮像部の画素構造を例示する図である。It is a figure which illustrates the pixel structure of an imaging part. 画像の分割処理および像ずれ量の算出処理を説明する模式図である。FIG. 5 is a schematic diagram for explaining image division processing and image shift amount calculation processing; デフォーカス量、F値、像ずれ量の関係を示す模式図である。FIG. 3 is a schematic diagram showing the relationship among defocus amount, F-number, and image shift amount; 評価値の決定処理を説明するフローチャートである。4 is a flowchart for explaining evaluation value determination processing; 各種評価値をグラフで説明する図である。It is a figure explaining various evaluation values with a graph. 画像ごとの有効測距範囲と複数の測距点の例を示す模式図である。FIG. 3 is a schematic diagram showing an example of an effective range-finding range and a plurality of range-finding points for each image; 測距値の表示処理を説明する図である。It is a figure explaining the display processing of a distance measurement value. 第2実施形態に係る装置の構成を示すブロック図である。It is a block diagram which shows the structure of the apparatus which concerns on 2nd Embodiment. 第2実施形態における動作を説明するフローチャートである。9 is a flowchart for explaining operations in the second embodiment; 第2実施形態における仮測距を説明するフローチャートである。9 is a flowchart for explaining provisional distance measurement in the second embodiment; 第2実施形態の撮影方法について説明するフローチャートである。9 is a flowchart for explaining an imaging method according to the second embodiment; 第2実施形態に係る撮影範囲を説明する図である。It is a figure explaining the imaging|photography range which concerns on 2nd Embodiment. 第2実施形態に係る信頼度の評価値を説明する図である。It is a figure explaining the evaluation value of reliability which concerns on 2nd Embodiment. 第2実施形態に係る有効測距範囲を説明する図である。FIG. 11 is a diagram illustrating an effective ranging range according to the second embodiment; FIG. 第2実施形態に係る撮影方法を説明する図である。It is a figure explaining the imaging|photography method which concerns on 2nd Embodiment. 有効測距範囲の分割数を増やした場合の撮影方法の説明図である。FIG. 10 is an explanatory diagram of a photographing method when the number of divisions of the effective distance measurement range is increased;

以下、本発明の好適な実施形態について、図面を参照して詳細に説明する。各実施形態の画像計測装置は、画像データを取得して計測処理を行う撮像装置や情報処理装置等に幅広く適用可能である。 Preferred embodiments of the present invention will now be described in detail with reference to the drawings. The image measurement apparatus of each embodiment can be widely applied to imaging apparatuses, information processing apparatuses, and the like that acquire image data and perform measurement processing.

[第1実施形態]
図1は、本実施形態の画像計測装置100の構成例を示すブロック図である。画像計測装置100は、制御部101と各モジュール(符号102~110)を備え、画像情報や画像に関連する各種情報を取得して処理を実行する。
[First embodiment]
FIG. 1 is a block diagram showing a configuration example of an image measurement device 100 of this embodiment. The image measurement apparatus 100 includes a control unit 101 and modules (reference numerals 102 to 110), acquires image information and various information related to the image, and executes processing.

制御部101はCPU(中央演算処理装置)等を備え、画像計測装置100を構成するモジュール間での情報の送受を制御する。画像入力部102は画像計測装置100に入力された複数枚の画像のデータを、制御部101からの制御指令にしたがってメモリ103へ記憶する処理を行う。メモリ103は制御部101によって制御され、各モジュールでの処理に必要な情報を読み出し、また各モジュールによる処理結果を保存する。 The control unit 101 includes a CPU (Central Processing Unit) and the like, and controls transmission and reception of information between modules that configure the image measuring apparatus 100 . The image input unit 102 stores data of a plurality of images input to the image measurement apparatus 100 in the memory 103 according to control commands from the control unit 101 . The memory 103 is controlled by the control unit 101 to read out information necessary for processing in each module and store processing results by each module.

撮影情報取得部104は撮影情報を取得し、制御部101からの制御指令によりメモリ103へ出力する。メモリ103への情報記憶は制御部101を介して行われる。撮影情報は、画像計測装置100へ入力された複数枚の画像に関連付けられた、撮影時に生成される情報である。 A shooting information acquisition unit 104 acquires shooting information and outputs it to the memory 103 according to a control command from the control unit 101 . Information storage in the memory 103 is performed via the control unit 101 . The imaging information is information associated with a plurality of images input to the image measurement device 100 and generated at the time of imaging.

測距点選択部105は、画像計測装置100へ入力された測距点情報を取得するとともに、メモリ103に保存された複数枚の画像のデータに対し、測距点を2点選択する。測距点選択部105は制御部101からの制御指令にしたがい、選択された2点の各座標情報をメモリ103へ出力する。各座標情報は制御部101を介してメモリ103に記憶される。 A focus detection point selection unit 105 acquires focus detection point information input to the image measuring apparatus 100 and selects two focus detection points for data of a plurality of images stored in the memory 103 . A focus detection point selection unit 105 outputs each coordinate information of the selected two points to the memory 103 according to a control command from the control unit 101 . Each piece of coordinate information is stored in memory 103 via control unit 101 .

対応点探索部106は、メモリ103に記憶された複数枚の画像のデータを読み出す。読み出された複数枚の画像データに対して、測距点選択部105によって選択された測距点(2点)に対応する各測距点を探索する処理が行われる。対応点探索部106は、複数枚の画像における、各測距点に対応する座標情報を算出する。算出された座標情報は制御部101を介してメモリ103に記憶される。 The corresponding point searching unit 106 reads data of a plurality of images stored in the memory 103 . A process of searching for each ranging point corresponding to the ranging points (two points) selected by the ranging point selection unit 105 is performed on the read multiple image data. The corresponding point searching unit 106 calculates coordinate information corresponding to each distance measuring point in the plurality of images. The calculated coordinate information is stored in the memory 103 via the control unit 101 .

デフォーカス量算出部107は、メモリ103に記憶された複数枚の画像のデータと撮影情報とを読み出す。複数枚の画像のデータに対して、測距点(2点)にそれぞれ対応する座標でのデフォーカス量が算出される。算出されたデフォーカス量は制御部101を介してメモリ103に記憶される。 A defocus amount calculation unit 107 reads data of a plurality of images and shooting information stored in the memory 103 . A defocus amount is calculated at coordinates corresponding to each of the distance measurement points (two points) for data of a plurality of images. The calculated defocus amount is stored in the memory 103 via the control unit 101 .

評価値決定部108は、メモリ103に記憶された、複数枚の画像のデータとデフォーカス量と複数枚の画像における測距点(2点)にそれぞれ対応する座標情報を読み出す。複数枚の画像における各測距点に対応する座標の評価値が決定される。決定された評価値は制御部101を介してメモリ103に記憶される。 The evaluation value determining unit 108 reads the data of the plurality of images, the defocus amount, and the coordinate information corresponding to the distance measurement points (two points) in the plurality of images, which are stored in the memory 103 . An evaluation value of coordinates corresponding to each ranging point in a plurality of images is determined. The determined evaluation value is stored in memory 103 via control unit 101 .

測距点間距離算出部109は、メモリ103に記憶されている評価値およびデフォーカス量を読み出す。読み出された評価値に基づいて、使用する画像が複数枚の画像の中から決定される。決定された画像における測距点(2点)でのデフォーカス量に基づき、各測距点の3次元空間での座標を算出する処理が行われる。測距点間距離算出部(以下、単に距離算出部という)109は、各測距点の3次元空間での座標から測距点間の長さを算出する。算出された長さ情報は、制御部101を介してメモリ103に記憶される。 The inter-focus point distance calculation unit 109 reads out the evaluation value and the defocus amount stored in the memory 103 . An image to be used is determined from among the plurality of images based on the read evaluation value. Based on the defocus amounts at the determined focus points (two points) in the image, processing is performed to calculate the coordinates of each focus point in the three-dimensional space. An inter-focus point distance calculator (hereinafter simply referred to as a distance calculator) 109 calculates the distance between the focus points from the coordinates of each focus point in the three-dimensional space. The calculated length information is stored in memory 103 via control unit 101 .

画像計測結果表示部(以下、単に表示部という)110は、メモリ103から読み出した、複数枚の画像のデータ、測距点の座標情報、および測距点間の長さ情報に基づいて、画像計測結果を画面上に表示し、ユーザへ提示する。複数枚の画像から選択された代表画像に対して、測距点である2点の座標と2点間の長さが表示部110に表示される。 An image measurement result display unit (hereinafter simply referred to as a display unit) 110 displays an image based on the data of a plurality of images read from the memory 103, the coordinate information of the distance measurement points, and the length information between the distance measurement points. The measurement results are displayed on the screen and presented to the user. For a representative image selected from a plurality of images, the display unit 110 displays the coordinates of two points that are distance measurement points and the distance between the two points.

図2を参照して、画像計測装置100に入力される複数枚の画像について詳細に説明する。図2(A)は撮像装置と被写体との位置関係を例示する模式図である。撮像装置201は、瞳分割型の撮像部を備える。例えば、撮像光学系の瞳部分領域をそれぞれ通過する、被写体から光束を2分割して受光し、視差を有する複数の画像(視差画像)として、第1および第2の視点画像を生成することができる。撮像装置201は、合焦位置に相当するピント位置や被写界深度を変更しながら被写体202を撮像し、複数枚の画像のデータを取得できるものとする。つまり、複数の視差画像の画像データ対が、複数のピント位置にてそれぞれ取得される。図2(A)にて撮像装置201に関して、水平方向をx軸方向とし、垂直方向をy軸方向とし、奥行き方向をz軸方向として定義する。奥行き方向は、撮像装置201の光軸方向に沿う方向である。 A plurality of images input to the image measurement device 100 will be described in detail with reference to FIG. FIG. 2A is a schematic diagram illustrating the positional relationship between the imaging device and the subject. The imaging device 201 includes a split-pupil imaging unit. For example, it is possible to generate first and second viewpoint images as a plurality of images having parallax (parallax images) by splitting a light beam from an object into two and receiving the light beams passing through the pupil partial regions of the imaging optical system. can. The image capturing apparatus 201 captures an image of the subject 202 while changing the focus position corresponding to the in-focus position and the depth of field, and acquires data of a plurality of images. That is, image data pairs of a plurality of parallax images are obtained at a plurality of focus positions. In FIG. 2A, regarding the imaging device 201, the horizontal direction is defined as the x-axis direction, the vertical direction is defined as the y-axis direction, and the depth direction is defined as the z-axis direction. The depth direction is the direction along the optical axis direction of the imaging device 201 .

図2(B)は撮像装置201によって撮影された複数枚の画像の説明図である。図2(A)に示したように、撮像装置201と被写体202の位置関係で撮影が行われ、撮影された複数枚の画像には、測距点選択用画像と測距用画像が含まれる。測距点選択用画像は測距点を選択するために被写界深度の深い撮影によって取得される画像である。また、測距用画像は同一の被写体に対してピント位置を変えて撮影された画像である。測距点選択用画像は測距用画像に対して合焦領域が広い画像である。尚、測距点選択用画像については測距用画像の中から特定の1枚を選択することによって、測距用画像と兼用することも可能である。さらには、測距用画像に対して合焦領域が広い画像が存在しない場合、測距用画像の中から任意に1枚の測距点選択用画像を選択することも可能である。 FIG. 2B is an explanatory diagram of a plurality of images captured by the imaging device 201. FIG. As shown in FIG. 2A, photography is performed with the positional relationship between the imaging device 201 and the subject 202, and the multiple images that have been photographed include an image for range-finding point selection and an image for range-finding. . The focus point selection image is an image obtained by shooting with a deep depth of field in order to select a focus point. Also, the image for distance measurement is an image of the same subject photographed at different focal positions. The range-finding point selection image is an image having a wider focus area than the range-finding image. By selecting a specific image from among the range finding images, the range finding point selection image can also be used as the range finding image. Furthermore, if there is no image with a wider focus area than the image for distance measurement, it is also possible to arbitrarily select one image for distance measurement point selection from the images for distance measurement.

図3は、測距用画像ごとの有効測距範囲を説明する図である。図2(A)に示す撮像装置201と被写体202の位置関係において、被写体202をy軸方向から俯瞰することによって、ピント位置を変えて複数枚撮影した測距用画像ごとの有効測距範囲を示す。図3の紙面に垂直な軸をy軸とし、紙面内で直交する2軸をx軸、z軸とする。ピント位置はy軸方向から俯瞰することによって、z軸に対するピント面として表現することが可能である。ピント位置を変えて複数枚撮影した測距用画像については、各測距用画像におけるピント面を、カメラ位置に近い方から順にピント面203p、ピント面204p、ピント面205p、ピント面206pとする。この場合、各ピント面において、それよりも手前側の有効測距範囲と奥側の有効測距範囲をそれぞれ示している。例えば、ピント面203pにおいて、ピント面203pより手前側の有効測距範囲は、ピント面203pから有効測距範囲を示す位置203bまでの範囲である。また、ピント面203pより奥側の有効測距範囲は、ピント面203pから有効測距範囲を示す位置203iまでの範囲である。手前側の有効測距範囲を示す位置203bから奥側の有効測距範囲を示す位置203iまでの範囲が、ピント面203pにおける有効測距範囲203aとなる。同様にして、ピント面204p、205p、206pの有効測距範囲はそれぞれ、範囲204a、205a、206aとなる。有効測距範囲はピント位置を中心とした奥行き方向における測距精度の有効性が高い範囲であり、後述するデフォーカス量に基づいて決定することが可能である。つまり、有効測距範囲外では測距精度が有効測距範囲内の測距精度に比べて大きく低下する。 FIG. 3 is a diagram for explaining the effective ranging range for each ranging image. In the positional relationship between the imaging device 201 and the object 202 shown in FIG. show. The axis perpendicular to the plane of FIG. 3 is defined as the y-axis, and the two orthogonal axes within the plane of the paper are defined as the x-axis and the z-axis. The focus position can be expressed as a focus plane with respect to the z-axis by looking down from the y-axis direction. For the images for distance measurement that are shot multiple times with different focus positions, the focus planes in each image for distance measurement are set to focus plane 203p, focus plane 204p, focus plane 205p, and focus plane 206p in order from the one closest to the camera position. . In this case, the effective distance measurement range on the front side and the effective distance measurement range on the back side are shown in each focal plane. For example, in the focus plane 203p, the effective distance measurement range on the near side of the focus plane 203p is the range from the focus plane 203p to a position 203b indicating the effective distance measurement range. Further, the effective distance measurement range on the far side of the focus plane 203p is a range from the focus plane 203p to a position 203i indicating the effective distance measurement range. The range from the position 203b indicating the effective range-finding range on the front side to the position 203i indicating the effective range-finding range on the back side is the effective range-finding range 203a on the focus plane 203p. Similarly, the effective ranging ranges of focus planes 204p, 205p, and 206p are ranges 204a, 205a, and 206a, respectively. The effective distance measurement range is a range in which the effectiveness of distance measurement accuracy in the depth direction centering on the focus position is high, and can be determined based on the defocus amount described later. In other words, the ranging accuracy outside the effective ranging range is much lower than the ranging accuracy within the effective ranging range.

図4に示すフローチャートを参照して、画像計測装置100が行う処理について詳細に説明する。S301にて、複数枚の画像の情報、撮影情報、測距点情報が取得され、画像計測装置100へ入力される。複数枚の画像には、測距点選択用画像と測距用画像が含まれており、画像入力部102が取得する。撮影情報としては、複数枚の画像ごとに少なくとも下記(a)~(h)の情報が撮影情報取得部104によって取得される。
(a)撮像装置からピント位置までの距離
(b)撮像素子の画素ピッチ
(c)一対の測距瞳領域を通過する光束の重心の開き角の大きさによって決まる変換係数
(d)F値
(e)瞳距離
(f)撮像装置のレンズにおける像主点から撮像センサ面までの距離
(g)撮像装置のレンズにおける物主点から被写体までの距離
(h)撮像装置のレンズステート情報(焦点距離および横倍率比)
撮影情報はデフォーカス量を算出する場合や、3次元空間上での座標を算出する場合に必要である。
The processing performed by the image measurement device 100 will be described in detail with reference to the flowchart shown in FIG. In S<b>301 , information on a plurality of images, shooting information, and ranging point information are acquired and input to the image measurement apparatus 100 . The plurality of images include an image for range finding point selection and an image for range finding, and the image input unit 102 acquires them. As the shooting information, at least the following information (a) to (h) is acquired by the shooting information acquisition unit 104 for each of a plurality of images.
(a) the distance from the imaging device to the focus position (b) the pixel pitch of the imaging device (c) the conversion coefficient determined by the size of the opening angle of the center of gravity of the light flux passing through the pair of ranging pupil regions (d) the F value ( e) pupil distance (f) distance from the image principal point of the lens of the imaging device to the imaging sensor surface (g) distance from the object principal point of the lens of the imaging device to the subject (h) lens state information of the imaging device (focal length and lateral magnification ratio)
The shooting information is necessary when calculating the defocus amount and when calculating the coordinates in the three-dimensional space.

測距点情報は、測距点の選択方法を自動で行うか、またはユーザが任意に選択するかを決定する情報であり、測距点選択部105によって取得される。また、測距点情報については、測距点の選択方法を自動で決定する場合、その決定方法に関する情報を含む。 The focus detection point information is information for determining whether the focus detection point is automatically selected or arbitrarily selected by the user, and is acquired by the focus detection point selection unit 105 . Further, the distance measuring point information includes information on the determination method when the method of selecting the distance measuring point is automatically determined.

次のS302において、測距点(2点)を選択する処理が実行される。処理の詳細については図5を用いて後述する。S303において、各測距点の評価値を決定する処理が実行される。処理の詳細については図7を用いて後述する。S304において、S303で決定された評価値に基づいて、各測距点の三次元座標と2点間の長さを算出する処理が実行され、算出結果がユーザへ提示される。評価方法については、図16を用いて後述する。S304の後、処理を終了する。 In the next step S302, a process of selecting focus detection points (two points) is executed. Details of the processing will be described later with reference to FIG. In S303, a process of determining the evaluation value of each distance measuring point is executed. Details of the processing will be described later with reference to FIG. In S304, processing is executed to calculate the three-dimensional coordinates of each ranging point and the length between the two points based on the evaluation values determined in S303, and the calculation results are presented to the user. The evaluation method will be described later with reference to FIG. 16 . After S304, the process ends.

図5を参照して、測距点選択部105による測距点の選択処理について説明する。図5は測距点の選択処理を説明するフローチャートである。S401にて、測距点選択用画像のデータを読み出す処理が行われる。次のS402では、測距点情報を参照し、ユーザから測距点の指定があるかどうかの判断処理が実行される。ユーザの操作による測距点の指定が行われない場合、S403へ処理を進める。またユーザの操作による測距点の指定が行われた場合、S404に処理を進める。 Focus detection point selection processing by the focus detection point selection unit 105 will be described with reference to FIG. FIG. 5 is a flow chart for explaining the process of selecting a focus detection point. In S401, a process of reading out image data for selecting a focus point is performed. In the next step S402, the focus detection point information is referenced, and determination processing is executed to determine whether or not the focus detection point is designated by the user. If the focus detection point is not specified by the user's operation, the process proceeds to S403. Also, if the focus detection point is specified by the user's operation, the process proceeds to S404.

S403では、あらかじめ測距点情報によって設定された条件に基づいて測距点が自動的に決定される。図6(A)を参照して具体例を説明する。図6(A)は特徴点検出および評価値算出を説明するための模式図である。まず、測距点選択用画像401について特徴点検出が行われ、例えば直方体形状をした被写体の特徴点4011~4017が得られる。このとき、特徴点として検出された点での評価値が算出されて、特徴点の特徴量が評価される。図6(A)では、特徴点の特徴量が大きいほど、特徴点(黒点)が大きく表示されている。つまり特徴量が大きいほど、測距点選択用画像401にて表示する特徴点を表す黒点印の半径が大きいものとする。例えば、特徴点4011~4017のうち、特徴点4011と4012は、他の特徴点4013~4017と比較して高い特徴量を有する。この場合、特徴点4011と4012が2点の測距点として決定される。尚、特徴点の検出方法としてコーナー検出方法、コントラスト検出方法、エッジ検出方法等がある。これらの方法を単独に使用する方法や、複数の方法を組み合わせて特徴点を算出する方法がある。 In S403, the focus detection point is automatically determined based on the conditions set in advance by the focus detection point information. A specific example will be described with reference to FIG. FIG. 6A is a schematic diagram for explaining feature point detection and evaluation value calculation. First, feature point detection is performed on an image 401 for selecting a distance measuring point, and feature points 4011 to 4017 of the subject having a rectangular parallelepiped shape, for example, are obtained. At this time, the evaluation value at the point detected as the feature point is calculated, and the feature amount of the feature point is evaluated. In FIG. 6A, the larger the feature amount of the feature point, the larger the feature point (black point) is displayed. That is, it is assumed that the larger the feature amount, the larger the radius of the black dot mark representing the feature point displayed in the range-finding point selection image 401 . For example, among the feature points 4011-4017, the feature points 4011 and 4012 have higher feature amounts than the other feature points 4013-4017. In this case, feature points 4011 and 4012 are determined as two distance measurement points. Methods for detecting feature points include a corner detection method, a contrast detection method, an edge detection method, and the like. There are a method of using these methods independently and a method of calculating feature points by combining a plurality of methods.

図5のS404では、あらかじめ測距点情報によって設定された条件に基づいてユーザにより指定された2点が測距点として選択される。図6(B)を参照して具体例を説明する。図6(B)は、ユーザによる選択操作を説明する模式図である。測距点選択用画像401について、ユーザが測距点4021および4022を指示する例を示す。ユーザはタッチパネル上で所望の測距点を、その手指により選択する操作またはポインティングデバイスおよびカーソル図形4023による指示操作を行える。これにより2点の測距点が選択される。尚、図6(B)に示す例以外にも、画像上でユーザが座標を選択し、選択した座標に対応する点を測距点とすることが可能である。
以上により、ユーザは測距点を自由に選択することができ、また、測距点の自動選択の場合にはユーザの手間を軽減できる。
In S404 of FIG. 5, two points specified by the user are selected as focus detection points based on conditions set in advance by focus detection point information. A specific example will be described with reference to FIG. FIG. 6B is a schematic diagram for explaining a selection operation by the user. An example in which the user designates focus detection points 4021 and 4022 for the focus detection point selection image 401 is shown. The user can perform an operation of selecting a desired range-finding point on the touch panel with his or her finger or an instruction operation with the pointing device and cursor graphic 4023 . As a result, two distance measuring points are selected. In addition to the example shown in FIG. 6B, it is also possible for the user to select coordinates on the image and set a point corresponding to the selected coordinates as the range-finding point.
As described above, the user can freely select the range-finding point, and in the case of automatic selection of the range-finding point, the user's trouble can be reduced.

次に図7のフローチャートを参照して、各測距点の評価値を決定する処理(図4:S303)について説明する。S501にて、測距点選択用画像で選択された測距点に対して、測距用画像における対応する点を探索するために対応点探索が行われる。S502にて、探索された対応点でのデフォーカス量を算出する処理が行われる。S503にて、算出されたデフォーカス量と信頼度に基づいて、測距点における評価値が決定される。図7の各ステップに示す処理の詳細を以下に説明する。 Next, referring to the flowchart of FIG. 7, the process of determining the evaluation value of each distance measuring point (FIG. 4: S303) will be described. In S501, a corresponding point search is performed to search for a corresponding point in the image for distance measurement with respect to the distance measurement point selected in the image for distance measurement point selection. In S502, a process of calculating the defocus amount at the searched corresponding point is performed. In S503, an evaluation value at the distance measuring point is determined based on the calculated defocus amount and reliability. Details of the processing shown in each step of FIG. 7 will be described below.

まず、S501では、測距点選択用画像で選択された測距点(2点)の座標を、複数の測距用画像において特定する必要があるので、対応点の探索処理が行われる。図8のフローチャートを参照して、対応点探索部106が行う処理を詳細に説明する。 First, in S501, since it is necessary to specify the coordinates of the distance measurement points (two points) selected in the image for distance measurement point selection in a plurality of images for distance measurement, search processing for corresponding points is performed. The processing performed by the corresponding point searching unit 106 will be described in detail with reference to the flowchart of FIG.

S601では、測距点選択用画像における各測距点の周辺の画素を選択する処理が行われる。S602では、選択された周辺画素を使用して、各測距用画像でブロックマッチング処理が実行される。図9(A)を参照して具体例を説明する。 In S601, processing for selecting pixels around each focus point in the image for focus point selection is performed. In S602, block matching processing is performed on each ranging image using the selected peripheral pixels. A specific example will be described with reference to FIG.

図9(A)は対応点探索を説明する模式図であり、測距点選択用画像601および測距用画像602を例示する。測距点選択用画像601において、まず測距点6011の周辺の画素を相関窓6012として選択する処理が行われる。相関窓6012を拡大図で示す。さらに、測距用画像602に対して窓範囲6021で選択された相関窓6022を選択する処理が行われる。選択された相関窓6022を拡大図で示す。これらの相関窓6012と相関窓6022とでブロックマッチング処理が行われる。つまり、相関窓同士の誤差量を算出する処理が実行され、この処理は、窓範囲6021の位置を変更しながら画像全体に亘って繰り返し行われる。そして、算出された誤差量が最小である範囲の座標から、測距点選択用画像601で選択された測距点に対応する、測距用画像602における測距点を算出することができる。測距点6013についても、測距点6011と同様に、各測距用画像における、測距点選択用画像で選択された測距点に対応する測距点が算出される。 FIG. 9A is a schematic diagram for explaining the search for corresponding points, exemplifying a range-finding point selection image 601 and a range-finding image 602 . In the focus detection point selection image 601 , processing is first performed to select pixels around the focus detection point 6011 as a correlation window 6012 . Correlation window 6012 is shown in an enlarged view. Furthermore, processing for selecting the correlation window 6022 selected in the window range 6021 is performed on the ranging image 602 . A selected correlation window 6022 is shown in an enlarged view. Block matching processing is performed with these correlation windows 6012 and 6022 . That is, a process of calculating the amount of error between correlation windows is executed, and this process is repeated over the entire image while changing the position of the window range 6021 . Then, from the coordinates of the range in which the calculated error amount is the smallest, it is possible to calculate the ranging point in the ranging image 602 that corresponds to the ranging point selected in the ranging point selection image 601 . As for the ranging point 6013, similarly to the ranging point 6011, a ranging point corresponding to the ranging point selected in the ranging point selection image is calculated in each ranging image.

図9(B)はブロックマッチング処理の改善法の説明図である。図9(A)で説明したブロックマッチング処理に工夫を凝らした方法として、画像内の探索範囲を絞り込んで演算量を低減する方法がある。つまり、図9(A)では測距用画像602の画像全体を探索範囲としたが、図9(B)では測距用画像603が測距点選択用画像に対してピント位置を変更して撮影された画像であることを利用する。測距点選択用画像における測距点の座標が測距用画像603における測距点の座標から大きく乖離する可能性は低い。この特性を利用し、測距用画像603における窓範囲6031の開始位置を測距点選択用画像における測距点の座標とし、相関窓6032を選択する処理が行われる。さらに、窓範囲6031の位置を変更する範囲が窓移動範囲6033内に制限される。このことにより、相関の低い領域を探索することによる処理の無駄を省き、演算量を著しく削減することができる。 FIG. 9B is an explanatory diagram of a method for improving the block matching process. As a method of devising the block matching processing described with reference to FIG. 9A, there is a method of narrowing down the search range in the image to reduce the amount of calculation. That is, in FIG. 9A, the entire range finding image 602 is set as the search range, but in FIG. Utilize the fact that it is a photographed image. It is unlikely that the coordinates of the ranging point in the ranging point selection image will deviate greatly from the coordinates of the ranging point in the ranging image 603 . Using this characteristic, the start position of the window range 6031 in the image for distance measurement 603 is set as the coordinates of the distance measurement point in the image for distance measurement point selection, and processing for selecting the correlation window 6032 is performed. Furthermore, the range of changing the position of the window range 6031 is restricted within the window movement range 6033 . As a result, wasteful processing due to searching for regions with low correlation can be eliminated, and the amount of computation can be significantly reduced.

図10を参照して、図7のS502に示すデフォーカス量の算出処理について詳細に説明する。図10はデフォーカス量算出部107が行う処理を説明するフローチャートである。S701において、1枚の測距用画像から一対の画像データを生成する処理が行われる。その詳細について、図11を用いて具体的に説明する。 The defocus amount calculation process shown in S502 of FIG. 7 will be described in detail with reference to FIG. FIG. 10 is a flowchart for explaining the processing performed by the defocus amount calculation unit 107. FIG. In S701, processing is performed to generate a pair of image data from one ranging image. Details thereof will be specifically described with reference to FIG. 11 .

図11(A)は、視差画像の撮影を行う際に使用される撮像素子の画素配列を説明する模式図である。紙面に垂直な軸をZ軸とし、紙面内にて直交する2軸をそれぞれX軸、Y軸とする。撮像部を構成する撮像素子は、多数の画素部712を2次元アレイ状に規則的に配列した構造を有する。図11(B)は画素部712のひとつを拡大して示す図である。画素部712は、マイクロレンズ711と一対の光電変換部713A、714B(以下、瞳分割画素713A、714Bという)から構成される。各マイクロレンズに対応する複数の光電変換部は、撮像光学系の異なる瞳部分領域をそれぞれ通過する、被写体からの光束を受光して光電変換を行い、電気信号を出力する。本実施形態では、瞳分割画素713Aにより取得される画像をA像と呼び、瞳分割画素714Bにより取得される画像をB像と呼ぶ。A像とB像を合成した画像をAB像と呼ぶ。AB像は瞳分割型でない撮像素子によって撮像される画像に相当する。 FIG. 11A is a schematic diagram for explaining the pixel arrangement of an imaging device used when capturing parallax images. The axis perpendicular to the plane of the paper is the Z-axis, and the two orthogonal axes in the plane of the paper are the X-axis and the Y-axis, respectively. The imaging device that constitutes the imaging unit has a structure in which a large number of pixel units 712 are regularly arranged in a two-dimensional array. FIG. 11B is an enlarged view of one of the pixel portions 712. FIG. The pixel unit 712 includes a microlens 711 and a pair of photoelectric conversion units 713A and 714B (hereinafter referred to as pupil division pixels 713A and 714B). A plurality of photoelectric conversion units corresponding to the respective microlenses receive light beams from the subject that pass through different pupil partial regions of the imaging optical system, perform photoelectric conversion, and output electrical signals. In this embodiment, an image obtained by the pupil-dividing pixels 713A is called an A image, and an image obtained by the pupil-dividing pixels 714B is called a B image. An image obtained by synthesizing the A image and the B image is called an AB image. The AB image corresponds to an image captured by a non-pupil-splitting imaging device.

図11に例示する構成では、画像計測処理を行うために必要な情報として、A像およびB像のデータを取得可能である。尚、この例では光電変換部の分割数が2であるが、分割数については3以上でもよく、視点の異なる複数の視点画像を取得することができる。 In the configuration illustrated in FIG. 11, the data of the A image and the B image can be obtained as information necessary for performing image measurement processing. Although the number of divisions of the photoelectric conversion unit is 2 in this example, the number of divisions may be 3 or more, and a plurality of viewpoint images having different viewpoints can be acquired.

図10のS702では、S701で生成された一対の画像データを微小ブロックに分割する処理が行われる。図12(A)を参照して具体例を説明する。図12(A)は、瞳分割画素713A、714Bによってそれぞれ取得される信号から生成される、A像721とB像722のデータを示す模式図である。A像721とB像722については、微小ブロック723で示すように複数のブロックに分割される。例えば、入力画像の画素ごとに、微小ブロックの中心位置に着目画素が設定されるものとする。図12(A)の微小ブロック723は、その中心にある測距点724での着目画素と、その周囲にある8つの画素を含むように分割される。 In S702 of FIG. 10, a process of dividing the pair of image data generated in S701 into minute blocks is performed. A specific example will be described with reference to FIG. FIG. 12A is a schematic diagram showing data of an A image 721 and a B image 722 generated from signals respectively acquired by pupil division pixels 713A and 714B. The A image 721 and the B image 722 are divided into a plurality of blocks as indicated by minute blocks 723 . For example, it is assumed that the pixel of interest is set at the center position of the minute block for each pixel of the input image. A minute block 723 in FIG. 12A is divided so as to include a pixel of interest at a distance measuring point 724 in the center and eight pixels surrounding it.

図12(B)は、微小ブロックの形状について説明するために、A像721を示す模式図である。左側の図に示す微小ブロック725は、図12(A)の微小ブロック723よりもサイズが大きい例である。また右側の図に示す微小ブロック726はL字形状の例である。このように、分割される微小ブロックのサイズと形状に制限は無いものとする。また、近接する微小ブロック同士の領域が重なっていてもよい。 FIG. 12B is a schematic diagram showing an A image 721 for explaining the shape of the minute blocks. A minute block 725 shown in the left diagram is an example larger in size than the minute block 723 in FIG. 12(A). Also, the minute block 726 shown in the right figure is an example of an L shape. In this way, there are no restrictions on the size and shape of the minute blocks to be divided. In addition, the regions of adjacent minute blocks may overlap each other.

図10のS703では、S702で分割された微小ブロックにおいて相関演算処理が行われ、各測距点での像ずれ量が算出される。具体的には、微小ブロックにおける一対の画素データをそれぞれ、E(1)~E(m)およびF(1)~F(m)と表記する。mはデータ数を表す。この場合、第1のデータ系列E(1)~E(m)に対して、第2のデータ系列F(1)~F(m)を相対的にずらしながら、下記数式(1)により2つのデータ列間のずらし量(kと記す)における相関量C(k)が算出される。
C(k)=Σ|E(n)-F(n+k)| ・・・(1)
数式(1)において||は絶対値記号であり、Σ演算(積算)はnについて計算される。このΣ演算において、n、n+kの取る範囲は1~mの範囲に限定される。ずらし量kの値は整数であり、一対の画像データの検出ピッチを単位とした相対的なシフト量である。
In S703 of FIG. 10, correlation calculation processing is performed on the minute blocks divided in S702, and the amount of image shift at each distance measuring point is calculated. Specifically, a pair of pixel data in a minute block are denoted by E(1) to E(m) and F(1) to F(m), respectively. m represents the number of data. In this case, while relatively shifting the second data series F(1) to F(m) with respect to the first data series E(1) to E(m), two A correlation amount C(k) in a shift amount (denoted as k) between data strings is calculated.
C(k)=Σ|E(n)−F(n+k)| (1)
In equation (1) || is the absolute value symbol and the Σ operation (accumulation) is computed over n. In this Σ calculation, the range of n and n+k is limited to the range of 1 to m. The value of the shift amount k is an integer and is a relative shift amount in units of detection pitches of a pair of image data.

図12(C)に示すグラフを参照して、数式(1)の演算結果の例を説明する。図12(C)の横軸は像ずれ量を表し、縦軸は相関量C(k)を表す。一対のデータ系列の間で相関が高い像ずれ量において、相関量C(k)が最小になる。そして、下記数式(2)~(5)による3点内挿法を用いて、連続的な相関量に対する最小値C(x)を与える像ずれ量(xと記す)が算出される。像ずれ量xの値は実数である。
x=kj+D/SLOP ・・・(2)
C(x)= C(kj)-|D| ・・・(3)
D={C(kj-1)-C(kj+1)}/2 ・・・(4)
SLOP=MAX{C(kj+1)-C(kj),C(kj-1)-C(kj)}・・・(5)
ここで、kjは離散的な相関量C(k)が最小となるときのkである。
数式(2)から求まる量xを、一対の瞳分割画像における像ずれ量とする。尚、像ずれ量xの単位はpixelとする。
An example of the calculation result of Expression (1) will be described with reference to the graph shown in FIG. The horizontal axis of FIG. 12C represents the amount of image shift, and the vertical axis represents the amount of correlation C(k). The correlation amount C(k) is minimized at the image shift amount with high correlation between the pair of data sequences. Then, the image shift amount (denoted as x) that gives the minimum value C(x) for the continuous correlation amount is calculated using the three-point interpolation method according to the following formulas (2) to (5). The value of the image shift amount x is a real number.
x=kj+D/SLOP (2)
C(x)=C(kj)−|D| (3)
D={C(kj−1)−C(kj+1)}/2 (4)
SLOP=MAX{C(kj+1)-C(kj), C(kj-1)-C(kj)} (5)
Here, kj is k when the discrete correlation amount C(k) is minimized.
The amount x obtained from the formula (2) is set as the image shift amount in the pair of split-pupil images. Note that the unit of the image shift amount x is pixels.

図10のS704では、数式(2)で求めた測距点での像ずれ量xから、被写体像面の予定結像面に対するデフォーカス量(DEFと記す)が、下記数式(6)によって算出される。
DEF= KX ・PY ・x ・・・(6)
数式(6)において、PYは撮像素子の画素ピッチ(撮像素子を構成する画素の画素間距離)である。KXは一対の測距瞳部分領域をそれぞれ通過する光束の重心の開き角の大きさによって決まる変換係数であり、単位はmm/pixelである。尚、この重心の開き角の大きさは、レンズの絞り開口の大きさ(F値)に応じて変化し、レンズ情報に応じて決定される。図13を用いて具体的に説明する。
In S704 of FIG. 10, the defocus amount (denoted as DEF) of the subject image plane with respect to the planned imaging plane is calculated by the following formula (6) from the image shift amount x at the distance measuring point obtained by the formula (2). be done.
DEF = KX · PY · x (6)
In Expression (6), PY is the pixel pitch of the image sensor (the inter-pixel distance between pixels forming the image sensor). KX is a conversion coefficient determined by the size of the opening angle of the center of gravity of the luminous flux passing through the pair of distance measuring pupil partial areas, and the unit is mm/pixel. It should be noted that the size of the opening angle of the center of gravity changes according to the size (F value) of the diaphragm opening of the lens, and is determined according to the lens information. A specific description will be given with reference to FIG.

図13は予定結像面に対するデフォーカス量、F値、像ずれ量の関係を示す模式図である。図13の左側から順に、撮像対象の物面741、レンズ742、撮像素子の予定結像面743、像面744をそれぞれ示す。像面744は、予定結像面743からのデフォーカス量745に相当する位置にある面である。F値に応じた像ずれ量746、747をそれぞれ示している。像ずれ量746はF値が小さい場合(開放側)の像ずれ量であり、像ずれ量747はF値が大きい場合(絞り側)の像ずれ量である。デフォーカス状態での像面に対する像ずれ量は開放側で大きくなり、絞り側で小さくなることがわかる。言い換えれば、デフォーカス量が同じでも像ずれ量はF値によって異なる。そのため、像ずれ量からデフォーカス量を算出する際には、数式(6)で示すように、F値に応じたゲインである変換係数KXを乗算する必要がある。 FIG. 13 is a schematic diagram showing the relationship between the defocus amount, the F-number, and the image shift amount with respect to the intended imaging plane. From the left side of FIG. 13, an object plane 741 to be imaged, a lens 742, an expected imaging plane 743 of the imaging element, and an image plane 744 are shown. An image plane 744 is a plane located at a position corresponding to a defocus amount 745 from an expected imaging plane 743 . Image shift amounts 746 and 747 corresponding to F-numbers are shown, respectively. The image shift amount 746 is the image shift amount when the F number is small (open side), and the image shift amount 747 is the image shift amount when the F number is large (diaphragm side). It can be seen that the amount of image shift with respect to the image plane in the defocused state increases on the wide open side and decreases on the aperture side. In other words, even if the defocus amount is the same, the image shift amount differs depending on the F number. Therefore, when calculating the defocus amount from the image shift amount, it is necessary to multiply by a conversion coefficient KX, which is a gain corresponding to the F number, as shown in Equation (6).

以上のように、着目画素の位置を1画素ずつずらしながら繰り返し計算を行うことで、デフォーカス量を算出することができる。この算出処理方法を、各測距用画像の測距点(2点)に対して適用することによって、各測距用画像のデフォーカス量を算出できる。 As described above, the defocus amount can be calculated by repeating the calculation while shifting the position of the pixel of interest by one pixel. By applying this calculation processing method to the distance measurement points (two points) of each distance measurement image, the defocus amount of each distance measurement image can be calculated.

図14を参照して、図7のS503に示す評価値の決定処理について説明する。図14は評価値決定部108が行う処理を説明するフローチャートである。S801は第1の条件に関する判断処理である。第1の条件とは、測距点である2点が1枚の画像の有効測距範囲内にある測距用画像(以下、条件適合画像という)が存在することである。第1の条件を満たす場合、S802の処理へ進み、第1の条件を満たさない場合にはS809へ移行する。ここで、有効測距範囲について詳しく説明する。条件適合画像の存否については、数式(6)で算出されるデフォーカス量DEFを評価することで判断できる。つまりデフォーカス量DEFが大きくなるにつれて、DEFの測距精度が低下する。測距精度がある一定以上に保証されるデフォーカス量DEFの範囲を、|DEF|<Crと定義する。Crはデフォーカス量の閾値である。|DEF|<Crという不等式を満たすデフォーカス量DEFが測距点で算出された場合、この測距点が有効測距範囲内にあると判断される。つまり、測距点でのデフォーカス量DEFの大きさが所定の閾値Crより小さいか否かによって、条件適合画像の存否を判断することができる。複数枚の測距用画像の各測距点に対して算出されるデフォーカス量に基づいて、条件適合画像が存在するかどうかを評価することができる。 The evaluation value determination process shown in S503 of FIG. 7 will be described with reference to FIG. FIG. 14 is a flowchart for explaining the processing performed by the evaluation value determination unit 108. FIG. S801 is judgment processing regarding the first condition. The first condition is that there is an image for distance measurement (hereinafter referred to as a condition-conforming image) in which two points, which are distance measurement points, are within the effective distance measurement range of one image. If the first condition is satisfied, the process proceeds to S802, and if the first condition is not satisfied, the process proceeds to S809. Here, the effective ranging range will be described in detail. Whether or not there is a condition-satisfactory image can be determined by evaluating the defocus amount DEF calculated by Equation (6). That is, as the defocus amount DEF increases, the distance measurement accuracy of DEF decreases. A range of the defocus amount DEF in which a certain level of distance measurement accuracy is guaranteed is defined as |DEF|<Cr. Cr is a defocus amount threshold. If the defocus amount DEF that satisfies the inequality |DEF|<Cr is calculated at a range-finding point, it is determined that this range-finding point is within the effective range-finding range. That is, it is possible to determine whether or not there is a condition-conforming image depending on whether or not the magnitude of the defocus amount DEF at the distance measuring point is smaller than the predetermined threshold value Cr. Based on the defocus amount calculated for each ranging point of a plurality of ranging images, it is possible to evaluate whether or not a condition-conforming image exists.

前記したように、デフォーカス量は絞り開口の大きさ(F値)に応じて変化する。図13を参照すると、具体的にはF値を大きく設定した第1の測距用画像は、F値を小さく設定した第2の測距用画像に対して、有効測距範囲を広くとることができる。ただし、第1の測距用画像では測距精度が低下する。この特性を利用し、F値を大きくした測距用画像が存在する場合には、この測距用画像1枚で測距点(2点)の仮測距を行い、2つの測距点が1枚の画像の有効測距範囲内にあるかどうかを判断することができる。このようにすることで、測距用画像のそれぞれで2つの測距点が有効測距範囲内であるかどうかを評価する処理に比べて、計算量および時間を低減可能である。 As described above, the defocus amount changes according to the aperture size (F value). Referring to FIG. 13, specifically, the first ranging image with a large F-number has a wider effective range-finding range than the second ranging image with a small F-number. can be done. However, the accuracy of distance measurement is lowered in the first image for distance measurement. Using this characteristic, when there is an image for ranging with a large F-number, provisional ranging is performed for the ranging points (2 points) with this one ranging image, and the two ranging points are It can be determined whether or not it is within the effective ranging range of one image. By doing so, it is possible to reduce the amount of calculation and the time required compared to the process of evaluating whether or not the two ranging points in each ranging image are within the effective ranging range.

図14のS802では、真度の信頼度を評価値として優先するか否かが判断される。真度とは、真の値からの測定誤差に対応する度合いを表し、測定値が真の値に近いほど信頼度が高いものとする。真度の信頼度は、ピントの移動量を評価することによって決定される。ピントの移動量とは、測距点である2点での奥行き情報を算出する各測距用画像が選択される場合において、各測距用画像間のピントの移動量を示す。ピントの移動量が大きい場合、複数枚の画像の撮影時におけるピント位置までの距離の測定誤差が大きくなる。仮に、真度の信頼度を評価値として優先するかどうかを判断せずに、真度の信頼度を評価値として常に優先する実施方法では、画質の良し悪しに関わらず、ピントの移動量のみで評価値が算出されてしまう。この場合に発生する問題は測距精度の低下である。例えば、測距点でのコントラストが低い画像や、測距点での輝度値が飽和している画像の場合、ピントの移動量が小さいために測距用画像として選択されてしまい、測距精度が低下する可能性がある。他方、真度の信頼度を評価値として優先しない実施方法では、その他の評価値をすべて算出し、または決定しなければならず、計算処理上の負担が大きくなる可能性がある。以上の理由により、S802では、真度の信頼度を評価値として優先するかどうかが判断され、真度の信頼度を評価値として優先しない場合、S803へ進み、真度の信頼度を評価値として優先する場合にはS806へ進む。判断方法としては、例えば、以下のようにユーザ主体の方法と装置主体の方法がある。 In S802 of FIG. 14, it is determined whether or not the reliability of accuracy is prioritized as an evaluation value. Accuracy represents the degree of correspondence to the measurement error from the true value, and the closer the measured value is to the true value, the higher the reliability. Confidence in accuracy is determined by evaluating the amount of focus shift. The focus movement amount indicates the focus movement amount between the distance measurement images when each distance measurement image for calculating the depth information at the two distance measurement points is selected. When the amount of focus movement is large, the measurement error of the distance to the focus position when photographing a plurality of images becomes large. Hypothetically, in an implementation method that always prioritizes the reliability of accuracy as an evaluation value without judging whether to prioritize the reliability of accuracy as an evaluation value, regardless of the quality of the image quality, only the amount of focus movement The evaluation value is calculated with . A problem that occurs in this case is a decrease in accuracy of distance measurement. For example, an image with low contrast at the focus point or an image with saturated luminance at the focus point will be selected as the image for range finding because the amount of focus movement is small, resulting in poor range accuracy. may decline. On the other hand, in an implementation method that does not prioritize the reliability of accuracy as an evaluation value, all other evaluation values must be calculated or determined, which may increase the computational load. For the above reasons, in S802, it is determined whether or not the reliability of accuracy is given priority as an evaluation value. , the process proceeds to S806. As the determination method, for example, there are a user-based method and a device-based method as follows.

・ユーザが操作を行って任意に設定する方法
装置は、ユーザが操作部を使用して行った設定の指示にしたがって優先判定を行う。
・装置が自動で判断する方法
例えば、複数枚の画像撮影にて撮影間隔(時間間隔)の長さに基づき、撮影間隔がある一定時間(閾値時間)以上である場合、装置は真度の信頼度を評価値として優先しないことを自動で判断する。
尚、各方法を単独で実施するか、または条件に応じて複数の方法を使い分けてもよい。
-Method of arbitrarily setting by user's operation The device performs priority determination according to the setting instruction performed by the user using the operation unit.
・Method for the device to automatically determine Automatically determine that the degree is not given priority as an evaluation value.
Each method may be performed independently, or a plurality of methods may be used according to the conditions.

S803にて、測距点(2点)の各測距用画像での真度の信頼度が、ピントの移動量を評価することによって決定される。ピントの移動量が大きい場合、複数枚の画像の撮影時におけるピント位置までの距離の測定誤差が大きくなる。そのため、評価値決定部108はピントの移動量の評価値を小さくする。また、測距点(2点)での奥行き情報を算出するための測距用画像が同一の測距用画像である場合にはピントの移動量はゼロである。このような場合に評価値決定部108はピントの移動の評価値を大きくする。図15(A)を参照して具体例を説明する。 In S803, the reliability of the accuracy of each distance measurement image of the distance measurement points (two points) is determined by evaluating the amount of movement of the focus. When the amount of focus movement is large, the measurement error of the distance to the focus position when photographing a plurality of images becomes large. Therefore, the evaluation value determination unit 108 reduces the evaluation value of the focus movement amount. Also, when the distance measurement images for calculating the depth information at the distance measurement points (two points) are the same distance measurement image, the focus shift amount is zero. In such a case, the evaluation value determination unit 108 increases the evaluation value of focus movement. A specific example will be described with reference to FIG.

図15(A)は、ピントの移動量と対応する評価値との関係をグラフで説明する図である。横軸はピントの移動量(pmと記す)を表し、縦軸は評価値(PINと記す)を表す。ピントの移動量pmが大きくなるにつれて評価値PINが小さくなる。例えば、評価値PINは数式(7)により算出される。
PIN = b1 - b2 × pm ・・・(7)
ただし、切片b1、係数b2はいずれも正値(b1,b2>0)であり、任意に設定可能である。ピントの移動量pmを評価しない場合には、数式(8)のように
PIN = b3 ・・・(8)
とする。b3は一定値(正値)であり、任意に設定可能である。
FIG. 15A is a graph for explaining the relationship between the amount of focus movement and the corresponding evaluation value. The horizontal axis represents the amount of focus movement (denoted as pm), and the vertical axis represents the evaluation value (denoted as PIN). As the focus movement amount pm increases, the evaluation value PIN decreases. For example, the evaluation value PIN is calculated by Equation (7).
PIN = b1 - b2 x pm (7)
However, both the intercept b1 and the coefficient b2 are positive values (b1, b2>0) and can be set arbitrarily. When the focus movement amount pm is not evaluated, PIN = b3 (8) as shown in Equation (8)
and b3 is a constant value (positive value) and can be arbitrarily set.

各測距用画像での真度の信頼度をRsと表記し、
Rs = PIN ・・・(9)
とする。ピントの移動量pmを評価する際、pmの値が大きくなるにつれて、信頼度Rsが小さくなるように決定することができる。これにより、ピントの移動による測定誤差を低減することができるので、より高精度な測距値を算出可能となる。尚、評価値PINを数式(7)および(8)のように算出する他に、パラメータによる参照テーブルを設けることで決定することも可能である。さらには、真度の信頼度Rsについても、数式(9)で算出せずにパラメータによる参照テーブルを設けることにより、ピントの移動量pmと評価値PINとの関係から決定することも可能である。
Denote the reliability of accuracy in each ranging image as Rs,
Rs = PIN (9)
and When evaluating the focus movement amount pm, it can be determined so that the reliability Rs decreases as the value of pm increases. As a result, it is possible to reduce the measurement error due to the movement of the focus, so that it is possible to calculate a more accurate distance measurement value. It should be noted that the evaluation value PIN can also be determined by providing a reference table using parameters instead of calculating the evaluation value PIN using the formulas (7) and (8). Furthermore, it is also possible to determine the reliability of accuracy Rs from the relationship between the focus movement amount pm and the evaluation value PIN by providing a reference table with parameters instead of calculating with the formula (9). .

図14のS804において、測距点2点の各測距用画像での再現性の信頼度が決定される。再現性の信頼度は、2つの測距点それぞれにおける、デフォーカス量または像ずれ量、輝度値、分散値を評価することによって決定される信頼度である。図15(B)から(D)を参照して、具体的に説明する。 In S804 of FIG. 14, the reliability of the reproducibility of each ranging image for the two ranging points is determined. The reliability of reproducibility is the reliability determined by evaluating the defocus amount or image shift amount, luminance value, and variance value at each of the two distance measuring points. A specific description will be given with reference to FIGS. 15B to 15D.

図15(B)は、デフォーカス量の評価値に基づく再現性の信頼度をグラフで説明する図である。横軸に示すデフォーカス量DEFに対して、その評価値をDFRと表記して縦軸に示す。デフォーカス量の絶対値|DEF|が大きくなるにしたがって、画像のボケが大きくなることから、有効測距範囲内であっても測距精度が低下する。測距点2点の各測距用画像でのデフォーカス量は数式(1)から数式(6)を用いて算出される。デフォーカス量DEFがゼロである位置1501bを基準として、デフォーカス量DEFの絶対値が大きくなるにしたがって評価値DFRは小さくなる。評価値DFRは数式(10)のように表現できる。
DFR = c1 ― c2 × |DEF| ・・・(10)
数式(10)にて、c1は位置1501bにおけるDFRの値である。c1>0とし、これはDFRの最大値となる。また、c2は任意の係数であり、c2>0とする。ただし、DEFがどのような値であっても、DFR>0となるようにc1、c2の値が設定されるものとする。
以上のように、デフォーカス量の絶対値|DEF|が大きくなるにしたがって評価値DFRを小さくすることが可能である。これにより、デフォーカス量に起因する測定誤差を低減することができるので、より高精度な測距値を算出可能である。
FIG. 15B is a graph for explaining the reproducibility reliability based on the evaluation value of the defocus amount. The evaluation value of the defocus amount DEF shown on the horizontal axis is expressed as DFR and shown on the vertical axis. As the absolute value of the defocus amount |DEF| increases, the blurring of the image increases, so that the distance measurement accuracy decreases even within the effective distance measurement range. The defocus amount in each distance measurement image of two distance measurement points is calculated using equations (1) to (6). With the position 1501b at which the defocus amount DEF is zero as a reference, the evaluation value DFR decreases as the absolute value of the defocus amount DEF increases. The evaluation value DFR can be expressed as Equation (10).
DFR=c1−c2×|DEF| (10)
In equation (10), c1 is the DFR value at location 1501b. Let c1>0, which is the maximum value of DFR. Also, c2 is an arbitrary coefficient, and c2>0. However, the values of c1 and c2 are set so that DFR>0 regardless of the value of DEF.
As described above, it is possible to decrease the evaluation value DFR as the absolute value |DEF| of the defocus amount increases. As a result, it is possible to reduce the measurement error caused by the defocus amount, so it is possible to calculate a more accurate distance measurement value.

図15(C)は、輝度平均値の評価値に基づく再現性の信頼度を説明する図である。横軸に示す輝度平均値LUMに対して、その評価値をLMRと表記して縦軸に示す。測距点2点の各測距用画像での輝度値については、各測距用画像における測距点2点それぞれの座標の近傍の画素の輝度値の平均値が算出される。近傍の範囲については任意に設定可能である。輝度平均値が輝度を表現する範囲の中間値に対して相対的に大きい(または小さい)ことは、その輝度平均値が輝度の中間値と比較して明るい(または暗い)ことを示す。輝度の中間値と比較して輝度平均値が明るすぎる場合、または暗すぎる場合には、各測距用画像の測距点を探索する場合に誤差が発生する可能性があり、またデフォーカス量の算出誤差が発生する可能性がある。これらの誤差の増加によって測距精度が低下する。図15(C)に示す例では、横軸に示す輝度平均値LUMが0から255の範囲で表現される。その中間値127に対応する位置1501cを基準として輝度平均値LUMが大きく(または小さく)なるにしたがって評価値LMRは小さくなる。評価値LMRは数式(11)のように表現できる。
LMR = d1 ― d2 × |((LM/2)-LUM)| ・・・(11)
数式(11)に示すd1は、中間値127に対応する位置1501cにおける値であり、d1>0とし、これはLMRの最大値となる。係数d2の値は任意に設定可能であり、d2>0とする。LMは表現可能な輝度値の最大値であり、図15(C)は255の例を示す。
以上のように、輝度平均値LUMが表現可能な輝度値の中間値から乖離するにしたがって評価値LMRを小さくすることが可能である。これにより、輝度平均値に起因する測定誤差を低減することができるので、より高精度な測距値を算出可能である。
FIG. 15C is a diagram for explaining the reliability of reproducibility based on the evaluation value of the luminance average value. The evaluation value LMR is shown on the vertical axis with respect to the luminance average value LUM shown on the horizontal axis. As for the luminance values of the two ranging points in each ranging image, the average value of the luminance values of the pixels near the coordinates of each of the two ranging points in each ranging image is calculated. The neighborhood range can be set arbitrarily. When the average luminance value is relatively large (or small) with respect to the intermediate value of the range expressing luminance, it indicates that the average luminance value is brighter (or darker) than the intermediate value of luminance. If the average luminance value is too bright or too dark compared to the intermediate luminance value, an error may occur when searching for the distance measurement point of each distance measurement image, and the defocus amount calculation error may occur. An increase in these errors degrades ranging accuracy. In the example shown in FIG. 15C, the luminance average value LUM shown on the horizontal axis is expressed in the range of 0 to 255. In the example shown in FIG. Using the position 1501c corresponding to the intermediate value 127 as a reference, the evaluation value LMR decreases as the luminance average value LUM increases (or decreases). The evaluation value LMR can be expressed as Equation (11).
LMR = d1 - d2 x |((LM/2)-LUM)| (11)
d1 shown in equation (11) is the value at position 1501c corresponding to the intermediate value 127, where d1>0, which is the maximum value of LMR. The value of the coefficient d2 can be set arbitrarily, and d2>0. LM is the maximum representable luminance value, and FIG. 15(C) shows an example of 255 values.
As described above, it is possible to decrease the evaluation value LMR as the average luminance value LUM diverges from the median value of the luminance values that can be expressed. As a result, it is possible to reduce the measurement error caused by the luminance average value, so that the distance measurement value can be calculated with higher accuracy.

図15(D)は、分散値の評価値に基づく再現性の信頼度について説明する図である。横軸に示す画像の分散値CONに対して、その評価値をCNRと表記して縦軸に示す。測距点2点の各測距用画像での分散値については、各測距用画像における2つの測距点それぞれの座標の近傍における画素の分散値から算出することができる。算出時に近傍の範囲を任意に設定可能である。分散値が小さい場合、すなわちコントラストが低い場合には、各測距用画像の測距点を探索する際に誤差が発生し、またデフォーカス量の算出誤差が発生することにより、測距精度が低下する。図15(D)に示すように、分散値CONが大きくなるにしたがって評価値CNRは大きくなる。CNRは数式(12)により表現できる。
CNR = e1×CON ・・・(12)
数式(12)において、e1はCNRの値を制御するための比例係数である。分散値CONがCON≧0であることから、CNRはゼロ以上の値で表現される。
以上のように、分散値が大きくなるにしたがって評価値を大きくすることが可能である。これにより、分散値に起因する測定誤差を低減することができるので、より高精度な測距値を算出可能である。
FIG. 15D is a diagram for explaining the reliability of reproducibility based on the evaluation value of the variance. The evaluation value is indicated as CNR and shown on the vertical axis with respect to the variance value CON of the image shown on the horizontal axis. The variance of the two ranging points in each ranging image can be calculated from the variance of pixels in the vicinity of the coordinates of each of the two ranging points in each ranging image. The neighborhood range can be arbitrarily set at the time of calculation. When the variance value is small, that is, when the contrast is low, an error occurs when searching for the distance measurement point of each distance measurement image, and an error occurs in calculating the defocus amount, resulting in a decrease in distance measurement accuracy. descend. As shown in FIG. 15(D), the evaluation value CNR increases as the variance value CON increases. CNR can be expressed by Equation (12).
CNR=e1×CON (12)
In equation (12), e1 is a proportionality factor for controlling the value of CNR. Since the variance CON satisfies CON≧0, the CNR is expressed as a value greater than or equal to zero.
As described above, it is possible to increase the evaluation value as the variance value increases. As a result, it is possible to reduce the measurement error caused by the variance value, so that the distance measurement value can be calculated with higher accuracy.

再現性の信頼度をRrと表記すると、これは、数式(10)、数式(11)、数式(12)にしたがって、数式(13)のように3つの評価値の積として算出される。
Rr = DFR × LMR × CNR ・・・(13)
すなわち、信頼度決定処理において再現性の信頼度Rrについては、デフォーカス量DEF、輝度平均値LUM、分散値CONをそれぞれ評価することによって決定できる。本実施形態では、デフォーカス量の評価値DFR、輝度平均値の評価値LMR、分散値の評価値CNRを、数式(10)、数式(11)、数式(12)で算出する方法を説明した。これに限らず、パラメータによる参照テーブルを予め設けることにより各評価値を決定する方法を採用してもよい。さらには、再現性の信頼度Rrについても、数式(13)で算出する方法に限らず、パラメータによる参照テーブルを用いて決定してもよい。この場合、各評価値DFR、LMR、CNRの関係に基づいて信頼度Rrを決定可能である。
Denoting the reliability of reproducibility as Rr, it is calculated as the product of three evaluation values as in Equation (13) according to Equations (10), (11) and (12).
Rr = DFR x LMR x CNR (13)
That is, the reproducibility reliability Rr in the reliability determination process can be determined by evaluating the defocus amount DEF, the luminance average value LUM, and the variance value CON. In the present embodiment, the method of calculating the evaluation value DFR of the defocus amount, the evaluation value LMR of the luminance average value, and the evaluation value CNR of the variance value using the formulas (10), (11), and (12) has been described. . The method is not limited to this, and a method of determining each evaluation value by preparing a reference table based on parameters in advance may be adopted. Further, the reproducibility reliability Rr is not limited to the calculation method using the formula (13), and may be determined using a parameter lookup table. In this case, the reliability Rr can be determined based on the relationship among the evaluation values DFR, LMR, and CNR.

S805において、真度の信頼度Rsと再現性の信頼度Rrから測距点2点の各測距用画像における評価値が決定される。この評価値(Rと記す)は数式(14)により算出される。
R = (s×Rs)×(r×Rr) ・・・(14)
数式(14)において、sとrはそれぞれ信頼度RsとRrに対する重み付けのパラメータである。s≧0、r≧0の任意の値が設定される。
以上により、条件適合画像が存在し、かつ真度の信頼度Rsを評価値として優先しない場合には、真度および再現性の各信頼度から測距点2点での各測距用画像における評価値を決定することができる。
In S805, an evaluation value for each distance measurement image of the two distance measurement points is determined from the reliability of accuracy Rs and the reliability of reproducibility Rr. This evaluation value (denoted as R) is calculated by Equation (14).
R = (s x Rs) x (r x Rr) (14)
In Equation (14), s and r are weighting parameters for reliability Rs and Rr, respectively. Arbitrary values of s≧0 and r≧0 are set.
As described above, when there is a condition-satisfactory image and the reliability of accuracy Rs is not prioritized as an evaluation value, from each reliability of accuracy and reproducibility, An evaluation value can be determined.

次に真度の信頼度Rsを評価値として優先する場合を説明する。この場合、S802からS806へ進む。S806において第2の条件について判定処理が行われる。第2の条件は、条件適合画像が複数存在することである。第2の条件を満たさない場合、つまり条件適合画像が複数存在しないと判定された場合、S807へ進む。また第2の条件を満たす場合にはS808へ進む。S807において、条件適合画像の評価値が最大となるように評価値が決定される。すなわち、複数枚の測距用画像において、測距点である2点が1枚の画像の有効測距範囲内に存在しない測距用画像での測距点(2点)の評価値Rをゼロとすることと同義である。条件適合画像でない測距用画像における測距点での評価値Rは数式(14)において、s=0として設定される。
以上により、1枚の条件適合画像が存在し、かつ真度の信頼度を評価値として優先する場合に、条件適合画像の評価値が最大となるように評価値を決定することができる。
Next, a case in which the reliability Rs of accuracy is prioritized as an evaluation value will be described. In this case, the process proceeds from S802 to S806. In S806, determination processing is performed for the second condition. The second condition is that there are multiple condition-matching images. If the second condition is not satisfied, that is, if it is determined that there are not a plurality of condition-satisfactory images, the process advances to S807. If the second condition is satisfied, the process proceeds to S808. In S807, the evaluation value is determined so that the condition-satisfactory image has the maximum evaluation value. That is, in a plurality of ranging images, the evaluation value R of the ranging points (two points) in the ranging image where the two points as ranging points do not exist within the effective ranging range of one image is It is synonymous with setting it to zero. The evaluation value R at the range-finding point in the range-finding image that is not the condition-matching image is set as s=0 in Equation (14).
As described above, when there is one condition-satisfactory image and priority is given to the reliability of accuracy as the evaluation value, the evaluation value can be determined so that the condition-satisfactory image has the maximum evaluation value.

一方、S808では、条件適合画像以外の測距用画像を、取得済みの測距用画像から除外する処理が行われる。これにより、各測距用画像における信頼度の算出に要する計算負担を低減できる。 On the other hand, in S808, a process of excluding ranging images other than the condition-matching images from the acquired ranging images is performed. As a result, it is possible to reduce the computational load required to calculate the reliability of each ranging image.

S809において、測距点2点の各測距用画像での再現性の信頼度を決定する処理が行われる。再現性の信頼度については数式(10)から(13)によって求められる、再現性の信頼度Rrと同様に算出することができる。ただし、S801において、条件適合画像が存在しないことが判定された場合には、すべての測距用画像に対して再現性の信頼度Rrが算出される。これに対して、S806にて条件適合画像が複数存在することが判定された場合には、条件適合画像のみに対して再現性の信頼度Rrが算出される。 In S809, processing is performed to determine the reliability of the reproducibility of each ranging image for the two ranging points. The reliability of reproducibility can be calculated in the same manner as the reliability of reproducibility Rr obtained by formulas (10) to (13). However, if it is determined in S801 that there is no condition-satisfactory image, the reproducibility reliability Rr is calculated for all ranging images. On the other hand, if it is determined in S806 that there are a plurality of condition-satisfactory images, the reproducibility reliability Rr is calculated only for the condition-satisfactory images.

S809の次にS810へ進み、再現性の信頼度Rrから各測距点の各測距用画像における評価値Rが算出される。評価値Rは数式(15)を用いて算出される。
R = r × Rr ・・・(15)
rは信頼度Rrに対する係数パラメータであり、r≧0の任意の値が設定される。
以上により、条件適合画像が存在しない場合(S801からS809へ進む場合)について各測距点の各測距用画像における評価値を決定することができる。また、条件適合画像が複数存在し、かつ真度の信頼度を評価値として優先する場合についても各測距点の各測距用画像における評価値を決定することができる。
After S809, the process advances to S810 to calculate an evaluation value R for each ranging image for each ranging point from the reproducibility reliability Rr. The evaluation value R is calculated using Equation (15).
R = r x Rr (15)
r is a coefficient parameter for the reliability Rr and is set to an arbitrary value of r≧0.
As described above, it is possible to determine the evaluation value of each range-finding image for each range-finding point when there is no condition-conforming image (when proceeding from S801 to S809). In addition, even when there are a plurality of condition-satisfactory images and priority is given to the reliability of accuracy as the evaluation value, the evaluation value of each range-finding image for each range-finding point can be determined.

図16を参照して、図4のS303で決定された評価値による評価方法について説明する。図16は、図3で説明した有効測距範囲について具体的な測距点A、測距点B、測距点Cを例示した説明図である。測距点AとBとの間、測距点AとCとの間、測距点BとCとの間について、各評価値を決定する場合を例示する。

Figure 0007163025000001
An evaluation method based on the evaluation value determined in S303 of FIG. 4 will be described with reference to FIG. FIG. 16 is an explanatory diagram exemplifying specific range-finding points A, B, and C for the effective range-finding range described in FIG. A case of determining each evaluation value between the distance measuring points A and B, between the distance measuring points A and C, and between the distance measuring points B and C will be exemplified.
Figure 0007163025000001

表1は、測距点AとBとの位置関係について測距点AおよびBのそれぞれの評価値を決定した具体例を示す。自然数の変数n(=1,2,・・・)は各測距用画像を区別するために付与した識別番号を表す。nの値は図16に示す有効測距範囲(1)から(4)おける括弧内の数字に対応する。「ピント移動なしR」は、ピント移動量がゼロである場合の評価値であり、「ピント移動ありR」は、ピント移動量がゼロでない場合の評価値である。測距点Aは有効測距範囲(4)内にあり、測距点Bは有効測距範囲(1)内にあり、測距点Cは有効測距範囲(1)および(2)内にあるものとする。 Table 1 shows a specific example of determining evaluation values for each of the distance measuring points A and B with respect to the positional relationship between the distance measuring points A and B. A natural number variable n (=1, 2, . . . ) represents an identification number assigned to distinguish each ranging image. The value of n corresponds to the numbers in parentheses in the effective ranging ranges (1) to (4) shown in FIG. "No focus movement R" is an evaluation value when the amount of focus movement is zero, and "With focus movement R" is an evaluation value when the amount of focus movement is not zero. Focusing point A is within effective ranging range (4), ranging point B is within effective ranging range (1), and ranging point C is within effective ranging ranges (1) and (2). Assume that there is

図16の例では、測距点AおよびBが1枚の画像の有効測距範囲内にある測距用画像は存在しない。そのため、ピント移動なしの評価値Rは決定できず、ピント移動ありの評価値Rのみを決定する処理が行われる。例えば、測距点Aにおける最大の評価値R(=80)は、n=4での有効測距範囲で撮影された測距用画像において決定される。また、測距点Bにおける最大の評価値R(=80)は、n=1での有効測距範囲で撮影された測距用画像において決定される。つまり、測距点AとBとの間の長さを算出するために用いる測距用画像に関し、測距点Aについてはn=4の測距用画像から評価値が算出され、測距点Bについてはn=1の測距用画像から評価値が算出される。
測距点AとCとの位置関係について測距点AおよびCの各評価値を決定した具体例を表2に示す。

Figure 0007163025000002
In the example of FIG. 16, there is no distance measurement image in which the distance measurement points A and B are within the effective distance measurement range of one image. Therefore, the evaluation value R without focus movement cannot be determined, and processing is performed to determine only the evaluation value R with focus movement. For example, the maximum evaluation value R (=80) at the range-finding point A is determined in the range-finding image shot in the effective range-finding range with n=4. Also, the maximum evaluation value R (=80) at the range-finding point B is determined in the range-finding image shot in the effective range-finding range with n=1. That is, regarding the ranging image used to calculate the length between the ranging points A and B, the evaluation value for the ranging point A is calculated from n=4 ranging images. For B, the evaluation value is calculated from the n=1 distance measurement image.
Table 2 shows a specific example in which each evaluation value of the distance measuring points A and C is determined with respect to the positional relationship between the distance measuring points A and C.
Figure 0007163025000002

図16の例では、測距点AおよびCが1枚の画像の有効測距範囲内にある測距用画像は存在しない。そのため、ピント移動なしの評価値Rは決定されず、ピント移動ありの評価値Rのみを決定する処理が行われる。測距点Aにおける最大の評価値R(=80)は、n=4での有効測距範囲で撮影された測距用画像にて決定される。測距点Cはn=1に対応する有効測距範囲(1)、およびn=2に対応する有効測距範囲(2)に含まれるが、評価値を比較することで、R=80であるn=2の測距用画像に決定することができる。つまり、測距点AとCとの間の長さを算出するために用いる測距用画像に関し、測距点Aについてはn=4の測距用画像から評価値が算出され、測距点Cについてはn=2の測距用画像から評価値が算出される。
測距点BとCとの位置関係について測距点BおよびCの各評価値を決定した具体例を表3に示す。

Figure 0007163025000003
In the example of FIG. 16, there is no distance measurement image in which the distance measurement points A and C are within the effective distance measurement range of one image. Therefore, the evaluation value R without focus movement is not determined, and only the evaluation value R with focus movement is determined. The maximum evaluation value R (=80) at the ranging point A is determined from the ranging image shot in the effective ranging range with n=4. The distance measurement point C is included in the effective distance measurement range (1) corresponding to n=1 and the effective distance measurement range (2) corresponding to n=2. A certain n=2 ranging image can be determined. That is, regarding the ranging image used to calculate the length between the ranging points A and C, the evaluation value for the ranging point A is calculated from n=4 ranging images, and the ranging point As for C, an evaluation value is calculated from n=2 ranging images.
Table 3 shows a specific example in which each evaluation value of the distance measuring points B and C is determined with respect to the positional relationship between the distance measuring points B and C.
Figure 0007163025000003

図16の例では、測距点BおよびCが1枚の画像の有効測距範囲内にある測距用画像が存在する。ピント移動なしの評価値Rとピント移動ありの評価値Rの両方を決定することができる。測距点Bについては、ピント移動ありRについてもピント移動なしRについてもn=1での評価値Rが最大である。よって、測距点Bに使用する測距用画像としては、n=1の測距用画像に決定することができる。また測距点Cについては、ピント移動なしRの場合にはn=1で評価値が最大となり、ピント移動ありRの場合にはn=2で評価値が最大となる。このような場合、ピント移動ありRの場合の評価値の積と、ピント移動なしRの場合の評価値の積とを比較する処理が行われる。具体的には、ピント移動ありRの場合の評価値積をPAと表記すると、数式(16)のように算出される。
PA = 80 × 80 = 6400 ・・・(16)
一方、ピント移動なしRの場合の評価値積をPBと表記すると、数式(17)のように算出される。
PB = 90 × 80 = 7200 ・・・(17)
したがって、PB>PAとなることから、ピント移動なしRの評価値に基づいて、測距点Bと測距点Cに用いる測距用画像としては、n=1の測距用画像を使用することを決定できる。
In the example of FIG. 16, there is a distance measurement image in which the distance measurement points B and C are within the effective distance measurement range of one image. Both the evaluation value R without focus shift and the evaluation value R with focus shift can be determined. Regarding the distance measuring point B, the evaluation value R at n=1 is the maximum for both R with focus movement and R without focus movement. Therefore, as the image for distance measurement to be used for the distance measurement point B, the image for distance measurement with n=1 can be determined. For the distance measuring point C, the maximum evaluation value is obtained at n=1 in the case of R without focus movement, and the maximum evaluation value is obtained at n=2 in the case of R with focus movement. In such a case, a process of comparing the product of the evaluation values in the case of R with focus movement and the product of the evaluation values in the case of R without focus movement is performed. Specifically, if the evaluation value product in the case of R with focus shift is denoted by PA, it is calculated as shown in Equation (16).
PA = 80 x 80 = 6400 (16)
On the other hand, if the evaluation value product in the case of R without focus movement is denoted by PB, it is calculated as shown in Equation (17).
PB = 90 x 80 = 7200 (17)
Therefore, since PB>PA, the image for distance measurement with n=1 is used as the image for distance measurement used for distance measurement points B and C based on the evaluation value of no focus shift R. can decide.

次に、評価値に基づいて決定された測距用画像から、各測距点の三次元座標と2点間の長さを算出する処理について説明する。撮影情報取得部104により取得された撮影情報と、測距点選択部105によって選択された測距点と、測距用画像から求めたデフォーカス量DEFに基づいて、3次元空間での測距点の座標が算出される。この座標を(x,y,z)と表記し、数式(18)~(22)により算出できる。ただし、3次元座標系としては、射出瞳中心を光軸中心とし、デフォーカス量DEFがゼロである軸をz軸とする。
(h,v) = (hb,hv) × PY ・・・(18)
(H,V) = (h,v)× (1-DEF/L) ・・・(19)
(x,y) = (H,V)× |dist/(dist_d + DEF)|・・・(20)
dist = 1/(1/(dist_d+DEF) -1/f) ・・・(21)
z = length - dist ・・・(22)
各記号の意味は以下のとおりである。
(h,v):測距点の撮像センサ面上の座標
(hb,hv):測距点の画像上の座標
PY:画素ピッチ
L:瞳距離
(H,V):撮像センサ面上の座標(h,v)からデフォーカスされたxy平面における座標
dist:撮像装置のレンズにおける物主点から被写体までの距離
dist_d:撮像装置のレンズにおける像主点から撮像センサ面までの距離
f:撮像光学系の焦点距離
length:撮像装置の撮像センサ面から被写体までの距離(被写体距離)
Next, processing for calculating the three-dimensional coordinates of each ranging point and the length between two points from the ranging image determined based on the evaluation value will be described. Distance measurement in a three-dimensional space based on the shooting information acquired by the shooting information acquisition unit 104, the distance measurement point selected by the distance measurement point selection unit 105, and the defocus amount DEF obtained from the image for distance measurement. The coordinates of the point are calculated. These coordinates are expressed as (x, y, z) and can be calculated by formulas (18) to (22). However, as a three-dimensional coordinate system, the center of the exit pupil is the center of the optical axis, and the axis along which the defocus amount DEF is zero is the z-axis.
(h, v) = (hb, hv) x PY (18)
(H, V) = (h, v) × (1-DEF/L) (19)
(x, y) = (H, V) x |dist/(dist_d + DEF) | (20)
dist=1/(1/(dist_d+DEF)-1/f) (21)
z=length−dist (22)
The meaning of each symbol is as follows.
(h, v): Coordinates on image sensor surface of focus point (hb, hv): Coordinates on image of focus point PY: Pixel pitch L: Pupil distance (H, V): Coordinates on image sensor surface Coordinates on the xy plane defocused from (h, v) dist: Distance from the object principal point on the lens of the imaging device to the subject dist_d: Distance from the image principal point on the lens of the imaging device to the imaging sensor surface f: Imaging optics focal length of the system length: the distance from the imaging sensor surface of the imaging device to the subject (subject distance)

距離算出部109は、数式(18)から(22)を用いて、測距点(2点)の3次元座標(x,y,z)を算出する。ただし、測距点の座標を算出するための測距用画像が2点でそれぞれ異なる場合には、一方の測距用画像におけるz軸に対し、3次元座標(x,y,z)を平行移動する必要がある。平行移動後のz座標をznと表記し、平行移動前のz座標をzbと表記する、数式(23)からznが算出される。
zn= zb - (lengthA - lengthB)・・・(23)
The distance calculation unit 109 calculates the three-dimensional coordinates (x, y, z) of the distance measurement points (two points) using formulas (18) to (22). However, when the distance measurement images for calculating the coordinates of the distance measurement point are different for each of the two points, the three-dimensional coordinates (x, y, z) are parallel to the z-axis in one of the distance measurement images. need to move. zn is calculated from Equation (23), where the z-coordinate after translation is denoted as zn and the z-coordinate before translation is denoted as zb.
zn=zb-(lengthA-lengthB) (23)

数式(23)において、lengthAは平行移動させない方の測距用画像における被写体距離であり、lengthBは平行移動させる方の測距用画像における被写体距離である。被写体距離は、例えばレーザ測距部により、ピント位置までの距離情報を測定することが可能である。例えば、被写体距離を、複数枚の撮影画像のすべてについて画像ごとに取得する方法がある。また、距離情報(被写体距離)を任意の枚数の画像で取得する方法や、撮影時の焦点距離と、横倍率の比によって被写体距離を算出する方法がある。複数枚の画像すべてに対して被写体距離を測定する場合に比べて手間を省くことができる。具体的には、横倍率の比をD1:D2とし、焦点距離fの位置から被写体までの距離をDと表記する。距離Dを数式(24)によって算出できる。
D = ( D1 / D2 ) × f ・・・(24)
In equation (23), lengthA is the subject distance in the distance measurement image that is not translated, and lengthB is the subject distance in the distance measurement image that is translated. For the subject distance, distance information to the focus position can be measured by, for example, a laser rangefinder. For example, there is a method of acquiring the subject distance for each image for all of a plurality of captured images. Further, there is a method of obtaining distance information (subject distance) from an arbitrary number of images, and a method of calculating the subject distance from the ratio of the focal length at the time of shooting and the lateral magnification. This saves time and effort compared to measuring the object distance for all of the multiple images. Specifically, the ratio of the lateral magnifications is D1:D2, and the distance from the focal length f to the object is denoted by D. The distance D can be calculated by Equation (24).
D = (D1/D2) x f (24)

焦点距離fは、撮影時のレンズステート情報を撮像装置が読み出すことで取得可能である。被写体距離lengthAは、距離Dと焦点距離fとの和となるので、数式(25)によって算出できる。
lengthA = D + f ・・・(25)
測距点Aの3次元座標を(xa,ya,za)とし、測距点Bの3次元座標を(xb,yb,zb)とし、測距点Aから測距点Bまでの線分の長さをLENと表記する。LENは数式(26)によって算出される。
LEN
=√((xa-xb)^2+(ya-yb)^2+(za-zb)^2)・・・(26)
「^」はべき乗を表す。
The focal length f can be obtained by reading the lens state information at the time of photographing by the imaging device. Since the subject distance lengthA is the sum of the distance D and the focal length f, it can be calculated by Equation (25).
length A = D + f (25)
Let the three-dimensional coordinates of the ranging point A be (xa, ya, za), the three-dimensional coordinates of the ranging point B be (xb, yb, zb), and the line segment from the ranging point A to the ranging point B The length is denoted as LEN. LEN is calculated by Equation (26).
LEN
=√((xa-xb)^2+(ya-yb)^2+(za-zb)^2) (26)
"^" represents exponentiation.

以上により、評価値に基づいて決定された測距用画像から各測距点の三次元座標と2点間の長さを算出することができ、表示部110は計測結果である2点間の長さを表示する。 As described above, the three-dimensional coordinates of each ranging point and the length between the two points can be calculated from the image for ranging determined based on the evaluation value, and the display unit 110 displays the distance between the two points, which is the measurement result. Show length.

図17は、計測結果をユーザへ提示する場合の画面例を示す模式図である。図17(A)に示す表示画面1001には、被写体の奥行き方向において最も手前側に位置する2点間の測定距離が表示され、図17(B)に示す表示画面1002には、被写体の奥行き方向において側面部の2点間の測定距離が表示されている。これらの例では、指定された2点の位置、および2点間の長さが画面上に表示される。ユーザは、算出された測距点間の距離を容易に把握することができる。
本実施形態では、測距用画像ごとの各測距点での評価値に基づいて、3次元空間での2点間の長さの算出に使用する画像を自動的に選択し、より高精度な測距値を算出して提示することができる。
FIG. 17 is a schematic diagram showing an example of a screen when presenting the measurement results to the user. The display screen 1001 shown in FIG. 17A displays the measured distance between the two points closest to the subject in the depth direction, and the display screen 1002 shown in FIG. 17B displays the depth of the subject. The measured distance between two points on the side in direction is indicated. In these examples, the position of two specified points and the length between the two points are displayed on the screen. The user can easily grasp the calculated distance between the distance measuring points.
In this embodiment, an image to be used for calculating the length between two points in a three-dimensional space is automatically selected based on the evaluation value at each ranging point for each ranging image, resulting in higher accuracy. distance measurement value can be calculated and presented.

[第2実施形態]
次に、本発明の第2実施形態を説明する。瞳分割撮像方法を用いた奥行き方向の長さの計測においては、デフォーカス量や、撮像画像の輝度、コントラスト、SNR(信号対ノイズ比)、撮像装置から被写体までの距離によって、測距精度が影響を受ける。さらに、F値を小絞りにして基線長を短くすることにより被写界深度が深くなるので、ピント位置からの距離におけるデフォーカス量を小さくできる。このため、測距可能範囲を長くすることができる反面で、測距分解能が低くなってしまい、測距精度が低下する。このような理由から、被写体に対して指定した2点間の3次元空間での長さを、より高精度に計測するためには、同一の被写体に対して同じ画角でピント位置を変えて複数枚の画像を撮影するフォーカスブラケット撮影を行う必要がある。
[Second embodiment]
Next, a second embodiment of the invention will be described. In measuring the length in the depth direction using the split-pupil imaging method, the distance measurement accuracy varies depending on the amount of defocus, the brightness, contrast, SNR (signal-to-noise ratio) of the captured image, and the distance from the imaging device to the subject. to be influenced. Furthermore, since the depth of field is increased by setting the F-number to a small aperture and shortening the base line length, the defocus amount at the distance from the focus position can be reduced. For this reason, although the distance measurement range can be lengthened, the distance measurement resolution is lowered, and the distance measurement accuracy is lowered. For this reason, in order to more accurately measure the length in the three-dimensional space between two points specified for the subject, it is necessary to change the focus position with the same angle of view for the same subject. It is necessary to perform focus bracketing, in which multiple images are captured.

フォーカスブラケット撮影(以下、単にブラケット撮影ともいう)を行う場合、ブラケット数(撮影数)はフォーカス位置のとりうる範囲でいくらでも設定可能であるが、そのような方法は時間的な制約上、現実的ではない。そこで、あるピント位置での1回の撮影で取得可能な奥行き方向の距離範囲(以降、有効測距範囲という)に基づいて、追加の撮影方法を決定する必要がある。本実施形態では、有効測距範囲に基づいて、ブラケット撮影の撮影方法を決定する処理を説明する。なお、第1実施形態との相違点を主に説明し、第1実施形態と同様の事項については既に使用した符号を用いることによって、それらの詳細な説明を省略する。 When performing focus bracket photography (hereinafter also referred to simply as bracket photography), the number of brackets (number of shots) can be set as many as the focus position can take, but such a method is not realistic due to time constraints. is not. Therefore, it is necessary to determine an additional photographing method based on the range of distance in the depth direction that can be obtained by one photographing at a certain focus position (hereinafter referred to as the effective distance measurement range). In this embodiment, processing for determining the shooting method for bracket shooting based on the effective distance measurement range will be described. Differences from the first embodiment will be mainly described, and detailed descriptions thereof will be omitted by using the same reference numerals as those of the first embodiment.

図18は、本実施形態の画像計測装置100の構成例を示すブロック図である。図1との相違点は以下のとおりである。
・画像入力部102に代えて、撮像部1102が設けられていること。
・パラメータ設定部1104、有効測距範囲算出部1107、追加撮影方法決定部1108、撮影制御部1109が設けられていること。
それ以外の構成要素(図1の符号108から110参照)については第1実施形態と同じであるため、図示を省略する。
FIG. 18 is a block diagram showing a configuration example of the image measurement device 100 of this embodiment. Differences from FIG. 1 are as follows.
- An imaging unit 1102 is provided in place of the image input unit 102 .
- A parameter setting unit 1104, an effective ranging range calculation unit 1107, an additional imaging method determination unit 1108, and an imaging control unit 1109 are provided.
Other components (see reference numerals 108 to 110 in FIG. 1) are the same as those in the first embodiment, so illustration is omitted.

撮像部1102は瞳分割型撮像素子を備え、被写体を撮像して、制御部101からの制御指令にしたがって撮像画像データをメモリ103へ出力する。パラメータ設定部1104は、ユーザによって画像計測装置100へ入力された各パラメータ情報の設定処理を行い、制御部101からの制御指令にしたがって、設定データをメモリ103へ出力する。 The imaging unit 1102 has a split-pupil imaging device, images a subject, and outputs captured image data to the memory 103 in accordance with a control command from the control unit 101 . The parameter setting unit 1104 performs setting processing of each parameter information input to the image measurement apparatus 100 by the user, and outputs setting data to the memory 103 according to control commands from the control unit 101 .

撮影された画像に関連付けられた撮影時の撮影情報は、撮影情報取得部104が取得し、制御部101からの制御指令にしたがってメモリ103へ出力する。デフォーカス量算出部107はメモリ103に記憶された画像情報および撮影情報を読み出し、画像の座標ごとに対応するデフォーカス量を算出する。算出されたデフォーカス量は制御部101からの制御指令にしたがってメモリ103に保存される。 The photographing information at the time of photographing associated with the photographed image is obtained by the photographing information obtaining unit 104 and output to the memory 103 according to the control command from the control unit 101 . A defocus amount calculation unit 107 reads the image information and shooting information stored in the memory 103, and calculates the corresponding defocus amount for each coordinate of the image. The calculated defocus amount is stored in memory 103 according to a control command from control unit 101 .

有効測距範囲算出部1107は、メモリ103に保存された画像情報とパラメータ情報、撮影情報、デフォーカス量のデータを読み出し、画像の有効測距範囲を算出する。有効測距範囲算出部1107は、有効測距範囲決定処理を行って有効測距範囲のデータをメモリ103に保存する。追加撮影方法決定部1108は、メモリ103に保存されたデフォーカス量と有効測距範囲のデータを読み出し、追加撮影方法を決定する。決定された追加撮影方法のデータは、制御部101からの制御指令にしたがってメモリ103に保存される。撮影制御部1109は、メモリ103に保存された追加撮影方法のデータを読み出し、制御部101を介して撮像部1102の制御を行う。 An effective ranging range calculation unit 1107 reads image information, parameter information, shooting information, and defocus amount data stored in the memory 103, and calculates an effective ranging range of the image. The effective ranging range calculation unit 1107 performs effective ranging range determination processing and stores data of the effective ranging range in the memory 103 . An additional shooting method determination unit 1108 reads out the data of the defocus amount and the effective ranging range stored in the memory 103 and determines the additional shooting method. Data on the determined additional imaging method is stored in the memory 103 according to a control command from the control unit 101 . The imaging control unit 1109 reads the data of the additional imaging method stored in the memory 103 and controls the imaging unit 1102 via the control unit 101 .

図19のフローチャートを参照して、画像計測装置100の動作について詳細に説明する。まず、S1901において、パラメータ設定部1104は、画像計測装置100のパラメータの設定処理を行う。設定されるパラメータは、少なくとも下記の情報を含む。
(A)仮測距時の撮影条件(F値、ISO感度、シャッタ速度等)。
(B)必要な測距精度。
(C)ブラケット撮影枚数の上限値。
設定されたパラメータに基づいて、仮測距時の撮影条件を決定し、その結果と必要な測距精度、ブラケット撮影枚数の上限値に基づいて追加撮影方法を決定することが可能となる。
The operation of the image measurement device 100 will be described in detail with reference to the flowchart of FIG. First, in S<b>1901 , the parameter setting unit 1104 performs parameter setting processing for the image measuring apparatus 100 . The parameters to be set include at least the following information.
(A) Shooting conditions (F number, ISO sensitivity, shutter speed, etc.) at the time of provisional distance measurement.
(B) Required ranging accuracy.
(C) Upper limit of the number of bracket shots.
Based on the set parameters, it is possible to determine shooting conditions for provisional distance measurement, and to determine an additional shooting method based on the results, the required distance measurement accuracy, and the upper limit of the number of bracket shots.

S1902にて仮測距処理が実行される。仮測距の方法については、図20を用いて後述する。S1903では、S1902で算出された仮測距の結果に基づいて、ブラケット撮影方法が決定される。ブラケット撮影方法については図21を用いて後述する。S1904において、S1903で決定された方法でブラケット撮影が行われる。そして一連の処理を終了する。以下では、各処理について具体的に説明する。 In S1902, provisional ranging processing is executed. A method of provisional distance measurement will be described later with reference to FIG. 20 . In S1903, the bracket shooting method is determined based on the result of the temporary distance measurement calculated in S1902. The bracketing method will be described later with reference to FIG. 21 . In S1904, bracketing is performed by the method determined in S1903. Then, the series of processing ends. Each process will be specifically described below.

図20は、図19のS1902における仮測距の方法を説明するフローチャートである。S2001で撮像部1102は、図19のS1901で設定されたパラメータに基づいて、被写体を撮像する。S2002で撮影情報取得部104は、S2001で行った撮影時の撮影情報を取得する。撮像情報は、例えば、第1実施形態で示した(a)~(h)の情報である。撮像装置の焦点位置情報として撮像光学系の焦点距離および横倍率比が取得される。 FIG. 20 is a flow chart for explaining the temporary distance measurement method in S1902 of FIG. In S2001, the imaging unit 1102 images the subject based on the parameters set in S1901 of FIG. In S2002, the imaging information acquisition unit 104 acquires imaging information at the time of imaging performed in S2001. The imaging information is, for example, information (a) to (h) shown in the first embodiment. The focal length and lateral magnification ratio of the imaging optical system are acquired as focal position information of the imaging device.

S2003にてデフォーカス量算出部107は、S2002で取得した撮影情報に基づいて、S2001で撮像された画像に係るデフォーカス量を算出する。デフォーカス量の算出処理の詳細については、第1実施形態にて説明したとおりである。着目画素位置を1画素ずつずらしながら繰り返し計算することで、仮測距用として撮像された画像のデフォーカス量が算出される。 In S2003, the defocus amount calculation unit 107 calculates the defocus amount of the image captured in S2001 based on the shooting information acquired in S2002. The details of the defocus amount calculation process are as described in the first embodiment. The defocus amount of the image captured for provisional distance measurement is calculated by repeating the calculation while shifting the position of the pixel of interest by one pixel.

S2004にて制御部101は、S2003で算出されたデフォーカス量から実距離情報を算出する。画像内の各点における実距離をzと表記すると、これは数式(27)および(28)から算出できる。
dist = 1/(1/(dist_d+DEF) - 1/f) ・・・(27)
z = length - dist ・・・(28)
各記号の意味は以下に示すとおりである。
・dist:撮像部1102のレンズにおける物主点から被写体までの距離
・dist_d:撮像部1102のレンズにおける像主点から撮像センサ面までの距離
・f:撮像光学系の焦点距離
・length:画像計測装置100の撮像センサ面から被写体までの距離。
In S2004, the control unit 101 calculates actual distance information from the defocus amount calculated in S2003. Denoting the actual distance at each point in the image as z, it can be calculated from equations (27) and (28).
dist=1/(1/(dist_d+DEF)-1/f) (27)
z=length−dist (28)
The meaning of each symbol is as follows.
dist: distance from the object principal point of the lens of the imaging unit 1102 to the object dist_d: distance from the image principal point of the lens of the imaging unit 1102 to the imaging sensor surface f: focal length of the imaging optical system length: image measurement The distance from the imaging sensor plane of the device 100 to the subject.

距離lengthについては、例えばレーザ測距部により、ピント位置までの距離を測定する方法や、撮影時の焦点距離fと横倍率の比によって算出する方法がある。横倍率の比D1:D2と焦点距離fから、焦点距離fの位置から被写体までの距離Dを前記の数式(24)によって求めることができる。焦点距離fは、撮影時の焦点位置情報から取得可能である。距離lengthは、距離Dと焦点距離fとの和となるので、数式(29)によって求めることができる。
length = D + f ・・・(29)
S2004の後、リターン処理へ移行する。
As for the distance length, for example, there is a method of measuring the distance to the focus position using a laser distance measuring unit, and a method of calculating from the ratio between the focal length f and the lateral magnification at the time of photographing. From the lateral magnification ratio D1:D2 and the focal length f, the distance D from the position of the focal length f to the object can be obtained by the above equation (24). The focal length f can be obtained from focal position information at the time of shooting. Since the distance length is the sum of the distance D and the focal length f, it can be obtained by Equation (29).
length = D + f (29)
After S2004, the process proceeds to return processing.

次に、本実施形態のフォーカスブラケット撮影について説明する。図21はブラケット撮影方法を説明するためのフローチャートである。S2101にて有効測距範囲算出部1107は、取得したい距離の範囲を決定する。図22を用いて、ブラケット範囲を決定する方法について説明する。 Next, focus bracket photography according to this embodiment will be described. FIG. 21 is a flow chart for explaining the bracketing method. In S2101, the effective ranging range calculation unit 1107 determines the range of distance to be obtained. A method for determining the bracket range will be described with reference to FIG.

図22は、図19のS1902で取得された仮測距の結果を、画像における距離の分布としてヒストグラム化した図である。横軸は距離を表わし、縦軸は距離の分布量を表わす。距離分布2201は、背景と判断された画像部の距離分布量を示している。距離分布2201よりも手前(撮像部1102側)に位置する距離分布の範囲が、ブラケット範囲(フォーカスブラケット撮影範囲)として決定される。また、この方法以外に、顔領域等を認識する被写体認識部を備える装置では、さらに被写体認識結果を組み合わせてブラケット範囲を決定できる。例えば、被写体認識部により認識された被写体距離のヒストグラムに基づいて、認識された被写体の距離範囲がブラケット範囲として決定される。あるいは、所定の閾値以上の距離分布量を有する範囲をブラケット範囲として決定することもできる。ブラケット範囲については1つとは限らず、複数の範囲であってもよい。 FIG. 22 is a histogram of the results of the provisional distance measurement acquired in S1902 of FIG. 19 as a distance distribution in the image. The horizontal axis represents the distance, and the vertical axis represents the distribution of the distance. A distance distribution 2201 indicates the distance distribution amount of the image portion determined to be the background. The range of the distance distribution located in front of the distance distribution 2201 (on the imaging unit 1102 side) is determined as the bracket range (focus bracket imaging range). In addition to this method, in a device provided with a subject recognition unit that recognizes a face area or the like, the bracket range can be determined by further combining subject recognition results. For example, based on a histogram of subject distances recognized by the subject recognition unit, the distance range of the recognized subject is determined as the bracket range. Alternatively, a range having a distance distribution amount equal to or greater than a predetermined threshold can be determined as the bracket range. The number of bracketed ranges is not limited to one, and may be multiple ranges.

図21のS2102において、仮測距時に取得した画像データに係る信頼度が算出される。信頼度は、画像の輝度値、コントラスト、ノイズ推定量、ピント位置までの距離を評価することによって算出することができる。画像の輝度値については、仮測距時に撮影された画像のそれぞれの座標での近傍の画素の輝度値から平均値を算出することで輝度平均値が算出される。輝度平均値の評価値LMRに基づく再現性の信頼度については、図15(C)を用いて説明済みである。また、コントラストにかかわる分散値については、仮測距時に撮影した画像のそれぞれの座標での近傍の画素の分散値が算出される。分散値の評価値CNRに基づく再現性の信頼度については、図15(D)を用いて説明済みである。 In S2102 of FIG. 21, the reliability of the image data acquired during provisional distance measurement is calculated. Confidence can be calculated by evaluating the luminance value, contrast, noise estimate, and distance to the focus position of the image. As for the brightness value of the image, the brightness average value is calculated by calculating the average value from the brightness values of the neighboring pixels at each coordinate of the image captured during the provisional distance measurement. The reliability of reproducibility based on the evaluation value LMR of the luminance mean value has already been described with reference to FIG. 15(C). As for the variance value related to the contrast, the variance value of neighboring pixels at each coordinate of the image captured during the provisional distance measurement is calculated. The reliability of reproducibility based on the evaluation value CNR of the variance has already been described with reference to FIG. 15(D).

図23(A)は、画像のノイズ推定量に関する評価値を説明する図である。横軸はノイズ推定量を表わし、縦軸はノイズ推定量の評価値(NISと記す)を表わす。ノイズ推定量は撮影時のISO値に基づいて算出される。ISO値が大きくなるにつれてノイズ推定量が大きくなる。ノイズ推定量が大きい場合、コントラストが高くなってしまうため、分散値の評価値に影響を与えてしまう。また、ノイズの影響により、デフォーカス量の算出時においてA像とB像の対称性に影響を与える場合、測距精度が低下する可能性がある。 FIG. 23A is a diagram for explaining evaluation values relating to the noise estimation amount of an image. The horizontal axis represents the noise estimator, and the vertical axis represents the evaluation value (denoted as NIS) of the noise estimator. The noise estimation amount is calculated based on the ISO value at the time of shooting. The noise estimator increases as the ISO value increases. If the noise estimation amount is large, the contrast becomes high, which affects the evaluation value of the variance value. Also, if noise affects the symmetry of the A image and the B image when calculating the defocus amount, there is a possibility that the distance measurement accuracy will decrease.

図23(A)に示すように、評価値NISはノイズ推定量が大きくなるにつれて小さくなるように決定される。ノイズ推定量をnzと表記すると、評価値NISは下記式により算出される。
NIS = g1 - g2 × nz ・・・(30)
定数g1、g2はいずれも正値であり、任意に設定可能である。ノイズ推定量nzを評価しない場合は、
NIS = g3 ・・・(31)
とする。g3>0であり、g3の値は任意に設定可能である。
以上のように、ノイズ推定量nzが大きくなるにつれて、ノイズ推定量の評価値NISが小さくなる。これにより、ノイズに起因する測定誤差を低減できるので、より高精度な測距値を算出することが可能である。
As shown in FIG. 23A, the evaluation value NIS is determined to decrease as the noise estimation amount increases. Denoting the noise estimation amount as nz, the evaluation value NIS is calculated by the following equation.
NIS = g1 - g2 x nz (30)
Both constants g1 and g2 are positive values and can be set arbitrarily. If we do not evaluate the noise estimator nz,
NIS=g3 (31)
and g3>0, and the value of g3 can be set arbitrarily.
As described above, as the noise estimator nz increases, the noise estimator evaluation value NIS decreases. As a result, it is possible to reduce measurement errors caused by noise, so that it is possible to calculate a more accurate distance measurement value.

図23(B)はピント位置までの距離に関する評価値を説明する図である。横軸はピント位置までの距離pnを表わし、縦軸は評価値DISを表わす。距離pnについては、当該距離が大きくなるにつれて測距精度が低下する。測距精度は距離pnの二乗に反比例して低下する。図23(B)に示すように、評価値DISは距離pnが大きくなるにつれて小さくなるように決定される。評価値DISは、距離pnにより、下記式から算出される。
DIS = h1 - h2 × pn ・・・(32)
定数h1、h2はいずれも正値であり、任意に設定可能である。距離pnを評価しない場合には、
DIS = h3 ・・・(33)
とする。h3>0であり、h3の値は任意に設定可能である。
以上のように、距離pnが大きくなるにつれて評価値DISが小さくなる。これにより、ピント位置までの距離に起因する測定誤差を低減できるため、より高精度な測距値を算出することが可能である。
FIG. 23B is a diagram for explaining evaluation values relating to the distance to the focus position. The horizontal axis represents the distance pn to the focus position, and the vertical axis represents the evaluation value DIS. As for the distance pn, the accuracy of ranging decreases as the distance increases. Ranging accuracy decreases in inverse proportion to the square of the distance pn. As shown in FIG. 23B, the evaluation value DIS is determined to decrease as the distance pn increases. The evaluation value DIS is calculated from the following formula using the distance pn.
DIS = h1 - h2 x pn (32)
Both constants h1 and h2 are positive values and can be set arbitrarily. If we do not evaluate the distance pn, then
DIS=h3 (33)
and h3>0, and the value of h3 can be set arbitrarily.
As described above, the evaluation value DIS decreases as the distance pn increases. As a result, it is possible to reduce the measurement error caused by the distance to the focus position, so that it is possible to calculate a more accurate distance measurement value.

信頼度決定処理において信頼度Rpは、第1実施形態と同様に、各評価値の積から算出される。
Rp = LMR × CNR × NIS × DIS・・・(34)
LMR、CNR、NIS、DISの各評価値の値域が0~1となるようにパラメータを設定することで、信頼度Rpが正規化されて、0~1の範囲で表現される。各評価値、信頼度については、数式による算出方法の他に、パラメータテーブルを用いた算出方法がある。
In the reliability determination process, the reliability Rp is calculated from the product of each evaluation value, as in the first embodiment.
Rp = LMR x CNR x NIS x DIS (34)
Reliability Rp is normalized and expressed in the range of 0-1 by setting parameters so that the range of each evaluation value of LMR, CNR, NIS, and DIS is 0-1. As for each evaluation value and reliability, there is a calculation method using a parameter table in addition to a calculation method using a formula.

画素ごとに算出された信頼度は、最終的に距離別の信頼度に変換される。距離別の信頼度は、画素ごとに算出された距離情報が同じか、または距離情報の近い値を持つ画素群の信頼度を加算平均して算出される。これにより、特定の距離情報を持つ画素の信頼度を算出することができる。 The reliability calculated for each pixel is finally converted to the reliability for each distance. The reliability by distance is calculated by averaging the reliability of a group of pixels having the same distance information calculated for each pixel or having close values of distance information. This makes it possible to calculate the reliability of pixels having specific distance information.

図21のS2103にて、有効測距範囲算出部1107は有効測距範囲を算出する。図24を参照して具体例を説明する。本実施形態では、特定のピント位置にて1回の撮影で取得可能な奥行き方向の距離範囲が、有効測距範囲として算出される。 In S2103 of FIG. 21, the effective ranging range calculation unit 1107 calculates the effective ranging range. A specific example will be described with reference to FIG. In the present embodiment, a distance range in the depth direction that can be obtained in one shot at a specific focus position is calculated as the effective distance measurement range.

図24(A)は、横軸にピント位置からの距離をとり、縦軸に測距精度をとって、両者の関係を例示する模式図である。有効測距範囲算出部1107は、必要な測距精度に基づいて有効測距範囲決定処理を行う。関数曲線801は数式(35)のように決定される。
y = A × x^2 + C ・・・(35)
yは測距精度値を示し、Aは一対の測距瞳領域を通過する光束の重心の開き角の大きさに応じた変換係数から決定される係数を示す。xはピント位置からの距離を示し、CはS2102で算出した信頼度から算出される切片を示す。係数Aの値は撮像光学系のF値が小さくなるにつれて値が大きくなるように設定される。切片Cについては、信頼度が最も高い場合の切片(C1と記す)と、信頼度が最も低い場合の切片(C2と記す)と、信頼度(Rと記す)の関係から、数式(36)のように算出される。
C = C2 - (C2 - C1) × R ・・・(36)
FIG. 24A is a schematic diagram illustrating the relationship between the distance from the focus position on the horizontal axis and the distance measurement accuracy on the vertical axis. An effective ranging range calculation unit 1107 performs effective ranging range determination processing based on the required ranging accuracy. A function curve 801 is determined as in Equation (35).
y=A×x^2+C (35)
y indicates a distance measurement accuracy value, and A indicates a coefficient determined from a conversion coefficient corresponding to the magnitude of the open angle of the center of gravity of the light flux passing through the pair of distance measurement pupil regions. x indicates the distance from the focus position, and C indicates the intercept calculated from the reliability calculated in S2102. The value of coefficient A is set so that the value increases as the F-number of the imaging optical system decreases. Regarding the intercept C, from the relationship between the highest reliability intercept (denoted as C1), the lowest reliability intercept (denoted as C2), and the reliability (denoted as R), Equation (36) is calculated as
C=C2-(C2-C1)×R (36)

このように定義された関数曲線801に対して、ユーザが指定した必要な測距精度に基づいて有効測距範囲を算出可能である。つまり、有効測距範囲は、測距精度(y値)が指定された測距精度値以下である場合の距離範囲である。 For the function curve 801 defined in this way, the effective ranging range can be calculated based on the required ranging accuracy specified by the user. In other words, the effective ranging range is the range when the ranging accuracy (y value) is equal to or less than the designated ranging accuracy value.

図24(B)は、図24(A)で例示した関数曲線801に対して、別の関数曲線802を示す。関数曲線802は、F値が大きく、信頼度が低い場合の関数曲線の例である。図24(A)における必要な測距精度は、図24(B)でも同じ測距精度であるとする。この場合、関数曲線802における有効測距範囲は、図24(A)に示した有効測距範囲よりも狭くなることがわかる。このように、F値と信頼度に基づいて、必要な測距精度を満たす有効測距範囲を算出することができる。 FIG. 24(B) shows another function curve 802 for the function curve 801 illustrated in FIG. 24(A). A function curve 802 is an example of a function curve when the F value is large and the reliability is low. It is assumed that the required ranging accuracy in FIG. 24(A) is the same ranging accuracy in FIG. 24(B). In this case, it can be seen that the effective ranging range in the function curve 802 is narrower than the effective ranging range shown in FIG. 24(A). In this way, it is possible to calculate an effective ranging range that satisfies the required ranging accuracy based on the F-number and reliability.

図21のS2104において、ブラケット範囲を、S2103で算出された有効測距範囲で分割する処理が実行される。図25を参照して具体的に説明する。図25(A)において横軸は距離を表わし、縦軸は信頼度Rを示す。ブラケット範囲について、信頼度Rを最大値とした時の有効測距範囲で均等に分割した例である。 In S2104 of FIG. 21, a process of dividing the bracket range by the effective ranging range calculated in S2103 is executed. A specific description will be given with reference to FIG. In FIG. 25A, the horizontal axis represents the distance, and the vertical axis represents the reliability R. In FIG. This is an example in which the bracket range is evenly divided by the effective distance measurement range when the reliability R is the maximum value.

図25(A)に示す有効測距範囲901aは、ピント位置902aで撮影が行われた場合の有効測距範囲を示している。均等な分割を行った場合、信頼度Rを評価することによって低測距精度となってしまう領域が発生し得る。低測距精度の領域を、実線の矩形枠で示す。低測距精度の領域が発生する場合について、図25(B)を用いて説明する。 An effective range-finding range 901a shown in FIG. 25A indicates the effective range-finding range when shooting is performed at the focus position 902a. When even division is performed, an area where the reliability R is evaluated may result in low ranging accuracy. A region of low ranging accuracy is indicated by a solid-line rectangular frame. A case where an area with low ranging accuracy occurs will be described with reference to FIG. 25(B).

図25(B)は、横軸に示すピント位置からの距離と、縦軸に示す測距精度との関係を例示する。関数曲線901bは、信頼度Rを最高値とした場合の関数曲線である。関数曲線902bは、信頼度を考慮した場合の関数曲線であり、関数曲線901bよりも上側に位置している。関数曲線901bから算出される第1の有効測距範囲と、関数曲線902bから算出される第2の有効測距範囲とを比較すると、第1の有効測距範囲は、第2の有効測距範囲と、低測距精度となる領域とを含んでいることがわかる。つまり、第2の有効測距範囲の方が狭い。信頼度を評価することにより、ピント位置が同じでも有効測距範囲が狭くなっている。 FIG. 25B illustrates the relationship between the distance from the focus position shown on the horizontal axis and the ranging accuracy shown on the vertical axis. A function curve 901b is a function curve when the reliability R is the highest value. A function curve 902b is a function curve when reliability is considered, and is positioned above the function curve 901b. Comparing the first effective ranging range calculated from the function curve 901b and the second effective ranging range calculated from the function curve 902b, the first effective ranging range is the second effective ranging range. It can be seen that it includes a range and an area with low ranging accuracy. That is, the second effective ranging range is narrower. By evaluating the reliability, the effective distance measurement range is narrowed even if the focus position is the same.

図25(A)で示される例において、均等な分割のままでは十分な測距精度が得られない場合、さらに分割処理が実行される。例えば、測距精度が十分に得られない、信頼度Rを最高値とした時の有効測距範囲を、範囲903a,904a,905aに示す。これらの範囲についてはさらに分割される。 In the example shown in FIG. 25A, if sufficient distance measurement accuracy cannot be obtained with uniform division, further division processing is performed. For example, ranges 903a, 904a, and 905a indicate effective ranging ranges when the reliability R is set to the maximum value, in which sufficient ranging accuracy cannot be obtained. These ranges are further divided.

図26(A)は、図25(A)にて低測距精度となる領域を含む有効測距範囲を、等分に2分割した結果を示す。この例では、分割された領域について信頼度Rをさらに評価すると、低測距精度となる領域が存在する。よって領域をさらに等分に2分割し、低測距精度となる領域が存在しなくなるまで分割処理が繰り返される。最終的には、図26(B)に示すようなブラケット範囲の分割結果となり、低測距精度の領域は無くなる。 FIG. 26A shows the result of equally dividing the effective range-finding range including the area with low range-finding accuracy in FIG. 25A into two. In this example, when the reliability R is further evaluated for the divided areas, there are areas with low ranging accuracy. Therefore, the area is divided into two equal parts, and the division process is repeated until there is no area with low distance measurement accuracy. Ultimately, the result of dividing the bracketed range is as shown in FIG.

図26(C)は、図26(B)に示すようにブラケット範囲を有効測距範囲で分割したときのピント位置901e~911eと、距離ごとの信頼度を示す。分割後の各ピント位置で撮影を行うことにより、必要な測距精度を得ることができる。以上の処理は追加撮影方法決定部1108によって行われる。ブラケット範囲を有効測距範囲で分割して、測距精度を向上させることが可能であるが、低測距精度となる領域が存在しなくなるまで分割を繰り返す方法以外に、分割数を制限する方法がある。この場合、パラメータ設定部1104により設定されたブラケット数に基づいて分割数が制限される。ブラケット範囲のすべてについて必要な測距精度で取得することはできなくなるが、制限されたブラケット数以内で効率的なブラケット撮影方法の設定が可能である。 FIG. 26(C) shows the focus positions 901e to 911e when the bracket range is divided by the effective ranging range as shown in FIG. 26(B), and the reliability for each distance. The required distance measurement accuracy can be obtained by photographing at each focal position after division. The above processing is performed by the additional imaging method determination unit 1108 . It is possible to improve the accuracy of ranging by dividing the bracket range into the effective ranging range. There is In this case, the number of divisions is limited based on the number of brackets set by the parameter setting section 1104 . Although it becomes impossible to obtain the necessary distance measurement accuracy for the entire bracket range, it is possible to set an efficient bracket photography method within the limited number of brackets.

さらには、ブラケット範囲が非常に広くなってしまうときにブラケット数を優先したい場合がある。制限されたブラケット数でブラケット範囲をなるべく広く取得できるように数式(35),(36)を設定することにより、被写界深度を深くしてブラケット撮影が行われる。一方で、ブラケット範囲が非常に狭いときに測距精度を優先したい場合には、被写界深度を浅くしてブラケット撮影が行われる。 Furthermore, there are cases where it is desired to give priority to the number of brackets when the bracket range becomes very wide. By setting the equations (35) and (36) so that the bracket range can be acquired as wide as possible with the limited number of brackets, the depth of field is deepened and bracket photography is performed. On the other hand, when it is desired to give priority to distance measurement accuracy when the bracket range is very narrow, bracket photography is performed with a shallow depth of field.

本実施形態では、ブラケット範囲の均等分割では必要な測距精度を満たすことができず、低測距精度の領域が発生するという課題に対して、さらに分割処理が行われる。この場合、信頼度を評価せずに、徒に細かくピント位置を刻んで間隔を過剰に小さくすると、有効測距範囲同士の重複が発生して非効率である。またブラケット撮影の枚数が膨大になってしまう。そこで撮影制御部1109は、信頼度の評価結果に基づいて、図26(C)に示したピント位置でブラケット撮影を行うように制御する。必要な測距精度を満たし、かつ効率的なブラケット撮影が可能である。本実施形態によれば、信頼度を評価した有効測距範囲に基づいてブラケット撮影の撮影方法を決定することにより、任意の測距精度の条件を満たす距離情報を効率的に取得できる。 In this embodiment, the division processing is further performed to solve the problem that the required distance measurement accuracy cannot be satisfied by the equal division of the bracket range, and an area with low distance measurement accuracy is generated. In this case, if the interval is excessively reduced by finely chopping the focus positions without evaluating the reliability, the effective range-finding ranges overlap with each other, which is inefficient. In addition, the number of bracket shots becomes enormous. Therefore, the imaging control unit 1109 performs control so that bracket imaging is performed at the focus position shown in FIG. 26C based on the reliability evaluation result. It satisfies the required distance measurement accuracy and enables efficient bracket photography. According to this embodiment, it is possible to efficiently acquire distance information that satisfies arbitrary distance measurement accuracy conditions by determining the photographing method for bracket photography based on the effective distance measurement range whose reliability is evaluated.

前記実施形態では、複数の画像データに対応する距離情報として、異なる視点の画像データ対の像ずれ量またはデフォーカス量から各測距点に対応する距離情報を算出し、該距離情報を用いて、指定された測距点間の長さを算出する例を説明した。これに限らず、画像の領域ごとに各ピント位置での画像データ対、つまり視差画像データ対の像ずれ量に基づいて、どの視差画像データ対を使って得られる距離情報を使用するのかを予め決めておく実施形態に適用できる。この場合、画像の各領域について距離情報の算出が1回で済むので、処理の簡単化および高速化に好適である。 In the above embodiment, as distance information corresponding to a plurality of image data, distance information corresponding to each distance measurement point is calculated from the image shift amount or defocus amount of image data pairs from different viewpoints, and the distance information is used to , the example of calculating the length between the specified distance measurement points has been described. Not limited to this, based on the image data pair at each focus position for each region of the image, that is, the image shift amount of the parallax image data pair, which parallax image data pair is used to use the distance information is determined in advance. It can be applied to the embodiment to be determined. In this case, the distance information is calculated only once for each area of the image, which is suitable for simplification and speeding up of processing.

[その他の実施形態]
本発明は、上述の実施形態の1以上の機能を実現するプログラムを、ネットワーク又は記憶媒体を介してシステム又は装置に供給し、そのシステム又は装置のコンピュータにおける1つ以上のプロセッサーがプログラムを読出し実行する処理でも実現可能である。また、1以上の機能を実現する回路(例えば、ASIC)によっても実現可能である。
[Other embodiments]
The present invention supplies a program that implements one or more functions of the above-described embodiments to a system or device via a network or a storage medium, and one or more processors in the computer of the system or device reads and executes the program. It can also be realized by processing to It can also be implemented by a circuit (for example, ASIC) that implements one or more functions.

100 画像計測装置
101 制御部
102 画像入力部
104 撮影情報取得部
105 測距点選択部
106 対応点探索部
107 デフォーカス量算出部
108 評価値決定部
109 測距点間距離算出部
REFERENCE SIGNS LIST 100 Image measurement device 101 Control unit 102 Image input unit 104 Shooting information acquisition unit 105 Focus point selection unit 106 Corresponding point search unit 107 Defocus amount calculation unit 108 Evaluation value determination unit 109 Inter-focus point distance calculation unit

Claims (22)

複数のピント位置で、かつ異なる視点でそれぞれ撮像された複数の画像データを取得する第1の取得手段と、
各ピント位置での異なる視点の画像データ対を用いて被写体の像ずれ量またはデフォーカス量を取得する第2の取得手段と、
前記画像データにおける複数の測距点を指定する指定手段と、
前記第2の取得手段により取得された像ずれ量またはデフォーカス量から前記指定手段により指定された各測距点に対応する第1の距離情報を算出し、該第1の距離情報を用いて、画像の奥行き方向を含む3次元空間における指定された前記測距点間の長さを算出する算出手段と、
前記複数の画像データにおける前記指定手段により指定された各測距点に対応する信頼度を決定する信頼度決定手段と、を備え、
前記算出手段は、前記信頼度決定手段により決定された前記信頼度を用いて選択された画像データにおける前記測距点の前記第1の距離情報から前記測距点間の長さを算出する
ことを特徴とする画像計測装置。
a first acquisition means for acquiring a plurality of image data captured at a plurality of focus positions and from different viewpoints;
a second acquisition means for acquiring an image shift amount or defocus amount of a subject using image data pairs from different viewpoints at each focus position;
designating means for designating a plurality of distance measuring points in the image data;
calculating first distance information corresponding to each distance measuring point specified by the specifying means from the image shift amount or the defocus amount acquired by the second acquiring means, and using the first distance information; , calculating means for calculating the length between the specified distance measuring points in a three-dimensional space including the depth direction of the image;
a reliability determining means for determining a reliability corresponding to each ranging point specified by the specifying means in the plurality of image data;
The calculation means calculates the length between the distance measurement points from the first distance information of the distance measurement points in the selected image data using the reliability determined by the reliability determination means. An image measurement device characterized by:
前記指定手段は、操作手段により前記測距点を指定し、または前記画像の特徴点を検出して前記測距点を指定する
ことを特徴とする請求項1に記載の画像計測装置。
2. The image measuring apparatus according to claim 1, wherein said designating means designates said distance measuring point by operating means, or designates said distance measuring point by detecting characteristic points of said image.
前記信頼度決定手段は、前記複数の画像データにおける前記測距点について算出される画像間のピントの移動量、像ずれ量もしくはデフォーカス量、輝度値、または画素の分散値のうちの1つ以上により前記信頼度を決定する
ことを特徴とする請求項1または請求項2に記載の画像計測装置。
The reliability determination means is one of a focus shift amount between images, an image shift amount or defocus amount, a luminance value, or a pixel variance value calculated for the range-finding points in the plurality of image data. The image measuring apparatus according to claim 1 or 2, wherein the reliability is determined by the above.
複数のピント位置で、かつ異なる視点でそれぞれ撮像された複数の画像データを取得する第1の取得手段と、
レーザ測距によって被写体の第2の距離情報を取得する第2の取得手段と、
前記画像データにおける複数の測距点を指定する指定手段と、
前記画像データにおける各測距点に対応する前記第2の距離情報を算出し、該第2の距離情報を用いて、画像の奥行き方向を含む3次元空間における指定された前記測距点間の長さを算出する算出手段と、
前記複数の画像データにおける前記測距点に対応する信頼度を決定する信頼度決定手段と、を備え、
前記算出手段は、前記信頼度決定手段により決定された前記信頼度を用いて選択された画像データにおける前記測距点の前記第2の距離情報から前記測距点間の長さを算出する
ことを特徴とする画像計測装置。
a first acquisition means for acquiring a plurality of image data captured at a plurality of focus positions and from different viewpoints;
a second obtaining means for obtaining second distance information of a subject by laser ranging;
designating means for designating a plurality of distance measuring points in the image data;
calculating the second distance information corresponding to each distance measuring point in the image data, and using the second distance information, between the specified distance measuring points in a three-dimensional space including the depth direction of the image; a calculating means for calculating the length;
reliability determining means for determining reliability corresponding to the distance measuring point in the plurality of image data;
The calculation means calculates the length between the distance measurement points from the second distance information of the distance measurement points in the selected image data using the reliability determined by the reliability determination means. An image measurement device characterized by:
複数のピント位置で、かつ異なる視点でそれぞれ撮像された複数の画像データを取得する第1の取得手段と、
撮像光学系の焦点距離と、横倍率の比を用いて算出される被写体の第3の距離情報を取得する第2の取得手段と、
前記画像データにおける複数の測距点を指定する指定手段と、
前記画像データにおける各測距点に対応する前記第3の距離情報を算出し、該第3の距離情報を用いて、画像の奥行き方向を含む3次元空間における指定された前記測距点間の長さを算出する算出手段と、
前記複数の画像データにおける前記測距点に対応する信頼度を決定する信頼度決定手段と、を備え、
前記算出手段は、前記信頼度決定手段により決定された前記信頼度を用いて選択された画像データにおける前記測距点の前記第3の距離情報から前記測距点間の長さを算出する
ことを特徴とする画像計測装置。
a first acquisition means for acquiring a plurality of image data captured at a plurality of focus positions and from different viewpoints;
a second acquisition means for acquiring third distance information of a subject calculated using the focal length of the imaging optical system and the ratio of the lateral magnification;
designating means for designating a plurality of distance measuring points in the image data;
calculating the third distance information corresponding to each distance measuring point in the image data, and using the third distance information, between the designated distance measuring points in a three-dimensional space including the depth direction of the image; a calculating means for calculating the length;
reliability determining means for determining reliability corresponding to the distance measuring point in the plurality of image data;
The calculation means calculates the length between the distance measurement points from the third distance information of the distance measurement points in the selected image data using the reliability determined by the reliability determination means. An image measurement device characterized by:
ント位置が対応する1対の画像データを用いて有効測距範囲を決定する範囲決定手段と、
前記画像データにおける距離の分布を示す第4の距離情報および前記有効測距範囲から、撮像手段により追加で撮影する際の撮影方法を決定する撮影方法決定手段と、
決定された前記撮影方法にしたがって前記撮像手段による撮像を制御する制御手段と、をさらに備え
前記第1の取得手段は、前記制御手段によって制御された撮像により前記複数のピント位置で、かつ異なる視点でそれぞれ撮像された複数の画像データを取得する
ことを特徴とする請求項1から3のいずれか1項に記載の画像計測装置。
Range determination means for determining an effective ranging range using a pair of image data corresponding to focus positions;
a photographing method determining means for determining a photographing method for additional photographing by the photographing means from fourth distance information indicating the distribution of distances in the image data and the effective ranging range;
a control means for controlling imaging by the imaging means according to the determined imaging method ,
The first acquisition means acquires a plurality of image data captured at the plurality of focus positions and at different viewpoints by imaging controlled by the control means.
The image measuring device according to any one of claims 1 to 3, characterized in that:
前記範囲決定手段は、画像の輝度値、コントラスト、ノイズ推定量、または前記撮像手段からピント位置までの距離のうちの1つ以上を用いて、前記有効測距範囲を決定する
ことを特徴とする請求項6に記載の画像計測装置。
The range determination means determines the effective ranging range using one or more of the luminance value, contrast, noise estimation amount of the image, or the distance from the imaging means to the focus position. The image measuring device according to claim 6.
前記撮影方法決定手段は、前記第4の距離情報のヒストグラムを用いて前記撮影方法を決定する
ことを特徴とする請求項6またはに記載の画像計測装置。
8. The image measuring apparatus according to claim 6 , wherein said photographing method determining means determines said photographing method using a histogram of said fourth distance information .
前記撮影方法決定手段は、前記ヒストグラムにて背景に対応する距離分布よりも前記撮像手段の側に位置する距離分布の範囲を撮影範囲に決定する
ことを特徴とする請求項に記載の画像計測装置。
9. The image measurement method according to claim 8 , wherein said imaging method determining means determines, as an imaging range, a range of distance distribution located closer to said imaging means than a distance distribution corresponding to a background in said histogram. Device.
前記画像データにおける被写体を認識する認識手段をさらに備え、
前記撮影方法決定手段は、前記ヒストグラムにて前記認識手段により認識された被写体の距離分布の範囲を撮影範囲に決定する
ことを特徴とする請求項に記載の画像計測装置。
further comprising recognition means for recognizing a subject in the image data;
9. The image measuring apparatus according to claim 8 , wherein said photographing method determining means determines a range of distance distribution of the subject recognized by said recognizing means in said histogram as a photographing range.
前記撮影方法決定手段は、前記ヒストグラムにて距離分布量が閾値以上である範囲を撮影範囲に決定する
ことを特徴とする請求項に記載の画像計測装置。
9. The image measuring apparatus according to claim 8 , wherein the photographing method determining means determines a range in which the distance distribution amount is equal to or greater than a threshold in the histogram as the photographing range.
前記撮影方法決定手段は、撮影範囲を前記有効測距範囲により分割して複数の撮影を行う撮影方法を決定する
ことを特徴とする請求項6または7に記載の画像計測装置。
8. The image measuring apparatus according to claim 6 , wherein said photographing method determining means determines a photographing method for performing a plurality of photographing operations by dividing a photographing range by said effective distance measurement range.
前記撮影方法決定手段は、被写界深度を変更して撮影方法を決定する
ことを特徴とする請求項12に記載の画像計測装置。
13. The image measuring apparatus according to claim 12 , wherein the imaging method determining means determines the imaging method by changing the depth of field.
前記撮影方法決定手段は、撮影数を優先する場合に測距精度を優先する場合に比べて被写界深度を深くする撮影方法に決定する
ことを特徴とする請求項13に記載の画像計測装置。
14. The image measurement apparatus according to claim 13 , wherein the photographing method determination unit determines a photographing method that makes the depth of field deeper when giving priority to the number of shots compared to when giving priority to distance measurement accuracy. .
前記算出手段によって算出された前記測距点間の長さを表示する表示手段を備える
ことを特徴とする請求項1から14のいずれか1項に記載の画像計測装置。
The image measuring apparatus according to any one of claims 1 to 14 , further comprising display means for displaying the distance between the distance measuring points calculated by the calculating means.
請求項1から15のいずれか1項に記載の画像計測装置と、
撮像手段と、を備える撮像装置。
The image measuring device according to any one of claims 1 to 15 ;
an imaging device comprising: imaging means;
前記撮像手段は、複数のマイクロレンズと、各マイクロレンズに対応する複数の光電変換部を備え、
前記第1の取得手段は、撮像光学系の異なる瞳部分領域をそれぞれ通過する光束を前記複数の光電変換部が受光して光電変換した信号により、前記複数の画像データを取得する
ことを特徴とする請求項16に記載の撮像装置。
The imaging means includes a plurality of microlenses and a plurality of photoelectric conversion units corresponding to each microlens,
The first obtaining means obtains the plurality of image data based on signals obtained by photoelectrically converting the light beams passing through different pupil partial regions of the imaging optical system and receiving them by the plurality of photoelectric conversion units. 17. The imaging device according to claim 16 .
前記算出手段は算出した前記測距点間の長さのデータを表示部に出力する
ことを特徴とする請求項16または17に記載の撮像装置。
18. The imaging apparatus according to claim 16 , wherein the calculating means outputs data of the calculated length between the distance measuring points to a display unit.
画像データを取得して計測処理を行う画像計測装置にて実行される画像計測方法であって、
複数のピント位置で、かつ異なる視点でそれぞれ撮像された、複数の画像データを取得するとともに、各ピント位置での異なる視点の画像データ対を用いて被写体の像ずれ量またはデフォーカス量を取得する工程と、
前記画像データにおける複数の測距点を指定する工程と、
前記複数の画像データにおける指定された各測距点に対応する信頼度を決定する工程と、
前記像ずれ量またはデフォーカス量から指定された各測距点に対応する第1の距離情報を算出し、該第1の距離情報を用いて、画像の奥行き方向を含む3次元空間における指定された前記測距点間の長さを算出する算出工程と、を有し、
前記算出工程では、決定された前記信頼度を用いて選択された画像データにおける前記測距点の前記第1の距離情報から前記測距点間の長さが算出される
ことを特徴とする画像計測方法。
An image measuring method executed by an image measuring device that acquires image data and performs measurement processing,
Acquiring a plurality of image data captured at a plurality of focus positions and from different viewpoints, and acquiring the image shift amount or defocus amount of the subject using the image data pairs from the different viewpoints at each focus position. process and
designating a plurality of ranging points in the image data;
determining a reliability corresponding to each designated ranging point in the plurality of image data;
First distance information corresponding to each designated distance measuring point is calculated from the image shift amount or the defocus amount, and the first distance information is used to calculate the designated distance in a three-dimensional space including the depth direction of the image. and a calculating step of calculating the length between the distance measuring points,
wherein, in the calculating step, a length between the distance measuring points is calculated from the first distance information of the distance measuring points in the selected image data using the determined reliability. measurement method.
画像データを取得して計測処理を行う画像計測装置にて実行される画像計測方法であって、
複数のピント位置で、かつ異なる視点でそれぞれ撮像された複数の画像データを取得、レーザ測距によって被写体の第2の距離情報を取得する工程と、
前記画像データにおける複数の測距点を指定する工程と、
前記複数の画像データにおける前記測距点に対応する信頼度を決定する工程と、
前記画像データにおける各測距点に対応する前記第2の距離情報を算出し、該第2の距離情報を用いて、画像の奥行き方向を含む3次元空間における指定された前記測距点間の長さを算出する算出工程と、を有し、
前記算出工程では、決定された前記信頼度を用いて選択された画像データにおける前記測距点の前記第2の距離情報から前記測距点間の長さが算出される
ことを特徴とする画像計測方法。
An image measuring method executed by an image measuring device that acquires image data and performs measurement processing,
a step of acquiring a plurality of image data captured at a plurality of focus positions and at different viewpoints, and acquiring second distance information of the subject by laser ranging;
designating a plurality of ranging points in the image data;
determining a reliability corresponding to the ranging point in the plurality of image data;
calculating the second distance information corresponding to each distance measuring point in the image data, and using the second distance information, between the specified distance measuring points in a three-dimensional space including the depth direction of the image; a calculating step of calculating the length,
In the calculating step, a length between the distance measuring points is calculated from the second distance information of the distance measuring points in the selected image data using the determined reliability. measurement method.
画像データを取得して計測処理を行う画像計測装置にて実行される画像計測方法であって、
複数のピント位置で、かつ異なる視点でそれぞれ撮像された複数の画像データを取得、撮像光学系の焦点距離と、横倍率の比を用いて算出される被写体の第3の距離情報を取得する工程と、
前記画像データにおける複数の測距点を指定する工程と、
前記複数の画像データにおける前記測距点に対応する信頼度を決定する工程と、
前記画像データにおける各測距点に対応する前記第3の距離情報を算出し、該第3の距離情報を用いて、画像の奥行き方向を含む3次元空間における指定された前記測距点間の長さを算出する算出工程と、を有し、
前記算出工程では、決定された前記信頼度を用いて選択された画像データにおける前記測距点の前記第3の距離情報から前記測距点間の長さが算出される
ことを特徴とする画像計測方法。
An image measuring method executed by an image measuring device that acquires image data and performs measurement processing,
A plurality of image data captured at a plurality of focus positions and at different viewpoints are acquired , and third distance information of the subject calculated using the ratio of the focal length of the imaging optical system and the lateral magnification is acquired. process and
designating a plurality of ranging points in the image data;
determining a reliability corresponding to the ranging point in the plurality of image data;
calculating the third distance information corresponding to each distance measuring point in the image data, and using the third distance information, between the designated distance measuring points in a three-dimensional space including the depth direction of the image; a calculating step of calculating the length,
wherein, in the calculating step, a length between the distance measuring points is calculated from the third distance information of the distance measuring points in the selected image data using the determined reliability. measurement method.
請求項19から21のいずれか1項に記載の各工程を画像計測装置のコンピュータに実行させるためのプログラム。
A program for causing a computer of an image measuring device to execute each step according to any one of claims 19 to 21 .
JP2017253584A 2017-09-28 2017-12-28 Image measuring device, image measuring method, imaging device, program Active JP7163025B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US16/138,136 US11004229B2 (en) 2017-09-28 2018-09-21 Image measurement device, image measurement method, imaging device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2017188390 2017-09-28
JP2017188390 2017-09-28

Publications (2)

Publication Number Publication Date
JP2019066451A JP2019066451A (en) 2019-04-25
JP7163025B2 true JP7163025B2 (en) 2022-10-31

Family

ID=66337843

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017253584A Active JP7163025B2 (en) 2017-09-28 2017-12-28 Image measuring device, image measuring method, imaging device, program

Country Status (1)

Country Link
JP (1) JP7163025B2 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7451120B2 (en) * 2019-09-20 2024-03-18 キヤノン株式会社 Image processing device, image processing method, imaging device, program
TWI709725B (en) * 2019-12-03 2020-11-11 阿丹電子企業股份有限公司 Volume measuring apparatus and volume measuring method for boxes
CN111473767B (en) * 2020-04-16 2022-10-25 福建汇川物联网技术科技股份有限公司 Remote distance measurement method and device
US11763491B2 (en) * 2020-10-21 2023-09-19 Faro Technologies, Inc. Compensation of three-dimensional measuring instrument having an autofocus camera
CN113470103B (en) * 2021-06-29 2023-11-24 阿波罗智联(北京)科技有限公司 Method and device for determining camera acting distance in vehicle-road cooperation and road side equipment
CN116934602B (en) * 2022-04-02 2026-03-06 北京字跳网络技术有限公司 Camera focal length estimation methods and related equipment
CN115876162B (en) * 2022-12-23 2025-08-12 东莞市兆丰精密仪器有限公司 Image measurement method, computing device and computer readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011232330A (en) 2010-04-08 2011-11-17 Casio Comput Co Ltd Imaging apparatus, distance measuring method, and program
JP2016156934A (en) 2015-02-24 2016-09-01 キヤノン株式会社 Distance information generation device, imaging device, distance information generation method, and distance information generation program

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011232330A (en) 2010-04-08 2011-11-17 Casio Comput Co Ltd Imaging apparatus, distance measuring method, and program
JP2016156934A (en) 2015-02-24 2016-09-01 キヤノン株式会社 Distance information generation device, imaging device, distance information generation method, and distance information generation program

Also Published As

Publication number Publication date
JP2019066451A (en) 2019-04-25

Similar Documents

Publication Publication Date Title
JP7163025B2 (en) Image measuring device, image measuring method, imaging device, program
US9208396B2 (en) Image processing method and device, and program
CN102771128B (en) A kind of method and system of stereo-picture of the improvement for obtaining target
US11004229B2 (en) Image measurement device, image measurement method, imaging device
US20070189750A1 (en) Method of and apparatus for simultaneously capturing and generating multiple blurred images
CN109883391B (en) Monocular distance measurement method based on digital imaging of microlens array
JP6071257B2 (en) Image processing apparatus, control method therefor, and program
JP7378219B2 (en) Imaging device, image processing device, control method, and program
JPWO2011125937A1 (en) Calibration data selection device, selection method, selection program, and three-dimensional position measurement device
CN105306922A (en) Method and device for obtaining depth camera reference diagram
KR101715553B1 (en) Focus position detection device, focus position detection method and a computer program for focus position detection
JP2016024052A (en) Three-dimensional measurement system, three-dimensional measurement method and program
JP2010117593A (en) Device for acquiring distance information, imaging apparatus, and program
US20040184656A1 (en) Method for measuring object based on image and photographing apparatus
US5913082A (en) Image signal processing apparatus
JP2013037166A (en) Focus detector, and lens device and imaging device having the same
JP6411188B2 (en) Stereo matching device, stereo matching program, and stereo matching method
JP2020106502A (en) Shape measuring device, control method and program
US11790600B2 (en) Image processing device, imaging apparatus, image processing method, and recording medium
US11468586B2 (en) Three-dimensional measurement apparatus, image capturing apparatus, control method, and recording medium
US20240257490A1 (en) Focal position estimation method, focal position estimation system, model generation method, model generation system, focal position estimation model, and non-transitory computer-readable storage medium
CN115086628B (en) Learning method and image processing device
JP2020139800A (en) Three-dimensional measuring device
Kuhl et al. Monocular 3D scene reconstruction at absolute scales by combination of geometric and real-aperture methods
CN120558114B (en) Single-lens three-dimensional optical measurement method, single-lens three-dimensional optical measurement device, computer equipment and medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20201207

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20211013

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20211026

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20211214

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20220125

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20220425

C60 Trial request (containing other claim documents, opposition documents)

Free format text: JAPANESE INTERMEDIATE CODE: C60

Effective date: 20220425

A911 Transfer to examiner for re-examination before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20220511

C21 Notice of transfer of a case for reconsideration by examiners before appeal proceedings

Free format text: JAPANESE INTERMEDIATE CODE: C21

Effective date: 20220517

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20220802

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20220905

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20221019

R151 Written notification of patent or utility model registration

Ref document number: 7163025

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151