The previous post was dedicated to picking the right supervised classification method. And this time we will look at how to perform supervised classification in ENVI. We will take parallelepiped classification as an example as it is mathematically the easiest algorithm. In ENVI working with any other type of supervised classification is very similar to the one we will look at here. The classification procedure interface is practically the same for all the algorithms. The only thing that differs is the parameter that sets the sensitivity of the procedure. So, if the user learns to do a parallelepiped classification, they can easily use ENVI for other classification algorithms.
First, a little bit of theory. For clarity, we will take the easiest case – two dimensional spectral feature space (figure 1). Here we need to tell a few classes apart. In the image we cas see three point clouds, that represent three classes. These clouds do not overlap. This is exactly the case when one needs to used parallelepiped classification algorithm.
Figure 1. Hypothetical example of when parallelepiped classification is best
To perform parallelepiped classification the software requires two parameters for each of the classes. These are the average brightness value and standard deviation from the mean in all channels of the image.
In our hypothetical example in Figure 1, we have two channels, so the spectral feature space is two-dimensional. Both parameters that are necessary for classification are calculated by the software from training samples created by the user.
Classification process has three stages (Fig. 2). In the first stage the algorithm sets the centers for each class in the spectral feature space. This is why it is necessary to know the average brightness of classes in all channels of the image. Figure 2A shows the centers of three classes marked with red, blue and green dots.
Next, the algorithm finds extreme points of each class. To do this lines are laid from the class centres parallel to the feature space axes. Their lengths equal to several standard deviations. The exact value is set by the user, and this setting influences the sensitivity of the classification. This amount may be the same for all classes, but it may also vary.
Figure 2B shows the second stage of classification. 3 standard deviations are laid for the red class, and 4 standard deviations for the green and blue classes.
Figure 2. Classification stages
On the final stage (Fig. 2C) the algorithm lays lines, that enclose the point clouds, parallel to axes, crossing the points of extremes. All values that are inside are assigned to the appropriate class. In Figure 2, we see that the geometric shape that limits a class is a parallelepiped. That’s where the algorithm name comes from. In the three-dimensional spectral classes will be limited by a parallelogram. If there are more than three channels in the image, the shape is a so-called hyperparallelepiped.
We will practice the classification by using an old example. This is a portion of a satellite Landsat 5 TM image taken on the 16th of September 2009 (Fig. 3). We will need to separate three object classes in the area around Siversky Donets river near Mokhnach: deciduous forests, coniferous forests and water bodies.
Figure 3. Landsat image (left) and training regions (right)
1) All the procedures of supervised classification start from creating a training set. This is the supervision part of the process. In ENVI it is implemented through creating regions of interest (ROIs). Each class has its own set of ROIs. What one needs to do next is to check the quality of regions of interest selected (to know about it in more detail see this post).
2) Using n-D Vizualizer see the locations of your class point clouds in the feature space (read about it here). If they do not overlap, then we can use parallelepiped classification method.
3) When the training sets are created the classification procedure can be started. For this pick Classification→Supervised Classification→Parallelepiped Classification in the Toolbox. Classification Input File window will open. Select the image that needs to be classified.
4) After selecting the image another window will appear – Parallelepiped Parameters. Classification parameters need to be set in this window. There are four settings that correspond to different sections of the window (Parallelepiped Parameters):
- Select Classes from Regions
- Set Max stdev from Mean
- Output Result to
- Output Rule Images
Figure 4. Parallelepiped Parameters window
5) The list of regions of interest consists of all the ROIs that were created during the current ENVI session. But we may want to only use some of them for training. So, by default none of the ROIs are selected, pick the ones you want to use by left-clicking. In case all the regions need to be selected press Select All Items button. Clear All Items button clears the selection.
6) Set the maximum standard deviation from the mean. ENVI has three different settings for this indicator: None, Single Value, Multiple Values. Examples of results for these options are shown in Figure 5.
Figure 5. Classification results for different settings of standard deviation from the mean. A – None, B – Single Value (standard deviation equals to 3), C – Single Value (standard deviation equals to 4), D – Multiple Value (standard deviation for water bodies is 3.5, deciduous forests – 5.0, for coniferous forests – 6,0)
A) If you choose None, the value of zero will be used. No entry is not necessary at this time. The procedure of classification will search only for those pixels that strictly equal to the class average, as set in the ROI. Generally, using this setting the values for class areas will be very small (Fig. 5A).
B) The default option is Single Value – the same value for all classes. This option is best when the point clouds of the values have similar sizes in the multidimensional feature space. If they do differ in size, in some cases it is still possible to use the same value of the maximum deviation from the mean. This is the case when the distance between clouds is large enough. Thus parallelepipeds defined by the size of the largest cloud do not overlap each other.
In the default Single Value option the maximum standard deviation from the mean is set to 3.00. You can put a different value to suit your case. If the value is below optimal, area classes will be less than the real ones, so there will be errors of omission. We see in Figure 5B, where forests have areas of white spots. If the value is higher than optimal, area classes will be inflated, so errors of commision will take place. An example of this can be seen in Figure 5C, where much more water than is actually in the area is classified.
C) In case the class point clouds have different sizes (diameters) in the spectral feature space, then the Multiple Values option should be used. If you set the radio button to this option an Assign Multiple Values button will appear. Press it to open Assign Max stdv from Mean window, it conrains a list of ROIs and a value entry field (Edit Select Item:).
Select each ROI and set the maximum standard deviation value.
Figure 6. Setting the standard deviation for each class
7) Set the save options for classification results. These can be temporary (Memory) and to a permanent file (File).
8) Set output rule images saving options. We will not look into rule images now. Briefly, these are images of class areas at various valuse of clasification parameters (standard deviation in case of parallelepiped algorithm). Rule images are used for so-called Rule-based classification and for creating ROC-curves. There will be separate posts on these procedures. If you are not planning to perform these classifications than there is no need to save rule images. Choose No (Yes is set by default). Similarly to classification results, output rule images can be temporary and to a file.
9) After finishing the settings you can press OK and you will get the classification results straight away. But in case the standard deviation values were not set correctly, the classification results will be unsatisfactory. That is why ENVI has a results preview option. For this press the Preview button (figure 7). The Parallelepiped Parameters window will be expanded and will now have a Classification Preview portion.
Figure 7. Classification result preview
10) By default you can preview a portion of 256 by 256 pixels in the centre of the image. To change this press Change View…
Figure 8. Change image subset for classification preview
Select Spatial Subset window will appear, where you can select another area of the image. You can do this in two ways. You can enter the exact screen coordinates for the upper left corner of the image fragment. For this use Samples and Lines fields. But most likely you like the visual way. To use this option press the Image button in the Select Spatial Subset window (Fig. 8, left). Subset by Image window will appear, it shows the entire picture on a reduced scale and red rectangular box highlights the preview area (Fig. 8, right). Left-click on the red box. By holding the left mouse button, drag the box to a new location, and then click OK. Click OK in the Select Spatial Subset window and the preview image is automatically updated.
11) If the preview results do not look satisfactory, change the standard deviation values. Run the preview again after doing that. And so, Through trial and error you will find the optimum value of the maximum deviation and will get a quality classification result.
2 thoughts on “Supervised image classification using parallelepiped algorithm”
Thanks for beautiful article. Enjoyed reading it. Minor error in the description
parallelogram is 2D
parallelopiped is 3D
Yes, this is a true remark