Go to the USGS Home Page

USGS MIPS Filter Documentation






This program can be used to apply one of several different types of spatial filters to digital raster/image  files. The filtering algorithm uses a moving rectangular window/kernel, often referred to as a boxcar, to define the filter's area or shape. The boxcar window is N x M pixels in size, with N and M always containing an odd number of lines and samples(M equal to N or M not equal to N). The boxcar window starts positioned with its center pixel at line one sample one, performs the filter operation, then moves to the next pixel on the right. At the end of the each pixel  in the line it repositions itself to the first sample of the next line, and continues the filtering process for the new line. When any part of the boxcar is outside the image(e.g., at the edges or corners of the image), the appropriate lines and or samples are folded out to fill the boxcar completely.

  

Files

This program requires as input one unsigned 8-bit , or one signed 16-bit , or one 32-bit  floating point image file. The output image will have the same bit type as the input image. The following information is transfered from the input image to the output image(if appropriate):

Image labels 
Mosaic labels
Projection labels
Sonar labels
History  file
        

Spatial Filter Options

LPF, LPFV, LPFZ, HPF, DIV, TRIM, NOISE or SUM

These options are used to select the filtering option; one must be selected. Note, the SUM option can only be applied to images in 32-bit floating point format.

Equations for filtering operations:

  P(i,j) = Original DN  value of input image at position i,j
           (center of filter window/boxcar)
  X(i,j) = Output DN value of resulting filter operation
  S(i,j) = Sum of points over the boxcar centered at i,j
  N(i,j) = Number of valid points in the boxcar centered at i,j
The LPF option is defined by:

             S(i,j)
  LPF(i,j) = ------ = average(i,j)
             N(i,j)

  X(i,j) = MULT * LPF(i,j)

  where

    MULT = multiplicative gain(see below)
The low pass filter (LPF) is simply an image whose pixels have been set equal to the average of the boxcar. This filtering option enhances the low frequency component of an image. Windows that do not contain enough pixels with DNs in the valid range will cause the center pixel to be set to either 0, -32768 or the maximum negative floating point number depending on the bit type of the input image(see the PRESERVE option for information on how to keep this from happening). All other pixels will be filtered(i.e., pixel value set to the average of the boxcar window). This filter is referrd to as a smoothing filter.

The low pass filter zero (LPFZ) is a special case of the LPF option; it uses the same equation as the LPF option, but only applies the averaging/filtering algorithm to pixels outside the valid range. Again, windows that do not contain enough pixels with valid DNs cause the center pixel to be set to either 0, -32768 or the maximum negative floating point number depending on the bit type(the PRESERVE option shows how to keep this from happening). Image pixels that have DN values within the valid range will not be changed. An example where LPFZ might be used is to "fill in" zero DN holes identified as having bit errors or speckle noise. Another example would be to use several increasing boxcar window sizes in a row to interpolate a surface from point data(i.e., valid DN range is 1 to 255 with background/missing data set to zero Dn. Executing a series of filters will gradually fill in the gaps/changing only pixels with zero DN). In this latter case the series of filters applied to the data could be 3x3, 7x7, 15x15, 31x31 and finally 63x63.

The low pass filter valid (LPFV) is also a special case of the LPF option; it uses the same equation as the LPF option, but only applies the averaging/filtering algorithm to pixels inside the valid range. Image pixels that have DN values below the valid range will be set to 0, -32768 or the maximum negative floating point number depending on the bit type. Image pixels that have DN values above the valid range will be set to 255, 32767 or the maximum floating point number(again, see the PRESERVE option for information on how to keep these from happening, if desired).

The HPF option is defined by:

  HPF(i,j) = NORM * (1 - ADBK) + P(i,j) * MULT * (1 + ADBK) - LPF(i,j) * MULT

  where

    NORM = normalization factor(see below)
    ADBK = value to be added back to filtered results(see below)
The high pass filter (HPF) is the differance of the center pixel of the boxcar window's DN and the average of the boxcar window(i.e., center pixel's DN minus the average or LPF). This filtering option enhances the high frequency component of the image, versus the low frequency enhancement of the LPF smoothing options. Boxcar windows that do not contain sufficient number of pixels with valid DNs will cause the center pixel of the window to be set to 0, -32768 or the maximum negative floating point number depending on the bit type. Image pixels that are below the valid range of data will be set to 0, -32768 or maximum negative floating point number, while those that are above the valid range will be set to 255, 32767 and maximum floating point number(see the PRESERVE option for information on how to keep these cases from happening.

The DIV option is defined by:

                  P(i,j) 
  X(i,j) = MULT * -------- - NORM
                  LPF(i,j)
The divide filter (DIV) is a special case of the HPF option; the window's center pixel of the boxcar is divided by the average of the boxcar. Boxcars that do not contain sufficient number of pixels with valid data cause the center pixel to be set to 0, -32768 or the maximum negative floating point number depending on the bit type. Image pixels that are below the valid range of data will be set to 0, -32768 or the maximum negative floating point number, while pixels that are above the valid range will be set to 255, 32767 or the maximum floating point number(see the PRESERVE option for information on how to keep this from happening).

The trim filter (TRIM) is a special case of the HPF that can be used to automatically trim images edges; it sets the output pixel to 0, -32768 or the maximum negative floating point number depending on the input file bit type iff the boxcar does not contain sufficient number of pixels with valid DNs. Otherwise, the output pixel is set to the value of the input pixel(i.e., remains unchanged).

The noise filter option (NOISE) is also a special case of the HPF and can be used to remove bit errors; it performs a despike algorithm on the image. If the difference between the input pixel is P(i,j) DN and the average of the boxcar window is greater than a user selected tolerance (TOL) the output dn will be set to the average value, otherwise the result will be unchanged. Usually for bit error removal the filter boxcar size is relatively small(3x3 to 9x9). Boxcars that do not contain sufficient number of pixels with valid DNs cause the center pixel to be set to 0, -32768 or the maximum negative floating point number depending on the input bit type. Image pixels with DNs outside the valid range will be set to the average of the boxcar(see the PRESERVE option for information on how to keep this from happening).

The sum filter option (SUM) works only on floating point data because the output file will contain the sum of all the valid points within the boxcar window(i.e., the resulting DN value is often too large for 8 or 16-bit integer format).

        

Standard Filtering Parameters

The following parameters may be specified for each of the spatial filtering options.

NL and NS

These parameters are used to select the number of lines and samples for the box car window size. There are no default values and the range is from 1 to the number of lines/samples(squared) minus 1. To keep the window/filter kernel symmetrical these values must be odd. However, they do not have to be equal to each other(e.g., NL = 7 and NS = 101 is a typical horizontal striping removal filter size).

LOW and HIGH

These parameters are used to select the valid range of DNs desired by the use; typically LOW = 1 and HIGH = 255. The default LOW dn is 0 for 8-bit data and -32768.0 for 16-bit data and the maximum negative floating point number for floating point, respectively. The default HIGH dn is 255 for 8-bit data and 32767 for 16-bit data, and the maximum floating point number for floating point, respectively.

PERCENT and COUNT

These parameters are used to select the valid percentage and valid count of dns inside the boxcar window. The PERCENT or COUNT, represent the percentage or number of pixels within the boxcar window that must be met or the filter will not operate on the current center pixel. The default PERCENT and COUNT values is 0. This default value should be used most of the time; these options are useful for trimming portions of the image edges when doing digital mosaicking.

PRESERVE

This parameter is used to control the action taken when there are not enough valid dns in the boxcar window. If PRESERVE is not set then pixels not meeting the requirements will be set to a dn value that represents a non-valid dn, otherwise the pixel will be filtered. As a default, the PRESERVE option is not set.

 

LPF, LPFV and LPFZ Specific Parameters

For these three filtering options(smoothing), the following parameter may be used in addition to the standard filtering parameters:

MULT

This parameter is a multiplicative factor used as a coefficient for expanding the output range(i.e., increase the "brightness" dynamic range of the output image --- note that with 8-bit data the effect of MULT is limited). It is useful to maximize subtle high frequency varations within low-contrast areas in the image. The default multiplicative factor is 1.0.

  

HPF Specific Parameters

For the HPF filtering option, the following parameters may be used in addition to the standard filtering parameters:

MULT, ADDBACK and NORM

These parameters are used to select the multiplication factor used for adjusting the output dynamic range of the high pass filter, as well as the addback (percentage of original dn to be added back to the filtered results), and the normalization factor used for centering the output dn values. The default MULT factor is 1.0; default ADDBCK is 0; and the default NORM value is 127 for 8-bit and 0 for both signed word(16-bit data) and floating point data, respectively.

DIV Specific Parameters

For the DIV filtering option, the following parameters may be used in addition to the standard filtering parameters:

MULT and NORM

These are the same parameters described above, and have the same effects on the resulting filtered results. However, the defaults for MULT are 100 for 8-bit data, 1 for signed word(16-bit), and floating point, respectively. The default for NORM is zero.

 

NOISE Specific Parameters

For the noise filtering option, the following parameter may be used in addition to the standard filtering parameters:

TOL

This parameter is used to select the tolerance (difference between the center dn and the average of the boxcar window) in the noise removal operation. The noise that is targeted with this operation is bit error type problem. There is no default value.

Examples

From left to right, original Landsat TM Band 4, low pass and high pass filter.

[Example Image] [Example Image] [Example Image]


See Also

Grad 
Lpf2b2 
Median 
Mode 
Stdflt 
U.S. Department of the Interior | U.S. Geological Survey | Jobs
Home | Search | Disclaimers & Privacy Web Rings
Send comments to webman@TerraWeb.wr.usgs.gov
URL:
Last Modified: Thu Oct 31 15:08:22 MST 2002
FirstGov: Your First Click to the U.S. Gov ernment