Digital Image Processing & Computer Vision: Edge Detection
Digital Image Processing & Computer Vision: Edge Detection
Computer Vision
Edge Detection
Agenda
Purpose of Edge detection
Noise
Derivative Operators
Edge Models
Color Edges
2
3
Stanford University Lecture 5
4 10-Oct-17
-
(A) Cave painting at Chauvet, France, about 30,000 B.C.;
(B) Aerial photograph of the picture of a monkey as part of the Nazca Lines geoglyphs, Peru, about 700 – 200 B.C.;
(C) Shen Zhou (1427-1509 A.D.): Poet on a mountain top, ink on paper, China;
(D) Line drawing by 7-year old I. Lleras (2010 A.D.).
An edge in an image is a significant local change in the image intensity, usually associated with a discontinuity
in either the image intensity or the first derivative of the image intensity
8
An edge point is a point in an image with coordinates [i, j] at the location of a significant local intensity change
in the image.
An edge fragment corresponds to the i and j coordinates of an edge and the edge orientation θ , which may be
An edge detector is an algorithm that produces a set of edges (edge points or edge fragments) from an image
9
Some more definitions
• A contour is a list of edges or the mathematical curve that models the list
of edges
11
Algorithms
Analysis
Conditions
What is an edge
12
13
Issues / Complications
• Digitization
• Noise
• Reasons for Noise
• light intensity
• type of camera and lens
• Motion
• Temperature
• Atmospheric effects
• Dust
14
15
Models of Edges
16
Background
17
Contd…
(1)
When Δx = -1
• We compute intensity differences using just a few terms of the Taylor series.
• For first-order derivatives we use only the linear terms, and we can form differences in one of three
ways
Backward difference
•• Based
on a central difference, , the 2nd order derivative is obtained by
adding (1) & (2)
• For 2 variables,
20
First derivatives produce “Thick” edges
2nd derivative produces much thinner edges
21
Approach for Computing first & second derivatives
zk is the intensity of the pixel whose spatial location corresponds to the location
of the k-th kernel coefficient
22
Detection of Isolated Points
Implemented
using mask
• A point is said to be detected at a location (x, y) on which the kernel is centred if the absolute value of
the response of the filter at that point exceeds a specified threshold.
24
25
• Laplacian operator highlights sharp intensity transitions in an image and de-emphazises regions of
slowly varying intensities.
where f (x, y) and g(x, y) are the input and sharpened images, respectively.
1. c = −1 if the Laplacian kernels in (a) or (b) is used,
2. c = 1 if either of the other two kernels is used.
26
Line Detection
27
Edge Models Step Edge
Edge Models classified according to intensity profiles.
• A step edge is characterized by a transition between two intensity levels occurring ideally over the
distance of one pixel.
• They occur in computer generated images (solid modeling and animation).
• 1 pixel wide, no additional processing (Smoothing) needed to make them look real.
• Canny edge detection was devised originally using a step-edge model
28
Edge Models contd.. Ramp edges
29
Edge Models contd.. Roof Edge
• Lines through a region with the base(width) of th edge being determined by the thickness and sharpness
of the line.
30
• First derivative is positive at the beginning of the ramp, negative at the end of the ramp, zero at points on the ramp and zero
at points of constant intensity.
• The second derivative is positive at the beginning of the ramp, negative at the end of the ramp, zero at points on the ramp
and zero at points of constant intensity.
• Signs of the derivatives would be reversed for an edge that transitions from light to dark.
• Intersection between the zero intensity axis and a line extending between the extrema of the second derivative marks a
point called the zero crossing of the second derivative.
31
Steps for Edge detection
32
Edge Detection
The tool of choice for finding edge strength and direction at an arbitrary location (x, y) of an image, f, is the
gradient, denoted by f and defined as the vector
When evaluated for all applicable values of x and y, f (x, y) becomes a vector image, each element of which is a
vector.
The magnitude, M(x, y), of this gradient vector at a point (x, y) is given by its Euclidean vector norm:
33
Edge Detection
Value of the rate of change in the direction of the gradient vector at point (x, y). Note that M(x, y), f (x, y) , g x y
x( , ), and g x y y( , ) are arrays of the same size as f, created when x and y are allowed to vary over all pixel locations
in f. It is common practice to refer to M(x, y) and f (x, y) as the gradient image, or simply as the gradient when the
meaning is clear
Angles are measured in the counterclockwise direction with respect to the x-axis
34
• Filter kernels used to compute the derivatives needed for the gradient are often called gradient operators,
difference operators, edge operators or edge detectors
35
Roberts cross-gradient operators
• Disadvantage:
• Eventhough simple, not useful 36
• 3x3 kernelss carry more information regarding the direction of the edge
Prewitt operators
37
Sobel Operator
38
• Any pairs of the kernels are convolved with an image to obtain the gradient components g x and gy at
every pixel location.
• These two partial derivative arrays are then used to estimate edge strength and direction.
• Obtaining the magnitude of the gradient requires the computations.
39
40
41
Edge detection
• Goal: Identify sudden
changes (discontinuities) in
an image
– Intuitively, most semantic and
shape information from the
image can be encoded in the
edges
– More compact than pixels
viewpoint line
Vanishing Vanishing
point point
Source: J. Hayes
color discontinuity
illumination discontinuity
Source: D. Hoiem
Source: D. Hoiem
Stanford University
10-Oct-17 Lecture 5 -
Closeup of edges
Depth discontinuity
Source: D. Hoiem
Stanford University
10-Oct-17 Lecture 5 -
Closeup of edges
Source: D. Hoiem
Stanford University
10-Oct-17 Lecture 5 -
Convolution
48
Slide credit: Ulas Bagci
11
2D convolution
example
50 6-Oct-16
2D convolution
example
51 6-Oct-16
2D convolution
example
52 6-Oct-16
2D convolution
example
53 6-Oct-16
2D convolution
example
54 6-Oct-16
2D convolution
example
55 6-Oct-16
2D convolution
example
56 6-Oct-16