User's Guide

MATRIX

Applies a matrix of coefficients to the input image

Function:

Applies a set of coefficients to an input image using matrix algebra performing the following operation:

                 AX = Y

where:
   A: is a matrix of coefficients, one for each band 
      of the input image
   X: is the input image
   Y: is the output image

The module can apply up to 100 coefficients in one execution. These can be applied as a 10 x 10 matrix, a 1 x 100 matrix, or any combination of up to 100 coefficients.

Parameters:

IN
Input image. The input image may be BYTE, INTEGER*2, INTEGER*4, or REAL*4 and must have at least the same number of bands as the second dimension of the MATDIM parameter.

OUT
Output image. The output image maybe a multi-band image that has the number of bands exactly equal to the first dimension of the MATDIM parameter. The data type will be that specified in the ODTYPE parameter.

MATDIM
Matrix dimension. This is a two dimensional parameter indicating the size of the matrix. The first value is the number of rows followed by the second indicating the number of columns.

MATVAL
Matrix values. A single dimensional array containing the matrix values. The values should be entered by rows starting at row 1 column 1 and going to the last row and last column as specified by MATDIM.

ODTYPE(SAME)
Output data type. The data type of the output image.

  = SAME:  Same as input 
  = BYTE:  BYTE      (8-bit unsigned integer)
                     (0 through 255)
  = I*2:   INTEGER*2 (16-bit signed integer)
                     (-32768 through 32767)
  = I*4:   INTEGER*4 (32-bit signed integer)
                     (-2147483648 through 2147483647)
  = R*4:   REAL*4    (32-bit signed real)
                     (System dependent)

Examples:

  1. LAS> matrix in=madtown.tm out=madtown.filt matdim=(3,3) matval=(-1 -1 -1 -1 9 -1 -1 -1 -1) odtype=byte

    A 3 x 3 matrix is applied to the MADTOWN.TM image which consists of three bands to produce an image (MADTOWN.FILT) of three bands of type BYTE.

  2. LAS> matrix "madtown.tm(:1)" madtown.out matdim=(1,1) matval=(.5)

    The first band of MADTOWN.TM is multipled by .5 creating MADTOWN.OUT.

  3. LAS> matrix "madtown.tm" out=madtown.tas matdim=(3,6) matval=(0.2909 0.2493 0.4806 0.5568 0.4438 0.1706 -0.2728 -0.2174 -0.5508 0.7221 0.0733 -0.1648 0.1446 0.1761 0.3322 0.3396 -0.621 -0.4186) odtype=r*4

    The six bands of MADTOWN.TM are multiplied by the coefficents in MATVAL to produce a three-banded image titled MADTOWN.TAS. This image is a REAL*4 image which is essentially the same image as if the module TASSELCP were run with the same coefficients.

Description/Algorithm:

The module retrieves the input parameters, determines the size of the coefficient matrix, checks the number of coefficients, and certifies that the input image is valid. It then performs the following operation using matrix algebra:

                 AX = Y
where:
   A: is a matrix of coefficients, one for each band of the 
      input image
   X: is the input image
   Y: is the output image

The expanded version of the equation would be:

       __                      __    __    __       __    __  
      |                          |  |        |     |        |
      | A(1,1) A(1,2) ... A(1,N) |  | X(1,1) |     | Y(1,1) |
      | A(2,1) A(2,2) ... A(2,N) |  | X(2,1) |     | Y(2,1) |
      |     .      .          .  |  |     .  |     |     .  |
      |     .      .          .  |  |     .  |  =  |     .  |
      |     .      .          .  |  |     .  |     |     .  |
      | A(M,1) A(M,2) ... A(M,N) |  | X(M,1) |     | Y(M,1) |
      |__                      __|  |__    __|     |__    __|

For a two-band image with four input coefficients in a 2 x 2 matrix, the algorithm is:

       __            __    __     __       __      __ 
      |                |  |         |     |          |
      | A(1,1)  A(1,2) |  | inband1 |     | outband1 |
      | A(2,1)  A(2,2) |  | inband2 |  =  | outband2 |
      |__            __|  |__     __|     |__      __| 

                      or
  
A(1,1) * inband1(x,y) + A(1,2) * inband2(x,y) = outband1(x,y)
A(2,1) * inband1(x,y) + A(2,2) * inband2(x,y) = outband2(x,y)

where:
   x and y are the line and sample.

Nonfatal Error Messages:

  1. [matrix-history] Error accessing the history information

    A nonfatal error occurred during the processing of the history information.

  2. [matrix-minmax] Error updating minmax information

    The minimum and maximum information within the DDR file could not be updated.

  3. [matrix-close] Error closing image files

    An error occurred in closing the image files.

Fatal Error Messages:

  1. [matrix-getin] Fatal error encountered

    Unable to get input image.

  2. [matrix-window] Input images do not have the same window sizes

    Message indicates that the number of lines or samples in image IN are not equal. To correct the error, use the window option to indicate the lines and samples to be used.

  3. [matrix-getout] Fatal error encountered

    Unable to get output image.

  4. [matrix-open] Unable to open input image

    Unable to open input image. Verify that the image exists.

  5. [matrix-open] Unable to open output image

    Unable to open output image. Check the syntax of the output image name.

  6. [matrix-alloc] Error allocating dynamic memory

    Cannot access dynamic memory buffer.

  7. [matrix-bands] Incorrect number of bands

    The bands entered do not correspond to the size of the matrix.

  8. [matrix-values] Incorrect number of values

    The values entered do not correspond to the size of the matrix.

User Notes:

  1. Related LAS modules include FACTOR.