Filters

User-defined rank order and median filters

Standard rank order filters are MED3x3 and MED5x5; these filters sort 9 resp. 25 pixel values and assign the 5th resp. the 13th value (median value) to the center pixel in the output map. In the Filter dialog box as well as on the command line, you may define other rank order and median filters of any user-defined size and assigning any user-defined rank order value to the central pixel.

Using the Filter dialog box:

  1. To use one of the standard rank order filters:
  2.  

  3. To define your own rank order filter:
  4. This ensures that larger differences between neighbouring pixels remain in the output, while small variations are removed.

     

  5. To define your own median filter:

See also the example below.

Using the command line (advanced):

  1. To use a standard Rank order filter, type one of the following expressions on the command line of the Main window:
  2.  

    OUTMAP

    =

    MapFilter(InputMapName, Med3x3)

    OUTMAP

    =

    MapFilter(InputMapName, Med5x5)

     

    where:

    OUTMAP

    is the name of your output map.

    MapFilter

    is the command to start the Filter operation.

    InputMapName

    is the name of your input map.

    Med3x3

    is the name of the standard Median 3x3 filter.

    Med5x5

    is the name of the standard Median 5x5 filter.

     

  3. To define your own Rank order filter, type one of the following expressions on the command line of the Main window:
  4.  

    OUTMAP

    =

    MapFilter(InputMapName, Rankorder(rows,cols,rank))

    OUTMAP

    =

    MapFilter(InputMapName, Rankorder(rows,cols,rank,threshold))

     

    where:

    OUTMAP

    is the name of your output map.

    MapFilter

    is the command to start the Filter operation.

    InputMapName

    is the name of your input map.

    Rankorder

    is the command to define a rank order filter.

    rows

    are the number of rows of your rank order filter.

    cols

    are the number of columns of your rank order filter.

    rank

    is the rank order number that determines the output value.

    threshold

    when a threshold is set, the value of the center pixel will only be replaced by the new value if the difference between the original and new pixel value is smaller than or equal to the threshold.

     

  5. To define your own Median filter, type one of the following expressions on the command line of the Main window:
  6.  

    OUTMAP

    =

    MapFilter(InputMapName,Median(rows,cols))

    OUTMAP

    =

    MapFilter(InputMapName,Median(rows,cols,threshold))

     

    where:

    OUTMAP

    is the name of your output map.

    MapFilter

    is the command to start the Filter operation.

    InputMapName

    is the name of your input map.

    Median

    is the command to define a median filter.

    rows

    are the number of rows of your median filter.

    cols

    are the number of columns of your median filter.

    rank

    is the rank order number that determines the output value.

    threshold

    when a threshold is set, the value of the center pixel will only be replaced by the new value if the difference between the original and new pixel value is smaller than or equal to the threshold.

Examples:

  1. To obtain the minimum of each 3x3 neighbouring pixels:
  2. Rank 1 means the smallest value of each 9 (3 by 3) pixel values examined will be used for the output pixel.

     

  3. To obtain the maximum of each 7 horizontally neighbouring pixels:
  4. Rank 7 means that the largest value of each 7 (1 by 7) pixel values examined is used as output value.

     

  5. To obtain the median value of each 5 horizontally neighbouring pixels:

Tips:

See also: