IPCLASSIFY Function (PV-WAVE Extreme Advantage)
Performs supervised classification using maximum likelihood classifier.
Usage
result = IPCLASSIFY(image, training_pixels[, threshold,
probability])
result = IPCLASSIFY(image, class_params)
Input Parameters
image—A 2D or 3D array of any type except string or complex that contains an image; or image, row, or pixel-interleaved images.
training_pixels—Training information for the desired classification. This parameter is an associative array with the following keys:
'pixels'—A list of pixel-element number arrays, each defining a separate training region.
'class_numbers'—An integer array of class numbers greater than 0 corresponding to the training regions listed in
'pixels'.
threshold—(optional) A floating-point array containing the threshold for each class.
probability—(optional) A floating-point array containing the probability for each class.
class_params—The statistical parameters for each class. This parameter is an associative array with the following keys:
'class'—An integer array containing the class number (greater than 0) for each class.
'covariance'—A list of floating-point arrays (for 3D input images) or an array of floating-point values (for 2D input images) that are the covariances for each class.
'mean'—A list of floating-point arrays (for 3D input images) or an array of floating-point values (for 2D input images) that are the mean vectors for each class.
'probability'—(optional) A floating-point array containing the probability for each class.
'threshold'—(optional) A floating-point array containing the threshold for each class.
Returned Value
result—A 2D array of byte or integer data type containing the class number of each pixel in image.
Keywords
Class_Stats—Specifies a variable to hold the classification statistics determined for the image. The Class_Stats keyword is an associative array with the following keys:
'class'—An integer array containing the class number (greater than 0) for each class.
'covariance'—A list of floating-point arrays (for 3D input images) or an array of floating-point values (for 2D input images) that are the covariances for each class.
'mean'—A list of floating-point arrays (for 3D input images) or an array of floating-point values (for 2D input images) that are the mean vectors for each class.
'probability'—A floating-point array containing the probability for each class.
'threshold'—A floating-point array containing the threshold for each class.
Intleave—A scalar string indicating the type of interleaving of 3D input image arrays. Valid strings and the corresponding interleaving methods are:
'pixel'—The input array arrangement is (
p,
x,
y) for
p pixel-interleaved images of
x-by-
y.
'row'—The 3D
image array arrangement is (
x,
p,
y) for
p row-interleaved images of
x-by-
y.
'image'—The 3D
image array arrangement is (
x,
y,
p) for
p image-interleaved images of
x-by-
y.
Discussion
IPCLASSIFY uses the maximum likelihood decision rule to classify each pixel in an image. The decision-rule is based on discriminant functions, gi(x) for each pixel position x and each class ωi:
gi(x) = ln (p(x|ωi)) + ln (p(ωi))
Classification is performed according to:
x ∈ ωi if p(ωi|x) > p(ωj|x) for all j ≠ i
and:
gi(x) > Ti
Assuming normal statistics, the discriminant function for maximum likelihood classification is represented as follows:
where Σi is the covariance matrix, mi is the mean vector, p(ωi) is the probability, and Ti is the threshold for class i. The default case is for equal prior probabilities. In other words, for M total classes,
p(ωi) = 1.0/M for all i
The default threshold values are chosen such that 95% of all pixels in a class will be classified, based on a Chi-squared distribution:
Example
; Read an image.
image = IMAGE_READ(!IP_Data + 'boulder_image.tif')
; Make an associative array of training information. Region1,
; region2, and region3 are long arrays that contain pixel
; numbers. Equal prior probabilities will be used as well as
; default class thresholds.
training_pixels = ASARR('pixels', LIST(region1, $
region2, region3), 'class_numbers', [1, 2, 3])
; Classify the image using a maximum likelihood classifier.
class_image = IPCLASSIFY(image('pixels'), training_pixels, $
class_stats = class_stats)
; Display the classified image.
TVSCL, class_image
land_image = IMAGE_READ(!IP_Data + 'landsat.tif')
; New images can now be classified using the Class_Stats keyword.
class_image2 = IPCLASSIFY(land_image('pixels', Class_Stats)
; Display the newly classified image.
TVSCL, class_image2
See Also