This routine is obsolete and has been replaced with ENVICalculateConfusionMatrixFromRaster.
Use this procedure to compute the confusion matrix, commission, omission, accuracy, and kappa coefficient, between a classification image and its ground truth. You can specify ground truth as a classification image using the GTFID keyword, or as an ROI using the ROI_IDS keyword.
Syntax
ENVI_DOIT, 'CLASS_CONFUSION_DOIT' [, ACCURACY=variable], CALC_PERCENT={0 | 1 | 2} | CFID=file ID, CLASS_PTR=value [, COMMISSION=variable], CPOS=array, DIMS=array, GT_NAMES=array, GT_PTR=value, GTDIMS=array, GTFID=file ID, GTPOS=integer [, KAPPA_COEFF=variable] [, MATRIX=variable] [, OMISSION=variable], ROI_IDS=variable [, /RPT_COMMISSION] [, RULE_OUT_BNAME=string array] [, RULE_OUT_NAME=string] [, /RULE_IN_MEMORY] [, /TO_SCREEN]
Keywords
ACCURACY (optional)
Use this keyword to specify a named variable that contains the accuracy between the classification image and the ground truth.
CALC_PERCENT
Set this keyword to one of the following values to specify units for the confusion matrix:
- 0: Output the confusion matrix in pixel counts
- 1: Output the confusion matrix in percent
- 2: Output both types of confusion matrix
CFID
Use this keyword to specify the file ID of the classification file. This value is returned from the keyword R_FID in the ENVI_OPEN_FILE procedure. CFID is a long integer with a value greater than 0. An invalid file ID has a value of -1.
CLASS_PTR
Use this keyword to specify which classes in the classification image match the ground truth ROIs or the ground truth classes specified by GT_PTR. The number of elements of CLASS_PTR must equal the number of ROIs when using ROIs, or the number of elements of CLASS_PTR must equal the number of elements of GT_PTR when using a ground truth classification image.
COMMISSION (optional)
Use this keyword to specify a named variable that contains the commission array between the classification image and the ground truth.
CPOS
Use this keyword to specify an array of band positions for the classification image, indicating the band numbers on which to perform the operation. CPOS is an array of long integers, ranging from 0 to the number of bands minus 1.
DIMS
The “dimensions” keyword is a five-element array of long integers that defines the spatial subset (of a file or array) to use for processing. Nearly every time you specify the keyword FID, you must also specify the spatial subset of the corresponding file (even if the entire file, with no spatial subsetting, is to be processed).
- DIMS[0]: A pointer to an open ROI; use only in cases where ROIs define the spatial subset. Otherwise, set to -1L.
- DIMS[1]: The starting sample number. The first x pixel is 0.
- DIMS[2]: The ending sample number
- DIMS[3]: The starting line number. The first y pixel is 0.
- DIMS[4]: The ending line number
To process an entire file (with no spatial subsetting), define DIMS as shown in the following code example. This example assumes you have already opened a file using ENVI_SELECT or ENVI_PICKFILE:
envi_file_query, fid, dims=dims
GT_NAMES
Use this keyword to specify names for each ground truth class. GT_NAMES is an array of strings with the same number of elements as GT_PTR or ROI_IDS, depending on which type of ground truth you use.
GT_PTR
Use this keyword to specify which classes in the ground truth image match the classification classes. You do not need this keyword if you use ROIs for ground truth. The number of elements of GT_PTR must equal the number of elements of CLASS_PTR.
GTDIMS
Use this keyword to specify the spatial dimensions of the ground truth image on which to perform the operation. This keyword is not needed if you use ROIs for ground truth. GTDIMS is a five-element array of long integers with the following definitions:
- DIMS[0]: Unused for this function, set to -1
- DIMS[1]: The starting x pixel (0)
- DIMS[2]: The ending x pixel
- DIMS[3]: The starting y pixel (0)
- DIMS[4]: The ending y pixel
Note that the dimensions you specify must be within the classification image, including the first pixel offsets.
GTFID
Use this keyword to specify the file ID of the ground truth file. This value is returned from the keyword R_FID in the ENVI_OPEN_FILE procedure. GTFID is a long integer with a value greater than 0. An invalid file ID has a value of -1.
GTPOS
Use this keyword to specify the band position for the ground truth image band, indicating the band numbers on which to perform the operation. You do not need this keyword if you use ROIs for ground truth. GTPOS is an array of long integers, ranging from 0 to the number of bands minus 1.
KAPPA_COEFF (optional)
Use this keyword to specify a named variable that contains the kappa coefficient between the classification image and the ground truth.
MATRIX (Optional)
Use this keyword to specify a named variable that contains the confusion matrix (in pixel counts) between the classification image and the ground truth.
OMISSION (optional)
Use this keyword to specify a named variable that contains the omission array between the classification image and the ground truth.
ROI_IDS
Use this keyword to specify the ROI IDs for the ground truth. This keyword is not needed if you use a ground truth image. Use the keyword GTFID in this case. The number of ROI_IDS must be equal to the number of elements in the CLASS_PTR array.
RPT_COMMISSION (optional)
Set this keyword to report the commission to the screen.
RULE_OUT_BNAME (optional)
Use this keyword to specify a string array that contains the output band names for the rule image.
RULE_OUT_NAME (optional)
Use this keyword to specify an output filename for the rule image. If this item is present, the rule image is automatically saved.
RULE_IN_MEMORY (optional)
Set this keyword to store output rule images in memory.
TO_SCREEN (optional)
Set this keyword to report the confusion matrix to the screen.