Applies a Gaussian smoothing filter to reduce noise while better preserving image features compared to a simple mean filter.
Arguments
- x
Raster object of class WhiteboxRaster. See
wbw_read_raster()
for more details.- sigma
double
, standard deviation distance parameter in units of grid cells. Should be in the range 0.5-20.
Value
WhiteboxRaster object containing filtered values
Details
The filter applies a 2D Gaussian kernel that weights pixels based on their distance from the center. This gradual weighting makes it more effective for noise reduction than the mean filter. The filter size is controlled by the sigma parameter (0.5-20 grid cells).
References
For more information, see https://www.whiteboxgeo.com/manual/wbw-user-manual/book/tool_help.html#gaussian_filter
Examples
f <- system.file("extdata/dem.tif", package = "wbw")
wbw_read_raster(f) |>
wbw_gaussian_filter(sigma = 1.5)
#> +-----------------------------------------------+
#> | WhiteboxRaster |
#> | dem.tif |
#> |...............................................|
#> | bands : 1 |
#> | dimensions : 726, 800 (nrow, ncol) |
#> | resolution : 5.002392, 5.000243 (x, y) |
#> | EPSG : 2193 (Linear_Meter) |
#> | extent : 1925449 1929446 5582091 5585717 |
#> | min value : 65.599586 |
#> | max value : 358.003418 |
#> +-----------------------------------------------+