Legacy Documentation

Digital Image Processing (2000)

This is documentation for an obsolete product.
Current products and services
Previous section-----Next section

7.5 Segmentation by Clustering

Clustering is a classification technique [Did80]. Given a vector of N measurements describing each pixel or group of pixels (i.e., region) in an image, a similarity of the measurement vectors and therefore their clustering in the N-dimensional measurement space implies similarity of the corresponding pixels or pixel groups. Therefore, clustering in measurement space may be an indicator of similarity of image regions, and may be used for segmentation purposes. The vector of measurements describes some useful image feature and thus is also known as a feature vector. Similarity between image regions or pixels implies clustering (small separation distances) in the feature space. Clustering methods were some of the earliest data segmentation techniques to be developed.

Clustering functions.

KMeans clustering finds a grouping of the measurements that minimizes the within-cluster sum-of-squares. In this method, each measurement, represented by a vector of length N, is grouped so that it is assigned to one of a fixed number of clusters. The number of clusters is determined by the number of seeds given as the second argument of KMeans. Measurements are transferred from one cluster to another when doing so decreases the within-cluster distances. The algorithm stops when no more transfers can occur. Here we will demonstrate the application of KMeans clustering to a simple image segmentation problem. Consider the problem of programmatically manipulating individual red beans in a fragment of the beans image.
In[1]:=
In[2]:=
In[3]:=
In[4]:=
Out[4]=Out[4]=
In[5]:=
In[6]:=
In[7]:=
In[8]:=
Out[8]=Out[8]=
In[9]:=
In[10]:=
In[11]:=
Out[11]=Out[11]=
In[12]:=
In[13]:=
Out[13]=Out[13]=

Cluster analysis functions.

In[14]:=
Out[14]=Out[14]=
In[15]:=
Out[15]=Out[15]=
The determination of similarity between regions or pixels is a result of measuring a distance in feature space. Many distance measures have been proposed between two points in N-dimensional space [Did80]. The most frequently used similarity measure is the well-known EuclideanDistance. If we take two measurement vectors X={x1,x2,...xn} and Y={y1,y2,...yn}, the Euclidean distance between them, also commonly called the square-root distance, is defined as

Option for KMeans, KMeansList, and ClusterMetric.