extract_regions#

extract_regions(regions, labels: list, trim=True)[source]#

Combine given regions into a single boolean mask

Parameters:
  • regions (ndarray) – An image containing an arbitrary number of labeled regions

  • labels (array_like or scalar) – A list of labels indicating which region or regions to extract

  • trim (bool) – If True then image shape will trimmed to a bounding box around the given regions.

Returns:

im – A boolean mask with True values indicating where the given labels exist

Return type:

ndarray

Examples

Click here to view online example.