Compute statistics for training sites and classes
Computes statistics for training sites and classes. Mean vectors, covariance and correlation matrices and histograms are computed for training sites and classes. The user may exclude certain grey values from statistics calculations by specifying subcommand -CUT; if subcommand -ALL is specified, then all the data will be used to calculate statistics. Polygons representing training sites must have been previously selected. Coordinates of the polygons are contained in the statistics file. Up to 256 classes and 256 sites may be processed.
- IN
- Input image. Statistics will be computed for the classes and sites that are located on this image. The data type of IN may be BYTE, INTEGER*2, INTEGER*4, or REAL*4. No windowing is allowed. The image may contain up to 256 bands. Any polygons that are not entirely within the input image will be excluded from calculations.
- INSTAT
- Statistics file. The input/output statistics file. It contains the coordinates of the polygons as well as the statistics. Any existing statistics will be overwritten if specified. The user will be interactively prompted to overwrite any existing statistics. If a polygon does not fit within the image, the mean vector, covariance matrix and the number of points for that polygon will all be set to zero and that polygon will not contribute to calculations for the class statistics. If none of the polygons fit within the image, processing will halt and INSTAT will not be changed.
- MEANFLG(YES)
- Mean option. Determines whether or not STATS will calculate mean vectors for the polygons.
= YES: Calculate mean vector. New mean vectors will be calculated and written into the input statistics file. Any existing mean vectors will be lost. = NO: Do not calculate vector. Existing mean vectors are retained.
- COVARFLG(YES)
- Covariance option. Determines whether or not STATS will calculate covariance and correlation matrices for the current set of input polygons.
= YES: Calculate covariance and correlation matrices. New matrices will be calculated and written into the input statistics file. Any existing matrices will be lost. = NO: Do not calculate covariance and correlation matrices. Existing matrices are retained.
- HISTFLG(YES)
- Histogram option. Specifies whether or not STATS will calculate histograms for the data contained in the polygons.
= YES: Generate histogram. New histograms are calculated and written into the input statistics file. Existing histograms will be lost. = NO: No histogram. Existing histograms in the statistics file are retained. Note: The following naming convention is used for histograms: HIST001 - band 1 HIST002 - band 2 . . . . HIST00n band n
- NCLASS(--)
- Number of classes. If NCLASS is not equal to 0, the user will be prompted NCLASS times for the following:
1. "ENTER CLASS NAME" (name of class to be processed) 2. "ENTER NUMBER OF SITES FOR THIS CLASS" (# of sites to process; "0" or carriage return for all sites) If the specified number of sites is not equal to the total number of sites in the class, the user is then prompted: 3. "ENTER SITE NAMES, 1 PER LINE" (names of sites to be processed)
- OPTION(-- )
- List option. Allows the user to display the class names, the site names, or both the class and site names in the statistics file prior to processing.
= CLASS: List class names. Allows the user to display the class names in the statistics file prior to processing. = SITE: List site names. Allows the user to display the site names in the statistics file prior to processing. = BOTH: List both class and site names. Allows user to display both the class and site names in the statistics file prior to processing.
- IN
- Input image. Statistics will be computed for the classes and sites that are located on this image. The data type of IN may be BYTE, INTEGER*2, INTEGER*4, or REAL*4. No windowing is allowed. The image may contain up to 256 bands. Any polygons that are not entirely within the input image will be excluded from calculations.
- INSTAT
- Statistics file. The input/output statistics file. It contains the coordinates of the polygons as well as the statistics. Any existing statistics will be overwritten if specified. The user will be interactively prompted to overwrite any existing statistics. If a polygon does not fit within the image, the mean vector, covariance matrix and the number of points for that polygon will all be set to zero and that polygon will not contribute to calculations for the class statistics. If none of the polygons fit within the image, processing will halt and INSTAT will not be changed.
- MEANFLG(YES)
- Mean option. Determines whether or not STATS will calculate mean vectors for the polygons.
= YES: Calculate mean vector. New mean vectors will be calculated and written into the input statistics file. Any existing mean vectors will be lost. = NO: Do not calculate vector. Existing mean vectors are retained.
- COVARFLG(YES)
- Covariance option. Determines whether or not STATS will calculate covariance and correlation matrices for the current set of input polygons.
= YES: Calculate covariance and correlation matrices. New matrices will be calculated and written into the input statistics file. Any existing matrices will be lost. = NO: Do not calculate covariance and correlation matrices. Existing matrices are retained.
- HISTFLG(YES)
- Histogram option. Specifies whether or not STATS will calculate histograms for the data contained in the polygons.
= YES: Generate histogram. New histograms are calculated and written into the input statistics file. Existing histograms will be lost. = NO: No histogram. Existing histograms in the statistics file are retained. Note: The following naming convention is used for histograms: HIST001 - band 1 HIST002 - band 2 . . . . HIST00n band n
- NCLASS(--)
- Number of classes. If NCLASS is not equal to 0, the user will be prompted NCLASS times for the following:
1. "ENTER CLASS NAME" (name of class to be processed) 2. "ENTER NUMBER OF SITES FOR THIS CLASS" (# of sites to process; "0" or carriage return for all sites) If the specified number of sites is not equal to the total number of sites in the class, the user is then prompted: 3. "ENTER SITE NAMES, 1 PER LINE" (names of sites to be processed)
- OPTION(--)
- List option. Allows the user to display the class names, the site names, or both the class and site names in the statistics file prior to processing.
= CLASS: List class names. Allows the user to display the class names in the statistics file prior to processing. = SITE: List site names. Allows the user to display the site names in the statistics file prior to processing. = BOTH: List both class and site names. Allows user to display both the class and site names in the statistics file prior to processing.
- BANDS
- Band numbers. Specifies the band numbers for which corresponding cutting ranges have been given. The number of values for BANDS, HIGHVAL, and LOWVAL must be equal.
- LOWVAL
- Low cutting value. Specifies the lower value(s) of the cutting range for the band(s) specified by the BANDS parameter. All pixels with values between LOWVAL and HIGHVAL inclusive for the appropriate image band specified in BANDS will be excluded from statistics calculations. Corresponding pixels in all other image bands will also be excluded. For example, if values from 12 to 20 are specified for cutting in band 2, then the corresponding pixels in all other bands will also be excluded from statistics calculations. The number of pixels used for calculations will therefore be the same for all bands.
- HIGHVAL
- High cutting value. Specifies the upper value(s) of the cutting range for the band(s) specified by the BANDS parameter. All pixels with values between LOWVAL and HIGHVAL, inclusive, for the appropriate image band specified in BANDS, will be excluded from statistics calculations. See HELP for LOWVAL for further information.
The mean vectors, correlation and covariance matrices, and histograms for three classes in the statistics file SCENE.DAT are computed for the image COLOR.IMG. The user is prompted for the class names. The class and site names in the file are listed before processing.
The mean vectors and covariance and correlation matrices for all classes in the statistics file LAND.DAT are computed for the image WATER.IMG. The histograms are not calculated.
This example is the same as Example 2 except that pixels with values between 63 and 68 in band 2 and pixels with values between 27 and 31 in band 3 are excluded from computations. Note that these pixels are excluded from all the bands.
Using the specified classes and sites, the statistics are calculated as follows: Site Mean Vector:
- - - - x = x (1) , x (2) , ... x (d) 1 1 1 1 where - -1 N x(p) = N x(p) 1 SUM i1 i=1 Site Covariance: N -1 - - C (p,q) = (N-1) SUM [x(p) -x(p) ] [x(q) -x(q) ] 1 i1 1 i1 1 i=1 where p,q = 1, ... d d = number of bands of input image N = number of pixels in a training site x(p)i1 denotes the gray level at pixel i at site 1 in band p The site statistics are then combined to generate class statistics. Class Mean Vector: - -1 - - - x(p) = NP (N x(p) + N x(p) + ... N x(p) ) 1 1 2 2 m m Class Covariance: m m -1 - - - - C(p,q) = (NP-1) [SUM (N -1)C (p,q) + SUM N [x(p) -x(p)][x(q) - x(q) ] ] i 1 i i i i=1 i=1 where Ni = number of pixels at site i NP = total number of pixels in a class m = number of sites in a classSite histograms are calculated and then combined to form class histograms.
The user is given three chances to enter a valid class name.
The user is given three chances to enter a valid site name.
Check data in statistics file.
Check data in statistics file.
Either specify new file or overwrite current file.
The input image name must be specified without a window.
Check the value given for the parameter IN and rerun.
Stats was asked to process more classes than the statistics file held. Check the value of the parameter NCLASS.
The user is given three chances to specify a valid class name. After three failures, the program terminates.
The user is given three chances to specify a valid site name. After three failures, the program terminates.
The maximum number of site vertices is 200. Simplify site shapes and rerun program.
The BANDS, HIGHVAL, and LOWVAL parameters must have the same number of values.
Respecify LOWVAL and HIGHVAL such that LOWVAL(1) < HIGHVAL(1), LOWVAL(2) < HIGHVAL(2), etc.
Cutting was requested on an image band not given as input.
The polygon vertices for all sites fell outside the given image. This occurs most often when the image given for IN is not the image used to generate the polygons. (See User Note 5.)
Check statistics file.
The polygon vertices fell outside the given image. This occurs most often when the image given for IN is not the image used to generate the polygons. (See User Note 5.)
Did not replace current statistics in file.
Respecify input image file.
Respecify statistics file.
o Use the program EDITSTAT. Copy the polygons to a new statistics file (to preserve the original) and use the EDITSITE function within EDITSTAT to make the polygons conform to the input image master scene coordinates. (This method is recommended.) o Use the program EDITDDR to modify the master line and sample coordinates of the input image to conform to the polygons.
The program DSPDDR may be used to show the master line and sample coordinates.