1
Marcin Iwanowski
Morphological Classification of Binary Image’s Pixels Marcin Iwanowski Institute of Control and Industrial Electronics, Warsaw University of Technology ul.Koszykowa 75, 00-662 Warszawa POLAND e-mail:
[email protected]
September 2, 2008
Abstract. The paper presents a novel approach to the classification of binary image pixels which is based on mathematical morphology. The proposed method makes use of new operators of class extractors to extract from the original image pixels belonging to pre-defined classes. Classes consist of pixels characterized by particular morphological properties. In the paper, a general scheme of morphological classifier is introduced. Depending on class to detect, various extractors can be defined based on mathematical morphology. Extracted classes can be organized in a structure of a class hierarchy tree. Apart from the general framework of morphological classifier also various class–extractors are described. Also, the class distribution functions, which can be used as shape descriptors for pattern recognition, are introduced in the paper. Finally, two practical examples of classification of binary image pixels are presented in the paper: application to shape description and to analysis of the shape of water bodies. Key words: mathematical morphology, image classification, binary images
1. Introduction The classification task aims at assigning elements of the feature space into appropriate classes consisting of elements similar one to another. In image processing, classification can be performed either directly i.e. considering image pixels’ values or indirectly via feature vectors computed based on the image content. This paper describes a classification of the first kind, which classifies each binary image pixel into one of predefined classes. Contrary however to usual approach of this kind which treats pixels - most often represented by multi spectral vectors - as inputs of typical classifiers - Bayesian, nearest neighbor etc., proposed method uses operators of class extractors to extract from the original image pixels belonging to every class. Classes consist of pixels characterized by particular morphological properties. For example, pixels which are farther than certain distance from the boundary of object can belong to a single class, pixels belonging to thin, elongated connections between two thick shapes can form another one, etc. In the paper, a general scheme of morphological classifier is introduced. It is based on the class-extractor type of morphological operator. Depending on class to detect, various extractors can be defined. They are based on morphological image processing operations like simple morphological operations (e.g. erosion), filters, reconstruction, etc., used Machine GRAPHICS & VISION vol. , no. , pp.
2
Morphological Classification
with different structuring elements. Also the anchored skeletonization method is used in the proposed framework. The morphological classes can be organized in a structure of binary tree of class hierarchy. This tree shows all the classes and their sub-classes and reflects the way of extracting them. Also, class distribution functions are introduced in the paper. These functions are expressing the number or the percentage of pixels belonging to chosen classes depending on the size of a structuring element used. They can be used as shape descriptors for pattern recognition. The application opportunities of the method is illustrated by two examples. The first one shows how the class distribution functions allow differentiating various shapes and consequently, allow their proper recognition. The second one aims at classifying regions on the binary image - water mask. The latter is obtained either on the basis of a map a terrain or by processing of the satellite imagery and shows the coverage of the water bodies - lakes, rivers, channels on the ground of the Earth. In this example a water mask of the Mazury region of Poland is used. The automatically detected spatial classes refer in this case to water regions of particular properties e.g. long and short channels, smaller and bigger islands, coves, shore and waterside areas etc. The paper is organized as follows. Chapter 2 recalls some important morphological notions. Chapter 3 introduces the idea of the morphological classifier and explains how the image can be described using the morphological classes. Chapter 4 presents applications of the morphological classifier and finally, chapter 5 concludes the paper. 2. Basic notions 2.1. Principles Since the proposed method deals with the binary images, the binary morphology notation will be used further in thix text. Binary image is defined as the image which values can be either 0 or 1. In 2D it is thus a mapping: {0, ..., xmax − 1} × {0, ..., ymax − 1} → {0, 1} where xmax and ymax stand for the image sizes. Let X be the set of pixels of value 1 of the binary image. For the simplicity reasons X will be later in this text referred to as (foreground) image, while the complement of X (i.e. set of pixels of value 0) will be referred to as background of X. Two base morphological operators are erosion and dilation [10, 4], which are defined as, respectively: X ⊖ B = ∩b∈B X−b ; X ⊕ B = ∪b∈B X−b ,
(1)
where Xb = {x + b, x ∈ X}. By combining erosion and dilation, among other operators, also two base morphological filters are defined: opening (erosion followed by dilation) and closing (dilation
Machine GRAPHICS & VISION vol. , no. , pp.
3
Marcin Iwanowski
......... ......... ......... ...111... ...111... ...111... ......... ......... ......... (a)
......... ......... ..11111.. ..11111.. ..11111.. ..11111.. ..11111.. ......... ......... (b)
......... .1111111. .1111111. .1111111. .1111111. .1111111. .1111111. .1111111. ......... (c)
......... ......... ......... ....1.... ...111... ....1.... ......... ......... ......... (d)
......... ......... ....1.... ...111... ..11111.. ...111... ....1.... ......... ......... (e)
......... ....1.... ...111... ..11111.. .1111111. ..11111.. ...111... ....1.... ......... (f)
......... ...111... ..11111.. .1111111. .1111111. .1111111. ..11111.. ...111... ......... (g)
Fig. 1. Structuring elements covering the neighborhood of size 1 - N8 (a), 2 - N8 ⊕ N8 (b) and 3 N8 ⊕ N8 ⊕ N8 (c), N4 (d), 2 - N4 ⊕ N4 (e) and 3 - N4 ⊕ N4 ⊕ N4 (f). Octagonal element of size 3 (g).
followed by erosion)1 . Structuring element B plays a crucial role in morphological image processing. It describes pixel’s neighborhood. The simplest neighborhood template consists of the closest pixel neighbors. In such case, in 2D case it is often called 4- or 8-connected elementary structuring element2 and consists of a central pixel plus 4 (horizontal and vertical) or 8 (horizontal, vertical and diagonal) closest neighbors. Such structuring elements will be referred to, later in this text, as N4 and N8 , respectively. Structuring element may also consist of neighboring pixels covering wider pixel neighborhood, of a given radius. Let then B (n) be the neighborhood of a radius n i.e. set of the all the closest (to the central point) pixels which are not farther than n. The structuring element B (n) can be defined in various ways. The simplest (and fastest) is based on superposition by successive dilations of n elementary structuring elements B (n) = B ′ ⊕B ′ ⊕...⊕B ′ where B ′ stands for an elementary structuring element. Since B ′ can be either 4- or 8-connected (B ′ = N4 or B ′ = N8 ), the final shape of B (n) can vary depending on it. The distance formulation which allows defining the radius is different for both cases. In the case B ′ = N4 , the B (n) contains the pixels which are located inside the circle of radius n defined on the basis of the city-block distance. In the case of B ′ = N8 the distance is implied by the max-norm. The shapes of such elements are shown in Fig. 1. In order to get the neighborhood of radius n according to the Euclidean distance the superposition by dilations cannot be used and the structuring element B (n) have to be computed individually for every n using specialized algorithms [8]. This yields to slower computation but, on the other hand, gives the neighborhood closer to usual way of considering the distance based on Euclidean metric. 1 The structuring element used in the first operator in each pair erosion/dilation must be the transposition of the element used is the second operator. But for elementary structuring elements, which are used in the current study, this assumption is not important because these elements are symmetric i.e. invariant to their transpositions. 2 6-connected grid is not considered here.
Machine GRAPHICS & VISION vol. , no. , pp.
4
Morphological Classification
There exists a stage between simple neighborhood defined by N4 or N8 and Euclidean distance-based approach: the approximation of Euclidean disk of a given radius by special structuring elements. One of the most popular is the octagon-shape element. Example of such element, of radius 3, is shown in Fig. 1(g). 2.2. Morphological reconstruction and filters based on it Morphological reconstruction is the operation which allows extracting from the binary image only chosen objects (connected components). These objects are indicated using the supplementary image called mask image. Morphological reconstruction is defined as a series of geodesic (or conditional) dilations which are defined as follows: (X ⊕Y B)(n) = (...(((X ⊕ B) ∩ Y ) ⊕ B) ∩ Y )... ∩ Y ), | {z }
(2)
n−times
where n stands for the size of geodesic dilation, X is an initial image and Y is a mask image. By performing geodesic dilations one after another, at certain moment the image under processing stops to change. This final image is defined as the result of reconstruction (by dilation). It can be formulated as follows: o n RY (X) = (X ⊕Y B)(k) , ; k = arg min (X ⊕Y B)(i) = (X ⊕Y B)(i+1) . i
(3)
Image X used in the equation 3 is referred to as the marker image because it contains markers which indicate object on the mask image Y . In other words, the marker image is reconstructed according to the content of the mask, which remains unchanged. Structuring element B used in the reconstruction is usually 4- or 8-connected elementary one (B = N4 or B = N8 ). Owing to iterative way of computing the geodesic dilations, wider neighborhoods are of minor importance3 . On the other hand, the choice among two above mentioned elements can strongly influence the final result of reconstruction. Due to that fact, the type structuring element, or - at least - type of connectivity should always be mentioned when describing the particular application of reconstruction. The morphological reconstruction can be computed either using the above definition or using specialized algorithms, which provides us with much faster computation of the reconstruction [5]. 2.3. Anchored homotopic skeletonization The way of performing skeletonization used in the current study is based on the notion of simple (or deletable) pixel [11, 9] i.e. such a pixel which can be removed without changing the homotopy of the binary image. 3 Except
from special cases, which are out of scope of this paper.
Machine GRAPHICS & VISION vol. , no. , pp.
Marcin Iwanowski
5
A pixel p belonging to the image X is simple if and only if it satisfies the following three conditions: 1. NG (p) ∩ X 6= ∅, 2. NG ′ (p) ∩ X C 6= ∅, 3. ∃S ∈ CC G (N8 (p) ∩ X) such that NG (p) ∩ X ⊆ S, where X C stands for the complement of image X. NG and NG ′ represents the closest neighborhood of foreground and background pixels respectively. Due to risk of falling down on the connectivity paradox, different connectivity should be used for the foreground and for the background. So either G = 8 and G ′ = 4, or inversely. Function CCG returns the set of G-connected components of its argument. The fast computation of simpleness can be achieved using the look-up table for the neighborhood configurations. By the successive removal of simple pixels the image is thinned. Image obtained by this thinning performed till idempotence is a skeleton which is also referred to as homotopic marking. In order to get more balanced skeleton it is advised to perform the thinning in two stage iterative process. In the first phase the simple pixels are detected within the whole image (but not yet removed). The removal is performed in the second phase. These two phases are performed iteratively until thinned image stops to change. In order to have the possibility to control the thinning process, the notion of anchor pixels has been introduced [7]. These pixels are defined separately and - by definition cannot be removed during the thinning process even if they are simple. The anchored skeletonization requires two input images - the image to be thinned and the image containing anchor pixels referred to as anchor image. 3. Image description using morphological classes 3.1. Class extractor Let X be a binary image. Any image Y such that Y ∈ X, which consists of pixels characterized by the same spatial property is a spatial class, a sub-class of X. The spatial property refers to the morphological features of locus of pixels belonging to a given class. An operator ψ such that Y = ψ(X) is a class extractor of class Y . Since ψ(X) ⊂ X, we say that the class extractor ψ is anti-extensive. The remaining subset of pixels which remains X \ ψ(X) will called residue of a class extracted by ψ. The following notions and operation are referring to the morphological classes: • Class Z is a sub-class of Y iff Z ⊂ Y . • Classes Z and Y are disjoint iff Y ∩ Z = ∅. • Set of classes Y1 , Y2 , ..., Yn is complete in X iff 1. ∀i6=j Yi ∩ Yj 6= ∅ and 2. ∪i Yi = X where X stands for the initial image. • Class Z is a sum of classes Y1 and Y2 iff Z = Y1 ∪ Y2 . Machine GRAPHICS & VISION vol. , no. , pp.
6
Morphological Classification
• Class Z is an intersection of classes Y1 and Y2 iff Z = Y1 ∩ Y2 . Class extractors which are described further in this text are using structuring elements, which will also be considered as input argument. To make this clear in the notation, the class-extractors will also be referred to as ψ(X, B), where X will stand for input image and B for the structuring element used. 3.2. Morphological classes 3.2.1. Basic class-extractors Since the only property which must be fulfilled by the class extractors is the antiextensivity, every anti-extensive morphological operator is a potential class-extractor. In order to be a true class-extractor, the pixels belonging to the output of this operator (and/or to its residue) must be able to be characterized by clearly-defined spatial property. In particular, the most obvious extractor is the erosion. It shrinks the binary image following the shape of the structuring element. The class-extractor based on erosion defined extracts the part of the image which remains after the erosion - the core of the image. The residue of core class is the internal boundary of binary image, usually referred to as the morphological gradient by erosion. Both classes can be described as follows: ψcore (X, B) = X ⊖ B ; ψintb (X, B) = X \ (X ⊖ B),
(4)
where ψcore stands for the core and ψintb for the internal boundary class extractors. In case of the structuring element of type B (n) , covering the pixel’s neighborhood of size n, ψcore (X, B (n) ) consists of pixels which distance to the boundary of X is greater than n. Internal boundary has, in this case, thickness of n. Another popular anti-extensive morphological operator, opening can also be considered as the class extractor. It splits the pixels of initial image into two classes. The first, which consists of pixels belonging to the result of the opening, is the simplified shape of the input image (with smoothed contours). It can also be described as a dilated core. The residue of this class, which is in fact the result of the white top-hat [4], consist of all fragments of the image which do not belong to the simplified shape. The class of pixel belonging to these fragments can be divided into three sub-classes: isolated, connections and branches regions (see Fig. 2). The first consists of all regions which do not surround the core. Such regions refer to isolated regions, which are too small to contain the core area. Second sub-class is a locus of all pixels that are located between at least two separated cores of the same input object. They will be referred to as connections. The last group consists of pixel connected to only one core and will be called branches. The class-extractor based on opening (class ”dilated core”) and its residue (class ”isolated, branches, connections” containing all three sub-classes) can be defined as:
Machine GRAPHICS & VISION vol. , no. , pp.
7
Marcin Iwanowski
............................ .....CCCCCC................. .....CCCCCC....CCCCCBBBBBB.. .....CCOOCC....CCCCC....BB.. .....CCOOCCKKKKCCOCC....BB.. .....CCOOCCKKKKCCOCC.....BB. .....CCOOCCKKKKCCOCC.....BB. .BBBBCCCCCC....CCCCC.....BB. ..BBBCCCCCC....CCCCC........ .......BBB............III... .......BBBBBBB......IIIIII.. ............................
Fig. 2. Pixels of various classes: O - core; C - core boundary; B - branch; K - connection; I - isolated. Underlined pixels belong to the anchored skeleton. Structuring element B from Fig.1 (b).
ψdico (X, B) = (X ⊖ B) ⊕ B T
; ψibco (X, B) = X \ (X ⊖ B) ⊕ B T ,
(5)
where B T stands for the transposition of structuring element B (B T = {p : −p ∈ B}). In other words, ψibco is the morphological white top-hat. Following the relation between erosion and opening: X ⊖ B ⊂ (X ⊖ B) ⊕ B T ⊂ X, there can be defined some relations between morphological classes induced by these operators: ψcore (X, B) ⊂ ψdico (X, B) ; ψibco (X, B) ⊂ ψintb (X, B).
(6)
It means that class ”core” is a sub-class of ”dilated core” and class ”isolated, branches, connections” is a sub-class of ”internal boundary” class. Based on these considerations a new class can be defined. It is ”core boundary” class, which is the part of the internal boundary which also makes a boundary of the core part of the image. It can be defined as: ψcobo (X, B) = ψintb (X, B) ∩ ψdico (X, B) = ψdico (X, B) \ ψcore (X, B).
(7)
It is thus an intersection of internal boundary and dilated core. It can be also formulated as: ψcobo (X, B) = (f ⊖ B) ⊕ B T \ (f ⊖ B) .
(8)
Morphological reconstruction can be used to extract a morphological class of isolated regions i.e. regions which does not contain core region. These regions are too small to be present on the eroded image. Reconstruction of the core class with a mask equal to input image produces regions with core (opening by reconstruction of initial image), while its residue (white top-hat by reconstruction) consists of isolated regions: ψrwco (X, B) = RX (ψcore (X, B)) ; ψisol (X, B) = X \ RX (X ⊖ B). Machine GRAPHICS & VISION vol. , no. , pp.
(9)
8
Morphological Classification
operator erosion ψ=ε opening ψ = δε opening by reconstruction ψ = Rε
class core ψcore (O) dilated core ψdico (OC) regions with core ψrwco (OCBK)
residual class internal boundary ψintb (CBIK) isolated, branches, connections ψibco (IBK) regions without core - isolated ψisol (I)
Tab. 1. Basic morphological class-extractors (codes of pixels belonging to a particular class put in brackets refer to pixel’s description used in Fig. 2).
The following relations hold for the above introduced classes:
ψisol (X, B) ⊂ ψintb (X, B) ; ψcobo (X, B) ⊂ ψintb (X, B) ; ψisol (X, B) ∩ ψcobo (X, B) = ∅. (10) All the up to now introduced class-extractors are summarized in Table 1. An example of pixels belonging to each class is shown in Fig. 2. 3.2.2. Skeletonization-based class-extractor Anchored skeletonization is used to detect connections - parts of internal boundary connecting two or more cores belonging to the same input object (see Fig.2, pixels marked as ’K’). Skeleton of the input image with core consider S = skel(X, ψcore (X, B)),
(11)
where skel(X, Y ) stands for the operator of the anchored skeletonization of the image X with anchor image Y . The skeleton is, by definition, one pixel thick. The connection can be however thicker due to the fact that structuring element used to detect the internal boundary can describe neighborhood of radius bigger than 1. Such an example is shown in Fig. 2 - pixels marked by ’K’ belong to the connection, while skeleton pixels are characterized by underline. In order to detect the connection in its proper form, the reconstruction is used: ψconn (X, B) = Rψintb (X,B)\(ψdico (X,B)∪ψisol (X,B)) (S).
(12)
Since internal boundary was divided into three classes: core boundary, connections and branches (ψintb (X, B) = ψcobo (X, B) ∪ ψconn (X, B) ∪ ψbran (X, B)) we can compute the ”branch” class as the following difference: ψbran = ψintb \ (ψcobo (X, B) ∪ ψconn (X, B)) .
(13)
Machine GRAPHICS & VISION vol. , no. , pp.
Marcin Iwanowski
9
Branch class is shown in Fig.2 (pixels marked as ’B’). 3.2.3. Length-driven class-extractors Another kind of regions characterized by a clearly defined feature are the elongated fragments of objects (branches and connections) of a given length. In order to consider the length, the geodesic dilation will be used. Let Y be the class of elongated shape (Y = ψconn or Y = ψbran ). By definition, loci of pixels belonging to this class are adjacent to ψdico and are subsets (subclasses) of ψintb . By performing the geodesic dilation of ψdico with a mask equal to (ψdico ∪Y ) with the elementary structuring element (N4 or N8 ) we get the propagation starting from ψdico performed inside Y . The depth of this propagation depends on the size of geodesic dilation. Branches/connections which are shorter than the size of dilation are thus entirely filled, longer parts are filled only up to level which refers to the dilation size. Thanks to that, by computing the difference between result of geodesic dilation and the Y we can mark all parts longer than given size. The size of geodesic dilation determines thus the length of branches/connections being detected. Morphological reconstruction of Y from the above difference allows obtaining parts which are longer than given size. All above consideration can be summarized in the following form: (n) , (14) ψ (>n) = RY Y \ ψdico (X, B) ⊕(ψdico ∪Y ) B ′ where B ′ = N4 or B ′ = N8 . The missing lower index of ψ (>n) should be introduced according to the type of Y and be equal to conn or bran accordingly. The class extractor (>n) according to the Eq. 14 in a form of ψbran allows detecting branches longer (in a sense (>n) of geodesic distance induced by B ′ ) than n. In case of ψconn it is important to mention that, due to the fact that the propagation starts from every core to which the connection is adjacent, the size of detected connections is greater than 2n. 3.3. Class hierarchy tree Morphological classes can be organized in a form of a binary tree - class hierarchy tree. Each node of this directed graph represents a class extractor, edges connecting this node with its children refer to its disjoint sub-classes which union equals the parent class. In particular, edges can represent the class generated by the extractor and its residual class (both are subclasses of their parent class). Class hierarchy tree organizes the structure of the classifier showing relations between class extractors and classes. The set of classes related to leafs of the tree is complete. An example of class hierarchy tree [2] is shown in Fig.3. All the classes on the test image are shown in Fig. 4. The class extractors4 (and colors which represent classes on 4 All
morphological reconstructions in this example as well as all other in this paper are preformed
Machine GRAPHICS & VISION vol. , no. , pp.
10
Morphological Classification
no. 1 2 3 4 5
name of the class core isolated regions core boundary connections branches
class extractor ψcore (T, B) ψisol (T, B)
color in Fig. 4 yellow orange
ψcobo (T, B)
blue
ψconn (T, B) ψbran (T, B)
violet green
Tab. 2. Morphological classes of test image Input image
Internal boundary
Core
Isolated regions Core boundary Branches
Connections
Fig. 3. The hierarchy of spatial classes.
figure) are listed in Table 2. To obtain the result presented in the figure two structuring elements was used (shown in Fig.1(a) and Fig.1(c)). By comparing both classified images one can observe that the classification of particular parts of image depends on the structuring element used. Trees can be created in various ways. The form of a particular tree depends on the type of features which are important for a given image type to be classified. Other examples of class hierarchy tree are presented in Section 4. 3.4. Class distribution functions The number of pixels belonging to each class depends, first of all, on the shape of the object being analyzed. But it also strongly depends on the structuring element B used - on its shape and size (compare e.g. Fig.4(a) and Fig.4(b)). Since the method is based on the classification of the image pixels, the way of extracting pixels belonging to each class is of primary importance. Let assume that classes are extracted using structuring elements of increasing sizes as described in section 2.1. The classification of pixels using the series of structuring elements B (n) containing with the structuring element N8 .
Machine GRAPHICS & VISION vol. , no. , pp.
11
Marcin Iwanowski
(a)
(b)
Fig. 4. Pixel classification of test image using the 8-connected elementary structuring element of size 1 - (a) and of size 3 - (b).
pixel neighborhood of size n, for increasing n allows obtaining the class distribution functions for each morphological class. They are defined as: D(s) = |ψ(X, B (s) )|,
(15)
where |.| stands for the number of pixels of the argument. Alternatively the distribution functions can be defined using the relative number of pixels of given class. Let Y ⊆ X be a set of pixels belonging to a class which is located in the class hierarchy above the class extracted by ψ. The relative distribution function can be then defined as: D′ (s) =
|ψ(X, B (s) )| . |Y |
(16)
Functions according to Eq. 15 and Eq. 16 reflects the variations of shape for which these functions are computed. 4. Applications 4.1. Feature extraction Feature extraction which plays an important role in pattern recognition process requires well-defined features i.e. features that allow differentiating various shapes. Distribution of pixels to spatial classes for increasing sizes of structuring elements depends on the shapes for which the functions are computed. Obviously, the choice of class, structuring elements and type of distribution function depends on the particular task of pattern recognition. Machine GRAPHICS & VISION vol. , no. , pp.
12
Morphological Classification
0.7 hand rabbit cat hawk
branch pixel coefficient
0.6 0.5 0.4 0.3 0.2 0.1 0
(a)
0
5
10 15 20 size of the structuring element
25
30
(b)
Fig. 5. Four test shapes (a) and their branch class distribution functions (b).
For some shapes only one function is sufficient to differentiate the shapes [1]. In Fig. 5 the branch class distribution functions of four test shapes are shown. Distribution functions was computed according to the Eq. 16 and presents the ratio of the pixels belonging to the ’branch’ class to the number of all internal boundary pixels. The structuring element covering the neighborhood of a given radius according the the Euclidean distance was applied. Distribution functions for each shape varies from one shape to the other, what makes them a good feature for shape recognition. 4.2. Water-bodies classification The proposed method was applied to the classification of regions belonging to water bodies. The starting point for this study is the water mask - a binary image which describes the presence of water on the underlying terrain. It is created either on a basis of a map or of a satellite imagery and shows the water-bodies: lakes, channels, rivers etc. within the given part of the Earth. Here, the water mask showing the lakes in the Mazury region of Poland is used. The simplified map of the underlying terrain is shown in Fig. 6(a). The appropriate water mask, of the size 455x664 pixels, is presented in Fig. 6(b). Using the morphological classification method, water mask is going to be divided into 11 classes. Each of them refers to a part of a water or land which have particular properties. In the first step the inverted water mask is considered. This inverted mask assigns pixel values 0 to water regions and 1 - to the land ones. This inversion is necessary to extract the first characteristic region - islands. Due to this extraction two images are created - image with islands and inverted water mask without island. Let F be the original water mask. Using the class extractor of isolated regions we can obtain two above mentioned spatial classes:
Machine GRAPHICS & VISION vol. , no. , pp.
13
Marcin Iwanowski
(a)
(b)
Fig. 6. Simplified map (a) and water mask (b).
I = ψisol (F C , B) ; W = F C \ I
C
,
(17)
where I stands for images containing islands, and W for water mask without islands (upper index C is the image complement). Structuring element B used in the Eq. 17 is an octagon of radius 6. Starting from these two images, two morphological classifications are performed. The first one refers to islands and consists in dividing of I into four spatial subclasses based on two class extractors. The first extracts the isolated regions (Eq. 10) with a certain structuring element and splits the regions of I into two sub-classes referring to smaller and bigger island. The second splits the spatial class of islands into two subclasses which represent the interior of the islands and its waterside. This split is performed using the internal boundary class extractor (Eq. 4). Four resulting subclasses are obtained as intersections of two above listed classes. The details of class extractors used are given in Table 3. The complete class hierarchy tree is shown in Fig. 7. Second classification task aims at dividing of W (water mask without islands) into its spatial sub-classes. First, channels joining two or more lakes are detected using the ’connection’ class extractor (Eq. 12) and its length-driven version (Eq. 14). They are divided into two groups: long (human-made) and short (natural) based on its length Machine GRAPHICS & VISION vol. , no. , pp.
14
Morphological Classification
Negative of water mask
Islands
Negative of water mask without islands
Bigger
Smaller
Interior of smaller islands
Shore of smaller islands
Interior of bigger islands
Shore of bigger islands
Fig. 7. Class hierarchy tree for islands classification.
no. 1 2 3 4 5 6 7 8
name of the class smaller island bigger islands interior of islands shore of islands interior of smaller islands shore of smaller islands interior of bigger islands shore of bigger islands
way of computing I1 = ψisol (I, B) I2 = I \ I1
remarks B - octagon of radius 3 residue of I1
I3 = ψcore (I, N8 ) I4 = ψintb (I, N8 ) I5 = I1 ∩ I3 I6 = I1 ∩ I4 I7 = I2 ∩ I3 I8 = I2 ∩ I4
intersection of I1 and I3 intersection of I1 and I4 intersection of I2 and I3 intersection of I2 and I4
Tab. 3. Morphological classes of islands. Names of auxiliary classes are put in italics.
Machine GRAPHICS & VISION vol. , no. , pp.
15
Marcin Iwanowski
Water mask without islands
Separated lakes
Big
Waterside
Coves
Interior part
Small
Small separated
Channels
Short
Long
Small connected
Rest of waterside Fig. 8. Class hierarchy tree for lakes classification.
in pixels. Channels connecting parts of the same water body are used to separate it. In this way one can detect multiple lakes of the the same water body. In the next step small lakes are detected using the ’isolated’ class extractor (Eq. 10). They can be divided into two groups. To the first one belong all small lakes which are connected (by a channel) to a big lake. The second consists of separated small lakes which are not connected with any other water body. Finally big lakes are taken into account. Their internal part is detected by means of the ’core’ class extractor (Eq. 4). Starting from its residue - internal boundary, waterside region, the coves are found by the ’branch’ extractor. Instead however to use a simple extractor (Eq. 13), its length-driven version is used (Eq. 14). Thanks to that, only larger coves are detected. The whole structure of class hierarchy tree is shown in Fig. 8, the list of consecutive class extractors is given in Table 4. Enlarged parts of resulting classified image are shown in Fig. 9. The complete classification result is presented in Fig. 9. Each class is marked there by an appropriate color. The result of classification can be used for the quantitative and qualitative analysis of waters. Example of a simple analysis is given in Table 5. It shows the share of particular classes within the whole water mask. Also, the approximate area in square kilometers of regions belonging to particular classes is included in the table. It was computed under a very rough estimation of the sizes of single pixel in water mask referred to underlying terrain which was assumed to be equal5 to 45m x 45m. 5 It important to stress that this estimation is not accurate enough to use this results as further references. The inaccuracies was due to low accuracy of the input water mask. The mask accuracy
Machine GRAPHICS & VISION vol. , no. , pp.
16
Morphological Classification
no. 1 2 3 4 5 6 7 8 9
name of the class long channels short channels mask without channels small separated lakes small connected lakes big lakes interior of big lakes coves rest of the waterside
way of computing (>6) W1 = ψconn (W, B1 )
remarks B1 = N8 ⊕ N8
W2 = ψconn (W, B1 ) \ W1 W3 = W \ (W1 ∪ W2 ) W4 = ψisol (W, B2 )
separation of lakes connected by channels B2 - octagon of radius 18
W5 = ψisol (W3 , B2 ) \ W4 W6 = W3 \ ψisol (W3 , B2 ) W7 = ψcore (W6 , B3 )
B3 - octagon of radius 9
(>5)
W8 = ψbran (W6 , B3 ) W9 = ψintb (W6 , B3 ) \ W8
Tab. 4. Morphological classes of lakes. Names of auxiliary classes are put in italics.
(a)
(b)
(c)
Fig. 9. Classification results on enlarged map fragments.
name of the class interior of big lakes rest of the waterside separated small lakes coves connected small lakes long channels short channels
share [%] 48.26 35.07 10.85 3.19 2.28 0.23 0.12
approx.area km2 68.82 50.02 15.47 4.54 3.25 0.33 0.18
Tab. 5. Share of the particular classes within the whole water mask.
Machine GRAPHICS & VISION vol. , no. , pp.
17
Marcin Iwanowski
W7
W9
W8
W4
W5
W1
W2
Fig. 10. Classification result. Machine GRAPHICS & VISION vol. , no. , pp.
I7
I8
I5
I6
18
Morphological Classification
5. Conclusions In the paper the idea of morphological classification was presented. It is based on the morphological class-extractors i.e. operators which extracts from the binary image loci of pixels characterizing by particular spatial property: location on the boundary, branch, connection etc. Various class-extractors was presented in the paper. Apart from just a classification of every image pixel, using the proposed approach the distribution functions can be computed. They are describing the ratio of pixels belonging to chosen classes as a function of the size of a structuring element. These functions can be applied as features in the pattern recognition process. Also some examples of application of proposed approach was given in the paper. The first shows how distribution functions differ from each other for various shapes. The second example refers to environmental studies and shows how the proposed method can be applied to classify the regions of water bodies of Mazury region in the north-east Poland. Two classifiers was used to classify water regions and islands into 11 classes. The method provides a different look at the classification task - the direct classification of image pixels based on the morphological image processing tools. The method is flexible and can be easily suited to particular needs. It can be used in shape description for pattern recognition and in classification of image pixels in e.g. remote sensing or rasterized maps as well as in other tasks of computer vision and image analysis. References 2007 [1] Iwanowski M., “Binary Shape Characterization using Morphological Boundary Class Distribution Functions”, Computer Recognition Systems 2 Advances in Soft Computing series no.45 (Proc. of CORES‘07 Conference, Oct. 22-25, 2007) Ed. M.Kurzynski, E.Puchala, M.Wozniak, A.Zolnierek; Springer-Verlag, pp.305-312. [2] Iwanowski M.,“Morphological Boundary Pixel Classification”, Proc. of IEEE EUROCON Conference, Warsaw 2007, pp.146-150. [3] Vogt P., Riitthers K., Iwanowski M., Estreguil C., Kozak J., Soille P., “Mapping Landscape Corridors” ”Ecological Indicators” vol.7, Issue 2, April 2007; pp. 481-488; 2004 [4] Soille P., “Morphological image analysis”, Springer Verlag, 1999, 2004. 1993 [5] Vincent L., “Morphological grayscale reconstruction in image analysis: applications and efficient algorithms”, IEEE Trans. on Image Processing, Vol.2, No.2, April 1993. 1992 [6] Serra J., Vincent L., “An overview of morphological filtering”, Circuit systems Signal Processing, 11(1), 1992. 1991 [7] Vincent L.,“Efficient computation of various types of skeletons”, In: Loew, M., ed. Medical Imaging V: Image Processing. Volume SPIE-1445 (1991) pp.297-311 issues are however out of scope of this paper.
Machine GRAPHICS & VISION vol. , no. , pp.
Marcin Iwanowski
19
[8] Vincent L. “ Exact Euclidean distance function by chain propagations”, In: Proc. IEEE Computer Vision and Pattern Recognition, 1991, pp. 520–525 1989 [9] Kong T., Rosenfeld A., “Digital topology: Introduction and survey”,Computer Vision, Graphics, and Image Processing, 1989, vol.48, pp.357–393 1983 [10] Serra J., “Image analysis and mathematical morphology, vol.1”, Academic Press, 1983. 1970 [11] Rosenfeld A., “Connectivity in digital pictures”, Journal of the ACM, 1970, vol.17, no.1 pp.146-160
Machine GRAPHICS & VISION vol. , no. , pp.