Professional Documents
Culture Documents
net/publication/230838044
CITATIONS READS
4 155
3 authors, including:
All content following this page was uploaded by Marcin Iwanowski on 20 May 2014.
ABSTRACT
INTRODUCTION
The presented method is divided into two steps: morphological filtering nad clustering. First
step is the preprocessing step performed in order to consider spatial dependencies in the
image. The main areas of the image are transformed to more homogeneous. It means that all
of the pixels with the graytone considerably lighter or darker than their background are
removed in order to avoid misclassifications during the second, clustering step. Typical
solution for such kind of problem is opening, closing, or linear filtering. But they change the
shapes of regions on the image (bluring), which is the main obstacle for using this kind of
filters in segmentation process. Segmentation should extract the shapes in the image, so each
distortion of shape is dangerous. In order to solve this problem more advanced mathematical
morphology is used: geodesic operators. Based on this operators two filters can be defined:
opening by reconstruction and closing by reconstruction. They both remove lighter or darker
pixels or areas on the image's surface, but they do not change the shapes. So they are very
well suited for the segmentation purposes.
The second step of proposed method is called clustering and is destined to a clasification of
image's pixels. To do this the k-means algorithm is used. This algorithm is iterative and
consists of two steps: clasification and calculation of cluster centers. Each iteration gives
better approximation of the cluster centers. The algorithm is itertively performed while the
cluster centers are moving. Each pixel is classified to the cluster with the closest center.
Clusters are represented by theirs centers, and they correspond with the regions on the image.
Two kinds of a k-means algorithms are considered. The first one is traditional and gives as the
result the number of clusters which is given by the user. The second is based on fuzzy logic. It
can give as the result the number of clusters different from those given at the beginning of the
algorithm. In this case the number of clusters is adapted to the real structure of the image. The
algorithm starts with given number of clusters and later this number can increase or decrease
depending on the spectral distribution of image's pixels.
Mathematical morphology is a very efficient non-linear tool for signal and image processing.
An introduction to mathematical morphology is to find in (Serra, 1982; Serra, 1988). In this
paper morphological filtering by reconstruction is considered. The following part describes
briefly theoretical background for opening and closing by reconstruction. Both operations
belong to one group called geodesic morphological transformations (Soille, 1994).
Geodesic dilation (erosion) of size 1 of the marker image f with respect to the mask image g
where f ≤ g ( f ≥ g ) is defined as infinimum (supremum) image of mask image and marker
image after dilation (erosion) of size one - with elementary structuring element, and is
denoted as: δ g(1) ( f ) ( ε g(1) ( f ) ):
δ g(1) ( f ) = δ (1) ( f ) ∧ g , ε g(1) ( f ) = ε (1) ( f ) ∨ g, (1)
where i such that (idempotence): δ (gi ) ( f ) = δ (gi +1) ( f ) , ε (gi ) ( f ) = ε (gi +1) ( f ).
More information about reconstruction is in (Soille, 1994; Vincent, 1992).
Opening and closing by reconstruction are defined as follows:
CLUSTERING
Up to now a huge amount of segmentation algorithms was developed. In general one can
divide them into two groups (Soille, 1992): based on spectral and spatial properties of the
image. To the first group belong all the algorithms based on the intensity of image's pixels
like e.g. clustering. Second group bases on the relationships between pixels and theirs
neighbors. To this group belongs the most popular morphological segmentation technique -
watershed (Beucher, 1990; Meyer and Beucher, 1990). This paper describes only first type of
segmentation - clustering. In our case not only spectral properties are considered because first
step - morphological filtering was performed. Those step have removed the undesirable
intensity peaks using the spatial information, so the spatial constraints are in such a manner
considered.
Proposed clustering method bases on the k-means technique (Duda and Hart, 1973; Selim and
Ismail 1984; Śluzek, 1991; Iwanowski, 1996). K-means algorithm aims at classifying each
member of given set of input data into given number of clusters. Algorithm deals with
distances between samples and cluster centers. This distance is iteratively minimized in two
steps performed iteratively. First step distributes samples into the clusters, second updates
cluster centers. Each sample is classified to the cluster which center is the nearest in given
metric. Updating of cluster centers is performed by computing a new cluster center by placing
it in the middle (arithmetic mean value) of all of the samples belonging to the cluster. These
two steps are performed iteratively while clusters centers change their position. If in the last
performed iteration cluster centers did not move, it means that operation of samples
classification is finished. In case of applying k-means algorithm for images notions of sample
and cluster center are represented by pixel's graytone. During the calculations the distance
between samples and cluster centers is calculated by taking absolute value of difference
between graytones of sample and cluster center. Cluster centers obtained finally represents
graytones of the output image. These graytones refers to regions on the image surface.
Initial cluster centers (point 2 above) can be calculated in any way. We have placed them
equally distanced in a whole range of graytones.
Next remark refers to the spectral property of this kind of segmentation. Because k-means
does not consider neither position of pixel nor its neighbors, there is no need to make all of
the calculations on image. Image histrogram is sufficient to do this. This solution is faster
because it needs smaller amout of computations.
In version of the algorithm described above number of clusters is fixed and cannot be
changed. This solution is not always sufficient. Sometimes one would have flexible algorithm
which can change the number of cluster according to the real situation on the image. In this
case fuzzy version of k-means algoriithm (fuzzy k-means - FKM) can be applied. Some fuzzy
versions of k-means was developed. In this paper version close to (Huntsberger et al., 1985) is
proposed. The main difference between traditional and FKM algorithm is representation of
the result. In traditional version each point is labelled by the cluster number. Fuzzy version
produces so called 'fuzzy partition' - a vector which includes membership values. These
values tell us 'how much' given point is similiar to each of the clusters. This is not only
indication of the closest cluster center but also a description of similiarity with other clusters.
The schema of algorithm is similar to that presented above. Only some changes should be
made. Calculation of cluster centers is performed using the following equation:
∑
n
j =1
( µ ij ) m x j
ci = (7)
∑
n
j =1
( µ ij ) m
µ ip = 0 if dip = 0
(8)
µ ip = 1l otherwise
(l - number of distances d equal to 0)
otherwise for all 1≤i≤k:
1
µ ip = k
(9)
∑(
dip 2 /( m −1)
d jp)
j =1
where: n - is the number of pixels, ci - is center of i-th cluster, x p - is i-th sample (pixel), µ ip -
is the element of fuzzy partition, it describes membership value: 'how much' p-th sample
belong to i-th cluster. Parameter m describes degree 'fuzziness' of classification (nature of
clustering). m=1 gives 'hard' or 'crisp' clustering, bigger m give fuzzier classification.
Presented above descriptions refers to 'pure' FKM algorithm. In order to apply it to
segmentation some additional steps should be made. FKM algorithm is performed until
convergence. When the fuzzy-partition elements stops changing their elements, next step is
executed. Cluster centers are compared in order to check if there are clusters with centers
close to each other. If two or more clusters have their centers close, they represent in fact one
cluster. In this case number of clusters k decreases and FKM algorithm is performed once
again. When number of clusters is stable next step is performed. Now all the pixels with the
membership values high enough are classified to the clusters with the highest membership
value. The thresholding operation with threshold which describes how 'high' is 'high enough'
is called α-cut. All the pixels not classified (their membership values were too small to be
classified properly) are classified once again using FKM.
RESULTS
In order to apply proposed algorithm some experiments were carried out. We used 256-
graytone images, resolution 256x256 pixels.
Fig. 1. (a) - input image (mangan), (b) - after ASF of size 2, (c) - after ASFR of size 2, (d) -
after ASFR of size 2 and k-means (k=2).
Fig. 1. shows the results of two kinds of filtering: by ASF and by ASFR. First one consists of
four operations: closing of size 1, opening of size 1, closing of size 2, opening of size 2 (ASF
of size 2). It is visible that all the disturbances on the background have disappeared, but at the
same time shapes of objects have been changed.
Fig. 2. (a) - intensity of pixels from Fig. 1a, (b) - after ASFR of size 1, (c) - after ASFR of
size 2, (d) - after ASFR of size 2 and k-means (k=2).
Second filter gives correct result. It is ASFR filter of size 2 contained closing by
reconstruction and opening by reconstruction (size 1 and 2). Image is filtered without any
change of shape of objects.
Image filtered by ASFR is much better input for k-means algorithm than image without
filtering. Only the important regions exists and theirs borders are unchanged. In this case
'crisp' version of k-means algorithm was applied. Number of clusters is known - we have to
extract darker shapes on lighter background - and is equal to 2. Result of k-means of size 2 is
presented in Fig. 1d.
Fig. 2. includes the 1-D views of the image from Fig. 1a made by horizontal cut of image at
y=120. At the first image (Fig. 2a) initial image is shown - image containes a lot of local
graytone disturbances which, from the point of view of 'pure' image analysis, represent noise.
This noise should be removed. K-means applied directly on this image gives bad result,
because apart from the proper areas also a lot of noise will be considered as objects.
Next picture (Fig. 2b) shows the result of filtration by ASFR of size 1. Some smaller peaks
disappear, but larger remain, so the size of ASFR should be increased. At the next picture
(Fig. 2c) result of ASFR of size 2 is presented. All the important peaks are removed so k-
means can be now applied. Result of this operation is shown on Fig. 2d.
Fig. 3. Other examples: (a) granite, (b) granite after ASFR of size 2 and k-means (k=3), (c)
cooper, (d) cooper after ASFR of size 1 and k-means (k=2).
Fig. 3. contains other examples of proposed segmentation method also with 'crisp' k-means.
Fig. 3a presents structure of granite. Three main areas exists on this image. This case needs
ASFR of size 2 and k-means with k=3 - result is shown on Fig. 4b.
Other example contains stucture of cooper (Fig. 3c.) which requires ASFR of size 1 and k-
means (k=2) - see Fig. 3d.
In examples shown above number of clusters was easy to define a priori. But it is sometimes
in not possible. Number of clusters can be not available a priori. This can happen in scene
analysis. In this case we apply fuzzy version of k-means (FKM).
Fig. 4. (a) input image (scene), (b) ASFR of size 5, (c) FKM k=3, m=3, α=150, (d) FKM k=5,
m=3, α=150.
Image shown in Fig. 4a represents a scene. From the point of view of segmentation it contains
a lot of noise, especially on the right side. ASFR is applied in order to remove possibly lot of
noise. In this case ASFR of size 5 was applied - larger than in examples shown before,
because the structure of noise is more complicated. Filtrated image is presented on Fig. 4b.
Number of clusters can be defined here only roughly. In proposed FKM algorithm some
parameters should be defined. Paramter k represents initial number of clusters. Parmeter m
defines how 'fuzzy' behavior of the algorithm is (the bigger m is, the more 'fuzzy' algorithm
is).
Parameter α indicates threshold for classified pixels. During the experiments the following
parameters were chosen: m equal to 2 or 3, 130<α<190. Segmented images with different
parameters k are shown of Fig. 4c and Fig. 4d. The real number of cluster is in both cases
bigger than defined by parameter k. Result is adapted to the image's structure. In this case
'crisp' k-means would give not 'natural' result - extracted regions would be not good fited to
the real regions on the input image.
CONCLUSIONS
One of the biggest obstacles for applying k-means-like algorithms is always the spectral
nature of this algorithm. It causes problems with bad-classified single points or small areas in
the image. Because of that one should find a supplement that can precede the clustering step,
and which can take under consideration spatial dependencies of the image.
Natural answer to the question of finding such a supplement is filtering. But the most popular
linear filters as well as non-linear (e.g. morphological) have one important disadvantage for
segmentation: they change the shape of the areas on the image. Segmentation by definition
should extract shapes of the areas, so each disturbance of it is a problem.
In order to avoid this, an advanced morphological filtering is proposed: alternating sequential
filter by reconstruction. As it was shown on the attached examples, this solution seems to be
very efficient. It removes local disturbances of graytone without changing the shape of areas.
Also two types of k-means algorithm was applied: traditional version anf fuzzy one. First one
can be applied to the images where number of clusters can be defined by the user. But not in
all cases it can be done. For such a case fuzzy k-means is applied. This variant needs an initial
number of clusters, but during the run of the algorithm this number can change according to
real image content.
Experiments carried out show that proposed combination of advanced morphological filtering
and clustering by k-means and fuzzy k-means considers both spectral and spatial nature of
image and gives good and promising results.
ACKNOWLEDGEMENTS
Authors would like to thank M. Młynarczuk from Instytut Mechaniki Górotworu PAN in
Kraków for the set of geological images.
REFERENCES