JP5595211B2 - Three-dimensional shape measuring apparatus, three-dimensional shape measuring method, and computer program - Google Patents

Three-dimensional shape measuring apparatus, three-dimensional shape measuring method, and computer program Download PDF

Info

Publication number
JP5595211B2
JP5595211B2 JP2010230098A JP2010230098A JP5595211B2 JP 5595211 B2 JP5595211 B2 JP 5595211B2 JP 2010230098 A JP2010230098 A JP 2010230098A JP 2010230098 A JP2010230098 A JP 2010230098A JP 5595211 B2 JP5595211 B2 JP 5595211B2
Authority
JP
Japan
Prior art keywords
pattern
dimensional shape
measurement
phase information
unit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2010230098A
Other languages
Japanese (ja)
Other versions
JP2012083233A5 (en
JP2012083233A (en
Inventor
博志 吉川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2010230098A priority Critical patent/JP5595211B2/en
Publication of JP2012083233A publication Critical patent/JP2012083233A/en
Publication of JP2012083233A5 publication Critical patent/JP2012083233A5/ja
Application granted granted Critical
Publication of JP5595211B2 publication Critical patent/JP5595211B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Length Measuring Devices By Optical Means (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Description

本発明は、三次元形状測定装置、三次元形状測定方法及びコンピュータプログラムに関する。   The present invention relates to a three-dimensional shape measuring apparatus, a three-dimensional shape measuring method, and a computer program.

三次元形状計測法としては種々の手法が提案されている。大まかに分類すると、照明装置を用いずに撮像装置だけで形状計測を行うパッシブ型と、照明装置と撮像装置を組み合わせて用いるアクティブ型がある。アクティブ型はパッシブ型に比べ、計測対象に対するロバスト性が高く、高精度な距離計測が可能である。アクティブ型では、計測対象の表面テクスチャ情報が少ない場合でも投影された照明パターンを手がかりにして形状計測を行うため、表面テクスチャ情報に影響されにくい。アクティブ型の代表例として、三角測量に基づく手法、位相情報変化に基づく手法、投影パターンのデフォーカス情報に基づく手法がある。   Various methods have been proposed as a three-dimensional shape measurement method. Roughly classified, there are a passive type in which shape measurement is performed only with an imaging device without using an illumination device, and an active type in which the illumination device and the imaging device are used in combination. The active type is more robust with respect to the measurement target than the passive type, and enables highly accurate distance measurement. In the active type, even when there is little surface texture information to be measured, shape measurement is performed using the projected illumination pattern as a clue, so that it is not easily affected by the surface texture information. Typical examples of the active type include a method based on triangulation, a method based on phase information change, and a method based on projection pattern defocus information.

このうち、パターンの位相情報変化を利用した手法は、縞パターン投影法と呼ばれ、代表的手法の1つにフーリエ変換法(非特許文献1を参照)がある。しかし、この方法は、計測できる位相変化が特定範囲に限定されるため、範囲外の形状変化が起こると位相の折り返しが生じ、位相接続をする必要がある。よって、滑らかな形状をした計測対象であれば、位相の連続性を用いて位相接続は比較的容易に実現できるが、形状変化が急激な計測対象や不連続な計測対象の場合、位相接続が困難になる。   Among these methods, a method using a change in pattern phase information is called a fringe pattern projection method, and one of representative methods is a Fourier transform method (see Non-Patent Document 1). However, in this method, since the phase change that can be measured is limited to a specific range, if a shape change outside the range occurs, the phase is folded back and it is necessary to connect the phases. Therefore, if the measurement target has a smooth shape, phase connection can be achieved relatively easily using phase continuity, but if the measurement target has a sharp shape change or is a discontinuous measurement target, the phase connection It becomes difficult.

また、投影パターンのデフォーカス情報に基づく手法として、撮像光学系によるデフォーカスを利用した形状計測手法(特許文献1を参照)や投影光学系によるデフォーカスを利用した形状計測手法(非特許文献2を参照)がある。後者では、撮像光学系がパンフォーカスである場合、投影光学系の焦点位置からのずれ量に比例してボケ量が大きくなる。このボケを画像上でのパターンの広がりとして評価し形状を計測する。具体的には、矩形状の投影パターンを細かくシフトさせた24種類のパターンを投影し、撮像する。デフォーカス量は、画像の各画素の輝度値をパターンごとに時系列的に並べて輝度値の変動で算出する。この手法では、奥行きの絶対値が算出可能なものの、パターンの投影数を多くする必要があるため、実時間の計測には向かない。   Further, as a method based on the defocus information of the projection pattern, a shape measurement method using defocus by the imaging optical system (see Patent Document 1) or a shape measurement method using defocus by the projection optical system (Non-Patent Document 2). See). In the latter case, when the imaging optical system is pan focus, the amount of blur increases in proportion to the amount of deviation from the focal position of the projection optical system. This blur is evaluated as the spread of the pattern on the image, and the shape is measured. Specifically, 24 types of patterns obtained by finely shifting a rectangular projection pattern are projected and imaged. The defocus amount is calculated by changing the luminance value by arranging the luminance value of each pixel of the image in time series for each pattern. Although this method can calculate the absolute value of the depth, it needs to increase the number of pattern projections, and is not suitable for real-time measurement.

特許第3481631号公報Japanese Patent No. 3481631

M.Takeda and K.Mutoh, "Fourier transform profilometry for automatic measurement of 3-D object shapes," Appl.Opt. Vol. 22, No. 24, P. 3977〜3982(1983).M. Takeda and K. Mutoh, "Fourier transform profilometry for automatic measurement of 3-D object shapes," Appl.Opt. Vol. 22, No. 24, P. 3977 to 3982 (1983). Li Zhang and Shree Nayar, "Projection defocus analysis for scene capture and image display," ACM Trans. on Graphics, Vol. 25, 3, P. 907〜915 (July 2006).Li Zhang and Shree Nayar, "Projection defocus analysis for scene capture and image display," ACM Trans. On Graphics, Vol. 25, 3, P. 907-915 (July 2006).

上述のように、形状変化が急激な計測対象や不連続な計測対象を少ない投影パターン数で詳細な形状まで計測可能な三次元形状計測技術は提案されていない。そこで、本発明は、少ない投影パターン数で、形状変化が急激な計測対象や不連続な計測対象の高精度な形状計測を可能とすることを目的とする。   As described above, a three-dimensional shape measurement technique that can measure a measurement object having a rapid shape change or a discontinuous measurement object to a detailed shape with a small number of projection patterns has not been proposed. Therefore, an object of the present invention is to enable high-precision shape measurement of a measurement object whose shape change is abrupt or a discontinuous measurement object with a small number of projection patterns.

上記課題を解決するための本発明は、周期性を有するパターンを計測空間に投影するパターン投影手段と、
前記パターンが投影された計測空間を撮影する撮像手段とを備え、
前記計測空間は、基準面、前記パターン投影手段の投影範囲及び前記撮影手段の撮影範囲により規定され、前記撮像手段は、前記基準面で合焦するように前記計測空間を撮像し、
前記計測空間に存在する計測対象の三次元形状を計測する三次元形状計測装置であって、
前記撮影手段により得られた撮影画像の前記パターンの明るさ変化から前記パターンの位相情報を算出する位相情報算出手段と、
前記算出された位相情報を補正する位相情報補正手段と、
前記撮影画像における前記パターンのボケ量を算出するボケ量算出手段と、
前記計測対象と前記三次元形状計測装置との相対的な位置関係が変化しない場合に、前記位相情報と前記ボケ量とに基づき、前記計測対象の三次元形状を算出する三次元形状算出手段とを備え、
前記位相情報補正手段は、前記ボケ量を前記計測空間の奥行き情報に変換し、該奥行き情報に対応する位相の次数を算出し、該次数に基づいて位相情報を補正し、
前記三次元形状算出手段は、補正された位相情報に基づいて前記計測対象の三次元形状を算出する。
The present invention for solving the above problems includes a pattern projecting unit that projects a pattern having periodicity onto a measurement space, and
Imaging means for photographing the measurement space on which the pattern is projected,
The measurement space is defined by a reference plane, a projection range of the pattern projection unit, and an imaging range of the imaging unit, and the imaging unit images the measurement space so as to be focused on the reference plane,
A three-dimensional shape measuring apparatus for measuring a three-dimensional shape of a measurement target existing in the measurement space,
Phase information calculating means for calculating phase information of the pattern from a change in brightness of the pattern of the photographed image obtained by the photographing means;
Phase information correction means for correcting the calculated phase information;
A blur amount calculating means for calculating a blur amount of the pattern in the captured image;
3D shape calculation means for calculating the 3D shape of the measurement object based on the phase information and the amount of blur when the relative positional relationship between the measurement object and the 3D shape measurement device does not change; With
The phase information correction unit converts the blur amount into depth information of the measurement space, calculates a phase order corresponding to the depth information, corrects the phase information based on the order,
The three-dimensional shape calculation means calculates the three-dimensional shape of the measurement target based on the corrected phase information.

本発明によれば、少ない投影パターン数で、形状変化が急激な計測対象や不連続な計測対象の高精度な形状計測が可能になる。   According to the present invention, it is possible to perform highly accurate shape measurement of a measurement object whose shape change is abrupt or a discontinuous measurement object with a small number of projection patterns.

実施形態1の三次元形状計測装置100の構成例を示す図。FIG. 3 is a diagram illustrating a configuration example of a three-dimensional shape measurement apparatus 100 according to the first embodiment. 実施形態1のパターン投影部1の投影パターン例を示す図。FIG. 4 is a diagram illustrating an example of a projection pattern of the pattern projection unit 1 according to the first embodiment. パターン投影部1にパターンを表示せずにシーン撮影した例を示す図。The figure which shows the example which image | photographed the scene, without displaying a pattern on the pattern projection part. 図3の状況でパターン投影した場合の撮影画像の一例を示す図。The figure which shows an example of the picked-up image at the time of pattern projection in the condition of FIG. 投影パターンのデフォーカス量を説明するための図。The figure for demonstrating the defocus amount of a projection pattern. キャリブレーションを行う場合の装置の構成例を示す図。The figure which shows the structural example of the apparatus in the case of performing calibration. キャリブレーションボードの一例を示す図。The figure which shows an example of a calibration board. キャリブレーション処理の一例を示すフローチャート。The flowchart which shows an example of a calibration process. パターン投影されたキャリブレーションボードの撮影例を示す図。The figure which shows the example of imaging | photography of the calibration board by which the pattern was projected. コントラスト値と撮影部2からの奥行き値の対応例を示すグラフ。6 is a graph showing a correspondence example between a contrast value and a depth value from the photographing unit 2; 詳細なキャリブレーションを行う場合の構成例を示す図。The figure which shows the structural example in the case of performing detailed calibration. 実施形態1における三次元形状計測処理の一例を示すフローチャート。5 is a flowchart illustrating an example of a three-dimensional shape measurement process according to the first embodiment. フーリエ変換法の原理を説明するための図。The figure for demonstrating the principle of a Fourier-transform method. 折りたたまれた位相φ(x、y)の算出結果例を示す図。The figure which shows the calculation result example of the folded phase (phi) w (x, y). コントラスト値及び標準偏差値の算出結果の一例を示す図。The figure which shows an example of the calculation result of a contrast value and a standard deviation value. 位相情報φ(x、y)算出の過程を説明するための図。The figure for demonstrating the process of phase information (phi) (x, y) calculation. 位相情報の補正方法を説明するための図。The figure for demonstrating the correction method of phase information. 実施形態2の三次元形状計測装置200の構成例を示す図。The figure which shows the structural example of the three-dimensional shape measuring apparatus 200 of Embodiment 2. FIG. 実施形態2のパターン投影部1の投影パターン例を示す図。FIG. 6 is a diagram illustrating an example of a projection pattern of a pattern projection unit 1 according to the second embodiment. 実施形態2における三次元形状計測処理の一例を示すフローチャート。10 is a flowchart illustrating an example of a three-dimensional shape measurement process in the second embodiment. 位相シフト法による位相算出の原理を説明するための図。The figure for demonstrating the principle of the phase calculation by a phase shift method. 実施形態3の投影パターンと、位相φw(x、y)の算出結果を示す図。The figure which shows the projection pattern of Embodiment 3, and the calculation result of phase (phi) w (x, y). 実施形態4の投影パターンと、位相φw(x、y)の算出結果を示す図。The figure which shows the projection pattern of Embodiment 4, and the calculation result of phase (phi) w (x, y). 実施形態5の三次元形状計測装置300の構成例を示す図。FIG. 10 is a diagram illustrating a configuration example of a three-dimensional shape measurement apparatus 300 according to a fifth embodiment. 実施形態5の投影パターン、および、局所配置情報の算出方法を示す図。FIG. 10 is a diagram illustrating a projection pattern and a method for calculating local arrangement information according to the fifth embodiment.

以下、添付図面を参照して、本発明の好適な実施の形態について説明する。なお、各図において、同一の部材については同一の参照番号を付し、重複する説明は省略する。   DESCRIPTION OF EXEMPLARY EMBODIMENTS Hereinafter, preferred embodiments of the invention will be described with reference to the accompanying drawings. In addition, in each figure, the same reference number is attached | subjected about the same member and the overlapping description is abbreviate | omitted.

[実施形態1]
図1に本発明の実施形態1に係る形状計測装置100の概略上面図を示す。撮影部2の光学中心Oが世界座標系(X、Y、Z)の原点になるように配置している。また、Z軸を撮影部2の光軸と一致させ、水平方向右向きにX軸を、鉛直方向下向きにY軸をとる。実施形態1ではパターン投影部1の光軸と撮影部2の光軸が平行になるように配置する。パターン投影部1の光学中心Cは撮影部2の光学中心OからX軸上で距離Dだけ離れた位置に配置される。パターン投影部1の水平半画角をθ、垂直半画角をθとした。また、撮影部2の水平半画角をψ、垂直半画角をψとした。図1において、計測対象は撮影部2の光学中心Oから距離Z1の位置にある円柱41と、撮影部の光学中心Oから距離Z2の距離にある角柱42である。
[Embodiment 1]
FIG. 1 shows a schematic top view of a shape measuring apparatus 100 according to Embodiment 1 of the present invention. It arrange | positions so that the optical center O of the imaging | photography part 2 may become the origin of a world coordinate system (X, Y, Z). Further, the Z axis is made coincident with the optical axis of the photographing unit 2, and the X axis is set to the right in the horizontal direction, and the Y axis is set to the vertical direction. In Embodiment 1, it arrange | positions so that the optical axis of the pattern projection part 1 and the optical axis of the imaging | photography part 2 may become parallel. The optical center C of the pattern projection unit 1 is disposed at a position separated from the optical center O of the photographing unit 2 by a distance D on the X axis. The horizontal half field angle of the pattern projection unit 1 is θ X , and the vertical half field angle is θ Y. In addition, the horizontal half field angle of the photographing unit 2 is ψ X , and the vertical half field angle is ψ Y. In FIG. 1, measurement objects are a cylinder 41 located at a distance Z1 from the optical center O of the photographing unit 2 and a prism 42 located at a distance Z2 from the optical center O of the photographing unit.

パターン投影部1は画像表示素子11、投影光学系12を含む。パターン投影部1には液晶プロジェクターなどの特定の位置に、周期性を有するパターンを結像可能な、結像光学系を有する投影装置を用いる。パターン投影部1の焦点はシーンの基準面3に合わせている。パターン投影部1の光学中心Cから基準面3の距離はLである。基準面3は計測範囲の最も後方に設定することが望ましい。これは、基準面よりも手前と奥の両方に計測対象が存在する場合、投影パターンのボケが合焦位置より手前にあるために生じたのか、奥にあるために生じたのかを見分けることができなくなるためである。奥行き計測可能な計測空間はパターン投影部1の投影範囲、撮影部2の撮影範囲、基準面よりも撮影部側の3つの範囲が重なる太実線で示した範囲40で規定される。ただし、物体によるオクルージョンが発生する部位は範囲内であっても計測可能ではない。   The pattern projection unit 1 includes an image display element 11 and a projection optical system 12. For the pattern projection unit 1, a projection apparatus having an imaging optical system capable of imaging a pattern having periodicity at a specific position such as a liquid crystal projector is used. The focus of the pattern projection unit 1 is adjusted to the reference plane 3 of the scene. The distance from the optical center C of the pattern projection unit 1 to the reference plane 3 is L. It is desirable to set the reference plane 3 at the rearmost of the measurement range. This is because when the measurement target exists both near and behind the reference plane, it can be distinguished whether the projection pattern is blurred because it is in front of the in-focus position or because it is behind. It is because it becomes impossible. A measurement space in which depth measurement is possible is defined by a projection range of the pattern projection unit 1, a shooting range of the shooting unit 2, and a range 40 indicated by a thick solid line in which three ranges closer to the shooting unit than the reference plane overlap. However, it is not possible to measure the part where the occlusion due to the object occurs within the range.

パターン投影部1で投影するパターンの一例を図2に示す。図2(a)に示すように、投影パターンは、照明の強度が正弦波状に最大強度Imaxと最小強度Iminとの間で変動するような周期性を有するパターンである。実施形態1では、パターン投影部1が1種類のパターンを投影する場合を説明する。基準面3上でピッチがpとなるよう調整されている。基準面3からずれた位置での正弦波状のパターンの例は図2(b)に示す通りである。投影光学系の焦点位置である基準面3からの位置ずれの影響により、ボケが発生する。ボケの発生量はデフォーカス量に依存するため、実施形態1では、ボケ量の基準量としてデフォーカス量を用い、ボケ量算出のためにデフォーカス量を算出する。デフォーカスの発生により、最大強度Imaxが低下し、最小強度Iminが増加する。すなわち、以下の式(1)で記述されるコントラストCが低下する。
C=(Imax - Imin)/(Imax+Imin)・・・式(1)
また、デフォーカスの発生量が大きいほど、投影パターンはグレーに近づくため、画像輝度の標準偏差も小さくなる。標準偏差SDは以下の式(2)で記述される。
ここで、Nはある画像領域内における画素の総数、Iaveはある画像領域内での画像輝度の平均値、Iは画像領域内の各画素の輝度である。
An example of a pattern projected by the pattern projection unit 1 is shown in FIG. As shown in FIG. 2A, the projection pattern is a pattern having periodicity such that the intensity of illumination varies sinusoidally between the maximum intensity I max and the minimum intensity I min . In the first embodiment, a case where the pattern projection unit 1 projects one type of pattern will be described. The pitch is adjusted to be p on the reference plane 3. An example of a sinusoidal pattern at a position shifted from the reference plane 3 is as shown in FIG. The blur occurs due to the influence of the positional deviation from the reference plane 3 which is the focal position of the projection optical system. Since the amount of blur generation depends on the defocus amount, in the first embodiment, the defocus amount is used as the reference amount of the blur amount, and the defocus amount is calculated to calculate the blur amount. Due to the occurrence of defocusing, the maximum intensity I max decreases and the minimum intensity I min increases. That is, the contrast C described by the following formula (1) is lowered.
C = (I max -I min ) / (I max + I min ) (1)
In addition, as the amount of defocus generation increases, the projection pattern approaches gray, and thus the standard deviation of image luminance decreases. The standard deviation SD is described by the following formula (2).
Here, N is the total number of pixels in a certain image area, I ave is the average value of image brightness in a certain image area, and I i is the brightness of each pixel in the image area.

図1の説明に戻り、撮影部2は撮像素子21、撮影レンズ22を含む。撮像素子21にはCMOSセンサやCCDなどの光電変換素子を用いることができる。撮影レンズ22の焦点距離をFcとする。歪曲収差などの各種カメラパラメータは予めキャリブレーションしてあるものとする。パターン投影部1の投影光学系によるデフォーカスと撮影部2の撮像光学系によるデフォーカスを分離するため、撮像光学系のデフォーカスを無視できるような条件で撮影する必要がある。具体的には、撮影部2の絞りを十分に絞り、被写界深度を深くしておく必要がある。ただし、絞りを絞りすぎると回折の影響により、像は逆にボケてしまうため注意が必要である。   Returning to the description of FIG. 1, the photographing unit 2 includes an imaging element 21 and a photographing lens 22. A photoelectric conversion element such as a CMOS sensor or a CCD can be used for the imaging element 21. Let Fc be the focal length of the taking lens 22. It is assumed that various camera parameters such as distortion are calibrated in advance. Since defocusing by the projection optical system of the pattern projection unit 1 and defocusing by the imaging optical system of the imaging unit 2 are separated, it is necessary to perform imaging under conditions that allow the defocusing of the imaging optical system to be ignored. Specifically, it is necessary to sufficiently reduce the aperture of the photographing unit 2 and increase the depth of field. However, it should be noted that if the diaphragm is too narrow, the image will be blurred due to the influence of diffraction.

撮影部2の前方被写界深度と後方被写界深度はそれぞれ以下の式(3)と式(4)から計算される。
φr×Fno×Zs 2/(Fc2+φr×Fno×Zs)・・・式(3)
φ×Fno×Zs 2/(Fc2−φr×Fno×Zs)・・・式(4)
ここで、φrは許容錯乱円径、FnoはF値(絞り値)、Zsは被写体距離、Fcは撮像光学系の焦点距離である。前方被写界深度と後方被写界深度の和が撮像光学系の被写界深度である。
The front depth of field and the rear depth of field of the photographing unit 2 are calculated from the following equations (3) and (4), respectively.
φ r × Fno × Z s 2 / (Fc 2 + φ r × Fno × Z s ) (3)
φ r × Fno × Z s 2 / (Fc 2 −φ r × Fno × Z s ) (4)
Here, φ r is the allowable circle of confusion, Fno is the F value (aperture value), Z s is the subject distance, and Fc is the focal length of the imaging optical system. The sum of the front depth of field and the rear depth of field is the depth of field of the imaging optical system.

例えば、1/2インチ、VGA、焦点距離16mmのレンズからなるカメラを用いて、1m離れた30cmの奥行き範囲のシーンを撮影する場合を考える。許容錯乱円径φrが撮像素子のピクセルピッチが0.01mmであるとすると、F値は4よりも大きく設定する必要がある。一方、回折によるボケの限界は以下のエアリーの式(5)で計算される。
1.22×λ×Fno・・・式(5)
ここでλは光の波長である。可視光において最も長波長だと言われる780nmで計算すると、撮像素子のピクセルピッチが0.01mmであればF値はF11よりも小さくすれば回折による影響はなくなる。つまり、上記条件ではF値をF4〜F8の間に設定する必要がある。
For example, let us consider a case where a camera having a lens of 1/2 inch, VGA, and a focal length of 16 mm is used to shoot a scene with a depth range of 30 cm that is 1 m away. If the permissible circle of confusion φ r is 0.01 mm and the pixel pitch of the image sensor is 0.01 mm, the F value needs to be set larger than 4. On the other hand, the blur limit due to diffraction is calculated by the following Airy equation (5).
1.22 × λ × Fno (5)
Here, λ is the wavelength of light. When calculating at 780 nm, which is said to be the longest wavelength in visible light, if the pixel pitch of the image sensor is 0.01 mm, the influence of diffraction is eliminated if the F value is smaller than F11. That is, under the above conditions, it is necessary to set the F value between F4 and F8.

パターン投影部1にパターンを表示せずに、円柱41、角柱42からなるシーンを撮影すると図3の撮影画像60のようになる。画像60は円柱61、角柱62を含む。画像座標のx軸は基準面3に向かって右方向、y軸は同様に下方向にとる。また、画像座標の原点oは左上とする。   If a scene composed of a cylinder 41 and a prism 42 is photographed without displaying a pattern on the pattern projection unit 1, a photographed image 60 shown in FIG. 3 is obtained. The image 60 includes a cylinder 61 and a prism 62. The x-axis of the image coordinates is the right direction toward the reference plane 3, and the y-axis is the downward direction as well. Further, the origin o of the image coordinates is the upper left.

次に、パターン投影部1により、図2のパターンを投影すると図4の画像63に示すようになる。画像63は円柱64、角柱65を含む。ただし、図4ではパターン投影部1の光学系によるデフォーカスは考慮していない。また、正弦波状の強度変動も簡略化して2値で示している。実際には投影光学系のデフォーカスにより、パターンのコントラストは低下する。   Next, when the pattern of FIG. 2 is projected by the pattern projection unit 1, an image 63 shown in FIG. 4 is obtained. The image 63 includes a cylinder 64 and a prism 65. However, in FIG. 4, defocusing by the optical system of the pattern projection unit 1 is not considered. In addition, sinusoidal intensity fluctuations are also shown as binary values in a simplified manner. Actually, the contrast of the pattern decreases due to the defocus of the projection optical system.

ここで、パターン投影部1により投影された投影パターンのデフォーカス量は、焦点位置からの位置ずれ量と、投影光学系の開口径に依存する。これを図5を用いて説明する。図5(a)に開口径がA1、図5(b)に開口径がA2であるときの投影光学系と投影像の模式図を示す。A1とA2の関係はA1>A2である。図5(a)において、画像表示素子11の実像が13である。簡単のために、投影光学系12は一つのレンズで示した。投影光学系12の焦点距離をFp、画像表示素子11と投影光学系12との距離をdとした。以下の式(6)で表される結像公式を変形した式(7)により、レンズから結像面Pfまでの距離diが導かれる。
1/Fp=1/d+1/di・・・式(6)
di=d・Fp/(d−Fp)・・・式(7)
結像面Pfよりもαだけ手前の平面P1では像が広がる。開口径をAとするとこの像の広がりBは幾何光学的に以下の式(8)で記述される。
Here, the defocus amount of the projection pattern projected by the pattern projection unit 1 depends on the positional deviation amount from the focal position and the aperture diameter of the projection optical system. This will be described with reference to FIG. FIG. 5A shows a schematic diagram of the projection optical system and the projection image when the aperture diameter is A1 and FIG. 5B is the aperture diameter A2. The relationship between A1 and A2 is A1> A2. In FIG. 5A, the real image of the image display element 11 is 13. For simplicity, the projection optical system 12 is shown as a single lens. The focal length of the projection optical system 12 is Fp, and the distance between the image display element 11 and the projection optical system 12 is d. The distance di from the lens to the imaging plane Pf is derived from Expression (7) obtained by modifying the imaging formula represented by Expression (6) below.
1 / Fp = 1 / d + 1 / di (6)
di = d · Fp / (d−Fp) (7)
The image spreads on a plane P1 that is a front of the image plane Pf by α. When the aperture diameter is A, the spread B of the image is described geometrically by the following formula (8).

B=α・A/di・・・式(8)
結像位置からの位置ずれ量αが大きいほど、像の広がりB、すなわち、デフォーカス量が増大することがわかる。簡単のために幾何光学的に算出される関係を記述した。しかし、波動光学的に考えると像の広がりは回折の影響を考慮する必要があるが、ここでは省略する。つまり、パターン投影部1による投影パターンのデフォーカス量を評価することで基準面3からの計測対象までの距離を推定できる。一方、式(8)から開口径Aが大きくなる程、デフォーカス量も増加することがわかる。図5(a)に開口径A1のときの像の広がりB1を、図5(b)に開口径A2のときの像の広がりB2を示したが、B1>B2である。
B = α · A / di (8)
It can be seen that the image spread B, that is, the defocus amount increases as the positional shift amount α from the imaging position increases. The relationship calculated geometrically for simplicity is described. However, considering the wave optics, it is necessary to consider the influence of diffraction on the spread of the image, but it is omitted here. That is, the distance from the reference plane 3 to the measurement target can be estimated by evaluating the defocus amount of the projection pattern by the pattern projection unit 1. On the other hand, it can be seen from equation (8) that the defocus amount increases as the aperture diameter A increases. FIG. 5A shows the image spread B1 when the aperture diameter is A1, and FIG. 5B shows the image spread B2 when the aperture diameter is A2. B1> B2.

開口径が大きい程、位置ずれに対するデフォーカス変化が大きくなるため、距離の推定精度が向上する。ただし、デフォーカス量がある一定量を超えると、位置ずれによる変化分を算出することができなくなるため、デフォーカス量を推定可能な距離範囲には制限がある。この距離範囲は開口径が小さい程広い。したがって、計測可能な距離範囲を広くとりたい場合には、開口径をある程度小さくする必要がある。ただし、距離範囲を広くとると位置ずれに対するデフォーカス量変化が小さくなるため感度が下がり、物体の詳細な形状を計測することはできなくなる。   The larger the aperture diameter, the larger the defocus change with respect to the positional deviation, so the distance estimation accuracy is improved. However, if the defocus amount exceeds a certain amount, it becomes impossible to calculate the amount of change due to the positional deviation, and therefore there is a limit to the distance range in which the defocus amount can be estimated. This distance range is wider as the opening diameter is smaller. Therefore, when it is desired to have a wide measurable distance range, it is necessary to reduce the opening diameter to some extent. However, if the distance range is wide, the defocus amount change with respect to the positional deviation is small, so the sensitivity is lowered, and the detailed shape of the object cannot be measured.

実施形態1の形状計測装置100では形状計測を行う前に、デフォーカス量と奥行き位置の関係を取得するためのキャリブレーションが必要になる。まず、図6乃至図10を用いて簡易なキャリブレーションの方法を述べる。図6(a)にキャリブレーションを行うための装置の概略上面図を、図6(b)に概略側面図を示す。パターン投影部1の焦点は図1の構成と同様、基準面3に合わせる。撮影部2から撮影可能範囲の最近点までの距離をZoとする。キャリブレーションボード50はキャリブレーション用に使用するボードであって、図7に示すように平面板でできており、一定間隔でドットが描かれている。また、キャリブレーションボード50は図6(b)に示すように傾いて配置されており、各ドットの世界座標値(X、Y、Z)は既知であるものとする。これは公知のカメラキャリブレーション手法を用いることで実現される。   The shape measuring apparatus 100 according to the first embodiment requires calibration for acquiring the relationship between the defocus amount and the depth position before performing shape measurement. First, a simple calibration method will be described with reference to FIGS. FIG. 6A shows a schematic top view of an apparatus for performing calibration, and FIG. 6B shows a schematic side view. The focus of the pattern projection unit 1 is adjusted to the reference plane 3 as in the configuration of FIG. Let Zo be the distance from the imaging unit 2 to the closest point of the shootable range. The calibration board 50 is a board used for calibration, and is made of a flat plate as shown in FIG. 7, and dots are drawn at regular intervals. Further, it is assumed that the calibration board 50 is inclined as shown in FIG. 6B, and the world coordinate values (X, Y, Z) of each dot are known. This is realized by using a known camera calibration method.

図8を参照して、形状計測装置100におけるキャリブレーション処理を説明する。まず、S01では、パターン投影部1がパターン投影を行う。具体的に、図2に示すような正弦波的に強度が変化するパターンをキャリブレーションボード50に投影する。次にS02では、撮影部2がパターンが投影されたキャリブレーションボード50を撮影する。このとき、例えば図9に示すような撮影画像51が得られる。画像51は、キャリブレーションボード50を含む。図9では簡単のために、パターンの本数を少なく描いたが、撮影部2に近い画像の下部ほど、投影パターンのデフォーカスが大きくなる。次にS03では、デフォーカス量算出部8が投影パターンのデフォーカス量を算出する。デフォーカス量の算出にはコントラスト値、または、標準偏差値を使用する。   With reference to FIG. 8, the calibration process in the shape measuring apparatus 100 will be described. First, in S01, the pattern projection unit 1 performs pattern projection. Specifically, a pattern whose intensity changes sinusoidally as shown in FIG. 2 is projected onto the calibration board 50. Next, in S02, the photographing unit 2 photographs the calibration board 50 on which the pattern is projected. At this time, for example, a captured image 51 as shown in FIG. 9 is obtained. The image 51 includes a calibration board 50. In FIG. 9, for the sake of simplicity, the number of patterns is reduced, but the defocus of the projection pattern increases toward the lower part of the image close to the photographing unit 2. Next, in S03, the defocus amount calculation unit 8 calculates the defocus amount of the projection pattern. The contrast value or the standard deviation value is used to calculate the defocus amount.

まず、コントラスト値の計算方法について説明する。キャリブレーションボード50を図6(b)に示すように配置しているため、画像の同一y座標での奥行き値は等しいと考えられる。そこで画像51中の領域53Aのような複数周期のパターンを含む領域を考える。その領域の中で画像輝度から上記式(1)によりコントラストCを計算する。式(1)でImaxは画像領域内での最大輝度、Iminは画像領域内での最低輝度である。例えば画像領域53Bのように領域をy方向にシフトさせながら全てのy座標に対して計算を行う。ただし、画像領域中にキャリブレーションボードのドットを含む場合にはノイズの原因となるため、その領域が除外した方が良い。 First, the contrast value calculation method will be described. Since the calibration board 50 is arranged as shown in FIG. 6B, the depth values at the same y coordinate of the image are considered to be equal. Therefore, a region including a pattern having a plurality of cycles such as a region 53A in the image 51 is considered. In the region, the contrast C is calculated from the image luminance according to the above equation (1). In Expression (1), I max is the maximum luminance in the image area, and I min is the minimum luminance in the image area. For example, calculation is performed for all y coordinates while shifting the region in the y direction as in the image region 53B. However, if a calibration board dot is included in the image area, it causes noise, so it is better to exclude that area.

次に標準偏差値の計算方法について説明する。コントラスト値と同様、領域53Aのような複数周期のパターンを含む領域を考える。標準偏差値の場合は、その領域の中で上記式(2)により、SD値を計算する。この領域をy方向にシフトさせながら全てのy座標に対して計算を行う。   Next, a method for calculating the standard deviation value will be described. Similar to the contrast value, a region including a pattern having a plurality of cycles such as the region 53A is considered. In the case of the standard deviation value, the SD value is calculated by the above formula (2) in the area. Calculations are performed for all y coordinates while shifting this region in the y direction.

図8の説明に戻り、S04では奥行き補間処理を行う。具体的には、キャリブレーションボード50が平面であると仮定し、ドット間の奥行き値を補間処理により算出する。キャリブレーションボード50が略平面であれば、線形補間で算出可能である。多少の歪みがある場合には、非線形な補間の方が好適な場合もある。次に、S05では、奥行き値とデフォーカス量のテーブル作成を行う。具体的に、S03で算出したデフォーカス量と、補間処理により求めたキャリブレーションボード50の奥行き値の対応関係を求める。例えば、基準面3に近い奥行きでは撮影画像のコントラスト値Cは高く、撮影部2に近づくにつれて、撮影画像のコントラスト値は低下するため、図10に示す曲線が描かれる。図10では、デフォーカス量としてコントラスト値を用いた場合を示している。曲線は最小二乗法などを用いて関数近似しても良い。   Returning to the description of FIG. 8, in S04, depth interpolation processing is performed. Specifically, assuming that the calibration board 50 is a plane, the depth value between dots is calculated by interpolation processing. If the calibration board 50 is substantially flat, it can be calculated by linear interpolation. If there is some distortion, non-linear interpolation may be preferable. Next, in S05, a table of depth values and defocus amounts is created. Specifically, the correspondence between the defocus amount calculated in S03 and the depth value of the calibration board 50 obtained by the interpolation process is obtained. For example, the contrast value C of the photographed image is high at a depth close to the reference plane 3, and the contrast value of the photographed image decreases as the distance to the photographing unit 2 is approached, so that a curve shown in FIG. 10 is drawn. FIG. 10 shows a case where a contrast value is used as the defocus amount. The curve may be approximated by a function using a least square method or the like.

この手法では画像の画面全体でデフォーカスが変動しないという仮定を置いている。この過程が成立するのは、プロジェクターの収差による影響が小さく、投影パターンの位置に応じたデフォーカス量の変動が無視できる場合である。像面湾曲の影響が大きい場合には、投影画像の中心部と周辺部でデフォーカス量が変わるため、厳密なキャリブレーションが必要になることもある。厳密にキャリブレーションするためには、画像のピクセルごとに個別にデフォーカス量と奥行き値の関係を求める必要がある。   This method assumes that the defocus does not vary over the entire image screen. This process is established when the influence of the aberration of the projector is small and the fluctuation of the defocus amount according to the position of the projection pattern can be ignored. When the influence of the curvature of field is large, the defocus amount varies between the central portion and the peripheral portion of the projection image, and thus strict calibration may be required. In order to perform calibration precisely, it is necessary to obtain the relationship between the defocus amount and the depth value for each pixel of the image.

図11を用いてこれを説明する。この手法ではキャリブレーションボード50をY軸方向に動かすため、図11に示すようにキャリブレーションボード移動部54が必要になる。キャリブレーションボード50を動作させる幅がYs、シフトさせる回数をN回とすると、シフトピッチSpは以下の式(9)で記述される。
Sp=Ys/N・・・式(9)
キャリブレーションボード50のシフトピッチSpが小さいほど、キャリブレーションの精度は向上する。この場合の厳密なキャリブレーションの処理では、図8に示したフローに対応する処理の前後に追加の処理を行う。まず、S01のパターン撮影の前にキャリブレーションボード50を初期位置に移動する。その後、図8のS01からS05を実行する。厳密なキャリブレーションの場合、撮影回数をカウントしておき、S05の処理が完了するたびに撮影回数がキャリブレーションを終了すべき所定回数N回に達したかどうかを判定する。もし、撮影回数が所定回数N回に満たなければ、キャリブレーションボード50をシフトピッチSpだけ移動させた後、S01乃至S06を繰り返す。撮影回数が所定回数N回となった場合は、キャリブレーションを終了する。このような処理に寄れば、画像の全画素に対してデフォーカス量と奥行き位置の対応関係が求まるため、キャリブレーションの精度が向上する。
This will be described with reference to FIG. In this method, since the calibration board 50 is moved in the Y-axis direction, a calibration board moving unit 54 is required as shown in FIG. Assuming that the width for operating the calibration board 50 is Ys and the number of shifts is N, the shift pitch Sp is described by the following equation (9).
Sp = Ys / N (9)
The smaller the shift pitch Sp of the calibration board 50 is, the more accurate the calibration is. In the strict calibration process in this case, an additional process is performed before and after the process corresponding to the flow shown in FIG. First, the calibration board 50 is moved to the initial position before the pattern photographing in S01. Thereafter, S01 to S05 in FIG. 8 are executed. In the case of strict calibration, the number of times of photographing is counted, and each time the processing of S05 is completed, it is determined whether or not the number of times of photographing has reached a predetermined number N of times that calibration should be finished. If the number of photographing is less than the predetermined number N, the calibration board 50 is moved by the shift pitch Sp, and then S01 to S06 are repeated. When the number of times of photographing reaches the predetermined number N, the calibration is finished. If such processing is performed, since the correspondence between the defocus amount and the depth position is obtained for all the pixels of the image, the accuracy of calibration is improved.

次に、実施形態1の形状計測装置100による形状計測の手順を説明する。形状計測は図12に示すフローチャートに沿って行われる。該フローチャートに対応する処理は、パターン投影部1、撮影部2、位相情報算出部7、デフォーカス量算出部8及び三次元形状算出部9が、対応する処理プログラムを実行することにより実現される。   Next, a procedure for shape measurement by the shape measurement apparatus 100 according to the first embodiment will be described. The shape measurement is performed according to the flowchart shown in FIG. The processing corresponding to the flowchart is realized by the pattern projection unit 1, the imaging unit 2, the phase information calculation unit 7, the defocus amount calculation unit 8, and the three-dimensional shape calculation unit 9 executing corresponding processing programs. .

まず、S10では、パターン投影(S11)と画像撮影(S12)からなる画像撮影工程が実施される。S10のパターン投影ではパターン投影部1により撮影対象シーンにパターンを投影する。S12では撮影部2により撮影対象シーンを画像撮影する。続いて、S20では、フーリエ変換(S21)、基本周波数成分抽出(S22)、原点へのシフト(S23)、逆フーリエ変換(S24)、位相情報抽出(S25)からなる位相情報算出工程が位相情報算出部7により実施される。   First, in S10, an image photographing process including pattern projection (S11) and image photographing (S12) is performed. In the pattern projection of S10, the pattern projection unit 1 projects a pattern onto the scene to be photographed. In S <b> 12, the photographing unit 2 captures an image of the scene to be photographed. Subsequently, in S20, a phase information calculation step including Fourier transform (S21), fundamental frequency component extraction (S22), shift to the origin (S23), inverse Fourier transform (S24), and phase information extraction (S25) is performed. This is performed by the calculation unit 7.

実施形態1の位相情報の算出はフーリエ変換法に基づいている。そのため、非特許文献1で開示されるフーリエ変換法の原理について図13を参照して説明する。図13では、パターン投影部1と撮影部2が平行な場合の光学的な配置を示す。パターン投影部1の光軸CからLだけ離れた位置に基準面3がある。また、パターン投影部1の光軸CからZだけ離れた位置に物体面Mがあるとする。基準面3から物体面Mまでの距離をHとする。投影部により、基準面上にはピッチpで周期的に変動する正弦波状のパターンが投影される。撮像面上での観察される像gB(x,y)はフーリエ級数で式(10)のように表現される。
ここでf0は観察される縞パターンの基本周波数であり、以下の式(11)で記述される。
=1/p・・・式(11)
pは基準面上でのパターンのピッチ、Aは強度の最大振幅である。シーンに計測対象がある場合、基準面から計測対象までの距離に応じて観測される縞の位相は変化する。例えば、基準面上ではBの位置に投影され、像面に結像される点があるとする。ここで、物体が基準面から距離Hだけ離れているとすると、点Mに投影されるため、像面上では距離Sだけずれた状態で観測される。この距離はxとyに依存して変化するため、式(10)は以下の式(12)のように修正される。
ここで、φ(x,y) = 2πf0S(x,y) である。また、物体表面の反射率r(x、y)の変動も考慮する必要がある。したがって、式(12)は以下の式(13)のように変形される。
式(13)で与えられる歪んだパターン像は、次のように解釈することができる。位相φ(x、y)と振幅r(x、y)と空間搬送周波数nfoを有する多次元信号である。位相が三次元形状の情報を有しているため、不均一な反射振幅r(x、y)を分離して、φ(x、y)をいかにして求めるかという問題になる。
式(13)を以下の式(14)のように書き直す。
ここで、qn(x,y) = Anr(x,y)・exp(inφ(x,y))である。FFTアルゴリズムにより、yを固定にして、式(14)の1次元のフーリエ変換を計算すると以下の式(15)になる。
ここで、G(f、y)とQn(f、y)は、g(x、y)とqn(x、y)のyを固定して変数xに関するそれぞれフーリエスペクトルである。ほとんどの場合、すべてのスペクトルQn(f−nf、y)は基本周波数fによって互いに分離される。
そこで、n=1のときのスペクトル成分Q(f−nfy)を選び、逆フーリエ変換を行い、以下の式(16)で記述される複素信号を得る。
また、基準面上での複素信号は式(10)より、以下で与えられる。
式(16)、式(17)から以下の式(18)が与えられる。
ここで、*は複素共役を表す。式(18)の|A|r(x、y)は実関数であるため、複素ロガリズムを計算すると、以下の式(19)になる。
このような演算により、不要な成分である物体表面の反射率r(x、y)と抽出すべき位相情報φ(x、y)を分離することができる。
The calculation of the phase information in the first embodiment is based on the Fourier transform method. Therefore, the principle of the Fourier transform method disclosed in Non-Patent Document 1 will be described with reference to FIG. FIG. 13 shows an optical arrangement when the pattern projection unit 1 and the imaging unit 2 are parallel. The reference plane 3 is located at a position L away from the optical axis C of the pattern projection unit 1. Further, it is assumed that there is a object plane M in a position apart Z s from the optical axis C of the pattern projection unit 1. Let H be the distance from the reference plane 3 to the object plane M. The projection unit projects a sinusoidal pattern that periodically fluctuates at a pitch p onto the reference surface. An image g B (x, y) observed on the imaging surface is expressed by the Fourier series as shown in Expression (10).
Here, f 0 is the fundamental frequency of the observed fringe pattern and is described by the following equation (11).
f 0 = 1 / p (11)
p is the pitch of the pattern on the reference plane, A n is the maximum amplitude of the intensity. When the scene has a measurement target, the phase of the observed fringe changes according to the distance from the reference plane to the measurement target. For example, it is assumed that there is a point projected onto the position B on the reference plane and imaged on the image plane. Here, if the object is separated from the reference plane by a distance H, the object is projected onto the point M, and therefore, the object is observed in a state shifted by the distance S M on the image plane. Since this distance changes depending on x and y, equation (10) is modified as equation (12) below.
Here, φ (x, y) = 2πf 0 S (x, y). In addition, it is necessary to consider the fluctuation of the reflectance r (x, y) of the object surface. Therefore, the equation (12) is transformed into the following equation (13).
The distorted pattern image given by equation (13) can be interpreted as follows. It is a multidimensional signal having a phase φ (x, y), an amplitude r (x, y), and a spatial carrier frequency nfo. Since the phase has information of a three-dimensional shape, it becomes a problem of how to obtain φ (x, y) by separating the non-uniform reflection amplitude r (x, y).
Equation (13) is rewritten as the following equation (14).
Here, q n (x, y) = A n r (x, y) · exp (inφ (x, y)). When y is fixed by the FFT algorithm and the one-dimensional Fourier transform of Expression (14) is calculated, the following Expression (15) is obtained.
Here, G (f, y) and Q n (f, y) are Fourier spectra related to the variable x with y of g (x, y) and q n (x, y) fixed. In most cases, all the spectra Q n (f−nf 0 , y) are separated from each other by the fundamental frequency f 0 .
Therefore, the spectral component Q 1 (f−nf 0 y) when n = 1 is selected, and inverse Fourier transform is performed to obtain a complex signal described by the following equation (16).
Further, the complex signal on the reference plane is given by the following equation (10).
From the equations (16) and (17), the following equation (18) is given.
Here, * represents a complex conjugate. Since | A 1 | 2 r (x, y) in equation (18) is a real function, the following equation (19) is obtained when the complex logarithm is calculated.
By such calculation, it is possible to separate the reflectance r (x, y) of the object surface, which is an unnecessary component, and the phase information φ (x, y) to be extracted.

次に抽出した位相情報から高さに変換する方法について述べる。図13の△BCOと△BMB’の相似の関係から、以下の式(20)の関係が成り立つ。
M=D・H/(H+Zs)・・・式(20)
また、式(12)のφ(x、y)=2πf0S(x、y)に式(20)を代入すると、以下の式(21)が成り立つ。
H=Zφ(x、y)/{2πfD−φ(x、y)}・・・式(21)
ただし、観測できる位相情報は−π〜+πに折りたたまれているφw(x、y)である。位相の連続性を利用するなどして、位相接続を実施する必要がある。これは以下の式(21)の次数mを決定することに対応する。
φ(x、y) = 2π・m + φw(x、y)・・・式(21)
通常の位相接続では形状の連続性を仮定して行う。しかし、図1に示すように複数物体が存在するシーンでは、物体の形状が不連続であるため、その仮定が成り立たず、正しく位相接続を行うことができない。以上が、フーリエ変換法による位相情報の算出と奥行き計測の原理である。
Next, a method for converting the extracted phase information into height will be described. From the similar relationship between ΔBCO and ΔBMB ′ in FIG. 13, the following equation (20) is established.
S M = D · H / (H + Z s ) (20)
Further, when Expression (20) is substituted into φ (x, y) = 2πf 0 S (x, y) in Expression (12), the following Expression (21) is established.
H = Z s φ (x, y) / {2πf 0 D−φ (x, y)} Expression (21)
However, the phase information that can be observed is φ w (x, y) folded between −π and + π. It is necessary to implement phase connection, such as by using phase continuity. This corresponds to determining the order m of the following equation (21).
φ (x, y) = 2π · m + φ w (x, y) (21)
In normal phase connection, the continuity of the shape is assumed. However, in a scene where there are a plurality of objects as shown in FIG. 1, since the shape of the objects is discontinuous, the assumption does not hold and phase connection cannot be performed correctly. The above is the principle of phase information calculation and depth measurement by the Fourier transform method.

上記、フーリエ変換法の原理に基づく位相情報算出工程(S20)の処理を説明する。S21のフーリエ変換では、撮影した画像を走査線毎にフーリエ変換する。S22の基本周波数成分抽出では、フーリエ変換後のデータのうち周波数領域で基本周波数f0付近のデータのみをフィルタリングにより抽出する。基本周波数f0は投影した縦縞のパターンの基準面上でのピッチpから式(11)で求める。S23の原点へのシフトでは、抽出したf付近のデータを原点へシフトさせる。原点シフトさせたf付近のデータをS24で逆フーリエ変換し、S25の位相情報抽出で位相情報を抽出する。 The process of the phase information calculation step (S20) based on the principle of the Fourier transform method will be described. In the Fourier transform of S21, the captured image is Fourier transformed for each scanning line. The fundamental frequency component extraction of S22, extracts the filters only data near the fundamental frequency f 0 in the frequency domain of the data after the Fourier transform. The fundamental frequency f 0 is obtained from the pitch p on the reference plane of the projected vertical stripe pattern by Expression (11). The shift to S23 in the origin, the data near f 0 the extracted shifted to the origin. Data in the vicinity of f 0 shifted by the origin is subjected to inverse Fourier transform in S24, and phase information is extracted in the phase information extraction in S25.

図5のパターン投影された撮影画像63をもとにして、折りたたまれた位相情報φw(x、yi)を算出した結果の例を図14に示す。画像の走査線yi上のデータからの位相情報を下のグラフに示した。円柱64と角柱65の位相情報からは詳細な形状変化が得られているが、物体の位置が不連続であるため、位相を接続することができないことがわかる。 FIG. 14 shows an example of a result of calculating the folded phase information φ w (x, yi) based on the captured image 63 on which the pattern is projected in FIG. The phase information from the data on the scan line yi of the image is shown in the lower graph. Although the detailed shape change is obtained from the phase information of the cylinder 64 and the prism 65, it can be seen that the phase cannot be connected because the position of the object is discontinuous.

次に、S30では、デフォーカス量算出(S31)、デフォーカス量信頼度算出(S32)からなるデフォーカス量算出工程を実行する。S31のデフォーカス量算出では、デフォーカス量の算出には、注目画素の近傍領域内のコントラスト値、または、標準偏差値を用いる。   Next, in S30, a defocus amount calculation step including defocus amount calculation (S31) and defocus amount reliability calculation (S32) is executed. In the defocus amount calculation of S31, the contrast value or the standard deviation value in the region near the target pixel is used for the calculation of the defocus amount.

図15(a)にコントラスト値の場合の算出方法と結果を示す。注目画素近傍の所定範囲内の領域66がコントラスト値の計算領域の例である。このデフォーカス量計算領域内で式(1)のコントラスト値を計算する。計算領域をラスタ走査していき画像の全領域内でコントラスト値を算出する。ただし、コントラストの計算領域は基準面における投影パターンピッチpよりも広い範囲で行う必要がある。上記条件を満たさないと領域内に輝度の最大値、輝度の最小値を含まない可能性があるため正しくコントラストを評価できないためである。図15(a)では、画像のy座標がyiの位置でのコントラストの計算結果を下のグラフに記述した。合焦領域である基準面上ではパターンが結像関係にあるため、コントラストは高くなる。手前にある角柱64とさらに手前にある円柱64ではデフォーカスが発生するため、コントラストが低下する。手前にある円柱64の方がパターンのデフォーカスが大きいため、コントラスト値はより低くなる。   FIG. 15A shows a calculation method and result in the case of a contrast value. A region 66 within a predetermined range near the target pixel is an example of a contrast value calculation region. The contrast value of equation (1) is calculated within this defocus amount calculation area. The calculation area is raster scanned, and the contrast value is calculated in the entire area of the image. However, the contrast calculation area needs to be performed in a range wider than the projection pattern pitch p on the reference plane. This is because if the above condition is not satisfied, the maximum brightness value and the minimum brightness value may not be included in the region, so that the contrast cannot be evaluated correctly. In FIG. 15A, the calculation result of the contrast at the position where the y coordinate of the image is yi is described in the lower graph. Since the pattern is in an imaging relationship on the reference plane that is the focus area, the contrast is high. Since defocusing occurs between the prism 64 at the front and the cylinder 64 at the front, the contrast is lowered. Since the defocusing of the pattern is larger in the cylinder 64 in front, the contrast value is lower.

一方、図15(b)に標準偏差値の場合の算出方法と結果を示す。図中の注目画素近傍の所定範囲内の領域67が標準偏差値の計算領域である。この標準偏差値計算領域内で式(2)の標準偏差値を計算する。計算領域をラスタ走査していき画像の全領域内で標準偏差値を算出する。ただし、標準偏差値の計算領域は基準面における投影パターンピッチpよりも広い範囲で行う必要がある。上記条件を満たさないと領域内の輝度のばらつきを正しく評価できない可能性があるためである。標準偏差値の計算結果を下のグラフに記述した。合焦領域である基準面上ではパターンが結像関係にあるため、画像輝度のばらつきは大きくなり、標準偏差値は高くなる。手前にある角柱65とさらに手前にある円柱64ではデフォーカスが発生するため、画像輝度のばらつきは小さくなり、標準偏差値は低下する。手前にある円柱64の方がデフォーカス量が大きいため、標準偏差値はより低くなる。   On the other hand, FIG. 15B shows a calculation method and result in the case of the standard deviation value. A region 67 within a predetermined range near the target pixel in the figure is a standard deviation value calculation region. The standard deviation value of Expression (2) is calculated within this standard deviation value calculation area. The calculation area is raster scanned, and the standard deviation value is calculated in the entire area of the image. However, the standard deviation value calculation region needs to be performed in a range wider than the projection pattern pitch p on the reference plane. This is because if the above condition is not satisfied, there is a possibility that the variation in luminance within the region cannot be correctly evaluated. The calculation result of the standard deviation value is described in the graph below. Since the pattern is in an imaging relationship on the reference plane that is the in-focus area, the variation in image luminance increases and the standard deviation value increases. Since defocusing occurs in the prism 65 at the front and the cylinder 64 at the front, the variation in image luminance is reduced and the standard deviation value is reduced. Since the cylinder 64 at the front has a larger defocus amount, the standard deviation value is lower.

コントラスト値と標準偏差値いずれを用いる場合でも物体と物体の境界、あるいは、表面の方向が急激に変わる部分ではコントラスト値と標準偏差値が本来の奥行きに対応する値よりも高くなる。この原因は3つ考えられる。1つ目は物体の表面方向の違いに起因する反射率の違い、2つ目は投影部から物体までの距離の違い、3つ目は物体から撮影部2までの距離の違いである。   Regardless of whether the contrast value or the standard deviation value is used, the contrast value and the standard deviation value are higher than the value corresponding to the original depth at the boundary between the objects or at the portion where the direction of the surface changes abruptly. There are three possible causes for this. The first is a difference in reflectance caused by a difference in the surface direction of the object, the second is a difference in distance from the projection unit to the object, and a third is a difference in distance from the object to the imaging unit 2.

まず、第一の理由である物体の表面方向の違いに起因する反射率の違いについて述べる。投影部からの光の物体への入射方向と撮影部2の方向が正反射角に近いほど表面は明るくなる。逆に、正反射方向から遠いほど表面は暗くなる。物体表面が完全拡散であればこのようなことは起きないが、それ以外の表面ではこの現象が発生する。次に投影部から物体までの距離の違いについて述べる。投影部からの光の強度は距離に比例して減衰する。このため、投影部から物体までの距離が小さいほど、入射光強度が高いため、物体表面は明るくなる。逆に、投影部から物体までの距離が大きいほど、入射光強度が低いため、物体表面は暗くなる。   First, the difference in reflectance caused by the difference in the surface direction of the object, which is the first reason, will be described. The surface becomes brighter as the incident direction of light from the projection unit to the object and the direction of the photographing unit 2 are closer to the regular reflection angle. Conversely, the farther from the specular direction, the darker the surface. This does not occur if the object surface is fully diffused, but this phenomenon occurs on other surfaces. Next, the difference in distance from the projection unit to the object will be described. The intensity of light from the projection unit attenuates in proportion to the distance. For this reason, the smaller the distance from the projection unit to the object, the higher the incident light intensity, and the brighter the object surface. Conversely, the greater the distance from the projection unit to the object, the lower the incident light intensity, and the darker the object surface.

次に物体から撮影部2までの距離の違いについて述べる。物体からの反射光強度も距離に比例して減衰する。物体から撮影部2までの距離が小さいほど、物体表面は明るくなる。一方、物体から撮影部2までの距離が大きいほど、物体表面は暗くなる。
実際のシーンではこれら3つの現象が複合して発生する。このような部分はデフォーカス量の算出結果の信頼性が低いと考えられる。そこで、S32のデフォーカス量信頼度算出において信頼度の評価を行う。
Next, the difference in distance from the object to the photographing unit 2 will be described. The reflected light intensity from the object is also attenuated in proportion to the distance. The smaller the distance from the object to the photographing unit 2, the brighter the object surface. On the other hand, the larger the distance from the object to the photographing unit 2, the darker the object surface.
In an actual scene, these three phenomena occur in combination. Such a portion is considered to have low reliability of the defocus amount calculation result. Therefore, the reliability is evaluated in the defocus amount reliability calculation in S32.

デフォーカス量信頼度P(x、y)の算出は以下の式(22)を用いる。
P(x、y)=Df(x、y)−Df(x−1、y)・・・式(22)
Df(x、y)はx=x、y=yにおけるデフォーカス値が格納されている。上記式(22)はデフォーカス値の差分(微分)をとることに対応する。すなわち、デフォーカス値の変化量が大きいところはP(x、y)の絶対値が大きくなる。P(x、y)の絶対値が所定の閾値以下ならば信頼性が高いとし、デフォーカス量をそのまま用いる。一方、閾値よりも大きければ信頼性が低いとし、補正処理を行う。以下では、この閾値をPtで表し、信頼性を評価する基準となる。補正処理はS40の位相接続工程の位相情報補正(S43)で行う。詳細は後で記述する。
The defocus amount reliability P (x, y) is calculated using the following equation (22).
P (x, y) = Df (x, y) −Df (x−1, y) Expression (22)
Df (x, y) stores a defocus value at x = x and y = y. The above equation (22) corresponds to taking the difference (differentiation) of the defocus value. That is, the absolute value of P (x, y) increases when the defocus value change amount is large. If the absolute value of P (x, y) is equal to or less than a predetermined threshold, the reliability is high and the defocus amount is used as it is. On the other hand, if it is larger than the threshold value, the reliability is assumed to be low, and correction processing is performed. In the following, this threshold value is represented by Pt, which is a reference for evaluating reliability. The correction process is performed in the phase information correction (S43) in the phase connection process of S40. Details will be described later.

図16(b)、(c)に画像63におけるデフォーカス値Dfの算出結果とデフォーカス信頼度P(x、y)の算出結果をグラフ化したものを示す。デフォーカス値の変化が大きい領域では、デフォーカス信頼度の絶対値が大きくなり、デフォーカス値の信頼性は下がる。   FIGS. 16B and 16C are graphs showing the calculation result of the defocus value Df and the calculation result of the defocus reliability P (x, y) in the image 63. In the region where the change in the defocus value is large, the absolute value of the defocus reliability increases, and the reliability of the defocus value decreases.

S40では、位相の次数算出(S41)、位相接続(S42)、位相情報補正(S43)からなる位相接続工程を三次元形状算出部9が実行する。S41の位相の次数算出では、まず事前に実施したキャリブレーションの結果からデフォーカス量Df(x、y)を奥行き値Z(x、y)に変換する。奥行き値Z(x、y)から式(21)を変形した以下の式(23)を用いて位相φ(x、y)を求める(Z=L−Hの関係を用いた)。
φ(x、y)=2πfD(1−Z(x、y)/L)・・・式(23)
求めたφ(x、y)から以下の式(24)を用いて次数mを算出する。
m=Int[φ(x、y)/2π]・・・式(24)
ここで、Int[]は少数点以下を切り捨てることを意味する。図16(d)に算出した次数mをグラフ化したものを示す。デフォーカス値の信頼性が基準よりも低い領域は、位相の次数は算出しない。グラフでは斜線で示す領域である。S42の位相接続では算出した位相の次数mと、S25における位相情報抽出の結果φw(x、y)に基づき、位相を接続する。具体的には以下の式(25)を用いる。
φ(x、y) = 2π・m + φ(x、y)・・・式(25)
式(25)は式(21)と同じ形だが、デフォーカス値の信頼性が基準よりも低い領域を含むため、本来のφ(x、y)とは異なる。区別するために、デフォーカス値の信頼性が基準よりも低い領域を含む場合の位相をφ(x、y)と表記した。
In S40, the three-dimensional shape calculation unit 9 executes a phase connection process including phase order calculation (S41), phase connection (S42), and phase information correction (S43). In the phase order calculation in S41, first, the defocus amount Df (x, y) is converted into the depth value Z (x, y) from the result of the calibration performed in advance. The phase φ (x, y) is obtained using the following equation (23) obtained by modifying the equation (21) from the depth value Z (x, y) (using the relationship of Z = L−H).
φ (x, y) = 2πf 0 D (1−Z (x, y) / L) (23)
The order m is calculated from the obtained φ (x, y) using the following equation (24).
m = Int [φ (x, y) / 2π] (24)
Here, Int [] means to cut off the decimal point. FIG. 16D shows a graph of the calculated order m. In the region where the reliability of the defocus value is lower than the reference, the phase order is not calculated. In the graph, the region is indicated by hatching. In the phase connection in S42, the phases are connected based on the calculated phase order m and the phase information extraction result φ w (x, y) in S25. Specifically, the following formula (25) is used.
φ m (x, y) = 2π · m + φ w (x, y) Expression (25)
Expression (25) is the same form as Expression (21), but includes a region where the reliability of the defocus value is lower than the reference, and thus is different from the original φ (x, y). In order to distinguish, the phase when the reliability of the defocus value is lower than the reference is described as φ m (x, y).

図16(e)にφ(x、y)の算出結果をグラフ化したものを示す。デフォーカス値の信頼性が基準よりも低い領域を斜線で示した。S43の位相情報補正ではφ(x、y)のデフォーカス値の信頼性が基準よりも低い領域の欠落した情報を補正して本来のφ(x、y)を求める。欠落情報の補正は接続前の位相φの連続性を用いる。なお、図16(f)は、図16(e)に次数mを反映させて示したグラフである。 FIG. 16E shows a graph of the calculation result of φ m (x, y). The region where the reliability of the defocus value is lower than the standard is indicated by hatching. In the phase information correction in S43, the missing information in the region where the reliability of the defocus value of φ m (x, y) is lower than the reference is corrected to obtain the original φ (x, y). Missing correction information using the continuity of the phase phi w before connection. Note that FIG. 16F is a graph reflecting the order m in FIG.

次に、補正方法を、図17を用いて具体的に説明する。図17(a)は、図16(e)に対応する接続前の位相を示すグラフである。図17(b)には、位相φ(x、yi)と、位相φ(x、yi)の微分値(差分値)であるdφw(x、yi)/dxのグラフを示す。位相の微分値の絶対値が大きい位置、x=xV1、xV2、xV3では位相の不連続が発生する。また、位相の微分値の正負が逆転する位置x=xI1では面の傾きが変化する。これらの点を位相変化の特異点と呼ぶことにする。 Next, the correction method will be specifically described with reference to FIG. FIG. 17A is a graph showing the phase before connection corresponding to FIG. FIG. 17B shows a graph of the phase φ w (x, yi) and dφ w (x, yi) / dx, which is the differential value (difference value) of the phase φ w (x, yi). A phase discontinuity occurs at a position where the absolute value of the differential value of the phase is large, x = x V1 , x V2 , x V3 . Further, the surface inclination changes at the position x = x I1 where the sign of the phase differential value is reversed. These points are called singular points of phase change.

位相変化が小さい特異点以外の領域では位相の不連続が生じないため、形状の連続性は保証される。したがって、φm(x、yi)の欠落した領域を位相φw(x、yi)の連続性を利用して補正することが可能になる。図17(c)のφm(x、yi)のグラフではデフォーカス値の信頼性が基準よりも低い領域のグラフを描かなかったので空白になっている。このような場合、空白の近傍から特異点に向かってφwの連続性を利用して補正する。具体的には図中の矢印方向に特異点と交わるまでこの操作を続ける。補正後の位相を図17(d)に補正した位相φ(x、yi)として示す。 Since the phase discontinuity does not occur in the region other than the singular point where the phase change is small, the continuity of the shape is guaranteed. Therefore, it is possible to correct a region lacking φ m (x, yi) using the continuity of the phase φ w (x, yi). The graph of φ m (x, yi) in FIG. 17C is blank because a graph in a region where the reliability of the defocus value is lower than the reference is not drawn. In such a case, correction is performed using the continuity of φ w from the vicinity of the blank toward the singular point. Specifically, this operation is continued until the singular point crosses in the direction of the arrow in the figure. The corrected phase is shown as a corrected phase φ (x, yi) in FIG.

最後にS50の形状算出工程で、三次元形状算出部9が形状の算出を行う。形状算出工程は形状情報算出(S51)からなる。S51の形状情報算出では式(23)を変形した以下の式(26)に基づき、位相情報φ(x、y)を奥行き情報Z(x、y)に変換する。
Z(x、y)=L(1−φ(x、y)/(2πfD))・・・式(26)
図17(e)に最終的に計算された形状情報を示す。不連続な奥行きにある物体に対しても1回のパターン投影のみで詳細な形状計測が可能になることがわかる。以上のようにして、本実施形態では、形状情報を算出することができる。
Finally, in the shape calculation step of S50, the three-dimensional shape calculation unit 9 calculates the shape. The shape calculation step includes shape information calculation (S51). In the shape information calculation of S51, phase information φ (x, y) is converted into depth information Z (x, y) based on the following equation (26) obtained by modifying equation (23).
Z (x, y) = L (1−φ (x, y) / (2πf 0 D)) (26)
FIG. 17E shows the shape information finally calculated. It can be seen that detailed shape measurement can be performed on an object at a discontinuous depth by only one pattern projection. As described above, in the present embodiment, shape information can be calculated.

[実施形態2]
図18に発明の実施形態2に係る形状計測装置200の概略図を示す。図1に示した実施形態1の構成と比較して投影パターン切換部14が追加された構成である。実施形態2では位相情報の取得に位相シフト法を用いる。位相シフト法では図2に示す正弦波状のパターンの位相をずらしながら3種類以上投影する必要がある。実施形態2では、正弦波状のパターンをπ/2ずつ位相をずらしながら4種類投影することにする。
[Embodiment 2]
FIG. 18 shows a schematic diagram of a shape measuring apparatus 200 according to Embodiment 2 of the present invention. Compared with the configuration of the first embodiment shown in FIG. 1, a projection pattern switching unit 14 is added. In the second embodiment, a phase shift method is used to acquire phase information. In the phase shift method, it is necessary to project three or more types while shifting the phase of the sinusoidal pattern shown in FIG. In the second embodiment, four types of sinusoidal patterns are projected while shifting the phase by π / 2.

この4種類のパターンの例は図19に示す通りである。図19では、位相シフト量が0、π/2、π、3π/2の場合をそれぞれ示している。このような位相の異なる4種類のパターンを投影することで、対象のテクスチャに影響されにくい位相情報の取得が可能になるという効果が得られる。さらに、デフォーカス量算出部8におけるデフォーカス量の算出では、信頼性の高いデフォーカス量算出が可能になる。ただし、投影するパターンが4種類であるため、パターンを切り換えて撮影している最中に被写体が動く可能性がある。したがって、動きの速い被写体に対応するためには、高速にパターンの切り換えが可能な投影部と、フレームレートが高速な撮影部2が必要になる。   Examples of these four types of patterns are as shown in FIG. FIG. 19 shows cases where the phase shift amounts are 0, π / 2, π, and 3π / 2, respectively. By projecting such four types of patterns having different phases, it is possible to obtain phase information that is hardly affected by the target texture. Further, in the calculation of the defocus amount in the defocus amount calculation unit 8, it is possible to calculate the defocus amount with high reliability. However, since there are four types of patterns to be projected, there is a possibility that the subject moves during shooting while switching the patterns. Therefore, in order to cope with a fast-moving subject, a projection unit capable of switching patterns at high speed and a photographing unit 2 having a high frame rate are required.

高速にパターンの切り換えが可能な投影部としては、DMDを表示素子として用いたプロジェクター、高速応答性のある液晶表示素子を用いたプロジェクターなどが考えられる。フレームレートが高速な撮影部2としては、市販されている高速カメラを用いればよい。高速カメラを用いれば100fpsや1000fpsでの画像取得も可能である。また、フーリエ変換法と同様に観測できる位相は0〜2πであるため、それを超える位相変化が発生した場合には位相接続が必要になる。事前のキャリブレーションは実施形態1の形状計測装置100と同様の操作をするため説明を省略する。デフォーカス量と奥行き位置の関係はキャリブレーションにより、取得されているものとする。   As a projection unit capable of switching patterns at high speed, a projector using a DMD as a display element, a projector using a liquid crystal display element having high-speed response, and the like can be considered. As the photographing unit 2 having a high frame rate, a commercially available high-speed camera may be used. If a high-speed camera is used, image acquisition at 100 fps or 1000 fps is also possible. Further, since the observable phase is 0 to 2π as in the Fourier transform method, phase connection is necessary when a phase change exceeding the phase is generated. Since the pre-calibration performs the same operation as the shape measuring apparatus 100 of the first embodiment, the description thereof is omitted. It is assumed that the relationship between the defocus amount and the depth position is acquired by calibration.

実施形態2の形状計測装置200による形状計測の手順を説明する。形状計測は図26に示すフローチャートに沿って行われる。該フローチャートに対応する処理は、パターン投影部1、撮影部2、位相情報算出部7、デフォーカス量算出部8、三次元形状算出部9及び投影パターン切換部14が、対応する処理プログラムを実行することにより実現される。   A procedure for shape measurement by the shape measurement apparatus 200 according to the second embodiment will be described. The shape measurement is performed according to the flowchart shown in FIG. In the processing corresponding to the flowchart, the pattern projection unit 1, the photographing unit 2, the phase information calculation unit 7, the defocus amount calculation unit 8, the three-dimensional shape calculation unit 9, and the projection pattern switching unit 14 execute corresponding processing programs. It is realized by doing.

S10’の画像撮影工程は、パターン投影(S11)、画像撮影(S12)、撮影枚数判定(S13)、パターン位相のπ/2シフト(S14)からなる。S10’の画像撮影工程は実施形態1の画像撮影工程と比較して、S13における撮影枚数判定、S14のパターン位相のπ/2シフトが追加された点で異なる。   The image capturing process of S10 'includes pattern projection (S11), image capturing (S12), number of captured images determination (S13), and pattern phase π / 2 shift (S14). The image capturing process in S10 'differs from the image capturing process in the first embodiment in that the number of captured images is determined in S13 and the pattern phase π / 2 shift in S14 is added.

S11では投影部1により、基準となる位相パターンを投影する。S12の画像撮影では撮影部2により撮影対象シーンを画像撮影する。S13では撮影枚数が4枚未満か否かの判定を行う。撮影枚数が4枚以上であれば、次の位相情報算出工程(S20’)とデフォーカス量算出工程(S30’)に進む。撮影枚数が4枚未満であれば、S14に進む。S14では、投影パターン切換部14を用いてパターンの位相をπ/2シフトさせる。その後、S11におけるパターン投影とS12の画像撮影とを行う。このようにしてS10’の画像撮影工程では、投影パターンの位相がπ/2ずつ異なる画像が4枚得られる。   In S11, the projection unit 1 projects a reference phase pattern. In the image shooting in S12, the shooting target scene is imaged by the shooting unit 2. In S13, it is determined whether or not the number of shots is less than four. If the number of shots is four or more, the process proceeds to the next phase information calculation step (S20 ') and defocus amount calculation step (S30'). If the number of shots is less than 4, the process proceeds to S14. In S14, the phase of the pattern is shifted by π / 2 using the projection pattern switching unit 14. Thereafter, pattern projection in S11 and image photographing in S12 are performed. In this way, in the image capturing process of S10 ', four images having different projection pattern phases by π / 2 are obtained.

続いて行うS20’の位相情報算出工程は、位相シフト画像による位相情報算出(S26)からなる。S26で行う処理を図21を用いて説明する。図21は横軸に位相を縦軸に画像輝度値をとったものである。ここでは、位相シフト量が0、π/2、π、3π/2の各撮影画像について同一座標位置(x、y)の画素の輝度値を抽出し、対応する位置にプロットする。画像座標が(x、y)のときの0、π/2、π、3π/2のときの輝度値をそれぞれI0(x、y)、Iπ/2(x、y)、Iπ(x、y)I3π/2(x、y)とする。このとき、画像座標(x、y)の位置での位相情報φw(x、y)は以下の式(27)で算出することができる。
φw(x、y)=tan-1{I3π/2(x、y)−Iπ/2(x、y)}/{I(x、y)−Iπ(x、y)}・・・式(27)
フーリエ変換法では注目画素の投影パターンの変化に応じた輝度変動のみで処理が完結するため、対象のテクスチャの変動に強い位相算出が可能になる。
The subsequent S20 ′ phase information calculation step includes phase information calculation (S26) using a phase shift image. The process performed in S26 will be described with reference to FIG. In FIG. 21, the horizontal axis represents the phase and the vertical axis represents the image luminance value. Here, the luminance value of the pixel at the same coordinate position (x, y) is extracted for each captured image with phase shift amounts of 0, π / 2, π, and 3π / 2, and plotted at the corresponding position. When the image coordinates are (x, y), the luminance values at 0, π / 2, π, 3π / 2 are respectively represented by I 0 (x, y), I π / 2 (x, y), I π ( x, y) Let I 3π / 2 (x, y). At this time, the phase information φ w (x, y) at the position of the image coordinates (x, y) can be calculated by the following equation (27).
φ w (x, y) = tan −1 {I 3π / 2 (x, y) −I π / 2 (x, y)} / {I 0 (x, y) −I π (x, y)} ... Formula (27)
In the Fourier transform method, the processing is completed only with the luminance fluctuation according to the change in the projection pattern of the pixel of interest, so that it is possible to calculate the phase that is strong against the fluctuation of the target texture.

続くS30’では、デフォーカス量算出(S31)、デフォーカス量信頼度算出(S32)、処理枚数判定(S33)、画像変更(S34)、結果統合(S35)からなるのデフォーカス量算出工程が、デフォーカス量算出部8により実施される。S31のデフォーカス量算出工程では、実施形態1と同様、デフォーカス量の算出に注目画素の近傍領域内のコントラスト値、または、標準偏差値を用いるので説明は省略する。S32のデフォーカス量信頼度算出も実施形態1と同様、デフォーカス値の差分(微分)を算出するので説明は省略する。   In the subsequent S30 ′, a defocus amount calculation step including defocus amount calculation (S31), defocus amount reliability calculation (S32), processing number determination (S33), image change (S34), and result integration (S35) is performed. This is performed by the defocus amount calculation unit 8. In the defocus amount calculation step of S31, as in the first embodiment, the contrast value or the standard deviation value in the vicinity region of the target pixel is used for calculating the defocus amount, and thus the description thereof is omitted. The defocus amount reliability calculation in S32 also calculates the difference (differentiation) of the defocus value, as in the first embodiment, and a description thereof will be omitted.

S33の処理枚数判定S33では、処理枚数が4枚未満か否かの判定を行う。処理枚数が4枚以上の場合には、S35の結果統合に進む。処理枚数が4枚未満の場合、S34の画像変更に進む。S34では処理の対象をデフォーカス量算出を実施していない投影パターンの撮影画像に変更する。S35では異なる投影パターンで実施したデフォーカス量の算出結果と、デフォーカス信頼度の算出結果を統合する。   In the process number determination S33 of S33, it is determined whether or not the process number is less than four. If the number of processed sheets is 4 or more, the process proceeds to S35 as a result integration. When the number of processed sheets is less than 4, the process proceeds to S34 image change. In S34, the processing target is changed to a captured image of a projection pattern for which defocus amount calculation is not performed. In S35, the calculation result of the defocus amount and the calculation result of the defocus reliability performed with different projection patterns are integrated.

ここでは、位相シフト量が0の画像を初期画像とし、デフォーカス信頼度が基準よりも低い領域を抽出する。位相シフト量が異なる画像でこの領域のデフォーカス信頼度が基準以上の場合には、そのときのデフォーカス値を初期画像の結果に上書きする。これを位相シフト量が異なる画像に対して繰り返して、デフォーカス信頼度が基準以上のデフォーカス量を統合することで、デフォーカス信頼度が基準よりも低い領域が小さくなる。複数パターンの撮影画像の結果を統合することで、デフォーカス信頼度の高い領域のデータを選定することができるため、精度の高いデフォーカス量算出が可能になる。なお、S40の位相接続工程とS50の形状情報算出工程に関しては実施形態1と同様の操作をするため説明を省略する。   Here, an image having a phase shift amount of 0 is set as an initial image, and a region having a defocus reliability lower than the reference is extracted. If the defocus reliability of this region is equal to or higher than the reference for images with different phase shift amounts, the defocus value at that time is overwritten on the result of the initial image. By repeating this operation for images having different phase shift amounts and integrating defocus amounts having a defocus reliability equal to or higher than the reference, a region where the defocus reliability is lower than the reference is reduced. By integrating the results of the captured images of a plurality of patterns, it is possible to select data in a region with high defocus reliability, and thus it is possible to calculate a defocus amount with high accuracy. In addition, regarding the phase connection process of S40 and the shape information calculation process of S50, since the same operation as Embodiment 1 is performed, description is abbreviate | omitted.

以上の実施形態2により、撮影枚数が4枚に増加するものの、テクスチャの変動に強い位相算出と、信頼度の高いデフォーカス量算出が可能になる。   According to the second embodiment described above, although the number of shots is increased to four, it is possible to calculate a phase that is resistant to texture fluctuation and to calculate a defocus amount with high reliability.

[実施形態3]
発明の実施形態3に係る形状計測装置は図18に示した実施形態2と同様の構成を有する。パターン投影部1で投影するパターンは図22(a)、(b)に示す2種類の矩形波パターンである。矩形波パターンの周期をpとし、図22(a)の矩形波を基準位相とすると、図22(b)のパターンはp/2だけ位相をずらしたものである。投影パターン切換部14でパターン投影部1で投影するパターンを切り替えながら、撮像部2でそれぞれのパターンが投影された撮影対象シーンの画像を撮像する。
[Embodiment 3]
The shape measuring apparatus according to the third embodiment of the invention has the same configuration as that of the second embodiment shown in FIG. The patterns projected by the pattern projection unit 1 are two types of rectangular wave patterns shown in FIGS. If the period of the rectangular wave pattern is p and the rectangular wave in FIG. 22A is the reference phase, the pattern in FIG. 22B is shifted in phase by p / 2. While the projection pattern switching unit 14 switches the pattern projected by the pattern projection unit 1, the imaging unit 2 captures an image of the shooting target scene on which each pattern is projected.

デフォーカス量算出部8では、撮影画像の各画素におけるデフォーカス量を式(1)で示したコントラスト値、式(2)で示した標準偏差値等を用いて計算する。   The defocus amount calculation unit 8 calculates the defocus amount at each pixel of the captured image using the contrast value represented by Expression (1), the standard deviation value represented by Expression (2), and the like.

次に、本実施形態における位相情報算出部7による、図20のS20'における位相情報の算出方法について説明する。ここでは、図22(a)のパターンを投影し、撮影したときの画像をIRp(x、y)、図22(b)のパターンを投影し、撮影したときの画像をIRn(x、y)とする。 Next, a method of calculating phase information in S20 ′ of FIG. 20 by the phase information calculation unit 7 in the present embodiment will be described. Here, the pattern of FIG. 22 (a) is projected and the image taken is I Rp (x, y), and the pattern of FIG. 22 (b) is projected and the image taken is I Rn (x, y).

まず、IRp(x、y)とIRn(x、y)の大小比較をし、2値化画像B(x、y)を生成する。IRp(x、y)>=IRn(x、y)のときB(x、y)=1とし、IRp(x、y)<IRn(x、y)のときB(x、y)=0とする。図22(c)に2値化画像B(x、y)の生成例を示す。 First, I Rp (x, y) and I Rn (x, y) are compared in size to generate a binarized image B (x, y). When I Rp (x, y)> = I Rn (x, y), B (x, y) = 1, and when I Rp (x, y) <I Rn (x, y), B (x, y) ) = 0. FIG. 22C shows a generation example of the binarized image B (x, y).

次に2値化画像B(x、y)から以下の式(28)により、エッジ画像Eを生成する。   Next, an edge image E is generated from the binarized image B (x, y) by the following equation (28).

E(x、y)=B(x、y)―B(x+1、y)・・・式(28)
式(28)の計算により、エッジ位置には1、または、−1の値が与えられる。次に注目画素xの両端のエッジ位置を探索する。これはエッジ画像E上で、最も近接する1、または、−1の値を探索することにより成される。探索された左側のエッジ位置をE、右側のエッジ位置をEとすると、位相φ(x、y)は以下の式(29)で計算される。
E (x, y) = B (x, y) −B (x + 1, y) (28)
The value of 1 or −1 is given to the edge position by the calculation of Expression (28). Next, the edge positions at both ends of the target pixel x are searched. This is done by searching for the closest 1 or -1 value on the edge image E. Assuming that the searched left edge position is E l and the right edge position is E r , the phase φ w (x, y) is calculated by the following equation (29).

φ(x)=2π・(x―E)/(E―E)―π・・・式(29)
これを全てのy座標に対して計算することで位相情報φ(x、y)が求められる。
φ w (x) = 2π · (x−E l ) / (E r −E l ) −π (29)
By calculating this with respect to all y coordinates, phase information φ w (x, y) is obtained.

三次元形状算出部9では、デフォーカス量算出部8で算出されたデフォーカス量を基に式(24)により位相次数mを決定する。さらに、式(25)により位相情報算出部7で算出した位相情報φ(x、y)を接続し、接続位相φ(x、y)を求める。必要に応じて位相補正を行い、式(26)を用いて奥行き情報Z(x、y)を計算し、被写体の三次元形状情報を求める。 In the three-dimensional shape calculation unit 9, the phase order m is determined by Expression (24) based on the defocus amount calculated by the defocus amount calculation unit 8. Further, the phase information φ w (x, y) calculated by the phase information calculation unit 7 according to the equation (25) is connected to obtain the connection phase φ m (x, y). Phase correction is performed as necessary, and depth information Z (x, y) is calculated using equation (26) to obtain the three-dimensional shape information of the subject.

以上の実施形態3により、撮影枚数が2枚に増加するものの、被写体が有するテクスチャ変動に強い位相算出が可能になる。   According to the third embodiment described above, although the number of shots is increased to two, it is possible to calculate a phase that is strong against texture fluctuation of the subject.

[実施形態4]
発明の実施形態4に係る形状計測装置は図18に示した実施形態2と同様の構成を有する。但し、本実施形態においてパターン投影部1が投影するパターンは図23(a)、(b)に示す2種類の三角波である。図23(b)の三角波は図23(a)の明るさを反転させたものである。投影パターン切換部14でパターン投影部1で投影するパターンを切り替えながら、撮像部2でそれぞれのパターンが投影された撮影対象シーンの画像を撮像する。
[Embodiment 4]
The shape measuring apparatus according to the fourth embodiment of the invention has the same configuration as that of the second embodiment shown in FIG. However, in the present embodiment, the patterns projected by the pattern projection unit 1 are two types of triangular waves shown in FIGS. The triangular wave in FIG. 23B is obtained by inverting the brightness in FIG. While the projection pattern switching unit 14 switches the pattern projected by the pattern projection unit 1, the imaging unit 2 captures an image of the shooting target scene on which each pattern is projected.

デフォーカス量算出部8では、撮影画像の各画素におけるデフォーカス量を式(1)で示したコントラスト値、式(2)で示した標準偏差値などを用いて計算する。   The defocus amount calculation unit 8 calculates the defocus amount in each pixel of the captured image using the contrast value represented by Expression (1), the standard deviation value represented by Expression (2), and the like.

次に、本実施形態における位相情報算出部7による、図20のS20'における位相情報の算出方法について説明する。ここでは、図23(a)のパターンで撮影したときの撮影画像をITp(x、y)、図23(b)のパターンで撮影したときの撮影画像をITn(x、y)とする。このとき強度比画像Iratioは以下の式(30)で計算される。 Next, a method of calculating phase information in S20 ′ of FIG. 20 by the phase information calculation unit 7 in the present embodiment will be described. Here, it is assumed that the captured image when the pattern of FIG. 23A is captured is I Tp (x, y), and the captured image when the pattern of FIG. 23B is captured is I Tn (x, y). . At this time, the intensity ratio image I ratio is calculated by the following equation (30).

ratio=ITp(x、y)/ITn(x、y)・・・式(30)
強度比画像Iratioの計算結果を図23(c)に示す。三角波の周期をpとすると位相情報φ(x、y)は以下の式(31)で計算される。
I ratio = I Tp (x, y) / I Tn (x, y) (30)
The calculation result of the intensity ratio image I ratio is shown in FIG. When the period of the triangular wave is p, the phase information φ w (x, y) is calculated by the following equation (31).

φ(x、y)=2π・Iratio・(1−x/p−int(x/p))−π・・・式(31)
ここでint()は小数点以下を切り捨てるという演算を意味する。式(31)により強度比画像Iratioの値が−π〜πの間で線形に変化するように正規化される。φ(x、y)の計算結果の例を図23(d)に示す。三次元形状算出部9では、デフォーカス量算出部8で算出されたデフォーカス量を基に式(24)により位相次数mを決定する。さらに、式(25)により位相情報算出部7で算出した位相情報φ(x、y)を接続し、接続位相φ(x、y)を求める。
φ w (x, y) = 2π · I ratio · (1−x / p−int (x / p)) − π (31)
Here, int () means an operation of truncating the decimal part. The value of the intensity ratio image I ratio is normalized by Expression (31) so as to change linearly between −π to π. An example of the calculation result of φ w (x, y) is shown in FIG. In the three-dimensional shape calculation unit 9, the phase order m is determined by Expression (24) based on the defocus amount calculated by the defocus amount calculation unit 8. Further, the phase information φ w (x, y) calculated by the phase information calculation unit 7 according to the equation (25) is connected to obtain the connection phase φ m (x, y).

必要に応じて位相補正を行い、式(26)を用いて奥行き情報Z(x、y)を計算し、被写体の三次元形状情報を求める。   Phase correction is performed as necessary, and depth information Z (x, y) is calculated using equation (26) to obtain the three-dimensional shape information of the subject.

以上の実施形態4により、撮影枚数が2枚に増加するものの、被写体が有するテクスチャ変動に強い位相算出が可能になる。   According to the fourth embodiment described above, although the number of shots is increased to two, it is possible to calculate a phase that is strong against texture fluctuation of the subject.

[実施形態5]
発明の実施形態5に係る形状計測装置300の概略上面図を図24に示す。図1で示した実施形態1の構成との違いは、位相情報算出部7の代わりに、撮影画像のパターンの明るさ変化からパターンの局所的な配置情報を算出する局所配置情報算出部71が使われる点である。
[Embodiment 5]
A schematic top view of a shape measuring apparatus 300 according to Embodiment 5 of the present invention is shown in FIG. The difference from the configuration of the first embodiment shown in FIG. 1 is that, instead of the phase information calculation unit 7, a local arrangement information calculation unit 71 that calculates the local arrangement information of the pattern from the brightness change of the pattern of the captured image. It is a point used.

パターン投影部1で投影するパターンは図25に示すランダム性を有するパターン(ランダムパターン)である。撮像部2で図25(a)に示すランダム性を有するパターンが投影された撮影対象シーンの画像を撮像する。このときの撮影画像をIRand(x、y)とする。 The pattern projected by the pattern projecting unit 1 is a random pattern shown in FIG. The imaging unit 2 captures an image of a scene to be photographed on which a pattern having randomness shown in FIG. Let the captured image at this time be I Rand (x, y).

局所配置情報算出部71では、2値化処理、符号化処理、相関演算処理、候補選択処理という4つの処理が行われる。2値化処理では、撮影画像IRand(x、y)が画像の明暗に応じた閾値処理により2値化される。符号化処理では、2値化処理の結果に基づいて符合化画像Code(x、y)が生成される。明部に対して符合「1」が、暗部に対して符号「0」がそれぞれ割り与えられる。相関演算処理では、まず、図25(b)に示すように符号化画像の注目画素近傍の所定範囲(−Rc〜+Rc)が切り出される。そして、以下の式(32)により、切り出された領域に対してランダムパターンRandCode(x)との相関演算が行われる。
上記演算式によれば、相関値Corre(x)が小さいほど、相関が高くなることを意味する。図25(c)に相関演算の結果の一例を示す。候補選択処理では、相関演算結果に基づいて複数の候補を選択する。図25(c)に示す例ではMin1、Min2という2つ候補が選択される。このような場合には、複数の候補が選択されたため、奥行きを一意に求めることができない。
The local arrangement information calculation unit 71 performs four processes: binarization processing, encoding processing, correlation calculation processing, and candidate selection processing. In the binarization processing, the captured image I Rand (x, y) is binarized by threshold processing according to the brightness of the image. In the encoding process, an encoded image Code (x, y) is generated based on the result of the binarization process. The sign “1” is assigned to the bright part and the sign “0” is assigned to the dark part. In the correlation calculation process, first, as shown in FIG. 25 (b), a predetermined range (-Rc to + Rc) near the target pixel of the encoded image is cut out. Then, the correlation calculation with the random pattern RandCode (x) is performed on the clipped region by the following equation (32).
According to the above equation, the smaller the correlation value Core (x), the higher the correlation. FIG. 25C shows an example of the result of the correlation calculation. In the candidate selection process, a plurality of candidates are selected based on the correlation calculation result. In the example shown in FIG. 25C, two candidates, Min1 and Min2, are selected. In such a case, since a plurality of candidates are selected, the depth cannot be uniquely determined.

そこで、候補を絞り込むために、デフォーカス量算出部8により求められたデフォーカス量を用いる。デフォーカス量算出部8では、撮影画像の各画素におけるデフォーカス量を式(1)で示したコントラスト値、式(2)で示した標準偏差値等を用いて計算する。撮影画像上の位置とデフォーカス量、投影パターン上の位置の関係は事前のキャリブレーションにより求められている。そのため、図25(c)に示す例では、点線枠で囲んだ領域Candに絞られる。これにより、2つの候補から1つの候補Min1を選択し、奥行きを求める。上記処理を画像の全範囲に対して実施することで、撮影対象シーンの奥行き情報Z(x、y)を計算する。   Therefore, in order to narrow down candidates, the defocus amount obtained by the defocus amount calculation unit 8 is used. The defocus amount calculation unit 8 calculates the defocus amount at each pixel of the captured image using the contrast value represented by Expression (1), the standard deviation value represented by Expression (2), and the like. The relationship between the position on the captured image, the defocus amount, and the position on the projection pattern is obtained by prior calibration. Therefore, in the example shown in FIG. 25C, the area is narrowed down to an area Cand surrounded by a dotted frame. Thereby, one candidate Min1 is selected from the two candidates, and the depth is obtained. The depth information Z (x, y) of the shooting target scene is calculated by performing the above process on the entire range of the image.

以上の実施形態5により、投影するパターンが周期的なパターンでなくても被写体の三次元形状計測が可能となる。   According to the fifth embodiment described above, it is possible to measure the three-dimensional shape of the subject even if the pattern to be projected is not a periodic pattern.

[実施形態6]
発明の実施形態6に係る形状計測装置の構成は、実施形態1の構成である図1と同一である。実施形態1乃至5ではパターン投影部1の焦点を基準面3に合わせ、投影光学系12によるボケを利用してデフォーカス量を算出した。しかし、実施形態6では撮像部2の結像光学系を用いて焦点を基準面3に合わせ、撮像光学系によるボケを利用してデフォーカス量を算出する。
[Embodiment 6]
The configuration of the shape measuring apparatus according to the sixth embodiment of the invention is the same as that of FIG. In the first to fifth embodiments, the focus of the pattern projection unit 1 is adjusted to the reference plane 3, and the defocus amount is calculated using blurring by the projection optical system 12. However, in the sixth embodiment, the focus is adjusted to the reference plane 3 using the imaging optical system of the imaging unit 2, and the defocus amount is calculated using the blur caused by the imaging optical system.

撮像部2の撮像光学系によるデフォーカスと、パターン投影部1の投影光学系によるデフォーカスを分離するために、投影光学系のデフォーカスを無視できるような条件で投影する必要がある。具体的にはパターン投影部1の絞りを十分に絞り、被写界深度を深くしておく必要がある。計測範囲に応じて、被写界深度の計算式(3)、(4)、および、回折によるボケの限界の算出式(5)を使用して投影光学系のF値を適切に設定する。   In order to separate the defocusing by the imaging optical system of the imaging unit 2 and the defocusing by the projection optical system of the pattern projection unit 1, it is necessary to project under conditions that allow the defocusing of the projection optical system to be ignored. Specifically, it is necessary to sufficiently stop the aperture of the pattern projection unit 1 and deepen the depth of field. According to the measurement range, the F value of the projection optical system is appropriately set using the calculation formulas (3) and (4) for the depth of field and the calculation formula (5) for the limit of blur due to diffraction.

撮像部2の焦点を基準面3に合わせたので、基準面から手前に離れるほど、デフォーカス量は大きくなる。デフォーカス量算出部8では、撮影画像の各画素におけるデフォーカス量を式(1)で示したコントラスト値、式(2)で示した標準偏差値などを用いて計算する。位相情報算出部7では実施形態1と同様に正弦波が投影された被写体の撮影画像から、フーリエ変換法により位相情報φ(x、y)を算出する。 Since the focus of the imaging unit 2 is adjusted to the reference plane 3, the defocus amount increases as the distance from the reference plane increases. The defocus amount calculation unit 8 calculates the defocus amount in each pixel of the captured image using the contrast value represented by Expression (1), the standard deviation value represented by Expression (2), and the like. The phase information calculation unit 7 calculates the phase information φ w (x, y) from the captured image of the subject on which the sine wave is projected, by the Fourier transform method, as in the first embodiment.

三次元形状算出部9では、デフォーカス量算出部8で算出されたデフォーカス量を基に式(24)により位相次数mを決定する。さらに、式(25)により位相情報算出部7で算出した位相φ(x、y)を接続し、接続位相φ(x、y)を求める。本実施形態6では投影パターンとして正弦波を1パターン投影し、フーリエ変換法により、位相を算出する方法を例に挙げて説明した。しかし、構成を実施形態5と同一にし、ランダムパターンを投影する方法も用いることができる。また、パターン切換部を追加した実施形態2乃至4と同一の構成にして、位相の異なる複数の正弦波を投影する方法、矩形波を投影する方法、三角波を投影する方法なども用いることができる。 In the three-dimensional shape calculation unit 9, the phase order m is determined by Expression (24) based on the defocus amount calculated by the defocus amount calculation unit 8. Further, the phase φ w (x, y) calculated by the phase information calculation unit 7 according to the equation (25) is connected to obtain the connection phase φ m (x, y). In the sixth embodiment, a method of calculating one phase of a sine wave as a projection pattern and calculating the phase by the Fourier transform method has been described as an example. However, a method of projecting a random pattern with the same configuration as that of the fifth embodiment can also be used. In addition, a method of projecting a plurality of sine waves having different phases, a method of projecting a rectangular wave, a method of projecting a triangular wave, etc. can be used with the same configuration as in the second to fourth embodiments to which a pattern switching unit is added. .

以上の実施形態6により、撮像光学系がパンフォーカス条件を満たさなくても三次元形状計測が可能になる。   The sixth embodiment described above enables three-dimensional shape measurement even when the imaging optical system does not satisfy the pan focus condition.

[実施形態7]
発明の実施形態7に係る形状計測装置の構成は、実施形態1の構成である図1と同一である。実施形態1乃至5ではパターン投影部1の焦点を基準面3に合わせ、投影光学系12によるボケを利用してデフォーカス量を算出した。また、実施形態6では撮像部2の焦点を基準面3に合わせ、撮像レンズ22によるボケを利用してデフォーカス量を算出した。しかし、実施形態7では、パターン投影部1の投影光学系によるボケと撮像部2の撮像光学系によるボケの両者を合わせた複合ボケを利用してデフォーカス量を算出する。
[Embodiment 7]
The configuration of the shape measuring apparatus according to the seventh embodiment of the invention is the same as that of FIG. In the first to fifth embodiments, the focus of the pattern projection unit 1 is adjusted to the reference plane 3, and the defocus amount is calculated using blurring by the projection optical system 12. In the sixth embodiment, the focus of the imaging unit 2 is adjusted to the reference plane 3, and the defocus amount is calculated using the blur caused by the imaging lens 22. However, in the seventh embodiment, the defocus amount is calculated using a composite blur that is a combination of the blur caused by the projection optical system of the pattern projection unit 1 and the blur caused by the imaging optical system of the imaging unit 2.

パターン投影部1と撮像部2の焦点は基準面3、または、基準面3よりも後方に合わせる。このようにすることで、基準面から手前に離れるほど、複合ボケは大きくなるため、パターン投影部1と撮像部2のボケを分離してデフォーカス量を算出する必要がなくなる。デフォーカス量算出部8では、撮影画像の各画素におけるデフォーカス量を式(1)で示したコントラスト値、式(2)で示した標準偏差値などを用いて計算する。位相情報算出部7では実施形態1と同様に正弦波が投影された被写体の撮影画像から、フーリエ変換法により位相情報φ(x、y)を算出する。 The pattern projection unit 1 and the imaging unit 2 are focused on the reference plane 3 or behind the reference plane 3. By doing so, since the composite blur increases as it moves away from the reference plane, it is not necessary to calculate the defocus amount by separating the blur of the pattern projection unit 1 and the imaging unit 2. The defocus amount calculation unit 8 calculates the defocus amount in each pixel of the captured image using the contrast value represented by Expression (1), the standard deviation value represented by Expression (2), and the like. The phase information calculation unit 7 calculates the phase information φ w (x, y) from the captured image of the subject on which the sine wave is projected, by the Fourier transform method, as in the first embodiment.

三次元形状算出部9では、デフォーカス量算出部8で算出されたデフォーカス量を基に式(24)により位相次数mを決定する。さらに、式(25)により位相情報算出部7で算出した位相情報φ(x、y)を接続し、接続位相φ(x、y)を求める。本実施形態7では投影パターンとして正弦波を1パターン投影し、フーリエ変換法により、位相を算出する方法を例に挙げて説明した。しかし、構成を実施形態5と同一にし、ランダムパターンを投影する方法も用いることができる。また、パターン切換部を追加した実施形態2乃至4と同一の構成にして、位相の異なる複数の正弦波を投影する方法、矩形波を投影する方法、三角波を投影する方法なども用いることができる。 In the three-dimensional shape calculation unit 9, the phase order m is determined by Expression (24) based on the defocus amount calculated by the defocus amount calculation unit 8. Further, the phase information φ w (x, y) calculated by the phase information calculation unit 7 according to the equation (25) is connected to obtain the connection phase φ m (x, y). In the seventh embodiment, a method of calculating one phase of a sine wave as a projection pattern and calculating a phase by a Fourier transform method has been described as an example. However, a method of projecting a random pattern with the same configuration as that of the fifth embodiment can also be used. In addition, a method of projecting a plurality of sine waves having different phases, a method of projecting a rectangular wave, a method of projecting a triangular wave, etc. can be used with the same configuration as in the second to fourth embodiments to which a pattern switching unit is added. .

以上の実施形態7により、撮像光学系、および、投影光学系がパンフォーカス条件を満たさなくても三次元形状計測が可能になる。   According to the seventh embodiment described above, three-dimensional shape measurement can be performed even if the imaging optical system and the projection optical system do not satisfy the pan focus condition.

本発明による三次元形状計測装置は様々な応用に利用できる。CGなどの分野では実在する物体のモデリングを行うことができる。これにより従来は手動で実施していたモデリングを自動化することができ、CG製作の効率化が期待できる。少ないパターン数で精度の高い距離算出が可能なため、高速な応答が要求されるロボットハンド用のビジョンとして用いることもできる。また、比較的少ないパターンでの形状計測が可能なため、動いている被写体に対しても形状計測を実施できる。小型のプロジェクターと組み合わせれば、ディジタルカメラなどの小型の撮像デバイスにも搭載でき、三次元形状を用いた高度な処理のための入力情報として用いることができる。   The three-dimensional shape measuring apparatus according to the present invention can be used for various applications. In the field of CG or the like, modeling of an actual object can be performed. This makes it possible to automate modeling that has been performed manually in the past, and to improve the efficiency of CG production. Since it is possible to calculate the distance with high accuracy with a small number of patterns, it can also be used as a vision for a robot hand that requires a high-speed response. In addition, since shape measurement with a relatively small number of patterns is possible, shape measurement can be performed even on a moving subject. When combined with a small projector, it can be mounted on a small imaging device such as a digital camera, and can be used as input information for advanced processing using a three-dimensional shape.

また、本発明は、実施形態1乃至7と同等の処理を、コンピュータプログラムでも実現できる。この場合、図1及び図18のブロック7乃至9及び14等の構成要素の各々は関数、もしくはCPUが実行するサブルーチンで機能させれば良い。また、通常、コンピュータプログラムは、CD−ROM等のコンピュータ可読記憶媒体に格納されており、それを、コンピュータが有する読取り装置(CD−ROMドライブ等)にセットし、システムにコピーもしくはインストールすることで実行可能になる。従って、かかるコンピュータ可読記憶媒体も本発明の範疇にあることは明らかである。   In addition, the present invention can realize the same processing as in the first to seventh embodiments with a computer program. In this case, each of the components such as blocks 7 to 9 and 14 in FIGS. 1 and 18 may be functioned by a function or a subroutine executed by the CPU. In general, the computer program is stored in a computer-readable storage medium such as a CD-ROM, and is set in a reading device (such as a CD-ROM drive) included in the computer and copied or installed in the system. Become executable. Therefore, it is obvious that such a computer readable storage medium is also within the scope of the present invention.

(その他の実施例)
また、本発明は、以下の処理を実行することによっても実現される。即ち、上述した実施形態の機能を実現するソフトウェア(プログラム)を、ネットワーク又は各種記憶媒体を介してシステム或いは装置に供給し、そのシステム或いは装置のコンピュータ(またはCPUやMPU等)がプログラムを読み出して実行する処理である。
(Other examples)
The present invention can also be realized by executing the following processing. That is, software (program) that realizes the functions of the above-described embodiments is supplied to a system or apparatus via a network or various storage media, and a computer (or CPU, MPU, etc.) of the system or apparatus reads the program. It is a process to be executed.

Claims (14)

周期性を有するパターンを計測空間に投影するパターン投影手段と、
前記パターンが投影された計測空間を撮影する撮像手段とを備え、
前記計測空間は、基準面、前記パターン投影手段の投影範囲及び前記撮影手段の撮影範囲により規定され、前記撮像手段は、前記基準面で合焦するように前記計測空間を撮像し、前記計測空間に存在する計測対象の三次元形状を計測する三次元形状計測装置であって、
前記撮影手段により得られた撮影画像の前記パターンの明るさ変化から前記パターンの位相情報を算出する位相情報算出手段と、
前記算出された位相情報を補正する位相情報補正手段と、
前記撮影画像における前記パターンのボケ量を算出するボケ量算出手段と、
前記計測対象と前記三次元形状計測装置との相対的な位置関係が変化しない場合に、前記位相情報と前記ボケ量とに基づき、前記計測対象の三次元形状を算出する三次元形状算出手段とを備え、
前記位相情報補正手段は、前記ボケ量を前記計測空間の奥行き情報に変換し、該奥行き情報に対応する位相の次数を算出し、該次数に基づいて位相情報を補正し、
前記三次元形状算出手段は、補正された位相情報に基づいて前記計測対象の三次元形状を算出することを特徴とする三次元形状計測装置。
Pattern projection means for projecting a pattern having periodicity onto a measurement space;
Imaging means for photographing the measurement space on which the pattern is projected,
The measurement space is defined by a reference plane, a projection range of the pattern projection unit, and an imaging range of the imaging unit, and the imaging unit images the measurement space so as to be focused on the reference plane, and the measurement space A three-dimensional shape measuring apparatus for measuring a three-dimensional shape of a measurement object existing in
Phase information calculating means for calculating phase information of the pattern from a change in brightness of the pattern of the photographed image obtained by the photographing means;
Phase information correction means for correcting the calculated phase information;
A blur amount calculating means for calculating a blur amount of the pattern in the captured image;
3D shape calculation means for calculating the 3D shape of the measurement object based on the phase information and the amount of blur when the relative positional relationship between the measurement object and the 3D shape measurement device does not change; With
The phase information correction unit converts the blur amount into depth information of the measurement space, calculates a phase order corresponding to the depth information, corrects the phase information based on the order,
The three-dimensional shape calculation unit is characterized in that the three-dimensional shape of the measurement target is calculated based on the corrected phase information.
前記ボケ量算出手段は、前記ボケ量の変化量を算出し、該変化量が閾値よりも高いボケ量を除外し、
前記位相情報補正手段は、該変化量が前記閾値以下であるボケ量を前記奥行き情報に変換することを特徴とする請求項1に記載の三次元形状計測装置。
The blur amount calculation means calculates a change amount of the blur amount, excludes a blur amount whose change amount is higher than a threshold,
The three-dimensional shape measurement apparatus according to claim 1, wherein the phase information correction unit converts a blur amount whose change amount is equal to or less than the threshold value into the depth information.
前記パターン投影手段により投影される前記パターンは、周期性を有する1種類のパターンであって、
前記位相情報算出手段は、前記撮影画像を走査線毎にフーリエ変換して、フーリエ変換後のデータから前記周期性を有するパターンの基本周波数の付近のデータを抽出し、抽出したデータを逆フーリエ変換して、前記位相情報を求めることを特徴とする請求項1または2に記載の三次元形状計測装置。
The pattern projected by the pattern projecting means is one type of pattern having periodicity,
The phase information calculation means performs Fourier transform on the captured image for each scanning line, extracts data in the vicinity of the fundamental frequency of the periodic pattern from the data after Fourier transform, and performs inverse Fourier transform on the extracted data The three-dimensional shape measuring apparatus according to claim 1, wherein the phase information is obtained.
前記パターン投影手段により投影される前記パターンは、位相がシフトされた3種類以上の周期性を有するパターンであって、
前記撮像手段は、前記3種類以上の投影パターンのそれぞれについて撮像を行い、
前記位相情報算出手段は、前記3種類以上の投影パターンについて得られた撮影画像のそれぞれについて、同一座標位置における輝度値を取得し、取得した各輝度値と該輝度値に対応する位相のシフト量との関係に基づき、前記位相情報を算出する
ことを特徴とする請求項1乃至3のいずれか1項に記載の三次元形状計測装置。
The pattern projected by the pattern projecting unit is a pattern having three or more types of periodicity whose phases are shifted,
The imaging means performs imaging for each of the three or more types of projection patterns,
The phase information calculation unit acquires a luminance value at the same coordinate position for each of the captured images obtained for the three or more types of projection patterns, and each acquired luminance value and a phase shift amount corresponding to the luminance value The three-dimensional shape measurement apparatus according to claim 1, wherein the phase information is calculated based on a relationship between the phase information and the phase information.
前記ボケ量算出手段は、前記3種類以上の投影パターンについて得られた撮影画像のそれぞれについて、前記ボケ量の変化量を算出し、該変化量が閾値以下のボケ量を統合し、
前記位相情報補正手段は、該統合されたボケ量を前記奥行き情報に変換することを特徴とする請求項3に記載の三次元形状計測装置。
The blur amount calculating unit calculates a change amount of the blur amount for each of the captured images obtained for the three or more types of projection patterns, and integrates the blur amount whose change amount is equal to or less than a threshold value.
The three-dimensional shape measurement apparatus according to claim 3, wherein the phase information correction unit converts the integrated blur amount into the depth information.
前記ボケ量算出手段は、前記撮影画像の注目画素近傍の所定範囲内におけるコントラスト値に基づき、前記ボケ量を算出することを特徴とする請求項1乃至5のいずれか1項に記載の三次元形状計測装置。   6. The three-dimensional image according to claim 1, wherein the blur amount calculation unit calculates the blur amount based on a contrast value within a predetermined range in the vicinity of the target pixel of the captured image. Shape measuring device. 前記ボケ量算出手段は、前記撮影画像の注目画素近傍の所定範囲内における標準偏差値に基づき、前記ボケ量を算出することを特徴とする請求項1乃至5のいずれか1項に記載の三次元形状計測装置。   6. The tertiary according to claim 1, wherein the blur amount calculating unit calculates the blur amount based on a standard deviation value within a predetermined range in the vicinity of the target pixel of the captured image. Original shape measuring device. 前記周期性を有するパターンが矩形波であることを特徴とする請求項1乃至7のいずれか1項記載の三次元形状計測装置。   The three-dimensional shape measurement apparatus according to claim 1, wherein the pattern having periodicity is a rectangular wave. 前記周期性を有するパターンが三角波であることを特徴とする請求項1乃至7のいずれか1項記載の三次元形状計測装置。   The three-dimensional shape measuring apparatus according to claim 1, wherein the pattern having periodicity is a triangular wave. 前記ボケ量はデフォーカス量を基準として算出するものであることを特徴とする請求項1乃至9のいずれか1項に記載の三次元形状計測装置。   The three-dimensional shape measuring apparatus according to any one of claims 1 to 9, wherein the blur amount is calculated based on a defocus amount. 周期性を有するパターンを計測空間に投影するパターン投影手段と、
前記パターンが投影された計測空間を撮影する撮像手段とを備え、
前記計測空間は、基準面、前記パターン投影手段の投影範囲及び前記撮影手段の撮影範囲により規定され、前記撮像手段は、前記基準面で合焦するように前記計測空間を撮像し、前記計測空間に存在する計測対象の三次元形状を計測する三次元形状計測装置による三次元形状計測方法であって、
位相情報算出手段が、前記撮影手段により得られた撮影画像の前記パターンの明るさ変化から前記パターンの位相情報をを算出する工程と、
位相情報補正手段が、前記算出された位相情報を補正する工程と、
ボケ量算出手段が、前記撮影画像における前記パターンのボケ量を算出する工程と、
前記計測対象と前記三次元形状計測装置との相対的な位置関係が変化しない場合に、三次元形状算出手段が、前記位相情報と前記ボケ量とに基づき、前記計測対象の三次元形状を算出する工程と、を有し
前記位相情報を補正する工程では、前記ボケ量を前記計測空間の奥行き情報に変換し、該奥行き情報に対応する位相の次数を算出し、該次数に基づいて位相情報を補正し、
前記三次元形状を算出する工程では、補正された位相情報に基づいて前記計測対象の三次元形状を算出する
ことを特徴とする三次元形状計測方法。
Pattern projection means for projecting a pattern having periodicity onto a measurement space;
Imaging means for photographing the measurement space on which the pattern is projected,
The measurement space is defined by a reference plane, a projection range of the pattern projection unit, and an imaging range of the imaging unit, and the imaging unit images the measurement space so as to be focused on the reference plane, and the measurement space A three-dimensional shape measurement method using a three-dimensional shape measurement device for measuring a three-dimensional shape of a measurement target existing in
A phase information calculating unit calculating phase information of the pattern from a change in brightness of the pattern of the captured image obtained by the imaging unit;
A phase information correcting unit correcting the calculated phase information;
A step of calculating a blur amount of the pattern in the captured image;
When the relative positional relationship between the measurement target and the three-dimensional shape measurement apparatus does not change, the three-dimensional shape calculation unit calculates the three-dimensional shape of the measurement target based on the phase information and the amount of blur. It includes a step of, a,
In the step of correcting the phase information, the blur amount is converted into depth information of the measurement space, a phase order corresponding to the depth information is calculated, and the phase information is corrected based on the order,
In the step of calculating the three-dimensional shape, the three-dimensional shape of the measurement target is calculated based on the corrected phase information.
パターンを投影するパターン投影手段と、撮影手段とを備えるコンピュータを、請求項1乃至10のいずれか1項に記載の三次元形状計測装置の各手段として動作させるためのコンピュータプログラム。   The computer program for operating a computer provided with the pattern projection means which projects a pattern, and an imaging means as each means of the three-dimensional shape measuring apparatus of any one of Claim 1 thru | or 10. ランダム性を有するパターンを計測空間に投影するパターン投影手段と、Pattern projection means for projecting a random pattern onto the measurement space;
前記パターンが投影された計測空間を撮影する撮像手段とを備え、Imaging means for photographing the measurement space on which the pattern is projected,
前記計測空間は、基準面、前記パターン投影手段の投影範囲及び前記撮影手段の撮影範囲により規定され、前記撮像手段は、前記基準面で合焦するように前記計測空間を撮像し、前記計測空間に存在する計測対象の三次元形状を計測する三次元形状計測装置であって、The measurement space is defined by a reference plane, a projection range of the pattern projection unit, and an imaging range of the imaging unit, and the imaging unit images the measurement space so as to be focused on the reference plane, and the measurement space A three-dimensional shape measuring apparatus for measuring a three-dimensional shape of a measurement object existing in
前記撮影手段により得られた撮影画像の前記パターンの明るさ変化から前記パターンの複数の局所的な配置情報を算出する局所配置情報算出手段と、Local arrangement information calculating means for calculating a plurality of local arrangement information of the pattern from a change in brightness of the pattern of the captured image obtained by the imaging means;
前記撮影画像における前記パターンのボケ量を算出するボケ量算出手段と、A blur amount calculating means for calculating a blur amount of the pattern in the captured image;
前記計測対象と前記三次元形状計測装置との相対的な位置関係が変化しない場合に、前記複数の局所的な配置情報のうち前記ボケ量に基づき選択された1つの局所的な配置情報に基づいて前記計測対象の三次元形状を算出する三次元形状算出手段とを備えることを特徴とする三次元形状計測装置。Based on one local arrangement information selected based on the amount of blur among the plurality of local arrangement information when the relative positional relationship between the measurement object and the three-dimensional shape measurement apparatus does not change. And a three-dimensional shape calculating means for calculating the three-dimensional shape of the measurement object.
ランダム性を有するパターンを計測空間に投影するパターン投影手段と、Pattern projection means for projecting a random pattern onto the measurement space;
前記パターンが投影された計測空間を撮影する撮像手段とを備え、Imaging means for photographing the measurement space on which the pattern is projected,
前記計測空間は、基準面、前記パターン投影手段の投影範囲及び前記撮影手段の撮影範囲により規定され、前記撮像手段は、前記基準面で合焦するように前記計測空間を撮像し、前記計測空間に存在する計測対象の三次元形状を計測する三次元形状計測装置による三次元形状計測方法であって、The measurement space is defined by a reference plane, a projection range of the pattern projection unit, and an imaging range of the imaging unit, and the imaging unit images the measurement space so as to be focused on the reference plane, and the measurement space A three-dimensional shape measurement method using a three-dimensional shape measurement device for measuring a three-dimensional shape of a measurement target existing in
局所配置情報算出手段が、前記撮影手段により得られた撮影画像の前記パターンの明るさ変化から前記パターンの複数の局所的な配置情報を算出する局所配置情報算出工程と、A local arrangement information calculating step in which a local arrangement information calculating unit calculates a plurality of pieces of local arrangement information of the pattern from a change in brightness of the pattern of the captured image obtained by the imaging unit;
ボケ量算出手段が、前記撮影画像における前記パターンのボケ量を算出するボケ量算出工程と、A blur amount calculating step of calculating a blur amount of the pattern in the captured image;
三次元形状算出手段が、前記計測対象と前記三次元形状計測装置との相対的な位置関係が変化しない場合に、前記複数の局所的な配置情報のうち前記ボケ量に基づき選択された1つの局所的な配置情報に基づいて、前記計測対象の三次元形状を算出する三次元形状算出工程とWhen the relative positional relationship between the measurement object and the three-dimensional shape measurement device does not change, the three-dimensional shape calculation means selects one of the plurality of local arrangement information selected based on the blur amount A three-dimensional shape calculating step for calculating a three-dimensional shape of the measurement target based on local arrangement information;
を有することを特徴とする三次元形状計測方法。A three-dimensional shape measuring method characterized by comprising:
JP2010230098A 2010-10-12 2010-10-12 Three-dimensional shape measuring apparatus, three-dimensional shape measuring method, and computer program Active JP5595211B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010230098A JP5595211B2 (en) 2010-10-12 2010-10-12 Three-dimensional shape measuring apparatus, three-dimensional shape measuring method, and computer program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010230098A JP5595211B2 (en) 2010-10-12 2010-10-12 Three-dimensional shape measuring apparatus, three-dimensional shape measuring method, and computer program

Publications (3)

Publication Number Publication Date
JP2012083233A JP2012083233A (en) 2012-04-26
JP2012083233A5 JP2012083233A5 (en) 2013-11-28
JP5595211B2 true JP5595211B2 (en) 2014-09-24

Family

ID=46242249

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010230098A Active JP5595211B2 (en) 2010-10-12 2010-10-12 Three-dimensional shape measuring apparatus, three-dimensional shape measuring method, and computer program

Country Status (1)

Country Link
JP (1) JP5595211B2 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2728305B1 (en) * 2012-10-31 2016-06-29 VITRONIC Dr.-Ing. Stein Bildverarbeitungssysteme GmbH Method and light patterns for measuring the height or the height curve of an object
JP6254849B2 (en) * 2014-01-17 2017-12-27 キヤノン株式会社 Image processing apparatus and image processing method
KR101940936B1 (en) * 2014-09-11 2019-01-21 사이버옵틱스 코포레이션 Point cloud merging from multiple cameras and sources in three-dimensional profilometry
DE112017001464B4 (en) * 2016-03-22 2021-09-23 Mitsubishi Electric Corporation Distance measuring device and distance measuring method
US10337860B2 (en) * 2016-12-07 2019-07-02 Magik Eye Inc. Distance sensor including adjustable focus imaging sensor
JP7028623B2 (en) * 2017-12-07 2022-03-02 Ckd株式会社 3D measuring device
WO2023195394A1 (en) * 2022-04-05 2023-10-12 富士フイルム株式会社 Imaging assistance device, moving body, imaging assistance method, and program

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08136222A (en) * 1994-11-12 1996-05-31 Omron Corp Method and device for three-dimensional measurement
JP3595736B2 (en) * 1999-07-14 2004-12-02 株式会社オプトン Non-contact shape measurement method
JP4255865B2 (en) * 2003-03-31 2009-04-15 株式会社ミツトヨ Non-contact three-dimensional shape measuring method and apparatus
JP5252820B2 (en) * 2007-03-27 2013-07-31 パナソニック株式会社 3D measurement method and 3D shape measurement apparatus using the same
JP2009168789A (en) * 2008-01-15 2009-07-30 Hideo Fujii Three-dimensional shape measuring method and system
JP2010133840A (en) * 2008-12-05 2010-06-17 Nokodai Tlo Kk Shape measuring apparatus and shape measuring method
JP5395507B2 (en) * 2009-05-21 2014-01-22 キヤノン株式会社 Three-dimensional shape measuring apparatus, three-dimensional shape measuring method, and computer program

Also Published As

Publication number Publication date
JP2012083233A (en) 2012-04-26

Similar Documents

Publication Publication Date Title
JP5395507B2 (en) Three-dimensional shape measuring apparatus, three-dimensional shape measuring method, and computer program
JP5595211B2 (en) Three-dimensional shape measuring apparatus, three-dimensional shape measuring method, and computer program
JP5362087B2 (en) Method for determining distance information, method for determining distance map, computer apparatus, imaging system, and computer program
KR101233013B1 (en) Image photographing device, distance computing method for the device, and focused image acquiring method
KR20130032368A (en) Three-dimensional measurement apparatus, three-dimensional measurement method, and storage medium
JP2015203652A (en) Information processing unit and information processing method
JP7378219B2 (en) Imaging device, image processing device, control method, and program
US11512946B2 (en) Method and system for automatic focusing for high-resolution structured light 3D imaging
JP2014013144A (en) Three-dimensional shape measurement device, three-dimensional shape measurement method, structure manufacturing method and structure manufacturing system
JP2016080393A (en) Three-dimensional measuring device, three-dimensional measuring method, and program
US11812137B2 (en) Measurement apparatus, image capturing apparatus, control method, and recording medium
JP2012141206A (en) Three-dimensional measuring device, three-dimensional measurement method, and program
JP6700818B2 (en) Image processing device, imaging device, and image processing method
JP2010181247A (en) Shape measurement apparatus and shape measurement method
JP2017134561A (en) Image processing device, imaging apparatus and image processing program
JP2007322259A (en) Edge detecting method, apparatus and program
CN109741384B (en) Multi-distance detection device and method for depth camera
JP2012068176A (en) Three-dimensional shape measuring apparatus
WO2013035847A1 (en) Shape measurement device, structure manufacturing system, shape measurement method, structure manufacturing method, shape measurement program, and computer-readable recording medium
KR101465996B1 (en) Method for measurement of high speed 3d shape using selective long period
JP6381206B2 (en) Image processing apparatus, control method thereof, and program
JP6075835B2 (en) Distance information acquisition device, imaging device, distance information acquisition method, and program
JP2019083580A (en) Image processing apparatus, image processing method, and program
EP3070432B1 (en) Measurement apparatus
KR102040629B1 (en) Depth Extraction Apparatus Using Camera

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20131011

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20131011

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20140328

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20140411

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140606

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20140707

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140805

R151 Written notification of patent or utility model registration

Ref document number: 5595211

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151