PIXELBANKv8.2.1
Menu

Block Matching Disparity

HardCV

Implement block matching for stereo disparity estimation, a fundamental technique in stereo vision. This task involves finding the corresponding points between two images of the same scene taken from different viewpoints.

The concept of disparity is crucial here, as it represents the difference in the position of a point between the left and right images, given by xleftxrightx_{left} - x_{right}. This disparity is inversely proportional to the depth of the point in the scene.

  1. For each pixel in the left image, find the best matching block in the right image along the epipolar line, which for rectified images, is the same row.
  2. Calculate the disparity for each pixel based on the position of the best match.
d=xleftxrightd = x_{left} - x_{right}

This technique is widely used in depth estimation and 3D reconstruction applications.

Example:

Input:
Stereo pair
Output:
Disparity map
Reasoning:

For each pixel, minimize SSD along scanline

Constraints:

  • Input images: 2D numpy arrays (grayscale) with shape (height, width) and pixel values in [0, 255]
  • Block size: odd integer between 3 and 31
  • Disparity range: integer values between 0 and width // 2
  • Output disparity map: 2D numpy array with shape (height, width) and dtype uint16
  • The input images are assumed to be rectified, with the epipolar line being the same row for corresponding pixels
Editor

Test Results

0/0
Run code to see test results.