100% found this document useful (3 votes)
2K views57 pages

Unit 4

Image segmentation algorithms partition an image into groups of pixels that correlate with real-world objects. Segmentation is typically the first step in computer vision applications. The main approaches are based on discontinuities, which partition based on abrupt intensity changes like edges, and similarity, which groups similarly intense regions. Common techniques include thresholding, edge detection using gradient operators like Sobel, and the Hough transform for global line detection. Region-based methods group connected similarly intense pixels into regions.

Uploaded by

Poongodi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
2K views57 pages

Unit 4

Image segmentation algorithms partition an image into groups of pixels that correlate with real-world objects. Segmentation is typically the first step in computer vision applications. The main approaches are based on discontinuities, which partition based on abrupt intensity changes like edges, and similarity, which groups similarly intense regions. Common techniques include thresholding, edge detection using gradient operators like Sobel, and the Hough transform for global line detection. Region-based methods group connected similarly intense pixels into regions.

Uploaded by

Poongodi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

Image Segmentation

 Segmentation attempts to partition the pixels of


an image into groups that strongly correlate
with the objects in an image
 Typically the first step in any automated
computer vision application

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 2


Image Segmentation
• Segmentation algorithms generally are based
on one of two basis properties of intensity
values
• Discontinuity: to partition an image based
on abrupt changes in intensity (such as
edges)

• Similarity: to partition an image into regions


that are similar according to a set of
predefined criteria.

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 3


Image Segmentation
 Image Segmentation

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 4


Image Segmentation
 Image Segmentation

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 5


Image Segmentation
 Detection of discontinuities:
 There are three basic types of gray-level
discontinuities:
 points , lines , edges

 the common way is to run a mask through


the image

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 6


Point Detection:
• Note that the mark is the same as the mask of
Laplacian Operation (in chapter 3)

• The only differences that are considered of


interest are those large enough (as determined
by T) to be considered isolated points.

|R| >T

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 7


Point Detection:

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 8


Line Detection

R1 R2 R3 R4

• Horizontal mask will result with max response when a line


passed through the middle row of the mask with a constant
background.
• the similar idea is used with other masks.
• note: the preferred direction of each mask is weighted with
a larger coefficient (i.e.,2) than other possible directions.

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 9


Line Detection
• Apply every masks on the image
• let R1, R2, R3, R4 denotes the response of
the horizontal, +45 degree, vertical and -45
degree masks, respectively.
• if, at a certain point in the image
|Ri| > |Rj|, for all j≠i,
• that point is said to be more likely
associated with a line in the direction of
mask i.
CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 10
Line Detection
• Alternatively, if we are interested in detecting all
lines in an image in the direction defined by a
given mask, we simply run the mask through the
image and threshold the absolute value of the
result.
• The points that are left are the strongest
responses, which, for lines one pixel thick,
correspond closest to the direction defined by
the mask.

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 11


Line Detection

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 12


Edge Detection Approach
 Segmentation by finding pixels on a region
boundary.

 Edges found by looking at neighboring pixels.

 Region boundary formed by measuring gray


value differences between neighboring pixels

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 13


Edge Detection

• an edge is a set of connected pixels that


lie on the boundary between two regions.

• an edge is a “local” concept whereas a


region boundary, owing to the way it is
defined, is a more global idea.

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 14


Edge Detection

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 15


Edge Detection

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 16


Edge Detection

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 17


Edge Detection
 Detection of discontinuities: Image Derivatives

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 18


Edge Detection
• First column: images and gray-
level profiles of a ramp edge
corrupted by random Gaussian
noise of mean 0 and = 0.0,
0.1, 1.0 and 10.0, respectively.
• Second column: first-derivative
images and gray-level profiles.
• Third column : second-
derivative images and gray-
level profiles.

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 19


Edge Detection
 Gradient Operator
 f 
Gx   x 
f      f 
G y   
 y 
f  G  G 2
x y 
2 1/ 2

for 3  3 mask
Gx  ( z7  z8  z9 )  ( z1  z 2  z3 )
G y  ( z3  z6  z9 )  ( z1  z 4  z7 )

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 20


Edge Detection
 Prewitt and Sobel Operators

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 21


Edge Detection

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 22


Edge Detection

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 23


Edge Detection

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 24


Edge Detection

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 25


Edge Detection
 The Laplacian

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 26


Edge Detection

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 27


Edge Detection
 The Laplacian of Gaussian (LoG)

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 28


Edge Detection
 The Laplacian of Gaussian (LoG)

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 29


The Hough Transform

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 30


The Hough Transform
 Global processing: The Hough Transform

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 31


The Hough Transform
 Global processing: The Hough Transform

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 32


The Hough Transform
 Global processing: The Hough Transform

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 33


Region-Based Segmentation

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 34


What is a Region?
 Basic definition :- A group of connected
pixels with similar properties.

 Important in interpreting an image because


they may correspond to objects in a scene.
 For that an image must be partitioned into
regions that correspond to objects or parts of
an object.

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 35


Region-Based vs. Edge-Based

Region-Based Edge-Based

 Closed boundaries  Boundaries formed


not necessarily
closed
 Multi-spectral  No significant
images improve improvement for
segmentation multi-spectral images
 Computation based  Computation based
on similarity on difference

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq.  36


Image Thresholding

•What is thresholding?
•Simple thresholding
•Adaptive thresholding

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 37


Thresholding – A Key Aspect
 Most algorithms involve establishing a
threshold level of certain parameter.
 Correct thresholding leads to better
segmentation.
 Using samples of image intensity available,
appropriate threshold should be set
automatically in a robust algorithm i.e. no
hard-wiring of gray values

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 38


Automatic Thresholding
 Use of one or more of the following:-
1. Intensity characteristics of objects
2. Sizes of objects
3. Fractions of image occupied by objects
4. Number of different types of objects
 Size and probability of occurrence – most
popular
 Intensity distributions estimate by histogram
computation.
CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 39
Automatic Thresholding Methods

 Some automatic thresholding schemes:


1. P-tile method
2. Iterative threshold selection
3. Adaptive thresholding

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 40


Thresholding Methods
 P-tile Method:- If object
occupies P% of image pixels
then set a threshold T such
that P% of pixels have
intensity below T.

 Iterative Thresholding:-
Successively refines an
T  1   2
approx. threshold to get a 1
new value which partitions 2
the image better.

 CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq.  41


P-Tile Thresholding
• Thresholding is usually the first
step in any segmentation approach
• Single value thresholding can be
given mathematically as follows:

1 if f ( x, y )  T
g ( x, y )  
0 if f ( x, y )  T
CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 42
P-Tile Thresholding
• Basic global thresholding:
• Based on the histogram of an image
Partition the image histogram using
a single global threshold

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 43


P-Tile Thresholding
• Basic global thresholding:
• The success of this technique very
strongly depends on how well the
histogram can be partitioned

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 44


Iterative P-Tile Thresholding
• The Basic global thresholding:
1. Select an initial estimate for T (typically the
average grey level in the image)
2. Segment the image using T to produce two
groups of pixels: G1 consisting of pixels with
grey levels >T and G2 consisting pixels with
grey levels ≤ T
3. Compute the average grey levels of pixels
in G1 to give μ1 and G2 to give μ2

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 45


Iterative P-Tile Thresholding
• The Basic global thresholding:
4. Compute a new threshold value:
1   2
T
2
5. Repeat steps 2 – 4 until the difference in T
in successive iterations is less than a
predefined limit T∞
This algorithm works very well for finding thresholds
when the histogram is suitable.
CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 46
P-Tile Thresholding

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 47


P-Tile Thresholding

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 48


P-Tile Thresholding
• Limitation of P-Tile thresholding:

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 49


P-Tile Thresholding
• Limitation of P-Tile thresholding:

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 50


P-Tile Thresholding
• Limitation of P-Tile thresholding:

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 51


Adaptive Thresholding
 Adaptive Thresholding is used in scenes with
uneven illumination where same threshold
value not usable throughout complete image.
 In such case, look at small regions in the
image and obtain thresholds for individual
sub-images. Final segmentation is the union
of the regions of sub-images.

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 52


Adaptive Thresholding
 Thresholding – Basic Adaptive Thresholding

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 53


Adaptive Thresholding
 Thresholding – Basic Adaptive Thresholding

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 54


Adaptive Thresholding
 Thresholding – Basic Adaptive Thresholding

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 55


Adaptive Thresholding
 Thresholding – Basic Adaptive Thresholding

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 56


Adaptive Thresholding
 Thresholding – Basic Adaptive Thresholding

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 57


Summary
 Segmentation is the most essential step
in most scene analysis and automatic
pictorial pattern recognition problems.

 Choice of the technique depends on the


peculiar characteristics of individual
problem in hand.

CSC447: Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 58

You might also like