cars.conf.mask_classes

CARS mask classes module

Module Contents

Functions

check_mask_classes(mask_classes_dict)

Check if mask classes use protected key,

is_multiclasses_mask(→ bool)

Check if the mask has several classes.

create_msk_from_classes(→ numpy.ndarray)

Create a mask of type out_msk_dtype set to the out_msk_pix_value for pixels

Attributes

VALID_VALUE

NO_DATA_IN_EPIPOLAR_RECTIFICATION

PROTECTED_VALUES

ignored_by_corr_tag

set_to_ref_alt_tag

ignored_by_sift_matching_tag

cars.conf.mask_classes.VALID_VALUE = 0
cars.conf.mask_classes.NO_DATA_IN_EPIPOLAR_RECTIFICATION = 255
cars.conf.mask_classes.PROTECTED_VALUES
cars.conf.mask_classes.ignored_by_corr_tag = 'ignored_by_correlation'
cars.conf.mask_classes.set_to_ref_alt_tag = 'set_to_ref_alt'
cars.conf.mask_classes.ignored_by_sift_matching_tag = 'ignored_by_sift_matching'
cars.conf.mask_classes.check_mask_classes(mask_classes_dict: dict)

Check if mask classes use protected key, and logs a warning

Parameters

mask_classes_dict – dictionary of the mask classes to use in CARS

cars.conf.mask_classes.is_multiclasses_mask(msk: numpy.ndarray) bool

Check if the mask has several classes. The VALID_VALUE and all protected values defined in the PROTECTED_VALUES mask module global variable are not taken into account.

Parameters

msk – mask to test

Returns

True if the mask has several classes, False otherwise

cars.conf.mask_classes.create_msk_from_classes(mc_msk: numpy.ndarray, classes_to_use: List[int], out_msk_pix_value: int = 255, out_msk_dtype: numpy.dtype = np.uint16, mask_intern_no_data_val: bool = False) numpy.ndarray

Create a mask of type out_msk_dtype set to the out_msk_pix_value for pixels belonging to the required classes (defined by the classes_to_use parameter) in the multi-classes mask in input.

The NO_DATA_IN_EPIPOLAR_RECTIFICATION value is added to the classes to mask if the add_intern_no_data_val parameter is set to True.

Parameters
  • mc_msk – multi-classes mask

  • classes_to_use – List of values to use to create the output mask

  • out_msk_pix_value – pixel value to assign to the output mask in the locations of the required classes’ pixels. If the out_msk_dtype parameter is set to bool, this parameter will be automatically set to True.

  • out_msk_dtype – numpy dtype of the output mask

Returns

the output mask