Download EDGE DETECTION

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Hold-And-Modify wikipedia , lookup

Dither wikipedia , lookup

Indexed color wikipedia , lookup

Ringing artifacts wikipedia , lookup

Anaglyph 3D wikipedia , lookup

Stereoscopy wikipedia , lookup

Stereo display wikipedia , lookup

Image editing wikipedia , lookup

Histogram of oriented gradients wikipedia , lookup

Spatial anti-aliasing wikipedia , lookup

Scale space wikipedia , lookup

Edge detection wikipedia , lookup

Transcript
EDGE DETECTION
1
Edge Template Gradient Generation
• Edge gradients are computed in two orthogonal
directions,
– usually along rows and columns,
– the edge direction is inferred by computing the
vector sum of the gradients.
• Another approach is to compute gradients in a
large number of directions by convolution of an
image with a set of template gradient impulse
2
response arrays.
Edge Template Gradient Generation
• The edge template gradient is defined as:
3
4
Kirsch
5
Robinson
6
Robinson
7
8
Nevatia and Babu edge detection
technique
9
Nevatia and Babu edge detection
technique
10
Nevatia and Babu edge detection
technique
11
12
Truncated Pyramid Operator
• Gives a linearly decreasing weighting to
pixels away from the center of an edge.
• The row gradient impulse response array for
a 7x7 truncated pyramid operator is given by:
13
Canny Edge Detector
• (1) The image is smoothed by Gaussian convolution.
• (2) A simple 2-D first derivative operator (Roberts Cross) is
applied to highlight regions of the image with high first spatial
derivatives.
(Edges give rise to ridges in the gradient magnitude image.)
• (3) Tracks along the top of these ridges and sets to zero all
pixels that are not actually on the ridge top so as to give a thin
line in the output, a process known as non-maximal
14
suppression.
15
Canny Edge Detector
• Tracking process exhibits hysteresis controlled by two
thresholds: T1 and T2, with T1 > T2.
• Tracking can only begin at a point on a ridge higher than T1.
• Tracking then continues in both directions out from that point
until the height of the ridge falls below T2.
• This hysteresis helps to ensure that noisy edges are not broken
up into multiple edge fragments.
16
The Effect of the Canny Operator
• Determined by following parameters:
– the width of the Gaussian kernel used in the smoothing
phase, and
– the upper and lower thresholds used by the tracker.
• Increasing the width reduces the detector's sensitivity
to noise, at the expense of losing some of the finer
detail in the image.
• The localization error in the detected edges also
17
increases slightly as the Gaussian width is increased.
Tracking Threshold
• For good results, the tracking threshold can be set:
– The upper  quite high
– The lower  quite low
• Too high lower threshold will cause noisy edges to
break up. (Why?)
• Too low upper threshold increases the number of
spurious and undesirable edge fragments appearing
in the output. (Why?)
18
Using a Gaussian kernel with standard deviation 1.0
and upper and lower thresholds of 255 and 1
Most of the major edges are detected and
lots of details have been picked out well
19
The same kernel size and upper threshold,
but with the lower threshold increased to 220
The edges have become more broken up than in the previous image,
which is likely to be bad for subsequent processing. Also, the vertical
edges on the wall have not been detected, along their full length.
255 and 220
255 and 1
20
Obtained by lowering the upper threshold to 128. The lower
threshold is kept at 1 and the Gaussian standard deviation
remains at 1.0.
Many more faint edges are detected along with some short `noisy'
fragments. Notice that the detail in the clown's hair is now picked out.
21
upper threshold to 128
255 and 220
255 and 1
22
Obtained with the same thresholds as the previous image,
but the Gaussian used has a standard deviation of 2.0.
Much of the detail on the wall is no longer detected,
but most of the strong edges remain.
The edges also tend to be smoother and less noisy
23
Edges in Artificial Scenes
•Often sharper and less complex than those in natural scenes.
•This generally improves the performance of any edge detector.
24
How to control the details contained in the resulting
edge image
The result of applying the Canny edge detector using a standard
deviation of 1.0 and an upper and lower threshold of 255 and 1
This image contains many details.
25
We might be interested to obtain only lines that
correspond to the boundaries of the objects
Increasing the standard deviation for the Gaussian smoothing to 1.8
Some edges corresponding to changes
in the surface orientation remain. 26
Scaling down the image before the edge
detection, we can use the upper threshold
of the edge tracker to remove the weaker
edges.
The result of:
1. scaling the image with 0.25
2. applying the Canny operator
(a standard deviation of 1.8)
(upper threshold of 200)
(lower threshold of 1 )
27
What effect does increasing the Gaussian kernel size have on the magnitudes of
the gradient maxima at edges? What change does this imply has to be made to
the tracker thresholds when the kernel size is increased?
It is sometimes easier to evaluate edge detector performance after thresholding
the edge detector output at some low gray scale value (e.g. 1) so that all detected
edges are marked by bright white pixels. Try this out on the third and fourth
example images of the clown. Comment on the differences between the two
images.
How does the Canny operator compare with the Roberts Cross and Sobel edge
detectors in terms of speed? What do you think is the slowest stage of the
process?
How does the Canny operator compare in terms of noise rejection and edge
detection with other operators such as the Roberts Cross and Sobel operators?
How does the Canny operator compare with other edge detectors on simple
artificial 2-D scenes? And on more complicated natural scenes?
Under what situations might you choose to use the Canny operator rather than the
Roberts Cross or Sobel operators? In what situations would you definitely not 28
choose it?
Laplacian/Laplacian of Gaussian
• The Laplacian is a 2-D isotropic measure of the 2nd
spatial derivative of an image.
• The Laplacian of an image highlights regions of rapid
intensity change and is therefore often used for edge
detection.
• The Laplacian is often applied to an image that has
first been smoothed with something approximating a
Gaussian smoothing filter in order to reduce its
sensitivity to noise.
29
How Laplacian/Laplacian of Gaussian Works
The Laplacian L(x,y) of an image with pixel intensity values I(x,y) is
given by:
Image is represented as a set of discrete pixels,
we have to find a discrete convolution kernel that
can approximate the second derivatives in the
definition of the Laplacian.
Three commonly used small kernels are shown below:
30
Noise and Laplacian
• Because kernels are approximating a second derivative
measurement on the image, they are very sensitive to noise.
• To counter this, the image is often Gaussian smoothed before
applying the Laplacian filter.
• This pre-processing step reduces the high frequency noise
components prior to the differentiation step.
• The convolution operation is associative, we can convolve the
Gaussian smoothing filter with the Laplacian filter, and then
convolve this hybrid filter
LoG (`Laplacian of Gaussian')
31
2-D LoG Function
The 2-D LoG function centered on zero and with
Gaussian standard deviation has the form:
32
Discrete 2-D LoG Function
A discrete kernel that approximates this function (for a Gaussian = 1.4) is
shown below.
A discrete domain version of the LOG operator can be obtained by sampling the
continuous domain impulse response function of Eq. over a window. To avoid
deleterious truncation effects, the size of the array should be set such that
W = 3c, or greater, where is the width of the positive center lobe of the
LOG function
33
The response of the LoG to a step edge
34
The result of applying a LoG filter with Gaussian
A 7×7 kernel
= 1.0.
for display purposes the image has been normalized to the range 0 - 25535
If a portion of the filtered, or gradient, image is added to the
original image, then the result will be to make any edges in
the original image much sharper and give them more contrast.
This is commonly used as an enhancement technique in remote sensing applications.
36
Zero Crossing Detector
• Looks for places in the Laplacian of an image where
the value of the Laplacian passes through zero.
(i.e. points where the Laplacian changes sign)
• Such points often occur at `edges' in images.
• They also occur at places that are not as easy to
associate with edges.
• Zero crossing detector as some sort of
– feature detector rather than
– as a specific edge detector.
37
Zero Crossing Detector
• The starting point is
– an image filtered (Laplacian of Gaussian).
• The results are strongly influenced by the
size of the Gaussian
• Increasing the smoothing
•  fewer and fewer zero crossing contours,
38
LoG filter with Gaussian
standard deviation 1.0
The zero crossings
39
LoG filter with Gaussian
standard deviation 2.0
The zero crossings
There are far fewer detected crossings, and that those that
remain are largely due to recognizable edges in the image
40
LoG filter with Gaussian
standard deviation 3.0
The zero crossings
Only the strongest contours remain, due to the heavy smoothing
All edges detected are in the form of closed curves
in the same way that contour lines on a map are always closed.
The only exception is where the curve goes off the edge
41
Laplacian zero-crossing patterns.
42