dqi is the nearest-neighbour distance, min is the minimum distance,and dist is the Euclidian distance between the query pixel q and a pixel xi belonging to a specific spectral class Si, which is a subset of the entire image.In step 4, the contextual feature vectors are classified using clustering techniques that group the pixels with similar contextual feature vectors to create new classes that are based on contextual information. This classification can either be supervised or unsupervised.Supervised classification entails identifying a number of cluster centres using training areas. A basic example is an area of forest that has been marked as a training area for the class forest and an urban area that has been marked as urban. Based on the contextual feature vectors covered by the training areas, a mean cluster centre is calculated. All of the contextual feature vectors are then compared with the mean cluster centres and are assigned the closest centre. An example of unsupervised classification is the common method of a moving K-mean cluster analysis in which the user decides the number of clusters (K). For each cluster, a mean vector is located within the multidimensional space created by the contextual feature vectors. The dimensions are the distance to each individual spectral class. Therefore, if there are ten classes,then there are ten dimensions, and each pixel has a position in the ten-dimensional space. The moving K-mean clustering algorithmapplied to the contextual feature can be defined as: