Performs statistical filtering of raster datasets with a sliding kernel of arbitrary shape and size.
The Module StatFilter takes an input raster file (parameter inFile) and for each pixel calculates a statistical feature (parameter feature) by considering the neighbouring pixels in a user-defined kernel environment (parameter kernelShape, parameter kernelSize). The resulting output is again a raster (parameter outFile) in GDAL supported data format (parameter oFormat). The same statistical features as for Module Cell are provided, enabling low pass filtering (smoothing), boundary value extraction (min/max), roughness estimation, etc. The following features are provided:
Depending on the application different neighbourhoods may be required. The following kernel shapes are supported:
Please note, that the kernel size is to be defined as a radius (in pixels) rather than as number of columns and lines. For a kernel radius of 4 (i.e. 9x9 kernel) the resulting kernels are shown in Figure 1.
By default, the input and output rasters have identical structure, i.e. for each input pixel a corresponding output pixel (containing the statistically filtered value) is calculated and stored. However, it is also possible to manipulate the output grid resolution (gridSize. The follwoing otions are provided:
Figure 2 illustrates the above mentioned resampling options:
Furthermore, the output grid extents may be changed by specifying a user defined limit (limit). Please note, that uneven limits are automatically rounded to the next grid post position. Optionally, a no-data value representing data voids in the output raster can be specified (parameter noData).
Possible values: square .... square kernel (Chebyshev metrics)) circle .... circular kernel (Euclidean metrics) diamond ... diamond kernel (Manhattan metrics)To select a predefined shape of the (binary) kernel matrix.
Possible values: automatic ... derived mode from attribute type real ........ allow arbitrary bin width values integer ..... limits bin width and centers bins to natural numbersFor features aggregated into bins like minority and majority, the bin center is used as representative value. The same applies to procMode=integer, where the bin limits are shifted by half the bin size so that the corresponding integer value is located in the bin center. With procMode=real the bin limits are mutiples of the bin sizes, which is suitable for processing features of floating point (real) type. In automatic mode the module selects real or integer procMode based on the attribute type.
Possible values: native ....... output grid size equals native input grid size halfKernel ... output grid size equals half kernel size kernelSize ... output grid size equals entire kernel sizeBy default, the output grid is calculated using the native input grid resolution. However, as the input pixels are used reduntantly for neigbouring output pixels in this case, a reduced resolution (half or entire kernel size) can be chosen. Especially for an output resolution corresponding to the kernelSize each input pixel is contributing to the resulting output grid one-time-only.
The following examples rely on the surface grids first.tif
and last.tif
derived from all first/last echoes of the dataset fullwave.fwf
as described in Example 3: (Example 3) of module Module Grid.
By averaging all pixels within the kernel area, low pass filtering (i.e. smoothing) of raster datasets can be performed. The smoothing level can be controlled by the kernel size.
This corresponds to a kernel size of 3x3, 5x5, and 7x7 resulting in gradually higher smoothing rates. Please note, that since the kernel shape is not explicitly defined, the square kernel is used by default.
In this example, the min/max features are used to derive a DSM and DTM. In this example, the highest values of first-echo-surface model and the lowest values of the last-echo-surface model are filtered using circular kernel environment (euclidian metrics), resulting in a simple DSM and (very noisy!!) DTM. A hill shading of the two models is shown in Figure 3.
In this example the parameter gridSize=kernelSize is used to resample the output grid. The resulting grid has a grid width of 1.0 x 1.0m2 (i.e. native grid width of 0.5m x kernel radius of 2 pixels).
In this example the parameter gridSize is set to the entire size of the kernel resulting in a grid with a cell size of 2.5 x 2.5m2.
This example shows how to use the limit parameter. The result is sillustrated in Figure 4 below.