With linear filtering the value at each grid position, G, is altered using a simple kernel as a weights matrix. With non-linear filtering kernels are not generally used. Instead the value at G is determined by some procedure other than weighted averaging. For example, G may be determined by a statistical measure (other than the mean) based on an NxN neighborhood of G. NxN is typically 5x5 or greater, and almost any basic statistic (as listed in Table 1‑3) may be used. Typical examples might be the minimum value in the neighborhood, or the cell value that is most common (occurs in the majority) within the neighborhood. Other measures commonly supported included variance, standard deviation, coefficient of variation and inter-quartile range. In each case the computations are based on the defined neighborhood.
ArcGIS describes such operations as Neighborhood operations involving Focal or Block statistics, with neighborhoods defined more generally than in typical filtering software (e.g. as rectangles, rings or wedges). Most other packages stick with the image processing terminology of filtering and square or rectangular neighborhoods. ArcGIS also provides a special function to handle the Majority case (MajorityFilter) with integer-valued grids that incorporates an additional spatial contiguity constraint. The rule applied is that either half or at least half of the cell values in the 3x3 neighborhood must be the same as the value at G, and these must satisfy a rook’s move (4-way) or queen’s move (8-way) contiguity constraint. Multiple passes of this filter can be made and will stabilize to a fixed pattern.
Several non-linear filters examine local deviations in grid values. In addition to standard statistical measures, median deviation and threshold averaging may be applied (see also Section 6.7.2, Kriging interpolation, subsection on median-polishing). In median deviation filtering the value at G is replaced by G‑B, where B is the local median. This emphasizes outliers. With thresholding averaging the value at G is retained if it is within a defined absolute value of the local mean (calculated excluding the value at G itself), otherwise it is replaced with this local average. The effect is to remove outliers. This is a form of “noise reduction”, a procedure that is supported in many image processing packages and in some GIS software. TNTMips, for example, provides 6 noise reduction filters, all of which utilize local statistics to adjust the resulting dataset or image. These are principally based on the local median or mode value (variously computed), but also include a form of trimmed mean (the Olympic filter) in which 1 or more values at the upper and lower end of the local ranked set of values is dropped and the mean of the subset calculated as the selected output value.
Simple hillshading may be achieved using a form of non-linear filter. In this case horizontal, vertical or diagonal difference filtering is applied. The procedure subtracts all the values in row 1 say, from row 2 and assigns a value of ‑1, 0 or 1 for example to the outcome, depending on the sign of the result. A color-graded map of the output grid provides the hillshading effect.