2.4 - EdgeDetecting
2.4 - EdgeDetecting
LE Thanh Sach
Chapter 3.3
Point Detection
Edge Detection Line Detection
Edge Detection
Image Processing and Computer Vision Laplacian of
Gaussian (LoG)
LE Thanh Sach
Faculty of Computer Science and Engineering
Ho Chi Minh University of Technology, VNU-HCM
3.3.1
Edge Detection
Overview
LE Thanh Sach
1 Point Detection
Point Detection
Line Detection
2 Line Detection Edge Detection
Laplacian of
Gaussian (LoG)
3 Edge Detection
3.3.2
Edge Detection
Point Detection
LE Thanh Sach
Laplacian of
Laplacian kernel Hlap : Gaussian (LoG)
−1 −1 −1
Hlap = −1 8 −1
−1 −1 −1
3.3.3
Edge Detection
Line Detection
LE Thanh Sach
Definition
Edge is a set of connected pixels that lie on the boundary Point Detection
Edge Detection
Laplacian of
Properties Gaussian (LoG)
3.3.5
Edge Detection
Edge Detection
LE Thanh Sach
Examples of Derivatives: image, a line profile, first and
second-order derivatives.
Point Detection
Line Detection
Edge Detection
Laplacian of
Gaussian (LoG)
3.3.6
Edge Detection
Edge Detection
LE Thanh Sach
Model of edges:
Point Detection
Line Detection
Edge Detection
Laplacian of
Gaussian (LoG)
3.3.7
Edge Detection
Edge Detection
LE Thanh Sach
Point Detection
Line Detection
Edge Detection
Laplacian of
Gaussian (LoG)
Point Detection
Line Detection
Edge Detection
Laplacian of
Gaussian (LoG)
Point Detection
Line Detection
Edge Detection
Laplacian of
Gaussian (LoG)
Point Detection
Line Detection
Edge Detection
Laplacian of
Gaussian (LoG)
Properties
Point Detection
Line Detection
• Second-order derivative is more sensitive to noise Edge Detection
compared with first-order derivative. Laplacian of
Gaussian (LoG)
• However,
• First-order derivatives provide thick edges
• Second-order derivatives provide thin edges (via,
zero-crossing)
3.3.12
Edge Detection
Edge Detection and Laplacian
LE Thanh Sach
Question
Laplacian can provide the discontinuity in gray-levels. Why
is it not used in edge detection?
Point Detection
Line Detection
Reasons
Edge Detection
3.3.13
Edge Detection
Edge Detection and Laplacian
LE Thanh Sach
Line Detection
Laplacian in edge detection
Edge Detection
Laplacian of
1 Perform noise removal will a Gaussian low-pass filter. Gaussian (LoG)
The input image will be blurred.
2 Apply Laplacian to the resulting image.
3 Detect zero-crossing points to obtain edge points.
Line Detection
2 +y 2
−x Edge Detection
G(x, y) = e 2σ 2
Laplacian of
Gaussian (LoG)
3.3.15
Edge Detection
Laplacian of Gaussian (LoG)
LE Thanh Sach
Line Detection
r2 Edge Detection
x2 y2 2σ 2
+ − −
∇2 G(r) = e 2σ 2 Laplacian of
σ4 Gaussian (LoG)
3.3.16
Edge Detection
Laplacian of Gaussian (LoG)
LE Thanh Sach
Point Detection
Line Detection
Edge Detection
Laplacian of
Gaussian (LoG)
3.3.17
Edge Detection
Laplacian of Gaussian (LoG)
LE Thanh Sach
Properties
Laplacian of
4 Kernel of LoG given above: just an example. It can be Gaussian (LoG)
3.3.18
Edge Detection
Laplacian of Gaussian (LoG)
LE Thanh Sach
Line Detection
Edge Detection
2
Laplacian of
g(x, y) = ∇ G(x, y) ∗ f (x, y) Gaussian (LoG)
3.3.19
Edge Detection
Marr-Hildreth Algorithm
LE Thanh Sach
Marr-Hildreth Algorithm
1 Filter the input image f (x, y) with Gaussian low-pass Point Detection
filter by kernel size n × n to obtain the output g(x, y). Line Detection
Edge Detection
2 Compute Laplacian of g(x, y) to obtain gL (x, y)
Laplacian of
3 Find zero-crossing points in gL (x, y) Gaussian (LoG)
LoG
Step 1 and 2 can be implemented as applying LoG on the
input image.
3.3.20
Edge Detection
Marr-Hildreth Algorithm
LE Thanh Sach
Laplacian of
2 Edges are sensitive to noise, especially true for Gaussian (LoG)
second-order derivative ⇒ use Gaussian low-pass filter
Questions
3.3.21
Edge Detection
Marr-Hildreth Algorithm
LE Thanh Sach
Point Detection
How can you obtain the kernel’s size?
Line Detection
Edge Detection
• Volume of a Gaussian function inside of circle
Laplacian of
radius = 3σ is 99.7% Gaussian (LoG)
3.3.22
Edge Detection
Marr-Hildreth Algorithm
LE Thanh Sach
gl (x, y) = 1 if (gl (x, y) > 0) and |gl (x, y)| > T Line Detection
Edge Detection
0 ortherwise
Laplacian of
Gaussian (LoG)
2 Apply a mask 3 × 3 at each pixel on gl (x, y).
NW N NE
W C E
SW S SE
3 Detect the difference on the sign at opposing corners,
i.e., (W, E), (N, S), (NW, SE), and (SW, NE).
4 If any pair of corners results a difference on the sign,
then gl (x, y) is an edge point.
3.3.23
Edge Detection
Laplacian of Gaussian (LoG): Illustration
LE Thanh Sach
Point Detection
Line Detection
Edge Detection
Laplacian of
Gaussian (LoG)
Point Detection
Line Detection
Edge Detection
Laplacian of
Gaussian (LoG)
Point Detection
Line Detection
Edge Detection
Laplacian of
Gaussian (LoG)
(a) (b)
Figure: Marr-Hildreth Algorithm: (a): Result of Step 1 and 2,
(b): Zero-crossing of (a), Threshold = 0
Point Detection
Line Detection
Edge Detection
Laplacian of
Gaussian (LoG)
(a) (b)
Figure: Marr-Hildreth Algorithm: (a): Result of Step 1 and 2, (b):
Zero-crossing of (a), Threshold = 4% of maximum value in (a)
1 Smooth the input image with Gaussian low-pass filter Line Detection
Laplacian of
3 Apply nonmaxima suppression to the gradient Gaussian (LoG)
magnitude image.
4 Use double thresholding and connectivity analysis to
detect and link edges
3.3.28
Edge Detection
Canny Edge Detection
LE Thanh Sach
Laplacian of
3 Apply nonmaxima suppression to the gradient Gaussian (LoG)
magnitude image.
4 Use double thresholding to obtain strong and weak edge
masks
5 Analyze the connectivity to detect and link edges
3.3.29
Edge Detection
Canny Edge Detection
LE Thanh Sach
Line Detection
2 2 Edge Detection
− x +y
G(x, y) = e 2σ 2
Laplacian of
Gaussian (LoG)
fs (x, y) = f (x, y) ∗ G(x, y)
3.3.30
Edge Detection
Canny Edge Detection
LE Thanh Sach
Line Detection
gy (x, y) = fs (x, y) ∗ Hy (x, y) Edge Detection
Laplacian of
Gaussian (LoG)
• Hx (x, y), Hy (x, y): any first-order derivative kernels,
e.g., ”standard” approximations kernels, Sobel, Roberts,
Prewitts, etc.
• Compute gradient magnitude and angle images
gx (x, y)
M (x, y) =
gy (x, y)
−1 gy (x, y)
α(x, y) = tan
gx (x, y)
3.3.31
Edge Detection
Canny Edge Detection
LE Thanh Sach
Edge Detection
if a point is not a local maxima, then supress (remove, stop,
Laplacian of
etc) it. Gaussian (LoG)
3.3.32
Edge Detection
Canny Edge Detection
LE Thanh Sach
Edge Detection
3.3.33
Edge Detection
Canny Edge Detection
LE Thanh Sach
Edge Detection
2 Find direction dk that is closest to α(x, y)
Laplacian of
3 Find local neighbors on edge using dk , referred to as N1 Gaussian (LoG)
and N2
4 Compute nonmaxima suppressed image gN (x, y)
(
0 if [M (x, y) < N1 ] & [M (x, y) < N2 ]
gN (x, y) =
M (x, y) otherwise
3.3.34
Edge Detection
Canny Edge Detection
LE Thanh Sach
Step 3: Apply nonmaxima suppression to the gradient
magnitude image.
Point Detection
Line Detection
Edge Detection
Laplacian of
Gaussian (LoG)
Edge Detection
gN H (x, y) = gN (x, y) ≥ TH
Laplacian of
gN L (x, y) = gN (x, y) ≥ TL Gaussian (LoG)
3.3.36
Edge Detection
Canny Edge Detection
LE Thanh Sach
3.3.37
Edge Detection
Canny Edge Detection: Illustration
LE Thanh Sach
Point Detection
Line Detection
Edge Detection
Laplacian of
Gaussian (LoG)
(a) (b)
Figure: Edge detection (a): Original image, (b): Thresholded
gradient magnitude image - thick edge
3.3.38
Edge Detection
Canny Edge Detection: Illustration
LE Thanh Sach
Point Detection
Line Detection
Edge Detection
Laplacian of
Gaussian (LoG)
(a) (b)
Figure: Edge detection (a): Marr-Hildreth Method, (b): Canny
method - better
3.3.39