Debian Codegraph @

raster/r.smooth.edgepreserve/r.smooth.edgepreserve.html

raw symbols SCIP
1 <h2>DESCRIPTION</h2>
2
3 <p>This module performs adaptive, edge-preserving raster smoothing
4 using anisotropic diffusion. The result is a denoised raster that
5 retains important features, especially edges. Unlike traditional
6 smoothing methods (such as a uniform average filter, like the one available
7 in <em>r.neighbors</em>), this module smooths only areas with similar values
8 and works to preserve sharp transitions between different regions.
9 An example is provided in the picture below: "A" is the original and
10 "B" is the smoothed version.</p>
11
12 <center>
13 <img src="r_smooth_edgepreserve.jpg" border="1" alt="An example of smoothed image">
14 </center>
15
16 <p>The module supports three types of diffusivity (conductance) functions:
17 <ul>
18 <li>Exponential</li>
19 <li>Quadratic <em>(both as proposed by Perona & Malik, 1990)</em></li>
20 <li>Tukey’s biweight <em>(as proposed by Black et al., 1998)</em></li>
21 </ul>
22
23 <p>The Tukey’s biweight function is more aggressive than the others and
24 tends to produce large, smoothly blended areas. This makes it
25 particularly useful for raster segmentation. If you prefer a gentler
26 effect that preserves smaller features, you can use the <em>-p</em> flag,
27 which switches to a softer variant of the Tukey function — ideal for
28 applications like visualization.</p>
29
30 <h3>PARAMETERS</h3>
31
32 <ul>
33 <li><em>threshold</em>
34 Defines how small a difference in raster values should be treated as
35 noise. The unit depends on the raster (e.g., digital numbers, meters,
36 etc.), and should be adjusted individually for each map.</li>
37 <li><em>lambda</em>
38 Controls the smoothing rate.
39 <ul>
40 <li>For <em>exponential</em> and <em>quadratic</em> functions,
41 the value is automatically clamped between <em>0</em> and
42 <em>0.25</em> for numeric stability.</li>
43 <li>For <em>Tukey</em>, the full range is used.</li>
44 </ul></li>
45 <li><em>steps</em>
46 Specifies the number of smoothing iterations. Higher values result
47 in stronger smoothing. Note that:
48 <ul>
49 <li>Excessive iterations can cause loss of fine detail.</li>
50 <li>Detail preservation improves in this order:
51 <em>quadratic</em> → <em>exponential</em> → <em>Tukey</em> →
52 <em>Tukey</em> with <em>-p</em> flag.</li>
53 </ul></li>
54 </ul>
55
56 <h2>NOTES</h2>
57
58 <p>Internally calculations are performed in double precision and only at the end
59 converted to the same type as the input map.</p>
60
61 <p>The module will try to keep all temporary data in RAM. Thus it is important
62 to set the <em>memory</em> parameter as high as possible. If the map does
63 not fit into RAM, a temporary file will be used instead.</p>
64
65 <p>The original Perona & Malik paper uses von Neumann (4-connected) neighbourhood for
66 value calculation, but this module uses Moore (8-connected) neighbourhood.
67 Computed gradients of neighbouring cells are adjusted to equalise distances for
68 diagonals and non-square cells.</p>
69
70 <h2>EXAMPLES</h2>
71
72 <div><pre class="code">
73 # Set computational region to orthophoto map
74 g.region raster=ortho_2001_t792_1m -p
75
76 # Smooth with average in a 3x3 window. Note how all edges have became blurry
77 # but at the same time streets and roofs are still noisy
78 r.neighbors input=ortho_2001_t792_1m output=ortho_smoothed_avg \
79 size=3 method=average
80
81 # Smooth with median in a 3x3 window. Although better than average smoothing,
82 # thin lines still are lost and noise on streets and roofs is still present.
83 r.neighbors input=ortho_2001_t792_1m output=ortho_smoothed_med \
84 size=3 method=median
85
86 # Smooth with quadratic diffusivity function. Note better preservation of
87 # small details and reduction of noise on streets and roofs.
88 r.smooth.edgepreserve function=quadratic input=ortho_2001_t792_1m \
89 output=ortho_smoothed_qa threshold=15 lambda=0.4 steps=20
90
91 # Smooth with exponential diffusivity function. Even better edge delineation
92 # but at the same time increase of noise in really noisy areas.
93 r.smooth.edgepreserve function=exponential input=ortho_2001_t792_1m \
94 output=ortho_smoothed_ex threshold=15 lambda=0.4 steps=20
95
96 # Smooth with aggressive Tukey's diffusivity function. Better preservation of
97 # minor details e.g. as road markings but little smoothing in areas with
98 # fine, well expressed texture.
99 r.smooth.edgepreserve function=tukey input=ortho_2001_t792_1m \
100 output=ortho_smoothed_ta threshold=15 lambda=0.4 steps=20
101
102 # Smooth with preserving Tukey's diffusivity function. Only low noise areas
103 # have been smoothed.
104 r.smooth.edgepreserve function=tukey input=ortho_2001_t792_1m \
105 output=ortho_smoothed_tp threshold=15 lambda=0.4 steps=20 -p
106 </pre></div>
107
108 <h2>SEE ALSO</h2>
109
110 Smooth with statistics: <em><a href="r.neghbours.html">r.neighbours</a></em><br>
111 The Mumford-Shah variational model for image segmentation (an add-on):
112 <em><a href="https://grass.osgeo.org/grass-stable/manuals/addons/r.smooth.seg.html">r.smooth.seg</a></em><br>
113
114 <h2>REFERENCES</h2>
115
116 <ul>
117 <li>
118 Perona P. and Malik J. 1990. Scale-space and edge detection using anisotropic
119 diffusion. <em>IEEE transactions on pattern analysis and machine intelligence</em>,
120 12(7).
121 </li>
122 <li>
123 Black M.J., Sapiro G., Marimont D.H. and Heeger D. 1998. Robust anisotropic
124 diffusion. <em>IEEE transactions on image processing</em>, 7(3).
125 </li>
126 </ul>
127
128 <h2>AUTHORS</h2>
129
130 Maris Nartiss, University of Latvia.