erode#

rlemasklib.RLEMask.erode(kernel_shape='circle', kernel_size=7, inplace=False)[source]#

Erode a mask with a kernel of a given shape and size.

Parameters:
  • kernel_shape – the shape of the kernel, either ‘circle’ or ‘square’

  • kernel_size – the size of the kernel

  • inplace – whether to perform the operation in place or to return a new object

Returns:

The RLEMask object representing the eroded mask (self if inplace=True)

Return type:

RLEMask

Examples

Erode with a circular kernel of size 5:

.erode(kernel_shape='circle', kernel_size=5) ==

See also

erode3x3() for a 3x3 kernel. erode5x5() for a 5x5 kernel. dilate()