Professional Documents
Culture Documents
Ed Detection
Edge
D
i
Wh are edges
What
d
in
i an image?
i
?
Edges are those places
i an image
in
i
that
th t
correspond to object
b
boundaries.
d i
Edges are pixels where
image brightness
changes abruptly.
Brightness vs. Spatial Coordinates
M
More
About
Ab
Ed
Edges
An edge is a property attached to an
i di id l pixel
individual
i l andd is
i calculated
l l t d from
f
the
th
image function behavior in a neighborhood
off th
the pixel.
i l
It is a vector variable (magnitude of the
gradient, direction of an edge) .
I
Image
T
To Edge
Ed Map
M
Ed Detection
Edge
D
i
Edge information in an image is found by looking
at the relationship a pixel has with its
neighborhoods.
If a pixels
pixel s gray-level
gray level value is similar to those
around it, there is probably not an edge at that
p
point.
If a pixels has neighbors with widely varying gray
levels, it may present an edge point.
Ed Detection
Edge
D
i
An edge is a boundary between an object
Ed Detection
Edge
D
i
Edges, in an image are defined as locations
where there is a significant variation in the
gray level or color of pixel in some direction.
Edge detection extracts and localizes points
(pixels) around which a large change in
age bbrightness
g t ess has
as occurred.
occu ed.
image
This can help in the process of
segmentation
T di i l Approaches
Traditional
A
h
Ideal Step Edge :(The most common definition of an edge)
In 1-d the edge is simply a change in gray
level occurring at one specific location
(fig.1a).
The greater the change in the level, the
easier the edge is to detect.
S
Step
Edge
d Detection
i
P bl
Problems
in
i Edge
Ed Detection
D
i
Problems:1)Because of digitization:-The image may be
p in such a wayy so that change
g in ggray
y
sampled
level may extend across some number of
pixels. Fig
p
g 1b-d.
2)Because of noise:-Due to factors such as
light intensity,
intensity type of camera and lens,
lens
motion, temperature, dust and others.
Noise
Two types of noise are of interest in image analysis:1) Signal independent:-noise
independent:-noise is a random set of gray levels,
levels
statistically independent of the data. It occurs during
electronically transmission of image. If A is a perfect
i
image
and
d N iis the
th noise
i that
th t occurs d
during
i
transmission, then the final image B is
B=A+N
2) Signal-dependent noise:- In this the level of the noise
value at each point in the image is a function of the
grey level
l l there.
h
Ed Detection
Edge
D
i Methods
M h d
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
bou thee existence
e s e ce of
o an edge at each
e c point.
po .
about
v = f(x,y)
A 2D grayvalue - image is
a 2D -> 1D function
Derivative Operators
An operator, that is sensitive to change in gray level will operate as
an edge detector- A derivative operator does this.
Interpretation of derivative:- The rate of change of function. The
rate of change of the gray levels in an image is large near an edge
and small in constant areas.
In images are 2-D, so level changes are considered in many
directions. For this reason partial derivatives of the image are used
with respect to the principal directions x and y.
Let A (x, y) be an image then the gradient is defined as:
( / x,, A / y)
y)
A ((x ,y) = (A
G di operators
Gradient
Because image is discrete, the derivative at a pixel is approximated by
the difference in gray levels over some local region.
The simplest approximation is the operator 1:
G di operators
Gradient
A better choice for an approximation is
x2 A(x,
A( y)) = A(
A(x+1,
+1 y)) A(x-1
A( 1 ,y))
y2 A(x,
A(x y) = A(x,
A(x y+1) A(x,
A(x y-1)
This operator is symmetrical with respect to the pixel (x,
y). It does not consider the value of the pixel at (x, y).
The edge response is given by:
Gmag = ((A
x)2 + (A y)2)
G di operators
Gradient
and the direction of the edge is approximately:
Gdir = atan (A y) ( A x)
Edge pixel- which exceeds the threshold
value
G di operators examples
Gradient
l
E
Examples
l
E
Examples
l
M
Measures
off P
Performance
f
Evaluation scheme based on local edge coherence (Kitchen
and Rosenfeld))
(a) It measures how well an edge pixel is continued on the
left; this function is
L(k) =a(d,dk) a(k/4,d+/2) if neighbor k is an edge pixel
0
otherwise
where
h d is
i the
th edge
d direction
di ti att the
th pixel
i l being
b i tested
t t d
d0 is the edge direction at its neighbor to the right
d1 is the direction of the upper
upper-right
right neighbor,
neighbor and so on
Counterclockwise about the pixel involved
a= the measure of the angular difference between any two
Measures
M
a(,) = -|-|
(b) A similar function measures directional continuity on the
right of the pixel being evaluated:
R(k) = a(d,dk) a(k/4,d+/2) if neighbor k is an edge
pixel
0
otherwise
(c) C= Overall continuity measure
= average(L(k), R(k))
(d) Then measure of thinness (T) is applied.
(e) The overall evaluation of the edge detector is:
(f)
E2 = C + (1-) T
Template-Based
Template
Based Edge Detection
This uses a small, discrete template as a model of an edge
p
instead of usingg a derivative operator.
Exampes:(a) Sobel Edge Detector
(b) Kirsch Edge Detector
P i Operator
Prewitt
O
1 1 1
y = 0 0 0
1 1 1
1 0 1
x = 1 0 1
1 0 1
x2 + y2
y
tan
x
1
S b l Operator
Sobel
O
Similar to the Prewitt, with different mask
coefficients:
1 2 1
0
0
y = 0
1
2
1
Edge
g Magnitude
g
=
1 0 1
x = 2 0 2
1 0 1
x +y
2
Edge
g Direction
y
= tan x
1
Ki h C
Kirsch
Compass Masks
M k
Taking a single mask and rotating it to 8
major compass orientations: N,
N NW,
NW W,
W SW,
SW
S, SE, E, and NE.
The edge magnitude = The maximum value
found by the convolution of each mask with
tthee image.
age.
The edge direction is defined by the mask
produces
oduces thee maximum
u magnitude.
g ude.
that p
Ki h Compass
Kirsch
C
Masks
M k (Cont.)
(C
)
The Kirsch masks are defined as follows:
5
5
5
5 3
3 3 5
3 5
5
5
N = 3 0 5 W = 3 0
5 S = 3 0 3 E = 5
0 3
3 3 5
3 3 3
3 3 3
3 3 3
5 3 3
3 3 3
3 3 3
3 3 5
NW = 5 0 3SW = 5
0 3SE = 3 0 3 NE = 3 0 5
5
5
5 3
5
5
5 3 3
3 5 5
Ki h Ed
Kirsch
Edge Detector
D
These masks are to observe the grey level change near an edge having
various orientations, rather than approximation to the gradient.
There
There are one mask for each of eight compass directions.
For example, a large response to mask K0 implies a vertical edge
(horizontal gradient) at the pixel corresponding to the center of the
mask.
Method:To find the edges, an image I is convolved with all of the masks at each
pixel position
position. The response of the operator at a pixel is the maximum
of the responses of any of the eight masks. The direction of the edge
pixel is quantized into eight possibilities and is /4 *I where I is the
g the largest
g response.
p
number of the mask having
Looks for edges in both horizontal and vertical directions, then combine
the information into a single metric.
R bi
Robinson
Compass
C
Masks
M k
Similar to the Kirsch masks, with mask
coefficients
ffi i t off 0,
0 1,
1 andd 2:
2
1 0 1
N = 2 0 2
1 0 1
1 2
2
1
0
0
1
2 1
W = 1 0 1 S = 0
0
0 E = 1 0 1
2 1 0
1 2 1
0 1 2
1 0 1
0 1 2
1 2 1
2 1 0
NW = 2 0 2 SW = 1 0 1 SE = 0
0
0 NE = 1 0 1
1 0 1
2 1
1
0
0
1 2
2
1
L l i Operators
Laplacian
O
Edge magnitude is approximated in digital
i
images
by
b a convolution
l ti sum.
The sign of the result (+ or -) from two
adjacent pixels provide edge orientation and
tells us which side of edge brighter
L l i Operators
Laplacian
O
(Cont.)
(C
)
Masks for 4 and 8 neighborhoods
0 1 0
1 4 1
0 1 0
1 1 1
1 8 1
1 1 1
1 2 1
2 4 2
1 2 1
2 1 2
1 4 1
2 1 2
C
Comparison
i
Sobel and Prewitt methods are very effectively
providing good edge maps.
Kirsch
Ki h andd Robinson
R bi
methods
th d require
i more time
ti for
f
calculation and their results are not better than the
ones pproduced by
y Sobel and Prewitt methods.
Roberts and Laplacian methods are not very good
as expected.
AQ
Quick
i kN
Note
Matlabs image processing toolbox provides edge
function to find edges in an image:
I = imread('rice.tif');
BW1 = edge(I,'prewitt');
BW2 = edge(I,'canny');
imshow(BW1)
figure imshow(BW2)
figure,