Calculate class statistics of multispectral images via a classified image mask.
Uses a classified input image (or "mask") to collect pixels according to class from an input data image and produces an output statistics file containing statistics for each class.
- MASKIMG
- Input classified image. It must be a single-band byte image. If the user has run UNKNOWN on this image, it may contain 0 or 255 for the UNKNOWN class. These classes will be ignored in making the statistical calculations.
- IN
- Input image. Specifies the input multispectral image for which class statistics will be computed.
- OUTSTAT
- Output statistics file. The class statistics stored in OUTSTAT are:
MEAN_VECTOR COVARIANCE_MATRIX HISTOGRAM for each input band NPOINTS (# points in class)
The mean vector, number of points, covariance matrix, and histogram for each class are calculated and placed in MASK.STATS. Classes are obtained from CLASS. The area in the multispectral image IMAGE from which statistics are taken is given by the size of CLASS.
Statistics are computed from the upper-left corner of images defined by the input image MULT.IMAGE and output to CORNER;STAT.
Statistics are computed for the 10 x 10 area in DC beginning at SL=500, SS=500 according to the classes given in the upper-left corner of OUT.CLASS.
MASKSTAT obtains the class (a number between 0 and 255) of a pixel from the input classified image. The value of a pixel at the same location in the input image is obtained and used in the statistical computations for that class. The mean vector, covariance matrix, number of pixels, and histogram of each class are calculated for the input image and written out to a statistics file. The area for which statistics are computed is determined by the intersection of the size or windowed size of the input classified image and the input image.If the program UNKNOWN has been previously run on the input classified image, pixels having unknown class may have been set to 0 or 255 in the classified image. Statistics are not computed for these pixels.
MASKSTAT calculates the following statistics:
o Number of pixels in each class o Class mean vectors o Class covariance matrices o Class histograms for each bandStatistics are calculated using an iterative technique adopted from B. P. Welford, "Note on a method for calculating corrected sums of squares and products," Technometrics, vol. 4, no. 3, 1962, pp. 419-20, as follows:
N a SUM x i,m i=1 X = --------------------- m N a N a i ( SUM x ) ( SUM x ) SUM ---( j=1 j,k ) ( j=1 j,m ) i=2 i-1( x - ----------- ) ( x - --------- ) ( i,k i ) ( i,m i ) C = --------------------------------------------------- k,m N - 1 aThis iterative procedure for calculating the covariances is more precise than traditional one-pass procedures, since it avoids the accumulation of very large sums and the subtraction of two very large numbers close together in value. The technique, therefore, is highly suitable for image data where there may be very large numbers of pixels in a single class.The program writes to the output statistics file the class names, number of data points, mean vectors, covariance matrices, and histograms.
MASKIMG may not contain more than one band. If the user desires to run a set of bands against more than one classified image, MASKSTAT may be run repeatedly.
Only integer values between 0 and 255 are appropriate for a classified image.
The data type of the input images or class must be BYTE, and may be changed by first running CONVERT.