raster_tools.general.dilate#

raster_tools.general.dilate(raster, size)[source]#

Perform dilation on a raster

Dilation increases the thickness of raster features. Features with higher values will cover features with lower values. At each cell, the miximum 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 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 eroded features. This raster will have the same shape and meta data as the original

Return type

Raster

References

1

https://en.wikipedia.org/wiki/Dilation_%28morphology%29

2

https://en.wikipedia.org/wiki/Mathematical_morphology