Main Content

Stereo Vision

Stereo camera calibration, rectification, disparity estimation, and dense 3-D reconstruction

Stereo vision enables depth estimation by comparing two views of the same scene. The output of this computation is a 3-D point cloud where each point corresponds to a matched pixel in one of the images. The workflow begins with stereo camera calibration, which estimates intrinsic and extrinsic parameters using the Stereo Camera Calibrator app. Once calibrated, stereo image rectification aligns image pairs onto a common plane, simplifying correspondence matching for disparity estimation. For an introduction, see Using the Stereo Camera Calibrator App. To perform stereo rectification on uncalibrated images, see Uncalibrated Stereo Image Rectification.

You can compute disparity maps using classical algorithms such as block matching or semi-global matching. Then, you can use the disparity maps to perform dense 3-D scene reconstruction by applying geometric principles like triangulation and epipolar geometry. For more information, see Reconstruct 3-D Scene from Stereo Image Pair Using Semi-Global Matching and Compare RAFT Optical Flow and Semi-Global Matching for Stereo Reconstruction.

Stereo vision also enables advanced applications such as visual SLAM and real-world distance measurements. For more information, see Stereo Visual SLAM for UAV Navigation in 3D Simulation and Measure Real-World Distances to Objects Using a Stereo-Camera.

Stereo Vision Capabilities Overview

Apps

Stereo Camera CalibratorEstimate geometric parameters of a stereo camera

Functions

expand all

estimateCameraParametersCalibrate a single or stereo camera
estimateStereoBaselineEstimate baseline of stereo camera
stereoParametersObject for storing stereo camera system parameters
stereoCalibrationErrorsObject for storing standard errors of estimated stereo parameters
undistortImageCorrect image for lens distortion
undistortPointsCorrect point coordinates for lens distortion
disparityBMCompute disparity map using block matching
disparitySGMCompute disparity map through semi-global matching
rectifyStereoImagesRectify pair of stereo images
estimateStereoRectificationUncalibrated stereo rectification (Since R2022b)
reconstructSceneReconstruct 3-D scene from disparity map
triangulate3-D locations of undistorted matching points in stereo images
epipolarLineCompute epipolar lines for stereo images
isEpipoleInImageDetermine whether image contains epipole
lineToBorderPointsIntersection points of lines in image and image border
showReprojectionErrorsVisualize calibration errors
showExtrinsicsVisualize extrinsic camera parameters
stereoAnaglyphCreate red-cyan anaglyph from stereo pair of images
pcshowPlot 3-D point cloud
plotCameraPlot camera in 3-D coordinates
stereoParametersFromOpenCVConvert stereo camera parameters from OpenCV to MATLAB (Since R2021b)
stereoParametersToOpenCVConvert stereo camera parameters from MATLAB to OpenCV (Since R2021b)
rotmat2vec3dConvert 3-D rotation matrix to rotation vector (Since R2022b)
rotvec2mat3dConvert 3-D rotation vector to rotation matrix (Since R2022b)

Topics

Featured Examples