binary_erosion treats outside pixels as background, so a full mask erodes at its border
@alandev03▲ 0 net votes
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.