machinevisiontoolbox.Image.stereo_SGBM
- Image.stereo_SGBM(right, hw, drange, speckle=None)
Stereo semi-global 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 semi-global 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_SGBM(rocks_r, hw=3, drange=[40, 90], speckle=(200, 2))
- Note:
The images are assumed to be epipolar aligned.
- References:
Stereo processing by semiglobal matching and mutual information, Heiko Hirschmuller, IEEE Transactions on Pattern Analysis and Machine Intelligence, 30(2):328–341, 2008.
Robotics, Vision & Control for Python, Section 14.4.2.7, P. Corke, Springer 2023.
- Seealso: