You are on page 1of 45

IT472

Digital Image Processing

Asim Banerjee
Faculty Block #1, Room No. 1109
Extn. # 554
Edge - Types

IT472 - Digital Image Processing 2


Edge – Derivatives of Intensity Profiles

IT472 - Digital Image Processing 3


Gradient Operators

IT472 - Digital Image Processing 4


Gradient Operators

IT472 - Digital Image Processing 5


Gradient Operators

IT472 - Digital Image Processing 6


Gradient Operators - Application

IT472 - Digital Image Processing 7


Gradient Operators - Application

(a) Original image


a b
(b) Sobel gradient
c d
(c) Spatial Gaussian smoothing
e f g function
(d) Laplacian mask
(e) LoG
(f) Thresholded LoG
(g) Zero crossings.

IT472 - Digital Image Processing 8


Edge Detection Steps
• There are two basic steps of
edge detection
1.Detection of short linear edge
segments (edgels)
2.Aggregation of edgels into
extended edges (maybe
parametric description)

IT472 - Digital Image Processing 9


Any Questions?

IT472 - Digital Image Processing 10


Edgel Detection Methods

• Difference operators

• Parametric-model matchers

IT472 - Digital Image Processing 11


Edge is Where Change Occurs

• Change is measured by derivative in


1D
• Biggest change, derivative has
maximum magnitude
• Or 2nd derivative is zero.

IT472 - Digital Image Processing 12


Image Gradient (1/2)

• The gradient of an image:

• The gradient points in the direction of most


rapid change in intensity
• The gradient direction is given by:

– how does this relate to the direction of the edge?

IT472 - Digital Image Processing 13


Image Gradient (2/2)

• The edge strength is given by the gradient


magnitude

IT472 - Digital Image Processing 14


The Discrete Gradient
• How can we differentiate a digital
image f[x,y]?
– Option 1: reconstruct a continuous
image, then take gradient
– Option 2: take discrete derivative (finite
difference)

• How would you implement this as a


cross-correlation?
IT472 - Digital Image Processing 15
The Sobel Operator (1/2)

• Better approximations of the


derivatives exist
– The Sobel operators below are very
commonly used

-1 0 1 1 2 1
-2 0 2 0 0 0
-1 0 1 -1 -2 -1

IT472 - Digital Image Processing 16


The Sobel Operator (2/2)

–The standard definition of the Sobel


operator omits the 1/8 term
• Doesn’t make a difference for edge
detection
• However, the 1/8 term is needed to
get the right gradient value,

IT472 - Digital Image Processing 17


Gradient Operators

(a) Roberts’ cross operator (b) 3x3 Prewitt operator


(c) Sobel operator (d) 4x4 Prewitt operator
IT472 - Digital Image Processing 18
Any Questions?

IT472 - Digital Image Processing 19


Effects Of Noise (1/2)

• Consider a single row or column of the image


– Plotting intensity as a function of position gives a signal

• Where is
the edge?

IT472 - Digital Image Processing 20


Effects Of Noise (2/2)

(a) (b) (c)


(a) Original image and its edge output
(b) Noise added (zero mean and σ = 0.03) and edge output
(c) Noise added (zero mean and σ = 0.09) and edge output

IT472 - Digital Image Processing 21


Solution: Smooth First

Where is the
edge?

Look for peaks


in IT472 - Digital Image Processing 22
Derivative Theorem Of Convolution
• This saves us one operation:

IT472 - Digital Image Processing 23


Laplacian of Gaussian (LoG)
• Consider

Where is the Laplacian of Gaussian


operator
edge?

Zero-crossings
of bottom graph
IT472 - Digital Image Processing 24
2D edge detection filters

Laplacian of Gaussian

Gaussian derivative of Gaussian

• is the Laplacian operator:

IT472 - Digital Image Processing 25


Optimal Edge Detection: Canny (1/2)
• Assume:
– Linear filtering
– Additive Gaussian noise
• Edge detector should have:
– Good Detection. Filter responds to edge,
not noise.
– Good Localization: detected edge near
true edge.
– Single Response: one per edge.
IT472 - Digital Image Processing 26
Optimal Edge Detection: Canny (2/2)

• Optimal Detector is approximately


Derivative of Gaussian.
• Detection/Localization trade-off
– More smoothing improves detection
– And hurts localization.
• This is what you might guess from
above
(detect change) + (remove noise)
IT472 - Digital Image Processing 27
Edge Detection Tutorials
• An interesting tutorial on edge detection
is available at
http://www.pages.drexel.edu/~weg22/edge.html
• An interesting tutorial on Canny edge
detector is available at
http://www.pages.drexel.edu/~weg22/can_tut.html

IT472 - Digital Image Processing 28


The Canny Edge Detector (1/4)

• original image (Lena)


IT472 - Digital Image Processing 29
The Canny Edge Detector (2/4)

• norm of the gradient


IT472 - Digital Image Processing 30
The Canny Edge Detector (3/4)

• thresholding
IT472 - Digital Image Processing 31
The Canny Edge Detector (4/4)

• thinning
• (non-maximum suppression)
IT472 - Digital Image Processing 32
Non-maximum Suppression

• Check if pixel is local maximum along


gradient direction
– requires checking interpolated pixels p and r
IT472 - Digital Image Processing 33
Predicting
the next
edge point
Assume the
marked point is an
edge point. Then
we construct the
tangent to the edge
curve (which is
normal to the
gradient at that
point) and use this
to predict the next
points (here either
r or s).

(Forsyth & Ponce)


IT472 - Digital Image Processing 34
Hysteresis
• Check that maximum value of
gradient value is sufficiently large
– drop-outs? use hysteresis
• use a high threshold to start edge
curves and a low threshold to
continue them.

IT472 - Digital Image Processing 35


Effect of  (Gaussian kernel size)

original Canny with Canny with

• The choice of depends on desired behavior


– large detects large scale edges
– small detects fine features
IT472 - Digital Image Processing 36
Scale Source (Forsyth & Ponce)

• Smoothing
• Eliminates noise edges.
• Makes edges smoother.
• Removes fine detail.
IT472 - Digital Image Processing 37
Scale Space (1/5)

IT472 - Digital Image Processing 38


Scale Space (2/5)

fine scale
high
threshold

IT472 - Digital Image Processing 39


Scale Space (3/5)

coarse
scale,
high
threshold

IT472 - Digital Image Processing 40


Scale Space (4/5)

coarse
scale
low
threshold

IT472 - Digital Image Processing 41


Scale Space (5/5)
first derivative peaks

larger

Gaussian filtered signal

• Properties of scale space (with Gaussian smoothing)


– edge position may shift with increasing scale ()
– two edges may merge with increasing scale
– an edge may not split into two with increasing scale
IT472 - Digital Image Processing 42
Gaussian - Image filter

Gaussian delta function

Laplacian of Gaussian
IT472 - Digital Image Processing 43
Any Questions?

IT472 - Digital Image Processing 44


That’s all for now.

We shall continue in the next class.

IT472 - Digital Image Processing 45

You might also like