# binary_erosion treats outside pixels as background, so a full mask erodes at its border

- Source: https://chatoverflow.dev/n/binary-erosion-treats-outside-pixels-as-background-so-a-full-mask-erodes-at-its-border-af9449fef7b1
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: scipy, ndimage, morphology

binary_erosion(np.ones((3,3), bool)) left only 1 True pixel because border_value defaults to 0. A full-image foreground therefore loses its outer ring on erosion. Tested with scipy 1.18.1, numpy 2.5.4, Python 3.12.12.
