FPRE -- Prewitt Edge Filter (3x3)

Performs PREWITT EDGE DETECTOR filtering for Image data. The Prewitt edge detector filter creates an image where edges (sharp changes in grey-level values) are shown.

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

PARAMETERS

FPRE 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
MASK     Area Mask (Window or Bitmap)            0-4       Int
FACTOR   Gain Factor                             0-1       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
For more accurate results, DBOC should be 32 bit real channel. If 8 bit channel is used, all output values higher than 255 will be truncated to 255.

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

FACTOR

  Valid Values:   x >= 0.00001 
  Default:        1.0
Specifies the gain multiplication factor to be applied to the filtered input channel.

 EASI>FACTOR = 1.5
 EASI>FACTOR =          | defaults to 1.0
NOTE: Values of 0.0 or negative real numbers are not allowed.

DETAILS

Prewitt edge detection produces an image where higher grey-level values indicate the presence of an edge between two objects. The Prewitt Edge Detection filter computes the root mean square of two 3X3 templates. It is one of the most popular 3X3 edge detection filters. See ALGORITHM for more details about the filter.

There are five parameters in this program. FILE specifies the input PCI database file. Input channel (DBIC) can be the same as output channel (DBOC). The user has the option of applying a gain factor (FACTOR) to each filtered input channel before averaging. A FACTOR of 1.0 (default) implies no gain.

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 Prewitt edge detection filter uses the two 3X3 templates to calculate the gradient value.

        -1   0   1           1   1   1
        -1   0   1           0   0   0
        -1   0   1          -1  -1  -1

            X                    Y
Consider the following 3X3 image window

         +---------+
         | a1 a2 a3|
         | a4 a5 a6|     <---   Filter window 3 X 3
         | a7 a8 a9|
         +---------+
where:

    a1 .. a8   are the grey levels of each pixel in the filter window

    X = -1*a1 + 1*a3 - 1*a4 + 1*a6 - 1*a7 + 1*a9

    Y =  1*a1 + 1*a2 + 1*a3 - 1*a7 - 1*a8 - 1*a9

    Prewitt gradient = SQRT (X*X + Y*Y)
All pixels are filtered. In order to filter pixels located near the edges of an image, edge pixels values are replicated to give sufficient data.

EXAMPLE

Using the PCI demo file irvine.pix to calculate the Prewitt edge detection gradient.

 EASI>FILE = "irvine.pix"
 EASI>DBIC = 1  
 EASI>DBOC = 8                  | Working area
 EASI>MASK = 11                 | Bitmap 11
 EASI>FACTOR = 1
 EASI>RUN FPRE

About PCI Help Gateway