FME -- Median Filter (up to 7x7)

Performs MEDIAN filtering on image data. The median filter smooths image data, while preserving sharp edges.

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

INPUT PORT(S)

Input

Type:Raster
Connection:Mandatory
Minimum Layers:1
Maximum Layers:1

Contains the input raster layer to be filtered.

Mask

Type:Bitmap
Connection:Optional
Minimum Layers:0
Maximum Layers:1

Contains the input area mask layer, consisting of a bitmap that indicates which area in the input raster should be processed. If no bitmap is provided, then the entire layer is filtered.

OUTPUT PORT(S)

Output

Type:Raster
Connection:Optional
Minimum Layers:0
Maximum Layers:1

Contains the output layer that receives the filtered raster data.

INPUT PARAMETER(S)

FME is controlled by the following parameters:

Filter X Size (Pixels)

Name:FilterXSize
Type:Integer
Valid Values:1, 3, 5, 7
Default:3
Requirement:Mandatory

Specifies the filter's X size in units of pixels.

The X size can be different from the Y size (i.e., the filter does not have to be square).

Filter Y Size (Lines)

Name:FilterYSize
Type:Integer
Valid Values:1, 3, 5, 7
Default:3
Requirement:Mandatory

Specifies the filter's Y size in units of lines.

The X size can be different from the Y size (i.e., the filter does not have to be square).

DETAILS

The median filter computes the median value of the grey-level values within a rectangular filter window surrounding each pixel. This has the effect of smoothing the image and preserving edges. The dimensions of the filter window must be odd. 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.

A bitmap specifies the area within the input layer which will be processed. Only this area will be filtered and the rest of the image will be unchanged. If no bitmap is connected, the entire database is processed.

ALGORITHM

The implementation of median filter consists of computing the median of the grey-level values within the square or rectangular filter window surrounding each pixel.

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

         +--------+
         | 5 3 11 |
         |12 4  9 |     <---    Filter window 3 X 3
         | 8 6 14 |
         +--------+
The median filter finds the median pixel value ( the "middle" value in an ordered set of values, below and above which there is an equal number of values). For example 8 is the median value for given set of values: (3,4,5,6,(8),9,11,12,14).

Example of using 5x5 median filter on 8x8 pixel database.

     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 8 8 6 6 6 6 |
   8 8 |8 9 9 7 6 6 6 6 | 6 6       |8 8 8 7 6 6 6 6 |   
   9 9 |9 8 8 6 6 6 6 6 | 6 6       |8 8 7 7 6 6 6 6 |
   9 9 |9 8 7 7 6 5 6 6 | 6 6       |8 7 7 6 6 6 6 6 |
   7 7 |7 7 7 6 6 6 6 6 | 6 6       |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 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 cases where the filter does not have a full window.


About PCI Help Gateway