FMO -- Mode Filter (up to 7x7)

Performs MODE filtering on image data. The Mode filter is primarily used to clean up thematic maps for presentation purposes.

Progress of this program can be monitored. See MONITOR section.

See Also: FAV, FED, FME, FGA, FPR, FAD, FLE, FSOBEL, FPRE, FSHARP

PARAMETERS

FMO is controlled by the following global parameters:

Name     Prompt                                  Count     Type
FILE     Database File Name                      1-64      Char
DBIC     Database Input Channel List             1         Int
DBOC     Database Output Channel List            1         Int
FLSZ     Filter Size: Pixels, Lines              1-2       Int
MASK     Area Mask (Window or Bitmap)            0-4       Int
THINLINE Thin Line preservation: ON/OFF          2-3       Char
KEEPVALU Values not be filtered                  0-16      Int

FILE

Specifies the name of the PCIDSK file containing channels to be filtered.

 EASI>FILE="filespec"

DBIC

Specifies the input channel to be filtered.

 EASI>DBIC=i

DBOC

Specifies the output channel for the filtered result.

 EASI>DBOC=j

FLSZ

Specifies the filter size in units of pixels and lines:

 EASI>FLSZ=i,j

MASK

Specifies the area in the input channel which should be processed. This can be one of the following:

 EASI>MASK=                             | process entire channel
 EASI>MASK=xoff,yoff,xsize,ysize        | process window
 EASI>MASK=b                            | process only under bitmap
                                        | stored in segment b

THINLINE

  Valid Values:   ON, OFF
  Default:        ON
Specifies whether thin line preservation is to be applied to the data.

 EASI>THINLINE = "OFF"
 EASI>THINLINE =                | defaults to "ON"
Notes:

KEEPVALU

  Valid Values:   x >= 0
  Default:        <none>
Specifies up to 16 pixel values (classes) which should not be filtered. Although these classes will not be replaced during the filtering process, other pixels could 'take on' these values as a result of filtering.

 EASI>KEEPVALU = i,j,...

DETAILS

The mode filter computes the mode of the grey-level values (the most frequently occurring grey-level value) within the filter window surrounding each pixel. Mode filtering is ideal for cleaning up thematic maps for presentation purposes, in that it replaces small "island" themes by their larger, surrounding themes. The minimum filter size is 1 by 3 and the maximum filter size allowed is 7 by 7. The filter window does not need to be square. The input channel(DBIC) can be the same as the output channel (DBOC).

If the thinline preservation flag (THINLINE) is ON, a pixel is mode filtered only if the number of occurrences of the centre pixel value in the 3 by 3 window surrounding it is less than 3. THINLINE can be set "ON" only for a 3x3 filter widow. This ensures that thin classes (such as streams or roads) are not removed when cleaning up thematic maps.

The KEEPVALU parameter specifies up to 16 values (classes) which should not be filtered. This is useful for preserving specified classes.

The MASK parameter specifies the area within the input channel which will be processed. Only the area under MASK will be filtered and the rest of the image will be unchanged. If a single value is specified, then this value points to a bitmap segment, which defines the area to be filtered. When four values are specified, these values define the x,y offsets and x,y dimensions of rectangular window within the image to be filtered. If MASK is defaulted, the entire database is processed.

MONITOR

Program progress can be monitored by printing the percentage of completed processing in odometer fashion. A system parameter, MONITOR, controls this activity:

 EASI>MONITOR="ON"           | turn monitor ON  (default)
 EASI>MONITOR="OFF"          | turn monitor OFF (recommended if
                             | running in batch/background mode)

ALGORITHM

The implementation of the mode filter consists of computing the mode of the grey-level values (the most frequently occurring grey-level value) within the square or rectangular filter window surrounding each pixel.

All pixels are filtered. In order to filter pixels located near the edges of the image, edge pixel values are replicated to give sufficient data.

                +---------+
                | 5  3  3 |    
                | 3  5  3 |     <-- Filter window
                | 3  4  5 |         3x3
                +---------+
When Thinline = "OFF" the output pixel is equal to the most frequently occurring value in the filter window.

 i.e. Thinline = "OFF" 
         Filtered pixel of filter window (3,3,3,3,3,4,5,5,5) 
         is set to 3, which occurs 5 times.
When Thinline = "ON" , in order to preserve thin lines in the image, the central pixel is filtered only if the grey-level value of the central pixel occurs less than three times within the 3x3 filter window.

 i.e. Thinline = "ON" 
         Filtered pixel of filter window (3,3,3,3,3,4,5,5,5)
         is set to 5, central pixel 5 occurs 3  times.
Example of using 5x5 filter on database image 8x8, Thinline="OFF"

     Image Before Filtering        Image After Filtering

   8 8  8 9 9 9 7 6 6 6   6 6
   8 8  8 9 9 9 7 6 6 6   6 6
       +----------------+           +----------------+
   8 8 |8 9 9 9 7 6 6 6 | 6 6       |8 9 9 6 6 6 6 6 |
   8 8 |8 9 9 7 6 6 6 6 | 6 6       |8 9 9 6 6 6 6 6 |   
   9 9 |9 8 8 6 6 6 6 6 | 6 6       |9 7 7 6 6 6 6 6 |
   9 9 |9 8 7 7 6 5 6 6 | 6 6       |9 7 6 6 6 6 6 6 |
   7 7 |7 7 7 6 6 6 6 6 | 6 6       |6 6 6 6 6 6 6 6 |
   6 6 |6 6 6 6 6 6 6 6 | 6 6       |6 6 6 6 6 6 6 6 |   
   6 6 |6 6 6 6 6 6 6 5 | 5 5       |6 6 6 6 6 6 6 6 |
   6 6 |6 6 6 6 6 6 6 6 | 6 6       |6 6 6 6 6 6 6 6 |
       +----------------+           +----------------+        
   6 6  6 6 6 6 6 6 6 6   6 6      
   6 6  6 6 6 6 6 6 6 6   6 6
For the case where the filter does not have a full window (see the "Image Before Filtering" on the left), columns and scanlines outside the box represent the last image column or scanline being reused.

EXAMPLE

A 3 by 3 mode filter is used under bitmap 11 (Urban area), on 8-bit database channel 7 (Supervised classification Results) using IRVINE.PIX file.

 EASI>FILE = "IRVINE.PIX"
 EASI>DBIC = 7                  | Classification results
 EASI>DBOC = 7                  
 EASI>FLSZ = 3,3                | Filter 3x3
 EASI>THINLINE = "ON"           | Preserve thinlines
 EASI>MASK = 11                 | Bitmap 11
 EASI>RUN FMO
A 5 by 5 mode filter is used on whole channel, using IRVINE.PIX file.

 EASI>FILE = "IRVINE.PIX"
 EASI>DBIC = 7                  | Classification results
 EASI>DBOC = 8                  
 EASI>FLSZ = 5,5                | Filter 5x5
 EASI>MASK =                    | Entire database
 EASI>THINLINE = "OFF"          | Do not preserve thinlines
 EASI>RUN FMO

About PCI Help Gateway