dilate3x3#
- rlemasklib.RLEMask.dilate3x3(connectivity=4, inplace=False)[source]#
Dilate a mask with a 3x3 kernel.
After dilation, all pixels that were foreground before remain foreground and additionally any pixel with at least one foreground neighbor (according to the specified connectivity, 4-way or 8-way) becomes also foreground.
The kernel shape depends on connectivity:
connectivity=4: connectivity=8:At the image border, pixels are treated as if the mask was extended by replicating the edge values. This means dilation does not extend beyond the image boundary.
- Parameters:
- Returns:
The RLEMask object representing the dilated mask (self if inplace=True)
- Return type:
Examples
A single pixel dilates into the kernel shape:
.dilate3x3(connectivity=4) ==.dilate3x3(connectivity=8) ==See also
dilate()for arbitrary kernel shapes.dilate5x5()for a 5x5 kernel.