0% found this document useful (0 votes)
2 views37 pages

Lecture 11

The document discusses edge detection and segmentation in image processing, detailing various methods such as Sobel, Canny, Prewitt, and Laplacian operators. It explains the significance of edges as boundaries in images and the techniques used to detect them, including noise reduction and gradient calculation. The performance of different edge detection methods is also evaluated, highlighting the effectiveness of Sobel and Prewitt methods compared to Roberts and Laplacian methods.

Uploaded by

farwaniaziit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views37 pages

Lecture 11

The document discusses edge detection and segmentation in image processing, detailing various methods such as Sobel, Canny, Prewitt, and Laplacian operators. It explains the significance of edges as boundaries in images and the techniques used to detect them, including noise reduction and gradient calculation. The performance of different edge detection methods is also evaluated, highlighting the effectiveness of Sobel and Prewitt methods compared to Roberts and Laplacian methods.

Uploaded by

farwaniaziit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 37

Edge Detection &

Segmentation

Articles  Sobel, Canny, and Prewitt edge detection


 Thresholding
Levels of reasoning in vision
Scenes

Objects

Lines

Edges

Pixels

Images
[Slide by Neeraj Kumar]
Edge Detection

• What are edges in an image?


• Edge Detection
• Edge Detection Methods
• Edge Operators
• Matlab Program
• Performance
Edge detection

 Convert a 2D image into a set of curves


• Extracts salient features of the scene
• More compact than pixels
What are edges in an image?

 Edges are those places


in an image that
correspond to object
boundaries.
 Edges are pixels
where image
brightness changes
abruptly. Brightness vs. Spatial Coordinates
More About Edges

 An edge is a property attached to an


individual pixel and is calculated from the
image function behavior in a neighborhood
of the pixel.
 It is a vector variable (magnitude of the
gradient, direction of an edge) .
Image To Edge Map
Edge Detection

 Edge information in an image is found by looking


at the relationship a pixel has with its
neighborhoods.
 If a pixel’s gray-level value is similar to those
around it, there is probably not an edge at that
point.
 If a pixel’s has neighbors with widely varying gray
levels, it may present an edge point.
Edge Detection Methods

 Many are implemented with convolution


mask and based on discrete approximations
to differential operators.
 Differential operations measure the rate of
change in the image brightness function.
 Some operators return orientation
information. Other only return information
about the existence of an edge at each point.
Roberts Operator

 Mark edge point only


 No information about edge orientation
 Work best with binary images
 Primary disadvantage:
 High sensitivity to noise
 Few pixels are used to approximate the gradient
Roberts Operator (Cont.)

 First form of Roberts Operator


I ( r , c )  I (r  1, c  1)  I (r , c  1)  I (r  1, c)
2 2

 Second form of Roberts Operator


| I (r , c)  I (r  1, c  1) |  | I (r , c  1)  I (r  1, c) |
1 0   0 1
h1   h2  
 0  1   1 0 
Sobel Operator

 Looks for edges in both horizontal and vertical


directions, then combine the information into a
single metric.
 The masks are as follows:
  1  2  1   1 0 1
y  0 0 0  x   2 0 2
 1 2 1    1 0 1 

Edge Magnitude = x 2  y 2 Edge Direction = tan  1  y 


 x
Prewitt Operator

 Similar to the Sobel, with different mask


coefficients:
  1  1  1   1 0 1
y  0 0 0  x   1 0 1
 1 1 1    1 0 1

Edge Magnitude = x 2  y 2 Edge Direction = tan  1  y 


 x
Laplacian Operators

 Edge magnitude is approximated in digital


images by a convolution sum.
 The sign of the result (+ or -) from two
adjacent pixels provide edge orientation and
tells us which side of edge brighter
Laplacian Operators (Cont.)

 Masks for 4 and 8 neighborhoods


 0 1 0   1  1  1
  1 4  1   1 8  1
   
 0  1 0    1  1  1
 Mask with stressed significance of the
central pixel or its neighborhood
 1 2 1   2 1  2
  2 4  2  1 4 1
   
 1  2 1    2 1  2
The Canny edge detector

 original image (Lena)


The Canny edge detector

norm of the gradient


The Canny edge detector

thresholding
The Canny edge detector

thinning
(non-maximum suppression)
Performance

 Sobel and Prewitt methods are very


effectively providing good edge maps.

 Roberts and Laplacian methods are not very


good as expected.
Edge Detection

Edge detection is a technique of image processing used


to identify points in a digital image with
• discontinuities, simply to say, sharp changes in the image
brightness.
These points where the image brightness varies sharply
• are called the edges (or boundaries) of the image.
It is one of the basic steps in image processing, pattern
recognition in images and computer vision. When we
process very high-resolution digital images, convolution
techniques come to our rescue.
Edge Detection
• Edge detection is mostly used for the
measurement, detection and location changes in an
image gray. Edges are the basic feature of an image.
In an object, the clearest part is the edges and lines.
• With the help of edges and lines, an object
structure is known. That is why extracting the
edges is a very important technique in graphics
• processing and feature extraction.
The basic idea behind edge detection is as follows:
– To highlight local edge operator use edge
enhancement operator.
– Define the edge strength and set the edge
points.
Edge Detection
Sobel Edge Detection

The Sobel edge detection operator extracts all the edges
of an image, without worrying about the directions.

The main advantage of the Sobel operator is that it
provides differencing and smoothing effect.

Sobel edge detection operator is implemented as the
sum of two directional edges.

And the resulting image is a unidirectional outline in
the original image.
Sobel Edge Detection
Sobel Edge Detection

Sobel Edge detection operator consists of 3x3
convolution kernels. Gx is a simple kernel and Gy is

rotated by 90°
These Kernels are applied separately to input image
because separate measurements can be produced in
each orientation i.e Gx and Gy.
Sobel Edge Detection
• Following is the gradient
magnitude:

• As it is much faster to compute An


approximate magnitude is computed:
Robert’s Edge Detection

Robert's cross operator is used to perform 2-D spatial
gradient measurement on an image which is simple and

quick to compute.
In Robert's cross operator, at each point pixel values
represents the absolute magnitude of the input image

at that point.
Robert's cross operator consists of 2x2 convolution
kernels. Gx is a simple kernel and Gy is rotated by 90o
Robert’s Edge Detection
Robert’s Edge Detection
• Following is the gradient
magnitude:

• As it is much faster to compute An


approximate magnitude is computed:
Canny Edge Detection
• The Canny edge detection algorithm is a
multi- stage algorithm that is used to
detect edges in images.
• It was developed by John F. Canny in
1986. The algorithm consists of the
following steps:
Canny Edge Detection
• Convert the image to grayscale
• Reduce noise – as the edge detection that using
derivatives is sensitive to noise, we reduce it.
• Calculate the gradient – helps identify the edge
intensity and direction.
• Non-maximum suppression – to thin the edges of
• the image.
Double threshold – to identify the
• strong, weak and irrelevant pixels in the
images.
Hysteresis edge tracking – helps convert the
weak pixels into strong ones only if they have a
strong pixel around them.
Laplacian Edge Detection
• The Laplacian edge detection
algorithm is a simple and effi cient
method for detecting edges in
images.
• It works by calculating the Laplacian
of the image, which is a measure of
the second derivative of the image.
• The Laplacian of an image is zero at all
points where the image is smooth, but
it will be positive at points where the
image has a sharp change in intensity,
such as at edges.
Positive Laplacian Operator
• In Positive Laplacian we have standard
mask in which center element of the
mask should be negative and corner
elements of mask should be zero.

• Positive Laplacian Operator is use to


take out outward edges in an image.
Negative Laplacian Operator
• In negative Laplacian operator we also have a
standard mask, in which center element should
• be positive.
All the elements in the corner should be zero
and rest of all the elements in the mask should
be -1.

• Negative Laplacian operator is use to take out


inward edges in an image
Laplacian Edge Detection

The Laplacian edge detection algorithm can be


• implemented using a 3x3 kernel, which is a small
square matrix that is used to convolve the image.
The kernel is typically centered at a pixel that is being
considered for edge detection, and the values in the kernel
are used to calculate the Laplacian of the image at that pixel.

If the Laplacian of the image at a pixel is positive, then
that pixel is considered to be an edge pixel.

The Laplacian edge detection algorithm can be used to
detect edges in both grayscale and color images.
Home Work
Image gradients ; first order derivative and second
order derivative

You might also like