0% found this document useful (0 votes)
42 views

Image Segmentation

The document discusses various image segmentation techniques including: 1. Threshold-based segmentation which uses a threshold value to segment images and can result in oversegmentation or undersegmentation. 2. Region-based segmentation techniques like region growing and fast scanning that group similar pixels into homogeneous regions. 3. Clustering-based segmentation including k-means clustering that groups pixels into a fixed number of clusters based on features and density-based techniques. Edge detection and laplacian filters are also covered as well as factors like noise and local versus global thresholding that impact segmentation quality. A variety of techniques are compared in terms of advantages and disadvantages.

Uploaded by

Shakshi Agrawal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Image Segmentation

The document discusses various image segmentation techniques including: 1. Threshold-based segmentation which uses a threshold value to segment images and can result in oversegmentation or undersegmentation. 2. Region-based segmentation techniques like region growing and fast scanning that group similar pixels into homogeneous regions. 3. Clustering-based segmentation including k-means clustering that groups pixels into a fixed number of clusters based on features and density-based techniques. Edge detection and laplacian filters are also covered as well as factors like noise and local versus global thresholding that impact segmentation quality. A variety of techniques are compared in terms of advantages and disadvantages.

Uploaded by

Shakshi Agrawal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

IMAGE SEGMENTATION

TYPES OF SEGMENTATION
1. THRESHOLD BASED SEGMENTATION

The bottom left and right


images show examples of
oversegmentation and
undersegmentation
respectively
Threshold value 0
Threshold value 10
Threshold value 25
Threshold value 50
Threshold value 75
Threshold value 100
Threshold value 125
Threshold value 150
Threshold value 175
Threshold value 200
Threshold value 215
Threshold value 230
HISTOGRAM FOR IMAGES

Plain Image Noise Image

Threshold t may be
midway between two peaks with grey values p1 and p2
HISTOGRAM OVERLAP

Minimum choice for t is usually better than the


midway choice.
 We may select a threshold that maximizes the
variance between objects and background, or one
that attempts to optimize both these “within” and
“between” variances.
MINIMUM VARIANCE
 For simplicity, we normalize the histogram H(v) of the
image to a proper distribution h(v) as
h(v) = 1.

 This can be achieved by setting


h(v) = H(v)/n for all v,
where n is the total number of pixels in the image.
The variance of the grey values σ2 in the image then
(by definition) equals
ITERATIVE THRESHOLDING
Problem: noisy histograms
(salt-and pepper noise)
OPTIMAL THRESHOLDING
 Optimal thresholding is a technique that approximates the
histogram using a weighted sum of distribution functions, and
then sets a threshold in such a way that the number of
incorrectly segmented pixels (as predicted from the
approximation) is minimal.
 If the histogram is bimodal (two segments; objects and
background), and that the histogram can be
approximated well using a sum of two Gaussians. In
this case, this means we model the normalized
histogram h as
 where g0 and g1 are Gaussian functions with unknown mean
and variance, and P0 and P1 are the global probabilities also
unknown that a pixel belongs to segment 0 or 1 respectively.
Note that P0 + P1 = 1.
ENHANCING THRESHOLD SEGMENTATION

Noisy Image Threshold Segmentation Histogram of


original image

Filtering should be applied before or after


the thresholding
Median filter Applied Thresholding Result
PRE-OR-POST PROCESSING

Noisy Original Thresholded Image

Thresholding Fails in this case


Image Closing
Thresholded Result Removing some small
using 7*7 square
area segments

Image Closing
using 9*9 square
NEED FOR LOCAL THRESHOLDING
 Global threshold: The threshold was the same for the
entire image.

Pixel Pixel
value 240 value 120
STEPS:
 If we divide the image into n subimages.
 Then the grey value of bone pixels in each subimage
will be relatively constant, because the gradient
effect is comparatively.
 For each subimage, we can now find an appropriate

threshold to extract the bone pixels.


 Merging the segmentation results of each subimage
into a complete image again will give us a good
segmentation of the whole image.
SUMMARY
 Advantages:
 Simple to implement

 Fast (especially if repeating on similar images)

 Good for some kinds of images (e.g.,documents,


controlled lighting)
 Disadvantages:

 No guarantees of object coherency may have holes,


extraneous pixels, etc. (incomplete) solution: post-
processing with morphological operators
EDGE BASED SEGMENTATION
 There are three basic types of gray-level
discontinuities in a digital image: points, lines, and
edges
 The most common way to look for discontinuities is to
run a mask through the image.
 We say that a point, line, and edge has been detected
at the location on which the mask is centered
if ,where
 Point detection

a point detection mask

 Line detection

a line detection mask


 Edge detection: Gradient
operation
 f 
f      fx 
Gx
 
Gy
 y 
1
f  mag (f )  Gx  Gy  2 2 2

Gy
 ( x, y )  tan (
1
)
Gx
 Edge detection:
Laplacian operation

2 f 2 f
 f  2  2
2

x y

r2
 r 2   2   2 2
 h(r )   
2
e
  4

REGION-BASED SEGMENTATION
SRG
 Region growing: Groups pixels or sub-region into
larger regions.
 step1:
 Start with a set of “seed” points and from
these grow regions by appending to each
seed those neighboring pixels that have
properties similar to the seed.
 step2:
 Region splitting and merging

4
1
REGION-BASED SEGMENTATION
SRG
 Advantage:
 With good connectivity

 Disadvantage:
 Initial seed-points:
 different sets of initial seed-point cause different segmented
result
 Time-consuming problem

4
2
REGION-BASED SEGMENTATION
USRG
 Unseeded region growing:
 no explicit seed selection is necessary, the
seeds can be generated by the
segmentation procedure automatically.
 It is similar to SRG except the choice of
seed point

4
3
REGION-BASED SEGMENTATION
USRG
 Advantage:
 easy to use
 can readily incorporate high level knowledge of the
image composition through region threshold

 Disadvantage:
 slow speed

4
4
REGION-BASED SEGMENTATION
FAST SCANNING(1)
 Fast scanning Algorithm:
 The fast scanning
algorithm somewhat
resembles unseeded
region growing
 the number of clusters of
both two algorithm would
not be decided before
image passing through
them.

45
REGION-BASED SEGMENTATION
FAST SCANNING(2)

4
6
REGION-BASED SEGMENTATION
FAST SCANNING(3)

 Last step:

 merge small region to


big region

47
REGION-BASED SEGMENTATION
FAST SCANNING
 Advantage:
 The speed is very fast
 The result of segmentation will be intact with good
connectivity

 Disadvantage:
 The matching of physical object is not good
 It can be improved by morphology and geometric
mathematic

4
8
REGION-BASED SEGMENTATION
FAST SCANNING-IMPROVED BY MORPHOLOGY

 erosion
 dilation

A  B  {c  E N | c  a  b for some a  A and b  B} A ! B  {x  E N x  b  A for every b  B}

49
REGION-BASED SEGMENTATION
FAST SCANNING-IMPROVED BY
MORPHOLOGY

 dilation  erosion

50
REGION-BASED SEGMENTATION
FAST SCANNING-IMPROVED BY MORPHOLOGY

 opening  closing

51
Erosion=>Dilation Dilation=>Erosion
CLUSTERING SEGMENTATION
WHAT IS CLUSTER ANALYSIS?
 Finding groups of objects such that the objects in a group
will be similar (or related) to one another and different from
(or unrelated to) the objects in other groups

Inter-cluster
Intra-cluster distances are
distances are maximized
minimized
NOTION OF A CLUSTER CAN BE AMBIGUOUS

How many clusters? Six Clusters

Two Clusters Four Clusters


TYPES OF CLUSTERS: CONTIGUITY-BASED

 Contiguous Cluster (Nearest neighbor or


Transitive)
 A cluster is a set of points such that a point in a cluster is
closer (or more similar) to one or more other points in the
cluster than to any point not in the cluster.

8 contiguous clusters
TYPES OF CLUSTERS: DENSITY-BASED

 Density-based
 A cluster is a dense region of points, which is separated by
low-density regions, from other regions of high density.
 Used when the clusters are irregular or intertwined, and
when noise and outliers are present.

6 density-based clusters
EUCLIDEAN DENSITY – CENTER-BASED
 Euclidean density is the number of points within
a specified radius of the point
K-MEANS
 Choose a fixed number of  Algorithm
clusters  fix cluster centers; allocate
points to closest cluster
 fix allocation; compute
 Choose cluster centers and
best cluster centers
point-cluster allocations to
minimize error  x could be any set of
features for which we can
 can’t do this by search,
compute a distance
because there are too
(careful about scaling)
many possible allocations.

 2 
  
iclusters jelements of i'th cluster
x j   i 

Image Clusters on intensity Clusters on color

K-means clustering using intensity alone and color alone


Image Clusters on color

K-means using color alone, 11 segments


K-means using
color alone,
11 segments.
LIMITATIONS OF K-MEANS

 K-means has problems when clusters are


of differing
 Sizes
 Densities
 Non-globular shapes

 K-means has problems when the data


contains outliers.
LIMITATIONS OF K-MEANS: DIFFERING
SIZES

Original Points K-means (3 Clusters)


LIMITATIONS OF K-MEANS: DIFFERING
DENSITY

Original Points K-means (3 Clusters)


LIMITATIONS OF K-MEANS: NON-GLOBULAR
SHAPES

Original Points K-means (2 Clusters)


OVERCOMING K-MEANS LIMITATIONS

Original Points K-means Clusters

One solution is to use many clusters.


Find parts of clusters, but need to put together.
OVERCOMING K-MEANS LIMITATIONS

K-means Clusters
MATCHING
 If we want to locate an object in an image, and we
have available an example of what it should look like
(a template), we can find this object by matching the
template to various image locations until we have
found the object.

 The most straightforward way of determining whether


a template ‘fits’ would be to place the template at a
certain image location, and see whether the grey
values of the template and the underlying image
image grey values all match.
 However, because there will generally be some
differences between the image and template values
because of noise and other artifacts, this is not a very
practical method. More useful is a quantitative measure
of fit such as

 where f is the image, g the M × N template, and the


variables p and q determine the location of the template
in the image. This measure will be small if the template
is similar to the part of the image under investigation;
then all grey value differences g(x, y)−f(x+p, y +q) are
small and the sum M1 will be small. The location of
optimal template fit is found by minimizing M1 to p and
q.
Image matching. The left image gives a template of the object we wish to
locate in the right image. This is achieved by matching of the template to
various locations in the right image.

You might also like