alsperGIS DATI
SOFTWARE



Average filters for SAGA


    SAGA GIS
Web site: http://www.saga-gis.org/
This is freeware software, developed in C++ language, very useful for Digital Elevation Model (DEM) analysis and processing.
The core (SAGA API) is distributed under the GNU Lesser General Public License (LGPL) while the Graphical User Interface (SAGA GUI) and a selection of useful modules are available under the GNU General Public License (GPL).



   My average filters (explanation for users)

In 2009 I created these filters for grids.
The modules are already included in the version 2.0.1 in "Modules > Contributions > A.Perego".
Newer versions: "Modules > Grid > Filter > Averages" or in the Manager Window > "Module Libraries > Grid - Filter (Perego 2009)"



Average with mask
It calculates the average with a rectangular kernel only for the cells specified in a mask grid.
AvWiMa1 calculates the average using only the cells included in the mask grid.
AvWiMa2 calculates the average only for the cells specified in a mask grid but using also the cells outside.

Input data and parameters:
- Input: the input grid.
- Mask Grid: grid used to specify what cells you want calculate the average.
- Mask Value: value in the mask grid which indicates the target cells.
- Radius X: horizontal dimension of the kernel used for the calculation.
- Radius Y: vertical dimension of the kernel.


Average with threshold
It calculates the average with a rectangular kernel using only cell values which differ from the central one less than the specified threshold.
In A2WiTh and A3WiTh the average is weighted. The weight is higher in the cells closer to the centre.

A2WiTh =   sum[ value * ( (radiusX - distanceX) + (radiusY - distanceY) ) ]   /   sum[ ( (radiusX - distanceX) + (radiusY - distanceY) ) ]

A3WiTh =   sum[ value * ( (radiusX - distanceX) * (radiusY - distanceY) ) ]   /   sum[ ( (radiusX - distanceX) * (radiusY - distanceY) ) ]

Input data and parameters:
- Input: the input grid.
- Radius X: horizontal dimension of the kernel used for the average calculation.
- Radius Y: vertical dimension of the kernel.
- Threshold: only cell values which differ from the central one less than this threshold are used in the calculation.


Directional average
It calculates the average along a specified direction.

Input data and parameters:
- Input: the input grid.
- Angle: direction of the average calculation; it’s measured in degrees counterclockwise from horizontal.
- Main Radius: dimension of the kernel along the filter direction.
- Transversal Radius: dimension of the kernel transversal to the filter direction.


Directional destriping
It removes straight parallel stripes in raster data.
It uses two low-pass filters elongated in the stripes direction; the first one is 1 pixel unit wide while the second one is wide as the striping wavelength. Their difference is the striping error which is removed from the original data to obtain the destriped DEM. This method is equivalent to that proposed by Oimoen (Oimoen, M.J., 2000. An Effective Filter For Removal Of Production Artifacts In U.S. Geological Survey 7.5-Minute Digital Elevation Models. Proceedings of the Fourteenth International Conference on Applied Geologic Remote Sensing, 6-8 November, Las Vegas, NV.).
With "destriping2" or "Destriping with Mask" you can choose a range of value (min-max) from the input grid and a range of value (Mask min - Mask max) from a mask grid to select the target cells.

Input data and parameters:
- Input: the input grid.
- Mask: mask grid (in destriping2).
- Angle: direction of the average calculation; it’s measured in degrees counterclockwise from horizontal.
- Radius: dimension of the kernel along the filter direction; should be the maximum stripe length you can measure (in pixel units).
- Stripes distance: distance between stripes / wavelength of striping (in pixel units).
- min (in destriping2).
- max (in destriping2).
- Mask min (in destriping2).
- Mask max (in destriping2).

>>> SRTM DEM destriping with SAGA: consequences on drainage network extraction.




    For developers: the source codes

These modules was created in “Scientific Developer Installation” of SAGA 2.0rc3 following the instructions on the SAGA web site and using Microsoft Visual C++ 2005 Express Edition on Windows XP.

 Average with mask:  .dll for Windows XP,  source code with C++ algorithm
 Average whit threshold:  .dll for Windows XP,  source code with C++ algorithm
 Directional average:  .dll for Windows XP,  source code with C++ algorithm
 Directional destriping:  .dll for Windows XP,  source code with C++ algorithm

Warning about source codes
In order to build the modules, in the .dsp file it was necessary to change
libpath:"$(SAGA)/bin/saga_vc_dbg" in libpath:"$(SAGA)/bin/saga_vc".





 

Releted topics

>>> SAGA (in italian)

>>> DEM (in italian)

>>> SRTM DEM destriping












Cookies
: questo sito contiene inserzioni pubblicitarie gestite da terze parti mediante cookies, anche di profilazione. Navigando in questo sito si acconsente all'uso di tali cookies.   >>> Maggiori informazioni


Aprile 2009 (rivisto nel 2015)
Alessandro Perego