You are on page 1of 52

EDGE /BOUNDARY

DETECTION
Sobel
Laplacian
Canny
pB

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
Ideal: artists line drawing (but artist
is also using object-level knowledge

Why do we care about edges?


Extract information, recognize objects

Recover geometry and viewpoint

Origin of edges

Edges are caused by a variety of factors

Closeup of edges

Closeup of edges

Closeup of edges

Characterization of edges
An edge is a place of rapid change in the image intensity function

Effects of noise
Consider a single row or column of the image
Plotting intensity as a function of position gives a signal

Effects of noise
Difference filters respond strongly to noise
Image noise results in pixels that look very different from their neighbors
Generally, the larger the noise the stronger the response
What can we do about it?

Effects of noise
Solution: smooth first

Tradeoff between smoothing and


localization

Smoothed derivative removes noise, but blurs edge. Also finds edges at
different scales.

Designing an edge detector


Criteria for a good edge detector:
Good detection:
the optimal detector should find all real edges, ignoring noise or other artifacts

Good localization:
the edges detected must be as close as possible to the true edges
the detector must return one point only for each true edge point
Cues of edge detection
Differences in color, intensity, or texture across the boundary
Continuity and closure
High-level knowledge
Source: L. Fei-Fei

Edge detection
An edge is the boundary between two regions with relatively distinct graylevel properties.
Assumption: The regions in question are sufficiently homogeneous so that
the transition between two regions can be determined on the basis of graylevel discontinuities alone.

The idea underlying most edge-detection techniques is the computation of a


local derivative operator.

Edge detection

Edge detection by derivative operators:


(a) light strips on a dark background; (b)
dark strip on a light background. Note that
the second derivative has a zero crossing
at the location of each edge.

Edge detection
Profile of gray-level at the edge is modelled as a smooth change of gray-level.
First derivative of the gray level profile is positive at the leading edge of a
transition, negative at the edge, and zero in areas of constant gray level.
The second derivative is positive for that part of the transition associated with
the dark side of the edge, and negative for that part of the transition
associated with the light side of the edge.
Hence, the second derivative can be used to determine whether an edge pixel
lies on the dark or light side of an edge.

Gradient Operators
The gradient of an image f(x, y) at location (x,y) is given by :

The gradient vector points in the direction of maximum rate of change.


In edge detection, an important quantity is the magnitude of , which is referred
to simply as gradient, where

Gradient Operators

Gradient is commonly approximated by the absolute values:

Where angle is measured with respect to the x-axis.

Sobel
Derivatives may be implemented in digital form in several ways.
Sobel operators have the advantage of providing both a differencing and a
smoothing effect.
As differencing or dervatives in digital image processing enhance noise, the
smoothing effect of Sobel operators is an attractive features.

Sobel

Sobel
Derivatives based on Sobel masks are

Computation of the gradient at the central location of the mask then uses eqn
(4) & (5) to give one value of the gradient.

The mask in then moved to the next location, and the process is repeated. We
will obtain a gradient image which is of the same size as the original image.
Mask operations on the image border are implemented by using the
appropriate partial neighbours.

Sobel

Laplacian
Laplacian of a 2-D function f(x,y) is

The mask used in this case must have a positive central pixel, and the outer
pixels must be negative. In addition, the sum of the coefficients must be zero.

Laplacian responds to transition in intensity, but is seldom used in practice for edge
detection, because
1. As a second order derivative, it is unacceptably sensitive to noise.
2. It produces double edges (See previous Fig).
3. It is unable to detect edge direction.
Laplacian usually play a secondary role of detector for establishing whether a pixel
is on the dark or light side of an edge.
A more general use of Laplacian is in the finding the location of edges using its
zero crossing property

Laplacian
The concept is based on convolving an image with the Laplacian of a 2-D
Gaussian function of the form.

Laplacian

The average value of the Laplacian operator h^2 is zero, so as the image
obtained by convolving with it.
This operator will blur the image with the degree of blurring being
proportional to . It can be used for noise-reduction, but its usefulness lies in
its zero-crossing.

Laplacian
Fig. 9 shows an example of edge detection with the ^2h operator, with = 4.

Some Remarks on Gradient Operations in Edge Detection


1. They tend to work well in cases involving images with sharp intensity
transitions and relatively low noise.
2. *Zero-crossings offer an alternative in cases when edges are blurry or when a
high noise content is present.

*They offer reliable edge location, and the smoothing properties of ^2h reduce
the effect of noise.
*Computational complex & intensive.

Canny Edge detector


This is probably the most widely used edge detector in computer vision
Theoretical model: step-edges corrupted by additive Gaussian noise

Canny has shown that the first derivative of the Gaussian closely
approximates the operator that optimizes the product of signal-to-noise ratio
and localization

J. Canny, A Computational Approach To Edge Detection, IEEE Trans. Pattern Analysis and
Machine Intelligence, 8:679-714, 1986.

Canny Edge detector

Canny Edge detector

Canny Edge detector

Canny Edge detector

Canny Edge detector

Canny Edge detector

Canny Edge detector

Canny Edge detector


Hysteresis thresholding
Threshold at low/high levels to get weak/strong edge pixels
Do connected components, starting from strong edge pixels

Canny Edge detector

Canny Edge detector


Final Canny Edges

Canny Edge detector


1. Filter image with x, y derivatives of Gaussian
2. Find magnitude and orientation of gradient

3. Non-maximum suppression:
Thin multi-pixel wide ridges down to single pixel width
4. Thresholding and linking (hysteresis):
Define two thresholds: low and high
Use the high threshold to start edge curves and the low threshold to continue
them
MATLAB: edge(image, canny)

Source: D. Lowe, L. Fei-Fei

Effect of (Gaussian kernel spread/size)

The choice of depends on desired behavior


large detects large scale edges
small detects fine features

Where do humans see boundaries?

pB Boundary detector

pB Boundary detector

You might also like