blenderproc.python.postprocessing.StereoGlobalMatching module¶
-
class
blenderproc.python.postprocessing.StereoGlobalMatching.
StereoGlobalMatching
[source]¶ Bases:
object
-
static
_sgm
(left_color_image, right_color_image, baseline, depth_max, focal_length, window_size=7, num_disparities=32, min_disparity=0, disparity_filter=True, depth_completion=True)[source]¶ Semi global matching funciton, for more details on what this function does check the original paper https://elib.dlr.de/73119/1/180Hirschmueller.pdf
Parameters: - left_color_image (
ndarray
) – The left color image. - right_color_image (
ndarray
) – The right color image. - baseline (
float
) – The baseline that was used for rendering the two images. - depth_max (
float
) – The maximum depth value for clipping the resulting depth values. - focal_length (
float
) – The focal length that was used for rendering the two images. - window_size (
int
) – Semi-global matching kernel size. Should be an odd number. - num_disparities (
int
) – Semi-global matching number of disparities. Should be > 0 and divisible by 16. - min_disparity (
int
) – Semi-global matching minimum disparity. - disparity_filter (
bool
) – Applies post-processing of the generated disparity map using WLS filter. - depth_completion (
bool
) – Applies basic depth completion using image processing techniques.
Return type: Tuple
[ndarray
,ndarray
]Returns: depth, disparity
- left_color_image (
-
static
-
blenderproc.python.postprocessing.StereoGlobalMatching.
stereo_global_matching
(color_images, depth_max=None, window_size=7, num_disparities=32, min_disparity=0, disparity_filter=True, depth_completion=True)[source]¶ Does the stereo global matching in the following steps: 1. Collect camera object and its state, 2. For each frame, load left and right images and call the sgm() methode. 3. Write the results to a numpy file.
Parameters: - color_images (
List
[ndarray
]) – A list of stereo images, where each entry has the shape [2, height, width, 3]. - depth_max (
Optional
[float
]) – The maximum depth value for clipping the resulting depth values. If None, distance_start + distance_range that were configured for distance rendering are used. - window_size (
int
) – Semi-global matching kernel size. Should be an odd number. - num_disparities (
int
) – Semi-global matching number of disparities. Should be > 0 and divisible by 16. - min_disparity (
int
) – Semi-global matching minimum disparity. - disparity_filter (
bool
) – Applies post-processing of the generated disparity map using WLS filter. - depth_completion (
bool
) – Applies basic depth completion using image processing techniques.
Return type: Returns: Returns the computed depth and disparity images for all given frames.
- color_images (