r.smooth.edgepreserve(1)
π r.smooth.edgepreserve β the GRASS User's Manual, but make it make sense π
okay so bestie, welcome to r.smooth.edgepreserve π this is one of those GRASS raster modules and honestly? she's a little bit iconic. no cap. let's get into it β¨
β¨ NAME β¨
r.smooth.edgepreserve β smoothing with anisotropic diffusion π¦
(like, smoothing but the smart kind, the kind that doesn't mush your edges into soup. iykyk πΈ)
π KEYWORDS π
raster, smoothing, edge detection, parallel, denoise π
π«Ά SYNOPSIS π«Ά
so the whole vibe in code form is:
r.smooth.edgepreserve
r.smooth.edgepreserve --help
r.smooth.edgepreserve [-p] input=name output=name threshold=float
lambda=float steps=integer function=string [memory=memory in MB]
[nprocs=integer] [--overwrite] [--help] [--verbose] [--quiet]
[--ui]
π Flags π
-pβ preserve details with Tukey π (the gentle-girl setting, we'll get to her)--overwriteβ allow output files to overwrite existing files. literally permission to be a little destructive π--helpβ print usage summary π«Ά--verboseβ verbose module output, she tells you everything--quietβ quiet module output, she says nothing, mysterious queen--uiβ force launching GUI dialog β¨ (graphical era)
π§ Parameters π§
input=name[required] β name of input raster map. your raw material, your main character πoutput=name[required] β name for output raster map. where the glow-up lands πthreshold=float[required] β gradient magnitude threshold (in map units). Options:0.000000001-. Default:5βlambda=float[required] β rate of diffusion. Options:0-1. Default:0.1πsteps=integer[required] β number of diffusion steps. Options:1-. Default:10π₯function=string[required] β diffusivity function. Options:exponential,quadratic,tukey. Default:tukeyπmemory=memory in MBβ maximum memory to be used (in MB). cache size for raster rows. Default:300πnprocs=integerβ number of threads for parallel computing.0: use OpenMP default;>0: use nprocs;<0: use MAX-nprocs. Default:0β‘
π DESCRIPTION π
so what does she actually do, you ask? π«Ά this module performs adaptive, edge-preserving raster smoothing using anisotropic diffusion. the result is a denoised raster that retains important features, especially edges. π
and like β this is the whole point β unlike traditional smoothing methods (such as a uniform average filter, like the one available in r.neighbors), this module smooths only areas with similar values and works to preserve sharp transitions between different regions. so she's not out here blurring everything indiscriminately, she's got taste. an example is provided in the picture below: "A" is the original and "B" is the smoothed version. π¦
the module supports three types of diffusivity (conductance) functions:
- Exponential
- Quadratic (both as proposed by Perona & Malik, 1990)
- Tukey's biweight (as proposed by Black et al., 1998)
the Tukey's biweight function is more aggressive than the others and tends to produce large, smoothly blended areas. this makes it particularly useful for raster segmentation. π if you prefer a gentler effect that preserves smaller features, you can use the -p flag, which switches to a softer variant of the Tukey function β ideal for applications like visualization. β¨
π PARAMETERS π
thresholdβ defines how small a difference in raster values should be treated as noise. the unit depends on the raster (e.g., digital numbers, meters, etc.), and should be adjusted individually for each map. π no universal setting, bestie, she's bespoke.lambdaβ controls the smoothing rate. πΈ- For
exponentialandquadraticfunctions, the value is automatically clamped between0and0.25for numeric stability. (she will not let you hurt her π₯) - For Tukey, the full range is used. π
- For
stepsβ specifies the number of smoothing iterations. higher values result in stronger smoothing. note that:- Excessive iterations can cause loss of fine detail. π (yes queen, too much of a good thing)
- Detail preservation improves in this order:
quadraticβexponentialβtukeyβtukeywith-pflag. β
π NOTES π
- Internally calculations are performed in double precision and only at the end converted to the same type as the input map. π§ precision princess behavior.
- The module will try to keep all temporary data in RAM. thus it is important to set the
memoryparameter as high as possible. π if the map does not fit into RAM, a temporary file will be used instead. π«Ά - The original Perona & Malik paper uses von Neumann (4-connected) neighbourhood for value calculation, but this module uses Moore (8-connected) neighbourhood. Computed gradients of neighbouring cells are adjusted to equalise distances for diagonals and non-square cells. π¦ yes she upgraded the neighbourhood, we love a glow-up.
π₯ EXAMPLES π₯
okay this is the part where she SHOWS you. copy these, they're exact, do not touch them π
# Set computational region to orthophoto map
g.region raster=ortho_2001_t792_1m -p
# Smooth with average in a 3x3 window. Note how all edges have became blurry
# but at the same time streets and roofs are still noisy
r.neighbors input=ortho_2001_t792_1m output=ortho_smoothed_avg \
size=3 method=average
# Smooth with median in a 3x3 window. Although better than average smoothing,
# thin lines still are lost and noise on streets and roofs is still present.
r.neighbors input=ortho_2001_t792_1m output=ortho_smoothed_med \
size=3 method=median
# Smooth with quadratic diffusivity function. Note better preservation of
# small details and reduction of noise on streets and roofs.
r.smooth.edgepreserve function=quadratic input=ortho_2001_t792_1m \
output=ortho_smoothed_qa threshold=15 lambda=0.4 steps=20
# Smooth with exponential diffusivity function. Even better edge delineation
# but at the same time increase of noise in really noisy areas.
r.smooth.edgepreserve function=exponential input=ortho_2001_t792_1m \
output=ortho_smoothed_ex threshold=15 lambda=0.4 steps=20
# Smooth with aggressive Tukeyβs diffusivity function. Better preservation of
# minor details e.g. as road markings but little smoothing in areas with
# fine, well expressed texture.
r.smooth.edgepreserve function=tukey input=ortho_2001_t792_1m \
output=ortho_smoothed_ta threshold=15 lambda=0.4 steps=20
# Smooth with preserving Tukeyβs diffusivity function. Only low noise areas
# have been smoothed.
r.smooth.edgepreserve function=tukey input=ortho_2001_t792_1m \
output=ortho_smoothed_tp threshold=15 lambda=0.4 steps=20 -p
like, the r.neighbors ones are the cautionary tales bestie π the r.smooth.edgepreserve ones are the ate-that moments π₯
π¦ SEE ALSO π¦
- Smooth with statistics:
r.neighbours - The Mumford-Shah variational model for image segmentation (an add-on):
r.smooth.segβ¨
π REFERENCES π
- Perona P. and Malik J. 1990. Scale-space and edge detection using anisotropic diffusion. IEEE transactions on pattern analysis and machine intelligence, 12(7).
- Black M.J., Sapiro G., Marimont D.H. and Heeger D. 1998. Robust anisotropic diffusion. IEEE transactions on image processing, 7(3).
(academic queens, cite them or it didn't happen π)
π AUTHORS π
Maris Nartiss, University of Latvia. π«Ά iconic.
β SOURCE CODE β
Available at: r.smooth.edgepreserve source code (history)
Accessed: Saturday Oct 31 11:08:35 2026
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual
okay and that's the whole page bestie π one last thing, the very bottom of the og page says GRASS 8.5.0 on the left and r.smooth.edgepreserve(1) on the right β that's the version + date footer situation, so like. it's GRASS 8.5.0, the manual page is r.smooth.edgepreserve(1), and the date vibes are Saturday Oct 31 11:08:35 2026. slay πΈπ
π
π¦ where this page comes from
- nixos 26.05: grass 8.5.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms