FPR -- Programmable Filter (up to 33x33)

Performs programmable filtering on image data. The programmable filter averages image data according to user specified weights.

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

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

PARAMETERS

FPR 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
FLTFIL   Text File for Filter Weights            0-64      Char
MR01     Matrix: Row 01                          0-11      Real
MR02     Matrix: Row 02                          0-11      Real
MR03     Matrix: Row 03                          0-11      Real
MR04     Matrix: Row 04                          0-11      Real
MR05     Matrix: Row 05                          0-11      Real
MR06     Matrix: Row 06                          0-11      Real
MR07     Matrix: Row 07                          0-11      Real
MR08     Matrix: Row 08                          0-11      Real
MR09     Matrix: Row 09                          0-11      Real
MR10     Matrix: Row 10                          0-11      Real
MR11     Matrix: Row 11                          0-11      Real

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

FLTFIL

Specifies the name of the Text file or text segment number containing filter weights:

 EASI>FLTFIL = "filespec"               | Text File 
 EASI>FLTFIL = "10"                     | Segment Text
Note: If MRnn filter matrix parameters are specified, then FLTFIL parameter is ignored.

MR01

See MRnn in the parameters help.

MR02

See MRnn in the parameters help.

MR03

See MRnn in the parameters help.

MR04

See MRnn in the parameters help.

MR05

See MRnn in the parameters help.

MR06

See MRnn in the parameters help.

MR07

See MRnn in the parameters help.

MR08

See MRnn in the parameters help.

MR09

See MRnn in the parameters help.

MR10

See MRnn in the parameters help.

MR011

See MRnn in the parameters help.

MRnn

Specifies the filter matrix row elements:

 EASI>MR01=i,j,...,p

DETAILS

FPR allows the user to design filters for specific requirements (e.g. Directional Filters, Laplacian Filters, etc.). The filter dimensions must be odd, and size is selectable between 1X3 and 33X33. The user must specify a matrix of real weights to be applied to each pixel within the filter window. Each row of this matrix is stored in a separate parameter: MR01, MR02, MR03, ...MR11. In order to specify a filter bigger than 11x11, the user has the option to input weights usings a text file (FLTFIL) or by text segment. Filtered pixel values is the sum of weighted values divided by sum of all filter weights. If the sum of filter weights is zero, than the weighted SUM of grey level values in the filter window is computed for the central pixel. Database input channel (DBOC) can equal input channel (DBIC).

The MASK parameter specifies the area within the input channel which will be processed. Only 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 define 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 defaulted, then 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 programmable filter consists of applying a set of weighting values (M),inputed by user,for each pixel(P). All pixels are filtered. In order to filter pixels located near edges of image, replicates edge pixels values to give sufficient data.

   Filtered window 3x3         Weight values set by user.
        +---------+                 +---------+
        |P1 P2 P3 |                 |M1 M2 M3 |
        |P4 P5 P6 |                 |M4 M5 M6 | 
        |P7 P8 P9 |                 |M7 M8 M9 |
        +---------+                 +---------+
The resulting grey level value R for the smoothed pixel is:

        R = (P1*M1 + P2*M2 + ... +  P9*M9) / (M1 + M2 + ... + M9)
where:

        P1 .. Pn   are grey levels of each pixel in filter window

        M1 .. Mn   are weights (as defined by users) for each pixel
If the sum of filter weights is zero,( M1 + M2 + ... + M9 = 0), then :

        R = (P1*M1 + P2*M2 + ... +  P9*M9)
Example of using filter 3x3 on database image 8x8, using Laplacian mask Q:

                         +---------+                
                         | 0 -1  0 |               
                         |-1  5 -1 |                
                         | 0 -1  0 |               
                         +---------+                

   Image before filtering           Image after filtering

   8  8 9 9 9 7 6 6 6   6 
     +----------------+             +--------------------+
   8 |8 9 9 9 7 6 6 6 | 6           | 7 10  9 13 7 5 6 6 |
   8 |8 9 9 7 6 6 6 6 | 6           | 6 11 12  5 4 6 6 6 |   
   9 |9 8 8 6 6 6 6 6 | 6           |11  6 10  2 6 7 6 6 |
   9 |9 8 7 7 6 5 6 6 | 6           |12  9  5 10 6 1 7 6 |
   7 |7 7 7 6 6 6 6 6 | 6           | 6  7  9  4 6 7 6 6 |
   6 |6 6 6 6 6 6 6 6 | 6           | 5  5  5  6 6 6 6 7 |   
   6 |6 6 6 6 6 6 6 5 | 5           | 6  6  6  6 6 6 7 1 |
   6 |6 6 6 6 6 6 6 6 | 6           | 6  6  6  6 6 6 6 7 |
     +----------------+             +--------------------+        
   6  6 6 6 6 6 6 6 6   6
Note: 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 3 by 3 programmable filter (Laplacian mask Q) is used under 8-bit sign database channels 1 (which contains blue-green data), using IRVINE.PIX file. Laplacian mask Q computes the Laplacian edge enhancement and adds it back onto the original image. Output channel equal input channel.

 EASI>FILE = "IRVINE.PIX"
 EASI>DBIC = 1
 EASI>DBOC = 1                  
 EASI>FLSZ = 3,3                | Filter 3x3
 EASI>MASK =                    | Entire database
 EASI>MR01 =  0,-1, 0           |
 EASI>MR02 = -1, 5,-1           | Laplacian mask Q
 EASI>MR03 =  0,-1, 0           |
 EASI>RUN FPR

About PCI Help Gateway