raster_tools.general.dilate#
- raster_tools.general.dilate(raster, size)[source]#
Perform dilation on a raster
Dilation increases the thickness of raster features 1. Features with higher values will cover features with lower values. At each cell, the maximum value within a window, defined by size, is stored in the output location. This is very similar to the max focal filter except that raster features are dilated (expanded) into null regions. Dilation is a mathematical morphology operation 2 and is performed on each band separately.
- Parameters
raster (Raster or path str) – The raster to dilate
size (int or 2-tuple of ints) – The shape of the window to use when dilating. 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 dilated features. This raster will have the same shape and meta data as the original
- Return type
See also
References