Parent Topic: DEM Editing
All functions require the user to define a "Failed" value. In addition, if the current graphic mask is clear (empty), the "Under Mask" buttons will not work.
The "Noise Removal" function is used to discard any artifacts which may be in the DEM. This function is made up of two separate filters. The first filter calculates the average and variance of the eight elevation values directly surrounding each pixel (excluding failed and background pixels). If the center pixel is more than two standard deviations away from the average, it is replaced with the failed value. This filter tends to remove small areas of "noisy" pixels. The second filter counts up the number of failed values directly surrounding each pixel. If there are five or more failed pixels then the center pixel is set to a failed value. This tends to 'grow' failed areas on the rational that the pixels adjacent to failed areas tend to have a high probability of being noise (errors).
Note: these two filters were chosen on the basis of experience and experimentation. There is no strict mathematical or algorithmic rational for their selection. It is possible that they will remove some good values as well as bad values.
The "Erode Holes" filter works by assigning a failure value to any DEM pixel that touches an existing failure pixel (8 neighborhood). This has the effect of enlarging failure holes, typically removing bad DEM pixels along their edges.
Note: If the user selects Apply Under Mask then erasing will also occur in pixels touching the mask (but not under it) and then the mask will enlarge itself to cover any added failure values.
The "Median Filter" works with a 5 by 5 median filter.
The "Smooth" function uses a 3 by 3 Gaussian smoothing filter. Pixels having Failed or Background values will not be altered and will not be used in smoothing calculations. Smoothing can be applied multiple times, having a cumulative effect.
The "Interpolate" function replaces failed values with elevation values, interpolated from the good elevation values from the edges of the failed area. The interpolation algorithm used was selected for its speed and simplicity rather than the quality of its results. It should be adequate for small areas (areas of 200 or less pixels) but should not be used for large failed areas. The algorithm linearly interpolates elevations between two good values using rows and columns, and then generates a single value for a pixel based on the row and column values, weighted by their distance from the failed area edges.
The "Remove Noise", "Erode Holes", "Smooth", "Median Filter", and "Interpolate" filters were designed to be used iteratively. For example: the user selects the "Remove Noise" function twice, then the "Interpolate" function once, and the "Smooth" function three times.
At any time the user can write back the results of the DEM editing by using the "Save DEM back to File" button. The first time this is done, the user is asked whether to create a new channel on the same file for output so the original data is preserved. The new channel has a copy of the entire original DEM channel in it, and after this the new data will be saved to the new channel. Otherwise, the new data will be saved to (and thereby overwrite) the original DEM channel.