Lecture 11
Lecture 11
Lecture 11
Basis of Edges
Discontinuity
in surface
orientation
Edge detection__ Reduced Set
Recall images as functions...
Problems:
81 82 26 24
• neighborhood size 82 33 25 25
81 82 26 24
• how to detect change
Derivatives and edges
An edge is a place of rapid change in the image
intensity function.
intensity function
image
Source: S. Lazebnik
Derivatives and edges
An edge is a place of rapid change in the image
intensity function. finding edges …. finding peaks in the derivative.
image intensity function first derivative
(along horizontal scanline)
edges correspond to
Source: S. Lazebnik
extrema of derivative
Differential Operators
• Differential operators -when applied to the image
returns some derivatives.
• Model these "operators" as masks/kernels that
compute the image gradient function.
• Threshold this gradient function to select the
edge pixels.
What's a gradient?
Gradient is the vector that's made up of derivatives.
Multivariate Functions
Image gradient
The gradient of an image:
“right derivative”
Finite differences finite difference Img/gradient img
Source: D. Forsyth
Partial derivatives of an image
(correlation filters)
Partial derivatives of an image
(correlation filters)
Partial derivatives of an image
(correlation filters)
The discrete gradient
• We want an "operator" (mask/kernel) that we
can apply to the image that implements:
filt = fspecial('sobel')
filt =
1 2 1
0 0 0
-1 -2 -1
outim = imfilter(double(im),filt);
imagesc(outim);
colormap gray;
But in the real world...
Consider a single row or column of the image
(plotting intensity as a function of x)
where's
the edge?
Finite differences responding to noise
Increasing noise
(this is zero mean additive Gaussian noise)
Source: D. Forsyth
Solution: smooth first
Solution: smooth first
Solution: smooth first
Solution: smooth first
Solution: smooth first
Where is the
edge?
We don't have to find general maxima, we just have to find any place where the
value is zero and that nearby has a strong gradient.
Gradient Direction
Computation and Representation
Here is an image that has clearly defined edges and
distinct angles.
// This function returns a pair of matrices, the first one being the gradient in x
Direction and the second one in the y direction.
we should scale them to the appropriate range to normalize the gradient images.
This is what the gradient magnitude looks like.
As the gradient direction is an angle computed as the tan inverse of y by x gradient
values. The result is returned in degrees ranging from minus -180 to +180. Where 0
degree corresponds with the positive x-axis, and increasing angle rotates
counterclockwise. The right edge has gradient pointing at 0 degrees.