Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Image segmentation using advanced fuzzy c-mean algorithm [FYP @ IITR, obtained 'A+' ]

1,308 views

Published on

FYP

Published in: Data & Analytics

Image segmentation using advanced fuzzy c-mean algorithm [FYP @ IITR, obtained 'A+' ]

  1. 1. Project No.49 Image Segmentation using Advanced Fuzzy c-means Algorithm B.Tech Final Year Project Report Submitted as requirement for award of degree of BACHELOR OF TECHNOLOGY in Electrical Engineering Submitted By: J Koteswar Rao Ankit Agarawal Guided By: Dr. R.P.MAHESHWARI DEPARTMENT OF ELECTRICAL ENGINEERING INDIAN INSTITUTE OF TECHNOLOGY ROORKEE ROORKEE-247667(INDIA) MAY,2012
  2. 2. Acknowledgement We express our most sincere and heartfelt gratitude to Dr. R.P. Maheshwari for helping us through every step of the project. Sparing time for us even through his extremely busy schedule, his guidance was essential for the successful completion of this project. We would also like to thank the research scholar, Mr. Subramaniam, for helping us and sharing his knowledge and experience in the field of Digital Image Processing. We have gained good experience and knowledge in the field of Digital Image Processing while doing this project and we are grateful to everyone who has helped us in our endeavour. Lastly we would like to thank God and our parents for their blessings and motivation throughout this project.
  3. 3. ABSTRACT K-means algorithm is still extensively used in various fields like image segmentation, data mining, etc. for clustering data and retrieving information. To enhance its quality of output many new concepts and algorithms have been developed like fuzzy c-means (fcm) which introduced the concept of partial membership. Since then huge amount of research has been done on fcm and many of its variants have been developed like Bias-corrected fuzzy c-means (BCFCM), some kernel versions of FCM with spatial constraints, such as KFCM_S1 and KFCM_S2, to solve those drawbacks of BCFCM. Then, a Gaussian kernel-based fuzzy c-means algorithm (GKFCM) with a spatial bias correction was proposed to decrease the heavy effect of parameters. In our project, we have implemented all these algorithms for image segmentation which have been proved to give very good results and created a GUI. Later above our pre-stated objectives, we developed an algorithm which improves them by automatically choosing the number of clusters, better selection of initial cluster centres and tremendously increasing the speed to enable their use in real-time video segmentation. Segmentation of flowers
  4. 4. CHAPTER 1 INTRODUCTION Due to ever increasing amount of visual data and need to retrieve the useful information out of it, it has become very necessary to develop better image segmentation tools and methods which enable retrieving desired information and that too fast. Huge amount of research has been and is being done in this field and various algorithms have been developed. Clustering is one such technique which helps not only in image segmentation but is also useful in various other fields like data mining, pattern recognition, etc. K-means is the most common clustering algorithm which is widely used due to its speed, simplicity and good output. It has been improved over the years and many of its variants have been developed like fuzzy c-means, Bias corrected fuzzy c- means, etc. which give better results and remove many drawbacks of K-means. In our project we first implemented K-means algorithm for image segmentation to understand the effect of clustering on an image and its segmentation results. We discovered that it suffers from many drawbacks like non-convergence and is susceptible to effects from noise. Hence, we implemented Fuzzy c-means algorithm which gives partial membership of each cluster to each pixel and then its variant which was proposed to yield better results as it took into account the effect of neighbouring pixels to decrease the effect of noise(BCFCM). Since it is computationally time taking and lacks enough robustness to noise and outliers, some kernel versions of FCM with spatial constraints, such as KFCM_S1 and KFCM_S2, were proposed to solve those drawbacks of BCFCM. However, KFCM_S1 and KFCM_S2 are heavily affected by their parameters. So,we implemented a Gaussian kernel-based fuzzy c-means algorithm (GKFCM) with a spatial bias correction which was proposed to be more efficient and robust. While implementing them, we noticed that we can improve the results of K-means algorithm by hitting on its basic inputs and we realized research is being done in that direction as well. Inputs to a K-means algorithm are number of clusters and the initial cluster centres. We noticed that initial clusters were in general randomly chosen and the number of clusters was derived by applying k-means a number of times and then comparing the results. So, we came up with the idea that we can apply a moving average filter on the histogram of an image and take the number of peaks as the number of clusters and those peaks as initial cluster centres. We found that this way the problem of non-convergence was removed and the results were better as the initial cluster centres were found to be close to final cluster centres. This way we also avoided the input, number of clusters, from the user. Then, we happened to notice that we can apply the k- means algorithm on the histogram of the image rather than the image itself which increased the speed of the algorithm since the iterations became very fast. We incorporated an additional feature which automatically varies the input to moving average filter and named it auto-pilot, which depending on the application itself decides the value of n for moving average filter. As the algorithm became very fast and didn’t require any input from the user we realized that we can even try real-time video segmentation which is very difficult due to limitation of time.
  5. 5. We have developed a GUI(Graphic User Interface) to display all the algorithms implemented, modifications which we are proposing, etc. so that the user can easily look through our work and use it as well. We have some interesting features like report generation which makes a report of the segmented results of an image in word file, live video segmentation, etc. In the report starting with introduction to Digital Image Segmentation we have explained various clustering algorithms implemented by us, then highlighted a few drawbacks of K-means and Fuzzy c-means which we have removed by our proposed algorithm which is explained in the next chapter along with auto-pilot and real-time video segmentation. At last we have explained the features of GUI developed. Segmentation using proposed algorithm (tumor got completely separated)
  6. 6. Chapter 2 Digital Image Segmentation 2.1 What is Digital Image Segmentation? When acquiring an image, it might be interesting to know what parts of the image do belong to each other. It could be a satellite image, where we wish to quantify and locate different types of vegetation, or a medical MRI image where the doctors are interested to know how much of each tissue type is present, and where it is located. Image segmentation techniques offer a method to perform these tasks, and thus, can be regarded as the process of dividing an image into groups of pixels which from a preset property are connected to each other. The goal of segmentation is to simplify and/or change the representation of an image into something that is more meaningful and easier to analyze. Image segmentation is typically used to locate objects and boundaries (lines, curves, etc.) in images. More precisely, image segmentation is the process of assigning a label to every pixel in an image such that pixels with the same label share certain common visual characteristics. These characteristics or computed property may be, such as color, intensity or texture. Commonly this means that pixels with almost the same intensity values are grouped together, or pixels with the same colour code. There are techniques for finding for instance objects with closed contours, convex objects and the boundaries of an object, etc. Segmentation is a fundamental task of image processing because of its many areas of application.  Medical Imaging  Locate tumors and other pathologies  Measure tissue volumes  Computer-guided surgery  Diagnosis  Treatment planning  Study of anatomical structure  Locate objects in satellite images (roads, forests, etc.)  Face Recognition  Iris Recognition  Fingerprint Recognition  Traffic Control Systems  Brake Light Detection  Machine Vision Segmentation techniques have not been widely applied, partly because they are time consuming and partly because there are no overall techniques that are suitable for all different types of images. All intensity based segmentation techniques are sensible to the situation that different
  7. 7. objects have almost equal intensities. This will often lead to misclassification (wrongly classified pixels) if the objects from the view of the human eye should not belong to the same class. [In general all the segmentation techniques have to be based on intensity since the only data available from an image is an array of numbers which signify the intensity. Then these numbers are used in segmentation in various formats to represent just the intensity based(for gray level images) or colour based(which uses three or more intensity matrices) or any kind of a pattern like a texture(which again may use more than one parameter), etc. Here in our project we have concentrated only on gray level images.] 2.2 Different ways of Image Segmentation Image segmentation can proceed on three different ways, 1. Manually 2. Automatically 3. Semi-automatically 2.2.1 Manual Segmentation The pixels belonging to the same intensity range could manually be pointed out, but clearly this is a very time consuming method if the image is large. A better choice would be to mark the contours of the objects. This could be done discrete from the keyboard, giving high accuracy, but low speed, or it could be done with the mouse with higher speed but less accuracy. The manual techniques all have in common the amount of time spent in tracing the objects, and human resources are expensive. Tracing algorithms can also make use of geometrical figures like ellipses to approximate the boundaries of the objects. This has been done a lot for medical purposes, but the approximations may not be very good. 2.2.2 Automatic Segmentation Fully automatic segmentation is difficult to implement due to the high complexity and variation of images. Most algorithms need some a priori information to carry out the segmentation, and for a method to be automatic, this a priori information must be available to the computer. The needed a priori information could for instance be noise level and probability of the objects having a special distribution. In computer vision it is required that computer is able to do automatic segmentation and then take the required actions according to the segmentation results. In our project we have made an attempt to go closer to automatic segmentation by requiring less and less input from the user. 2.2.3 Semi-automatic Segmentation Semiautomatic segmentation combines the benefits of both manual and automatic segmentation. By giving some initial information about the structures, we can proceed with automatic methods.
  8. 8. Thresholding If the distribution of intensities is known, thresholding divides the image into two regions, separated by a manually chosen threshold value ‘a’ as follows: if B(i; j) ¸ a; B(i; j) = 1 (object) else B(i; j) = 0 (background) for all i; j over the image B. This can be repeated for each region, dividing them by the threshold value, which results in four regions etc. However, a successful segmentation requires that some properties of the image is known beforehand. This method has the drawback of including separated regions which correctly lie within the limits specified, but regionally do not belong to the selected region. These pixels could for instance appear from noise. The simplest way of choosing the threshold value would be a fixed value, for instance the mean value of the image. A better choice would be a histogram derived threshold. This method includes some knowledge of the distribution of the image, and will result in less misclassification. Isodata algorithm is an iterative process for finding the threshold value. First segment the image into two regions according to a temporary chosen threshold value. Then calculate the mean value of the image corresponding to the two segmented regions. Calculate a new threshold value from thresholdnew = mean(meanregion1 + meanregion2) and repeat until the threshold value does not change any more. Finally choose this value for the threshold segmentation. Various other thresholding methods are used like adaptive thresholding, Otsu algorithm, Minimum error algorithm, Minimum entropy method, etc. Boundary tracking Edge-finding or edge-detection by gradients is the method of selecting a boundary manually, and automatically follow this gradient until returning to the same point. Returning to the same point can be a major problem of this method. Boundary tracking will wrongly include all interior holes in the region, and will meet problems if the gradient specifying the boundary is varying or is very small. A way to overcome this problem is first to calculate the gradient and then apply a threshold segmentation. This will exclude some wrongly included pixels compared to the threshold method only. Zero-crossing based procedure is a method based on the Laplacian. Assume the boundaries of an object has the property that the Laplacian will change sign across them. Assume the boundary is blurred, and the gradient will have a shape like in Figure 2.2. The Laplacian will change sign just around the assumed edge for position = 0.
  9. 9. For noisy images the noise will produce large second derivatives around zero crossings, and the zero-crossing based procedure needs a smoothing filter to produce satisfactory results. Various edge detection tools are used and huge development have been made in this like various masks have been developed e.g. Robert operator, Sobel’s operator, Prewitt Operator, etc. Neighbouring methods Region growing is a statistical method for segmentation. We group the pixels into different regions from the principles of proximity and homogeneity. The principle of proximity splits the image into smaller regions and merges them again such that all pixels have neighbours similar to themselves. This means that the intensities of the neighbours all lie within a certain threshold. The principle of homogeneity compares the statistical probability of different combinations of regions to belong to the same class. This requires some a priori information about the image we are trying to segment. Various statistical measures like standard deviation, skewness, kurtosis etc. are used for determining whether the regions are similar or different. But here also the input for these measures to differentiate has to be given by the user based on a priori information. Mathematical Morhphology Mathematical morphology (MM) is a theory and technique for the analysis and processing of geometrical structures. MM is most commonly applied to digital images, but it can be employed as well on graphs, surface meshes, solids, and many other spatial structures. Topological and geometrical continuous-space concepts such as size, shape, convexity, connectivity, and geodesic distance were introduced by MM on both continuous and discrete spaces. MM is also the foundation of morphological image processing, which consists of a set of operators that transform images according to the above characterizations. Besides extending the main concepts (such as dilation, erosion, etc...) to functions, this generalization yielded new operators, such as morphological gradients, and
  10. 10. the Watershed (MM's main segmentation approach). The watershed transformation considers the gradient magnitude of an image as a topographic surface. Pixels having the highest gradient magnitude intensities (GMIs) correspond to watershed lines, which represent the region boundaries. Water placed on any pixel enclosed by a common watershed line flows downhill to a common local intensity minimum (LIM). Pixels draining to a common minimum form a catch basin, which represents a segment. Clustering Methods Clustering is the process of dividing data elements into classes or clusters so that items in the same class are as similar as possible, and items in different classes are as dissimilar as possible. Depending on the nature of the data and the purpose for which clustering is being used, different measures of similarity may be used to place items into classes, where the similarity measure controls how the clusters are formed. Some examples of measures that can be used as in clustering include distance, connectivity, and intensity. Hence, clustering has been used as a very useful tool in data mining, image segmentation, pattern recognition, information retrieval, etc. Many clustering algorithms have been developed like K-means, Fuzzy c-means, etc. With moderate processing time they give very good result and are very commonly used. We’ll be discussing about clustering algorithms at length in the next chapter and discuss about various clustering algorithms evolved and their drawbacks. Later in the report we’ll mention the efforts made by us in trying to remove those drawbacks and getting better results.
  11. 11. Chapter 3 CLUSTERING METHODS 3.1 Introduction Cluster analysis or clustering is the task of assigning a set of objects into groups (called clusters) so that the objects in the same cluster are more similar (in some sense or another) to each other than to those in other clusters. Clustering is widely used in image analysis, pattern recognition, and many other fields, including data mining, statistical analysis, machine learning, information retrieval and bioinformatics. Its wide use can be attributed to the fact that they are very fast and simple and give good results for unsupervised approaches. In intensity based image segmentation for example clustering algorithms finds its use because an object generally has same intensity, pattern or texture etc. for a particular orientation. Hence to segment a particular object out of an image what we require to know is its intensity. Similarly different objects can be segmented based on their intensity in the image. So by the process of clustering we identify various groups of intensities which may refer to different objects and thus segment the image into its constituting parts separately. Cluster analysis itself is not one specific algorithm, but the general task to be solved. It can be achieved by various algorithms that differ significantly in their notion of what constitutes a cluster and how to efficiently find them. Popular notions of clusters include groups with low distances among the cluster members, dense areas of the data space, intervals or particular statistical distributions. Clustering can therefore be formulated as a multi-objective optimization problem. The appropriate clustering algorithm and parameter settings (including values such as the distance function to use, a density threshold or the number of expected clusters) depend on the individual data set and intended use of the results. Cluster analysis as such is not an automatic task, but an iterative process of knowledge discovery or interactive multi-objective optimization that involves trial and failure. It will often be necessary to modify preprocessing and parameters until the result achieves the desired properties. 3.2 CLUSTERS AND CLUSTERING The notion of a "cluster" varies between algorithms and is one of the many decisions to take when choosing the appropriate algorithm for a particular problem. At first the terminology of a cluster seems obvious: a group of data objects. However, the clusters found by different algorithms vary significantly in their properties, and understanding these "cluster models" is key to understanding the differences between the various algorithms. There may be various cluster models but we’ll be confining our discussion to centroid based models like K-means algorithm and its variants in which a cluster is represented by a single mean vector. A "clustering" is essentially a set of such clusters, usually containing all objects in the data set. Additionally, it may specify the relationship of the clusters to each other, for example a hierarchy of clusters embedded in each other. Clusterings can be roughly distinguished in:
  12. 12.  hard clustering: each object belongs to a cluster or not  soft clustering (also: fuzzy clustering): each object belongs to each cluster to a certain degree In the next few sections of the chapter we would discuss various clustering algorithms which we have implemented in our project. 3.3 K-Means Algorithm K-means (MacQueen) is one of the simplest unsupervised learning algorithms that solve the well known clustering problem. It is very popular because of its ability to cluster a kind of huge data, and also outliers, quickly and efficiently. The procedure follows a simple and easy way to classify a given data set through a certain number of clusters (assume k clusters) fixed a priori. The main idea is to define k centroids, one for each cluster. Every pixel has to belong to only and only one cluster. These centroids shoud be placed in a cunning way because different location causes different result. So, the better choice is to place them as much as possible far away from each other. The next step is to take each point belonging to a given data set and associate it to the nearest centroid. When no point is pending, the first step is completed and an early groupage is done. At this point we need to re-calculate k new centroids for the clusters resulting from the previous step. After we have these k new centroids, a new binding has to be done between the same data set points and the nearest new centroid. A loop has been generated. As a result of this loop we may notice that the k centroids change their location step by step until no more changes are done. In other words centroids do not move any more. Finally, this algorithm aims at minimizing an objective function, in this case a squared error function. The objective function Where, is a chosen distance measure between a data point and the cluster centre , is an indicator of the distance of the n data points from their respective cluster centres. K-means has proved to be very useful algorithm for image segmentation being both simple and fast is sometimes used as a pre-segmentation for other segmentation processes.
  13. 13. Place K points in space one for each cluster randomly. Assign each pixel to the cluster whose centroid or centre is closest Calculate new centres as the centroid of the group cj(new)-cj(old)<Є Cluster centres have been obtained yes No figure: Flowchart for K-means algorithm
  14. 14. 3.4 Fuzzy C-Means (FCM) Algorithm Zadeh proposed fuzzy sets that introduced the idea of partial memberships described by membership functions, it has been successfully applied in various areas. Especially, fuzzy sets could allow membership functions to all clusters in a data set so that it is very suitable for cluster analysis i.e. each pixel can have membership to all the clusters but the membership would be defined. In contrast to K-means where each pixel is a member of only one cluster Ruspini first proposed fuzzy c-partitions as a fuzzy approach to clustering. Later, the fuzzy c-means (FCM) algorithms with a weighting exponent m = 2 proposed by Dunn , and then generalized by Bezdek with m > 1 became popular. Let X = {x1, . . .,xn} be a data set in an s-dimensional Euclidean space R. Let c be a positive integer greater than one. A partition of X into c parts can be presented by a mutually disjoint set X1, . . .,Xc such that X1 U….U Xc = X, or equivalently by the indicator functions µ1, . . .,µc such that µij = µi(xj) = 1 if xj Є Xi and µij = 0 if xj ∉ Xi for i = 1,. . ., c and j = 1,. . .,n. The set of indicator functions {µ1, . . ., µc} is known as a hard c-partition of clustering X into c clusters. Ruspini first considered an extension to allow µij = -µi(xj) to be the membership functions of fuzzy sets µi on X assuming values in the interval [0,1] such that ∑ µ for all xj in X. In this fuzzy extension, {µ1, . . ., µc} is called a fuzzy c-partition of X. The fuzzy c-partitions of X can be represented in a matrix form as follows: µ = {µij}cxn Є Mfcn where Mfcn is a partition matrix with Mfcn = {µ=[µij]cn | ∀ i, ∀j µij ≥0, ∑ µ , n> ∑ µ > 0 } Dunn first embedded the fuzzy c-partitions into K-means and then proposed the fuzzy c-means (FCM) objective function with ∑ ∑ µ where µij Є Mfcn and {a1, . . .,ac} denote the cluster centres of the data set X. Bezdek extended the weighting exponent m = 2 to any m > 1 with the FCM objective function Jm as µ ∑ ∑ µ Thus, the FCM algorithm is iterated through the necessary conditions for minimizing Jm(µ,a) with the following update equations: ∑ µ ∑ µ , i=1,2,…c (1)
  15. 15. µ ∑ , i=1,2,….c (2) j=1,2,….n Based on a sequence of execution for stage s using stage (s -1) according to the update Eqs. (1) and (2), the FCM can be described as follows: FCM procedure Input: (1) X = { ,…. }, Є R, the data set (2) c, 2 ≤ c ≤ n, the number of clusters (3) Ɛ > 0, the stopping criterion of algorithm (4) ( ) the initials of cluster centers. OUTPUT: a = { }, the final cluster centers Algorithm: Step 1: Let s = 1 Step 2: Compute µ using (2). Step 3: Update the cluster centers with µ using (1). Step 4: Compare to in a convenient matrix norm ||.||. IF || || < Ɛ, STOP and OUTPUT. ELSE s = s + 1 and return to step 2. Fuzzy clustering has been widely studied and applied in a variety of areas, such as numerical taxonomy, image processing, pattern recognition, medicine, economics, ecology, marketing, artificial intelligence, data mining, engineering systems, and gene expression. In fuzzy clustering, the fuzzy c-means (FCM) algorithm plays an important role. 3.5 Bias-corrected Fuzzy C-Means (BCFCM) Although the FCM algorithm is the best known, it has several drawbacks. For example, the points in the data set are supposed to be equally important, the number of points in the clusters is almost equal, nearly all points do not have a membership value of one, and the outliers always affect the clustering results. To overcome these drawbacks, many generalized FCM algorithms
  16. 16. have been proposed in the literature. Among them, Ahmed et al. (2002) first modified the FCM algorithm as a bias-corrected FCM(BCFCM) with a spatial neighbourhood regularization term by regularizing the following FCM objective function . where Nj stands for the set of neighbours that exist in a window around xj and is the cardinality of Nj. The effect of neighbouring terms is controlled by the parameter a. Thus, the BCFCM algorithm is iterated through the necessary conditions for minimizing with the following update equations: However, Chen and Zhang (2004) pointed out a shortcoming of the BCFCM update equations that computing the term of neighbourhoods Nj may take too much time than FCM. They then proposed a modified objective function as where is the sample mean within the window around xj where can be computed in advance. The idea is that the term Thus, the modified BCFCM algorithm is iterated through the necessary conditions for minimizing with the following update equations:
  17. 17. 3.6 Kernel based Fuzzy C-means (KFCM) Chen and Zhang (2004) then replaced the Euclidean distance || || with a Gaussian kernel- induced distance 1- K( =1 - exp(- / ). They gave the kernel version of as The necessary conditions for minimizing (µ,a)are the following update equations: where K(x,y) =exp(- / ). Note that different kernels can be chosen by replacing the Euclidean distance . for different purposes. However, a Gaussian kernel is suitable for clustering in which it can actually induce the necessary conditions (7) and (8). They then proposed the KFCM_S1 as follows: KFCM_S1 procedure Input: (1) X = { ,…. }, Є R, the data set (2) c, 2 ≤ c ≤ n,, the number of clusters
  18. 18. (3) Ɛ > 0, the stopping criterion of algorithm (4) and , the values of parameters (5) ( ) the initials of cluster centres. Output: a = { }, the final cluster centres Algorithm: Step 1: Let s = 1 Step 2: Compute µ using (8). Step 3: Update the cluster centres with and µ using (7). Step 4: IF || || < Ɛ, STOP and OUTPUT. ELSE s = s + 1 and return to step 2. If ̅ is taken as the median of the neighbours within the window around , then the algorithm is called KFCM_S2 by Chen and Zhang(2004) where they compare the KFCM_S1 and KFCM_S2 with FCM and BCFCM. However, the parameter in BCFCM, KFCM_S1 and KFCM_S2 heavily affects the final clustering results. For estimating the parameter and learning the parameter , we propose a generalized type of BCFCM, KFCM_S1 and KFCM_S2 where the parameters and can be automatically estimated and learned from the data in the next section. 3.7 Gaussian kernel-based FCM (GKFCM) We know that Chen and Zhang (2004) considered a kernel version of FCM by replacing the Euclidean distance || || with the kernel substitution as ( ) where / is a nonlinear map from the data space into the feature space with its corresponding kernel K. They specially assumed K(x,y) = 1 and then proposed the kernel-type objective function with µ ∑ ∑ µ Thus, the update equations for the necessary conditions for minimizing µ are as follows:
  19. 19. ∑ µ ( ) ∑ µ ( ) i = 1,2,…,c (9) µ ( ) ∑ ( ) , i = 1,2,…c; (10) j=1,….,n We point out that the necessary conditions for minimizing µ are update Eqs. (9) and (10) only when the kernel function K is chosen to be the Gaussian function with K( ) = exp(- ). µ ∑ ∑ µ ∑ ∑ µ ̅ Where, K(x,y) =exp(- / ) is taken. Thus, the necessary conditions for minimizing µ are Eqs. (7) and (8) as shown in Section 2.We mention that the parameter is used to control the effect of the neighbors for adjusting the spatial bias correction term. In fact, the parameter heavily affects the clustering results of BCFCM, KFCM_S1 and KFCM_S2. Intuitively, it would be better if we can adjust each spatial bias correction term separately for each cluster i. That is, the overall parameter is better replaced with that is correlated to each cluster i. In this sense, we will consider the following modified objective function with µ ∑ ∑ µ ∑ ∑ µ ̅ (11) where K(x,y) =exp(- / ). Based on the concept of machine learning with a learning capability to improve the performance of clustering results, an exponential-type distance is bounded and monotone increasing. Hence it can be robust to noise and outliers when = 1- exp(- ) is used to replace the Euclidean distance . However, there are parameters and in the proposed objective function . Since is presented as a dispersion, we use the sample variance to estimate with ∑ ̅ with ̅ ∑ (12) On the other hand, because the parameter controls the effect of the neighbouring term for each cluster i, a ratio of the two distance-based influence terms, and ̅ , can be used as a learning scheme for . This is because the term presents the separation of data set for the cluster i. If the value of is larger, then the cluster i will be more isolated so that the value of should be larger. However, the scale of for each data set may depend on the total separation of the data set in which it can be measured by the term ̅ . Thus, the ratio of the two terms
  20. 20. and ̅ can be well used as a standardized separation strength of cluster i. Moreover, we also consider these influencing factors simultaneously in replacing the Euclidean distance with the exponential-type distance 1- K(x,y) = 1-exp(- / ). Therefore, the parameter is estimated as follows: ̅ , i = 1,2,…c (13) Thus, the update equations for the necessary conditions of minimizing µ are ∑ µ ( ) (̅̅̅ )̅̅̅ ∑ µ ( ) , i = 1,…c (14) µ ( ( )) (̅̅̅ ) ∑ ( ( )) (̅̅̅ ) , i = 1,…,c; j = 1,…,n (15) where K(x,y) = exp(- / ). We see that the KFCM objective function µ is a special case of µ when = for all i. Thus, we have the GKFCM as follows: GKFCM procedure Input: (1) X = { ,…. }, Є R, the data set (2) c, 2 ≤ c ≤ n, the number of clusters (3) Ɛ > 0, the stopping criterion of algorithm (4) ( ) the initials of cluster centres. Output: a = { }, the final cluster centers Algorithm: Step 1: Let s = 1and estimate using (12). Step 2: Compute using (13). Step 3: Compute µ and using (15). Step 4: Update the cluster centres with , and µ using (14). Step 5: IF || || < Ɛ, STOP and OUTPUT.
  21. 21. ELSE s = s + 1 and return to step 2. If ̅ in Eqs. (14) and (15) is considered as the sample mean within the window around , then we call the algorithm as GKFCM1. If ̅ in Eqs. (14) and (15) is replaced with the median within the window around , then the algorithm is called GKFCM2. Note that the parameters and in BCFCM, KFCM_S1 and KFCM_S2 are priori assigned by users where they heavily affect the clustering results. But in our proposed GKFCM1 and GKFCM2, the parameter is estimated by Eq. (12) and the parameter i is updated at each iteration using Eq. (13) based on the data and learning schemes.
  22. 22. CHAPTER 4 Drawbacks of K-means and FCM Algorithms 4.1 Introduction The K-means and FCM algorithms are having many drawbacks due to which their results are not good and hence the algorithms which have k-means as their starting point or are from its variations have to suffer from various drawbacks. These are drawbacks are: 1. No. of clusters has to be a human input 2. May not converge (K-means) 3. Different initial cluster centres may yield different final cluster centres hence sometimes the result may be completely erroneous 4. Slow (FCM) In the next few sections we discuss these drawbacks along with some methods which were proposed to modify and improve it. They also have suffered from the drawbacks of their own so we have suggested a new method in the next chapter and its certain features have been discussed along with the drawbacks of previously proposed algorithms. 4.2 Number of clusters The first issue is that the number of clusters k needs to be determined in advance as an input to clustering algorithms. In a real data set, k is usually unknown. In practice, different values of k are tried, and cluster validation techniques are used to measure the clustering results and determine the best value of k, see, for instance, [9]. In [10], Li et al. presented an agglomerative fuzzy k-means clustering algorithm for numerical data, an extension to the standard fuzzy k- means algorithm by introducing a penalty term to the objective function. The algorithm can determine the number of clusters by analyzing the penalty factor. For categorical data, a bottom- up hierarchical algorithm ACE was proposed in [11], which uses entropy as an index function to capture the candidates for the number of clusters. All these methods are time consuming and computation expensive to apply. For example, [9] for instance requires whole K-means algorithm to be applied multiple times to gain the no. of clusters to divide the image. In [10] the algorithm needs to randomly select a subset from data set as initial cluster centers, which results in an uncertainty and then suffers with the problem as stated in the next drawback. [11] is very time consuming and is dependent on the size of the image because if the size of the image is very large, the ACE algorithm is not efficient due to its computational burden of O(n2 log2n) with n being the number of data points. Hence, we would like to propose a method to find out the number of clusters for clustering of an image for the purpose of segmentation which is lot simpler, fast and gives good results. First, the histogram of the image is developed and on the histogram of the image a moving average filter is applied whose size can be decided by the user depending upon the image. Then this moving
  23. 23. average filter will do the smoothing of the filter and give rise to some smooth peaks and valleys. In general, it has been noticed that the intensity of an object in an image is clustered in one particular region which forms a peak and the peaks of two different objects (or the object from the background) are separated by a valley. So, this feature of a digital image is made use of to determine the number of clusters. It is proposed that for intensity based segmentation each peak will refer to a separate segment of the image. Hence, the number of peaks is our required number of clusters. As such it can be said that this can easily be known by just viewing the histogram of an image. But, for the purpose of computer vision and machine learning it is important that computer itself identifies the number of clusters. This particular method aids computer in identifying the number of cluster on its own. Though it can be said that the size of the moving average filter is to be an input which cannot be done by computer, but later in the project we’ve tried to sort that problem as well. 4.3 INITIAL cluster centres Through the iterative partitioning, k-means algorithm minimizes the sum of distance from each data to its clusters. However, one of the biggest drawbacks of the k-means algorithm is, it is very sensitive to the designated initial starting points as cluster centers because they have direct impact on final cluster centres. K-Means does not guarantee unique clustering as we get different results with randomly chosen initial cluster centres. The final cluster centroids may not be the optimal ones as the algorithm can converge into local optimal solutions. An empty cluster can be obtained if no points are allocated to the cluster during the assignment step. Thus, computer vision and machine learning practitioners find it difficult to rely on the results thus obtained. Therefore, it is quite important for k-means to have good initial cluster centers. Several methods proposed to solve the cluster initialization for k-means algorithm. Since clusters are separated groups in a feature space, it is desirable to select initial centers which are well separated. So the image is first divided into k parts on the basis of its intensity and then the centre of each part is taken to be the initial cluster centres. But, the clustering of the data can be in any region and need not be spread throughout the range and it is dangerous to select outliers as initial centers, since they are away from normal samples. This will not only take time for reaching to the final cluster centres there may be the problem of convergence as is discussed in next section as well. For the initial cluster center, Jain and Dubes (1988) applied the k-means with several times by randomly selected initial values and selected the average of these final cluster centers. Bradley and Fayyad (1998) proposed the refinement algorithm that builds a set of small random sub-samples of the data, then clusters data in each sub-samples by k-means. All centroids of all sub-samples are then clustered together by k-means using the k-centroids of each sub-sample as
  24. 24. initial centers. The centers of the final clusters that give minimum clustering error are to be used as the initial centers for clustering the original set of data using k-means algorithm. Penã et al. (1999) presented a comparative study for different initialization methods for the K- means algorithm. The result of their experiments illustrate that the random initialization method outperforms the rest of the compared methods as they make the K-means more effective and more independent on initial clustering and on instance order. This clearly showed that the methods developed till then were not giving effective but the need to find better initial cluster was there in order to get better final cluster centres and also to avoid any problem of convergence which may occur due to inappropriate selection of initial cluster centres. Hence, more research was being done to find better initial cluster which are closer to the final cluster centres which would make the results better and along with that would be speedy since convergence will be faster and number of iterations required will be less. Likas et al. (2003) proposed the global k-means algorithm which is an incremental approach to clustering which dynamically adds one cluster center at a time through a deterministic global search procedure consisting of N (with N being the size of the dataset) executions of the k-means algorithm from suitable initial positions. But it is a very long and time consuming process as error finding method is run about (K-1)*N times in this. Khan and Ahmad (2004) proposed Cluster Center Initialization Algorithm (CCIA) to solve cluster initialization problem. CCIA is based on two observations, which some patterns are very similar to each other. It initiates with calculating mean and standard deviation for data attributes, and then separates the data with normal curve into certain partition. CCIA uses k-means and density-based multi scale data condensation to observe the similarity of data patterns before finding out the final initial clusters. The experiment results of the CCIA performed the effectiveness and robustness this method to solve the several clustering problems. Deelers and Auwatanamongkol (2007) proposed an algorithm to compute initial cluster centers for k-means algorithm. They partitioned the data set in a cell using a cutting plane that divides cell in two smaller cells. The plane is perpendicular to the data axis with the highest variance and is designed to reduce the sum squared errors of the two cells as much as possible, while at the same time keep the two cells far apart as possible. Also they partitioned the cells one at a time until the number of cells equals to the predefined number of clusters, k. In their method the centers of the k cells become the initial cluster centers for k-means algorithm.
  25. 25. Presently research is being done to make use of many attributes of the data set to find initial cluster centres but this is again very time consuming and computation expensive process for just finding the initial cluster centres as all the other methods mentioned above though they might give very good result but if the data set is large and the processing time available for segmenting images (or in that case any other kind of data) is less i.e. there is huge amount of images or video data which has to be segmented then they would not fulfill the requirement. Our proposed algorithm calculates the initial cluster centers that are quite close to the desired cluster centers. The peaks which are obtained by using a moving average filter on the histogram of the image are taken to be our initial cluster centres and they may not be the modes of the histogram. This method is really fast in comparison to other methods as explained above in finding the initial cluster centres (and is almost completed by the end of the process to find the number of clusters) and better as well. Firstly, it is not based on any kind of random choice for initial cluster centres which may lead to the problem of non-convergence or may give erratic results(it will be very difficult to get unique final cluster centres) for different initial centres which are chosen randomly and we can’t even have any kind of control over them. Secondly, since the initial cluster centres are found to be close to the final cluster centres the whole clustering algorithm becomes fast as the number of iterations required to converge will decrease whereas if the initial cluster centres are equally spaced throughout the intensity range and the data is confined only to one section of intensity range, then unnecessarily more iterations will be required and the cluster centres may also get trapped in local clustering of data. Thirdly, it is independent of the size of the image. Only while making the histogram we require going through all the pixels of the image otherwise all the calculations can be conducted on the histogram itself which saves a lot of computation time [and is kind of uniform for different image sizes]. Fourthly, it can be used on histogram and doesn’t require any other attribute to find the initial cluster centres though there may be compromise with quality. The ones which use many attributes to find the initial cluster centres are very calculation intensive and would make the algorithm slow. 4.4 Convergence There is a problem of convergence which may occur in K-means algorithm if care is not taken and when random selection of initial cluster centres is done then since there is no control over the process the algorithm may not even converge to final cluster centres. This may happen if the initial cluster is put in a region where there are no data points. So when the new cluster centres will be calculated in the next step then since there are no data points in that cluster the denominator will become zero, hence there will be the problem of convergence.
  26. 26. A way was devised to avoid this problem by assigning the initial cluster centres between the minimum and the maximum values of the data points. But still this problem may arise if cluster centre drops in a region where there are no points pertaining to the data i.e. data need not be spread throughout uniformly. So, this problem is also resolved by choosing correct initial cluster centres and having some control over it. 4.5 Speed Speed is always a factor which determines the applicability of a particular method. Simple K- means algorithm applied on images is very slow because it is iteratively applied on the image and as the size of the image increases its time of evaluating cluster centres will increase proportionately as the computer will have to peruse all the pixels again. Though K-means is still very fast in comparison to other methods for clustering as the computation is less. But it can be made faster if it is applied on the histogram of the image rather than the image pixels. Hence, as we have mentioned earlier we can work on the histogram of the image. The initial cluster centre rather than being a pixel and iteratively measuring the distance of intensity of each pixel from the intensity of the cluster centre pixel what can be done is we can take the intensities of the peaks as the initial cluster centres and then cluster the intensities on the basis of their nearness to respective cluster centre. Then using their frequency in the image as their weight and calculate the new cluster centres. This way the number of data points is reduced from any number depending on the size of the image to 255(if 8-bit representation). So the iterations become faster and hence the same result can be obtained in lesser time.
  27. 27. CHAPTER 5 PROPOSED ALGORITHMS 5.1 optimum cluster centers and optimum number of clusters Clustering algorithms like k-means and fuzzy c-means , although appears very simple, we get long time or short time to converge depending upon initial cluster centers chosen and sometimes it so happens that it doesn’t converge at all. For computer vision, we need a reliable algorithm producing fast and sure shot convergence. Number of clusters and initial cluster centers are human input in k-means algorithm. So, there is a (n+1) degrees of freedom to get a particular segmentation, which causes inconsistency in results, and there is known charge against k-means algorithm that it doesn’t have spatial coherence. Keeping these two things in mind, We propose a new concept of finding initial cluster centers as a function of size of filter used to filter the histogram. Using this concept, degree of freedom reduces to one i.e. size of the filter instead of number of clusters and it accounts for spatial coherence too. Convergence becomes faster as initial cluster centers are somewhat near final cluster centers. We propose two methods of finding such optimum cluster centers using filtered histogram of the image. METHOD-1 Step 1: Apply moving average filter of size ‘t’ on histogram and obtain Histogram-1 Step 2: Apply moving average filter of size ‘round(t/2)’ on Histogram-1 and obtain Histogram-2 Step 3: Intensities having local maxima in the Histogram-2 can be taken as optimum initial cluster centers. Since Histogram-2 is a filtered histogram, there are only very few local maximas METHOD-2 Step 1: Apply moving average filter of size ‘t’ on histogram and obtain Histogram-1 Step 2: Apply moving average filter of size ‘round(t/2)’ on Histogram-1 and obtain Histogram-2 Step 3: Intensities having minima in the histogram can be taken as separating criteria for dividing the original histograms into sub-histograms. Step 4: Within those sub histograms, intensities having maximum frequency can be taken as optimum initial cluster centers.
  28. 28. Although, choosing initial cluster centers at equal distance has been in practice so far. But by using this method, we account for spatial coherency and speed increases very significantly as the initial cluster centers obtained are somewhat near final cluster centers. It is observed that greater the size of filter, lesser is the number of clusters obtained to start with. And there is a high degree of consistency in final cluster centers obtained by same number of cluster within certain range of size of filter used. Whole idea is that input is size of the filter not number of clusters we want to divide the image into, forcibly. 5.2 Proposed Algorithms for clustering 5.2.1 K-means using histogram Step 1: Divide histogram into sub histograms by criteria of mid-point between cluster centers. Step 2: perform k-means on histogram using these cluster centers to obtain new cluster centers by finding the weighted average of intensities within the corresponding histogram. Weights are calculated by dividing corresponding frequency of intensity with sum of all frequencies within the sub histogram. This weighted average becomes the new cluster center Step 3: Check if error between consecutive iterations is less than maximum error allowed If Yes, final cluster centers are obtained and intensities within corresponding histogram belong to corresponding cluster Otherwise, Go to step 1 5.2.2 Fuzzy c-means using histogram Equation for calculating membership remains same but while calculating average membership term is multiplied with corresponding frequency of that intensity. 5.2.3 FCM +k-means In FCM, while segmenting finally maximum an intensity falls in the cluster in which it has maximum intensity.Finding maximum membership consumes lot of time. This can be easily avoided by dividing in the way we divide in k-means (an intensity value belongs to the cluster if it falls in sub-histogram of that particular cluster) 5.2.4 kf-means K-means is fast whereas fuzzy c-means ensures sure shot convergence, therefore we propose a method of combining these two to find the final cluster center in optimum time and with sure shot convergence. We carry on iterations as we do in k-means, recalling the (sum of sub-
  29. 29. histogram) criteria discussed above can be used to call a single iteration of fuzzy c-means to place the cluster centers in such a manner that convergence will happen as the criteria doesn’t sense the problem of convergence once FCM is called. 5.3 Effect of using initial cluster centers proposed by two theorems Original Image Normal Initial cluster centers: 32 96 159 223 Final cluster centers: 19 77 137 237 Time taken: 1.59 secs Optimum initial cluster centers by theorem 1(t=22): 33 78 123 255 Final cluster centers: 18 75 135 236 Time Taken: 0.445 secs
  30. 30. Optimum initial cluster centers by theorem 1(t=22): 14 65 111 255 Final cluster centers: 16 71 132 235 Time Taken:0.703 secs Original Histogram 0 500 1000 1500 2000 2500 0 50 100 150 200 250
  31. 31. Filtered Histogram One may ask what about time taken for finding these initial cluster centers. But finding normal cluster centers also takes time as range of image need to be calculated as if by chance cluster center outside the range is chosen, algorithm doesn’t converge. 0 50 100 150 200 250 300 0 200 400 600 800 1000 1200 1400 1600 1800 2000
  32. 32. 5.4 Addressing problem of convergence in clustering algorithms In spite of choosing optimum cluster centers, we cannot ensure convergence because of inherent nature of the image. One of the reason might be discontinuous histogram. So we propose a solution of using histogram based k-means algorithm. By which speed increases drastically. We can have a constant check in every iteration, if algorithm can converge for given number of cluster centers. Especially in computer vision, predefined number of clusters based on training but still there are problems of convergence encountered. We propose a flexible number of clusters method based on histogram. Use optimum initial cluster centers obtained from METHOD-1. Step 1: Divide histogram into sub histograms by criteria of mid-point between cluster centers. Step 2: Check if sum of all frequencies in the sub histogram is greater than 0 If yes, continue. Otherwise, delete this cluster center and merge the left part of sub histogram to left cluster center and right part of sub histogram to right cluster center. Original image with segmented edge Segmented image with segmented edge
  33. 33. Step 3: perform k-means on histogram using these cluster centers to obtain new cluster centers by finding the weighted average of intensities within the corresponding histogram. Weights are calculated by dividing corresponding frequency of intensity with sum of all frequencies within the sub histogram. Step 4: Check if difference between consecutive iteration is less than criterion predefined. If yes, obtained cluster centers are final cluster centers. Otherwise, go to step1. 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 0 50 100 150 200 250
  34. 34. Now if we use normal initial cluster centers=32 96 159 223, algorithm doesn’t converge. Because 3rd initial cluster center (159) can’t have any pixel in his cluster. if we use cluster centers obtained by theorem 1=44 88 125 237 Final cluster centers=14 59 104 215 Time taken=0.0911 secs if we use cluster centers obtained by theorem 2=14 75 200 255 Final cluster centers=23 91 201 250 Time taken=0.09 secs
  35. 35. So, using these cluster centers, algorithm converges. In spite of using these cluster centers we cannot ensure sure shot convergence , so reduction in number of clusters remains as only solution as discussed above when it is encountered that algorithm cannot converge using sub-histogram criteria Main reason behind using histogram instead of image is to have some criteria for checking if convergence is possible and take described action. Thus the advantages of the proposed algorithms are: 1. It automatically finds the number of clusters for segmentation which used to be a human input, thus, heading to automatic segmentation. 2. The initial cluster centres are obtained in a simple and refined way which removes the problems which are created due to random selection of initial cluster centres like non- convergence, improper clustering results, etc. , and is faster than other algorithms which use many attributes to calculate initial cluster center though the result may be a bit poor. 3. The problem of convergence has also been removed. 4. The speed has been increased manifold as is shown in next section containing results because of various reasons: a. Use of histogram for iterations rather than applying it on the image itself. b. Number of clusters is chosen faster. c. Initial cluster centres are also chosen very fast and they are found to be near final cluster centre which decreases the overall number of iterations. But there is a drawback in this method of segmentation that it is susceptible to noise because noise can bring heavy shift in the final cluster centres and thus degrade the segmentation result. The effect of noise can be removed by using a filter before segmenting the image to get better result.
  36. 36. CHAPTER 6 Auto-segmentation/auto-pilot Introduction In a step to go further to automatic segmentation, to be more useful for computer vision and machine learning, we made an effort wherein we don’t even require giving the input to the moving average filter used in our proposed algorithm. Thus, we have been able to advance further in our research to make the algorithm more user-friendly and faster. The program itself applies the moving average filter on the histogram of the image for different values of ‘t’ in steps of 2. This way a number of filtered outputs will be obtained and the number of peaks obtained from the histogram may keep on decreasing due to more and more smoothing of the histogram. And hence the number of clusters or the value of k may also keep on changing according to our algorithm. The program will then see what are the values of k which is/are stable, i.e. when the size of the moving average filter is varied which value of k occur repetitively. Then, only for those values of k the segmentation is done and the results are shown. This way we have been able to avoid any kind of human intervention and made the program easier and faster. Presently, if a biomedical practitioners or some other professional interested in segmentation uses K-means algorithm, he/she would have to try various values of k and then see which value is suitable for him/her or is giving good results, which can be tedious, but here he/she can just give one input to the program i.e. the image to be segmented, then the program itself will find the stable values of k and show the segmented image only for those values of k. Auto pilot Auto pilot is a concept of finding all stable segmentations of an image. Initialize t=3, s=maximum clusters you want, sm=minimum clusters you want Step 1: increment ‘t’ in step of 2 Step 2: find initial cluster centers, Step 3: if number of clusters<’s’. s=number of clusters. Segment the image Otherwise, go to step 1 Step 4: s<=sm, autopilot has finished its job,break Otherwise, go to step 1
  37. 37. Inverse auto pilot Initialize t=80,sm=minimum clusters you want, s=maximum clusters you want Step 1: decrement ‘t’ in step of 1 Step 2: find initial cluster centers, Step 3: if number of clusters>=’sm’. sm=number of clusters. Segment the image Otherwise, go to step 1 Step 4: sm>=s, autopilot has finished its job,break. Otherwise, go to step 1 Original image This image has been segmented into 4,3,2 clusters by auto pilot as shown below
  38. 38. clusters=4 clusters=3 clusters=2
  39. 39. CHAPTER 7 Fast Video Segmentation with automatic change of number of clusters Real-time Video-segmentation Introduction A video is made up of many images called frames which are linked together and these frames are displayed at such a high speed that it appears to us as if it is one single component(one video). But, it is not so, hence, video segmentation is similar to image segmentation only major difference being that we segment each frame of the video in order to segment it. But various other aspects come into picture while segmenting a video since it is not random images which are to be segmented they are all linked in a manner. Several video segmentation algorithms have been proposed. They can be classified into three types: 1. edge information based video segmentation, 2. image segmentation based video segmentation and 3. change detection based video segmentation. 1. Edge information based algorithms, first apply edge detector algorithms to find edge information of each frame and then keep tracking these edges. A morphology motion filter is also applied to find edges belonging to foreground objects. Next, a filling technique can connect edge information to generate final object masks. This method can deal with both still camera and moving camera situations; however, the computation load is very large. 2. Image segmentation based algorithms first apply image segmentation algorithms, such as watershed transform and colour segmentation on each frame to separate a frame into many homogeneous regions. By combining motion information derived with motion estimation, or frame difference, regions with motion vectors different from the global motion are merged as foreground regions. These algorithms often can give segmentation results with accurate boundaries, but the computation load for image segmentation and motion information calculation is also high, and the region merging process often has many parameters to set. Both these two kinds of algorithms are too complex to be integrated into a real-time system. 3. Change detection based segmentation algorithms, threshold the frame difference to form change detection mask. Then the change detection masks are further processed to generate final object masks. The processing speed is high, but it is often not robust. The segmentation results are suffered from the uncovered background situations; still object situations, light changing, shadow, and noise. The robustness can be promoted by a lot of post-processing algorithms; however, complex post-processing will make the efficiency of less computation lost. The threshold of change detection is very critical and cannot be automatically decided. These reasons make this kind of algorithms not practical for real applications.
  40. 40. All these algorithms have their own specific areas of excellence like image segmentation type algorithms can give very good segmentation results but are too heavy to be used for real-time applications, and change detection algorithms being light are often used for real-time applications though a compromise on quality of segmentation is to be made. Real time video segmentation is a very difficult task since the segmentation of the frame has to be done very fast i.e. before the next frame arrives. Though the speed of arrival of frames can be varied but still it has to be fast enough so that it doesn’t appear as a collection of images but a video. In general, a speed of 25frames/second is found to be sufficient but that too requires the segmentation algorithm to be really fast. Proposed real-time video segmentation algorithm We noticed that since our proposed algorithm is very fast in comparison to regular K-means algorithm we thought that we can go one more step forward and try real-time video segmentation. Our method would qualify as the second category of segmentation i.e. image segmentation based algorithm, wherein we segment each frame of the video separately till the next frame arrives. These types of algorithms are famous for their segmentation quality and poor time efficiency, but our proposed method has not only improved the quality but also has increased the speed large enough to be used for real-time purposes which earlier was not possible for other image segmentation type algorithms. By using moving average filter to find the number of clusters we have been able to break the video into variable number of clusters for each frame i.e. each frame will have its own number of clusters. If general K-means algorithm is applied to segment a video (not even real time) in which the number of clusters is given as an input, it cannot be given for each frame as it will be very difficult, so K will be given for a complete video. Hence, the program will try to break every frame into equal number of clusters. For example, if the value of k is given as 4 then the program will try to break each frame into 4 clusters even if in a frame there is only one intensity value. This will give rise to the problem of non-convergence since the rest of the three clusters won’t be able to find final cluster centres and it will give error. But by our method if any of the frame has many objects of different intensities then it will be appropriately broken into many clusters and if there is only one intensity then it will have only one cluster. The additional feature of auto-pilot which has been incorporated so that the program itself decides the value of n for moving average filter to give the number of clusters brings it closer to being unsupervised. We just need to give the input that how much detail do we require from the video i.e. If we require good amount of detail then we can keep number of clusters to be the maximum value of n which comes out to be stable or if we require only crude discrimination then we can have minimum stable value of n as number of clusters.
  41. 41. In video segmentation, clustering has been used only for video summary, but not for segmentation of video frame itself, because of large computing time. By using autopilot as discussed, segmentation of video is possible with automatic change in number of clusters when there is introduction of new object in the image. This automatic change becomes a crucial point of consideration in computer vision. This can be established by using the auto pilot by choosing proper limits of clusters and breaking the autopilot at first possible segmentation itself. This fastest video segmentation algorithm as speed can go even up to 100 frames per second based on limits of clusters whereas speed of previous algorithms is limited to only 25 frames per second. In applications like where we are concerned about only watching the video segmentation we can just use color map to give the effect of segmentation without actually getting into the image and cause increased computation time. This makes algorithm time independent of size of frame. Uses,  We can also use this algorithm for lossy video compression in internet video chating or live streaming etc.  In algorithms having to segment large database of images. This can save lot of time. Frames of same video with change in number of clusters by introduction of object in the video
  42. 42. CHAPTER 8 GRAPHIC USER INTERFACE Layout of GUI Divided into 7 panels: 1. Loader Panel 2. Error and Selection Panel 3. Viewer Panel 4. Interaction Panel 5. Initialization Panel 6. Segmentation Panel 7. Results Panel Loader Panel  Used for loading the image in the software  Image name should be written in ‘file name.file format’  Image is loaded as soon as Load Image button is pressed
  43. 43.  Software works only for 2 dimensional images. Therefore Image should be first converted into 2 dimension and then it can be loaded Error & Selection Panel  Used for error selection & Theorem selection  Error is the minimum error allowed between consecutive iteration to stop the iterations. It acts as breaking criteria  10 Algorithms have been loaded in the software. User can select any one of them for segmenting the image  First 6 Algorithms are already existing and last 4 Algorithms are proposed ones  Existing Algorithms: 1. K-means 2. Fuzzy-cmean 3. Fcm for image with salt and pepper noise 4. Fcm for image with Gaussian noise 5. GKFCM 6. Modified GKFCM  Proposed Algorithms 1. K-means using histogram 2. Fuzzy c-means using histogram 3. F+k means 4. Kf-means Viewer Panel
  44. 44.  Axes 11 for showing image with initial cluster centers(to give an idea about segmentation)  Axes 6 for showing original image Initialization panel  Axes 1 is used for showing original histogram and filtered histogram  Slider is used for giving size of moving average filter as user input  Popup menu to select algorithm for finding initial cluster centers  Provision for starting with normal cluster centers as ‘Normal’
  45. 45.  KHT and FHT for speeding up the segmentation of images that can use only image based algorithms like image with noise  Crop and Zoom In buttons for cropping the images and finding the pixel values respectively. Interaction Panel  Used for snapshot  Live segmentation demo(for computer vision )  Chating demo  User input: No. of frames Segmentation Panel
  46. 46.  Display and editing of initial cluster centers  Starting Segmentation  Choosing color map and color of edge  For choosing variables controlling neighborhood effect  Choosing Auto Pilots: 1. Auto pilot using k-means 2. Auto Pilot using fuzzy c-means Results Panel  Display of final cluster centers.  Display of time taken for segmentation algorithm.  Display of number of iterations carried out.
  47. 47. CHAPTER 9 Experimental Results Original Image Original Histogram
  48. 48. Filtered Histogram Comparision between speeds for initial cluster centers found with different theorems (Algorithm used is simple k-means). Normal Initial cluster centers for number of clusters as 3= [24 73 122] Final cluster centers= [19 47 91], Time=0.3773 secs, iterations=12 Initial cluster centers using theorem 1 for ‘t’ as 15= [19 39 99] Final cluster centers= [18 45 90], Time=0.1466 secs, iterations=4 Initial cluster centers using theorem 2 for ‘t’ as 15= [0 27 86] Final cluster centers= [13 38 88], Time=0.2331 secs, iterations=7 Observe the reduction in no. of iterations required to get the result.
  49. 49. Since, we have found fastest results with theorem-1, Segmentation results in that case are being shown: Comparision between results obtained by different algorithms(using initial cluster centers of theorem -1):
  50. 50. Initial Cluster centers:[34 94 128] k-means: Fuzzy c-means: k-means using proposed method:
  51. 51. Fcm using propsed method: F+k means: kf-means Segmentations results obtained by kf-means:
  52. 52. Segmentation of noisy images: (i)Salt & Pepper noise: BCFCM_S2 is used
  53. 53. Initial Cluster Centers: [32 78 123 255] ‘t’=28 ‘af’=10 ‘sig’=20
  54. 54. cluster1 cluster2 cluster3 cluster4 Original Image with segmented edge Segmented Image with segmented edge
  55. 55. Edge obtained by matlab Edge obtained by propesed method
  56. 56. (ii)Gaussian Noise Algorithm used=BCFCM_S1 Initial cluster centers=[57 77 255] ‘t’=41 ‘af’=60 ‘sig’=20
  57. 57. cluster1 cluster2 cluster3 Original Image with segmented edge Segmented Image with segmented edge
  58. 58. GKFCM: Edge obtained by matlab Edge obtained by propesed method
  59. 59. Cropping Sometimes detail required in the mage may be very small portion of entire image. In that case cropping is necessary to obtain useful results so that the detail plays a significant role in the segmentation Cropped image To be able to see the tumor clearly
  60. 60. Tumor has got separated in cluster 5. cluster1 cluster2 cluster3 cluster4 cluster5
  61. 61. CHAPTER 10 ACCOMPLISHMENTS, FUTURE RESEARCH AND APPLICATIONS Accomplishments: 1. We have been able to implement six different algorithms for clustering K-means, Fuzzy C-means, BCFCM, KFCM_S1, KFCM_S2 and GKFCM. 2. We have been able to make modifications to already existing algorithms to remove the problem of number of clusters, initial cluster centres and non-convergence. 3. Four new methods have been proposed by us. 4. By speeding-up of the algorithms we have been able to do real-time image segmentation. Future research or development: 1. Better selection of number of clusters can be done, though auto-pilot gives decent results and is fast but it can be further improved depending upon the applications. 2. The algorithm is much faster than required to do 25frames/second so the work can be done on improving the quality of the segmented video. 3. A further research can be done on choosing better membership function and relationship between pixel and its neighbours that removes more noise gives better segmentation results. Applications: 1. For many segmentation algorithm K-means is pre-processing step on which other segmentation tools are used so our method can speed-up segmentation and quality of output as well , and can speed-up other processes requiring clustering like data mining, information retrieval, etc. 2. By using the auto-pilot option the K-means algorithm has been made more unsupervised and can be useful in computer vision and machine learning. 3. Real-time video segmentation can be useful in video-surveillance where data size is large and time to survey it is less or in on-line chatting when the speed of transmission is poor then the segmented image can be compressed more for fast transmission and retrieval.
  62. 62. References 1. Digital Image Processing using MATLAB, by Gonzalez, Woods and Eddins, 2009 2. Miin-Shen Yang, Hsu-Shen Tsai, 2008, ‘A Gaussian kernel-based fuzzy c-means algorithm with a spatial bias correction’ 3. Erlend Hodneland ,July, 2003, ‘Segmentation of Digital Image’ 4. Ursula Gonzales-Baron, Francis Butler, March 2005, ‘A comparison of seven thresholding techniques with the k-means clustering algorithm for measurement of bread- crumb features by digital image analysis’ 5. D.A. Clausi, 2002, K-means Iterative Fisher (KIF) unsupervised clustering algorithm applied to image texture segmentation 6. Likas, Nikos Vlassis, Jakob J. Verbeek, 2003, The global k-means clustering algorithm 7. Sadullah Sakallioglu, Murat Erisoglu, Nazif Calis ,2011, ‘A new algorithm for initial cluster centers in k-means algorithm 2011’ 8. Liang Bai, Jiye Liang, Chuangyin Dang, 2011, ‘An initialization method to simultaneously find initial cluster centers and the number of clusters for clustering categorical data’ 9. Fuyuan Cao, Jiye Liang, Guang Jiang, 2009, ‘An initialization method for the K-Means algorithm using neighborhood model’ 10. A.K. Jain, R.C. Dubes, Algorithms for Clustering Data 11. K.K. Chen, L. Liu, 2008, ‘Best K: critical clustering structures in categorical datasets’ 12. J.J. Li, M.K. Ng, Y.M. Cheng, Z.H. Huang, 2008, ‘Agglomerative fuzzy k-means clustering algorithm with selection of number of clusters’ 13. J.M Peña, J.A Lozano, P Larrañaga, 1999, An empirical comparison of four initialization methods for the K-means algorithm 14. Yasira Beevi and Dr. S. Natarajan, Dec 2009, An efficient Video Segmentation Algorithm with Real time Adaptive Threshold Technique
  63. 63. Accomplishments: 5. We have been able to implement six different algorithms for clustering Future research or development: 4. Better selection of number of clusters can be done, though auto-pilot gives decent results and is fast but it can be further improved depending upon the applications. 5. The algorithm is much faster than required to do 25frames/second so the work can be done on improving the quality of the segmented video. 6. A further research can be done on choosing better membership function and relationship between pixel and its neighbours that removes more noise gives better segmentation results. Applications: 4. For many segmentation algorithm K-means is pre-processing step on which other segmentation tools are used so our method can speed-up segmentation and quality of output as well , and can speed-up other processes requiring clustering like data mining, information retrieval, etc. 5. By using the auto-pilot option the K-means algorithm has been made more unsupervised and can be useful in computer vision and machine learning. 6. Real-time video segmentation can be useful in video-surveillance where data size is large and time to survey it is less or in on-line chatting when the speed of transmission is poor then the segmented image can be compressed more for fast transmission and retrieval.

×