Sei sulla pagina 1di 37

1.

INTRODUCTION
With the development of computer technology, image segmentation has become an important
tool in many computer vision applications and image processing applications. The goal of
image segmentation is to find regions that represent objects or meaningful parts of objects.
Based on the applications of an image, division of the image into regions, corresponding to
objects of interest, is necessary before any processing can be done at a level higher than that
of the pixel. Identifying real objects, pseudo-objects, and shadows or actually finding out
anything of interest within the image require some form of segmentation. Image
segmentation is one of the most widespread means to classify correctly the pixels of an image
in a decision oriented applications. Image segmentation is a technique that partitions an
image into uniform and non-overlapping regions based on some likeness measure.
Clustering, the unsupervised classification of patterns into groups is one of the most
important tasks in exploratory data analysis. Primary goals of clustering include gaining
Insight into data (detecting anomalies, identifying salient features, etc.), classifying data, and
compressing data. Clustering has a long and rich history in a variety of scientific disciplines
including anthropology, biology, medicine, psychology, statistics, mathematics, Engineering
and computer science. Fuzzy C-means (FCM) algorithm is one of the most popular fuzzy
clustering methods widely used in various tasks of pattern recognition, data mining, image
processing, gene expression data Recognition etc. Modifying and generalizing the FCM
algorithm is a prevailing research stream in fuzzy clustering in recent decades.
In this paper, we present reliable algorithms for fuzzy k-means and C-means that could
improve Image segmentation. Since the k-means or FCM method aims to minimize the sum
of squared distances from all points to their cluster centers, this should result in compact
clusters. Therefore the distance of the points from their cluster centre is used to determine
whether the clusters are compact. For this purpose, we use the intra-cluster distance measure,
which is simply the median distance between a point and its cluster centre. The intra-cluster
is used to give us the ideal number of clusters automatically; i.e a centre of the first cluster is
used to estimate the second cluster, while an intra-cluster of the second cluster is obtained.
Similar, the third cluster is estimated based on the second cluster information (centre and
intra cluster), so on, and only stop when the intra-cluster is smaller than a prescribe value.
Fuzzy c-means (FCM) clustering algorithm is a popular model widely used in image
segmentation due to its good performance. Several algorithms have been proposed to
improve FCM in incorporating the spatial information of the image, defining new distance or

1
using histogram for segmentation. In the proposed method, input color images are converted
into its color images, which are more closed to human vision. Magnetic resonance image
segmentation has been proposed for a number of clinical investigations of varying
complexity. Automatic segmentation of MRI scans is very useful for research and clinical
study of much neurological pathology. The accurate segmentation of MRI images into
different tissue classes, especially Gray Matter (GM), White Matter (WM) and CerebroSpinal
Fluid (CSF), is an important for the diagnosis and prognosis of certain illnesses. The
automatic segmentation of brain MRI images, however, remains a persistent problem.
Magnetic Resonance Imaging (MRI) is an advanced medical imaging technique providing
rich information about the human soft tissue anatomy. Segmentation of MR images into
different tissue classes, especially grey matter (GM), white matter (WM) and cerebrospinal
fluid (CSF) is an important task. Accurate and robust brain tissue segmentation from
magnetic resonance (MR) images is key issue in many applications of medical image analysis
for quantitative studies and particularly in the study of several brain disorders. A wide variety
of approaches have been proposed for brain MR image segmentation. The major MR image
segmentation problem when MR image is the corruption with an inhomogeneity bias field. In
region-based segmentation, the shape of an object can be described in terms of its boundary
or the region it occupies. In its simplest form, region growing methods usually start by
locating some seeds representing distinct regions in the image. The seeds are then grown until
they eventually cover the entire image. The region growing process is therefore governed by
a rule that describe the growth mechanism and a rule that check the homogeneity of the
regions at each growth step. Region growing technique has been applied to MRI
segmentation. This paper addresses these problems for overcoming the shortcomings of
existing fuzzy methods. We present alternative k-means and FCM algorithms that could
improve MRI segmentation. The algorithms incorporate spatial information into the
membership function and the validity procedure for clustering. We use the intra-cluster
distance measure, which is simply the median distance between a point and its cluster centre.
The number of the cluster increases automatically according the value of intra-cluster, for
example when a cluster is obtained, it uses this cluster to evaluate intra-cluster of the next
cluster as input to the FCM or k-means and so on, stop only when intra cluster is smaller than
a prescribe value. The most important aspect of the proposed algorithms is actually to work
automatically. Alternative is to improve automatic image segmentation. The rest of this paper
is organized as follows. Chapter 2 is about the working of matlab, Chapter 3 includes a brief
idea about Digital Image Processing, chapter 4 is about image segmentation\and chapter 5

2
includes various segmentation technique which includes intensity based segmentation,
discontinuity based method, region based segmentation, clustering based method, hybrid
method, graph based method and pixon based method, chapter 6 is clustering method- using
fuzzy-logic which give you detail idea about the clustering techniques and fuzzy c mean
methods, Chapter 7 is objective and scope of the report which summarizes you the report and
our work, Chapter 8 is experimental code and result which have some basic matlab codes we
use in Image processing and segmentation and the fuzzy C mean code and its results and
finally the last chapter 9 conclusive discussions summarizes you the report.

2. BACKGROUND OF MATLAB

Matlab is a high performance language for technical computing. It integrates computation,


visualization and programming in an easy to use environment where problems and solutions
are expressed in familiar mathematical notation. Typical uses included the following-

1. Math and computation.


2. Algorithm development.
3. Data acquisition.
4. Modelling, simulation, and prototyping.
5. Data analysis, exploration, and visualization.
6. Data analysis, exploration.
7. Scientific and engineering graphics.
8. Application development, including graphical user interface building.

3. DIGITAL IMAGE PROCESSING

An image is defined as a two dimensional function f(x,y), where x and y are spatial (plane)
coordinates, and the amplitude of f at any pair of coordinates (x,y) is called the intensity of
image at that point. The term gray level is used often to refer to the intensity of monochrome
images. Colour images are formed by a combination of individual 2D images. An image may
be continuous with x and y coordinates and the amplitude. Digitizing the coordinate and the
amplitude value is called the sampling and quantization respectively and if the x and y and
the amplitude value is finite, we call the image as digital.

3
Fig 1:- Representation of digital image

Images read in the Matlab as -- imread(‘filename’)


Function size gives the row and column dimensions of the image [ Size(f) ], Whos function
display additional information about array [ Whos f ], Image can be displayed as,
[imshow(f,g)], f is an image array and g is the intensity of array levels,
[pixval] displays the Euclidean distance between the initial and current cursor locations,
Images are written in disk using function [ imwrite(f, ‘filename’) ], [ iminfo filename] gives
the detail of the image.

4. IMAGE SEGMENTATION
Image segmentation is a mid-level processing technique used to analyse the image and can be
defined as a processing technique used to classify or cluster an image into several disjoint
parts by grouping the pixels to form a region of homogeneity based on the pixel
characteristics like gray level, color, texture, intensity and other features. The main purpose
of the segmentation process is to get more information in the region of interest in an image
which helps in annotation of the object scene. Image segmentation aims at domain-
independent partition of the image into a set of visually distinct and homogeneous regions
with respect to certain properties. The main goal of segmentation is to clearly differentiate the
object and the background in an image.

4
If R represents an image, then the image segmentation is simply division of R into sub-
regions R1, R2…..Rn, such that and is governed by following set of rules:
a) Ri is a connected set, i=1, 2,..n.
b) Ri ∩ Rj = Ø for all i and j, i ≠ j
c) Q(Ri) = True for i= 1,2,…n.
d) Q(Ri U Rj) = False for adjoint regions, Ri and Rj
Where Q(Rk) is a logical predicate. The rules described above mentions about continuity,
one-to-one relationship, homogeneity and non-repeatability of the pixels after segmentation
respectively.
There are many knowledge based approaches to segment an image and can be listed as
1. Intensity based methods.
2. Discontinuity based methods.
3. Similarity based methods.
4. Clustering methods.
5. Graph based methods.
6. Pixon based methods.
7. Hybrid methods.

Table 1:- Image Segmentation technique

5
In the following sections a brief discussion is made on these methods to understand the
principles and extract the attributes from the region of interest. In some literatures
segmentation using Markov Random Field are treated as separate segmentation approach, but
in this paper it has not discussed directly but have mentioned its application whenever
required.

5. SEGMENTATION TECHNIQUES

5.1 INTENSITY BASED SEGMENTATION


One of the simplest approaches to segment an image is based on the intensity levels and is
called as threshold based approach. Threshold based techniques classifies the image into two
classes and works on the postulate that pixels belonging to certain range of intensity values
represents one class and the rest of the pixels in the image represents the other class.
Thresholding can be implemented either globally or locally. Global thresholding
distinguishes object and background pixels by comparing with threshold value chosen and
use binary partition to segment the image. The pixels that pass the threshold test are
considered as object pixel and are assigned the binary value “1” and other pixels are assigned
binary value “0” and treated as background pixels.

Fig 2:- Thresholding example

The threshold based segmentation techniques are inexpensive, computationally fast and can
be used in real time applications with aid of specialized hardware, where g(x,y) is the output
image i(x,y) is the input image and t is the threshold value.

6
Local thresholding is also called as adaptive thresholding. In this technique the threshold
value varies over the image depending on the local characteristic of the subdivided regions in
the image. The algorithm followed for adaptive thresholding can be stated in general as:
1. Divide the image into sub-image.
2. Choose a local threshold for sub-image considered.
3. Compare the pixels in that sub-image and segment the region.
4. Consider all sub-images individually and choose corresponding threshold values.
5. Stop segmentation when all the sub-images are processed.
In case of global thresholding the threshold value chosen remains the same for the entire
image and acts as a cut off value. In case of local thresholding the image is to be subdivided
in to sub-images and the threshold is to be chosen depending on the properties of local pixels
in that sub-image.

Fig 3:- Thresholding technique


(a) Binary Thresholding (b) Ternary Thresholding

5.2 DISCONTINUITY BASED METHODS


These methods are based on the principle of intensity variations among the pixels. If the
image consists two or more objects boundaries exists and hence can be applied to segment
the image. The boundaries of the objects lead to formation of edges. The significant abrupt
changes in the intensity levels among neighbouring pixels in certain direction are termed as
edges and results in the discontinuity in the pixels. Edge detection basically involves the
following steps: smoothing the image, edge detection and edge localization. A suitable

7
smoothing filter is applied on test image to remove the noise from the image to make it
suitable for segmentation. Then the possible edges are grouped together to check for
candidature and finally the true edges are found by localizing the edge candidates. There are
four different edge types that may be present in the image (a) step-edge (b) ramp-edge (c)
ridge-edge and (d) line-edge and are shown in the fig 4 correspondingly. Edges are usually
found by applying masks over the image. The gradient or the zero crossing techniques are
employed to find the edges in the given image. The convolution operation between the mask
and the image determines the edge set for the image. Edge detection operators can be broadly
classified into two categories as: First order derivative operators and second order derivative
operators..

8
Fig 4:- Discontinuity based method

A. First order derivative operators:


There are two methods for first order derivative edge detection. 1) One of the methods is
evaluating the gradients generated along two orthogonal directions. 2) The second approach
is utilizing a set of discrete edge templates with different orientations. The first derivative
operator uses gradient method to find the edges by using the maximum and minimum value
of the gradient. The gradient is a measure of change in a function. Direction of gradient is
given by α is measured with respect to x axis. The operators used in this category are Robert’s
operator, Prewitt’s operator and Sobel’s operator.

i). Robert’s operator:


It is the simplest first derivative operator that can be used to find the edges in the given
images. It finds the edges in row and columns separately and are put together to find the
resultant edge. The masks used to solve the purpose along x and y direction respectively are
as given in Table 2.

ii). Prewitt’s operator:


This operator uses 3 X 3 mask to find the edges. The mask used along x and y direction
correspondingly are as given in Table 2.

iii). Sobel’s Operator:

This is widely used first derivative operator to find edges and is modification of Prewitt’s
operator by changing the centre coefficient to 2. The sobel operators are given as in Table 2.

iv). The Frei-Chen mask:


It is another operator used to find the edges in the image and its corresponding masks are
given as in Table 2.

9
Table 2:- Derivative Operator
(Impulse response arrays for 3*3 orthogonal differential gradient edge operators.)

B. Second Order Derivative operators:


These operators work on zero crossing detection of the second derivative of the gradient. It
detects the local maxima in gradient values and treats them as edges. The Laplacian operator
is used with the second derivative operator. The frequent used second derivative operators for
edge detection are Laplacian of Gaussian (LoG) operator and Canny edge operator.

i). Laplacian of Gaussian Operator:


The Laplacian of an image highlights regions of rapid intensity change. The operator
normally takes a single gray level image as input and produces another gray level image as

10
output. The kernels used for approximation of second derivatives Laplacian operations are-

Fig 5:- Laplacian operator

Pros:
1. Second order operators give reliable results.
2. Useful in calculating the number of different objects present in the given image.
Cons:
1. No single operator can fit for all variety of images and the computational complexity
increases with the size of operator.
2. Many a times the edges obtained are not continuous.

11
5.3 REGION BASED SEGMENTATION
This method works on the principle of homogeneity by considering the fact that the
neighbouring pixels inside a region possess similar characteristics and are dissimilar to the
pixels in other regions. The objective of region based segmentation is to produce a
homogeneous region which is bigger in size and results in very few regions in the image. The
regions though treated as homogeneous in nature but there is provision to note any
considerable changes in the characteristic of the neighbouring pixels. The simplest approach
to segment image based on the similarity assumption is that every pixel is compared with its
neighbour for similarity check (for gray level, texture, color, shape). If the result is positive,
then that particular pixel is “added” to the pixel and a region is ‘grown’ like-wise. The
growing is stopped when the similarity test fails.
Region based methods are fundamentally divided as
1). Region growing methods
2). Region split and merge methods
Further there are several segment approaches based on regional analysis of the image
proposed by similarity measures among the neighbours, comparing the pixel to original seed,
comparing the pixel to neighbour in region, comparing the pixel to the region statistics,
considering multiple seeds, calculating the cumulative differences and counter examples.

A). Region growing methods:


Region growing method gives reliable output compared to its other counterparts. It is
basically extracting a region from the image using some pre-defined criteria. The simplest
procedure is to compare the candidate pixel to its neighbours to check the homogeneity
criteria allocated to the class to which its neighbour belongs. It can be further classified as
seeded region growing method (SRG) and unseeded region growing method (UsRG). The
main difference between SRG and UsRG is that SRG is semi-automatic in nature whereas
UsRG is fully automatic in nature.

B). Region Split and Merge method:


This method is the most similar method to segment the image based on homogeneity criteria.
This method works on the basis of quad trees and main objective is to distinguish the
homogeneity of the image. It initially considers the entire image as one single region and then

12
divides the image into four quadrants based on certain pre-defined criteria. It checks the
quadrants for the same defined criteria and divides it further into four quadrants if the test
result is negative and the process continues till the criteria is satisfied or no further division is
possible.

5.4 CLUSTERING BASED METHOD


Clustering a process of organizing the groups based on its attributes. The objective of
clustering techniques is to identify bunch in data. A cluster usually contains a group of similar
pixels that belongs to a specific region and different from other regions. The term data
clustering as synonyms like cluster analysis, automatic classification, numerical taxonomy,
and typological analysis. Images can be grouped based on its content. In content based
clustering, grouping is done depending on the inherited characteristics of the pixels like
shape, texture etc. There are various clustering techniques employed, the most widely used
are K-means algorithm and fuzzy C-means algorithm. The Clustering methods are usually
divided as hierarchical algorithms and partitional algorithms. Discussed in detail in later
chapter…

5.5 HYBRID METHODS


Hybrid methods combine one or more of the basic segmentation methods. These algorithms
inherit the good quality of several approaches and gives better performance compared to its
parent approach. The combination of threshold based and clustering methods are used in
medical image segmentations along with the region-edge based approaches, region –
deformable models, region-edge-based with morphological watershed. Hybrid methods rely
on morphological operations performed on images. The widely used techniques are
watershed segmentation, variable-order surface fitting and active contour methods.
A watershed region is defined as the region over which all points flow ‘downhill’ to a
common point. The watershed algorithm uses concepts from edge detection and mathematical
morphology to partition images into homogeneous regions and is applied to the gradient
magnitude of the image. The gradient image can be considered as topography with
boundaries between regions as ridges.

13
5.6 GRAPH BASED METHODS
Graph based methods for image segmentation has several good features in practical
applications. It explicitly organizes the image elements into mathematically sound structures,
and makes the formulation of the problem more flexible and the computation more efficient.
There are various other methods that are used to obtain desired image segmentation using the graph
theory. A detailed survey on graph based techniques is done by the reader can refer for more detailed
information. The advantage of the segmentation using a graph based approach is that it might require
no discretization by virtue of purely combinatorial operators and thus incur no discretization errors.

5.7 PIXON BASED METHOD

The pixon method is a nonlinear image reconstruction method that has decision levels as
pixons instead of pixels. This method increases linear spatial resolution by few factor and
sensitivity by the order of magnitude. This was introduced by pina & puetter in 1993. The
advantage of pixon based method is computational fastness compared to other methods.
There are various ways to select pixons locally convolving the kernel with the pseudo image,
using anisotrophic diffusion equations and combining with Markov Random Fields Fast
Quad Tree Combination algorithm can be used to get good pixon representation and can be
combined with MRF model, another method can be wavelet thresholding is used as pre-
processing step by Hassanpour et al and then proper pixon representation is extracted using
suitable algorithm and finally segmented using Fuzzy-C Means algorithm.

6. CLUSTERING METHOD- FUZZY LOGIC

A. Agglomerative clustering:
This is a hierarchical approach and starts grouping by calling each data point a separate
cluster, and then merges the appropriate clusters into single clusters. The key step for
hierarchical algorithms is to compute the distance. This process can be schematized using
dendograms. The result of this method is that it results in several partitions. The dissimilarity
matrix is used to decide which clusters are to be merged, the smallest entry gives the data
points that are least dissimilar and hence are the most likely candidates to be merged.

Algorithm: Agglomerative Hierarchical clustering

14
1). Select the biggest similarity value from the input similarity matrix and its session is Si, Sj
and combine and form its composition Si,j.
2). Form a matrix with Si,j.
3). Find the cell value of matrix as Similarity (Si,j, Sk) = min { similarity (Si,Sk),
Similarity(Sj,Sk)}.
4). Repeat step 2 until single cluster in matrix cell.
B. Partitional clustering:
These algorithms works by specifying the number of groups initially and converging them
iteratively. The partitional clustering divides the data points into clusters such that the total
distance of data points to their respective cluster centers is minimal. An algorithm to achieve
this is called K-means clustering. The partitional clustering results in one single partition of
the image.
i. K-means algorithm
ii. This algorithm clusters the point nearest to the centroid. The centroid is basically
the average of all the points in that cluster and has coordinate as the arithmetic
mean over all points in the cluster, separately for each dimension.

Algorithm: K-means clustering


1). Select the number of desired clusters k. arbitrarily place the k cluster centers at different
initial locations in the image.
2). Assign each data point to the cluster whose center is closest.
3). Re-compute the cluster centers, the cluster center should be at the average coordinates
(center of gravity) of the data points that make up the cluster.
4). Go to step 2 until no more changes occur or a maximum number of iterations is reached.

This algorithm minimizes the total distance of data points to the cluster center, of the cluster
they are assigned to. Also it does not require the actual computation of distances. A drawback
of k-means algorithm is that the number of desired clusters needs to be set before. Although
hierarchical methods can be more accurate, partitional methods are used in applications
involving large data sets (related with images) due to the fact the construction of a
dendrogram is computationally prohibitive. In hierarchal method if once the merge/split is
done, it can never be undone. This rigidity can be limitation in some case and can be useful in

15
other as it leads to smaller computation costs by not worrying about a combinatorial number
of different choices.

Fig 6:- Fuzzy C-Means [FCM] Algorithm:

In this algorithm the test pixel is allowed to be member of two or more clusters with different
membership coefficient. FCM algorithm is iterative in nature and generates fuzzy partition
matrix and also requires cluster centre along with objective function. The values for cluster
centre and objective function are updated for every single iteration and are stopped when the
difference between two successive object function values is less than some predefined
threshold value. The objective function and the algorithm are as given below. Where
x={x1,x2,x3,……,xn}⊆ R; dataset n= number of data items c= number of clusters;
2 ≤ c < n = degree of membership of xk in ith cluster q= weighting exponent of each fuzzy
member = prototype of center cluster. 90 = distance between object and cluster center

The fuzzy C-Means algorithm (FCM) generalizes the hard c-means algorithm to allow a point
to partially belong to multiple clusters. Therefore, it produces a soft partition for a given
dataset. In fact, it produces a constrained soft partition. To do this, the objective function J
1
of hard c-means has been extended in two ways:
(1) The fuzzy membership degrees in clusters were incorporated into the formula, and
(2) An additional parameter m was introduced as a weight exponent in the fuzzy
membership.
The extended objective function denoted J , is:
m

16
c
2
J m ( P , V ) =∑ ∑ ( μC ( x k ) )m||x k−v i||
i
j =1 x i ∈ C j

Eqn-1
Where, P is fuzzy partition of the dataset X formed by C ,C ,…,C . The parameter m is a
1 2 k
weight that determines the degree to which partial members of a clusters affect the clustering
result. Like hard c-means, fuzzy c-means also tries to find a good partition by searching for
prototypes v that minimize the objective function J . Unlike hard c-means, however, the
i m
fuzzy c-means algorithm also needs to search for membership functions μC i
that minimize

J . To accomplish these two objectives, a necessary condition for local minimum of J was
m m
derived from J . This condition, which is formally stated below, serves as the foundation of
m
the fuzzy c-means algorithm.
FCM partitions a set of n objects x {x , x ,..., xn} in Rd dimensional space into c(1 < c < n)
fuzzy clusters with y = {y1, y2 , y3 ,..., yc} cluster centers or centroids. The fuzzy clustering
of objects is described by a fuzzy matrix μ with n rows and c columns in which n is the
number of data objects and c in the number of clusters. μij , the element in the ith row and jth
column in μ , indicates the degree of association or membership function of the ith object
with the jth cluster. The objective function of FCM algorithm is to minimize the following
equation

Where ,

Eqn-2
In this report there are various latest techniques used in image segmentation which are very
useful in medical field for diagnosis of a problem.m(m > 1) is a scalar termed as weighting
exponent. M controls the fuzziness of the resulting clusters and dij is the Euclidian distance
from object i x to the cluster center y j.
The yj , centroid of the jth cluster, is obtained as:

17
Eqn-3
The FCM algorithm is iterative and can be stated as follow:
1. Selectm(m > 1); initialize the membership function values μij , i = 1,2,...,n; j = 1,2,...,c.
2. Compute the cluster centers yj , j = 1,2,..., ,c . according to equation (5)
3. Compute Euclidian distance dij , i=1,2…,n j=1,2,…,c.

Theorem: Fuzzy c-means theorem. A constrained fuzzy partition {C1,C2,…,Ck} can be a

local minimum of objective function Jm only if the following conditions are satisfied:

1
μC ( x )=
i 2 1

(
||x −v i||
)
k
m−1 1≤ i≤ k, x∈ X
∑ 2
j=1 ||x−v ||
j

Eqn-4

∑ ( μC ( x ))m x
i
x∈ X
v i= n 1≤ i≤ k
m
∑ ( μC ( x )) i
x∈ X

Eqn-5

Based on this theorem, FCM updates the prototypes and the membership function iteratively
using equations 4 and 5 until a convergence criterion is reached. We describe the algorithm
below.
FCM (X, c, m, ε)
X: an unlabelled data set.
c: the number the clusters.
m: the parameter in the objective function

ε: a threshold for the convergence criteria.

18
Initialize prototype V={v ,v ,…,v }
1 2 c
Repeat
Previous
V ←V
Compute membership functions using equations 3.
Update the prototype, vi in V using equation 2.

c
Until ∑||v iprevious−v i||≤ ε .
i=1

Algorithm Steps:
 Choose a number of clusters.
 Assign randomly to each point coefficients for being in the clusters.
 Repeat until the algorithm has converged (that is, the coefficients' change between
two iterations is no more than ε, the given sensitivity threshold) :
 Compute the centroid for each cluster, using the formula above.
 For each point, compute its coefficients of being in the clusters, using the
formula above.

In addition of above, the hybrid of the k-means algorithm and fuzzy c-means algorithm also
exists and is called as fuzzy k-c means algorithm and it resembles fuzzy c-means algorithm in
most situations but with improved efficiency. The comparison between these algorithms is
given in Clustering algorithms use many different features of images like brightness (pixel
intensity) and geometric information (pixel location), though an algorithm’s effectiveness is
very dependent on the type of object and the feature used. This raises ambiguity among the
choice of features to obtain better results for given image and hence limit the generalization
of a clustering algorithm.

7. OBJECTIVE AND SCOPE OF THE WORK

An algorithm is proposed for segmenting an image into multiple levels using Fuzzy-c-means
clustering technique. Image segmentation is the technique of decomposing an image into
meaningful parts or objects. Its results in a segmented image, where each object is labelled in
a way that facilitates the description of the original image so that it can be interpreted by the
system that handles the image. In this Technical report first determined the center of

19
clustering and Fuzzy partition matrix. Considering the spatial information of pixels and based
on spatially weighted FCM, we propose a novel algorithm which can get faster and more
accurate color image segmentation results. The results of experiments show the effectiveness
of the proposed algorithm. Expected result as shown in figure

Fig 7:- Expected segmented result

In this paper, fuzzy c-means (FCM) clustering algorithm for image segmentation is presented.
The originality of this algorithm is based on the fact that the conventional FCM-based
algorithm considers no spatial context information, which makes it sensitive to noise. The
algorithm is formulated by incorporating the spatial neighbourhood information into the
original FCM algorithm by a priori probability and initialized by a histogram based FCM
algorithm. The probability in the algorithm that indicates the spatial influence of the
neighbouring pixels on the centre pixel plays a key role in this algorithm and can be
automatically decided in the implementation of the algorithm by the fuzzy membership. To
quantitatively evaluate and prove the performance of the proposed method, series of
experiments and comparisons with many derivates of FCM algorithms are given in the report.
Experimental results show that the proposed method is effective and robust to noise. The
segmentation of the image is very useful in medical applications to diagnose the
abnormalities in the image, satellite imaging and in computer vision. The criteria for
segmenting the image is very hard to decide as it varies from image to image and also varies

20
significantly on the modality used to capture the image. There is large amount of literature
available to understand and analyse the segmentation techniques.
Fuzzy c-means (FCM) clustering is a widely used unsupervised technique for feature
analysis, clustering, and classifier designs in various areas. One of its successful applications
is image segmentation where images can be represented in various feature spaces. FCM
algorithm separates the image data by grouping similar data points in the feature space into
clusters. This clustering is achieved by iteratively minimizing a cost function, which is
dependent on the distance of the pixels to the cluster centroids in the feature domain FCM is
especially useful for medical image segmentation due to its capacity of processing multiple-
feature inputs, which can be created by the simultaneously generated multiple images from
the multi-spectral imaging techniques. While development of segmentation algorithms has
attracted significant attention, relatively fewer efforts have been spent on their evaluation,
although many newly developed algorithms are (most often subjectively) compared with
some particular algorithms with few particular images. Moreover, most efforts spent on
evaluation are just for designing new evaluation methods and only very few authors have
attempted to characterize the different evaluation methods existed. The present paper will
review different existing methods for segmentation evaluation, as well as discuss and
compare their applicability, advantages and limitations. The list of related works done in the
field of image segmentation is very large and can hardly be mentioned. There are various
survey and reviews done on these methods periodically. This report presents a latest survey of
different technologies of image segmentation using Fuzzy C Means (FCM). The conventional
fuzzy c-means algorithm is an efficient clustering algorithm that is used in image
segmentation. A conventional FCM algorithm does not fully utilize the spatial information in
the image. In this report, we present a fuzzy c-means (FCM) algorithm that incorporates
spatial information into the membership function for clustering. The spatial function is the
summation of the membership function in the neighbourhood of each pixel under
consideration. The advantages of the new method are the following:
(1) It yields regions more homogeneous than those of other methods,
(2) It reduces the spurious blobs,
(3) It removes noisy spots, and
(4) It is less sensitive to noise than other techniques.
This technique is a powerful method for noisy image segmentation and works for both single
and multiple-feature data with spatial information. Fuzzy clustering using Fuzzy C- Means
(FCM) algorithm proved to be superior over the other clustering approaches in terms of

21
segmentation efficiency. But the major drawback of the FCM algorithm is the huge
computational time required for convergence. The effectiveness of the FCM algorithm in
terms of computational rate is improved by modifying the cluster center and membership
value updation criterion.
This study is useful for determining the appropriate use of the image segmentation methods
and for improving their accuracy and performance and also for the main objective, which
designing new algorithms

8. EXPERIMENTAL MATLAB CODES AND RESULT

8.1 BASIC MATLAB CODES

8.1.1 CONTRAST STRETCHING

I = imread('C:\Users\Ashish Verma\Desktop\LEENA.png');
I2=im2double(I);
m=mean2(I2);
contrast1 = 1./(1 + (m ./(I2 + eps )).^4);
contrast2 = 1./(1 + (m ./(I2 + eps )).^5);
contrast3 = 1./(1 + (m ./(I2 + eps )).^10);
contrast4 = 1./(1 + (m ./(I2 + eps )).^-5);
contrast5 = 1./(1 + (m ./(I2 + eps )).^-1);
figure, imshow(I2)
figure, imshow(contrast1)
figure, imshow(contrast2)
figure, imshow(contrast3)
figure, imshow(contrast4)
figure, imshow(contrast5)

22
(a) Original Image (b)

(c) (d)

(e) (f)
Fig 8:- Contrast Stretching

23
8.1.2 COMPLEMENT IMAGE

I = imread('C:\Users\Ashish Verma\Desktop\LEENA.png');
J=imcomplement(I);
figure,imshow(J)

(a) Original Image (b) Complement Image

Fig 9:- Complement Image

8.1.3 RGB

I = imread('C:\Users\Ashish Verma\Desktop\LEENA.png');
R = I(:,:,1);
figure;
image(R),colormap([[0:1/255:1]',zeros(256,1),zeros(256,1)]), colorbar;
G = I(:,:,2);
figure;
image(G),colormap([zeros(256,1),[0:1/255:1]',zeros(256,1)]), colorbar;
B = I(:,:,3);
figure;
image(B),colormap([zeros(256,1),zeros(256,1),[0:1/255:1]']),colorbar;

24
(a) Original image (b)

(c) (d)

Fig 10:- RGB Image

8.1.4 WATERSHED SEGMENTATION

I = imread('C:\Users\Ashish Verma\Desktop\LEENA.png');
I=rgb2gray(I);
hy = fspecial('sobel');
hx = hy';
Iy = imfilter(double(I), hy, 'replicate');
Ix = imfilter(double(I), hx, 'replicate');
gradmag = sqrt(Ix.^2 + Iy.^2);
figure, imshow(gradmag,[]), title('Gradient magnitude (gradmag)')

25
L = watershed(gradmag);
figure, imshow(L), title('Watershed transform of gradient magnitude (Lrgb)')

(a) Original image (b)

(c)

Fig 11:- Watershed Segmentation

8.1.5 EXTRACTION OF IMAGE

I = imread('C:\Users\Ashish Verma\Desktop\LEENA.png');
x=double(I)
figure, imshow(x)
impixelinfo;

26
figure, imshow(I);
impixelinfo;
x(20,20);
c0=mod(x,2);
c01=mod(I,2);
figure, imshow(c0)
figure, imshow(c01);
c1=mod(floor(x/2),2);
c2=mod(floor(x/4),2);
c3=mod(floor(x/8),2);
c4=mod(floor(x/16),2);
c6=mod(floor(x/32),2);
c7=mod(floor(x/64),2);
c8=mod(floor(x/128),2);
figure, imshow(c1);
figure, imshow(c2);
figure, imshow(c3);
figure, imshow(c4);
figure, imshow(c6);
figure, imshow(c7);
figure, imshow(c8);

(a) Original image (b)

27
(c) (d)

(e) (f)

(g) (h)

28
(i) (j)
Fig 12 :- Extraction Of Image

8.1.6 HISTOGRAM
x = imread('C:\Users\Ashish Verma\Desktop\LEENA.png');
img1= rgb2gray(x);
figure, imshow(img1);
title('original image');
figure, imhist(img1);
title('histogram');

(a) Original image (b)

29
(c)

Fig 13:- Histogram

8.2 FUZZY C MEAN CODE AND RESULT

clear all;
clc;
close all;
Im=imread('C:\Users\Ashish Verma\Desktop\image.jpg');
I=rgb2gray(Im);
imshow(I)
I1=unique(I);
[maxrow maxcol]=size(I1);
n=(maxrow)*(maxcol);
class=3;
m=2;
L=[1 0 0;0 1 0;0 0 1];
L1=[1 0 0;0 1 0;0 0 1];
for J=1:(n-3)/3
L=vertcat(L,L1);
end

30
A=[1 0 0];
U=vertcat(L,A);
Uprev=U;

for l=1:class
for p=1:n
B(p,l)=(U(p,l).^m).*I1(p,1);
end
end

s=sum(B);
for l=1:1:class
Zc(1,l)=s(1,l)/sum(U(:,l).^m);
end

for j=1:class
for i=1:n
Dist(i,j)=abs(I1(i,1)-Zc(1,j));
end
end

for j=1:class
for i=1:n
if (Dist(i,j)==0)
U(i,j)=1;
else
ss=0;
for k=1:class
ss=ss+((Dist(i,j)/Dist(i,k))^2/(m-1));
U(i,j)=1/ss;
end
end
end
end

31
XX=abs(U-Uprev);
AAA=0.01*ones(88,1);
iter=1;
while(iter<=1000)
Uprev=U;

for l=1:class
for p=1:n
B(p,l)=(U(p,l).^m).*I1(p,1);
end
end
s=sum(B);
for l=1:1:class
Zc(1,l)=s(1,l)/sum(U(:,l).^m);
end
for j=1:class
for i=1:n
Dist(i,j)=abs(I1(i,1)-Zc(1,j));
end
end

for j=1:class
for i=1:n
if (Dist(i,j)==0)
U(i,j)=1;
else
ss=0;
for k=1:class
ss=ss+((Dist(i,j)/Dist(i,k))^2/(m-1));
U(i,j)=1/ss;
end
end
end
end

32
iter=iter+1
end
Newclassifiedmatrix=zeros(n,class);
for i=1:n
[best classno]=max(U(i,:));
Newclassifiedmatrix(i,classno)=1;
end
T1=(Zc(1,1)+Zc(1,2))/2;
T2=(Zc(1,2)+Zc(1,3))/2;
[M N]=size(I);

for i=1:M
for j=1:N
if (I(i,j)<=T1)
g(i, j)=0;
elseif (I(i,j)>T1&I(i,j)<=T2)
g(i,j)=63;
else
g(i,j)=255;
end
end
end
g
x=uint8(g);
figure, imshow(x);

RESULT-

33
(a) Original image

(b) Extracted image


Fig 14:- Fuzzy C Mean Code

34
9. CONCLUSIVE DISCUSSION

Image segmentation is a process of dividing an image into its constituent homogeneous


regions to extract data from the attributes of the image. As a result, a good segmentation
should result in regions in which the image elements should have uniform properties in terms
of brightness, color or texture etc. Though the image is to be portioned into regions, the
considerable changes within the regions should be observable visually. The measurement of
quality of segmentation is that the elements of the same region should be similar and should
have clear difference between elements of the other regions.
The segmentation process can be divided into various category based on the parameter
selected for segmentation like pixel intensity, homogeneity, discontinuity, cluster data,
topology etc. Each approach has its own advantages and disadvantages. The result obtained
using one approach may not be the same as compared with other approach. Methods that are
specialized to particular applications can often achieve better performance and this selection
of an appropriate approach to a segmentation problem can be a difficult dilemma. Basically
the segmentation can be semi-interactive or fully automatic. The algorithms developed for
segmentation lies in either of this category. With the major difficulty of ill-posed nature of
segmentation it is hard to obtain single answer for segmentation of given image as the
interpretation varies from individual approaches. In some cases manual interaction to
segment the image may be error-prone (for example, in case of seed selection) while the fully
automated approach can give error output (for example in case of watershed segmentation)
and in some cases interactive methods can be laborious and time consuming. So a single
approach to segment all variety of images may be practical unachievable. The prior
knowledge on the image can give better results and gives user the choice to decide proper
method to segment the image. Hence we used clustering based methods for segmentation.
Clustering, the unsupervised classification of patterns into groups is one of the most
important tasks in exploratory data analysis whose primary goal is to include gaining insight
into data (detecting anomalies, identifying salient features, etc.), classifying data, and
compressing data. Fuzzy C-means (FCM) algorithm is one of the most popular fuzzy
clustering methods widely used in various tasks of pattern recognition, data mining, image
processing, gene expression data Recognition etc. Modifying and generalizing the FCM
algorithm is a prevailing research stream in fuzzy clustering in recent decades
This reviews and summarizes some existing methods of image segmentation and their
drawbacks. It is well known that no method is equally good for all images and all methods

35
are not good for a particular type of image Selection of an appropriate segmentation
technique largely depends on the type of images and application areas.
The important problem is how to make a quantitative evaluation of segmentation results
which would be quite useful for vision applications where automatic decisions are required. It
is very difficult to find a single quantitative index for this purpose because such an index
should take into account many factors like homogeneity, contrast, compactness, continuity,
psycho-visual perception etc. Possibly the human being is the best judge to evaluate the
output of any segmentation algorithm.

36
REFERENCES

1. Digital Image processing by Gonzalez & Woods


2. Fuzzy segmentation applied to face segmentation Technical Report Erik Cuevas,
Daniel Zaldivar, and Raul Rojas,Freie Universität Berlin, Institute of Informatik
Takusstr,Berlin, Germany
3. Segmentation of Lip Images by Modified Fuzzy C-means
Clustering Algorithm
G.Sudhavani, Dept. of ECE, R.V.R& J.C College of Engg. Guntur, Andhra
Pradesh,India
Dr.K.Sathyaprasad, Director,Evaluation,JNT University,Kakinada, Andhra Pradesh,
India.
4. Fuzzy C-Means Technique with Histogram Based Centroid Initialization for Brain
tissue segmentation in mri scan.
5. S.kirindis and v. Chatzis, “ a robust fuzzy local information cmeans clustering
algorithm,” ieee trans. Image process. Vol.19, no.5 ,pp. 1328-1337,may 2010
6. International journal of signal processing, image processing and pattern recognition
vol. 8, no. 2 (2015), pp. 65-76 http://dx.doi.org/10.14257/ijsip.2015.8.2.08
7. International journal of advanced research in computer and communication
engineering vol. 2, issue 7, july 2013
8. P. Vasuda et. Al. / (ijcse) international journal on computer science and engineering
vol. 02, no. 05, 2010, 1713-1715
9. A survey on evaluation methods for image segmentation y.j.zhang, department of
electronic engineering, tsinghua university, 100084 beijing, china.
10. Ieee transactions on image processing, vol. 13, no. 4, april 2004, zhou wang, member,
ieee, alan conrad bovik, fellow, ieee, hamid rahim sheikh, student member, ieee, and
eero p. Simoncelli, senior member, ieee.

37

Potrebbero piacerti anche