From bddc8d055c3f5760bb3b8911fe638ebe9d7c5420 Mon Sep 17 00:00:00 2001 From: Maximilian Denninger Date: Wed, 21 Sep 2022 16:21:31 +0200 Subject: [PATCH] doc(postprocessing): add docu to semantic segmentation fct --- blenderproc/python/camera/LensDistortionUtility.py | 1 - .../python/postprocessing/PostProcessingUtility.py | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/blenderproc/python/camera/LensDistortionUtility.py b/blenderproc/python/camera/LensDistortionUtility.py index 8c56039d3..f295c9e2a 100644 --- a/blenderproc/python/camera/LensDistortionUtility.py +++ b/blenderproc/python/camera/LensDistortionUtility.py @@ -147,7 +147,6 @@ def set_lens_distortion(k1: float, k2: float, k3: float = 0.0, p1: float = 0.0, raise Exception("The iterative distortion algorithm is unstable.") # update undistorted projection - # this can not be changed to x -=, for whatever reasons x -= x_ - P_und[0, :] # * factor y -= y_ - P_und[1, :] # * factor diff --git a/blenderproc/python/postprocessing/PostProcessingUtility.py b/blenderproc/python/postprocessing/PostProcessingUtility.py index 40f4618bf..f2ab540d4 100644 --- a/blenderproc/python/postprocessing/PostProcessingUtility.py +++ b/blenderproc/python/postprocessing/PostProcessingUtility.py @@ -282,6 +282,15 @@ def semantic_segmentation_mapping(image: Union[List[np.ndarray], np.ndarray], map_by: Union[str, List[str]], default_values: Optional[Dict[str, int]]) \ -> Dict[str, Union[np.ndarray, List[np.ndarray], List[Dict[str, Any]]]]: + """ Maps an image or a list of images to the desired segmentation images plus segmentation dictionary for keys, + which can not be stored in an image (e.g. `name`). + + :param image: A list or single image of a scene, must contain the pass indices defined in + `enable_segmentation_output`. + :param map_by: The keys which will be extracted from the objects, either a single key or a list of keys. + :param default_values: If an object does not provide a key a default key must be provided. + :return: A dict mapping each key in map_by to an output list of images or a dictionary containing the information + """ return_dict: Dict[str, Union[np.ndarray, List[np.ndarray], List[Dict[str, Any]]]] = {} is_stereo_case = bpy.context.scene.render.use_multiview