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

chapter-2

Uploaded by

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

chapter-2

Uploaded by

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

Chapter-2

Image Segmentation
Image segmentation partitions the set X into the subsets R(i),
i=1,…,N having the following properties

X = i=1,..N U R(i)
R(i) ∩ R(j) = 0 for I ≠ j
P(R(i)) = TRUE for i = 1,2,…,N
P(R(i) U R(j)) = FALSE for i ≠ j
Region-growing

The fundamental drawback of histogram-based region detection is


that histograms provide no spatial information (only the distribution of
gray levels)
Region-growing approaches exploit the important fact that pixels
which are close together have similar gray values
Region growing techniques start with one pixel of a potential region and
try to grow it by adding adjacent pixels till the pixels being compared are
too dissimilar
Region-growing

1) Choose the seed pixels (one for every segment).The first pixel selected
can be just the first unlabeled pixel in the image or a set of seed pixels
can be chosen from the image
2) Check the neighboring pixels and add them to the region if they are
similar to the seed
3) Repeat step 2 for each of the newly added pixels; stop if no more pixels
can be added
Thresholding

▪ Bi-level thresholding is employed on images


which have bimodal histograms.
▪ In bi-level thresholding, the object and
background form two different groups with
distinct gray levels.
Multilevel Thresholding
A simple iterative algorithm for threshold selection
in a bimodal image
Split and Merge

1. Split (& merge) starts from the assumption that the entire image is homogeneous

2. If this is not true (by the homogeneity criterion), the image is split into four sub images
3. This split is repeated until no further splitting is possible

4. Merging phase: If 2 adjacent regions are homogenous, they are merged

5. Repeat step 4 until no further merging is possible


Split and Merge
Since the procedure is recursive, it produces an image representation that can be described
by a tree whose nodes have four sons each
*Such a tree is called a
‘Quadtree’. Therefore split is also
known as ‘quadtree segmentation’
Edges
Edges are significant local changes of intensity in an image
Edges are pixels where the brightness function changes abruptly

Goal of Edge Detection


Produce a line “drawing” of a scene from an image of
that scene.

Why is Edge Detection Useful?


Convert a 2D image into a set of curves
Extract useful information from images Recognizing objects
Types of Edges and definition

Variation of Intensity / Gray


Level
➢Step Edge
➢Ramp Edge
➢Line Edge
➢Roof Edge
Definition of edge is the abrupt
change in intensity value
Edge Detection
Edge detection is a technique of image processing used to identify points in a digital image with
discontinuities, simply to say, sharp changes in the image brightness.
• These points where the image brightness varies sharply are called the edges (or boundaries) of the
image.
• It is one of the basic steps in image processing, pattern recognition in images and computer vision.
When we process very high-resolution digital images, convolution techniques come to our rescue.

The basic idea behind edge detection is as follows:


– To highlight local edge operator use edge
enhancement operator.
– Define the edge strength and set the edge points.
Gradient operator
Use gradient for image differentiation
The gradient of an image f(x,y) at location (x,y) is the vector
é ¶f ù
éG x ù ê ¶x ú
Ñf = ê ú = ê ¶f ú
ëG y û ê ú
ë ¶y ú
ê û
Some properties about this gradient vector
• It points in the direction of maximum rate of change of image at (x,y)
• Magnitude:
Ñf = mag (Ñf )= Gx + Gy » Gx + Gy
2 2

æ Gy ö
• Direction (angle is measured w.r.t x axis): a (x, y ) = tan çç ÷÷
-1

è Gx ø
Methods of Edge Detection
First Order Derivative / Gradient Methods
• Roberts Operator
• Sobel Operator
• Prewitt Operator
Second Order Derivative
• Laplacian
• Laplacian of Gaussian
• Difference of Gaussian
Optimal Edge Detection
• Canny Edge Detection
Robert Operator
Sobel Operator

Sobel edge detection operator extracts all the edges of an


image, without worrying about the directions.
Main advantage of the Sobel operator is that it provides
differencing and smoothing effect.
• Sobel edge detection operator is implemented as the sum of
two directional edges.
• the resulting image is a unidirectional outline in the original
image.
Sobel Edge detection operator consists of 3x3 convolution kernels. Gx is a simple kernel and
Gy is rotated by 90°
Sobel Operator

These Kernels are applied separately to input image because separate measurements
can be produced in each orientation i.e Gx and Gy.
Sobel Operator
Gradient Methods – Prewitt Operator
Prewitt Operator

The gradient magnitude is usually computed as

Prewitt operator is defined by a set of eight


masks, four of which are shown in Figure .
Others can be generated by rotation of 90'
successively.
Kirsch Operator

Kirsch masks can be defined in


eight directions, which yields the
estimated gradients in these
directions
Canny Edge Detector
The Canny edge detection algorithm is a multistage algorithm that is used to detect edges in images.

Convert the image to grayscale


Reduce noise – as the edge detection that using derivatives
is sensitive to noise, we reduce it.
Calculate the gradient – helps identify the edge intensity
and direction.
Non-maximum suppression – to thin the edges of the image.
Double threshold – to identify the strong, weak and
irrelevant pixels in the images.
Hysteresis edge tracking – helps convert the weak pixels
into strong ones only if they have a strong pixel around
them.
Second Order Derivative Methods

Zero crossing of the second


derivative of a function
indicates the presence of a
maxima
Laplacian Edge Detection

The Laplacian edge detection algorithm is a simple and efficient method for detecting edges in images.
• It works by calculating the Laplacian of the image, which is a measure of the second derivative of the
image.
• The Laplacian of an image is zero at all points where the image is smooth, but it will be positive at
points where the image has a sharp change in intensity, such as at edges.
❑Defined as

0 1 0
❑Very susceptible to noise, filtering required, use Laplacian 1 -4 1
of Gaussian 0 1 0
Laplacian of Gaussian (LoG)
(Marr-Hildreth operator)

• To reduce the noise effect, the image is first


smoothed.
• When the filter chosen is a Gaussian, we call it the
LoG edge detector.

• It can be shown that:


Decomposition of LoG (cont’d)

▪ Filter the input image with a nxn Gaussian lowpass filter. N is the smallest
odd integer greater than or equal to 6
▪ Compute the Laplacian of the image resulting from step1
▪ Find the zero crossing of the image from step 2
g ( x, y) =  G( x, y) f ( x, y) 
2
Decomposition of LoG
• It can be shown than LoG can be written as follows:

• 2D LoG convolution can be implemented using 4, 1D


convolutions. σ controls smoothing
Difference of Gaussians (DoG)

The Laplacian of Gaussian can be


approximated by the difference
between two Gaussian functions:

actual LoG
approximation
Gradient vs LoG
step edge

▪ Gradient works well when


the image contains sharp
intensity transitions and
low noise.
▪ Zero-crossings of LOG offer
ramp edge
better localization,
especially when the edges
are not very sharp.

o LoG behaves poorly at corners


Difference of Gaussian – contd.

Advantage of DoG
▪ Close approximation of LoG
▪ Less computation effort
▪ Width of edge can be adjusted
by changing s1 and s2
Second Order Derivative Methods - Difference of Gaussian - DoG

LoG requires large computation time for a large edge detector mask
To reduce computational requirements, approximate the LoG by
the difference of two LoG – the DoG

x 2+ y 2 x 2+ y 2
−( ) −( )
212
e 2 2
2
e
DoG ( x, y ) = −
2 1 2 2
2 2
Sheet -1
1)Do histogram stretching for the following 8 x 8 graylevel image
0 0 0 0 0 0 0 0
0 0 4 4 4 4 4 0
0 4 5 5 5 5 4 0
0 4 5 7 7 5 4 0
0 4 5 7 7 5 4 0
0 4 5 6 6 5 4 0
0 4 5 5 5 5 4 0
0 4 4 4 4 4 4 0

2)Do histogram equalisation for a 64 x 64 image, when it’s


Gray level deviation is
graylevel pixels
0 790
1/7 1023
2/7 850
3/7 656
4/7 329
5/7 245
6/7 122
1 81

3)Segment the following image using split and merge strategy.


The logical predicate P(Ri) = TRUE, when all the pixels in the
region Ri have the same intensity. Construct the correspond ding
quadtree.
4)Apply the following filters to the image

by using a 3 x 3 window and


a) Neighbor hood averaging
b) Gaussian filtering with the following convolution mask
5) Below is a histogram of an image of a black-and-white soccer ball on a gray
background. This soccer is 230 mm in a diameter what is the pixel spacing?
[0 520 920 490 30 40 5910 24040 6050 80 20 80 440 960 420 0]

6) Below is the histogram of a 20-gray level image containing one frit on a


contrasting background. The pixel spacing is 2 mm. Is the fruit a cherry, a grapefruit,
or a pumpkin?
[0 100 200 300 500 600 500 300 200 100 200 500 3,000 8,000 20,000 8,000
3000 500 100 0]
Example: Histogram Equalization

Suppose that a 3-bit image (L=8) of size 64 × 64 pixels (MN = 4096) has the
intensity distribution shown in following table.
Get the histogram equalization transformation function and give the ps(sk) for
each sk.
→1
0
s0 = T (r0 ) = 7 pr (rj ) = 7  0.19 = 1.33
j =0
1
s1 = T (r1 ) = 7 pr (rj ) = 7  (0.19 + 0.25) = 3.08 →3
j =0

s2 = 4.55 →5 s3 = 5.67 →6
s4 = 6.23 → 6 s5 = 6.65 →7
s6 = 6.86 →7 s7 = 7.00 → 7

You might also like