FAV -- Averaging (Mean) Filter

Performs AVERAGE filtering on image data. The Averaging (mean) filter smooths image data, eliminating noise.

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

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

PARAMETERS

FAV 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

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

DETAILS

The average filter computes the mean (average) of the grey-level values within a rectangular filter window surrounding each pixel. This has the effect of smoothing the image (eliminating noise).

The dimensions of the filter window must be odd. The minimum filter size is 1 by 3 (or 3 by 1), and the maximum filter size allowed is 1001 by 1001. The filter window does not need to be square.

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 the 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

FAV performs spatial filtering on each individual pixel in an image using the grey-level values in a square or rectangular window surrounding each pixel. The dimensions of the filter size must be odd and can be between 1x3 or 3x1 to 1001x1001. The filter size must not exceed the database size.

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.

         +---------+
         |a1 a2 a3 |
         |a4 a5 a6 |     <---   Filter window 3 X 3
         |a7 a8 a9 |
         +---------+
The averaging filter calculates the sum of all pixels in the filter window, then divides by the number of pixels in the filter window:

Filtered pixel r = (a1 + a2 +....+ a9) / 9

Example of using 5x5 filter on database image of 8x8 pixels.

   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 8 8 8 7 7 6 6 |
   8 8 |8 9 9 7 6 6 6 6 | 6 6       |8 8 8 7 7 6 6 6 |   
   9 9 |9 8 8 6 6 6 6 6 | 6 6       |8 8 8 7 7 6 6 6 |
   9 9 |9 8 7 7 6 5 6 6 | 6 6       |8 7 7 7 6 6 6 6 |
   7 7 |7 7 7 6 6 6 6 6 | 6 6       |7 7 7 6 6 6 6 6 |
   6 6 |6 6 6 6 6 6 6 6 | 6 6       |7 7 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
In the "Image before filtering" on the left, columns and scanlines outside the box represent the last image column or scanline being reused, for the case where the filter does not have a full window.

EXAMPLE

A bitmap delineating urban land uses is stored in segment 4 of database IRVINE.PIX. A 5x5 averaging window is to be performed on just the urban features of channel 4. The filtered result is to be saved in channel 8.

 EASI>FILE = "IRVINE.PIX"
 EASI>DBIC = 4                  | Channel to be filtered
 EASI>DBOC = 8                  | Filtered results
 EASI>FLSZ = 5,5                | 5x5 filter size.
 EASI>MASK = 11                 | Indicate area to filter.
 EASI>RUN FAV
The 16-bit elevation data stored channel 10 on database IRVINE.PIX is to be smoothed using a 21 square filter. The filtered result is to overwrite the original input data.

 EASI>FILE = "IRVINE.PIX"
 EASI>DBIC = 10                 | Input Elevation data
 EASI>DBOC = 10                 | Input data to be overwritten
 EASI>FLSZ = 21,21              | 21x21 filter size. 
 EASI>MASK =                    | Entire database to be filtered
 EASI>RUN FAV

About PCI Help Gateway