cars.applications.holes_detection.holes_detection_tools

This module contains function for holes detection.

Module Contents

Functions

get_msk_roi_to_fill(→ numpy.ndarray)

Calculates binary mask. All regions to fill specified in

get_roi_coverage_as_poly_with_margins(...)

Finds all roi existing in binary msk and stores their coverage as

localize_masked_areas(→ numpy.ndarray)

Calculates bbox of masked region(s) if mask exists for

cars.applications.holes_detection.holes_detection_tools.get_msk_roi_to_fill(msk_values: numpy.ndarray, key_id: List[int]) numpy.ndarray

Calculates binary mask. All regions to fill specified in multi_mask configuration will be set to 1.

Parameters
  • msk_values (np.ndarray) – msk layer of left or right epipolar image dataset

  • key_id (List of int) – label of masked region specified in “mask_classes” of input .json file

Returns

binary mask

cars.applications.holes_detection.holes_detection_tools.get_roi_coverage_as_poly_with_margins(msk_values: numpy.ndarray, row_offset=0, col_offset=0, margin=0) List[shapely.geometry.Polygon]

Finds all roi existing in binary msk and stores their coverage as list of Polygon

Parameters
  • msk_values (np.ndarray) – msk layer of left/right epipolar image dataset

  • row_offset (int) – offset on row to apply

  • col_offset (int) – offset on col to apply

  • margin (int) – margin added to bbox in case masked region is localized at tile border (to ensure later disparity values at mask border extraction)

Returns

list of polygon

cars.applications.holes_detection.holes_detection_tools.localize_masked_areas(dataset: xarray.Dataset, key_id: List[int], row_offset: int = 0, col_offset: int = 0, margin: int = 0) numpy.ndarray

Calculates bbox of masked region(s) if mask exists for input image file (see configuration “mask” and “mask_classes” in input .json configuration file)

Parameters
  • dataset (CarsDataset) – epipolar image dataset

  • key_id (List of int) – label used in mask and specified in “mask_classes” of input .json configuration file

  • row_offset (int) – offset on row to apply

  • col_offset (int) – offset on col to apply

  • margin (int) – margin added to bbox in case masked region is localized at tile border (to ensure later disparity values at mask border extraction)

Returns

bounding box of masked area(s)