erode5x5#

rlemasklib.RLEMask.erode5x5(inplace=False)[source]#

Erode a mask with a round 5x5 kernel.

The kernel is 0 in the four corners, otherwise 1:

Kernel:

At the image border, pixels are treated as if the mask was extended by replicating the edge values. This means foreground pixels touching the border can survive erosion.

Parameters:

inplace (bool) – 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

A rounded 9x9 shape erodes to a 5x5 rectangle:

.erode5x5() ==

See also

erode() for arbitrary kernel shapes. erode3x3() for a 3x3 kernel.