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 と focal length が既知です。Rectification 後の stereo pair では、対応点探索は同じ scanline 上の一次元探索になります。
Left image の pixel に対応する right image の pixel が であるとき、 が disparity です。Depth は次の式で得られます。
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 では StereoBM と StereoSGBM が提供されています。
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 を直接得られる点が大きな利点です。
関連ページ
主なソース
- OpenCV StereoMatcher documentation: https://docs.opencv.org/master/d2/d6e/classcv_1_1StereoMatcher.html
- OpenCV disparity / depth map tutorial: https://docs.opencv.org/4.x/dd/d53/tutorial_py_depthmap.html
- Hirschmüller, “Stereo Processing by Semi-Global Matching and Mutual Information”, 2005: https://ieeexplore.ieee.org/document/1467526
- Middlebury Stereo benchmark: https://vision.middlebury.edu/stereo/
- KITTI Stereo benchmark: https://www.cvlibs.net/datasets/kitti/eval_scene_flow.php?benchmark=stereo