Realm

oa::image::stereo_bm

Block-matching stereo disparity over the horizontal search range [0, num_disparities), following cv::StereoBM. The stereo_sad pass builds a [planes, num_disparities, H, W] sum-of-absolute-differences volume over an odd block_size window; stereo_wta then keeps the per-pixel argmin, applies the uniqueness percent runner-up margin test (0 disables), and refines the winner with a symmetric parabola on the neighbouring costs. Pixels outside the border region where the matching window fits for every disparity, and uniqueness losers, are marked -1; the valid range otherwise starts at 0. Returns the F32 [planes, 1, H, W] disparity map. Errors Returns an error unless both images are nonempty FP32 NCHW/CHW images with identical shape, layout, and format, num_disparities >= 1, block_size is odd and >= 3, and the image fits the combined block and disparity support.

FnRust public API

Function Documentation

pub fn stereo_bm( left: &Image, right: &Image, num_disparities: u32, block_size: u32, uniqueness: u32 ) -> Result<Matrix>
Block-matching stereo disparity over the horizontal search range [0, num_disparities), following cv::StereoBM. The stereo_sad pass builds a [planes, num_disparities, H, W] sum-of-absolute-differences volume over an odd block_size window; stereo_wta then keeps the per-pixel argmin, applies the uniqueness percent runner-up margin test (0 disables), and refines the winner with a symmetric parabola on the neighbouring costs. Pixels outside the border region where the matching window fits for every disparity, and uniqueness losers, are marked -1; the valid range otherwise starts at 0. Returns the F32 [planes, 1, H, W] disparity map. Errors Returns an error unless both images are nonempty FP32 NCHW/CHW images with identical shape, layout, and format, num_disparities >= 1, block_size is odd and >= 3, and the image fits the combined block and disparity support.