JP2019184568A - Parallax detection device, distance detection device, robot device, parallax detection method, distance detection method and program - Google Patents

Parallax detection device, distance detection device, robot device, parallax detection method, distance detection method and program Download PDF

Info

Publication number
JP2019184568A
JP2019184568A JP2018210864A JP2018210864A JP2019184568A JP 2019184568 A JP2019184568 A JP 2019184568A JP 2018210864 A JP2018210864 A JP 2018210864A JP 2018210864 A JP2018210864 A JP 2018210864A JP 2019184568 A JP2019184568 A JP 2019184568A
Authority
JP
Japan
Prior art keywords
image
parallax
pattern light
reference image
correlation value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2018210864A
Other languages
Japanese (ja)
Other versions
JP2019184568A5 (en
Inventor
聖雄 池本
Masao Ikemoto
聖雄 池本
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/364,987 priority Critical patent/US20190301855A1/en
Publication of JP2019184568A publication Critical patent/JP2019184568A/en
Publication of JP2019184568A5 publication Critical patent/JP2019184568A5/ja
Pending legal-status Critical Current

Links

Landscapes

  • Measurement Of Optical Distance (AREA)
  • Image Analysis (AREA)

Abstract

To provide a parallax detection device that can reduce calculation errors upon calculating an amount of parallax using images with periodicity.SOLUTION: A parallax detection device comprises: acquisition means that acquires a pair of images having parallax; correlation calculation means that sets a reference image on one image of the pair of images, and calculates a correlation value of the pair of images on the basis of the reference image; and parallax calculation means that calculates an amount of parallax of the pair of images using the correlation value. The correlation calculation means is configured to: set a first reference image on the one image of the pair of images; calculate a first correlation value on the basis of the first reference image; set a second reference image at a position different from that of the first reference image in a prescribed direction on the one image of the pair of images; and calculate a second correlation value on the basis of the second reference image. The parallax calculation means is configured to calculate the amount of parallax using the first correlation value and the second correlation value.SELECTED DRAWING: Figure 1

Description

本発明は、視差検出装置、距離検出装置、ロボット装置、視差検出方法、距離検出方法及びプログラムに関する。   The present invention relates to a parallax detection device, a distance detection device, a robot device, a parallax detection method, a distance detection method, and a program.

被写体の撮影画像を取得し、撮影画像から被写体に対する距離情報を算出する手法が提案されている。このような手法の一例として、異なる視点からの画像を含む画像組を取得し、各画像間の相関値(類似度ともいう)から視差量を求め、距離情報を取得する手法がある。   There has been proposed a method of acquiring a captured image of a subject and calculating distance information with respect to the subject from the captured image. As an example of such a method, there is a method of acquiring distance information by acquiring image sets including images from different viewpoints, obtaining a parallax amount from a correlation value (also referred to as similarity) between the images.

具体的には、まず、画像組の片方の画像において注目画素を含む部分領域の画像信号を基準画像として抜き出す。次に、他方の画像における部分領域の画像信号を参照画像として抜き出す。その後、参照画像を抜き出す画像上の位置を変えながら、基準画像と各位置における参照画像の相関値を算出(相関演算)する。算出された基準画像と各位置における参照画像との相関値において最も相関値が高くなる位置を求めることで、注目画素における視差量を算出することができる。その後、視差量を既知の手法により距離情報に変換することで、被写体の距離情報を算出することができる。   Specifically, first, an image signal of a partial region including the target pixel in one image of the image set is extracted as a reference image. Next, the image signal of the partial area in the other image is extracted as a reference image. Thereafter, the correlation value between the reference image and the reference image at each position is calculated (correlation calculation) while changing the position on the image from which the reference image is extracted. The parallax amount at the target pixel can be calculated by obtaining the position where the correlation value is highest in the correlation value between the calculated standard image and the reference image at each position. Thereafter, the distance information of the subject can be calculated by converting the parallax amount into distance information by a known method.

しかしながら、撮影画像中に模様の乏しい領域があると、画像信号のコントラストが低下し、相関演算による視差量の算出ができず、距離情報の算出(測距)ができなくなることがある。これに対して、特許文献1では、パターン光の投影を併用して撮影画像の取得を行うことで、このような領域の測距を可能にする手法が提案されている。   However, if there is a region with a poor pattern in the captured image, the contrast of the image signal decreases, the amount of parallax cannot be calculated by correlation calculation, and distance information cannot be calculated (ranging). On the other hand, Patent Document 1 proposes a technique that enables distance measurement of such an area by acquiring a captured image using pattern light projection.

特許5803065号公報Japanese Patent No. 5803305

しかしながら、パターン光を投影して撮影した画像を用いて測距を行う場合、撮影画像の画素値が大きく変化する領域(投影パターンの明領域と暗領域の境界部)と基準画像の端部とが重なる状態で視差量を算出すると、算出される視差量に誤差が発生する。この場合には、視差量に誤差が発生していることに起因して、視差量を変換して求められる距離情報にも誤差が生じる。特に、高輝度領域と低輝度領域が交互に並ぶラインパターンなどの周期性を有するパターン光を投影して測距を行うとき、この誤差が顕著となる。なお、この視差量の算出誤差は、周期性がある模様を有する被写体の撮影画像を用いて視差量を求める場合にも、同様に生じる場合がある。   However, when distance measurement is performed using an image captured by projecting pattern light, an area where the pixel value of the captured image changes greatly (a boundary between a bright area and a dark area of the projection pattern) and an end of the reference image If the amount of parallax is calculated in a state where the two overlap, an error occurs in the calculated amount of parallax. In this case, due to an error in the amount of parallax, an error also occurs in the distance information obtained by converting the amount of parallax. In particular, this error becomes prominent when distance measurement is performed by projecting pattern light having periodicity such as a line pattern in which high luminance regions and low luminance regions are alternately arranged. Note that this parallax amount calculation error may occur in the same manner when the parallax amount is obtained using a captured image of a subject having a periodic pattern.

そこで、本発明は、周期性を有する画像を用いて視差量を算出する際の、算出誤差を低減することができる視差検出装置、距離検出装置、ロボット装置、視差検出方法、距離検出方法及びプログラムを提供する。   Therefore, the present invention provides a parallax detection device, a distance detection device, a robot device, a parallax detection method, a distance detection method, and a program capable of reducing a calculation error when calculating a parallax amount using an image having periodicity. I will provide a.

本発明の一実施態様に係る視差検出装置は、視差を有する画像組を取得する取得手段と、前記画像組の片方の画像上で基準画像を設定し、該基準画像に基づいて前記画像組の相関値を算出する相関算出手段と、前記相関値を用いて前記画像組の視差量を算出する視差算出手段とを備え、前記相関算出手段は、前記画像組の片方の画像上で第1の基準画像を設定し、該第1の基準画像に基づいて第1の相関値を算出し、前記画像組の片方の画像上で、所定の方向において前記第1の基準画像の位置とは異なる位置に第2の基準画像を設定し、該第2の基準画像に基づいて第2の相関値を算出し、前記視差算出手段は、前記第1の相関値と前記第2の相関値を用いて前記視差量を算出する。   The parallax detection device according to an embodiment of the present invention includes an acquisition unit configured to acquire an image set having parallax, a reference image set on one image of the image set, and the image set based on the reference image. A correlation calculating unit that calculates a correlation value; and a parallax calculating unit that calculates a parallax amount of the image set using the correlation value, wherein the correlation calculating unit includes a first unit on one image of the image set. A reference image is set, a first correlation value is calculated based on the first reference image, and a position different from the position of the first reference image in a predetermined direction on one image of the image set A second reference image is set to the second reference image, a second correlation value is calculated based on the second reference image, and the parallax calculation means uses the first correlation value and the second correlation value. The parallax amount is calculated.

また、本発明の他の実施態様に係る視差検出装置は、被写体にパターン光を投影する投影手段と、視差を有する画像組を取得する取得手段と、前記画像組の片方の画像上に基準画像を設定し、該基準画像に基づいて前記画像組の相関値を算出する相関算出手段と、前記相関値を用いて前記画像組の視差量を算出する視差算出手段とを備え、前記投影手段は、所定の方向において互いに対して位置がずれたパターンを有する第1のパターン光と第2のパターン光を投影し、前記相関算出手段は、前記第1のパターン光を投影して取得した第1の画像組に基づいて第1の相関値を算出し、前記第2のパターン光が投影して取得した第2の画像組に基づいて第2の相関値を算出し、前記視差算出手段は、前記第1の相関値と前記第2の相関値を用いて前記視差量を算出する。   A parallax detection device according to another embodiment of the present invention includes a projection unit that projects pattern light onto a subject, an acquisition unit that acquires an image set having parallax, and a reference image on one image of the image set. And a calculation unit for calculating a correlation value of the image set based on the reference image, and a parallax calculation unit for calculating a parallax amount of the image set using the correlation value. The first pattern light and the second pattern light having patterns whose positions are shifted with respect to each other in a predetermined direction are projected, and the correlation calculation unit projects the first pattern light to obtain the first pattern light. A first correlation value is calculated based on the second image set, a second correlation value is calculated based on the second image set obtained by projecting the second pattern light, and the parallax calculating unit includes: Using the first correlation value and the second correlation value It calculates the amount of parallax.

さらに、本発明の更なる他の実施態様に係る視差検出装置は、被写体にパターン光を投影する投影手段と、視差を有する画像組を取得する取得手段と、前記画像組の片方の画像上に基準画像を設定し、該基準画像に基づいて前記画像組の相関値を算出する相関算出手段と、前記相関値を用いて前記画像組の視差量を算出する視差算出手段とを備え、前記パターン光は、第1のサブパターン光と第2のサブパターン光を含み、前記第1のサブパターン光及び前記第2のサブパターン光は、第1の方向及び該第1の方向に垂直な第2の方向において互いに対して位置がずれたパターン光であり、前記基準画像は、前記第1のサブパターン光と前記第2のサブパターン光が投影された領域の画像を含む。   Furthermore, a parallax detection device according to still another embodiment of the present invention includes a projection unit that projects pattern light onto a subject, an acquisition unit that acquires an image group having parallax, and an image on one image of the image group. A correlation calculation unit that sets a reference image and calculates a correlation value of the image set based on the reference image; and a parallax calculation unit that calculates a parallax amount of the image set using the correlation value, The light includes a first sub-pattern light and a second sub-pattern light, and the first sub-pattern light and the second sub-pattern light have a first direction and a second direction perpendicular to the first direction. The reference light includes an image of a region where the first sub-pattern light and the second sub-pattern light are projected.

本発明によれば、周期性を有する画像を用いて視差量を算出する際の、算出誤差を低減することができる。   According to the present invention, it is possible to reduce a calculation error when calculating a parallax amount using an image having periodicity.

実施例1による距離検出装置の概略的な構成例を示す。1 shows a schematic configuration example of a distance detection device according to a first embodiment. 実施例1に係る撮像素子に含まれる画素の概略的な構成例を示す。1 illustrates a schematic configuration example of pixels included in an image sensor according to Embodiment 1. 実施例1に係る距離検出方法を説明するための図である。It is a figure for demonstrating the distance detection method which concerns on Example 1. FIG. 実施例1に係る測定結果の一例を示す。An example of the measurement result which concerns on Example 1 is shown. 実施例1に係る距離検出方法を説明するための図である。It is a figure for demonstrating the distance detection method which concerns on Example 1. FIG. 実施例1に係る距離検出方法を説明するための図である。It is a figure for demonstrating the distance detection method which concerns on Example 1. FIG. 実施例1の変形例に係る距離検出方法を説明するための図である。It is a figure for demonstrating the distance detection method which concerns on the modification of Example 1. FIG. 実施例1の変形例に係る距離検出方法のフローを示す。The flow of the distance detection method which concerns on the modification of Example 1 is shown. 実施例2に係るロボット装置の概略的な構成例を示す。3 shows a schematic configuration example of a robot apparatus according to a second embodiment. 実施例3に係る距離検出装置の概略的な構成例、及び距離検出方法のフローを示す。The schematic structural example of the distance detection apparatus which concerns on Example 3, and the flow of the distance detection method are shown. 実施例4に係るパターン光の一例を示す。An example of the pattern light which concerns on Example 4 is shown. 実施例4に係る距離検出方法を説明するための図である。It is a figure for demonstrating the distance detection method which concerns on Example 4. FIG. 実施例4に係る測定結果の一例を示す。An example of the measurement result which concerns on Example 4 is shown. 実施例4に係る距離検出方法を説明するための図である。It is a figure for demonstrating the distance detection method which concerns on Example 4. FIG. 実施例4に係る距離検出方法を説明するための図である。It is a figure for demonstrating the distance detection method which concerns on Example 4. FIG. 実施例5による距離検出装置の概略的な構成例を示す。10 shows a schematic configuration example of a distance detection device according to Embodiment 5. 実施例5に係る距離検出方法を説明するための図である。It is a figure for demonstrating the distance detection method which concerns on Example 5. FIG. 実施例6に係る距離検出装置の概略的な構成例を示す。10 shows a schematic configuration example of a distance detection apparatus according to Embodiment 6. 実施例6に係る距離検出方法を説明するための図である。It is a figure for demonstrating the distance detection method which concerns on Example 6. FIG. 実施例6に係る測定結果の一例を示す。An example of the measurement result which concerns on Example 6 is shown. 実施例6に係る距離検出方法を説明するための図である。It is a figure for demonstrating the distance detection method which concerns on Example 6. FIG. 実施例6に係る距離検出方法を説明するための図である。It is a figure for demonstrating the distance detection method which concerns on Example 6. FIG. 実施例6の変形例に係る距離検出方法を説明するための図である。It is a figure for demonstrating the distance detection method which concerns on the modification of Example 6. FIG.

以下、本発明を実施するための例示的な実施例を、図面を参照して詳細に説明する。ただし、以下の実施例で説明する寸法、材料、形状、及び構成要素の相対的な位置等は任意であり、本発明が適用される装置の構成又は様々な条件に応じて変更できる。また、図面において、同一であるか又は機能的に類似している要素を示すために図面間で同じ参照符号を用いる。   Hereinafter, exemplary embodiments for carrying out the present invention will be described in detail with reference to the drawings. However, dimensions, materials, shapes, and relative positions of components described in the following embodiments are arbitrary and can be changed according to the configuration of the apparatus to which the present invention is applied or various conditions. Also, in the drawings, the same reference numerals are used between the drawings to indicate the same or functionally similar elements.

(実施例1)
以下、図1(a)乃至6を参照して、本発明の実施例1による距離検出装置について説明する。図1は、本実施例による距離検出装置の概略的な構成例を示す。図1(a)はパターン光の投影を併用した距離検出装置100の概略的な構成例を示す。図1(b)は、投影されるパターン光の一例を示す。
Example 1
Hereinafter, a distance detection apparatus according to Embodiment 1 of the present invention will be described with reference to FIGS. FIG. 1 shows a schematic configuration example of a distance detection apparatus according to the present embodiment. FIG. 1A shows a schematic configuration example of a distance detection apparatus 100 using pattern light projection together. FIG. 1B shows an example of the projected pattern light.

(装置構成)
本実施例による距離検出装置100には、投影装置101、及び撮影装置103が設けられている。投影装置101は被写体102へパターン光の投影を行い、撮影装置103は被写体102からのパターン光の戻り光を用いて被写体102を撮影し、撮影画像を取得する。また、投影装置101及び撮影装置103は、制御部108に接続され、制御部108は、投影装置101及び撮影装置103の同期などの制御を行う。なお、投影装置101は撮影装置103に任意の方法で固定されることができ、撮影装置103に対して着脱可能に固定されてもよい。
(Device configuration)
The distance detection device 100 according to the present embodiment is provided with a projection device 101 and a photographing device 103. The projection device 101 projects pattern light onto the subject 102, and the photographing device 103 photographs the subject 102 using the return light of the pattern light from the subject 102 to obtain a photographed image. The projection apparatus 101 and the imaging apparatus 103 are connected to the control unit 108, and the control unit 108 performs control such as synchronization of the projection apparatus 101 and the imaging apparatus 103. Note that the projection apparatus 101 can be fixed to the imaging apparatus 103 by an arbitrary method, and may be fixed to the imaging apparatus 103 so as to be detachable.

投影装置101には、不図示の光源と、結像光学系と、パターン形成手段の一例としてすりガラスや金属板などにパターンを形成したパターンマスクとが設けられている。光源には、LED(Light Emitting Diode)等を用いることができる。なお、投影装置101にこれらの構成要素のみを配置する場合には、装置コストを低減したり、装置を小型化したりすることができる。また、本実施例では、投影装置101により投影するパターン光の一例として、図1(b)に示すラインパターン109を投影する。   The projection apparatus 101 is provided with a light source (not shown), an imaging optical system, and a pattern mask in which a pattern is formed on ground glass or a metal plate as an example of a pattern forming unit. As the light source, an LED (Light Emitting Diode) or the like can be used. Note that when only these components are arranged in the projection apparatus 101, the apparatus cost can be reduced and the apparatus can be downsized. In the present embodiment, a line pattern 109 shown in FIG. 1B is projected as an example of pattern light projected by the projection apparatus 101.

撮影装置103には、結像光学系104、撮像素子105、演算処理部106、及び本体メモリ107が設けられている。なお、撮影装置103には、投影装置101を固定するためのマウント等が設けられていてもよい。   The imaging apparatus 103 is provided with an imaging optical system 104, an image sensor 105, an arithmetic processing unit 106, and a main body memory 107. Note that the photographing apparatus 103 may be provided with a mount or the like for fixing the projection apparatus 101.

結像光学系104は、被写体102の像を撮像面である撮像素子105に形成する機能を有する。結像光学系104には複数の不図示のレンズ群及び絞り等が設けられ、結像光学系104は撮像素子105から所定距離だけ離れた位置に射出瞳を有する。ここで、図1(a)中には、結像光学系104の光軸140が一点鎖線で示されており、光軸140はz軸と平行である。また、x軸とy軸は互いに垂直であり、且つ光軸140及びz軸と垂直な軸とする。   The imaging optical system 104 has a function of forming an image of the subject 102 on the imaging element 105 that is an imaging surface. The imaging optical system 104 is provided with a plurality of lens groups (not shown), stops, and the like, and the imaging optical system 104 has an exit pupil at a position away from the image sensor 105 by a predetermined distance. Here, in FIG. 1A, the optical axis 140 of the imaging optical system 104 is indicated by a one-dot chain line, and the optical axis 140 is parallel to the z-axis. The x axis and the y axis are perpendicular to each other and are perpendicular to the optical axis 140 and the z axis.

撮像素子105には、基板204と複数の画素が配置される。ここで、図2(a)及び(b)は撮像素子105に含まれる画素の概略的な構成例を示す。図2(a)は、撮像素子105に配置される画素の断面図である。   The image sensor 105 is provided with a substrate 204 and a plurality of pixels. Here, FIGS. 2A and 2B show schematic configuration examples of the pixels included in the image sensor 105. FIG. FIG. 2A is a cross-sectional view of pixels arranged in the image sensor 105.

各画素には、マイクロレンズ201、カラーフィルタ202、及び光電変換部203A,203Bが設けられている。撮像素子105は、画素毎に、検出する波長帯域に応じたRGB(Red、Green、Blue:赤、緑、青)の分光特性がカラーフィルタ202によって与えられ、各画素は、不図示の公知の配色パターンによってxy平面上に配置されている。撮像素子105の基板204には、検出する波長帯域に感度を有する光電変換部203A,203Bが画素毎に形成されている。また、各画素には、不図示の配線が設けられており、各画素は配線を介して出力信号(画像信号)を演算処理部106に送ることができる。   Each pixel is provided with a microlens 201, a color filter 202, and photoelectric conversion units 203A and 203B. The image sensor 105 is provided with a spectral characteristic of RGB (Red, Green, Blue: red, green, blue) corresponding to the wavelength band to be detected for each pixel by the color filter 202, and each pixel has a well-known public image (not shown). They are arranged on the xy plane by a color arrangement pattern. On the substrate 204 of the image sensor 105, photoelectric conversion units 203A and 203B having sensitivity in the wavelength band to be detected are formed for each pixel. Each pixel is provided with a wiring (not shown), and each pixel can send an output signal (image signal) to the arithmetic processing unit 106 via the wiring.

図2(b)は、光軸140と撮像素子105の交点(中心像高)から見た、結像光学系104の射出瞳130を示す。光電変換部203A及び光電変換部203Bには、それぞれ射出瞳130の異なる領域である第1の瞳領域210を通過した第1の光束及び第2の瞳領域220を通過した第2の光束が入射する。各画素における光電変換部203A及び光電変換部203Bは入射した光束を光電変換することで、それぞれA画像及びB画像に対応する画像信号を生成することができる。生成された画像信号は演算手段の一例である演算処理部106に伝送され、演算処理部106は受け取った画像信号に基づいて、A画像及びB画像を生成する。演算処理部106は、A画像及びB画像を用いて距離検出処理を行って距離値を算出し、算出した距離値を本体メモリ107に蓄える。また、演算処理部106は、A画像とB画像を加算した画像を画像情報として本体メモリ107に記憶し、以降の処理で利用することができる。なお、演算処理部106は、A画像及びB画像自体を本体メモリ107に記憶させることもできる。   FIG. 2B shows the exit pupil 130 of the imaging optical system 104 viewed from the intersection (center image height) between the optical axis 140 and the image sensor 105. The first light beam that has passed through the first pupil region 210 and the second light beam that has passed through the second pupil region 220 are incident on the photoelectric conversion unit 203A and the photoelectric conversion unit 203B, respectively. To do. The photoelectric conversion unit 203A and the photoelectric conversion unit 203B in each pixel can generate image signals corresponding to the A image and the B image, respectively, by photoelectrically converting the incident light flux. The generated image signal is transmitted to the arithmetic processing unit 106 which is an example of an arithmetic unit, and the arithmetic processing unit 106 generates an A image and a B image based on the received image signal. The arithmetic processing unit 106 performs a distance detection process using the A image and the B image, calculates a distance value, and stores the calculated distance value in the main body memory 107. Further, the arithmetic processing unit 106 stores an image obtained by adding the A image and the B image in the main body memory 107 as image information, and can use it in the subsequent processing. The arithmetic processing unit 106 can also store the A image and the B image itself in the main body memory 107.

また、図2(b)には第1の瞳領域210の重心位置(第1の重心位置211)、及び第2の瞳領域220の重心位置(第2の重心位置221)が示されている。本実施例においては、第1の重心位置211は、射出瞳130の中心から第1の軸200に沿って偏心(移動)している。一方、第2の重心位置221は、第1の軸200に沿って、第1の重心位置211とは逆の方向に偏心(移動)している。第1の重心位置211と第2の重心位置221とを結ぶ方向を瞳分割方向と呼ぶ。また、第1の重心位置211と第2の重心位置221との重心間距離が基線長230となる。   FIG. 2B shows the centroid position of the first pupil region 210 (first centroid position 211) and the centroid position of the second pupil region 220 (second centroid position 221). . In the present embodiment, the first barycentric position 211 is decentered (moved) along the first axis 200 from the center of the exit pupil 130. On the other hand, the second center of gravity position 221 is eccentric (moved) along the first axis 200 in the direction opposite to the first center of gravity position 211. A direction connecting the first barycentric position 211 and the second barycentric position 221 is referred to as a pupil division direction. In addition, the distance between the centroids of the first centroid position 211 and the second centroid position 221 is the baseline length 230.

A画像とB画像は、デフォーカスによって瞳分割方向と同じ方向(本実施例ではx軸方向)に位置がずれる。この画像間の相対的な位置ずれ量、すなわちA画像とB画像の視差量は、デフォーカス量に応じた量となる。よって、この視差量を後述の手法により取得し、既知の変換手法によって視差量をデフォーカス量に変換することができる。また、既知の変換手法によってデフォーカス量を距離情報に変換することができる。   The positions of the A image and the B image are shifted in the same direction as the pupil division direction (in the present embodiment, the x-axis direction) by defocusing. The relative positional shift amount between the images, that is, the parallax amount between the A image and the B image is an amount corresponding to the defocus amount. Therefore, this parallax amount can be acquired by a method described later, and the parallax amount can be converted into a defocus amount by a known conversion method. Further, the defocus amount can be converted into distance information by a known conversion method.

演算処理部106には、相関算出部161、視差算出部162及び距離算出部163が設けられている。相関算出部161は、A画像上において、距離算出を行う画素(注目画素)を含む部分領域の画像を基準画像として設定し、B画像に参照画像を設定し、参照画像の位置を所定の方向に移動させながら基準画像と参照画像との相関値を算出する。   The arithmetic processing unit 106 includes a correlation calculation unit 161, a parallax calculation unit 162, and a distance calculation unit 163. The correlation calculation unit 161 sets an image of a partial area including a pixel (target pixel) for calculating a distance as a reference image on the A image, sets a reference image for the B image, and sets the position of the reference image in a predetermined direction. The correlation value between the standard image and the reference image is calculated while moving the image.

視差算出部162は、相関算出部161によって算出された相関値を用いてA画像及びB画像を含む画像組の視差量を算出する。距離算出部163は、視差算出部162によって算出された視差量を用いて被写体102までの距離を算出する。   The parallax calculation unit 162 calculates the parallax amount of the image set including the A image and the B image using the correlation value calculated by the correlation calculation unit 161. The distance calculation unit 163 calculates the distance to the subject 102 using the parallax amount calculated by the parallax calculation unit 162.

なお、制御部108は、汎用のコンピュータを用いて構成されてもよいし、距離検出装置100専用のコンピュータとして構成されてもよい。また、演算処理部106の各構成要素は、CPU(Central Processing Unit)やMPU(Micro Processing Unit)等の演算装置上で実行されるソフトウェアモジュールによって構成されることができる。同様に、演算処理部106の各構成要素は、ASIC等の特定の機能を果たす回路等によって構成されてもよい。さらに、投影装置101及び撮影装置103の同期制御等を行う制御部108を、撮影装置103の演算処理部106において実現してもよい。また、本体メモリ107は、RAMやROM等の既知の任意のメモリによって構成されてよい。   The control unit 108 may be configured using a general-purpose computer, or may be configured as a computer dedicated to the distance detection device 100. Each component of the arithmetic processing unit 106 can be configured by a software module that is executed on an arithmetic device such as a CPU (Central Processing Unit) or an MPU (Micro Processing Unit). Similarly, each component of the arithmetic processing unit 106 may be configured by a circuit that performs a specific function such as an ASIC. Furthermore, the control unit 108 that performs synchronization control of the projection device 101 and the imaging device 103 may be realized in the arithmetic processing unit 106 of the imaging device 103. The main body memory 107 may be configured by any known memory such as a RAM or a ROM.

(距離検出処理のフロー)
次に、図3(a)乃至(c)を参照して、本実施例に係る距離検出処理のフローについて説明する。図3(a)は本実施例に係る距離検出処理のフローチャートであり、図3(b)及び(c)は、相関算出部161によって行う相関演算を説明するための図である。本実施例に係る距離検出処理が開始されると、処理はステップS301に移行する。
(Distance detection process flow)
Next, a flow of distance detection processing according to the present embodiment will be described with reference to FIGS. FIG. 3A is a flowchart of distance detection processing according to the present embodiment, and FIGS. 3B and 3C are diagrams for explaining the correlation calculation performed by the correlation calculation unit 161. When the distance detection process according to the present embodiment is started, the process proceeds to step S301.

ステップS301「パターン光投影画像取得」では、投影装置101から被写体102へパターン光を投影している状態で、撮影装置103を用いて撮影を行い、撮影画像を本体メモリ107に記憶させる。具体的には、まず、投影装置101の内部に設けたパターン制御手段の一例である空間光変調器(不図示)によって、ラインパターン109を有する光を生成し、被写体102の表面へと照射する。その後、この状態で撮影装置103により撮影を行い、視差を有するA画像及びB画像を含む画像組を生成・取得し、取得した画像組を本体メモリ107に記憶させる。この際、制御部108が、パターン光投影を行った状態で撮影装置103の露光を行うように、投影装置101と撮影装置103の動作及びタイミングの制御を行う。   In step S301 “acquire pattern light projection image”, image capturing is performed using the image capturing apparatus 103 while pattern light is being projected from the projection apparatus 101 to the subject 102, and the captured image is stored in the main body memory 107. Specifically, first, light having a line pattern 109 is generated by a spatial light modulator (not shown) which is an example of a pattern control unit provided inside the projection apparatus 101 and is irradiated onto the surface of the subject 102. . Thereafter, photographing is performed by the photographing apparatus 103 in this state, an image set including an A image and a B image having parallax is generated and acquired, and the acquired image set is stored in the main body memory 107. At this time, the control unit 108 controls the operations and timings of the projection apparatus 101 and the imaging apparatus 103 so that the imaging apparatus 103 is exposed in a state where pattern light projection is performed.

ここで、模様(テクスチャともいう)が乏しい被写体102を周辺環境光のみで撮影した場合には、A画像やB画像のコントラストやS/N比が低下し、相関演算を用いた距離算出(測距演算)の精度が低下する。これに対し、投影装置101から被写体102にパターン光を照射・投影し、被写体102の表面にテクスチャを重畳した状態で撮影を行うことで距離算出の精度を向上させることができる。   Here, when the subject 102 having a poor pattern (also referred to as a texture) is photographed with only ambient light, the contrast and S / N ratio of the A image and the B image are lowered, and distance calculation (measurement) using correlation calculation is performed. The accuracy of distance calculation is reduced. On the other hand, the accuracy of distance calculation can be improved by irradiating and projecting pattern light from the projection apparatus 101 onto the subject 102 and shooting with the texture superimposed on the surface of the subject 102.

ステップS302からステップS305の処理は、演算処理部106によって行う。ここで、図3(b)及び(c)は、ステップS302及びステップS303にて設定する基準画像及び参照画像の位置関係を説明するための図である。図3(b)にはA画像310Aが示され、図3(c)にはB画像310Bが示されている。   The processing from step S302 to step S305 is performed by the arithmetic processing unit 106. Here, FIGS. 3B and 3C are diagrams for explaining the positional relationship between the standard image and the reference image set in step S302 and step S303. FIG. 3B shows an A image 310A, and FIG. 3C shows a B image 310B.

ステップS302「相関演算1」では、演算処理部106の相関算出部161が、A画像310A及びB画像310Bの第1の相関値を算出する。具体的には、相関算出部161は、まず、A画像310A上において、注目画素320とその近傍画素を含む部分領域を抜き出し、第1の基準画像311として設定する。次に、相関算出部161は、B画像310B上において、第1の基準画像311と同じ面積(画像サイズ)の領域を抜き出して参照画像313として設定する。その後、相関算出部161は、B画像310B上で参照画像313を抜き出す位置を瞳分割方向と同じx軸方向に移動させて、各移動量(各位置)における参照画像313と第1の基準画像311との相関値を算出する。これにより、相関算出部161は、各移動量に対応する相関値のデータ列からなる第1の相関値を算出する。なお、相関算出部161は、参照画像313を第1の基準画像311の縦及び横寸法と同じ縦及び横寸法を有する画像として設定することができる。   In step S302 “correlation calculation 1”, the correlation calculation unit 161 of the calculation processing unit 106 calculates the first correlation value of the A image 310A and the B image 310B. Specifically, the correlation calculation unit 161 first extracts a partial area including the target pixel 320 and its neighboring pixels from the A image 310 </ b> A and sets it as the first reference image 311. Next, the correlation calculation unit 161 extracts a region having the same area (image size) as that of the first reference image 311 on the B image 310B and sets it as the reference image 313. Thereafter, the correlation calculation unit 161 moves the position where the reference image 313 is extracted on the B image 310B in the same x-axis direction as the pupil division direction, and the reference image 313 and the first reference image at each movement amount (each position). A correlation value with 311 is calculated. Thereby, the correlation calculation unit 161 calculates a first correlation value including a data string of correlation values corresponding to each movement amount. Note that the correlation calculation unit 161 can set the reference image 313 as an image having the same vertical and horizontal dimensions as the vertical and horizontal dimensions of the first base image 311.

参照画像313を移動させて相関演算を行う方向を視差算出方向と呼ぶ。視差算出方向は瞳分割方向と同じ方向に設定することで、A画像310AとB画像310Bの被写体距離に応じて生じる視差量を正しく算出することができる。なお、相関値の算出方法としては、SAD(Sum of Absolute Difference)やSSD(Sum of Squared Difference)などの一般的な算出方法を用いることができる。   A direction in which the reference image 313 is moved and the correlation calculation is performed is referred to as a parallax calculation direction. By setting the parallax calculation direction to the same direction as the pupil division direction, it is possible to correctly calculate the parallax amount generated according to the subject distance between the A image 310A and the B image 310B. In addition, as a calculation method of a correlation value, general calculation methods, such as SAD (Sum of Absolute Difference) and SSD (Sum of Squared Difference), can be used.

次に、ステップS303「相関演算2」では、相関算出部161は、A画像310A及びB画像310Bの第2の相関値を算出する。具体的には、相関算出部161は、A画像310A上において、第1の基準画像311と同じ面積(画像サイズ)の領域であって、瞳分割方向(x軸方向)において異なる位置にある部分領域を抜き出して第2の基準画像312として設定する。次に、相関算出部161は、B画像310B上において、第2の基準画像312と同じ面積(画像サイズ)の領域を抜き出して、参照画像313として設定する。その後、相関算出部161は、ステップS302と同様に、参照画像313の位置を視差算出方向に移動させ、各移動量における参照画像313と第2の基準画像312との相関値を算出する。これにより、相関算出部161は、各移動量に対する相関値のデータ列からなる第2の相関値を算出する。なお、相関算出部161は、第2の基準画像312を第1の基準画像311の縦及び横寸法と同じ縦及び横寸法を有する画像として設定することができる。   Next, in step S303 “correlation calculation 2”, the correlation calculation unit 161 calculates the second correlation value of the A image 310A and the B image 310B. Specifically, the correlation calculation unit 161 is a region having the same area (image size) as the first reference image 311 on the A image 310A and is located at a different position in the pupil division direction (x-axis direction). An area is extracted and set as the second reference image 312. Next, the correlation calculation unit 161 extracts a region having the same area (image size) as that of the second standard image 312 on the B image 310B and sets it as the reference image 313. Thereafter, similarly to step S302, the correlation calculation unit 161 moves the position of the reference image 313 in the parallax calculation direction, and calculates a correlation value between the reference image 313 and the second reference image 312 at each movement amount. Thereby, the correlation calculation part 161 calculates the 2nd correlation value which consists of a data sequence of the correlation value with respect to each moving amount | distance. Note that the correlation calculation unit 161 can set the second reference image 312 as an image having the same vertical and horizontal dimensions as the vertical and horizontal dimensions of the first reference image 311.

なお、相関演算2において、第2の基準画像312に対する参照画像313は、第1の基準画像311に対する参照画像313の設定条件と同様の条件で、設定されることができる。例えば、参照画像313がA画像310Aにおける第1の基準画像311の位置に対応するB画像310Bの位置の画像となるように設定されるとする。この場合には、相関演算2において、参照画像313は、A画像310Aにおける第2の基準画像312の位置に対応するB画像310Bの位置の画像となるように設定されてよい。なお、A画像310A上の位置とB画像310B上の位置の対応関係は、既知の手法で特定されてよく、例えば、それぞれの画像を構成する画像信号を取得する画素の構造に基づいて特定されることができる。   In the correlation calculation 2, the reference image 313 for the second standard image 312 can be set under the same conditions as the setting conditions for the reference image 313 for the first standard image 311. For example, it is assumed that the reference image 313 is set to be an image at the position of the B image 310B corresponding to the position of the first standard image 311 in the A image 310A. In this case, in the correlation calculation 2, the reference image 313 may be set to be an image at the position of the B image 310B corresponding to the position of the second standard image 312 in the A image 310A. The correspondence relationship between the position on the A image 310A and the position on the B image 310B may be specified by a known method, for example, based on the structure of the pixels that acquire the image signals constituting each image. Can.

また、相関演算2における参照画像313の移動量は、相関演算1における参照画像313の移動量と略同量とすることができる。例えば、相関算出部161は、相関演算1における参照画像313の移動量を−Mから+Mとした場合、相関演算2における参照画像313の移動量も−Mから+Mとすることができる。   Further, the amount of movement of the reference image 313 in the correlation calculation 2 can be made substantially the same as the amount of movement of the reference image 313 in the correlation calculation 1. For example, when the movement amount of the reference image 313 in the correlation calculation 1 is changed from −M to + M, the correlation calculation unit 161 can also change the movement amount of the reference image 313 in the correlation calculation 2 from −M to + M.

ステップS304「視差量算出」では、演算処理部106の視差算出部162が、ステップS302及びステップS303で求められた第1の相関値と第2の相関値を用いて視差量を算出する。具体的には、視差算出部162は、第1の相関値と第2の相関値の各移動量における相関値をそれぞれ加算又は加算平均し、第3の相関値を算出する。このとき、視差算出部162は、第1の相関値及び第2の相関値における対応する移動量の相関値同士を加算又は加算平均して求めた各相関値のデータ列から、第3の相関値を算出することができる。例えば、視差算出部162は、参照画像の移動量−Mの第1の相関値及び第2の相関値を加算又は加算平均し、移動量−Mに対応する第3の相関値を算出することができる。   In step S304 “calculation of parallax”, the parallax calculation unit 162 of the arithmetic processing unit 106 calculates the amount of parallax using the first correlation value and the second correlation value obtained in steps S302 and S303. Specifically, the parallax calculation unit 162 adds or averages the correlation values of the first correlation value and the second correlation value for each movement amount, and calculates a third correlation value. At this time, the parallax calculation unit 162 calculates the third correlation from the data string of each correlation value obtained by adding or averaging the correlation values of the corresponding movement amounts in the first correlation value and the second correlation value. A value can be calculated. For example, the parallax calculation unit 162 adds or averages the first correlation value and the second correlation value of the movement amount −M of the reference image, and calculates a third correlation value corresponding to the movement amount −M. Can do.

その後、視差算出部162は、既知の任意の手法により、第3の相関値を用いて視差量を算出する。例えば、第3の相関値の中で最も高い相関が得られる移動量とその近傍の移動量に対応する相関値のデータ列を抽出し、既知の任意の内挿手法により、最も相関が高くなる移動量をサブピクセル精度で推定することで、視差量を算出することができる。   Thereafter, the parallax calculation unit 162 calculates the amount of parallax using the third correlation value by a known arbitrary method. For example, the data amount of the correlation value corresponding to the movement amount that provides the highest correlation among the third correlation values and the movement amount in the vicinity thereof is extracted, and the highest correlation is obtained by any known interpolation method. The amount of parallax can be calculated by estimating the amount of movement with subpixel accuracy.

ステップS305「距離値算出」では、演算処理部106の距離算出部163が、既知の任意の手法により、視差量をデフォーカス量又は被写体距離に変換する。視差量からデフォーカス量への換算は、基線長を用いた幾何学的関係を用いて行うことができる。また、デフォーカス量から被写体距離への変換は、結像光学系104の結像関係を用いて行うことができる。また、視差量に所定の変換係数を乗算することで、視差量をデフォーカス量又は被写体距離に変換してもよい。このような方法により、距離算出部163は、注目画素320における視差量を用いて被写体102までの距離を算出することができる。   In step S305 “distance value calculation”, the distance calculation unit 163 of the arithmetic processing unit 106 converts the parallax amount into the defocus amount or the subject distance by any known method. Conversion from the amount of parallax to the amount of defocus can be performed using a geometric relationship using the baseline length. Further, the conversion from the defocus amount to the subject distance can be performed using the imaging relationship of the imaging optical system 104. Alternatively, the parallax amount may be converted into a defocus amount or a subject distance by multiplying the parallax amount by a predetermined conversion coefficient. By such a method, the distance calculation unit 163 can calculate the distance to the subject 102 using the amount of parallax at the target pixel 320.

このように本実施例による距離検出方法では、瞳分割方向(視差算出方向)における異なる位置で第1の基準画像311と第2の基準画像312を設定し、それぞれに対して設定された参照画像313との相関値を算出し、両相関値より視差量を算出する。当該処理によれば、投影パターンの輝度分布と基準画像の位置とに関係して発生する視差量の算出誤差を軽減して測距誤差を軽減することができ、高精度な測距を行うことができる。   As described above, in the distance detection method according to the present embodiment, the first reference image 311 and the second reference image 312 are set at different positions in the pupil division direction (parallax calculation direction), and the reference image set for each is set. The correlation value with 313 is calculated, and the amount of parallax is calculated from both correlation values. According to this processing, it is possible to reduce the measurement error of the parallax amount that occurs in relation to the luminance distribution of the projection pattern and the position of the reference image, thereby reducing the distance measurement error, and performing highly accurate distance measurement. Can do.

ここで、図4(a)及び(b)を参照して、本実施例による距離検出方法の処理結果の一例について述べる。図4(a)は、既知の距離において、撮影装置103と並行となるように配置した平板に、投影装置101を用いてパターン光を投影し、撮影装置103で撮影した画像である。図4(b)は、平板上の各位置における視差量を算出した際の誤差の結果である。図4(b)の横軸は移動量(画素位置)を表しており、縦軸は視差量の算出誤差を表している。図4(b)には、従来の処理で算出した視差量の算出誤差401が破線で示され、本実施例による処理で算出した視差量の算出誤差402が実線で示されている。従来と比べて本実施例の手法により、誤差が0に近づき、視差量の算出誤差を低減していることが分かる。   Here, an example of the processing result of the distance detection method according to the present embodiment will be described with reference to FIGS. FIG. 4A is an image obtained by projecting pattern light using a projection device 101 onto a flat plate arranged in parallel with the imaging device 103 at a known distance and imaging the imaging device 103. FIG. 4B shows a result of an error when calculating the amount of parallax at each position on the flat plate. The horizontal axis in FIG. 4B represents the movement amount (pixel position), and the vertical axis represents the parallax amount calculation error. In FIG. 4B, the parallax amount calculation error 401 calculated by the conventional process is indicated by a broken line, and the parallax amount calculation error 402 calculated by the process according to the present embodiment is indicated by a solid line. It can be seen that the error approaches 0 and the calculation error of the parallax amount is reduced by the method of the present embodiment as compared with the prior art.

次に、図5(a)乃至(e)を参照して、従来の処理では視差量の算出に誤差が発生し、本実施例による処理では視差量の算出誤差が低減する理由について説明する。以降の説明では、A画像とB画像は同じ濃淡を有する画像で視差が無いものと仮定する。図5(a)乃至(c)は誤差の発生理由を説明する図である。   Next, with reference to FIGS. 5A to 5E, the reason why an error occurs in the calculation of the parallax amount in the conventional processing and the calculation error of the parallax amount is reduced in the processing according to the present embodiment will be described. In the following description, it is assumed that the A image and the B image have the same shading and have no parallax. 5A to 5C are diagrams for explaining the reason for the occurrence of an error.

図5(a)は、明領域及び暗領域が交互に現れるラインパターンを有するA画像501と基準画像502及び基準画像503との位置関係を示した図である。基準画像502は、A画像501の明領域と暗領域が切り替わる画像エッジ504,505(境界部)を基準画像502の内部に含んでいる。図5(b)は、基準画像502に対して設定された参照画像を移動させて基準画像502と参照画像の相関演算を行うことで算出される各相関値を示している。ここでは、相関値が低いほど相関が高いことを表している。   FIG. 5A is a diagram illustrating a positional relationship between the A image 501 having a line pattern in which bright regions and dark regions appear alternately, the reference image 502, and the reference image 503. The reference image 502 includes image edges 504 and 505 (boundary portions) where the bright area and the dark area of the A image 501 are switched inside the reference image 502. FIG. 5B shows correlation values calculated by moving the reference image set with respect to the standard image 502 and performing a correlation calculation between the standard image 502 and the reference image. Here, the lower the correlation value, the higher the correlation.

相関値C0,Cp,Cmはそれぞれ参照画像の位置を0、+1、−1画素だけ移動させたときの相関値である。ここでは、A画像及びB画像が視差を有さないものと仮定しているため、移動量が0のとき、両画像は一致し、相関値C0は低い値となる。参照画像を+1画素又は−1画素だけ移動させると、画像エッジ504,505に起因して基準画像502と参照画像に差(違い)が生じるため、相関値Cp,Cmは相関値C0より増加する。このとき、相関値Cp,Cmに対応する参照画像の移動量の絶対値は同じであるため、ラインパターン上の画像エッジ504,505に起因する画像間の差も同量となる。そのため、相関値Cpと相関値Cmは同じ値となる。この相関値を内挿して相関曲線510を求め、最も高い相関値となる移動量(視差量)を算出することで視差量511が求まり、正しい値(視差量0)が求まる。   Correlation values C0, Cp, and Cm are correlation values when the position of the reference image is moved by 0, +1, and −1 pixel, respectively. Here, since it is assumed that the A image and the B image have no parallax, when the movement amount is 0, the two images coincide with each other, and the correlation value C0 is a low value. When the reference image is moved by +1 pixel or −1 pixel, a difference (difference) occurs between the base image 502 and the reference image due to the image edges 504 and 505, and thus the correlation values Cp and Cm increase from the correlation value C0. . At this time, since the absolute values of the movement amounts of the reference images corresponding to the correlation values Cp and Cm are the same, the difference between the images caused by the image edges 504 and 505 on the line pattern is also the same amount. Therefore, the correlation value Cp and the correlation value Cm are the same value. The correlation value is interpolated to obtain a correlation curve 510, and the movement amount (parallax amount) that gives the highest correlation value is calculated, whereby the parallax amount 511 is obtained, and the correct value (parallax amount 0) is obtained.

一方、基準画像503では、画像エッジ504と基準画像503の右端が重なる。図5(c)は、基準画像503に対して設定された参照画像を移動させて基準画像503と参照画像の相関演算を行うことで算出される各相関値を示している。移動量が0のとき、両画像は一致し、相関値C0は低い値となる。移動量が+1画素のとき、基準画像502の場合と同様に、相関値Cpは相関値C0より増加する。これに対し、移動量が−1画素のときには、画像エッジ505のみに起因して基準画像と参照画像との差が生じるため、相関値C0からの相関値Cmの増加量は微量となる。そのため、この場合の相関値は、参照画像の移動量の+側と−側で非対称となり、これを内挿した相関曲線512により求まる視差量513は正しい値(視差量0)とは異なる値となり、誤差が発生する。これが、投影パターンの輝度分布と基準画像の位置とに関係して発生する視差量の算出誤差となる。   On the other hand, in the reference image 503, the image edge 504 and the right end of the reference image 503 overlap. FIG. 5C shows each correlation value calculated by moving the reference image set with respect to the standard image 503 and performing a correlation calculation between the standard image 503 and the reference image. When the movement amount is 0, both images match and the correlation value C0 is a low value. When the movement amount is +1 pixel, the correlation value Cp increases from the correlation value C0 as in the case of the reference image 502. On the other hand, when the movement amount is −1 pixel, the difference between the base image and the reference image is caused only by the image edge 505, and therefore, the increase amount of the correlation value Cm from the correlation value C0 is very small. For this reason, the correlation value in this case is asymmetrical on the + side and the − side of the movement amount of the reference image, and the parallax amount 513 obtained from the correlation curve 512 obtained by interpolating this is different from the correct value (parallax amount 0). An error occurs. This is a calculation error of the amount of parallax generated in relation to the luminance distribution of the projection pattern and the position of the reference image.

次に、本実施例のように、第1の基準画像とは視差算出方向に位置が異なる第2の基準画像を設定し、第1の基準画像及び第2の基準画像の各々を用いて算出した相関値より視差量を算出することで、視差量の算出誤差が低減する理由について説明する。図5(d)は、A画像501と第1の基準画像503及び第2の基準画像506の位置を示した図である。図5(e)は第1の基準画像503及び第2の基準画像506を用いて算出される相関値を示している。   Next, as in the present embodiment, a second reference image having a position different from that of the first reference image in the parallax calculation direction is set, and calculation is performed using each of the first reference image and the second reference image. The reason why the parallax amount calculation error is reduced by calculating the parallax amount from the correlation value will be described. FIG. 5D is a diagram showing the positions of the A image 501, the first reference image 503, and the second reference image 506. FIG. 5E shows correlation values calculated using the first reference image 503 and the second reference image 506.

第1の基準画像503は、前述と同様に画像エッジ504と基準画像の右端が重なる基準画像を仮定する。このとき、第1の基準画像503より算出される第1の相関値Cm1,C01,Cp1は、図5(c)に示す相関値Cm,C0,Cpと同じになる。   The first reference image 503 is assumed to be a reference image in which the image edge 504 and the right end of the reference image overlap as described above. At this time, the first correlation values Cm1, C01, Cp1 calculated from the first reference image 503 are the same as the correlation values Cm, C0, Cp shown in FIG.

次に第2の基準画像506を、第2の基準画像506の左端が画像エッジ504と重なるように設定する。このとき、第2の基準画像506と画像エッジ504との位置関係は、第1の基準画像503と画像エッジ504との位置関係を反転した関係になる。そのため、図5(e)に示すように、第2の基準画像506を用いて得られる第2の相関値Cm2,C02,Cp2は、第1の基準画像503を用いて得られる第1の相関値Cm1,C01,Cp1を反転したものとなる。   Next, the second reference image 506 is set so that the left end of the second reference image 506 overlaps the image edge 504. At this time, the positional relationship between the second reference image 506 and the image edge 504 is a relationship obtained by inverting the positional relationship between the first reference image 503 and the image edge 504. Therefore, as shown in FIG. 5E, the second correlation values Cm2, C02, and Cp2 obtained using the second reference image 506 are the first correlation obtained using the first reference image 503. The values Cm1, C01, and Cp1 are inverted.

これらの相関値を参照画像の位置(移動量)毎に加算平均すると、相関値は第3の相関値Cm3,C03,Cp3のようになる。第3の相関値は、参照画像の移動量の+側と−側の非対称性がキャンセルされ、対称となる。この場合、相関値を内挿した相関曲線514より求まる視差量515は正しい値(視差量0)となり、適切な視差量を算出することができる。本実施例による処理では、このような原理により視差量の算出誤差を低減することができ、適切に算出された視差量に基づいて高精度に測距を行うことができる。   When these correlation values are added and averaged for each position (movement amount) of the reference image, the correlation values become the third correlation values Cm3, C03, and Cp3. The third correlation value is symmetrical because the asymmetry on the + side and − side of the movement amount of the reference image is canceled. In this case, the parallax amount 515 obtained from the correlation curve 514 obtained by interpolating the correlation value becomes a correct value (parallax amount 0), and an appropriate parallax amount can be calculated. In the process according to the present embodiment, the calculation error of the parallax amount can be reduced based on such a principle, and the distance can be measured with high accuracy based on the appropriately calculated parallax amount.

ここで、本実施例による距離検出方法では、第1の基準画像と第2の基準画像の位置を、視差算出方向において適切な量だけ異ならせることで、視差量の算出誤差をより低減することができる。図6は各基準画像の適切な位置を説明する図である。   Here, in the distance detection method according to the present embodiment, the calculation error of the parallax amount is further reduced by making the positions of the first reference image and the second reference image different by an appropriate amount in the parallax calculation direction. Can do. FIG. 6 is a diagram illustrating an appropriate position of each reference image.

第1の基準画像520及び第1の基準画像521は、基準画像の右端がA画像501の画像エッジ504又は画像エッジ505と重なる基準画像である。これらの第1の基準画像520,521を用いたときに相関値に発生する誤差を、第2の基準画像で算出した相関値でキャンセルする場合を考える。   The first reference image 520 and the first reference image 521 are reference images in which the right edge of the reference image overlaps the image edge 504 or the image edge 505 of the A image 501. Consider a case where an error that occurs in a correlation value when these first reference images 520 and 521 are used is canceled with the correlation value calculated with the second reference image.

この場合には、第1の基準画像の右端における画像エッジに起因する相関値の誤差をキャンセルするため、第2の基準画像の左端における画像エッジに起因する相関値の誤差が生じるように第2の基準画像を設定すればよい。そのため、第2の基準画像を、第1の基準画像520,521の近傍で、第2の基準画像の左端がA画像501に含まれる画像エッジに重なるように設定すればよい。   In this case, since the error of the correlation value due to the image edge at the right end of the first reference image is canceled, the second error of the correlation value due to the image edge at the left end of the second reference image is generated. The reference image may be set. Therefore, the second reference image may be set so that the left end of the second reference image overlaps the image edge included in the A image 501 in the vicinity of the first reference images 520 and 521.

例えば、図6に示すように第2の基準画像522,523,524,525,526,527のいずれかのように、第2の基準画像を設定することができる。このとき、第1の基準画像520又は第1の基準画像521と第2の基準画像522,523,524,525,526,527の各々とのx軸方向における位置の差を求めると、当該位置の差は以下の式(1a)又は式(1b)で表すことができる。
For example, as shown in FIG. 6, the second reference image can be set like any one of the second reference images 522, 523, 524, 525, 526, 527. At this time, when the position difference in the x-axis direction between the first reference image 520 or the first reference image 521 and each of the second reference images 522, 523, 524, 525, 526, 527 is obtained, The difference of can be expressed by the following formula (1a) or (1b).

ここで、Wは第1の基準画像及び第2の基準画像のx方向(視差算出方向)の幅、Pは投影パターンの撮影画像上における周期、Hは投影パターンの撮影画像上における高輝度領域の幅、nは任意の整数を表している。   Here, W is the width of the first reference image and the second reference image in the x direction (parallax calculation direction), P is the period of the projected pattern on the captured image, and H is the high brightness area on the captured image of the projected pattern. , N represents an arbitrary integer.

本実施例による距離検出方法では、第1の基準画像と第2の基準画像の位置を、式(1a)又は式(1b)で示す量だけ視差算出方向に互いに異ならせることで、最も適切に視差量の算出誤差を低減することができ、高精度な測距を行うことができる。   In the distance detection method according to the present embodiment, the positions of the first reference image and the second reference image are most appropriately changed from each other in the parallax calculation direction by the amount indicated by Expression (1a) or Expression (1b). The calculation error of the parallax amount can be reduced, and highly accurate distance measurement can be performed.

なお、第2の基準画像の視差算出方向に垂直な方向(y軸方向)における位置は、第1の基準画像とは異なる位置に設定してもよい。また、第1の基準画像と第2の基準画像とのx軸方向又はy軸方向の位置は、互いにできるだけ近傍とすることができる。第1の基準画像と第2の基準画像が互いに近い位置にある方が、被写体の距離が略同じ領域に両基準画像を設定することができ、より適切に視差量の算出誤差を低減できる。   Note that the position of the second reference image in the direction perpendicular to the parallax calculation direction (y-axis direction) may be set to a position different from that of the first reference image. Further, the positions of the first reference image and the second reference image in the x-axis direction or the y-axis direction can be as close as possible to each other. When the first reference image and the second reference image are closer to each other, both reference images can be set in a region where the distance between the subjects is substantially the same, and the parallax amount calculation error can be reduced more appropriately.

また、投影装置101の照明ムラや結像光学系104の収差等により、距離検出装置100で取得される画像には像高依存性を有する。この観点からも、第1の基準画像と第2の基準画像とのx軸方向又はy軸方向の位置は互いに近い位置に設けることができる。好ましくは、撮影画像の対角の長さを1とすると、第1の基準画像及び第2の基準画像は、距離が0.1以内になるように近づけた方がよく、より好ましくは、距離が0.05以内になるように近づけた方がよい。このように、第1及び第2の基準画像の位置を設定することで、より適切に視差量の算出誤差を低減できる。   Further, an image acquired by the distance detection device 100 has an image height dependency due to illumination unevenness of the projection device 101, aberration of the imaging optical system 104, and the like. Also from this viewpoint, the positions of the first reference image and the second reference image in the x-axis direction or the y-axis direction can be provided close to each other. Preferably, if the diagonal length of the captured image is 1, the first reference image and the second reference image should be close to each other so that the distance is within 0.1, and more preferably the distance It is better to make it close to within 0.05. Thus, by setting the positions of the first and second reference images, it is possible to more appropriately reduce the parallax amount calculation error.

上記のように、本実施例による距離検出装置は、投影装置101と、撮影装置103と、相関算出部161、視差算出部162、及び距離算出部163を含む演算処理部106とを備えている。投影装置101は、被写体102にパターン光を投影する。撮影装置103は、投影装置101から投影されるパターン光を用いて、視差を有する画像組を取得する。相関算出部161は、取得した画像組の片方の画像上で基準画像を設定し、基準画像に基づいて画像組の相関値を算出する。より具体的には、相関算出部161は、画像組の他方の画像上に参照画像を設定し、参照画像の位置を所定の方向に移動させながら基準画像と参照画像との相関値を算出する。視差算出部162は、相関算出部161が算出した相関値を用いて画像組の視差量を算出する。距離算出部163は、視差算出部162が算出した視差量を用いて被写体102までの距離を算出する。   As described above, the distance detection device according to the present embodiment includes the projection device 101, the imaging device 103, and the arithmetic processing unit 106 including the correlation calculation unit 161, the parallax calculation unit 162, and the distance calculation unit 163. . The projection device 101 projects pattern light onto the subject 102. The imaging apparatus 103 acquires an image set having parallax using the pattern light projected from the projection apparatus 101. The correlation calculation unit 161 sets a reference image on one image of the acquired image set, and calculates a correlation value of the image set based on the reference image. More specifically, the correlation calculation unit 161 sets a reference image on the other image in the image set, and calculates a correlation value between the reference image and the reference image while moving the position of the reference image in a predetermined direction. . The parallax calculation unit 162 calculates the parallax amount of the image set using the correlation value calculated by the correlation calculation unit 161. The distance calculation unit 163 calculates the distance to the subject 102 using the parallax amount calculated by the parallax calculation unit 162.

より具体的には、相関算出部161は、画像組の片方の画像上で第1の基準画像を設定し、第1の基準画像に基づいて第1の相関値を算出する。また、相関算出部161は、画像組の片方の画像上で、視差算出方向において第1の基準画像の位置とは異なる位置に第2の基準画像を設定し、第2の基準画像に基づいて第2の相関値を算出する。そして、視差算出部162は、第1の相関値と第2の相関値を用いて視差量を算出する。   More specifically, the correlation calculation unit 161 sets a first reference image on one image of the image set, and calculates a first correlation value based on the first reference image. Further, the correlation calculation unit 161 sets the second reference image at a position different from the position of the first reference image in the parallax calculation direction on one image of the image set, and based on the second reference image. A second correlation value is calculated. Then, the parallax calculation unit 162 calculates the amount of parallax using the first correlation value and the second correlation value.

ここで、相関算出部161は、式(1a)又は式(1b)に従って、第1の基準画像と第2の基準画像を設定する。より具体的には、相関算出部161は、第1の基準画像と第2の基準画像を、第1の基準画像の視差算出方向の幅、又は該幅と撮影画像上におけるパターン光の周期との差の分だけ、視差算出方向において異なる位置に設定する。又は、相関算出部161は、第1の基準画像と第2の基準画像を、第1の基準画像の視差算出方向の幅と撮影画像上におけるパターン光の高輝度領域の幅との差だけ視差算出方向において異なる位置に設定する。若しくは、相関算出部161は、第1の基準画像と第2の基準画像を、第1の基準画像の視差算出方向の幅から撮影画像上におけるパターン光の高輝度領域の幅とパターン光の周期とを引いた量の分だけ、視差算出方向において異なる位置に設定する。   Here, the correlation calculation unit 161 sets the first reference image and the second reference image according to the formula (1a) or the formula (1b). More specifically, the correlation calculation unit 161 determines the first reference image and the second reference image as the width of the first reference image in the parallax calculation direction, or the width and the period of the pattern light on the captured image. Are set at different positions in the parallax calculation direction by the difference between the two. Alternatively, the correlation calculation unit 161 converts the first reference image and the second reference image into a parallax by a difference between the width in the parallax calculation direction of the first reference image and the width of the high-luminance area of the pattern light on the captured image. Set different positions in the calculation direction. Alternatively, the correlation calculation unit 161 converts the first reference image and the second reference image from the width in the parallax calculation direction of the first reference image to the width of the high-brightness region of the pattern light and the cycle of the pattern light. Are set at different positions in the parallax calculation direction by the amount obtained by subtracting.

また、視差算出部162は、第1の相関値と第2の相関値を加算又は加算平均した相関値より視差量を算出する。   Further, the parallax calculation unit 162 calculates the amount of parallax from the correlation value obtained by adding or averaging the first correlation value and the second correlation value.

このような構成から、距離検出装置100が、パターン光を投影した撮影画像を用いた距離検出における視差量の算出誤差を低減することができる。そのため、距離検出装置100は、算出誤差の低減された視差量に基づいて、被写体102の高精度な距離情報を取得することができる。   With such a configuration, the distance detection apparatus 100 can reduce parallax amount calculation errors in distance detection using a captured image on which pattern light is projected. Therefore, the distance detection apparatus 100 can acquire highly accurate distance information of the subject 102 based on the amount of parallax with a reduced calculation error.

なお、本実施例に係る距離検出処理のフローでは、相関演算1の後に相関演算2を行うとしているが、相関演算1において第1の基準画像を設定した後に、相関演算1と相関演算2を並列に処理してもよい。   In the distance detection processing flow according to the present embodiment, the correlation calculation 2 is performed after the correlation calculation 1. However, after setting the first reference image in the correlation calculation 1, the correlation calculation 1 and the correlation calculation 2 are performed. You may process in parallel.

また、本実施例における視差量を算出する方法は、前述したステップS304における方法に限定されるものでない。例えば、視差算出部162が、第1の相関値より第1の視差量を算出し、第2の相関値より第2の視差量を算出し、これらの視差量を加算平均することで最終的な視差量を算出してもよい。この場合には、相関算出部161は、第1及び第2の相関値を用いて第3の相関値を求めなくてよい。   Further, the method for calculating the amount of parallax in the present embodiment is not limited to the method in step S304 described above. For example, the parallax calculation unit 162 calculates the first parallax amount from the first correlation value, calculates the second parallax amount from the second correlation value, and adds and averages these parallax amounts. An appropriate amount of parallax may be calculated. In this case, the correlation calculation unit 161 does not have to obtain the third correlation value using the first and second correlation values.

さらに、図7(a)に示すように、A画像310Aにおいて、注目画素320を中心とし、第1の基準画像701と第2の基準画像702を視差算出方向において互いに逆方向に偏心させて設定してもよい。この場合にも、第1の基準画像701と第2の基準画像702を用いて注目画素320を中心とする部分領域の平均的な距離情報が算出されるため、注目画素320の位置と距離情報との位置ずれを低減することができる。また、前述のように、第1の基準画像701と第2の基準画像702の視差算出方向における位置関係を適切に設定することで、より適切に視差量の算出誤差を低減することができる。   Further, as shown in FIG. 7A, in the A image 310A, the first reference image 701 and the second reference image 702 are decentered in opposite directions in the parallax calculation direction with the target pixel 320 as the center. May be. Also in this case, since the average distance information of the partial area centered on the target pixel 320 is calculated using the first reference image 701 and the second reference image 702, the position and distance information of the target pixel 320 are calculated. Can be reduced. Further, as described above, by appropriately setting the positional relationship between the first reference image 701 and the second reference image 702 in the parallax calculation direction, it is possible to more appropriately reduce the parallax amount calculation error.

本実施例では、第1の基準画像と第2の基準画像の2つの基準画像を設定し、視差量を算出する手法について述べた。しかしながら、第1の基準画像の周囲にさらに多数の基準画像を設定し、各々の基準画像で算出した相関値を用いて視差量を算出してもよい。   In the present embodiment, the method of setting the two reference images of the first reference image and the second reference image and calculating the parallax amount has been described. However, a larger number of reference images may be set around the first reference image, and the amount of parallax may be calculated using the correlation value calculated for each reference image.

例えば、図7(b)に示すように、相関算出部161は、第1の基準画像701と第2の基準画像702と第3の基準画像703を設定し、各々の基準画像を用いて第1の相関値、第2の相関値、及び第3の相関値を算出する。その後、視差算出部162は、上述のように、これらの相関値を加算又は加算平均して求めた相関値より視差量を算出してもよい。また、視差算出部162は、第1の相関値と第2の相関値を加算して求めた相関値より視差量を算出し、第1の相関値と第3の相関値を加算して求めた相関値より視差量を算出し、これらの視差量を加算平均することで最終的な視差量を算出してもよい。   For example, as shown in FIG. 7B, the correlation calculation unit 161 sets a first reference image 701, a second reference image 702, and a third reference image 703, and uses each reference image to set the first reference image 701, the second reference image 702, and the third reference image 703. One correlation value, a second correlation value, and a third correlation value are calculated. Thereafter, the parallax calculation unit 162 may calculate the parallax amount from the correlation value obtained by adding or averaging the correlation values as described above. Further, the parallax calculation unit 162 calculates the amount of parallax from the correlation value obtained by adding the first correlation value and the second correlation value, and obtains it by adding the first correlation value and the third correlation value. The final amount of parallax may be calculated by calculating the amount of parallax based on the correlation value and averaging the parallax amounts.

同じ画像エッジに対して第1の基準画像と第2の基準画像とを設定した場合でも、投影パターンの輝度のばらつきや撮影画像に付与されるノイズ、収差の影響等によって、第1の相関値と第2の相関値とは完全に対称な関係にはならない場合がある。これに対して、より多くの基準画像を設定し、各々の基準画像より求めた相関値を用いて視差量を算出することで、これらの影響を軽減し、視差量の算出誤差をより低減することができる。そのため、当該処理を行うことで、より適切に高精度に測距を行うことができる。   Even when the first reference image and the second reference image are set for the same image edge, the first correlation value is affected by the variation in the brightness of the projection pattern, the noise added to the captured image, the influence of aberration, and the like. And the second correlation value may not be completely symmetric. On the other hand, by setting more reference images and calculating the amount of parallax using the correlation value obtained from each reference image, these effects are reduced and the calculation error of the amount of parallax is further reduced. be able to. Therefore, distance measurement can be performed appropriately and with high accuracy by performing the processing.

さらに、本実施例では、1つの注目画素について、被写体102までの距離を算出する場合について述べた。これに対して、A画像上の複数の画素における距離(距離画像)を効率よく算出する距離検出方法のフローを図8に示す。当該距離検出方法が開始されると、処理はステップS801に移行する。   Furthermore, in the present embodiment, the case where the distance to the subject 102 is calculated for one target pixel has been described. In contrast, FIG. 8 shows a flow of a distance detection method for efficiently calculating distances (distance images) at a plurality of pixels on the A image. When the distance detection method is started, the process proceeds to step S801.

ステップS801「パターン光投影画像取得」では、ステップS301と同様に、投影装置101が被写体102へパターン光投影を行った状態で撮影装置103により撮影を行い、撮影画像を本体メモリ107に記憶させる。   In step S <b> 801 “acquire pattern light projection image”, as in step S <b> 301, the image capturing apparatus 103 captures an image while the projection apparatus 101 projects pattern light onto the subject 102, and the captured image is stored in the main body memory 107.

次に、ステップS802「各画素の相関値算出」では、相関算出部161が、A画像上の各画素における相関値を算出する。具体的には、A画像上において注目画素とその近傍画素を含む部分領域を抜き出して基準画像を設定する。次にB画像上で参照画像を設定し、参照画像を抜き出す位置を視差算出方向に移動させて、各移動量における参照画像と基準画像との相関値を算出することで、各移動量に対する相関値を算出する。この演算を、A画像上の各々の画素を注目画素として設定して行うことで、各画素における相関値を算出する。   Next, in step S802 “Calculate correlation value of each pixel”, the correlation calculation unit 161 calculates a correlation value for each pixel on the A image. Specifically, the reference image is set by extracting a partial region including the target pixel and its neighboring pixels on the A image. Next, a reference image is set on the B image, the position where the reference image is extracted is moved in the parallax calculation direction, and the correlation value between the reference image and the standard image at each movement amount is calculated, thereby correlating with each movement amount. Calculate the value. By performing this calculation by setting each pixel on the A image as a target pixel, a correlation value at each pixel is calculated.

ステップS803「各画素の視差量算出」では、視差算出部162が、A画像上の各画素における視差量を算出する。その後、視差算出部162は、A画像上において注目画素と視差算出方向において所定の位置だけ異なる画素を選択する。このとき、視差算出部162は、注目画素を含む第1の基準画像から前述のように適切な位置にだけ異なるように設定された第2の基準画像における注目画素に対応する画素を選択する。そして、視差算出部162は、注目画素と選択画素について、ステップS802で算出した相関値を選択し、選択した両相関値を用いて視差量を算出する。なお、視差量はステップS304と同様の方法で算出することができる。   In step S803 “calculation of parallax amount of each pixel”, the parallax calculation unit 162 calculates the parallax amount of each pixel on the A image. Thereafter, the parallax calculation unit 162 selects a pixel that differs from the target pixel on the A image by a predetermined position in the parallax calculation direction. At this time, the parallax calculation unit 162 selects a pixel corresponding to the target pixel in the second reference image set so as to be different from the first reference image including the target pixel only at an appropriate position as described above. Then, the parallax calculation unit 162 selects the correlation value calculated in step S802 for the target pixel and the selected pixel, and calculates the parallax amount using the selected both correlation values. The amount of parallax can be calculated by the same method as in step S304.

ステップS804「各画素の距離値算出」では、距離算出部163が、A画像上の各画素における距離値を算出する。具体的には、距離算出部163は、ステップS803の各画素で算出した視差量を、ステップS305と同様に既知の手法を用いてデフォーカス量又は被写体距離に変換する。   In step S804 “calculation of distance value of each pixel”, the distance calculation unit 163 calculates the distance value of each pixel on the A image. Specifically, the distance calculation unit 163 converts the parallax amount calculated in each pixel in step S803 into a defocus amount or a subject distance using a known method, similarly to step S305.

このようなフローにより、各々の注目画素について複数の基準画像を設定して相関値を算出する場合と比べて、重複して行われる相関演算の回数を低減することができ、効率的に複数の画素における距離(距離画像)を算出することができる。   By such a flow, compared with the case where a plurality of reference images are set for each pixel of interest and the correlation value is calculated, the number of correlation operations performed in duplicate can be reduced. A distance (distance image) in the pixel can be calculated.

また、代替例として、ステップS802において、相関算出部161が各画素の相関値を算出した後、視差算出部162がこの相関値を用いて各画素の仮の視差量を算出する。次にステップS803にて、視差算出部162が、ステップS802で算出した各画素の視差量を用いて、注目画素から上述の適切な位置だけ異なる画素の視差量と注目画素の視差量を加算平均することで最終的な視差量を算出してもよい。この場合でも、効率的に複数の画素における距離を算出することができる。なお、仮の視差量の算出は、ステップS803で行われてもよい。   As an alternative example, after the correlation calculation unit 161 calculates the correlation value of each pixel in step S802, the parallax calculation unit 162 calculates a temporary parallax amount of each pixel using the correlation value. Next, in step S803, the parallax calculation unit 162 uses the parallax amount of each pixel calculated in step S802 to add and average the parallax amount of the pixel that differs from the target pixel by the appropriate position described above and the parallax amount of the target pixel. By doing so, the final amount of parallax may be calculated. Even in this case, the distances of a plurality of pixels can be calculated efficiently. The provisional parallax amount may be calculated in step S803.

なお、投影装置101によって被写体102に照射される投影パターンは、視差算出方向に垂直な方向に高輝度領域と低輝度領域が伸びるラインパターンであることが好ましい。投影パターンが視差算出方向に垂直な方向に対して斜めに傾くと、撮影画像に含まれる視差算出方向(瞳分割方向)の空間周波数成分が減少するため、相関演算の精度が低下し、視差量の算出精度が低下する。   Note that the projection pattern irradiated onto the subject 102 by the projection apparatus 101 is preferably a line pattern in which a high luminance region and a low luminance region extend in a direction perpendicular to the parallax calculation direction. When the projection pattern is tilted obliquely with respect to the direction perpendicular to the parallax calculation direction, the spatial frequency component in the parallax calculation direction (pupil division direction) included in the captured image decreases, so the accuracy of the correlation calculation decreases, and the amount of parallax The calculation accuracy of is reduced.

そのため、視差算出方向と投影パターンの明領域が伸びる方向がなす角度は60度以上であることが好ましく、さらに好ましくは80度以上であることが好ましい。視差算出方向に垂直な方向により近い方向に高輝度領域(照明領域)が伸びるパターンを投影し、本実施例で述べた方法で視差量を算出することで、より高精度な測距を行うことができる。   Therefore, the angle formed by the parallax calculation direction and the direction in which the bright area of the projection pattern extends is preferably 60 degrees or more, and more preferably 80 degrees or more. By projecting a pattern in which a high brightness area (illumination area) extends in a direction closer to the direction perpendicular to the parallax calculation direction, and calculating the parallax amount by the method described in this embodiment, more accurate distance measurement is performed. Can do.

また、本実施例では、第1の基準画像の近傍に第2の基準画像を設定し、両基準画像で算出した相関値を用いて視差量を算出することから、投影パターンにおいて、できるだけ同じパターン同士が近傍にあることが望ましい。そのため、投影パターンは周期的に輝度分布が繰り返される周期パターンであることが好ましい。このとき完全な周期パターンであると、相関演算で視差量を算出する際に、一周期ずれた領域が誤って検出される場合がある。そこで、視差量を探索する範囲(参照画像を動かす移動量)をパターンの周期よりも小さくなるように制限することで、この誤検出を回避することができる。   Further, in this embodiment, the second reference image is set in the vicinity of the first reference image, and the parallax amount is calculated using the correlation value calculated in both reference images. It is desirable that they are close to each other. Therefore, the projection pattern is preferably a periodic pattern in which the luminance distribution is periodically repeated. In this case, if the period pattern is complete, an area shifted by one period may be erroneously detected when calculating the amount of parallax by correlation calculation. Therefore, this erroneous detection can be avoided by limiting the range in which the amount of parallax is searched (the amount of movement for moving the reference image) to be smaller than the cycle of the pattern.

また、投影パターンを完全に同じ輝度分布が繰り返されるパターンにする必要はない。投影パターンは周期的に略同じ輝度分布が繰り返されるパターンであればよい。例えば、明領域の視差算出方向における幅がライン毎に異なっていてもよい。また、明領域又は暗領域内に輝度のばらつきがあるパターンであってもよい。適度に輝度変化を与えることで、1周期ずれた領域が誤って検出されることを回避することができる。   Further, the projection pattern does not need to be a pattern in which the same luminance distribution is repeated. The projection pattern may be a pattern in which substantially the same luminance distribution is periodically repeated. For example, the width of the bright region in the parallax calculation direction may be different for each line. Moreover, the pattern which has the dispersion | variation in a brightness | luminance in a bright area | region or a dark area | region may be sufficient. By appropriately changing the luminance, it is possible to avoid erroneous detection of a region shifted by one cycle.

さらに、視差画像を取得する撮影装置は、2つ以上の複数の光学系とそれに対応する撮像素子から構成されたステレオカメラで構成されてもよい。この場合には、基線長の設計自由度が向上し、測距分解能が向上する。また、撮影装置と投影装置とを別の装置として距離検出装置を構成してもよい。   Furthermore, the imaging device that acquires a parallax image may be configured by a stereo camera that includes two or more optical systems and imaging elements corresponding thereto. In this case, the design freedom of the base line length is improved, and the ranging resolution is improved. Further, the distance detection device may be configured with the photographing device and the projection device as separate devices.

なお、制御装置を撮影装置内に備えられたCPU(Central Processing Unit)等を用いて構成する場合、装置を小型化することができる。   Note that when the control device is configured using a CPU (Central Processing Unit) or the like provided in the imaging device, the device can be downsized.

また、投影装置101は、光源としてLD(Laser Diode)を用いてもよい。さらに、パターン形成手段として反射型LCOS(Liquid Crystal On Silicon)や透過型LCOS、DMD(Digital Micromirror Device)を用いてもよい。これらを用いる場合には、被写体の大きさや距離に応じて投影パターンの周期を適時変えることができ、状況に応じてより高精度な測距を行うことができる。   Further, the projection apparatus 101 may use an LD (Laser Diode) as a light source. Further, a reflective LCOS (Liquid Crystal On Silicon), a transmissive LCOS, or a DMD (Digital Micromirror Device) may be used as the pattern forming means. When these are used, the cycle of the projection pattern can be changed as appropriate according to the size and distance of the subject, and more accurate distance measurement can be performed according to the situation.

さらに、投影装置101の光源からの光を、光の波長が可視光域の全域を含む白色とすることで、被写体102の分光反射率によらず反射率補正の効果が得られる。また、使用エネルギーに対する光利用効率の観点から、投影装置101の光源をRGBの3色から構成し、光源からの光の波長を撮影装置103のカラーフィルタ透過帯域と一致させることができる。   Furthermore, by making the light from the light source of the projection device 101 white in which the wavelength of the light includes the entire visible light range, the effect of correcting the reflectance can be obtained regardless of the spectral reflectance of the subject 102. Further, from the viewpoint of light utilization efficiency with respect to energy used, the light source of the projection apparatus 101 can be configured with three colors of RGB, and the wavelength of light from the light source can be matched with the color filter transmission band of the imaging apparatus 103.

投影装置101の光源の波長がIR(Infrared)領域である場合、これに対応した透過帯域及び受光感度を持つカラーフィルタ並びに撮像素子105を備えた撮影装置103を用いて撮影を行うことができる。この場合には、RGB帯域を用いて鑑賞用画像を同時に撮影することができる。特にIRの波長帯域が800nmから1100nmの間である場合、撮像素子の光電変換部にSiを用いることができ、カラーフィルタの配列を変更することで、ひとつの撮像素子によりRGB鑑賞画像とIR測距画像を取得することができる。   When the wavelength of the light source of the projection apparatus 101 is in the IR (Infrared) region, it is possible to perform imaging using the imaging apparatus 103 including the color filter having the corresponding transmission band and light receiving sensitivity and the imaging element 105. In this case, a viewing image can be taken simultaneously using the RGB band. In particular, when the IR wavelength band is between 800 nm and 1100 nm, Si can be used for the photoelectric conversion unit of the image sensor, and by changing the arrangement of the color filters, RGB image and IR measurement can be performed by one image sensor. A distance image can be acquired.

なお、本実施例では、被写体102までの距離を算出する例について示したが、視差量を検出する視差検出装置にも本実施例に係る視差量の算出方法を適用することができる。この場合には、図3において、ステップS305「距離値算出」を省略してもよい。例えば、視差検出装置では、視差量に基づいて、合焦位置近傍の被写体を画像から切り出すなどの処理を施すことができる。この視差量検出装置は、本実施例における距離検出装置100において視差量を距離に変換せずにそのまま出力する構成とすれば、その他の構成は距離検出装置100と同じでよい。   In the present embodiment, an example in which the distance to the subject 102 is calculated has been described. However, the parallax amount calculation method according to the present embodiment can also be applied to a parallax detection device that detects a parallax amount. In this case, step S305 “distance value calculation” may be omitted in FIG. For example, the parallax detection device can perform processing such as cutting out a subject near the in-focus position from an image based on the parallax amount. If this parallax amount detection device is configured to output the parallax amount as it is without converting it into a distance in the distance detection device 100 in this embodiment, the other configuration may be the same as the distance detection device 100.

本実施例に係る距離検出方法は、距離検出装置に適用する他に、コンピュータプログラムとして実現されてもよい。このようなコンピュータプログラムは、距離又は視差量の算出のために、コンピュータ(プロセッサ)に所定の工程を実行させるものである。当該プログラムは、距離検出装置、視差検出装置、又はそのいずれかを備えるデジタルカメラ等の撮像装置のコンピュータにインストールされる。この場合には、インストールされたプログラムがコンピュータによって実行されることで上記の機能が実現し、高精度な距離検出や視差量の検出を行うことができる。   The distance detection method according to the present embodiment may be realized as a computer program in addition to being applied to the distance detection device. Such a computer program causes a computer (processor) to execute a predetermined process in order to calculate a distance or a parallax amount. The program is installed in a computer of an imaging apparatus such as a digital camera equipped with a distance detection apparatus, a parallax detection apparatus, or any one thereof. In this case, the installed program is executed by a computer, thereby realizing the above-described function, and highly accurate distance detection and parallax amount detection can be performed.

(実施例2)
図9を参照して、実施例2による、例えば生産作業用ロボット装置等のロボット装置について説明する。本実施例によるロボット装置900には、架台901と、多関節ロボットアームであるロボットアーム902と、ロボットハンド903と、制御装置905と、距離検出装置100が設けられている。なお、本実施例に係る距離検出装置100は、実施例1による距離検出装置100と同様の装置であるため、同じ参照符号を付し、説明を省略する。
(Example 2)
With reference to FIG. 9, a robot apparatus such as a robot apparatus for production work according to the second embodiment will be described. The robot apparatus 900 according to this embodiment includes a gantry 901, a robot arm 902 that is an articulated robot arm, a robot hand 903, a control device 905, and a distance detection device 100. In addition, since the distance detection apparatus 100 according to the present embodiment is the same apparatus as the distance detection apparatus 100 according to the first embodiment, the same reference numerals are given and description thereof is omitted.

ロボットアーム902は架台901に設置され、ロボットアーム902の先端部には、ロボットハンド903が取り付けられている。ロボットハンド903は、ワーク(工業部品)904を把持し、把持したワーク904を他の部品に組付けることができる。   The robot arm 902 is installed on a mount 901, and a robot hand 903 is attached to the tip of the robot arm 902. The robot hand 903 can grip a work (industrial part) 904 and assemble the gripped work 904 on another part.

ロボットアーム902の先端部には、ワーク904が撮影範囲内に入るように、距離検出装置100が固定されている。なお、距離検出装置100の固定の方法は任意の方法であってよく、着脱可能に構成されていてもよい。距離検出装置100は、撮影を通して取得した画像情報や距離情報を制御装置905に送信する。   The distance detection device 100 is fixed to the tip of the robot arm 902 so that the workpiece 904 is within the imaging range. The method for fixing the distance detection device 100 may be any method and may be configured to be detachable. The distance detection device 100 transmits image information and distance information acquired through shooting to the control device 905.

制御装置905は、ロボットアーム902、ロボットハンド903、及び距離検出装置100等を制御する。制御装置905には、演算部951及び制御部952が設けられている。   The control device 905 controls the robot arm 902, the robot hand 903, the distance detection device 100, and the like. The control device 905 is provided with a calculation unit 951 and a control unit 952.

演算部951は、距離検出装置100から送られてきた距離情報や画像情報に基づいて、ワーク904の位置姿勢の推定や、ロボットアーム902やロボットハンド903の駆動量の算出を行う。制御部952は、距離検出装置100に対して距離検出の指令を送信するタイミングや、演算部951での演算結果に基づいてロボットアーム902、及びロボットハンド903の駆動を制御する。   The calculation unit 951 estimates the position and orientation of the workpiece 904 and calculates the driving amount of the robot arm 902 and the robot hand 903 based on the distance information and image information sent from the distance detection device 100. The control unit 952 controls the driving of the robot arm 902 and the robot hand 903 based on the timing at which a distance detection command is transmitted to the distance detection device 100 and the calculation result of the calculation unit 951.

なお、制御装置905は任意のコンピュータで構成されてよく、制御装置905の各構成要素は、CPUやMPU等の演算装置上で実行されるソフトウェアモジュールによって構成されることができる。同様に、制御装置905の各構成要素は、ASIC等の特定の機能を果たす回路によって構成されてもよい。   Note that the control device 905 may be configured by an arbitrary computer, and each component of the control device 905 can be configured by a software module executed on an arithmetic device such as a CPU or MPU. Similarly, each component of the control device 905 may be configured by a circuit that performs a specific function such as an ASIC.

ロボット装置900を用いた生産工程では、ロボットハンド903で架台901上に配置されたワーク904を把持する。このため、制御部952は、ロボットアーム902に対して、シリアル通信路を介して移動指令を送信し、ワーク904付近にロボットハンド903が移動するように、ロボットアーム902及びロボットハンド903を制御する。   In the production process using the robot apparatus 900, the workpiece 904 placed on the gantry 901 is gripped by the robot hand 903. Therefore, the control unit 952 transmits a movement command to the robot arm 902 via the serial communication path, and controls the robot arm 902 and the robot hand 903 so that the robot hand 903 moves near the workpiece 904. .

ワーク904の位置姿勢は不定であるため、ロボットハンド903によりワーク904の把持を行う前に、ロボット装置900は、距離検出装置100によりワーク904を撮影し、画像情報及び距離情報を取得する。制御装置905の演算部951は、これら画像情報及び距離情報に基づいて、ワーク904の位置姿勢情報を演算し、ワーク904の位置姿勢を推定する。さらに、演算部951は、演算したワーク904の位置姿勢情報に基づいて、ロボットアーム902の移動量を演算する。演算部951は、演算したロボットアーム902の移動量のデータを制御部952に送信する。   Since the position and orientation of the work 904 is indefinite, the robot apparatus 900 captures the work 904 by the distance detection apparatus 100 and acquires image information and distance information before the work 904 is gripped by the robot hand 903. The calculation unit 951 of the control device 905 calculates the position and orientation information of the workpiece 904 based on the image information and the distance information, and estimates the position and orientation of the workpiece 904. Further, the calculation unit 951 calculates the movement amount of the robot arm 902 based on the calculated position and orientation information of the workpiece 904. The calculation unit 951 transmits the calculated movement amount data of the robot arm 902 to the control unit 952.

制御部952は、ロボットアーム902に対して、演算部951から受け取った移動量分だけ移動するように指令を送信する。これにより、ロボットアーム902はワーク904を把持するのに適した位置に移動する。ロボットアーム902の移動が完了したら、制御部952はロボットハンド903に対してハンドを閉じるように指令を送信する。ロボットハンド903は、制御部952からの指令に応じてハンドを閉じてワーク904を把持する。   The control unit 952 transmits a command to the robot arm 902 so as to move by the amount of movement received from the calculation unit 951. As a result, the robot arm 902 moves to a position suitable for gripping the workpiece 904. When the movement of the robot arm 902 is completed, the control unit 952 transmits a command to the robot hand 903 to close the hand. The robot hand 903 closes the hand and grips the workpiece 904 in response to a command from the control unit 952.

制御部952は、ロボットハンド903が把持したワーク904を不図示の本体部品に組み付けるために、所定の位置にロボットアーム902を移動させ、移動した後にロボットハンド903を開くように指令を送信する。これらの作業を繰り返し行うことで、ロボット装置900によるワーク904の組み付け作業が行われる。   The control unit 952 transmits a command to move the robot arm 902 to a predetermined position and to open the robot hand 903 after the movement in order to assemble the workpiece 904 gripped by the robot hand 903 to a main body component (not shown). By repeatedly performing these operations, the assembly operation of the workpiece 904 by the robot apparatus 900 is performed.

一般的なワーク904は表面に模様が無いことが多い。そのため、ロボット装置900では、距離検出装置100の投影装置101からパターン光の投影を行い、ワーク904の表面にテクスチャを重畳した状態で撮影を行う。これにより、高精度な測距を行うことができる。   A general work 904 often has no pattern on the surface. Therefore, in the robot apparatus 900, pattern light is projected from the projection apparatus 101 of the distance detection apparatus 100, and imaging is performed in a state where the texture is superimposed on the surface of the workpiece 904. Thereby, highly accurate ranging can be performed.

また、距離検出装置100は、実施例1と同様に、第1の基準画像と第2の基準画像を適切に設定し、これらの基準画像を用いて算出した相関値より視差量を算出し、距離を求めることで、ワーク904の距離情報をより高精度に取得することできる。これにより、ロボット装置900では、ワーク904の位置姿勢の推定精度が向上し、ロボットアーム902及びロボットハンド903の位置制御の精度が向上し、より高精度な組み付け作業を行うことができる。   Further, the distance detection device 100 sets the first reference image and the second reference image appropriately as in the first embodiment, calculates the amount of parallax from the correlation value calculated using these reference images, By obtaining the distance, the distance information of the workpiece 904 can be acquired with higher accuracy. Thereby, in the robot apparatus 900, the estimation accuracy of the position and orientation of the workpiece 904 is improved, the accuracy of position control of the robot arm 902 and the robot hand 903 is improved, and a more accurate assembly operation can be performed.

上記のように、本実施例に係るロボット装置900は、距離検出装置100と、ロボットアーム902と、ロボットアーム902に設けられたロボットハンド903と、ロボットアーム902及びロボットハンド903を制御する制御装置905とを備える。ここで、距離検出装置100は、ワーク904までの距離を含む距離情報及びワーク904の画像情報を取得する。制御装置905は、距離情報及び画像情報を用いてワーク904の位置姿勢を推定し、推定した位置姿勢に基づいてロボットアーム902及びロボットハンド903を制御する。このような構成により、ロボット装置900では、視差量の算出誤差を低減でき、ワーク904の距離情報をより高精度に取得することで、ワーク904の位置姿勢推定精度を向上させ、より高精度な組み付け作業を行うことができる。   As described above, the robot apparatus 900 according to the present embodiment includes the distance detection apparatus 100, the robot arm 902, the robot hand 903 provided on the robot arm 902, and the control apparatus that controls the robot arm 902 and the robot hand 903. 905. Here, the distance detection apparatus 100 acquires distance information including the distance to the workpiece 904 and image information of the workpiece 904. The control device 905 estimates the position and orientation of the workpiece 904 using the distance information and the image information, and controls the robot arm 902 and the robot hand 903 based on the estimated position and orientation. With such a configuration, the robot apparatus 900 can reduce the parallax amount calculation error, acquire the distance information of the workpiece 904 with higher accuracy, improve the position and orientation estimation accuracy of the workpiece 904, and increase the accuracy of the workpiece 904. Assembly work can be performed.

なお、本実施例では、距離検出装置100をロボットアーム902に固定した例について述べたが、ロボットアーム902とは離れた位置に距離検出装置100を設けてもよい。この場合には、ワーク904が撮影範囲内に入るように距離検出装置100を設置すればよい。また、演算処理部106は距離検出装置100内に設けられなくてもよく、制御装置905内に設けられてもよい。また、演算処理部106で行う処理を制御装置905内の演算部951で行ってもよい。   In this embodiment, the example in which the distance detection device 100 is fixed to the robot arm 902 is described. However, the distance detection device 100 may be provided at a position away from the robot arm 902. In this case, the distance detection device 100 may be installed so that the workpiece 904 falls within the imaging range. In addition, the arithmetic processing unit 106 may not be provided in the distance detection device 100 and may be provided in the control device 905. Further, the processing performed by the arithmetic processing unit 106 may be performed by the arithmetic unit 951 in the control device 905.

距離検出装置100とワーク904との距離は、ロボットアーム902やロボットハンド903の位置に応じて変化する。このとき、投影装置101の投影パターンを変えないで距離検出を行うと、撮影画像上におけるパターンの周期が、距離検出装置100とワーク904との距離に応じて変化する。このため、第1の基準画像と第2の基準画像との最適な位置関係が変化し、視差量の算出誤差を低減させる効果が弱くなることがある。   The distance between the distance detection apparatus 100 and the workpiece 904 changes according to the positions of the robot arm 902 and the robot hand 903. At this time, if distance detection is performed without changing the projection pattern of the projection apparatus 101, the pattern period on the captured image changes according to the distance between the distance detection apparatus 100 and the workpiece 904. For this reason, the optimal positional relationship between the first reference image and the second reference image changes, and the effect of reducing the parallax amount calculation error may be weakened.

そこで、相関算出部161は、投影パターンを撮影して取得した画像を分析し、分析結果に基づいて第2の基準画像の位置を設定してもよい。具体的には、相関算出部161は、投影パターンを撮影して取得した画像組を分析し、画像上におけるパターンの周期を示す画素値の変動の周期を算出・評価する。次に、相関算出部161は、視差算出方向における第1の基準画像の幅とパターンの周期に基づいて、第2の基準画像を設定する位置を決定する。なお、この際には、相関算出部161は、上述した式(1a)又は式(1b)に従って、第2の基準画像の位置を決定することができる。このような処理により、相関算出部161は、距離検出装置100とワーク904との距離に応じて、第2の基準画像の位置を適切に設定することができる。   Therefore, the correlation calculation unit 161 may analyze an image acquired by photographing the projection pattern and set the position of the second reference image based on the analysis result. Specifically, the correlation calculation unit 161 analyzes an image set acquired by photographing a projection pattern, and calculates and evaluates a period of variation in pixel values indicating a pattern period on the image. Next, the correlation calculation unit 161 determines a position where the second reference image is set based on the width of the first reference image and the pattern period in the parallax calculation direction. At this time, the correlation calculation unit 161 can determine the position of the second reference image according to the above-described equation (1a) or equation (1b). By such processing, the correlation calculation unit 161 can appropriately set the position of the second reference image according to the distance between the distance detection device 100 and the workpiece 904.

また、ワーク904とロボットハンド903の距離が近いときほど、面内解像度が高い距離情報を取得し、ワーク904の位置姿勢を高精度に推定することが求められる。ここで、ワーク904の距離は、撮影画像上におけるワーク904の大きさから概略的に算出することができる。また、距離検出装置100によるワーク904の距離情報の取得と制御装置905によるロボットアーム902の制御は時系列で順次行うため、これら処理の1サイクル前に取得した距離情報に基づいて、ワーク904の距離を概略的に知ることもできる。   Further, as the distance between the workpiece 904 and the robot hand 903 is closer, it is required to acquire distance information with higher in-plane resolution and to estimate the position and orientation of the workpiece 904 with higher accuracy. Here, the distance of the workpiece 904 can be roughly calculated from the size of the workpiece 904 on the captured image. In addition, since the distance information of the workpiece 904 by the distance detection device 100 and the control of the robot arm 902 by the control device 905 are sequentially performed in time series, based on the distance information acquired one cycle before these processing, You can also know the distance roughly.

そこで、相関算出部161又は演算処理部106は、概略的なワーク904の距離情報に基づいて、ワーク904の距離が近いほど第1の基準画像と第2の基準画像の大きさが小さくなるように、これら画像の大きさを設定してもよい。この場合、相関算出部161は、投影パターンの画像上における周期と第1の基準画像の大きさとから第2の基準画像の位置を決定することができる。   Therefore, the correlation calculation unit 161 or the arithmetic processing unit 106 makes the size of the first reference image and the second reference image smaller as the distance of the work 904 is closer based on the approximate distance information of the work 904. In addition, the size of these images may be set. In this case, the correlation calculation unit 161 can determine the position of the second reference image from the period of the projection pattern on the image and the size of the first reference image.

また、ワーク904の距離が近いときほど投影パターンの周期が細かくなるように、制御部108によって投影装置101の投影パターンを変更してもよい。これらのような処理により、距離検出装置100とワーク904との距離に応じて、第2の基準画像を適切に設定することができる。   Further, the projection pattern of the projection apparatus 101 may be changed by the control unit 108 so that the cycle of the projection pattern becomes finer as the distance between the workpieces 904 is shorter. Through such processing, the second reference image can be appropriately set according to the distance between the distance detection device 100 and the workpiece 904.

これらの方法により、第2の基準画像を適切に設定することで、ロボット装置900は、距離検出装置100による視差量の算出誤差を低減することができ、ワーク904の距離を高精度に算出することができる。このため、ロボット装置900では、ワーク904の位置姿勢の推定精度が向上し、ロボットアーム902及びロボットハンド903の位置制御の精度が向上し、より高精度な組み付け作業を行うことができる。   By appropriately setting the second reference image by these methods, the robot apparatus 900 can reduce the parallax amount calculation error by the distance detection apparatus 100 and calculate the distance of the workpiece 904 with high accuracy. be able to. For this reason, in the robot apparatus 900, the estimation accuracy of the position and orientation of the workpiece 904 is improved, the accuracy of the position control of the robot arm 902 and the robot hand 903 is improved, and more accurate assembly work can be performed.

(実施例3)
図10(a)及び(b)を参照して、実施例3による距離検出装置について説明する。実施例1による距離検出装置100では投影装置101を設けたが、距離検出装置の構成はこれに限られない。本実施例による距離検出装置110では、投影装置101を設けずに、被写体112の模様を分析し、被写体112への距離を検出する。このような距離検出装置110は、周期的に模様が変化する被写体112に対して距離検出を行う場合に特に有効である。
(Example 3)
With reference to FIGS. 10A and 10B, a distance detection apparatus according to Embodiment 3 will be described. Although the projection apparatus 101 is provided in the distance detection apparatus 100 according to the first embodiment, the configuration of the distance detection apparatus is not limited to this. In the distance detection device 110 according to the present embodiment, the pattern of the subject 112 is analyzed and the distance to the subject 112 is detected without providing the projection device 101. Such a distance detection device 110 is particularly effective when distance detection is performed on a subject 112 whose pattern changes periodically.

なお、本実施例による距離検出装置110は、投影装置101が設けられていない点と、演算処理部116に判定部164が設けられている点を除き、実施例1による距離検出装置100と同様の構成を有する。そのため、演算処理部116及び判定部164以外の構成要素については、実施例1と同じ参照符号を用いて、説明を省略する。以下、本実施例による距離検出装置110と実施例1による距離検出装置100との違いを中心に説明する。   The distance detection device 110 according to the present embodiment is the same as the distance detection device 100 according to the first embodiment except that the projection device 101 is not provided and the determination unit 164 is provided in the arithmetic processing unit 116. It has the composition of. Therefore, constituent elements other than the arithmetic processing unit 116 and the determination unit 164 are denoted by the same reference numerals as those in the first embodiment, and description thereof is omitted. Hereinafter, the difference between the distance detection device 110 according to the present embodiment and the distance detection device 100 according to the first embodiment will be mainly described.

図10(a)は、本実施例による距離検出装置110の概略的な構成例を示す。撮影装置103には、結像光学系104、撮像素子105、演算処理部116、及び本体メモリ107が設けられている。結像光学系104、撮像素子105、及び本体メモリ107は実施例1と同様の構成である。   FIG. 10A shows a schematic configuration example of the distance detection device 110 according to the present embodiment. The imaging apparatus 103 is provided with an imaging optical system 104, an image sensor 105, an arithmetic processing unit 116, and a main body memory 107. The imaging optical system 104, the image sensor 105, and the main body memory 107 have the same configuration as that of the first embodiment.

演算処理部116には、相関算出部161、視差算出部162、及び距離算出部163に加えて、判定部164が設けられている。相関算出部161、視差算出部162、及び距離算出部163は実施例1と同様の構成である。判定部164は、取得した被写体112の撮影画像が周期性を有するか否かを判定し、判定結果を相関算出部161に送信する。相関算出部161は、判定部164から受け取った判定結果に基づいて、相関演算を行う。   In the arithmetic processing unit 116, a determination unit 164 is provided in addition to the correlation calculation unit 161, the parallax calculation unit 162, and the distance calculation unit 163. The correlation calculation unit 161, the parallax calculation unit 162, and the distance calculation unit 163 have the same configuration as in the first embodiment. The determination unit 164 determines whether the acquired captured image of the subject 112 has periodicity, and transmits the determination result to the correlation calculation unit 161. The correlation calculation unit 161 performs a correlation calculation based on the determination result received from the determination unit 164.

図10(b)を参照して、本実施例に係る距離検出方法のフローについて説明する。距離検出方法が開始されると、処理はステップS1001に移行する。   With reference to FIG.10 (b), the flow of the distance detection method which concerns on a present Example is demonstrated. When the distance detection method is started, the process proceeds to step S1001.

ステップS1001「画像取得」では、撮影装置103により被写体112を撮影し、視差を有するA画像とB画像を含む画像組を生成・取得し、取得した画像組を本体メモリ107に蓄える。   In step S1001 “image acquisition”, the subject 112 is photographed by the photographing device 103, an image set including an A image and a B image having parallax is generated and obtained, and the obtained image set is stored in the main body memory 107.

以降の各ステップの処理は、演算処理部116にて行う。ステップS1002「相関演算1」では、相関算出部161が、第1の基準画像を設定し、第1の相関値を算出する。   Processing of each subsequent step is performed by the arithmetic processing unit 116. In step S1002 “correlation calculation 1”, the correlation calculation unit 161 sets a first reference image and calculates a first correlation value.

次に、ステップS1003「周期性判定処理」において、判定部164が、撮影画像の画素値が視差算出方向において周期性を有しているかを判定する。周期性の判定は、例えば、A画像の部分領域画像を抜き出し、抜き出した画像とA画像上の他の部分領域画像との相関演算を行う。相関が高くなる領域が周期的に現れるとき、判定部164は、撮影画像が周期性を有すると判定することができる。また、判定部164は、相関算出部161が求めた第1の相関値を用いて、参照画像の移動量に対して周期的に第1の基準画像と参照画像との相関値が高くなっているか否かを判定してもよい。この場合には、判定部164は、周期的に相関値が高くなっていたら、撮影画像が周期性を有すると判定することができる。ステップS1003において、撮影画像が周期性を有していると判定された場合、処理はステップS1004に移行する。   Next, in step S1003 “periodicity determination processing”, the determination unit 164 determines whether the pixel value of the captured image has periodicity in the parallax calculation direction. For example, the periodicity is determined by extracting a partial area image of the A image and performing a correlation operation between the extracted image and another partial area image on the A image. When the region where the correlation is high appears periodically, the determination unit 164 can determine that the captured image has periodicity. The determination unit 164 uses the first correlation value obtained by the correlation calculation unit 161 to periodically increase the correlation value between the first reference image and the reference image with respect to the movement amount of the reference image. It may be determined whether or not. In this case, the determination unit 164 can determine that the captured image has periodicity if the correlation value periodically increases. If it is determined in step S1003 that the captured image has periodicity, the process proceeds to step S1004.

ステップS1004「相関演算2」では、相関算出部161が第2の基準画像を設定し、第2の相関値を算出する。第2の基準画像の設定方法及び第2の相関値の算出方法は実施例1と同様である。   In step S1004 “correlation calculation 2”, the correlation calculation unit 161 sets a second reference image and calculates a second correlation value. The method for setting the second reference image and the method for calculating the second correlation value are the same as in the first embodiment.

ステップS1005「視差量算出」では、視差算出部162が、ステップS1002及びステップS1004で求めた第1の相関値と第2の相関値より視差量を算出する。視差量の算出方法は実施例1と同様である。なお、本実施例では、パターン光を投影しないため、画像エッジは被写体112の模様のエッジとなる。   In step S1005 “calculation of parallax amount”, the parallax calculation unit 162 calculates the parallax amount from the first correlation value and the second correlation value obtained in steps S1002 and S1004. The method for calculating the amount of parallax is the same as in the first embodiment. In this embodiment, since pattern light is not projected, the image edge becomes the pattern edge of the subject 112.

ステップS1006「距離値算出」では、距離算出部163が、実施例1と同様に、ステップS1005で算出した視差量を既知の手法によりデフォーカス量又は被写体距離に変換する。   In step S1006 “distance value calculation”, the distance calculation unit 163 converts the parallax amount calculated in step S1005 into a defocus amount or a subject distance by a known method, as in the first embodiment.

一方で、ステップS1003において、撮影画像が周期性を有していないと判定された場合には、処理はステップS1007「視差量算出2」に移行する。ステップS1007では、視差算出部162が、ステップS1002で算出した第1の相関値より視差量を算出する。第1の相関値より視差量を算出する方法は前述と同様の方法を用いることができる。ステップS1007で視差量を算出したら、距離算出部163は、ステップS1006において、算出した視差量に基づいて距離値を算出する。   On the other hand, if it is determined in step S1003 that the captured image does not have periodicity, the process proceeds to step S1007 “parallax amount calculation 2”. In step S1007, the parallax calculation unit 162 calculates the amount of parallax from the first correlation value calculated in step S1002. A method similar to that described above can be used as a method of calculating the amount of parallax from the first correlation value. After calculating the parallax amount in step S1007, the distance calculation unit 163 calculates a distance value based on the calculated parallax amount in step S1006.

このような処理により、本実施例による距離検出装置110は、周期的に模様が変化する被写体112に対しても、実施例1と同様の理由により、視差量の算出誤差を低減でき、高精度な距離検出を行うことができる。   By such processing, the distance detection device 110 according to the present embodiment can reduce the parallax amount calculation error for the subject 112 whose pattern changes periodically for the same reason as in the first embodiment, and can achieve high accuracy. Distance detection can be performed.

上記のように、本実施例による距離検出装置110は、撮影装置103で取得した画像組のいずれかの画像が視差算出方向において周期性を有するかを判定する判定部164を備える。そして、画像組のいずれかの画像が視差算出方向において周期性を有すると判断された場合に、相関算出部161が第1の相関値と第2の相関値を算出し、視差算出部162が、第1の相関値及び第2の相関値を用いて視差量を算出する。これにより、距離検出装置110は、パターン光を投影しない場合であっても、被写体112が有する周期的に変化する模様に基づいて、視差量の算出誤差を低減でき、高精度な測距を行うことができる。   As described above, the distance detection device 110 according to the present embodiment includes the determination unit 164 that determines whether any image in the image set acquired by the imaging device 103 has periodicity in the parallax calculation direction. When it is determined that any image in the image set has periodicity in the parallax calculation direction, the correlation calculation unit 161 calculates the first correlation value and the second correlation value, and the parallax calculation unit 162 The amount of parallax is calculated using the first correlation value and the second correlation value. As a result, the distance detection device 110 can reduce parallax amount calculation errors and perform highly accurate distance measurement based on the periodically changing pattern of the subject 112 even when pattern light is not projected. be able to.

なお、本実施例に係る距離検出装置は、実施例2と同様にロボット装置に対して適用されてもよい。この場合であっても、ワークの距離を高精度に算出することができる。そのため、ワークの位置姿勢の推定精度を向上させることで、ロボットアーム及びロボットハンドの位置制御の精度を向上させ、より高精度な組み付け作業を行うことができる。   Note that the distance detection apparatus according to the present embodiment may be applied to the robot apparatus as in the second embodiment. Even in this case, the distance of the workpiece can be calculated with high accuracy. Therefore, by improving the estimation accuracy of the position and orientation of the workpiece, it is possible to improve the accuracy of position control of the robot arm and robot hand, and to perform more accurate assembly work.

また、本実施例に係る距離検出方法における視差検出方法は、実施例1と同様に、検出した視差量を出力するための視差検出装置に適用されてもよい。この場合にも、周期的に模様が変化する被写体に対する視差量の検出誤差を低減させることができる。   Further, the parallax detection method in the distance detection method according to the present embodiment may be applied to a parallax detection device for outputting the detected amount of parallax, as in the first embodiment. Also in this case, it is possible to reduce the detection error of the parallax amount for the subject whose pattern changes periodically.

(実施例4)
実施例1では、1つの投影パターンの光を撮影した画像において視差算出方向における異なる箇所に基準画像を設定し、各基準画像に関して参照画像との相関値を算出して距離を検出した。これに対し、実施例4に係る距離検出装置では、視差算出方向にずらした2つの投影パターンの光を撮影した2つの画像組における同一箇所に基準画像を設定し、各基準画像に関して参照画像との相関値を算出して距離を検出する。
Example 4
In Example 1, reference images are set at different locations in the parallax calculation direction in an image obtained by photographing light of one projection pattern, and a correlation value with a reference image is calculated for each reference image to detect a distance. On the other hand, in the distance detection device according to the fourth embodiment, the reference image is set at the same location in the two image sets obtained by photographing the light of the two projection patterns shifted in the parallax calculation direction, and the reference image is related to each reference image. The correlation value is calculated and the distance is detected.

以下、図11(a)乃至15(b)を参照して、本実施例による距離検出装置について説明する。本実施例による距離検出装置の構成は実施例1による距離検出装置100の構成と同様であるため、実施例1と同じ参照符号を用いて説明を省略する。以下、本実施例による距離検出装置と実施例1による距離検出装置100との違いを中心に説明する。   Hereinafter, the distance detection apparatus according to the present embodiment will be described with reference to FIGS. 11 (a) to 15 (b). Since the configuration of the distance detection device according to the present embodiment is the same as the configuration of the distance detection device 100 according to the first embodiment, the same reference numerals as those of the first embodiment are used and description thereof is omitted. Hereinafter, the difference between the distance detection device according to the present embodiment and the distance detection device 100 according to the first embodiment will be mainly described.

本実施例における投影するパターン光を図11(a)と図11(b)に示す。第1のパターン光であるパターン光1101は、x軸方向に高輝度領域と低輝度領域が交互に繰り返され、周期1103を有している。また、パターン光1101は、y軸方向に各輝度領域が伸びるラインパターンを有している。第2のパターン光であるパターン光1102は、パターン光1101と同じx軸方向に周期的な輝度分布を有するとともに、y軸方向に各輝度領域が伸びるラインパターンを有している。パターン光1102のラインパターンは、パターン光1101のラインパターンとはx軸方向における位置がずれている。   FIG. 11A and FIG. 11B show pattern light to be projected in this embodiment. The pattern light 1101 that is the first pattern light has a period 1103 in which a high luminance region and a low luminance region are alternately repeated in the x-axis direction. The pattern light 1101 has a line pattern in which each luminance region extends in the y-axis direction. The pattern light 1102 as the second pattern light has a periodic luminance distribution in the same x-axis direction as the pattern light 1101 and a line pattern in which each luminance region extends in the y-axis direction. The line pattern of the pattern light 1102 is shifted in position in the x-axis direction from the line pattern of the pattern light 1101.

次に、図12(a)乃至(c)を参照して、本実施例に係る測距演算フローについて説明する。図12(a)は本実施例に係る距離検出処理のフローチャートであり、図12(b)及び(c)は、相関算出部161によって行う相関演算を説明するための図である。本実施例に係る距離検出処理が開始されると、処理はステップS1201に移行する。   Next, a ranging calculation flow according to the present embodiment will be described with reference to FIGS. FIG. 12A is a flowchart of distance detection processing according to the present embodiment, and FIGS. 12B and 12C are diagrams for explaining the correlation calculation performed by the correlation calculation unit 161. When the distance detection process according to the present embodiment is started, the process proceeds to step S1201.

ステップS1201「パターン光投影画像取得1」では、投影装置101から被写体102へパターン光1101を投影している状態で、撮影装置103を用いて撮影を行い、撮影画像を本体メモリ107に記憶させる。なお、パターン光の投影方法は実施例1と同様であるため説明を省略する。   In step S1201 “pattern light projection image acquisition 1”, the patterning light 1101 is projected from the projection apparatus 101 onto the subject 102, and the photographing is performed using the photographing apparatus 103, and the photographed image is stored in the main body memory 107. Since the pattern light projection method is the same as that of the first embodiment, description thereof is omitted.

ステップS1202「パターン光投影画像取得2」では、被写体102へパターン光1102を投影している状態で撮影を行い、撮影画像を本体メモリ107に記憶させる。パターン光の投影方法は実施例1と同様であるため説明を省略する。   In step S1202 “pattern light projection image acquisition 2”, photographing is performed while the pattern light 1102 is projected onto the subject 102, and the photographed image is stored in the main body memory 107. Since the pattern light projection method is the same as that of the first embodiment, the description thereof is omitted.

ステップS1203からステップS1206の処理は、演算処理部106によって行う。ここで、図12(b)及び(c)は、それぞれ、ステップS1203及びステップS1204にて設定する基準画像及び参照画像の位置関係を説明するための図である。図12(b)にはステップS1201で取得されたA画像1210A及びB画像1210Bが示され、図12(c)にはステップS1202で取得されたA画像1220A及びB画像1220Bが示されている。以下、A画像1210A及びA画像1220A上の同じ位置にある、距離算出を行う画素を注目画素1230として説明する。   The processing from step S1203 to step S1206 is performed by the arithmetic processing unit 106. Here, FIGS. 12B and 12C are diagrams for explaining the positional relationship between the standard image and the reference image set in steps S1203 and S1204, respectively. FIG. 12B shows the A image 1210A and the B image 1210B acquired in step S1201, and FIG. 12C shows the A image 1220A and the B image 1220B acquired in step S1202. Hereinafter, a pixel for which distance calculation is performed at the same position on the A image 1210A and the A image 1220A will be described as a target pixel 1230.

ステップS1203「相関演算1」では、相関算出部161が、ステップS1201で取得した画像組を用いて第1の相関値を算出する。具体的には、相関算出部161は、A画像1210A上において、注目画素1230とその近傍画素を含む部分領域を抜き出し、第1の基準画像1211として設定する。次に、相関算出部161は、B画像1210B上において、第1の基準画像1211と同じ面積(画像サイズ)の領域を抜き出して参照画像1212として設定する。その後、相関算出部161は、B画像1210B上で参照画像1212を抜き出す位置を瞳分割方向と同じx軸方向に移動させて、各移動量(各位置)における参照画像1212と第1の基準画像1211との相関値を算出する。これにより、相関算出部161は、各移動量に対応する相関値のデータ列からなる第1の相関値を算出する。   In step S1203 “correlation calculation 1”, the correlation calculation unit 161 calculates a first correlation value using the image set acquired in step S1201. Specifically, the correlation calculation unit 161 extracts a partial region including the target pixel 1230 and its neighboring pixels on the A image 1210A, and sets it as the first reference image 1211. Next, the correlation calculation unit 161 extracts a region having the same area (image size) as that of the first reference image 1211 on the B image 1210B and sets it as a reference image 1212. Thereafter, the correlation calculation unit 161 moves the position where the reference image 1212 is extracted on the B image 1210B in the same x-axis direction as the pupil division direction, and the reference image 1212 and the first reference image at each movement amount (each position). Correlation value with 1211 is calculated. Thereby, the correlation calculation unit 161 calculates a first correlation value including a data string of correlation values corresponding to each movement amount.

なお、相関値の算出方法は、実施例1に係るステップS302と同様であってよい。また、相関算出部161は、参照画像1212を第1の基準画像1211の縦及び横寸法と同じ縦及び横寸法を有する画像として設定することができる。   The correlation value calculation method may be the same as that in step S302 according to the first embodiment. In addition, the correlation calculation unit 161 can set the reference image 1212 as an image having the same vertical and horizontal dimensions as the vertical and horizontal dimensions of the first standard image 1211.

次に、ステップS1204「相関演算2」では、相関算出部161は、ステップS1202で取得した画像組を用いて第2の相関値を算出する。具体的には、相関算出部161は、A画像1220A上において、注目画素1230とその近傍画素を含む部分領域を抜き出し、第2の基準画像1221として設定する。次に、相関算出部161は、B画像1220B上において、第2の基準画像1221と同じ面積の領域を抜き出して参照画像1222として設定する。その後、相関算出部161は、ステップS1203と同様に、参照画像1222の位置を視差算出方向に移動させ、第2の基準画像1221との相関値を算出することで、各移動量に対応する相関値のデータ列からなる第2の相関値を算出する。なお、参照画像1212,1222の設定条件等は、実施例1と同様であってよい。   Next, in step S1204 “correlation calculation 2”, the correlation calculation unit 161 calculates a second correlation value using the image set acquired in step S1202. Specifically, the correlation calculation unit 161 extracts a partial region including the target pixel 1230 and its neighboring pixels on the A image 1220A, and sets it as the second reference image 1221. Next, the correlation calculation unit 161 extracts a region having the same area as that of the second reference image 1221 on the B image 1220B and sets it as the reference image 1222. Thereafter, as in step S1203, the correlation calculation unit 161 moves the position of the reference image 1222 in the parallax calculation direction, and calculates a correlation value with the second reference image 1221 so that the correlation corresponding to each movement amount is obtained. A second correlation value composed of a data string of values is calculated. The setting conditions for the reference images 1212 and 1222 may be the same as those in the first embodiment.

ステップS1205「視差量算出」では、視差算出部162が、実施例1に係るステップS304と同様に、ステップS1203及びステップS1204で求めた第1の相関値と第2の相関値を用いて視差量を算出する。より具体的には、視差算出部162は、第1の相関値と第2の相関値の各移動量における相関値をそれぞれ加算又は加算平均し、第3の相関値を算出し、第3の相関値に基づいて視差量を算出する。また、ステップS1206「距離値算出」では、距離算出部163が、実施例1に係るステップS305と同様に、既知の手法により視差量をデフォーカス量又は被写体距離に変換し、被写体102までの距離を算出する。   In step S1205 “parallax amount calculation”, the parallax calculation unit 162 uses the first correlation value and the second correlation value obtained in steps S1203 and S1204 in the same manner as in step S304 according to the first embodiment. Is calculated. More specifically, the parallax calculation unit 162 adds or averages the correlation values of the movement amounts of the first correlation value and the second correlation value, respectively, calculates a third correlation value, The amount of parallax is calculated based on the correlation value. Also, in step S1206 “distance value calculation”, the distance calculation unit 163 converts the parallax amount into the defocus amount or the subject distance by a known method, as in step S305 according to the first embodiment, and the distance to the subject 102. Is calculated.

このように本実施例による距離検出方法では、瞳分割方向(視差算出方向)においてラインパターンが異なる第1の画像組及び第2の画像組について、それぞれ第1の基準画像1211と第2の基準画像1221を設定する。その後、第1の基準画像1211と第1の基準画像1211に対して設定された参照画像1212との相関値、及び第2の基準画像1221と第2の基準画像1221に対して設定された参照画像1222との相関値を算出し、両相関値より視差量を算出する。当該処理によれば、各々の画像組より第1の相関値と第2の相関値を算出し、両相関値より視差量を算出することで、投影パターンの輝度分布と基準画像の位置とに関係して発生する測距誤差を軽減することができ、高精度な測距を行うことができる。   As described above, in the distance detection method according to this embodiment, the first reference image 1211 and the second reference set are respectively obtained for the first image set and the second image set having different line patterns in the pupil division direction (parallax calculation direction). An image 1221 is set. Thereafter, the correlation value between the first reference image 1211 and the reference image 1212 set for the first reference image 1211, and the reference set for the second reference image 1221 and the second reference image 1221. A correlation value with the image 1222 is calculated, and a parallax amount is calculated from both correlation values. According to this process, the first correlation value and the second correlation value are calculated from each image set, and the parallax amount is calculated from both correlation values, so that the brightness distribution of the projection pattern and the position of the reference image are obtained. A related measurement error can be reduced, and highly accurate distance measurement can be performed.

ここで、図13を参照して、本実施例による距離検出方法の処理結果の一例について述べる。図13は、既知の距離において、撮影装置103と並行となるように配置した平板に、投影装置101を用いてパターン光を投影して、撮影装置103で撮影し、平板上の各位置における視差量を算出した結果を示すグラフである。図13の横軸は移動量(画素位置)を表しており、縦軸は視差量の算出誤差を表している。図13には、従来の処理として、第1のパターン光のみを投影して取得した画像組から算出した視差量の算出誤差1301が破線で示され、本実施例に係る手法で算出した視差量の算出誤差1302が実線で示されている。従来と比べて本実施例に係る手法により、誤差量が0に近き、視差量の算出誤差を低減していることが分かる。従って、本実施例に係る手法によれば、高精度に測距することができる。   Here, an example of the processing result of the distance detection method according to the present embodiment will be described with reference to FIG. FIG. 13 shows the parallax at each position on the flat plate, which is projected by using the projection device 101 to project pattern light onto a flat plate arranged in parallel with the photographing device 103 at a known distance. It is a graph which shows the result of having calculated quantity. The horizontal axis in FIG. 13 represents the movement amount (pixel position), and the vertical axis represents the parallax amount calculation error. In FIG. 13, as a conventional process, a parallax amount calculation error 1301 calculated from an image set obtained by projecting only the first pattern light is indicated by a broken line, and the parallax amount calculated by the method according to the present embodiment Is calculated by a solid line. It can be seen that the error amount is close to 0 and the parallax amount calculation error is reduced by the method according to the present embodiment as compared with the conventional case. Therefore, according to the method according to the present embodiment, the distance can be measured with high accuracy.

次に、図14(a)乃至(f)を参照して、従来の処理では視差量の算出に誤差が発生し、本実施例による処理では視差量の算出誤差が低減する理由について説明する。以降の説明では、A画像とB画像は同じ濃淡を有する画像で視差が無いものと仮定する。図14(a)乃至(c)は誤差の発生理由を説明する図である。なお、誤差の発生理由に関しては、実施例1で説明したものと同様であるため、説明を簡略化する。   Next, with reference to FIGS. 14A to 14F, the reason why an error occurs in the calculation of the parallax amount in the conventional process and the calculation error of the parallax amount is reduced in the process according to the present embodiment will be described. In the following description, it is assumed that the A image and the B image have the same shading and have no parallax. FIGS. 14A to 14C are diagrams for explaining the reason for the error. The reason for the occurrence of the error is the same as that described in the first embodiment, and therefore the description is simplified.

図14(a)は、明領域及び暗領域が交互に現れるラインパターンを有するA画像1401と基準画像1402及び基準画像1403との位置関係を示した図である。基準画像1402は、A画像1401の明領域と暗領域が切り替わる画像エッジ1404(境界部)を基準画像1402の内部に含んでいる。図14(b)は、基準画像1402に対して設定された参照画像を移動させて基準画像1402と参照画像の相関演算を行うことで算出される各相関値を示している。   FIG. 14A is a diagram showing a positional relationship between an A image 1401 having a line pattern in which bright areas and dark areas alternately appear, a reference image 1402 and a reference image 1403. The reference image 1402 includes an image edge 1404 (boundary portion) in which the bright area and the dark area of the A image 1401 are switched inside the reference image 1402. FIG. 14B shows each correlation value calculated by moving the reference image set with respect to the standard image 1402 and performing a correlation calculation between the standard image 1402 and the reference image.

相関値C0,Cp,Cmはそれぞれ参照画像の位置を0、+1、−1画素だけ移動させたときの相関値である。この場合、実施例1で説明したように、相関値Cp,Cmに対応する参照画像の移動量の絶対値は同じであるため、ラインパターン上の画像エッジ1404に起因する画像間の差も同量となる。そのため、相関値Cpと相関値Cmは同じ値となる。この相関値を内挿して相関曲線1410を求め、最も高い相関値となる移動量(視差量)を算出することで視差量1411が求まり、正しい値(視差量0)が求まる。   Correlation values C0, Cp, and Cm are correlation values when the position of the reference image is moved by 0, +1, and −1 pixel, respectively. In this case, as described in the first embodiment, since the absolute value of the movement amount of the reference image corresponding to the correlation values Cp and Cm is the same, the difference between images caused by the image edge 1404 on the line pattern is also the same. It becomes quantity. Therefore, the correlation value Cp and the correlation value Cm are the same value. The correlation value is interpolated to obtain a correlation curve 1410, and the amount of parallax 1411 is obtained by calculating the movement amount (parallax amount) that is the highest correlation value, and the correct value (parallax amount 0) is obtained.

一方、基準画像1403では、画像エッジ1404と基準画像1403の右端が重なる。図14(c)は、基準画像1403に対して設定された参照画像を移動させて基準画像1403と参照画像の相関演算を行うことで算出される各相関値を示している。実施例1で説明したように、この場合の相関値は、参照画像の移動量の+側と−側で非対称となり、これを内挿した相関曲線1412により求まる視差量1413は正しい値(視差量0)とは異なる値となり、誤差が発生する。これが、投影パターンの輝度分布と基準画像の位置とに関係して発生する視差量の算出誤差となる。   On the other hand, in the reference image 1403, the image edge 1404 and the right end of the reference image 1403 overlap. FIG. 14C shows each correlation value calculated by moving the reference image set with respect to the standard image 1403 and performing correlation calculation between the standard image 1403 and the reference image. As described in the first embodiment, the correlation value in this case is asymmetrical on the + side and the − side of the movement amount of the reference image, and the parallax amount 1413 obtained from the correlation curve 1412 obtained by interpolating this is a correct value (parallax amount). 0) and an error occurs. This is a calculation error of the amount of parallax generated in relation to the luminance distribution of the projection pattern and the position of the reference image.

次に、本実施例のように、視差算出方向に位置ずれした第1のパターン光と第2のパターンを投影して取得した各々の画像組より第1の相関値と第2の相関値を算出し、両相関値より視差量を算出することで、前述の誤差が低減する理由について説明する。図14(d)は、第1のパターン光を投影して取得したA画像1401と第1の基準画像1403の位置を示した図である。図14(e)は、第2のパターン光を投影して取得したA画像1405と第2の基準画像1406の位置を示した図である。図14(f)は、各基準画像を用いて算出される相関値を示している。   Next, as in this embodiment, the first correlation value and the second correlation value are obtained from the respective image sets obtained by projecting the first pattern light and the second pattern that are displaced in the parallax calculation direction. The reason why the aforementioned error is reduced by calculating and calculating the parallax amount from both correlation values will be described. FIG. 14D is a diagram showing the positions of the A image 1401 and the first reference image 1403 acquired by projecting the first pattern light. FIG. 14E is a diagram showing the positions of the A image 1405 and the second reference image 1406 acquired by projecting the second pattern light. FIG. 14F shows the correlation value calculated using each reference image.

第1の基準画像1403として、前述と同様に画像エッジ1404と基準画像の右端が重なる基準画像を仮定する。このとき、第1の基準画像1403より算出される第1の相関値Cm1,C01,Cp1は、図14(c)に示す相関値Cm,C0,Cpと同様になる。   As the first reference image 1403, a reference image in which the image edge 1404 and the right end of the reference image overlap is assumed as described above. At this time, the first correlation values Cm1, C01, Cp1 calculated from the first reference image 1403 are the same as the correlation values Cm, C0, Cp shown in FIG.

次に、第1の基準画像1403と同じ位置に設定した第2の基準画像1406の左端と画像エッジ1407が重なるように第2のパターン光を投影する。このとき、第2の基準画像1406と画像エッジ1407との位置関係は、第1の基準画像1403と画像エッジ1404との位置関係を反転した関係になる。そのため、図14(f)で示したように、第2の基準画像1406を用いて得られる第2の相関値Cm2,C02,Cp2は、第1の相関値Cm1,C01,Cp1を反転したものとなる。   Next, the second pattern light is projected so that the left edge of the second reference image 1406 set at the same position as the first reference image 1403 and the image edge 1407 overlap. At this time, the positional relationship between the second reference image 1406 and the image edge 1407 is a relationship obtained by inverting the positional relationship between the first reference image 1403 and the image edge 1404. Therefore, as shown in FIG. 14F, the second correlation values Cm2, C02, Cp2 obtained using the second reference image 1406 are obtained by inverting the first correlation values Cm1, C01, Cp1. It becomes.

これらの相関値を参照画像の位置(移動量)毎に加算平均すると、相関値は第3の相関値Cm3,C03,Cp3のようになる。第3の相関値は、参照画像の移動量の+側と−側の非対称性がキャンセルされ、対称となる。この場合、相関値を内挿した相関曲線1414より求まる視差量1415は正しい視差量(視差量0)となり、適切な視差量を算出することができる。本実施例による処理では、このような原理により視差量の算出誤差を低減することができ、適切に算出された視差量に基づいて高精度に測距を行うことができる。   When these correlation values are added and averaged for each position (movement amount) of the reference image, the correlation values become the third correlation values Cm3, C03, and Cp3. The third correlation value is symmetrical because the asymmetry on the + side and − side of the movement amount of the reference image is canceled. In this case, the parallax amount 1415 obtained from the correlation curve 1414 obtained by interpolating the correlation value is a correct parallax amount (parallax amount 0), and an appropriate parallax amount can be calculated. In the process according to the present embodiment, the calculation error of the parallax amount can be reduced based on such a principle, and the distance can be measured with high accuracy based on the appropriately calculated parallax amount.

本実施例では、第1のパターン光と第2のパターンの位置を、視差算出方向において適切な量だけ異ならせることで、視差量の算出誤差をより低減することができる。図15(a)及び(b)は、各基準画像についての第1のパターン光と第2のパターン光の適切な位置を説明する図である。   In the present embodiment, the calculation error of the parallax amount can be further reduced by making the positions of the first pattern light and the second pattern different by an appropriate amount in the parallax calculation direction. FIGS. 15A and 15B are diagrams for explaining appropriate positions of the first pattern light and the second pattern light for each reference image.

第1の基準画像1403と第2の基準画像1406は、それぞれ、第1のパターン光及び第2のパターン光を用いて取得した画像1401,1405上の同じ位置に設定した基準画像である。第1の基準画像1403の右端と第1のパターン光による画像エッジ1404は重なっている。   The first reference image 1403 and the second reference image 1406 are reference images set at the same positions on the images 1401 and 1405 obtained using the first pattern light and the second pattern light, respectively. The right edge of the first reference image 1403 and the image edge 1404 due to the first pattern light overlap.

ここで、第1の基準画像1403を用いたときに相関値に発生する誤差を、第2の基準画像1406を用いて算出した相関値でキャンセルする場合を考える。この場合には、第1の基準画像1403の右端における画像エッジ1404に起因する相関値の誤差をキャンセルするため、第2の基準画像1406の左端に関して画像エッジに起因する相関値の誤差が生じるように、第2のパターン光を設定すればよい。なお、パターン光の設定は、演算処理部106によって行われてもよいし、制御部108によって行われてもよい。   Here, a case is considered where an error occurring in the correlation value when the first reference image 1403 is used is canceled with the correlation value calculated using the second reference image 1406. In this case, since the error of the correlation value due to the image edge 1404 at the right end of the first reference image 1403 is canceled, the error of the correlation value due to the image edge is generated with respect to the left end of the second reference image 1406. In addition, the second pattern light may be set. The setting of the pattern light may be performed by the arithmetic processing unit 106 or the control unit 108.

図15(a)は、第2の基準画像1406の左端が第2のパターン光による画像エッジ1407と重なる場合を示している。この場合には、第1の基準画像1403を用いて算出した第1の相関値に発生する誤差を、第2の基準画像1406を用いて算出した第2の相関値でキャンセルすることができる。   FIG. 15A shows a case where the left end of the second reference image 1406 overlaps with the image edge 1407 by the second pattern light. In this case, an error occurring in the first correlation value calculated using the first reference image 1403 can be canceled with the second correlation value calculated using the second reference image 1406.

また、図15(b)は、第2の基準画像1406の左端と第2のパターン光による他の画像エッジ1508とが重なる場合を示している。この場合にも、第1の基準画像1403を用いて算出した第1の相関値に発生する誤差を、第2の基準画像1406を用いて算出した第2の相関値でキャンセルすることができる。   FIG. 15B shows a case where the left end of the second reference image 1406 and another image edge 1508 due to the second pattern light overlap. Also in this case, an error occurring in the first correlation value calculated using the first reference image 1403 can be canceled with the second correlation value calculated using the second reference image 1406.

これらの場合における、第1のパターン光と第2のパターン光との視差算出方向(x軸方向)における位置の差を求めると、上述した式(1a)又は式(1b)で表すことができる。なお、式中のW、P、H、及びnは実施例1において説明したパラメータと同様のパラメータとすることができる。   If the position difference in the parallax calculation direction (x-axis direction) between the first pattern light and the second pattern light in these cases is obtained, it can be expressed by the above-described equation (1a) or equation (1b). . Note that W, P, H, and n in the equation can be the same parameters as those described in the first embodiment.

本実施例による距離検出方法では、第1のパターン光と第2のパターン光との位置を、式(1a)又は式(1b)で示す量だけ視差算出方向に互いに異ならせることで、最も適切に視差量の算出誤差を低減することができ、高精度な測距を行うことができる。なお、パターン光の位置は、制御部108によって、投影装置101において、光源に対してパターンマスク等のパターン形成手段の位置を制御・変更することで、変更することができる。また、制御部108の制御に応じて、投影装置101内の空間光変調器を制御したり、複数のパターン形成手段を切り替えて用いたりする等、その他の既知の任意方法によりパターン光の位置を変更してもよい。   In the distance detection method according to the present embodiment, the positions of the first pattern light and the second pattern light are different from each other in the parallax calculation direction by the amount indicated by the formula (1a) or the formula (1b). In addition, the parallax amount calculation error can be reduced, and highly accurate distance measurement can be performed. The position of the pattern light can be changed by the control unit 108 by controlling / changing the position of the pattern forming unit such as the pattern mask with respect to the light source in the projection apparatus 101. Further, according to the control of the control unit 108, the position of the pattern light is adjusted by other known arbitrary methods such as controlling the spatial light modulator in the projection apparatus 101 or switching between a plurality of pattern forming means. It may be changed.

上記のように、本実施例に係る投影装置101は、視差算出方向において互いに対して位置がずれたパターンを有する第1のパターン光と第2のパターン光を投影する。相関算出部161は、第1のパターン光を投影して取得した第1の画像組に基づいて第1の相関値を算出し、第2のパターン光が投影して取得した第2の画像組に基づいて第2の相関値を算出する。なお、相関算出部161は、第1の画像組の片方の画像及び第2の画像組の片方の画像上の同じ位置に設定した基準画像を用いて、第1の相関値と第2の相関値とを算出する。視差算出部162は、第1の相関値と第2の相関値を用いて視差量を算出する。   As described above, the projection apparatus 101 according to the present embodiment projects the first pattern light and the second pattern light having patterns whose positions are shifted from each other in the parallax calculation direction. The correlation calculation unit 161 calculates a first correlation value based on the first image set obtained by projecting the first pattern light, and the second image set obtained by projecting the second pattern light. The second correlation value is calculated based on The correlation calculation unit 161 uses the reference image set at the same position on one image of the first image set and one image of the second image set, and uses the first correlation value and the second correlation value. Value. The parallax calculation unit 162 calculates the amount of parallax using the first correlation value and the second correlation value.

ここで、第1のパターン光と第2のパターン光は、視差算出方向において高輝度領域と低輝度領域とが交互に繰り返される周期的な光であり、視差算出方向に垂直な第2の方向に高輝度領域及び低輝度領域が伸びるラインパターンを有する。特に、本実施例において、第1のパターン光と第2のパターン光は、同じ輝度分布を有するパターン光を互いに対して視差算出方向にずらした光である。   Here, the first pattern light and the second pattern light are periodic lights in which the high luminance region and the low luminance region are alternately repeated in the parallax calculation direction, and the second direction is perpendicular to the parallax calculation direction. Have a line pattern in which a high luminance region and a low luminance region extend. In particular, in the present embodiment, the first pattern light and the second pattern light are light obtained by shifting pattern lights having the same luminance distribution in the parallax calculation direction with respect to each other.

また、投影装置101は、式(1a)又は式(1b)に従って、位置が設定された第1のパターン光と第2のパターン光を投影する。より具体的には、演算処理部106は、基準画像の視差算出方向の幅、又は該幅と撮影画像における第1のパターン光の周期との差の分だけ、視算出方向において第1のパターン光と第2のパターン光の位置をずらして設定する。又は、演算処理部106は、基準画像の視差算出方向の幅と撮影画像における第1のパターン光の高輝度領域の幅との差の分だけ、視算出方向において第1のパターン光と第2のパターン光の位置をずらして設定する。若しくは、演算処理部106は、当該差から撮影画像における第1のパターン光の周期を引いた量だけ、視差算出方向において第1のパターン光と第2のパターンの光の位置をずらして設定する。投影装置101は、設定された位置に基づいて、第1のパターン光が有するパターンと第2のパターン光が有するパターンの視差算出方向における位置が異なるように、第1及び第2のパターン光を投影する。   Further, the projection apparatus 101 projects the first pattern light and the second pattern light whose positions are set according to the formula (1a) or the formula (1b). More specifically, the arithmetic processing unit 106 sets the first pattern in the visual calculation direction by the width of the reference image in the parallax calculation direction or the difference between the width and the period of the first pattern light in the captured image. The positions of the light and the second pattern light are shifted and set. Alternatively, the arithmetic processing unit 106 may match the first pattern light and the second pattern light in the visual calculation direction by the difference between the width of the parallax calculation direction of the reference image and the width of the high brightness area of the first pattern light in the captured image. The position of the pattern light is shifted and set. Alternatively, the arithmetic processing unit 106 sets the positions of the light of the first pattern light and the second pattern in the parallax calculation direction by an amount obtained by subtracting the period of the first pattern light in the captured image from the difference. . The projection apparatus 101 outputs the first and second pattern lights based on the set positions so that the positions of the pattern of the first pattern light and the pattern of the second pattern light in the parallax calculation direction are different. Project.

このような構成から、本実施例に係る距離検出装置は、パターン光を投影した撮影画像を用いた距離検出における視差量の算出誤差を低減することができる。そのため、距離検出装置は、算出誤差の低減された視差量に基づいて、被写体102の高精度な距離情報を取得することができる。   With such a configuration, the distance detection apparatus according to the present embodiment can reduce a parallax amount calculation error in distance detection using a captured image on which pattern light is projected. Therefore, the distance detection device can acquire highly accurate distance information of the subject 102 based on the amount of parallax with reduced calculation error.

なお、本実施例における視差量を算出する方法は、実施例1と同様に、ステップS304について説明した方法に制限されるものでない。例えば、視差算出部162が、第1の相関値より第1の視差量を算出し、第2の相関値より第2の視差量を算出し、これらの視差量を加算平均することで最終的な視差量を算出してもよい。この場合にも、視差量の算出誤差を低減し、高精度な測距を行うことができる。なお、この場合には、相関算出部161は、第1及び第2の相関値を用いて第3の相関値を求めなくてよい。   Note that the method of calculating the amount of parallax in the present embodiment is not limited to the method described in step S304 as in the first embodiment. For example, the parallax calculation unit 162 calculates the first parallax amount from the first correlation value, calculates the second parallax amount from the second correlation value, and adds and averages these parallax amounts. An appropriate amount of parallax may be calculated. Also in this case, it is possible to reduce parallax amount calculation errors and perform highly accurate distance measurement. In this case, the correlation calculation unit 161 does not have to obtain the third correlation value using the first and second correlation values.

なお、本実施例ではステップS1201及びS1202で、第1のパターン光及び第2のパターン光に基づく画像を取得し、次に、ステップS1203及びステップS1204で各々のパターン光に基づく画像を用いて相関値を算出する例について示した。しかしながら、相関値を算出するタイミングはこれに限定されるものではない。例えば、第1のパターン光に伴う画像を取得して第1の相関値を算出し、次に、第2のパターン光に伴う画像を取得して第2の相関値を算出してもよい。この場合にも、前述と同様の効果を奏することができる。   In this embodiment, in steps S1201 and S1202, images based on the first pattern light and the second pattern light are acquired, and then in steps S1203 and S1204, correlation is performed using the images based on the respective pattern lights. An example of calculating the value is shown. However, the timing for calculating the correlation value is not limited to this. For example, an image associated with the first pattern light may be acquired to calculate the first correlation value, and then an image associated with the second pattern light may be acquired to calculate the second correlation value. In this case, the same effect as described above can be obtained.

また、撮影画像上のどの位置に基準画像を設定しても、基準画像の両端付近に各々のパターン光に基づく画像エッジがあることが好ましい。そのため、実施例1と同様に、投影パターンは、x軸方向に周期的に輝度分布が繰り返される周期パターンであることが好ましい。このとき完全な周期パターンであると、相関演算で視差量を算出する際に、一周期ずれた領域が誤って検出される場合がある。そこで、視差量を探索する範囲(参照画像を動かす移動量)をパターンの周期よりも小さくなるように制限することで、この誤検出を回避することができる。   Moreover, it is preferable that there is an image edge based on each pattern light in the vicinity of both ends of the reference image regardless of the position where the reference image is set on the captured image. Therefore, like the first embodiment, the projection pattern is preferably a periodic pattern in which the luminance distribution is periodically repeated in the x-axis direction. In this case, if the period pattern is complete, an area shifted by one period may be erroneously detected when calculating the amount of parallax by correlation calculation. Therefore, this erroneous detection can be avoided by limiting the range in which the amount of parallax is searched (the amount of movement for moving the reference image) to be smaller than the cycle of the pattern.

また、投影パターンを完全に同じ輝度分布が繰り返されるパターンにする必要はない。投影パターンは周期的に略同じ輝度分布が繰り返されるパターンであればよい。例えば、明領域の視差算出方向における幅がライン毎に異なっていてもよい。また、明領域又は暗領域内に輝度のばらつきがあるパターンであってもよい。適度に輝度変化を与えることで、1周期ずれた領域が誤って検出されることを回避することができるとともに、上述した視差量の算出誤差の低減効果を奏することができる。   Further, the projection pattern does not need to be a pattern in which the same luminance distribution is repeated. The projection pattern may be a pattern in which substantially the same luminance distribution is periodically repeated. For example, the width of the bright region in the parallax calculation direction may be different for each line. Moreover, the pattern which has the dispersion | variation in a brightness | luminance in a bright area | region or a dark area | region may be sufficient. By appropriately changing the luminance, it is possible to avoid erroneously detecting a region shifted by one period, and to achieve the effect of reducing the above-described parallax amount calculation error.

また、本実施例に係る距離検出装置を、実施例2と同様に、生産作業用ロボット装置に適用することもできる。この場合の例について、図9を参照して簡単に説明する。なお、この場合のロボット装置の構成は、実施例2に係るロボット装置の構成と同様であってよいため、図9と同じ参照符号を用いて説明を省略する。   In addition, the distance detection apparatus according to the present embodiment can be applied to a production work robot apparatus as in the second embodiment. An example of this case will be briefly described with reference to FIG. Note that the configuration of the robot apparatus in this case may be the same as the configuration of the robot apparatus according to the second embodiment, and thus the description thereof is omitted using the same reference numerals as those in FIG.

このようなロボット装置では、本実施例で説明したように、視差算出方向に位置ずれした第1のパターン光と第2のパターン光をワーク904に投影し、各々のパターン光に基づく画像組を撮像する。その後、各画像組より第1の相関値と第2の相関値を算出し、距離を求めることで、ワーク904の距離情報をより高精度に取得することができる。これにより、ロボット装置900では、ワーク904の位置姿勢の推定精度が向上し、ロボットアーム902及びロボットハンド903の位置制御の精度が向上し、より高精度な組み付け作業を行うことができる。   In such a robot apparatus, as described in the present embodiment, the first pattern light and the second pattern light shifted in the parallax calculation direction are projected onto the work 904, and an image set based on each pattern light is generated. Take an image. Thereafter, the first correlation value and the second correlation value are calculated from each image group, and the distance information of the workpiece 904 can be obtained with higher accuracy by obtaining the distance. Thereby, in the robot apparatus 900, the estimation accuracy of the position and orientation of the workpiece 904 is improved, the accuracy of position control of the robot arm 902 and the robot hand 903 is improved, and a more accurate assembly operation can be performed.

なお、距離検出装置とワーク904との距離は、ロボットアーム902やロボットハンド903の位置に応じて変化する。このとき、投影装置101の投影パターンを変えないで距離計測を行うと、撮影画像上におけるパターンの周期が距離に応じて変化する。そのため、第1のパターン光と第2のパターン光との最適な位置関係が変化し、視差量の算出誤差を低減させる効果が弱くなることがある。   Note that the distance between the distance detection device and the workpiece 904 changes according to the positions of the robot arm 902 and the robot hand 903. At this time, if distance measurement is performed without changing the projection pattern of the projection apparatus 101, the pattern period on the captured image changes according to the distance. Therefore, the optimal positional relationship between the first pattern light and the second pattern light may change, and the effect of reducing the parallax amount calculation error may be weakened.

そこで、演算処理部106は、第1のパターン光を投影して取得した画像を分析し、分析結果に基づいて第2のパターン光におけるラインパターンの位置ずれ量を決定してもよい。具体的には、演算処理部106は、第1のパターン光を投影して取得した画像を分析し、取得した画像上において視差算出方向における第1のパターン光の周期を示す画素値の変動の周期を算出・評価する。次に、演算処理部106は、視差算出方向における第1の基準画像の幅(サイズ)とパターンの周期に基づいて、第2のパターン光の視差算出方向における位置ずれ量を決定する。   Therefore, the arithmetic processing unit 106 may analyze the image acquired by projecting the first pattern light, and determine the amount of positional deviation of the line pattern in the second pattern light based on the analysis result. Specifically, the arithmetic processing unit 106 analyzes an image acquired by projecting the first pattern light, and changes the pixel value indicating the period of the first pattern light in the parallax calculation direction on the acquired image. Calculate and evaluate the period. Next, the arithmetic processing unit 106 determines the amount of positional deviation in the parallax calculation direction of the second pattern light based on the width (size) of the first reference image in the parallax calculation direction and the pattern period.

また、演算処理部106は、第1のパターン光と第2のパターン光の位置ずれ量を各々のパターン光を投影して取得した画像より分析し、それに応じて視差算出方向における第1及び第2の基準画像の幅を決定してもよい。具体的には、演算処理部106は、第1のパターン光と第2のパターン光をそれぞれ投影して得た各画像群の少なくとも一方の画像に基づいて、視差算出方向における第1のパターン光と第2のパターン光の位置ずれ量を算出する。次に、演算処理部106は、第1のパターン光と第2のパターン光の位置ずれ量に基づいて、第1及び第2の基準画像の幅を決定する。   In addition, the arithmetic processing unit 106 analyzes the positional deviation amounts of the first pattern light and the second pattern light from the images obtained by projecting the respective pattern lights, and accordingly, the first and second patterns in the parallax calculation direction are analyzed. The width of the second reference image may be determined. Specifically, the arithmetic processing unit 106 uses the first pattern light in the parallax calculation direction based on at least one image of each image group obtained by projecting the first pattern light and the second pattern light, respectively. And the amount of positional deviation of the second pattern light is calculated. Next, the arithmetic processing unit 106 determines the widths of the first and second reference images based on the amount of positional deviation between the first pattern light and the second pattern light.

これらのような処理により、演算処理部106は、距離検出装置とワーク904との距離に応じて第1のパターン光と第2のパターン光との位置ずれ量と第1及び第2の基準画像の大きさ(サイズ)を適切に設定することができる。なお、当該位置ずれ量や基準画像の幅を決定する際には、上述した式(1a)又は式(1b)に従って、これらを決定することができる。また、演算処理部106による処理は、制御部108で行われてもよいし、制御装置905によって行われてもよい。   Through the processing as described above, the arithmetic processing unit 106 detects the positional deviation amount between the first pattern light and the second pattern light and the first and second reference images according to the distance between the distance detection device and the workpiece 904. Can be set appropriately. Note that when determining the amount of misalignment and the width of the reference image, these can be determined according to the above-described equation (1a) or equation (1b). Further, the processing by the arithmetic processing unit 106 may be performed by the control unit 108 or may be performed by the control device 905.

また、ワーク904とロボットハンド903の距離が近いときほど、面内解像度が高い距離情報を取得し、ワーク904の位置姿勢を高精度に推定することが求められる。ここで、ワーク904の距離は、撮影画像上におけるワーク904の大きさから概略的に算出することができる。また、距離検出装置によるワーク904の距離情報の取得と制御装置905によるロボットアーム902の制御は時系列で順次行うため、これらの処理の1サイクル前に取得した距離情報に基づいてワーク904の距離を概略的に知ることもできる。   Further, as the distance between the workpiece 904 and the robot hand 903 is closer, it is required to acquire distance information with higher in-plane resolution and to estimate the position and orientation of the workpiece 904 with higher accuracy. Here, the distance of the workpiece 904 can be roughly calculated from the size of the workpiece 904 on the captured image. In addition, since acquisition of distance information of the workpiece 904 by the distance detection device and control of the robot arm 902 by the control device 905 are sequentially performed in time series, the distance of the workpiece 904 is based on the distance information acquired one cycle before these processes. Can also be known roughly.

そこで、演算処理部106は、概略的なワーク904の距離情報に基づいて、ワーク904の距離が近いほど第1の基準画像の大きさが小さくなるように設定してもよい。この場合、演算処理部106は、画像上における第1のパターン光の周期と第1の基準画像の大きさとから第2のパターン光の位置ずれ量を決定することができる。   Therefore, the arithmetic processing unit 106 may set the size of the first reference image to be smaller as the distance of the workpiece 904 is closer, based on the schematic distance information of the workpiece 904. In this case, the arithmetic processing unit 106 can determine the positional deviation amount of the second pattern light from the period of the first pattern light on the image and the size of the first reference image.

また、演算処理部106は、距離が近いときほど投影パターンの周期が細かくなるように、投影パターンを変更してもよい。このような処理により、演算処理部106は、距離検出装置とワーク904との距離に応じて、第1のパターン光と第2のパターン光との位置ずれ量を適切に設定することができる。なお、演算処理部106に代わって、制御部108や制御装置905が画像を分析してパターン光の位置ずれ量を決定してもよい。また、パターン光の位置は制御部108によって制御されてよい。   Further, the arithmetic processing unit 106 may change the projection pattern so that the cycle of the projection pattern becomes finer as the distance is shorter. By such processing, the arithmetic processing unit 106 can appropriately set the positional deviation amount between the first pattern light and the second pattern light according to the distance between the distance detection device and the workpiece 904. Instead of the arithmetic processing unit 106, the control unit 108 or the control device 905 may analyze the image and determine the amount of pattern light misregistration. Further, the position of the pattern light may be controlled by the control unit 108.

これらの方法により、第1のパターン光と第2のパターン光と基準画像を適切に設定することで、ロボット装置900は、距離検出装置による視差量の算出誤差を低減することができ、ワーク904の距離を高精度に算出することができる。このため、ロボット装置900では、ワーク904の位置姿勢の推定精度が向上し、ロボットアーム902及びロボットハンド903の位置制御の精度が向上し、より高精度な組み付け作業を行うことができる。   By appropriately setting the first pattern light, the second pattern light, and the reference image by these methods, the robot apparatus 900 can reduce the parallax amount calculation error by the distance detection apparatus, and the workpiece 904 can be reduced. Can be calculated with high accuracy. For this reason, in the robot apparatus 900, the estimation accuracy of the position and orientation of the workpiece 904 is improved, the accuracy of the position control of the robot arm 902 and the robot hand 903 is improved, and more accurate assembly work can be performed.

(実施例5)
実施例4による距離検出装置では、視差算出方向にずらした2つの投影パターンの光を撮影した2つの画像における同一箇所に基準画像を設定し、各基準画像に関して参照画像との相関値を算出して距離を検出した。これに対し、実施例5による距離検出装置では、波長帯域が異なる複数のパターン光を投影し、各々のパターン光による画像組を取得して距離を検出する。
(Example 5)
In the distance detection device according to the fourth embodiment, a reference image is set at the same place in two images obtained by photographing light of two projection patterns shifted in the parallax calculation direction, and a correlation value with the reference image is calculated for each reference image. The distance was detected. On the other hand, in the distance detection device according to the fifth embodiment, a plurality of pattern lights having different wavelength bands are projected, and an image set using each pattern light is acquired to detect the distance.

以下、図16(a)乃至17(c)を参照して、本実施例による距離検出装置について説明する。図16(a)は、本実施例による距離検出装置1600の概略的な構成を示す。なお、本実施例による距離検出装置1600において、実施例1による距離検出装置100と同様の構成については、同じ参照符号を用いて説明を省略する。以下、実施例4による距離検出装置との違いを中心として、本実施例に係る距離検出装置1600について説明する。   Hereinafter, the distance detecting device according to the present embodiment will be described with reference to FIGS. 16 (a) to 17 (c). FIG. 16A shows a schematic configuration of a distance detection apparatus 1600 according to the present embodiment. In the distance detection device 1600 according to the present embodiment, the same reference numerals are used for the same configurations as those of the distance detection device 100 according to the first embodiment, and description thereof is omitted. Hereinafter, the distance detection apparatus 1600 according to the present embodiment will be described focusing on the difference from the distance detection apparatus according to the fourth embodiment.

本実施例による距離検出装置1600には、投影装置1610、及び撮影装置1603が設けられている。撮影装置1603には、結像光学系104、撮像素子1620、演算処理部106、及び本体メモリ107が設けられている。また、投影装置1610及び撮影装置1603は、制御部108に接続され、制御部108は、投影装置1610及び撮影装置1603の同期などの制御を行う。   The distance detection device 1600 according to the present embodiment is provided with a projection device 1610 and an imaging device 1603. The imaging device 1603 is provided with an imaging optical system 104, an image sensor 1620, an arithmetic processing unit 106, and a main body memory 107. Further, the projection device 1610 and the imaging device 1603 are connected to the control unit 108, and the control unit 108 performs control such as synchronization of the projection device 1610 and the imaging device 1603.

投影装置1610は、パターン光1611とパターン光1612を投影するように構成されている。図16(b)及び図16(c)は、それぞれ、本実施例において投影するパターン光の例であるパターン光1611,1612を示す。第1のパターン光であるパターン光1611は、ラインパターンを有し、x軸方向に高輝度領域と低輝度領域が交互に繰り返され、周期1613を有している。第2のパターン光であるパターン光1612は、パターン光1611と同じx軸方向に周期的な輝度分布を有するラインパターンを有している。また、パターン光1612のラインパターンは、パターン光1611のラインパターンとは、x軸方向における位置がずれている。   The projection device 1610 is configured to project the pattern light 1611 and the pattern light 1612. FIGS. 16B and 16C show pattern lights 1611 and 1612 which are examples of pattern light projected in the present embodiment, respectively. Pattern light 1611 which is the first pattern light has a line pattern, and a high luminance region and a low luminance region are alternately repeated in the x-axis direction, and has a period 1613. The pattern light 1612 that is the second pattern light has a line pattern having a periodic luminance distribution in the same x-axis direction as the pattern light 1611. Further, the line pattern of the pattern light 1612 is shifted in position in the x-axis direction from the line pattern of the pattern light 1611.

ここで、本実施例に係るパターン光1611とパターン光1612は、それぞれ波長帯域が異なる光である。そのため、投影装置1610には、例えば、光源と結像光学系とパターン形成手段とを含む投影光学系が2台設けられる。当該2台の投影光学系には、互いに波長帯域が異なる光源と、互いにパターンが異なるパターンマスクとが含まれる。なお、同じパターンマスクを含むとともにパターンマスクの位置を変更できるように構成された投影光学系を用いてもよい。   Here, the pattern light 1611 and the pattern light 1612 according to the present embodiment are lights having different wavelength bands. Therefore, the projection apparatus 1610 is provided with two projection optical systems including, for example, a light source, an imaging optical system, and a pattern forming unit. The two projection optical systems include a light source having a different wavelength band and a pattern mask having a different pattern. Note that a projection optical system including the same pattern mask and configured to change the position of the pattern mask may be used.

図16(d)は、撮像素子1620の一部を示す。撮像素子1620には、複数の画素1621,1622,1623が配置され、これら画素上には透過波長帯域が異なるカラーフィルタが配置されている。本実施例では、画素1621上のカラーフィルタはパターン光1611の波長帯域、画素1622上のカラーフィルタはパターン光1612の波長帯域の光を透過するように構成されている。このような撮像素子を用いることで、各パターン光の波長に対応するカラーフィルタが配置された画素において、対応する波長のパターン光を受光することができ、各々のパターン光に基づく画像組を分離して取得することができる。なお、撮像素子1620における、複数の画素1621、複数の画素1622、及び複数の画素1623の配置は、図16(d)に示す配置に限定されず、所望の構成に応じて任意に変更されてよい。   FIG. 16D shows a part of the image sensor 1620. A plurality of pixels 1621, 1622, and 1623 are arranged on the image sensor 1620, and color filters having different transmission wavelength bands are arranged on these pixels. In this embodiment, the color filter on the pixel 1621 is configured to transmit the wavelength band of the pattern light 1611 and the color filter on the pixel 1622 is configured to transmit the light in the wavelength band of the pattern light 1612. By using such an image sensor, a pixel having a color filter corresponding to the wavelength of each pattern light can receive the pattern light of the corresponding wavelength, and an image set based on each pattern light is separated. And can be obtained. Note that the arrangement of the plurality of pixels 1621, the plurality of pixels 1622, and the plurality of pixels 1623 in the imaging element 1620 is not limited to the arrangement illustrated in FIG. 16D, and may be arbitrarily changed according to a desired configuration. Good.

次に、図17(a)乃至(c)を参照して、本実施例に係る測距演算フローについて説明する。図17(a)は本実施例に係る距離検出処理のフローチャートであり、図17(b)及び(c)は、相関算出部161によって行う相関演算を説明するための図である。本実施例に係る距離検出処理が開始されると、処理はステップS1701に移行する。   Next, a ranging calculation flow according to the present embodiment will be described with reference to FIGS. FIG. 17A is a flowchart of the distance detection processing according to the present embodiment, and FIGS. 17B and 17C are diagrams for explaining the correlation calculation performed by the correlation calculation unit 161. When the distance detection process according to the present embodiment is started, the process proceeds to step S1701.

ステップS1701「パターン光投影画像取得」では、投影装置1610から被写体102へパターン光1611及び1612を投影している状態で、撮影装置1603を用いて撮影を行い、撮影画像を本体メモリ107に記憶させる。撮影装置1603は、この状態で撮影を行うことで、画素1621を用いて画像組1710を取得し、画素1622を用いて画像組1720を取得し、本体メモリ107に記憶させることができる。なお、パターン光の投影方法は、実施例1や実施例4と同様であるため説明を省略する。また、以下において、画像組1710は、A画像1710A及びB画像1710Bを含むものとして、画像組1720は、A画像1720A及びB画像1720Bを含むものとして説明する。   In step S1701 “acquire pattern light projection image”, the patterning light 1611 and 1612 are projected onto the subject 102 from the projection device 1610, and photographing is performed using the photographing device 1603, and the photographed image is stored in the main body memory 107. . The image capturing apparatus 1603 can perform image capturing in this state to acquire the image set 1710 using the pixel 1621 and acquire the image set 1720 using the pixel 1622 and store the image set 1720 in the main body memory 107. Note that the pattern light projection method is the same as in the first and fourth embodiments, and a description thereof will be omitted. In the following description, it is assumed that the image set 1710 includes an A image 1710A and a B image 1710B, and the image set 1720 includes an A image 1720A and a B image 1720B.

ステップS1702からステップS1705の処理は、演算処理部106によって行う。ここで、図17(b)及び(c)は、ステップS1702及びステップS1703において設定する基準画像及び参照画像の位置関係を説明する図である。図17(b)にはステップS1701で画素1621を用いて取得したA画像1710A及びB画像1710Bが示され、図17(c)には画素1622を用いて取得したA画像1720A及びB画像1720Bが示されている。以下、A画像1710A及びA画像1720A上の同じ位置にある、距離算出を行う画素を注目画素1730として説明する。   The processing from step S1702 to step S1705 is performed by the arithmetic processing unit 106. Here, FIGS. 17B and 17C are diagrams illustrating the positional relationship between the standard image and the reference image set in steps S1702 and S1703. FIG. 17B shows an A image 1710A and a B image 1710B acquired using the pixel 1621 in step S1701, and FIG. 17C shows an A image 1720A and a B image 1720B acquired using the pixel 1622. It is shown. Hereinafter, a pixel for which distance calculation is performed at the same position on the A image 1710A and the A image 1720A will be described as a target pixel 1730.

ステップS1702「相関演算1」では、相関算出部161が、ステップS1701で取得した画像組1710を用いて相関値を算出する。具体的には、相関算出部161は、A画像1710A上において、注目画素1730とその近傍画素を含む部分領域を抜き出し、第1の基準画像1711として設定する。次に、相関算出部161は、B画像1710B上において、第1の基準画像1711と同じ面積の領域を抜き出して参照画像1712として設定する。その後、相関算出部161は、実施例4に係るステップS1203と同様に、第1の基準画像1711と参照画像1712とを用いて第1の相関値を算出する。   In step S1702 “correlation calculation 1”, the correlation calculation unit 161 calculates a correlation value using the image set 1710 acquired in step S1701. Specifically, the correlation calculation unit 161 extracts a partial region including the target pixel 1730 and its neighboring pixels on the A image 1710A, and sets it as the first reference image 1711. Next, the correlation calculation unit 161 extracts a region having the same area as that of the first reference image 1711 on the B image 1710B and sets it as a reference image 1712. After that, the correlation calculation unit 161 calculates the first correlation value using the first standard image 1711 and the reference image 1712 as in step S1203 according to the fourth embodiment.

なお、相関値の算出方法は、実施例1に係るステップS302と同様であってよい。また、相関算出部161は、参照画像1712を第1の基準画像1711の縦及び横寸法と同じ縦及び横寸法を有する画像として設定することができる。   The correlation value calculation method may be the same as that in step S302 according to the first embodiment. In addition, the correlation calculation unit 161 can set the reference image 1712 as an image having the same vertical and horizontal dimensions as the vertical and horizontal dimensions of the first standard image 1711.

次に、ステップS1703「相関演算2」では、相関算出部161は、ステップS1701で取得した画像組1720を用いて相関値を算出する。具体的には、相関算出部161は、A画像1720A上において、注目画素1730とその近傍画素を含む部分領域を抜き出し、第2の基準画像1721として設定する。次に、相関算出部161は、B画像1720B上において、第2の基準画像1721と同じ面積の領域を抜き出して参照画像1722として設定する。その後、相関算出部161は、実施例4に係るステップS1204と同様に、第2の基準画像1721と参照画像1722とを用いて第2の相関値を算出する。なお、相関算出部161は、実施例4と同様に、第1の基準画像1711と同じ位置に第2の基準画像1721を設定することができる。   Next, in step S1703 “correlation calculation 2”, the correlation calculation unit 161 calculates a correlation value using the image set 1720 acquired in step S1701. Specifically, the correlation calculation unit 161 extracts a partial region including the target pixel 1730 and its neighboring pixels on the A image 1720A and sets it as the second reference image 1721. Next, the correlation calculation unit 161 extracts a region having the same area as the second reference image 1721 on the B image 1720B and sets it as a reference image 1722. Thereafter, the correlation calculation unit 161 calculates the second correlation value using the second reference image 1721 and the reference image 1722 as in step S1204 according to the fourth embodiment. Note that the correlation calculation unit 161 can set the second reference image 1721 at the same position as the first reference image 1711 as in the fourth embodiment.

ステップS1704「視差量算出」では、視差算出部162が、実施例1に係るステップS304と同様に、ステップS1703及びステップS1704で求めた第1の相関値と第2の相関値を用いて視差量を算出する。より具体的には、視差算出部162は、第1の相関値と第2の相関値の各移動量における相関値をそれぞれ加算又は加算平均し、第3の相関値を算出し、第3の相関値に基づいて視差量を算出する。また、ステップS1705「距離値算出」では、距離算出部163が、実施例1に係るステップS305と同様に、既知の手法により視差量をデフォーカス量又は被写体距離に変換し、被写体102までの距離を算出する。   In step S1704 “calculation of parallax”, the parallax calculation unit 162 uses the first correlation value and the second correlation value obtained in steps S1703 and S1704 as in step S304 according to the first embodiment. Is calculated. More specifically, the parallax calculation unit 162 adds or averages the correlation values of the movement amounts of the first correlation value and the second correlation value, respectively, calculates a third correlation value, The amount of parallax is calculated based on the correlation value. Also, in step S1705 “distance value calculation”, the distance calculation unit 163 converts the parallax amount into the defocus amount or the subject distance by a known method, as in step S305 according to the first embodiment, and the distance to the subject 102. Is calculated.

このように本実施例による距離検出方法では、投影装置1610が、視差算出方向に位置ずれしたラインパターンを有する、波長帯域が異なる第1のパターン光と第2のパターン光を投影する。また、撮影装置1603は、第1のパターン光に基づく画像組と、第2のパターン光に基づく画像組とを分離して取得する。相関算出部161は、各々の画像組について、それぞれ第1の基準画像1711と第2の基準画像1721を設定する。その後、相関算出部161は、第1の基準画像1711と対応して設定された参照画像1712との第1の相関値、及び第2の基準画像1721と対応して設定された参照画像1722との第2の相関値を算出する。視差算出部162は、両相関値より視差量を算出する。当該処理によれば、各々の画像組より第1の相関値と第2の相関値を算出し、両相関値より視差量を算出することで、投影パターンの輝度分布と基準画像の位置とに関係して発生する測距誤差を軽減することができ、高精度な測距を行うことができる。   As described above, in the distance detection method according to the present embodiment, the projection device 1610 projects the first pattern light and the second pattern light having the line patterns shifted in the parallax calculation direction and having different wavelength bands. Also, the imaging device 1603 acquires the image set based on the first pattern light and the image set based on the second pattern light separately. The correlation calculation unit 161 sets a first reference image 1711 and a second reference image 1721 for each set of images. After that, the correlation calculation unit 161 sets the first correlation value with the reference image 1712 set corresponding to the first reference image 1711 and the reference image 1722 set corresponding to the second reference image 1721. The second correlation value is calculated. The parallax calculation unit 162 calculates the amount of parallax from both correlation values. According to this process, the first correlation value and the second correlation value are calculated from each image set, and the parallax amount is calculated from both correlation values, so that the brightness distribution of the projection pattern and the position of the reference image are obtained. A related measurement error can be reduced, and highly accurate distance measurement can be performed.

特に、本実施例では、波長帯域が異なる第1のパターン光と第2のパターン光を同時に投影し、各々のパターン光に基づく画像組を撮像素子1620で取得する。このため、一回のパターン投影で距離計測を行うことができ、高速な計測を行うことができる。   In particular, in the present embodiment, the first pattern light and the second pattern light having different wavelength bands are simultaneously projected, and an image set based on each pattern light is acquired by the image sensor 1620. For this reason, distance measurement can be performed by one pattern projection, and high-speed measurement can be performed.

なお、第1のパターン光と第2のパターン光の波長帯域は、互いに離れていることが好ましい。例えば、第1のパターン光を青色や紫外の波長帯域とし、第2のパターン光を赤色や赤外域の波長帯域とすることができる。両パターン光の波長帯域を離すことで、一般的に用いられている撮像素子で、両パターン光による画像組を分離して取得することが容易となる。   Note that the wavelength bands of the first pattern light and the second pattern light are preferably separated from each other. For example, the first pattern light can be a blue or ultraviolet wavelength band, and the second pattern light can be a red or infrared wavelength band. By separating the wavelength bands of the two pattern lights, it becomes easy to separate and acquire an image set by the two pattern lights with a commonly used image sensor.

また、本実施例では、画素1623上に、パターン光1611及びパターン光1612の波長帯域の光を透過しないカラーフィルタを配置することで、パターン光の模様がない被写体画像を取得することができる。このような画像を用いることで、前述の手法で求めた距離情報が被写体102上のどの位置を測定したものかを特定することができる。これらの画像情報と距離情報は被写体102の位置や姿勢を検出するために用いることができる。また、撮影した被写体102が、複数の種類の物体のうち、どの物体かを判断するために用いることもできる。なお、画像情報や距離情報を用いた被写体102の位置や姿勢の検出等のこれらの処理は、演算処理部106や制御部108によって行われてよい。   Further, in this embodiment, by arranging a color filter that does not transmit light in the wavelength bands of the pattern light 1611 and the pattern light 1612 on the pixel 1623, it is possible to acquire a subject image without a pattern light pattern. By using such an image, it is possible to specify which position on the subject 102 the distance information obtained by the above-described method is measured. These image information and distance information can be used to detect the position and orientation of the subject 102. It can also be used to determine which of the plurality of types of objects the photographed subject 102 is. Note that these processes such as detection of the position and orientation of the subject 102 using the image information and the distance information may be performed by the arithmetic processing unit 106 and the control unit 108.

(実施例6)
実施例1では、1つの投影パターンの光を撮影した画像において視差算出方向における異なる箇所に基準画像を設定し、各基準画像に関して参照画像との相関値を算出して距離を検出した。これに対し、実施例6に係る距離検出装置では、視差算出方向にずらした2つのサブパターンを含む投影パターンの光を撮影した画像において基準画像を設定し、基準画像に関して参照画像との相関値を算出して距離を検出する。
(Example 6)
In Example 1, reference images are set at different locations in the parallax calculation direction in an image obtained by photographing light of one projection pattern, and a correlation value with a reference image is calculated for each reference image to detect a distance. On the other hand, in the distance detection device according to the sixth embodiment, a reference image is set in an image obtained by capturing light of a projection pattern including two sub patterns shifted in the parallax calculation direction, and a correlation value between the reference image and the reference image is set. To detect the distance.

以下、図18乃至22を参照して、本実施例による距離検出装置について説明する。本実施例による距離検出装置の構成は実施例1による距離検出装置100の構成と同様であるため、実施例1と同じ参照符号を用いて説明を省略する。以下、本実施例による距離検出装置と実施例1による距離検出装置100との違いを中心に説明する。   Hereinafter, the distance detection apparatus according to the present embodiment will be described with reference to FIGS. Since the configuration of the distance detection device according to the present embodiment is the same as the configuration of the distance detection device 100 according to the first embodiment, the same reference numerals as those of the first embodiment are used and description thereof is omitted. Hereinafter, the difference between the distance detection device according to the present embodiment and the distance detection device 100 according to the first embodiment will be mainly described.

本実施例における投影するパターン光の一例を図18に示す。パターン光1800は、パターン光1801(第1のサブパターン光)とパターン光1802(第2のサブパターン光)で構成される。両パターン光1801,1802は、x軸方向(第1の方向)において同じ輝度分布を有し、x軸方向における位置が互いにずれている。また、両パターン光1801,1802は、y軸方向(第2の方向)において異なる位置に位置しており、本実施例では、両パターン光1801,1802はy軸方向において交互に位置している。各々のパターン光のx軸方向における輝度分布は、高輝度領域と低輝度領域が交互に繰り返され、周期1803を有している。また、両パターン光1801,1802は、y軸方向において同じ長さ1804を有している。   An example of pattern light to be projected in this embodiment is shown in FIG. The pattern light 1800 includes a pattern light 1801 (first sub pattern light) and a pattern light 1802 (second sub pattern light). Both pattern lights 1801 and 1802 have the same luminance distribution in the x-axis direction (first direction), and their positions in the x-axis direction are shifted from each other. Further, both pattern lights 1801 and 1802 are located at different positions in the y-axis direction (second direction). In this embodiment, both pattern lights 1801 and 1802 are located alternately in the y-axis direction. . The luminance distribution in the x-axis direction of each pattern light has a cycle 1803 in which a high luminance region and a low luminance region are alternately repeated. Both pattern lights 1801 and 1802 have the same length 1804 in the y-axis direction.

次に、図19(a)乃至(c)を参照して、本実施例に係る測距演算フローについて説明する。図19(a)は本実施例に係る距離検出処理のフローチャートであり、図19(b)及び(c)は、相関算出部161によって行う相関演算を説明するための図である。本実施例に係る距離検出処理が開始されると、処理はステップS1901に移行する。   Next, with reference to FIGS. 19A to 19C, the ranging calculation flow according to the present embodiment will be described. FIG. 19A is a flowchart of distance detection processing according to the present embodiment, and FIGS. 19B and 19C are diagrams for explaining the correlation calculation performed by the correlation calculation unit 161. When the distance detection process according to the present embodiment is started, the process proceeds to step S1901.

ステップS1901「パターン光投影画像取得」では、投影装置101から被写体102へパターン光1800を投影している状態で、撮影装置103を用いて撮影を行い、撮影画像を本体メモリ107に記憶させる。なお、パターン光の投影方法は実施例1と同様であるため説明を省略する。   In step S1901, “acquire pattern light projection image”, the patterning light 1800 is projected from the projection apparatus 101 onto the subject 102, and the photographing is performed using the photographing apparatus 103, and the photographed image is stored in the main body memory 107. Since the pattern light projection method is the same as that of the first embodiment, description thereof is omitted.

ステップS1902からステップS1904の処理は、演算処理部106によって行う。ここで、図19(b)及び(c)は、ステップS1902にて設定する基準画像及び参照画像の位置関係を説明するための図である。図19(b)には、ステップS1901で取得されたA画像1910A及びB画像1910Bが示されている。以下、A画像1910A上において距離算出を行う画素を注目画素1920として説明する。   The processing from step S1902 to step S1904 is performed by the arithmetic processing unit 106. Here, FIGS. 19B and 19C are diagrams for explaining the positional relationship between the standard image and the reference image set in step S1902. FIG. 19B shows an A image 1910A and a B image 1910B acquired in step S1901. Hereinafter, a pixel for which distance calculation is performed on the A image 1910A will be described as a target pixel 1920.

ステップS1902「相関演算」では、相関算出部161が、ステップS1901で取得した画像組を用いて第1の相関値を算出する。具体的には、相関算出部161は、A画像1910A上において距離算出を行う注目画素1920とその近傍画素を含む部分領域を抜き出し、基準画像1911とする。図19(c)は基準画像の領域を説明するための図である。相関算出部161は、基準画像1911を、パターン光1801とパターン光1802が投影された領域を含むように設定する。   In step S1902 “correlation calculation”, the correlation calculation unit 161 calculates a first correlation value using the image set acquired in step S1901. Specifically, the correlation calculation unit 161 extracts a partial region including the pixel of interest 1920 for which distance calculation is performed on the A image 1910 </ b> A and its neighboring pixels as a reference image 1911. FIG. 19C is a diagram for explaining a region of the reference image. The correlation calculation unit 161 sets the reference image 1911 so as to include an area where the pattern light 1801 and the pattern light 1802 are projected.

次に、相関算出部161は、B画像1910B上において、基準画像1911と同じ面積(画像サイズ)の領域を抜き出し、参照画像1912として設定する。その後、相関算出部161は、B画像1910B上で参照画像1912を抜き出す位置を瞳分割方向と同じx軸方向に移動させて、各移動量(各位置)における参照画像1912と基準画像1911との相関値を算出する。これにより、相関算出部161は、各移動量に対する相関値のデータ列からなる相関値を算出する。   Next, the correlation calculation unit 161 extracts a region having the same area (image size) as that of the base image 1911 on the B image 1910B and sets it as a reference image 1912. After that, the correlation calculation unit 161 moves the position where the reference image 1912 is extracted on the B image 1910B in the same x-axis direction as the pupil division direction, and the reference image 1912 and the standard image 1911 at each movement amount (each position). A correlation value is calculated. Thereby, the correlation calculation part 161 calculates the correlation value which consists of a data string of the correlation value with respect to each moving amount | distance.

なお、相関値の算出方法は、実施例1に係るステップS302と同様であってよい。また、相関算出部161は、参照画像1912を基準画像1911の縦及び横寸法と同じ縦及び横寸法を有する画像として設定することができる。   The correlation value calculation method may be the same as that in step S302 according to the first embodiment. Further, the correlation calculation unit 161 can set the reference image 1912 as an image having the same vertical and horizontal dimensions as the vertical and horizontal dimensions of the standard image 1911.

次に、ステップS1903「視差量算出」では、視差算出部162が、既知の任意の手法により、ステップS1902で求めた相関値を用いて視差量を算出する。例えば、相関値の中で最も高い相関が得られる移動量とその近傍の移動量に対応する相関値のデータ列を抽出し、既知の任意の内挿手法により、最も相関が高くなる移動量をサブピクセル精度で推定することで、視差量を算出することができる。   Next, in step S1903 “parallax amount calculation”, the parallax calculation unit 162 calculates the parallax amount using the correlation value obtained in step S1902 by any known method. For example, a data sequence of correlation values corresponding to the movement amount that provides the highest correlation among the correlation values and the movement amount in the vicinity thereof is extracted, and the movement amount that provides the highest correlation is obtained by any known interpolation method. By estimating with sub-pixel accuracy, the amount of parallax can be calculated.

ステップS1904「距離値算出」では、距離算出部163が、実施例1に係るステップS305と同様に、既知の手法により視差量をデフォーカス量又は被写体距離に変換し、被写体102までの距離を算出する。   In step S1904 “distance value calculation”, the distance calculation unit 163 calculates the distance to the subject 102 by converting the parallax amount into the defocus amount or the subject distance by a known method, as in step S305 according to the first embodiment. To do.

このように本実施例による距離検出方法では、瞳分割方向(視差算出方向)に位置ずれしたパターン光1801とパターン光1802が投影された領域を含むように基準画像1911を設定する。その後、基準画像1911と参照画像1912との相関値を算出し、相関値から視差量を算出することで、投影パターンの輝度分布と基準画像の位置とに関係して発生する測距誤差を軽減することができ、高精度な測距を行うことができる。   As described above, in the distance detection method according to the present embodiment, the reference image 1911 is set so as to include a region where the pattern light 1801 and the pattern light 1802 that are displaced in the pupil division direction (parallax calculation direction) are projected. Thereafter, a correlation value between the standard image 1911 and the reference image 1912 is calculated, and a parallax amount is calculated from the correlation value, thereby reducing a ranging error that occurs in relation to the luminance distribution of the projection pattern and the position of the standard image. And high-precision ranging can be performed.

ここで、図20を参照して、本実施例による距離検出方法の処理結果の一例について述べる。図20は、既知の距離において、撮影装置103と並行となるように配置した平板に、投影装置101を用いてパターン光を投影して、撮影装置103で撮影し、平板上の各位置における視差量を算出した結果を示すグラフである。図20の横軸は移動量(画素位置)を表しており、縦軸は視差量の算出誤差を表している。図20には、従来の処理として、明部と暗部がy軸方向に一様に伸びるラインパターンを投影して算出した視差量の算出誤差2001が破線で示され、本実施例に係るパターンを投影して算出した視差量の算出誤差2002が実線で示されている。従来と比べて本実施例の手法により、誤差量が0に近き、視差量の算出誤差を低減していることが分かる。従って、本実施例に係る処理によれば、高精度に測距することができる。   Here, an example of the processing result of the distance detection method according to the present embodiment will be described with reference to FIG. FIG. 20 shows a pattern light projected onto a flat plate arranged in parallel with the imaging device 103 at a known distance using the projection device 101, and taken by the imaging device 103, and the parallax at each position on the flat plate. It is a graph which shows the result of having calculated quantity. The horizontal axis in FIG. 20 represents the movement amount (pixel position), and the vertical axis represents the parallax amount calculation error. In FIG. 20, as a conventional process, a parallax amount calculation error 2001 calculated by projecting a line pattern in which a bright part and a dark part extend uniformly in the y-axis direction is indicated by a broken line, and the pattern according to the present embodiment is A calculation error 2002 of the parallax amount calculated by projection is indicated by a solid line. It can be seen that the error amount is close to 0 and the parallax amount calculation error is reduced by the method of the present embodiment as compared with the prior art. Therefore, according to the processing according to the present embodiment, distance measurement can be performed with high accuracy.

次に、図21(a)乃至(f)を参照して、従来の処理では視差量の算出に誤差が発生し、本実施例による処理では視差量の算出誤差が低減する理由について説明する。以降の説明では、A画像とB画像は同じ濃淡を有する画像で視差が無いものと仮定する。図21(a)乃至(c)は、従来の手法として、ラインパターンを投影して視差量を算出した場合の誤差の発生理由を説明する図である。なお、誤差の発生理由に関しては、実施例1で説明したものと同様であるため、説明を簡略化する。   Next, with reference to FIGS. 21A to 21F, the reason why an error occurs in the calculation of the parallax amount in the conventional processing and the calculation error of the parallax amount is reduced in the processing according to the present embodiment will be described. In the following description, it is assumed that the A image and the B image have the same shading and have no parallax. FIGS. 21A to 21C are diagrams for explaining the reason why an error occurs when a parallax amount is calculated by projecting a line pattern as a conventional method. The reason for the occurrence of the error is the same as that described in the first embodiment, and therefore the description is simplified.

図21(a)は、明領域及び暗領域が交互に現れるラインパターンを有するA画像2101と基準画像2102及び基準画像2103との位置関係を示した図である。基準画像2102は、A画像2101の明領域と暗領域が切り替わる画像エッジ2104,2105,2106(境界部)を基準画像2102の内部に含んでいる。図21(b)は、基準画像2102に対して設定された参照画像を移動させて基準画像2102と参照画像の相関演算を行うことで算出される各相関値を示している。   FIG. 21A is a diagram showing the positional relationship between an A image 2101 having a line pattern in which bright regions and dark regions appear alternately, a reference image 2102, and a reference image 2103. The reference image 2102 includes image edges 2104, 2105, 2106 (boundary portions) in which the bright area and dark area of the A image 2101 are switched inside the reference image 2102. FIG. 21B shows correlation values calculated by moving a reference image set with respect to the standard image 2102 and performing a correlation calculation between the standard image 2102 and the reference image.

相関値C0,Cp,Cmはそれぞれ参照画像の位置を0、+1、−1画素だけ移動させたときの相関値である。この場合、実施例1で説明したように、相関値Cp,Cmに対応する参照画像の移動量の絶対値は同じであるため、ラインパターン上の画像エッジ2104,2105,2106に起因する画像間の差も同量となる。そのため、相関値Cpと相関値Cmは同じ値となる。この相関値を内挿して相関曲線2110を求め、最も高い相関値となる移動量(視差量)を算出することで視差量2111が求まり、正しい値(視差量0)が求まる。   Correlation values C0, Cp, and Cm are correlation values when the position of the reference image is moved by 0, +1, and −1 pixel, respectively. In this case, as described in the first embodiment, since the absolute value of the movement amount of the reference image corresponding to the correlation values Cp and Cm is the same, the image between the images caused by the image edges 2104, 2105, and 2106 on the line pattern The difference is the same amount. Therefore, the correlation value Cp and the correlation value Cm are the same value. By interpolating this correlation value, a correlation curve 2110 is obtained, and a movement amount (parallax amount) having the highest correlation value is calculated, whereby the parallax amount 2111 is obtained, and a correct value (parallax amount 0) is obtained.

一方、基準画像2103では、画像エッジ2104と基準画像2103の右端が重なる。図21(c)は、基準画像2103に対して設定された参照画像を移動させて基準画像2103と参照画像の相関演算を行うことで算出される各相関値を示している。この場合には、移動量が+1画素のとき、基準画像2102の場合と同様に、相関値Cpは相関値C0より増加する。これに対し、移動量が−1画素のときには、画像エッジ2105,2106のみに起因して基準画像と参照画像との差が生じるため、相関値C0からの相関値Cmの増加量は微量となる。そのため、相関値は、参照画像の移動量の+側と−側で非対称となり、これを内挿した相関曲線2112により求まる視差量2113は正しい値(視差量0)とは異なる値となり、誤差が発生する。これが、投影パターンの輝度分布と基準画像の位置とに関係して発生する視差量の算出誤差となる。   On the other hand, in the reference image 2103, the image edge 2104 and the right end of the reference image 2103 overlap. FIG. 21C shows each correlation value calculated by moving the reference image set with respect to the standard image 2103 and performing a correlation calculation between the standard image 2103 and the reference image. In this case, when the movement amount is +1 pixel, the correlation value Cp increases from the correlation value C0 as in the case of the reference image 2102. On the other hand, when the movement amount is −1 pixel, the difference between the base image and the reference image is caused only by the image edges 2105 and 2106, and therefore, the increase amount of the correlation value Cm from the correlation value C0 is very small. . Therefore, the correlation value is asymmetrical on the + side and the − side of the movement amount of the reference image, and the parallax amount 2113 obtained by the correlation curve 2112 interpolated with this is different from the correct value (parallax amount 0), and the error is appear. This is a calculation error of the amount of parallax generated in relation to the luminance distribution of the projection pattern and the position of the reference image.

次に、本実施例のように、視差算出方向に位置ずれしたパターン光1801,1802を含むパターン光1800を投影して撮影し、両パターン光1801,1802を含む基準画像を用いて測距演算を行うことで、前述の誤差が低減する理由を説明する。図21(d)は、本実施例に係るパターン光1800を投影して取得したA画像2100と基準画像2120を示した図である。図21(e)は、原理を簡便に説明するために、基準画像2120内を第1の部分画像2121及び第2の部分画像2122に分割し、各々の部分画像2121,2122で算出される相関値を示した図である。   Next, as in this embodiment, the pattern light 1800 including the pattern lights 1801 and 1802 shifted in the parallax calculation direction is projected and photographed, and the distance measurement calculation is performed using the reference image including both the pattern lights 1801 and 1802. The reason why the error is reduced by performing the above will be described. FIG. 21D is a diagram showing an A image 2100 and a reference image 2120 acquired by projecting the pattern light 1800 according to the present embodiment. FIG. 21 (e) shows a correlation calculated by dividing the reference image 2120 into a first partial image 2121 and a second partial image 2122 for simple explanation of the principle. It is the figure which showed the value.

第1の部分画像2121として、パターン光1801による画像エッジ2123と部分画像の右端が重なる部分画像を仮定する。このとき、第1の部分画像2121より算出される第1の相関値Cm1,C01,Cp1は、図21(c)に示す相関値Cm,C0,Cpと同様になる。   As the first partial image 2121, a partial image in which the image edge 2123 caused by the pattern light 1801 and the right end of the partial image overlap is assumed. At this time, the first correlation values Cm1, C01, Cp1 calculated from the first partial image 2121 are the same as the correlation values Cm, C0, Cp shown in FIG.

次に、第2の部分画像2122として、部分画像の左端がパターン光1802による画像エッジ2124と重なるように、第1の部分画像2121とは異なる部分画像を設定する。このとき、第2の部分画像2122と画像エッジ2124との位置関係は、第1の部分画像2121と画像エッジ2123との位置関係を反転した関係になる。そのため、図21(e)で示したように、第2の部分画像2122を用いて得られる第2の相関値Cm2,C02,Cp2は、第1の相関値Cm1,C01,Cp1を反転したものとなる。   Next, a partial image different from the first partial image 2121 is set as the second partial image 2122 so that the left end of the partial image overlaps the image edge 2124 by the pattern light 1802. At this time, the positional relationship between the second partial image 2122 and the image edge 2124 is a relationship obtained by inverting the positional relationship between the first partial image 2121 and the image edge 2123. Therefore, as shown in FIG. 21E, the second correlation values Cm2, C02, and Cp2 obtained using the second partial image 2122 are obtained by inverting the first correlation values Cm1, C01, and Cp1. It becomes.

これらの相関値を参照画像の位置(移動量)毎に加算平均すると、相関値は第3の相関値Cm3,C03,Cp3のようになる。第3の相関値は、参照画像の移動量の+側と−側の非対称性がキャンセルされ、対称となる。この場合、相関値を内挿した相関曲線2114より求まる視差量2115は正しい値(視差量0)となり、適切な視差量を算出することができる。本実施例による処理では、このような原理により視差量の算出誤差を低減することができ、適切に算出された視差量に基づいて高精度に測距を行うことができる。   When these correlation values are added and averaged for each position (movement amount) of the reference image, the correlation values become the third correlation values Cm3, C03, and Cp3. The third correlation value is symmetrical because the asymmetry on the + side and − side of the movement amount of the reference image is canceled. In this case, the parallax amount 2115 obtained from the correlation curve 2114 obtained by interpolating the correlation value becomes a correct value (parallax amount 0), and an appropriate parallax amount can be calculated. In the process according to the present embodiment, the calculation error of the parallax amount can be reduced based on such a principle, and the distance can be measured with high accuracy based on the appropriately calculated parallax amount.

本実施例では、パターン光1801とパターン光1802を、x軸方向(視差算出方向)において適切な量だけ異ならせることで、視差量の算出誤差をより低減することができる。図22(a)及び(b)は、投影されるパターン光に含まれる第1のパターン光及び第2のパターン光と基準画像の適切な位置を説明するための図である。   In the present embodiment, the parallax amount calculation error can be further reduced by making the pattern light 1801 and the pattern light 1802 different by an appropriate amount in the x-axis direction (parallax calculation direction). 22A and 22B are diagrams for explaining appropriate positions of the first pattern light, the second pattern light, and the reference image included in the projected pattern light.

基準画像2230は、第1のパターン光及び第2のパターン光を含む異なるパターン光を用いて取得した画像2210,2220に設定した基準画像である。図22(a)及び(b)では、基準画像2230の右端と第1のパターン光による画像エッジが重なっている。   The reference image 2230 is a reference image set to images 2210 and 2220 acquired using different pattern lights including the first pattern light and the second pattern light. 22A and 22B, the right edge of the reference image 2230 and the image edge by the first pattern light overlap.

ここで、第1のパターン光の画像エッジに基づく相関値の誤差を、第2のパターン光を用いてキャンセルする場合を考える。この場合には、例えば、基準画像の右端における第1のパターン光の画像エッジに起因する相関値の誤差をキャンセルするため、基準画像の左端に関して第2のパターン光の画像エッジに起因する相関値の誤差が生じるように、第2のパターン光を設定すればよい。なお、基準画像の左端における1のパターン光の画像エッジに起因する相関値の誤差をキャンセルする場合には、基準画像の右端に関して第2のパターン光の画像エッジに起因する相関値の誤差が生じるように、第2のパターン光を設定すればよい。なお、パターン光の設定は、演算処理部106によって行われてもよいし、制御部108によって行われてもよい。   Here, consider a case where the error of the correlation value based on the image edge of the first pattern light is canceled using the second pattern light. In this case, for example, in order to cancel the error of the correlation value due to the image edge of the first pattern light at the right end of the reference image, the correlation value due to the image edge of the second pattern light with respect to the left end of the reference image. The second pattern light may be set so that this error occurs. When canceling the correlation value error caused by the image edge of the first pattern light at the left end of the reference image, an error of the correlation value caused by the image edge of the second pattern light occurs at the right end of the reference image. In this way, the second pattern light may be set. The setting of the pattern light may be performed by the arithmetic processing unit 106 or may be performed by the control unit 108.

図22(a)は、第1のパターン光2211及び第2のパターン光2212を含むパターン光を投影して取得した画像2210を示している。画像2210では、基準画像2230の右端が第1のパターン光2211の画像エッジ2213と重なり、基準画像の左端が第2のパターン光2212の画像エッジ2214と重なっている。この場合には第1のパターン光2211の画像エッジ2213に基づいて発生する第1の相関値の誤差を、第2のパターン光2212の画像エッジ2214に基づいて算出した第2の相関値を用いてキャンセルすることができる。   FIG. 22A shows an image 2210 obtained by projecting pattern light including the first pattern light 2211 and the second pattern light 2212. In the image 2210, the right end of the reference image 2230 overlaps with the image edge 2213 of the first pattern light 2211, and the left end of the reference image overlaps with the image edge 2214 of the second pattern light 2212. In this case, the error of the first correlation value generated based on the image edge 2213 of the first pattern light 2211 is used as the second correlation value calculated based on the image edge 2214 of the second pattern light 2212. Can be canceled.

また、図22(b)は、第1のパターン光2221及び第2のパターン光2222を含むパターン光を投影して取得した画像2220を示している。画像2220において、基準画像2230の右端が第1のパターン光2221の画像エッジ2223と重なり、基準画像2230の左端が第2のパターン光2222の画像エッジ2224と重なっている。この場合には第1のパターン光2221の画像エッジ2223に基づいて発生する第1の相関値の誤差を、第2のパターン光2222の画像エッジ2224に基づいて算出した第2の相関値を用いてキャンセルすることができる。   FIG. 22B shows an image 2220 obtained by projecting pattern light including the first pattern light 2221 and the second pattern light 2222. In the image 2220, the right end of the reference image 2230 overlaps with the image edge 2223 of the first pattern light 2221, and the left end of the reference image 2230 overlaps with the image edge 2224 of the second pattern light 2222. In this case, the error of the first correlation value generated based on the image edge 2223 of the first pattern light 2221 is used as the second correlation value calculated based on the image edge 2224 of the second pattern light 2222. Can be canceled.

これらの場合における、第1のパターン光と第2のパターン光との視差算出方向(x軸方向)における位置の差を求めると、上述した式(1a)又は式(1b)で表すことができる。なお、式中のW、P、H、及びnは実施例1において説明したパラメータと同様のパラメータとすることができる。   If the position difference in the parallax calculation direction (x-axis direction) between the first pattern light and the second pattern light in these cases is obtained, it can be expressed by the above-described equation (1a) or equation (1b). . Note that W, P, H, and n in the equation can be the same parameters as those described in the first embodiment.

本実施例による距離検出方法では、第1のパターン光と第2のパターン光との位置を、式(1a)又は式(1b)で示す量だけ視差算出方向に互いに異ならせることで、最も適切に視差量の算出誤差を低減することができ、高精度な測距を行うことができる。なお、パターン光の位置は、制御部108によって、投影装置101において、光源に対して各サブパターン光を形成するためのパターンマスク等のパターン形成手段の位置を制御・変更することで、変更することができる。また、制御部108の制御に応じて、投影装置101内の空間光変調器を制御したり、複数のパターン形成手段を切り替えて用いたりする等、その他の既知の任意方法によりパターン光の位置を変更してもよい。   In the distance detection method according to the present embodiment, the positions of the first pattern light and the second pattern light are different from each other in the parallax calculation direction by the amount indicated by the formula (1a) or the formula (1b). In addition, the parallax amount calculation error can be reduced, and highly accurate distance measurement can be performed. Note that the position of the pattern light is changed by the control unit 108 by controlling / changing the position of a pattern forming unit such as a pattern mask for forming each sub-pattern light with respect to the light source in the projection apparatus 101. be able to. Further, according to the control of the control unit 108, the position of the pattern light is adjusted by other known arbitrary methods such as controlling the spatial light modulator in the projection apparatus 101 or switching between a plurality of pattern forming means. It may be changed.

なお、第1のパターン光と第2のパターン光の視差算出方向に垂直な方向(y軸方向)における長さは、基準画像の同方向における長さよりも短くなるように設定する。これにより、基準画像内に両パターン光の投影領域が含まれるようになり、そのような基準画像を用いることで視差量の算出誤差を低減することができる。特に、第1のパターン光と第2のパターン光の視差算出方向に垂直な方向における長さは、基準画像の同方向における長さの偶数分の1の長さにすることができる。この場合には、基準画像内に両パターン光の投影領域が均等に含まれるようになり、視差量の算出誤差を低減する効果を最も得ることができる。   Note that the length of the first pattern light and the second pattern light in the direction perpendicular to the parallax calculation direction (y-axis direction) is set to be shorter than the length of the reference image in the same direction. Thereby, the projection area of both pattern lights is included in the reference image, and the calculation error of the parallax amount can be reduced by using such a reference image. In particular, the length of the first pattern light and the second pattern light in the direction perpendicular to the parallax calculation direction can be set to an even-numbered length of the length of the reference image in the same direction. In this case, the projection area of both pattern lights is uniformly included in the reference image, and the effect of reducing the parallax amount calculation error can be most obtained.

また、第1のパターン光と第2のパターン光は、y軸方向において間隔を空けずに交互に投影されることができる。この場合には、基準画像内において、第1のパターン光及び第2のパターン光により輝度が変化する領域が増えるため、視差量の算出誤差を適切に低減でき、視差量を高精度に算出することができる。   In addition, the first pattern light and the second pattern light can be alternately projected without a gap in the y-axis direction. In this case, since the number of areas in which the luminance changes due to the first pattern light and the second pattern light in the reference image increases, it is possible to appropriately reduce the parallax amount calculation error and calculate the parallax amount with high accuracy. be able to.

なお、本実施例ではパターン光は2つのサブパターン光を含むものとして説明したが、パターン光に含まれるサブパターン光は2つに限られない。例えば、図23に示すように、パターン光2300は、パターン光2301(第1のサブパターン光)と、パターン光2302(第2のサブパターン光)と、パターン光2303(第3のサブパターン光)を含んでもよい。   In the present embodiment, the pattern light is described as including two sub-pattern lights, but the number of sub-pattern lights included in the pattern light is not limited to two. For example, as shown in FIG. 23, pattern light 2300 includes pattern light 2301 (first sub-pattern light), pattern light 2302 (second sub-pattern light), and pattern light 2303 (third sub-pattern light). ) May be included.

パターン光2301,2302,2303は、それぞれ、x軸方向(視差算出方向、第1の方向)に同じ輝度分布を有しており、x軸方向の位置が互いにずれている。また、パターン光2301,2302,2303は、y軸方向(第2の方向)の異なる位置に投影され、より具体的には順番に繰り返して投影される。各々のパターン光2301,2302,2303のx軸方向における輝度分布は、高輝度領域と低輝度領域が交互に繰り返され、同じ周期を有している。   The pattern lights 2301, 2302, and 2303 have the same luminance distribution in the x-axis direction (parallax calculation direction, first direction), and the positions in the x-axis direction are shifted from each other. The pattern lights 2301, 2302, and 2303 are projected at different positions in the y-axis direction (second direction), and more specifically, repeatedly in order. The luminance distribution in the x-axis direction of each of the pattern lights 2301, 2302, and 2303 has the same cycle in which the high luminance region and the low luminance region are alternately repeated.

このようなパターン光でも基準画像の両端にいずれかのパターン光による画像エッジがかかることで、上述した視差量の算出誤差の低減効果を奏することができる。なお、サブパターン光の数は、3つ以上であっても同様の効果を奏することができる。   Even with such pattern light, an image edge caused by any one of the pattern lights is applied to both ends of the reference image, so that the above-described effect of reducing the parallax amount calculation error can be achieved. Even if the number of sub-pattern lights is three or more, the same effect can be obtained.

上記のように、本実施例に係る距離検出装置では、投影されるパターン光は、第1のサブパターン光と第2のサブパターン光を含む。第1のサブパターン光及び第2のサブパターン光は、視差算出方向(第1の方向)及び第1の方向に垂直な第2の方向において互いに対して位置がずれたパターン光である。また、第1のサブパターン光と第2のサブパターン光は、第1の方向において高輝度領域と低輝度領域とが交互に繰り返される周期的な光であり、本実施例では、同じ輝度分布を有するパターン光を互いに対して第1及び第2の方向にずらした光である。また、基準画像は、第1のサブパターン光と第2のサブパターン光が投影された領域の画像を含む。   As described above, in the distance detection apparatus according to the present embodiment, the projected pattern light includes the first sub pattern light and the second sub pattern light. The first sub-pattern light and the second sub-pattern light are pattern lights whose positions are shifted from each other in the parallax calculation direction (first direction) and the second direction perpendicular to the first direction. Further, the first sub-pattern light and the second sub-pattern light are periodic lights in which a high-luminance region and a low-luminance region are alternately repeated in the first direction. In this embodiment, the same luminance distribution is used. Are light obtained by shifting the pattern light having s in the first and second directions with respect to each other. Further, the reference image includes an image of a region where the first sub pattern light and the second sub pattern light are projected.

また、投影装置101は、式(1a)又は式(1b)に従って、位置が設定された第1のサブパターン光と第2のサブパターン光を投影する。具体的には、演算処理部106は、基準画像の第1の方向の幅、又は該幅と撮影画像における第1のサブパターン光の第1の方向の周期との差の分だけ、視算出方向において第1のサブパターン光と第2のサブパターン光の位置をずらして設定する。又は、演算処理部106は、基準画像の第1の方向の幅と撮影画像における第1のサブパターン光の第1の方向の高輝度領域の幅との差の分だけ、視算出方向において第1のサブパターン光と第2のサブパターン光の位置をずらして設定する。若しくは、演算処理部106は、当該差から撮影画像における第1のサブパターン光の第1の方向の周期を引いた量の分だけ、視算出方向において第1のサブパターン光と第2のサブパターン光の位置をずらして設定する。投影装置101は、設定された位置に基づいて、第1のサブパターン光と第2のサブパターン光との第1の方向における位置が異なるように、パターン光を投影する。   Further, the projection apparatus 101 projects the first sub-pattern light and the second sub-pattern light whose positions are set according to the formula (1a) or the formula (1b). Specifically, the arithmetic processing unit 106 calculates the visual amount by the width of the reference image in the first direction or the difference between the width and the period of the first sub-pattern light in the first direction in the captured image. The positions of the first sub pattern light and the second sub pattern light are shifted in the direction. Alternatively, the arithmetic processing unit 106 performs the first calculation in the visual calculation direction by the difference between the width in the first direction of the reference image and the width of the high-luminance area in the first direction of the first sub-pattern light in the captured image. The positions of the first sub-pattern light and the second sub-pattern light are shifted and set. Alternatively, the arithmetic processing unit 106 is equivalent to the first sub pattern light and the second sub pattern in the visual calculation direction by an amount obtained by subtracting the period of the first sub pattern light in the captured image from the difference from the difference. Set by shifting the position of the pattern light. Based on the set position, the projection device 101 projects the pattern light so that the first sub-pattern light and the second sub-pattern light have different positions in the first direction.

このような構成から、本実施例に係る距離検出装置は、パターン光を投影した撮影画像を用いた距離検出における視差量の算出誤差を低減することができる。そのため、距離検出装置は、算出誤差の低減された視差量に基づいて、被写体102の高精度な距離情報を取得することができる。   With such a configuration, the distance detection apparatus according to the present embodiment can reduce a parallax amount calculation error in distance detection using a captured image on which pattern light is projected. Therefore, the distance detection device can acquire highly accurate distance information of the subject 102 based on the amount of parallax with reduced calculation error.

なお、本実施例では、相関値の算出方法として、基準画像内を分割し、各々の部分画像で相関値を算出し、加算平均することで算出した。しかしながら、相関値の算出方法はこれに限られず、例えば、基準画像内の行毎に相関値を算出し、各行の相関値を加算平均することで算出してもよいし、基準画像の全領域を用いて相関値を算出してもよい。なお、部分画像や行の相関値についての演算は加算平均に限られず、加算であってもよい。   In this embodiment, the correlation value is calculated by dividing the inside of the reference image, calculating the correlation value for each partial image, and averaging. However, the calculation method of the correlation value is not limited to this. For example, the correlation value may be calculated for each row in the reference image, and the correlation value of each row may be calculated and averaged, or the entire region of the reference image may be calculated. The correlation value may be calculated using Note that the calculation for the correlation values of the partial images and rows is not limited to the averaging, but may be addition.

また、本実施例では、上側半分にパターン光1801の投影領域が含まれ、下側半分にパターン光1802の投影領域が含まれるように基準画像2120を設定する場合について述べた。しかしながら、基準画像の設定方法はこれに限られない。図21(f)は基準画像の他の設定例を示したものである。例えば、図21(f)に示す基準画像2130のように、基準画像内のy方向の複数の領域に、パターン光1801,1802の投影領域が含まれるように、基準画像を設定してもよい。言い換えると、y方向における基準画像の長さを、y方向におけるパターン光1801,1802の周期の整数倍の長さとなるように設定してもよい。   In the present embodiment, the case where the reference image 2120 is set so that the upper half includes the projection area of the pattern light 1801 and the lower half includes the projection area of the pattern light 1802 has been described. However, the reference image setting method is not limited to this. FIG. 21F shows another setting example of the reference image. For example, like the reference image 2130 shown in FIG. 21F, the reference image may be set so that the projection areas of the pattern lights 1801 and 1802 are included in a plurality of areas in the y direction in the reference image. . In other words, the length of the reference image in the y direction may be set to be a length that is an integral multiple of the period of the pattern lights 1801 and 1802 in the y direction.

これらの方法により相関値を算出し、視差量を算出することでも、視差量の算出誤差を低減することができ、適切に算出された視差量に基づいて高精度に測距を行うことができる。   By calculating the correlation value by these methods and calculating the amount of parallax, the calculation error of the amount of parallax can be reduced, and the distance can be measured with high accuracy based on the appropriately calculated amount of parallax. .

なお、撮影画像上のどの位置に基準画像を設定しても、基準画像の両端に各々のパターン光に基づく画像エッジがあることが好ましい。そのため、投影パターンはX軸方向に周期的に輝度分布が繰り返される周期パターンであることが好ましい。このとき完全な周期パターンであると、相関演算で視差量を算出する際に、一周期ずれた領域が誤って検出される場合がある。そこで、視差量を探索する範囲(参照画像を動かす変位量)をパターンの周期よりも小さくなるように制限することで、この誤検出を回避することができる。   It should be noted that no matter where the reference image is set on the photographed image, it is preferable that there are image edges based on the respective pattern lights at both ends of the reference image. Therefore, the projection pattern is preferably a periodic pattern in which the luminance distribution is periodically repeated in the X-axis direction. In this case, if the period pattern is complete, an area shifted by one period may be erroneously detected when calculating the amount of parallax by correlation calculation. Therefore, this erroneous detection can be avoided by limiting the range in which the amount of parallax is searched (the amount of displacement by which the reference image is moved) to be smaller than the pattern period.

また、投影パターンを完全に同じ輝度分布が繰り返されるパターンにする必要はない。投影パターンは周期的に略同じ輝度分布が繰り返されるパターンであればよい。例えば、明領域の視差算出方向における幅がライン毎に異なっていてもよい。また、明領域又は暗領域内に輝度のばらつきがあるパターンであってもよい。適度に輝度変化を与えることで、1周期ずれた領域が誤って検出されることを回避することができるとともに、上述した視差量の算出誤差の低減効果を奏することができる。   Further, the projection pattern does not need to be a pattern in which the same luminance distribution is repeated. The projection pattern may be a pattern in which substantially the same luminance distribution is periodically repeated. For example, the width of the bright region in the parallax calculation direction may be different for each line. Moreover, the pattern which has the dispersion | variation in a brightness | luminance in a bright area | region or a dark area | region may be sufficient. By appropriately changing the luminance, it is possible to avoid erroneously detecting a region shifted by one period, and to achieve the effect of reducing the above-described parallax amount calculation error.

また、本実施例に係る距離検出装置を、実施例2と同様に、生産作業用ロボット装置に適用することもできる。この場合の例について、図9を参照して簡単に説明する。なお、この場合のロボット装置の構成は、実施例2に係るロボット装置の構成と同様であってよいため、図9と同じ参照符号を用いて説明を省略する。   In addition, the distance detection apparatus according to the present embodiment can be applied to a production work robot apparatus as in the second embodiment. An example of this case will be briefly described with reference to FIG. Note that the configuration of the robot apparatus in this case may be the same as the configuration of the robot apparatus according to the second embodiment, and thus the description thereof is omitted using the same reference numerals as those in FIG.

このようなロボット装置では、本実施例で説明したように、第1のパターン光1801と第2のパターン光1802を含むパターン光1800をワーク904に投影し、パターン光1800に基づく画像組を撮像する。その後、両パターン光1801,1802の投影領域を含む基準画像を用いて相関値を算出し、距離を求めることで、ワーク904の距離情報をより高精度に取得することができる。これにより、ロボット装置900では、ワーク904の位置姿勢の推定精度が向上し、ロボットアーム902及びロボットハンド903の位置制御の精度が向上し、より高精度な組み付け作業を行うことができる。   In such a robot apparatus, as described in the present embodiment, the pattern light 1800 including the first pattern light 1801 and the second pattern light 1802 is projected onto the work 904, and an image set based on the pattern light 1800 is captured. To do. Thereafter, the correlation value is calculated using the reference image including the projection areas of both pattern lights 1801 and 1802, and the distance information is obtained, whereby the distance information of the workpiece 904 can be acquired with higher accuracy. Thereby, in the robot apparatus 900, the estimation accuracy of the position and orientation of the workpiece 904 is improved, the accuracy of position control of the robot arm 902 and the robot hand 903 is improved, and a more accurate assembly operation can be performed.

なお、距離検出装置とワーク904との距離は、ロボットアーム902やロボットハンド903の位置に応じて変化する。このとき、投影装置101の投影パターンを変えないで距離計測を行うと、撮影画像上におけるパターンの大きさが距離に応じて変化する。そのため、この場合には、パターン光1801,1802による画像エッジの位置や、基準画像内に含まれるパターン光1801,1802の割合が変化し、視差量の検出誤差を低減させる効果が弱くなることがある。   Note that the distance between the distance detection device and the workpiece 904 changes according to the positions of the robot arm 902 and the robot hand 903. At this time, if distance measurement is performed without changing the projection pattern of the projection apparatus 101, the size of the pattern on the captured image changes according to the distance. Therefore, in this case, the position of the image edge by the pattern light 1801 and 1802 and the ratio of the pattern light 1801 and 1802 included in the reference image change, and the effect of reducing the detection error of the parallax amount may be weakened. is there.

そこで、演算処理部106は、パターン光1800を撮影して取得した画像を分析し、パターン光1801,1802のx軸方向の位置ずれ量、x軸方向の周期間隔、又はy軸方向の長さを算出・評価することができる。次に、演算処理部106は、これらの大きさに応じて基準画像の大きさを決定することができる。   Accordingly, the arithmetic processing unit 106 analyzes an image acquired by photographing the pattern light 1800, and the amount of positional deviation in the x-axis direction, the periodic interval in the x-axis direction, or the length in the y-axis direction of the pattern light 1801 and 1802. Can be calculated and evaluated. Next, the arithmetic processing unit 106 can determine the size of the reference image according to these sizes.

また、演算処理部106は、撮影画像から算出したこれらの大きさと基準画像の大きさから、各パターン光1801,1802のx軸方向における位置ずれ量や周期間隔、y軸方向の長さを決定してもよい。この場合には、制御部108によって投影装置101を制御し、演算処理部106で決定したパラメータに基づいて修正したパターン光を投影して、距離計測を行うことができる。   In addition, the arithmetic processing unit 106 determines the positional deviation amount and the period interval in the x-axis direction of each pattern light 1801 and 1802 and the length in the y-axis direction from these sizes calculated from the captured image and the size of the reference image. May be. In this case, the projection apparatus 101 can be controlled by the control unit 108, and the pattern light corrected based on the parameter determined by the arithmetic processing unit 106 can be projected to perform distance measurement.

これらのような処理によれば、距離検出装置とワーク904との距離に応じて、最適な基準画像及び投影パターン光で距離計測を行うことができ、高精度な距離計測を行うことができる。なお、演算処理部106による処理は、制御部108で行われてもよいし、制御装置905によって行われてもよい。   According to such processing, distance measurement can be performed with an optimum reference image and projection pattern light according to the distance between the distance detection device and the workpiece 904, and highly accurate distance measurement can be performed. Note that the processing by the arithmetic processing unit 106 may be performed by the control unit 108 or may be performed by the control device 905.

また、ワーク904とロボットハンド903の距離が近いときほど、面内解像度が高い距離情報を取得し、ワーク904の位置姿勢を高精度に推定することが求められる。ここで、ワーク904の距離は、撮影画像上におけるワーク904の大きさから概略算出することができる。また、距離検出装置によるワーク904の距離情報の取得と制御装置905によるロボットアーム902の制御は時系列で順次行うため、これらの処理の1サイクル前に取得した距離情報に基づいてワーク904の距離を概略知ることもできる。   Further, as the distance between the workpiece 904 and the robot hand 903 is closer, it is required to acquire distance information with higher in-plane resolution and to estimate the position and orientation of the workpiece 904 with higher accuracy. Here, the distance of the workpiece 904 can be roughly calculated from the size of the workpiece 904 on the captured image. In addition, since acquisition of distance information of the workpiece 904 by the distance detection device and control of the robot arm 902 by the control device 905 are sequentially performed in time series, the distance of the workpiece 904 is based on the distance information acquired one cycle before these processes. You can also get an overview.

そこで、演算処理部106は、概略的なワーク904の距離情報に基づいて、各パターン光1801,1802のx軸方向における位置ずれ量や周期間隔、y軸方向の長さが小さくなるように設定してもよい。また、距離が近いほど、演算処理部106は、各パターン光1801,1802の周期間隔に基づいて、基準画像のx軸方向及びy軸方向の大きさが小さくなるように設定してもよい。このような処理によれば、距離検出装置とワーク904との距離に応じて、最適な基準画像及び投影パターン光で距離計測を行うことができ、高精度な距離計測を行うことができる。なお、演算処理部106による処理は、制御部108で行われてもよいし、制御装置905によって行われてもよい。   Therefore, the arithmetic processing unit 106 is set so that the positional deviation amount and the period interval in the x-axis direction of each pattern light 1801, 1802 and the length in the y-axis direction are reduced based on the schematic distance information of the workpiece 904. May be. Further, as the distance is shorter, the arithmetic processing unit 106 may set the size of the reference image in the x-axis direction and the y-axis direction to be smaller based on the periodic intervals of the pattern lights 1801 and 1802. According to such processing, distance measurement can be performed with the optimum reference image and projection pattern light according to the distance between the distance detection device and the workpiece 904, and highly accurate distance measurement can be performed. Note that the processing by the arithmetic processing unit 106 may be performed by the control unit 108 or may be performed by the control device 905.

これらの方法によれば、各パターン光と基準画像を適切に設定することができ、ロボット装置900は、距離検出装置による視差量の算出誤差を低減することができ、ワーク904の距離を高精度に算出することができる。このため、ロボット装置900では、ワーク904の位置姿勢の推定精度が向上し、ロボットアーム902及びロボットハンド903の位置制御の精度が向上し、より高精度な組み付け作業を行うことができる。   According to these methods, each pattern light and the reference image can be appropriately set, and the robot apparatus 900 can reduce the parallax amount calculation error by the distance detection apparatus, and the distance of the workpiece 904 can be set with high accuracy. Can be calculated. For this reason, in the robot apparatus 900, the estimation accuracy of the position and orientation of the workpiece 904 is improved, the accuracy of the position control of the robot arm 902 and the robot hand 903 is improved, and more accurate assembly work can be performed.

(実施例7)
実施例1は、パターン光を投影して取得した撮影画像上において視差算出方向に異なる位置に第1の基準画像と第2の基準画像を設定し、両基準画像と参照画像との相関値を算出して両相関値より視差量を算出した。また、実施例4では、視差算出方向に位置ずれした第1のパターン光と第2のパターン光を投影して各パターン光に基づく画像組を取得し、各々の画像組より第1の相関値と第2の相関値を算出して両相関値より視差量を算出した。さらに、実施例6では、視差算出方向に位置ずれした複数のサブパターン光を含むパターン光を投影し、撮像画像上の両サブパターン光が投影された領域を含むように基準画像を設定し、基準画像を用いて相関値を算出して視差量を算出した。
(Example 7)
In the first embodiment, the first reference image and the second reference image are set at different positions in the parallax calculation direction on the captured image obtained by projecting the pattern light, and the correlation value between the reference image and the reference image is set. The parallax amount was calculated from both correlation values. In the fourth embodiment, the first pattern light and the second pattern light that are displaced in the parallax calculation direction are projected to obtain an image set based on each pattern light, and the first correlation value is obtained from each image set. The second correlation value was calculated, and the parallax amount was calculated from both correlation values. Further, in the sixth embodiment, pattern light including a plurality of sub-pattern lights shifted in the parallax calculation direction is projected, and a reference image is set so as to include an area where both sub-pattern lights are projected on the captured image, The correlation value was calculated using the reference image to calculate the amount of parallax.

ここで、実施例1に係る手法を第1の手法、実施例6に係る手法を第2の手法、実施例4に係る手法を第3の手法とする。第1の手法と第2の手法では、一回のパターン投影で距離計測を行うことができ、高速な距離計測を行うことができる。これに対し、第3の手法では、注目画素を含む狭い領域に基準画像を設定し、複数のパターン光の位置調整を行って測距を行うことで、注目画素の周辺にある物体の距離情報が混合することを避けることでき、注目画素の距離を高精度に計測することができる。   Here, the technique according to the first embodiment is a first technique, the technique according to the sixth embodiment is a second technique, and the technique according to the fourth embodiment is a third technique. In the first method and the second method, distance measurement can be performed by one pattern projection, and high-speed distance measurement can be performed. On the other hand, in the third method, the reference image is set in a narrow region including the target pixel, and the distance information of the object around the target pixel is obtained by performing the distance measurement by adjusting the position of the plurality of pattern lights. Can be mixed, and the distance of the target pixel can be measured with high accuracy.

そこで、実施例7では、これら第1〜3の手法を、測距条件に応じて切り替えて使用する場合について説明する。なお、本実施例に係る距離検出装置及びロボット装置の構成は、実施例1に係る距離検出装置の構成及び実施例2に係るロボット装置の構成と同様であるため、図1及び9と同じ参照符号を用いて説明を省略する。   Therefore, in the seventh embodiment, a case where these first to third methods are used by switching according to the distance measurement condition will be described. The configuration of the distance detection device and the robot device according to the present embodiment is the same as the configuration of the distance detection device according to the first embodiment and the configuration of the robot device according to the second embodiment. The description will be omitted using reference numerals.

例えば、実施例2で述べたロボット装置900において、ロボットハンド903とワーク904の距離が遠いときは、ワーク904近傍にロボットハンド903を速やかに近づけることが求められる。このような場合には、第1の手法又は第2の手法を用いて、高速に測距を行うことが好ましい。   For example, in the robot apparatus 900 described in the second embodiment, when the distance between the robot hand 903 and the workpiece 904 is long, the robot hand 903 is required to be brought close to the vicinity of the workpiece 904 quickly. In such a case, it is preferable to perform distance measurement at high speed using the first method or the second method.

また、ロボットハンド903とワーク904の距離が近いときは、ロボットハンド903とワーク904との位置合わせを高精度に行うことが求められる。このような場合には、第3の手法を用いて、ワークの位置を高精度に計測することが好ましい。   Further, when the distance between the robot hand 903 and the workpiece 904 is short, it is required to align the robot hand 903 and the workpiece 904 with high accuracy. In such a case, it is preferable to measure the position of the workpiece with high accuracy using the third method.

このため、本実施例に係るロボット装置では、演算処理部106が、距離検出装置とワーク904の距離が、所定の距離よりも長い場合には、実施例1で説明した第1の手法又は実施例6で説明した第2の手法を用いて測距を行う。また、演算処理部106は、距離検出装置とワーク904の距離が、所定の距離以下の(所定の距離よりも短い)場合には、実施例4で説明した第3の手法を用いて測距を行う。   For this reason, in the robot apparatus according to the present embodiment, when the distance between the distance detection apparatus and the workpiece 904 is longer than the predetermined distance, the arithmetic processing unit 106 performs the first method or implementation described in the first embodiment. Ranging is performed using the second method described in Example 6. Further, when the distance between the distance detection device and the workpiece 904 is equal to or less than a predetermined distance (shorter than the predetermined distance), the arithmetic processing unit 106 uses the third method described in the fourth embodiment to measure the distance. I do.

ここで、ワーク904の距離は、撮影画像上におけるワーク904の大きさから概略算出することができる。また、距離検出装置によるワーク904の距離情報の取得と制御装置905によるロボットアーム902の制御は時系列で順次行うため、これらの処理の1サイクル前(以前)に取得した距離情報に基づいてワーク904の距離を概略知ることもできる。このため、演算処理部106は、これら概略的なワーク904の距離(第1の距離)に基づいて、距離検出装置とワーク904との距離(第2の距離)の検出に用いる手法の切り替えを行ってよい。なお、演算処理部106は、継時的に検出した距離に基づいて測距に用いる手法の切り替える場合、ワーク904の距離を初めて検出する場合には、第1〜第3の手法のうち予め設定された手法を用いてワーク904の距離を検出してもよい。   Here, the distance of the workpiece 904 can be roughly calculated from the size of the workpiece 904 on the captured image. In addition, since acquisition of distance information of the workpiece 904 by the distance detection device and control of the robot arm 902 by the control device 905 are sequentially performed in time series, the workpiece is based on the distance information acquired one cycle before (before) these processes. It is also possible to know the approximate distance of 904. Therefore, the arithmetic processing unit 106 switches the method used for detecting the distance (second distance) between the distance detection device and the workpiece 904 based on the approximate distance (first distance) of the workpiece 904. You can go. Note that the arithmetic processing unit 106 sets in advance among the first to third methods when the method used for distance measurement is switched based on the distance detected over time, or when the distance of the workpiece 904 is detected for the first time. The distance of the workpiece 904 may be detected by using the method described above.

本実施例に係る距離検出装置では、距離検出装置と被写体との概略的な距離に基づいて、測距手法を切り替えて測距を行うことができる。このため、距離検出装置と被写体との位置関係及び状況等に応じて、より適切な測距を行うことができる。   In the distance detection apparatus according to the present embodiment, distance measurement can be performed by switching the distance measurement method based on the approximate distance between the distance detection apparatus and the subject. Therefore, more appropriate distance measurement can be performed according to the positional relationship between the distance detection device and the subject, the situation, and the like.

なお、演算処理部106による上述の処理は、制御部108や制御装置905で行われてもよい。また、本実施例に係る距離検出装置で距離検出する被写体は、ワーク904に限られず、任意の被写体であってよい。   Note that the above-described processing by the arithmetic processing unit 106 may be performed by the control unit 108 or the control device 905. Further, the subject whose distance is detected by the distance detection apparatus according to the present embodiment is not limited to the work 904, and may be any subject.

上述した実施例1、及び3乃至7による距離検出装置は、ロボット装置に適用される構成に限られず、カメラや内視鏡等の撮影装置に適用されてもよい。   The distance detection apparatuses according to the first embodiment and the third to seventh embodiments described above are not limited to the configuration applied to the robot apparatus, and may be applied to an imaging apparatus such as a camera or an endoscope.

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

以上、実施例を参照して本発明について説明したが、本発明は上記実施例に限定されるものではない。本発明の趣旨に反しない範囲で変更された発明、及び本発明と均等な発明も本発明に含まれる。また、上述の各実施例及び変形例は、本発明の趣旨に反しない範囲で適宜組み合わせることができる。   Although the present invention has been described with reference to the embodiments, the present invention is not limited to the above embodiments. Inventions modified within the scope not departing from the spirit of the present invention and inventions equivalent to the present invention are also included in the present invention. Moreover, each above-mentioned Example and modification can be combined suitably in the range which is not contrary to the meaning of this invention.

100:距離検出装置、101:投影装置、102:被写体、103:撮影装置、161:相関算出部、162:視差算出部 100: distance detection device, 101: projection device, 102: subject, 103: imaging device, 161: correlation calculation unit, 162: parallax calculation unit

Claims (41)

視差を有する画像組を取得する取得手段と、
前記画像組の片方の画像上で基準画像を設定し、該基準画像に基づいて前記画像組の相関値を算出する相関算出手段と、
前記相関値を用いて前記画像組の視差量を算出する視差算出手段と、
を備え、
前記相関算出手段は、
前記画像組の片方の画像上で第1の基準画像を設定し、該第1の基準画像に基づいて第1の相関値を算出し、
前記画像組の片方の画像上で、所定の方向において前記第1の基準画像の位置とは異なる位置に第2の基準画像を設定し、該第2の基準画像に基づいて第2の相関値を算出し、
前記視差算出手段は、前記第1の相関値と前記第2の相関値を用いて前記視差量を算出する、視差検出装置。
Acquisition means for acquiring an image set having parallax;
Correlation calculating means for setting a reference image on one image of the image set and calculating a correlation value of the image set based on the reference image;
Parallax calculating means for calculating the parallax amount of the image set using the correlation value;
With
The correlation calculating means includes
Setting a first reference image on one image of the image set, and calculating a first correlation value based on the first reference image;
A second reference image is set at a position different from the position of the first reference image in a predetermined direction on one image of the image set, and a second correlation value is set based on the second reference image. To calculate
The parallax calculation unit is a parallax detection device that calculates the parallax amount using the first correlation value and the second correlation value.
前記取得手段は、パターン光が投影された被写体を撮像した、視差を有する画像組を取得する、請求項1に記載の視差検出装置。   The parallax detection device according to claim 1, wherein the acquisition unit acquires an image set having parallax obtained by imaging a subject on which pattern light is projected. 前記パターン光は、前記所定の方向に対して垂直な方向に高輝度領域及び低輝度領域が伸びるラインパターンを有する、請求項2に記載の視差検出装置。   The parallax detection device according to claim 2, wherein the pattern light has a line pattern in which a high luminance region and a low luminance region extend in a direction perpendicular to the predetermined direction. 前記相関算出手段は、前記第1の基準画像と前記第2の基準画像を、前記第1の基準画像の前記所定の方向の幅、及び該幅と前記画像組の少なくとも一方の画像上における前記パターン光の周期との差のいずれか一方の分だけ、前記所定の方向において異なる位置に設定する、請求項2又は3に記載の視差検出装置。   The correlation calculating means calculates the first reference image and the second reference image, the width of the first reference image in the predetermined direction, and the width and the image on at least one image of the image set. 4. The parallax detection device according to claim 2, wherein the parallax detection device is set at a different position in the predetermined direction by one of the differences from the pattern light period. 前記相関算出手段は、前記第1の基準画像と前記第2の基準画像を、前記第1の基準画像の前記所定の方向の幅と前記画像組の少なくとも一方の画像上における前記パターン光の高輝度領域の幅との差、及び該差から前記パターン光の周期を引いた量のいずれか一方の分だけ、前記所定の方向において異なる位置に設定する、請求項2又は3に記載の視差検出装置。   The correlation calculating means determines the first reference image and the second reference image as the width of the first reference image in the predetermined direction and the height of the pattern light on at least one image of the image set. 4. The parallax detection according to claim 2, wherein the position is set to a different position in the predetermined direction by either one of a difference from a width of a luminance region and an amount obtained by subtracting a period of the pattern light from the difference. apparatus. 前記相関算出手段は、前記画像組より前記パターン光に基づく画素値の変動の周期を算出し、算出した前記変動の周期に基づいて前記第2の基準画像の位置を決定する、請求項2又は3に記載の視差検出装置。   The correlation calculation unit calculates a fluctuation period of pixel values based on the pattern light from the image set, and determines the position of the second reference image based on the calculated fluctuation period. 3. The parallax detection device according to 3. 前記パターン光を被写体に投影する投影手段を更に備える、請求項2乃至6のいずれか一項に記載の視差検出装置。   The parallax detection device according to any one of claims 2 to 6, further comprising projection means for projecting the pattern light onto a subject. 前記画像組のいずれかの画像が前記所定の方向において周期性を有するかを判定する判定手段を更に備え、
前記画像組のいずれかの画像が前記周期性を有すると判定された場合には、前記相関算出手段が前記第1及び第2の相関値を算出する、請求項1に記載の視差検出装置。
Determination means for determining whether any image of the image set has periodicity in the predetermined direction;
The parallax detection device according to claim 1, wherein, when any image in the image set is determined to have the periodicity, the correlation calculation unit calculates the first and second correlation values.
前記相関算出手段は、前記第1の基準画像と前記第2の基準画像を、前記所定の方向に対して垂直な方向において異なる位置に設定する、請求項1乃至8のいずれか一項に記載の視差検出装置。   9. The correlation calculation unit according to claim 1, wherein the correlation calculation unit sets the first reference image and the second reference image at different positions in a direction perpendicular to the predetermined direction. Parallax detection device. 前記第1の基準画像及び前記第2の基準画像は画像サイズが同じである、請求項1乃至9のいずれか一項に記載の視差検出装置。   The parallax detection device according to any one of claims 1 to 9, wherein the first reference image and the second reference image have the same image size. 被写体にパターン光を投影する投影手段と、
視差を有する画像組を取得する取得手段と、
前記画像組の片方の画像上に基準画像を設定し、該基準画像に基づいて前記画像組の相関値を算出する相関算出手段と、
前記相関値を用いて前記画像組の視差量を算出する視差算出手段と、
を備え、
前記投影手段は、所定の方向において互いに対して位置がずれたパターンを有する第1のパターン光と第2のパターン光を投影し、
前記相関算出手段は、
前記第1のパターン光を投影して取得した第1の画像組に基づいて第1の相関値を算出し、
前記第2のパターン光が投影して取得した第2の画像組に基づいて第2の相関値を算出し、
前記視差算出手段は、前記第1の相関値と前記第2の相関値を用いて前記視差量を算出する、視差検出装置。
Projection means for projecting pattern light onto the subject;
Acquisition means for acquiring an image set having parallax;
A correlation calculating means for setting a reference image on one image of the image set and calculating a correlation value of the image set based on the reference image;
Parallax calculating means for calculating the parallax amount of the image set using the correlation value;
With
The projecting means projects first pattern light and second pattern light having patterns whose positions are shifted from each other in a predetermined direction,
The correlation calculating means includes
Calculating a first correlation value based on a first image set obtained by projecting the first pattern light;
Calculating a second correlation value based on a second image set obtained by projecting the second pattern light;
The parallax calculation unit is a parallax detection device that calculates the parallax amount using the first correlation value and the second correlation value.
前記相関算出手段は、前記第1の画像組の片方の画像及び前記第2の画像組の片方の画像上の同じ位置に設定した基準画像を用いて、前記第1の相関値と前記第2の相関値とを算出する、請求項11に記載の視差検出装置。   The correlation calculation means uses the reference image set at the same position on one image of the first image set and one image of the second image set, and uses the first correlation value and the second correlation value. The parallax detection device according to claim 11, wherein the correlation value is calculated. 前記第1のパターン光と前記第2のパターン光は、前記所定の方向において高輝度領域と低輝度領域とが交互に繰り返される周期的な光であり、前記所定の方向に垂直な第2の方向に該高輝度領域及び該低輝度領域が伸びるラインパターンを有する、請求項11又は12に記載の視差検出装置。   The first pattern light and the second pattern light are periodic lights in which a high luminance region and a low luminance region are alternately repeated in the predetermined direction, and a second light that is perpendicular to the predetermined direction. The parallax detection device according to claim 11 or 12, comprising a line pattern in which the high luminance region and the low luminance region extend in a direction. 前記第1のパターン光と前記第2のパターン光は、同じ輝度分布を有するパターン光を互いに対して前記所定の方向にずらした光である、請求項11に記載の視差検出装置。   The parallax detection device according to claim 11, wherein the first pattern light and the second pattern light are light obtained by shifting pattern lights having the same luminance distribution in the predetermined direction with respect to each other. 前記投影手段は、前記基準画像の前記所定の方向の幅と前記第1の画像組の少なくとも一方の画像における前記第1のパターン光の高輝度領域の幅との差、及び該差から該少なくとも一方の画像における前記第1のパターン光の周期を引いた量のいずれか一方の分だけ、前記第1のパターン光が有するパターンと前記第2のパターン光が有するパターンの前記所定の方向における位置が異なるように、前記第2のパターン光を投影する、請求項11又は12に記載の視差検出装置。   The projection unit is configured to obtain a difference between a width of the reference image in the predetermined direction and a width of the high-intensity region of the first pattern light in at least one image of the first image set, and at least the difference from the difference. Positions of the pattern of the first pattern light and the pattern of the second pattern light in the predetermined direction by either one of the amounts obtained by subtracting the period of the first pattern light in one image The parallax detection device according to claim 11, wherein the second pattern light is projected so that the two are different from each other. 前記投影手段は、前記基準画像の前記所定の方向の幅、及び該幅と前記第1の画像組の少なくとも一方の画像における前記第1のパターン光の周期との差のいずれか一方の分だけ、前記第1のパターン光が有するパターンと前記第2のパターン光が有するパターンの前記所定の方向における位置が異なるように、前記第2のパターン光を投影する、請求項11又は12に記載の視差検出装置。   The projecting means may be one of a width of the reference image in the predetermined direction and a difference between the width and the period of the first pattern light in at least one image of the first image set. The second pattern light is projected so that a pattern of the first pattern light and a pattern of the second pattern light have different positions in the predetermined direction. Parallax detection device. 前記第1の画像組の少なくとも一方の画像における前記第1のパターン光の前記所定の方向における周期を評価する評価手段を更に備え、
前記投影手段は、評価した前記周期に基づいて決定された位置に、前記第2のパターン光を投影する、請求項13に記載の視差検出装置。
Evaluation means for evaluating a period in the predetermined direction of the first pattern light in at least one image of the first image set;
The parallax detection device according to claim 13, wherein the projection unit projects the second pattern light at a position determined based on the evaluated period.
前記第1の画像組の少なくとも一方の画像及び前記第2の画像組の少なくとも一方の画像に基づいて、前記第1のパターン光と前記第2のパターン光の前記所定の方向における位置ずれ量を算出し、該位置ずれ量に基づいて前記基準画像の該所定の方向における長さを決定する演算手段を更に備える、請求項11乃至14のいずれか一項に記載の視差検出装置。   Based on at least one image of the first image set and at least one image of the second image set, a positional shift amount of the first pattern light and the second pattern light in the predetermined direction is determined. The parallax detection device according to any one of claims 11 to 14, further comprising calculation means for calculating and determining a length of the reference image in the predetermined direction based on the amount of positional deviation. 前記投影手段は、波長帯域が異なる前記第1のパターン光と前記第2のパターン光とを投影し、
前記取得手段は、前記第1のパターン光に基づく画像組と、前記第2のパターン光に基づく画像組とを分離して取得する、請求項11乃至18のいずれか一項に記載の視差検出装置。
The projection means projects the first pattern light and the second pattern light having different wavelength bands,
The parallax detection according to any one of claims 11 to 18, wherein the acquisition unit acquires the image set based on the first pattern light and the image set based on the second pattern light separately. apparatus.
前記視差算出手段は、前記第1の相関値と前記第2の相関値の加算及び加算平均のいずれかにより算出した相関値を用いて前記視差量を算出する、請求項1乃至19のいずれか一項に記載の視差検出装置。   The parallax calculation unit calculates the amount of parallax using a correlation value calculated by either addition or addition averaging of the first correlation value and the second correlation value. The parallax detection device according to one item. 前記視差算出手段は、
前記第1の相関値より第1の視差量を算出し、
前記第2の相関値より第2の視差量を算出し、
前記第1の視差量と前記第2の視差量を加算平均した視差量を用いて前記画像組の視差量を算出する、請求項1乃至19のいずれか一項に記載の視差検出装置。
The parallax calculation means includes
Calculating a first parallax amount from the first correlation value;
A second amount of parallax is calculated from the second correlation value;
The parallax detection device according to any one of claims 1 to 19, wherein a parallax amount of the image set is calculated using a parallax amount obtained by averaging the first parallax amount and the second parallax amount.
前記相関算出手段は、前記画像組の他方の画像上に参照画像を設定し、該参照画像の位置を前記所定の方向に移動させながら前記基準画像と該参照画像との相関値を算出する、請求項1乃至21のいずれか一項に記載の視差検出装置。 The correlation calculating unit sets a reference image on the other image in the image set, and calculates a correlation value between the reference image and the reference image while moving the position of the reference image in the predetermined direction. The parallax detection device according to any one of claims 1 to 21. 被写体にパターン光を投影する投影手段と、
視差を有する画像組を取得する取得手段と、
前記画像組の片方の画像上に基準画像を設定し、該基準画像に基づいて前記画像組の相関値を算出する相関算出手段と、
前記相関値を用いて前記画像組の視差量を算出する視差算出手段と、
を備え、
前記パターン光は、第1のサブパターン光と第2のサブパターン光を含み、
前記第1のサブパターン光及び前記第2のサブパターン光は、第1の方向及び該第1の方向に垂直な第2の方向において互いに対して位置がずれたパターン光であり、
前記基準画像は、前記第1のサブパターン光と前記第2のサブパターン光が投影された領域の画像を含む、視差検出装置。
Projection means for projecting pattern light onto the subject;
Acquisition means for acquiring an image set having parallax;
A correlation calculating means for setting a reference image on one image of the image set and calculating a correlation value of the image set based on the reference image;
Parallax calculating means for calculating the parallax amount of the image set using the correlation value;
With
The pattern light includes a first sub-pattern light and a second sub-pattern light,
The first sub pattern light and the second sub pattern light are pattern lights whose positions are shifted from each other in a first direction and a second direction perpendicular to the first direction,
The parallax detection device, wherein the reference image includes an image of a region where the first sub-pattern light and the second sub-pattern light are projected.
前記第1のサブパターン光と前記第2のサブパターン光は、前記第1の方向において高輝度領域と低輝度領域とが交互に繰り返される周期的な光である、請求項23に記載の視差検出装置。   The parallax according to claim 23, wherein the first sub-pattern light and the second sub-pattern light are periodic lights in which a high-luminance region and a low-luminance region are alternately repeated in the first direction. Detection device. 前記第1のサブパターン光と前記第2のサブパターン光は、同じ輝度分布を有するパターン光を互いに対して前記第1及び第2の方向にずらした光である、請求項24に記載の視差検出装置。   The parallax according to claim 24, wherein the first sub-pattern light and the second sub-pattern light are light obtained by shifting pattern lights having the same luminance distribution in the first and second directions with respect to each other. Detection device. 前記投影手段は、前記基準画像の前記第1の方向の幅と前記画像組の少なくとも一方の画像における前記第1のサブパターン光の前記第1の方向の高輝度領域の幅との差、及び該差から該少なくとも一方の画像における前記第1のサブパターン光の前記第1の方向の周期を引いた量のいずれか一方の分だけ、前記第1のサブパターン光と前記第2のサブパターン光との前記第1の方向における位置が異なるように、前記パターン光を投影する、請求項24又は25に記載の視差検出装置。   The projection means includes a difference between the width of the reference image in the first direction and the width of the high-luminance area in the first direction of the first sub-pattern light in at least one image of the image set; and The first sub-pattern light and the second sub-pattern are equal to one of the difference obtained by subtracting the period in the first direction of the first sub-pattern light in the at least one image from the difference. The parallax detection device according to claim 24 or 25, wherein the pattern light is projected so that the position of the light in the first direction is different. 前記投影手段は、前記第1の方向のおける前記基準画像の幅、及び該幅と前記画像組の少なくとも一方の画像における前記第1のサブパターン光の前記第1の方向の周期との差のいずれか一方の分だけ、前記第1のサブパターン光と前記第2のサブパターン光との前記第1の方向における位置が異なるように、前記パターン光を投影する、請求項24又は25に記載の視差検出装置。   The projection means includes a width of the reference image in the first direction, and a difference between the width and a period of the first sub-pattern light in the first direction in at least one image of the image set. 26. The pattern light is projected so that the position of the first sub-pattern light and the second sub-pattern light in the first direction is different from each other by any one amount. Parallax detection device. 前記第1のサブパターン光と前記第2のサブパターン光は、前記第2の方向において同じ周期を有する光である、請求項23乃至27のいずれか一項に記載の視差検出装置。   The parallax detection device according to any one of claims 23 to 27, wherein the first sub-pattern light and the second sub-pattern light are light having the same period in the second direction. 前記第2の方向における前記基準画像の長さは、前記第2の方向における前記第1のサブパターン光及び前記第2のサブパターン光の周期の整数倍の長さである、請求項28に記載の視差検出装置。   The length of the reference image in the second direction is a length that is an integral multiple of the period of the first sub-pattern light and the second sub-pattern light in the second direction. The parallax detection device described. 前記画像組の少なくとも一方の画像における前記第1のサブパターン光の前記第1の方向の周期、又は該少なくとも一方の画像における前記第1のサブパターン光と前記第2のサブパターン光の前記第1の方向における位置の差を評価し、該周期又は該位置の差に基づいて、前記基準画像の前記第1の方向及び前記第2の方向の長さを決定する評価手段を更に備える、請求項23乃至25のいずれか一項に記載の視差検出装置。   The period of the first sub-pattern light in the first direction in at least one image of the image set, or the first sub-pattern light and the second sub-pattern light in the at least one image. And further comprising evaluation means for evaluating a difference in position in one direction and determining the length of the first direction and the second direction of the reference image based on the period or the difference in position. Item 26. The parallax detection device according to any one of Items 23 to 25. 前記画像組の少なくとも一方の画像における前記第1のサブパターン光の前記第1の方向の周期、又は該少なくとも一方の画像における前記第1のサブパターン光と前記第2のサブパターン光の前記第1の方向における位置の差を評価する評価手段を更に備え、
前記投影手段は、評価した前記周期又は前記位置の差と、前記基準画像の該第1の方向及び前記第2の方向の長さとに基づいて前記第1のサブパターン光と前記第2のサブパターン光の周期と位置とを修正したパターン光を投影する、請求項23乃至25のいずれか一項に記載の視差検出装置。
The period of the first sub-pattern light in the first direction in at least one image of the image set, or the first sub-pattern light and the second sub-pattern light in the at least one image. An evaluation means for evaluating the difference in position in the direction of 1;
The projecting means may determine the first sub-pattern light and the second sub-light based on the evaluated period or position difference and the lengths of the reference image in the first direction and the second direction. The parallax detection device according to any one of claims 23 to 25, which projects pattern light in which the period and position of the pattern light are corrected.
前記相関算出手段は、前記画像組の他方の画像上に参照画像を設定し、該参照画像の位置を前記第1の方向に移動させながら前記基準画像と該参照画像との相関値を算出する、請求項23乃至31のいずれか一項に記載の視差検出装置。   The correlation calculating unit sets a reference image on the other image of the image set, and calculates a correlation value between the reference image and the reference image while moving the position of the reference image in the first direction. The parallax detection device according to any one of claims 23 to 31. 請求項1乃至32のいずれか一項に記載の視差検出装置と、
ロボットアームと、
前記ロボットアームに設けられたロボットハンドと、
前記ロボットアーム及び前記ロボットハンドを制御する制御装置と、
を備えた、ロボット装置。
A parallax detection device according to any one of claims 1 to 32;
A robot arm,
A robot hand provided on the robot arm;
A control device for controlling the robot arm and the robot hand;
A robot apparatus comprising
前記視差検出装置は、
前記視差量に基づいて、被写体までの距離を算出する距離算出手段を更に備え、
ワークまでの距離を含む距離情報及び該ワークの画像情報を取得し、
前記制御装置は、
前記距離情報及び前記画像情報を用いて前記ワークの位置姿勢を推定し、
前記位置姿勢に基づいて前記ロボットアーム及び前記ロボットハンドを制御する、請求項33に記載のロボット装置。
The parallax detection device includes:
A distance calculating means for calculating a distance to the subject based on the parallax amount;
Obtain distance information including the distance to the workpiece and image information of the workpiece,
The controller is
Estimating the position and orientation of the workpiece using the distance information and the image information;
The robot apparatus according to claim 33, wherein the robot arm and the robot hand are controlled based on the position and orientation.
請求項1乃至32のいずれか一項に記載の視差検出装置と、
前記視差検出装置が検出した視差量を用いて被写体までの距離を検出する距離算出手段と、
を備える距離検出装置。
A parallax detection device according to any one of claims 1 to 32;
Distance calculating means for detecting the distance to the subject using the amount of parallax detected by the parallax detection device;
A distance detection device comprising:
視差を有する画像組を取得することと、
前記画像組の片方の画像上で基準画像を設定し、該基準画像に基づいて前記画像組の相関値を算出することと、
前記相関値を用いて前記画像組の視差量を算出することと、
を含み、
前記相関値を算出することは、
前記画像組の片方の画像上で第1の基準画像を設定し、該第1の基準画像に基づいて第1の相関値を算出することと、
前記画像組の片方の画像上で、所定の方向において前記第1の基準画像の位置とは異なる位置に第2の基準画像を設定し、該第2の基準画像に基づいて第2の相関値を算出することと、
を含み、
前記視差量を算出することは、前記第1の相関値と前記第2の相関値を用いて前記視差量を算出することを含む、視差検出方法。
Obtaining a set of images having parallax;
Setting a reference image on one image of the image set, and calculating a correlation value of the image set based on the reference image;
Calculating a parallax amount of the image set using the correlation value;
Including
Calculating the correlation value is
Setting a first reference image on one image of the image set, and calculating a first correlation value based on the first reference image;
A second reference image is set at a position different from the position of the first reference image in a predetermined direction on one image of the image set, and a second correlation value is set based on the second reference image. Calculating
Including
Calculating the amount of parallax includes calculating the amount of parallax using the first correlation value and the second correlation value.
被写体にパターン光を投影することと、
視差を有する画像組を取得することと、
前記画像組の片方の画像上に基準画像を設定し、該基準画像に基づいて前記画像組の相関値を算出することと、
前記相関値を用いて前記画像組の視差量を算出することと、
を含み、
前記投影することは、所定の方向において互いに対して位置がずれたパターンを有する第1のパターン光と第2のパターン光を投影することを含み、
前記相関値を算出することは、
前記第1のパターン光を投影して取得した第1の画像組に基づいて第1の相関値を算出することと、
前記第2のパターン光が投影して取得した第2の画像組に基づいて第2の相関値を算出することと、
を含み、
前記視差量を算出することは、前記第1の相関値と前記第2の相関値を用いて前記視差量を算出することを含む、視差検出方法。
Projecting pattern light onto the subject;
Obtaining a set of images having parallax;
Setting a reference image on one image of the image set, and calculating a correlation value of the image set based on the reference image;
Calculating a parallax amount of the image set using the correlation value;
Including
The projecting includes projecting a first pattern light and a second pattern light having patterns whose positions are shifted from each other in a predetermined direction,
Calculating the correlation value is
Calculating a first correlation value based on a first image set obtained by projecting the first pattern light;
Calculating a second correlation value based on a second set of images obtained by projecting the second pattern light;
Including
Calculating the amount of parallax includes calculating the amount of parallax using the first correlation value and the second correlation value.
被写体にパターン光を投影することと、
視差を有する画像組を取得することと、
前記画像組の片方の画像上に基準画像を設定し、該基準画像に基づいて前記画像組の相関値を算出することと、
前記相関値を用いて前記画像組の視差量を算出することと、
を含み、
前記パターン光は、第1のサブパターン光と第2のサブパターン光を含み、
前記第1のサブパターン光及び前記第2のサブパターン光は、第1の方向及び該第1の方向に垂直な第2の方向において互いに対して位置がずれたパターン光であり、
前記基準画像は、前記第1のサブパターン光と前記第2のサブパターン光が投影された領域の画像を含む、視差検出方法。
Projecting pattern light onto the subject;
Obtaining a set of images having parallax;
Setting a reference image on one image of the image set, and calculating a correlation value of the image set based on the reference image;
Calculating a parallax amount of the image set using the correlation value;
Including
The pattern light includes a first sub-pattern light and a second sub-pattern light,
The first sub-pattern light and the second sub-pattern light are pattern lights whose positions are shifted from each other in a first direction and a second direction perpendicular to the first direction,
The parallax detection method, wherein the reference image includes an image of an area where the first sub-pattern light and the second sub-pattern light are projected.
請求項36乃至38のいずれか一項に記載の視差検出方法の各工程と、
前記視差検出方法で検出した視差量を用いて被写体までの距離を検出することと、
を含む、距離検出方法。
Each step of the parallax detection method according to any one of claims 36 to 38;
Detecting the distance to the subject using the amount of parallax detected by the parallax detection method;
A distance detection method including:
距離検出装置を用いた距離検出方法であって、
前記距離検出装置によって撮影した画像における被写体の大きさ及び前記被写体について以前に検出した前記被写体と前記距離検出装置との距離のいずれか一方に基づいて、前記被写体と前記距離検出装置との第1の距離を取得することと、
前記第1の距離が所定の距離よりも長い場合に、請求項36又は38に記載の視差検出方法により検出した視差量に基づいて前記被写体と前記距離検出装置との第2の距離を検出することと、
前記第1の距離が前記所定の距離以下の場合に、請求項37に記載の視差検出方法により検出した視差量に基づいて前記第2の距離を検出することと、
を含む、距離検出装置を用いた距離検出方法。
A distance detection method using a distance detection device,
The first of the subject and the distance detection device is based on either the size of the subject in the image photographed by the distance detection device or the distance between the subject and the distance detection device previously detected for the subject. To get the distance of
The second distance between the subject and the distance detection device is detected based on the amount of parallax detected by the parallax detection method according to claim 36 or 38 when the first distance is longer than a predetermined distance. And
Detecting the second distance based on the amount of parallax detected by the parallax detection method according to claim 37 when the first distance is equal to or less than the predetermined distance;
A distance detection method using a distance detection device.
プロセッサによって実行されると、該プロセッサに請求項36乃至40のいずれか一項に記載の方法の各ステップを実行させるプログラム。   41. A program that, when executed by a processor, causes the processor to execute the steps of the method according to any one of claims 36 to 40.
JP2018210864A 2018-03-30 2018-11-08 Parallax detection device, distance detection device, robot device, parallax detection method, distance detection method and program Pending JP2019184568A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US16/364,987 US20190301855A1 (en) 2018-03-30 2019-03-26 Parallax detection device, distance detection device, robot device, parallax detection method, and distance detection method

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2018067499 2018-03-30
JP2018067499 2018-03-30

Publications (2)

Publication Number Publication Date
JP2019184568A true JP2019184568A (en) 2019-10-24
JP2019184568A5 JP2019184568A5 (en) 2022-02-28

Family

ID=68340878

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2018210864A Pending JP2019184568A (en) 2018-03-30 2018-11-08 Parallax detection device, distance detection device, robot device, parallax detection method, distance detection method and program

Country Status (1)

Country Link
JP (1) JP2019184568A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014009997A (en) * 2012-06-28 2014-01-20 Ricoh Co Ltd Range finding device
WO2017209213A1 (en) * 2016-05-31 2017-12-07 Necソリューションイノベータ株式会社 Image processing device, image processing method, and computer-readable recording medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014009997A (en) * 2012-06-28 2014-01-20 Ricoh Co Ltd Range finding device
WO2017209213A1 (en) * 2016-05-31 2017-12-07 Necソリューションイノベータ株式会社 Image processing device, image processing method, and computer-readable recording medium

Similar Documents

Publication Publication Date Title
US8199335B2 (en) Three-dimensional shape measuring apparatus, three-dimensional shape measuring method, three-dimensional shape measuring program, and recording medium
US20120154577A1 (en) Image processing apparatus, method of controlling the same, distance measurement apparatus, and storage medium
EP2745171B1 (en) Projector and control method thereof
US10018722B2 (en) Measurement apparatus
US10782126B2 (en) Three-dimensional scanning method containing multiple lasers with different wavelengths and scanner
KR101207198B1 (en) Board inspection apparatus
TWI489079B (en) Projection apparatus and depth measuring system
US20160267668A1 (en) Measurement apparatus
WO2014174779A1 (en) Motion sensor apparatus having a plurality of light sources
WO2015165209A1 (en) Wearable projection device, and focusing method and projecting method therefor
WO2020066637A1 (en) Depth acquisition device, depth acquisition method, and program
US9659379B2 (en) Information processing system and information processing method
JP2016075658A (en) Information process system and information processing method
US11803982B2 (en) Image processing device and three-dimensional measuring system
US20190301855A1 (en) Parallax detection device, distance detection device, robot device, parallax detection method, and distance detection method
JP2020020640A (en) Three-dimensional shape measuring system, three-dimensional shape measuring method, and three-dimensional shape measuring program
JP2020021126A (en) Image processing device and control method thereof, distance detection device, imaging device, program
JP2019184568A (en) Parallax detection device, distance detection device, robot device, parallax detection method, distance detection method and program
US11037316B2 (en) Parallax calculation apparatus, parallax calculation method, and control program of parallax calculation apparatus
KR101750883B1 (en) Method for 3D Shape Measuring OF Vision Inspection System
US10060733B2 (en) Measuring apparatus
JP6432968B2 (en) Object shape estimation apparatus and program
CN116134289A (en) Three-dimensional measuring device
JP2021004762A (en) Measurement device, imaging device, measurement system, control method, program and recording medium
JP7236854B2 (en) Shape information acquisition device, shape information acquisition method, program, and storage medium

Legal Events

Date Code Title Description
A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20211105

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20211105

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20220128

RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7421

Effective date: 20220630

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20220822

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20220927

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20230316