Image processing



What to do with the loners ?

The classification procedure usually leaves you with a small number of isolated, generally poorly classified or unclassified, pixels that are often located at the boundaries between two clearly assigned areas. They give the picture a ‘pointillist’ look that may be problematic for producing maps. In such a case, homogenising the classification by reassigning the pixels to one or the other class is desirable. Filtering techniques are also used to achieve this.

Modal filtering involves assigning an isolated pixel to the dominant class within which it lies. A 3x3-pixel mobile window is used to analyse the image for each pixel in order to determine the dominant class around the central pixel. The pixel is then assigned to this class. The major drawback of modal filtering is that it skews the picture in the dominant classes’ favour, especially at the boundaries between two classes, to the detriment of the less represented classes or those corresponding to linear structures, such as the road network, or dispersed habitats, such as scattered dwellings. In the image opposite the small details have disappeared, but the filter has also altered all of the contours of the image, causing the linear boundaries and straight angles to disappear.

Here is the effect of applying modal filtering to the classification applied to the Eau d’Heure lakes image. This filtering did indeed remove most of the isolated pixels that interfered with a reading of the image, but also changed all of the groups of pixels’ shapes by softening their outlines.

One possible alternative is to use filters that allow you to specify the exact context in which a pixel must be reassigned to another class. This can be done using the dilation and erosion filters of mathematical morphology. These filters are applied to a binary mask of the class that one wants to process. In a 3x3 mobile window, dilation consists in enlarging the class’s mask by assigning the mask’s value to any pixel that is immediately next to it. The reverse operation, erosion, is then performed and the difference between the resulting and original masks enables one to single out the pixels that must be reassigned to a new class. As the illustration shows, dilation and erosion can be performed using larger windows.

Another approach is to calculate the connections that exist between pixels of the same class in the image as a whole. In this way, each pixel is connected to a value that gives the size of the homogeneous spot that is connected to it. The decision to replace an isolated pixel by the dominant value of its neighbourhood is then based on this value. 

Here we see the effect of this filter on the classification of the Eau d’Heure image. The isolated pixels were reclassified in the neighbourhood’s dominant class, but the forests’ general shapes are conserved much better than in the preceding example.