machinevisiontoolbox.Image.stereo_BM
- Image.stereo_BM(right, hw, drange, speckle=None)
Stereo block matching
- Parameters:
right (
Image
) – right imagehw (int) – window half width
drange (array_like(2)) – disparity range
speckle (array_like(2), optional) – speckle filter parameters, defaults to None
- Raises:
ValueError – block size too small
- Returns:
disparity image
- Return type:
Image
This is an efficient block-matching stereo implementation. It returns the disparity image, same size as input images, whose elements give the subpixel-interpolated disparity (in pixels) of the corresponding point in the left image.
Speckle are small regions of anomalous disparity. A speckle is defined as less than A pixels with disparity variation less than V, and the filter parameters are (A, V). The disparity values within a detected speckle are set to that of its enclosing region.
Example:
>>> rocks_l = Image.Read("rocks2-l.png", reduce=2) >>> rocks_r = Image.Read("rocks2-r.png", reduce=2) >>> disparity = rocks_l.stereo_BM(rocks_r, hw=3, drange=[40, 90], speckle=(200, 2))
- Note:
The images are assumed to be epipolar aligned.
- References:
Robotics, Vision & Control for Python, Section 14.4.2.7, P. Corke, Springer 2023.
- Seealso: