Filters

User-defined majority filters

The standard majority filters are: Majority, MajUndef, and MajZero; they work in a 3 by 3 environment and assign the predominant value of the surrounding pixels to the central pixel. In the Filter dialog box as well as on the command line, you may define other majority filters of any user-defined size.

Using the Filter dialog box:

  1. To use one of the standard Majority filters:
  2.  

  3. To define your own Majority filter:

See also the example below.

Using the command line (advanced):

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

    OUTMAP

    =

    MapFilter(InputMapName, Majority)

    OUTMAP

    =

    MapFilter(InputMapName, MajUndef)

    OUTMAP

    =

    MapFilter(InputMapName, MajZero)

     

    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.

    Majority

    is the name of the standard Majority filter.

    MajUndef

    is the name of the standard Undef-Majority filter.

    MajZero

    is the name of the standard Zero-Majority filter.

     

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

    OUTMAP

    =

    MapFilter(InputMapName, Majority(rows,cols))

    OUTMAP

    =

    MapFilter(InputMapName, UndefMajority(rows,cols))

    OUTMAP

    =

    MapFilter(InputMapName, ZeroMajority(rows,cols))

     

    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.

    Majority

    is the command to define a Majority filter.

    UndefMajority

    is the command to define an Undef-Majority filter.

    ZeroMajority

    is the command to define a Zero-Majority filter.

    rows

    are the number of rows of your majority filter.

    cols

    are the number of columns of your majority filter.

Example:

To use a majority filter which considers each 5 horizontally neighbouring pixels:

Tip:

See also: