Filter

Functionality

Filtering is a process in which each pixel value in a raster map is replaced with a new value. The new value is obtained by applying a certain function to each input pixel and its direct neighbours. These neighbours are usually the 8 adjacent pixels (in a 3 x 3 filter) or the 24 surrounding pixels (in a 5 x 5 filter). When you create or define your own filters, any odd sized matrix is allowed (5 x 1, 11 x 23, 25 x 25).

Filters can be used for a number of purposes:

Sharpening images:

EDGESENH

the edges enhancement filter leaves the overall look of the image the same, but pixels at the borders of light areas become light as well, and pixels at the borders of dark areas become dark. Homogenous areas remain the same. This gives the impression that the image is sharper.

Noise reduction in images (smoothing):

AVG3x3

calculates the average value of 9 pixels and assigns the result to the central pixel. The AVG filter smoothes the image but may blur it.

MED3x3

reads and orders 9 pixel values from low to high and replaces the central pixel with the middle value (= the pixel value with rank order 5 = median value).

MED5x5

reads and orders 25 pixel values from low to high and replaces the central pixel with the middle value (= the pixel value with rank order 13 = median value).

The MED3x3 and MED5x5 filters remove point noise better than the AVG filter and they do not blur the image, but thin line features may disappear. Median filters can be used prior to a multi-band image classification if the classes to distinguish are 'large' areas (forest, agriculture) and not small or fine features (farm, roads).

Detecting line features and edges:

Gradient filters: see DFDX, DFDY, D2FDX2, D2FDY2, etc. below.

EDGESENH

the edges enhancement filter leaves the overall look of the image the same, but pixels at the borders of light areas become light as well, and pixels at the borders of dark areas become dark. Homogenous areas remain the same. This gives the impression that the image is sharper.

LAPLACE

The LAPLACE filter calculates gradients both in x- and y-direction (second partial derivative). The effect of using the LAPLACE filter is that when the value of the central pixel is relatively high compared to its neighbours, the value assigned to the central pixel will be even lower than the neighbours; and that when the value of the central pixel is relatively low compared to its neighbours, the value assigned to the central pixel will be even higher than the neighbours. Thus values which 'largely' differ from their neighbours come out as an opposite in the output map, while areas with more or less the same pixel value 'disappear'. The LAPLACE filter is quite sensitive to noise.

Detecting areas and directions of change:

PATTERN

detects homogenous areas where pixels have more or less the same value; detects outliers where the value of all neighbouring pixels is largely different from a center pixel; detects the directions in which differences between the center pixel and its neighbours are found.

Using filters on DEMs:

DFDX

detects slope differences in x-direction. Positive values in the output map mean that the terrain goes up from left to right (West to East); negative values in the output mean the terrain goes down.

DFDY

detects slope differences in y-direction. Positive values in the output map means that the terrain goes up from bottom to top (South to North); negative values mean that terrain goes down.

D2FDX2

detects slope shape differences in x-direction (second derivative). Positive values in the output map mean that the terrain is concave in x-direction; negative values mean that the terrain is convex.

D2FDY2

detects slope shape differences in y-direction (second derivative). Positive values in the output map mean that the terrain is concave in y-direction; negative values mean that the terrain is convex.

LAPLACE

the LAPLACE filter can be used to investigate which parts of the terrain are convex (negative value in output map) or concave (positive value in output map). Flat areas and uniform slopes obtain output value 0.

SHADOW

applies artificial illumination (from the Northwest) to the DEM. As a result, higher parts in the DEM become more pronounced because they obtain a shadow.

Using filters after a multi-band classification:

MAJUNDEF

the undefined-majority filter assigns to pixels classified as unknown during a multi-band image classification, the value of the most frequent occurring class around the unknown pixel. It considers 8 neighbours around an unclassified pixel and assigns the predominant class name of the neighbours to the unclassified pixel in the output map.

Morphologic filtering:

DILATE4

assigns a 1 to the center pixel if one or more horizontal or vertical neighbours is true as well. The result of using DILATE4 is that true pixels 'grow' in horizontal and vertical direction.

DILATE8

assigns a 1 to the center pixel if any of the neighbours is true. The result of using DILATE8 is that true pixels 'grow' in all directions.

SHRINK4

assigns a 1 only when the center pixel is 1 and all horizontal and vertical neighbours are 1 as well. The result of using the SHRINK4 filter is that areas of true pixels 'shrink' along their edges; single lines of true pixels and single true pixels totally surrounded by false pixels disappear.

SHRINK8

assigns a 1 only when the center pixel is 1 and all neighbours are 1 as well. The result of using the SHRINK8 filter is that areas of true pixels 'shrink' along their edges; single lines of true pixels and single true pixels totally surrounded by false pixels disappear.

INBND4

assigns a 1 only when the center pixel is 1 and at least one of the horizontal or vertical neighbours is 0 (meaning it is located at the edge of a group of true pixels). The result of using this filter is that 4-connected areas of true pixels are replaced by their 4-connected outline (a 4-connected boundary of true pixels).

INBND8

assigns only a 1 when the center pixel is 1 and at least one of the 8 neighbours is 0 (meaning it is located at the edge of a group of true pixels). The result of using this filter is that areas of 8-connected true pixels are replaced by their 8-connected outline (an 8-connected boundary of true pixels).

OUTBND4

results in a 4-connected outline of groups of false pixels.

OUTBND8

results in an 8-connected outline of groups of false pixels.

CONN8TO4

when true pixels are only 8-connected, this filter makes them 4-connected by adding a true pixel in some places. This might give your binary image a better outlook.

BINMAJOR

assigns the predominant value of each group of 9 pixels to the center pixel. The filter removes single pixels and very small groups of pixels; larger areas are smoothed.

PEPPSALT

only removes single true pixels and single false pixels.

Standard filters are found in the ILWIS\SYSTEM directory. You can also define your own filters in the Filter dialog box or by typing an expression on the command line of the Main window. For more information and some examples, refer to Filters : user-defined filters.

Input map requirements:

Input map requirements depend on the used filter type:

  

Linear filters:

raster map with a Value domain or the Image domain;

Rank order filters:

raster map with a Value domain or the Image domain;

Majority filters:

any raster map; no restrictions on domain type;

Binary filters:

raster map with a Value domain, the Image domain, a Bool domain, the Bit domain or a Class or ID domain;

Pattern filters:

raster map with a Value domain or the Image domain;

Standard deviation filters:

raster map with a Value domain or the Image domain.

The operation can also be applied on all raster maps in a map list.

Domain and georeference of output map:

An output domain is proposed depending on the domain of the input map and the filter type used. The value range and precision for the output raster map can be adjusted each time you perform the Filter operation.

The output map uses the same georeference as the input map.

When the operation is performed on an input map list, you will obtain an output map list. When the output map list is opened, the output raster maps will be (defined and) calculated.

See also: