Skip to main content

Stereo Matching

Stereo Matching は、左右の camera image の間で pixel-level correspondence を求め、disparity map を推定する task です。Stereo depth、robotics、autonomous driving、MVS の基礎になります。

Stereo geometry

Calibrated stereo camera では、左右 camera の baseline BB と focal length ff が既知です。Rectification 後の stereo pair では、対応点探索は同じ scanline 上の一次元探索になります。

Left image の pixel (u,v)(u, v) に対応する right image の pixel が (ud,v)(u - d, v) であるとき、dd が disparity です。Depth ZZ は次の式で得られます。

Z=fBdZ = \frac{fB}{d}

Disparity が大きい点ほど camera に近く、disparity が小さい点ほど遠くにあります。

Classical stereo matching

Classical stereo matching は、一般に次の流れで行われます。

stereo calibration
-> rectification
-> matching cost computation
-> cost aggregation
-> disparity optimization
-> post-processing / filtering

代表的な method には、Block Matching(BM)や Semi-Global Matching(SGM / SGBM)があります。OpenCV では StereoBMStereoSGBM が提供されています。

Learning-based stereo

Deep learning による stereo matching では、feature extraction と cost volume construction を neural network で行います。Cost volume は、candidate disparity ごとに左右 image の feature similarity を格納した volume です。

近年の method は、3D convolution、recurrent refinement、RAFT-like iterative update などを使って、sub-pixel 精度の disparity を推定します。

難しいケース

Stereo Matching は、次のような領域で難しくなります。

  • Textureless region
  • Repetitive pattern
  • Specular / transparent surface
  • Occlusion boundary
  • Thin structure
  • Large disparity
  • Calibration error
  • Exposure difference between cameras

Depth Estimation との関係

Stereo depth は、Stereo Matching で得た disparity を depth に変換することで得られます。Monocular depth と違い、calibration と baseline が正確であれば metric scale を直接得られる点が大きな利点です。

関連ページ

主なソース