Home

Awesome

fp_denoise

Description

fp_denoise is a command-line program for performing feature-preserving de-noising, intented for application with raster digital elevation models (DEMs). It is a modified implementation of Sun's 2007 (Fast and Effective Feature-Preserving Mesh Denoising) de-noising algorithm. The algorithm has been developed using the Nim programming language. The implementation has been modified in the following ways:

These modifications generally result in more efficient denoising. The algorithm has been demonstrated to work well with fine-resolution LiDAR data. Note that the input DEM should be in a projected coordinate system (e.g. UTM) and in a Whitebox GAT or ArcGIS ASCII raster format.

The general workflow of the method is divided into three components:

  1. A normal vector is calculated for each grid cell in the input DEM based on the eight neighbouring cells in the 3 x 3 neighbourhood.

  2. The normal vector field is smoothed using a low-pass filtering technique that preserves features, or breaks in slope, by excluding neighbours that have differences in normal vectors from the centre-cell vector by more than a user-specified threshold. The size of the convolution filter kernel is also specified by the user. In addition to excluding neighbours with differences in normal vector angle larger than the specified threshold, if the optional hillslope image is input, then neighbours with hillslope ID values different from that of the centre cell will be excluded during the smoothing process. This ensures that smoothing does not occur across channels and drainage divides.

  3. The smoothed normal vector field is used to update the elevations in the output DEM using an iterative process.

Although the algorithm, like Sun's mdenoise, is currently single-threaded, there is potential to parallelize Steps 1 and 2 in the above workflow. Future versions will likely add this feature to further enhance algorithm efficiency.

Installing

After downloading the source code in the repository and installing the Nim compiler on your computer, open a terminal (command prompt), change the working directory to the folder containing the source code and type the following:

>> nim c -d:release fp_denoise.nim

Usage

flagDescription
--wdWorking directory; appended to input/output file names
-i, --inputInput DEM file name
-o, --outputOutput DEM file name
--hillslope, --hsOptional input hillslope raster file name
--thresholdThreshold value in degrees (1.0 - 85.0)
--filterFilter size for normal smoothing (odd value >3)
--iterationsNumber of iterations used for elevation updating
--shaded_relief, --srOptional output hillshade image file name
-mIf this flag is present, a simple mean filter is used
-hHelp

Example usage at command line prompt (>>):

>> ./fp_denoise --wd="/path/to/data/" -i="DEM file.dep" -o=output.dep --hs=hillslopes.dep --threshold=20.0 --filter=5 --iterations=8 --sr=shaded_relief.dep

Here is a sample of the effect of running the tool on a fine-resolution LiDAR DEM:

Original unfiltered LiDAR DEM

De-noised LiDAR DEM

The above image is the hillshade image derived from the de-noised DEM using a threshold of 20-degrees, a 13 grid cell filter size, and 5 iterations of elevation updating. And here are some more detailed images:

Detailed original unfiltered LiDAR DEM

Detailed de-noised LiDAR DEM

Licence

The MIT License (MIT)

References

Stevenson JA, Sun X, Mitchell NC (2010) Despeckling SRTM and other topographic data with a denoising algorithm. Geomorphology 114:238–252. doi: 10.1016/j.geomorph.2009.07.006

Sun X, Rosin PL, Martin RR, Langbein FC (2007) Fast and Effective Feature-Preserving Mesh Denoising. IEEE Transactions on Visualization and Computer Graphics, 13:925–938. doi: 10.1109/TVCG.2007.1065