Vous êtes sur la page 1sur 32

CSC 553: Computer

Vision

Lec 04:Edge Detection


Edges:
 Detecting edges is a basic operation in image
processing.
 The edges of items in an image hold much of the
information in the image.
 The edges tell you where items are, their size, shape,
and something about their texture.
 An edge is where the gray level of the image moves
from an area of low values to high values or vice
versa.
 The edge itself is at the center of this transition.
How to detect edges?
 The problem in edge detection is how to calculate the
derivative (the slope) of an image in all directions?
 Convolution of the image with masks is the most
often used technique of doing this.
 The idea is to take a n x n array of numbers and
multiply it point by point with a n x n section of the
image.
 You sum the products and place the result in the
center point of the image.
 The question in this operation is how to choose the n
x n mask.
Examples of Masks:
Results:
Homogeneity Operator:
 The homogeneity operator uses subtraction to find an
edge. The operator subtracts each of the pixels next
to the center of a 3x3 area from the center pixel.
 The result is the maximum of the absolute value of
these subtractions.
 Subtraction in a homogeneous region (one that is a
solid gray level) produces zero and indicates an
absence of edges.
 A region containing sharp edges, has a large
maximum.
Example of Homogeneity Operator:
Difference Operator:
 The next edge detector is the difference operator,
another simple operator that uses subtraction.
 Recall that edge detection is often called image
differentiation (detecting the slope of the gray levels in
the image).
 The difference operator perform differentiation by
calculating the differences between the pixels that
surround the center of a 3x3 area.
 The difference operator finds the absolute value of the
differences between opposite pixels, the upper left minus
lower right, upper right minus lower left, left minus right,
and top minus bottom.
Example of Difference Operator:
Difference of Gaussians:
 The next operator to examine is the
difference of Gaussians edge detector, which
allows varying the width of a convolution
mask and adjusting the detail in the output.
 Varying the width of convolution masks
eliminates details. If a mask is wide,
convolving an image will smooth out details,
much like averaging.
 These masks are \difference of Gaussians" or
\Mexican hat" functions.
 The center of the masks is a positive peak (16 in the
7x7 masks|19 in the 9x9 mask).
 The masks slope downward to a small negative peak
(-3 in both masks) and back up to zero.
 The curve in the 9x9 mask is wider than that in the
3x3 mask. Notice how the 9x9 mask hits its negative
peak three pixels away from the center while the 7x7
masks hits its peak two pixels away from the center.
Also, notice these masks use integer values.
 Most edge detectors of this type use floating point
numbers that peak at +1. Using integers greatly
increases the speed.
 Figure 6.7 illustrates how the narrower mask will
detect small edges the wide mask misses. Each area
in Figure 6.7 has a small pattern similar to the brick
and mortar pattern in the house image.
 This pattern has small objects (bricks) with many
edges. Convolving the 7x7 mask in Figure 6.6 with
the 7x7 area in Figure 6.7, results in a +40; the 7x7
mask detected an edge at the center of the 7x7 area.
 Doing the same with the 9x9 mask in Figure 6.6 with
the 9x9 area in Figure 6.7, produces a -20; the 9x9
mask did not detect any edges. The \hat" in the 9x9
mask was wide enough to smooth out the edges and
not detect them.
Contrast-based Edge Detector:
 One problem with detecting edges involves uneven
lighting in images. The contrast-based edge detector
helps take care of this problem. In well lit areas of an
image the edges have large differences in gray levels.
 If the same edge occurs in a poorly lit area of the image,
the difference in gray levels is much smaller. Most edge
detectors result in a strong edge in the well lit area and a
weak edge in the poorly lit area.
 The contrast-based edge detector takes the result of any
edge detector and divides it by the average value of the
area. This division removes the effect of uneven lighting
in the image.
 The average value of an area is available by convolving
the area with a mask containing all ones and dividing by
the size of the area.
Edge Enhancement:
 A good application of edge detectors is to
enhance edges and improve the appearance
of an original image.
 Detect the edges in an image and overlay
these edges on top of the original image to
accent its edges.
Variance and Range:
 The chapter ends with two edge detectors similar to
the difference edge detector in that they look at the
image numbers inside a small area.
 The variance operator, examines a 3x3 area and
replaces the center pixel with the variance.
 The variance operator subtracts the pixel next to the
center pixel, squares that difference, adds up the
squares of the differences from the eight neighbors,
and takes the square root.
 The other edge detector, the range operator, sorts
the pixels in an nxn area and subtracts the smallest
pixel value from the largest to produce the range.

Vous aimerez peut-être aussi