raster_tools.general.erode#
- raster_tools.general.erode(raster, size)[source]#
Perform erosion on a raster
Erosion decreases the thickness of raster features 1. Features with lower values will cover features with higher values. At each cell, the minimum value within a window, defined by size, is stored in the output location. This is very similar to the min focal filter except that raster features are eroded (contracted) into null regions. Erosion is a mathematical morphology operation 2 and is performed on each band separately.
- Parameters
raster (Raster or path str) – The raster to erode
size (int or 2-tuple of ints) – The shape of the window to use when eroding. A Single int is interpreted as the size of a square window. A tuple of 2 ints is used as the dimensions of rectangular window. At least one value must be greater than 1. Values cannot be less than 1.
- Returns
The resulting raster with eroded features. This raster will have the same shape and meta data as the original
- Return type
See also
References