machinevisiontoolbox.Image.stereo_simple

Image.stereo_simple(right, hw, drange)

Simple stereo matching

Parameters:
  • right (Image) – right image

  • hw (int) – window half width

  • drange (array_like(2)) – disparity range

Returns:

disparity image, similarity image, disparity space image

Return type:

Image, Image, ndarray(H,W,D)

This is a simple stereo matching implementation for pedagogical purposes. It returns:

  • the disparity image, same size as input images, whose elements give the integer disparity (in pixels) of the corresponding point in the left image.

  • the similarity image, same size as input images, whose elements give the strength of the stereo match. This is a ZNCC measure where 1 is a perfect match, greater than 0.8 is a decent match.

  • the disparity space image, a 3D array, whose first two dimensions are the same size as the input imagesm and whose third dimension is the number of disparities. Each fibre DSI[v,u,:] is window similarity versus disparity.

Example:

>>> rocks_l = Image.Read("rocks2-l.png", reduce=2)
>>> rocks_r = Image.Read("rocks2-r.png", reduce=2)
>>> disparity, similarity, DSI = rocks_l.stereo_simple(rocks_r, hw=3, drange=[40, 90])
Note:

The images are assumed to be epipolar aligned.

References:
  • Robotics, Vision & Control for Python, Section 14.4, P. Corke, Springer 2023.

Warning

Not fast.

Seealso:

DSI_refine stereo_BM stereo_SGBM