You are on page 1of 31

1/17/2013 Y.

EMRE 2
CONTENTS
1/17/2013 Y.EMRE 3
INTRODUCTION
Edges are sudden variances at
the pixel value among the
smooth area
Edge - Area of significant
change in the image intensity /
contrast

1/17/2013 Y.EMRE 4
1/17/2013 Y.EMRE 5
Filtering Filter image to improve
performance of the Edge Detector
Enhancement Emphasize pixels having
significant change in local intensity
Localization Locate the edge
accurately, estimate edge orientation
1/17/2013 Y.EMRE 6
First Derivative
At the point of greatest
slope, the first
derivative has maximum
value
E.g. For a Continuous 1-
dimensional function f(t)

1/17/2013
Y.EMRE

7
1/17/2013 Y.EMRE 8

(
(
(
(

c
c
c
c
=
(

=
y
f
x
f
Gy
Gx
y x f G )] , ( [
Gy Gx Gy Gx G + ~ + =
2 2
|
.
|

\
|
=

Gx
Gy
1
tan u
GRADENT
VERTCAL HORZONTAL
1/17/2013 Y.EMRE 9
I = G
x
q x, y
( )
= 0
( )
2
t
u =
= V
y x
G I
y
,
1/17/2013 Y.EMRE 10
Gradient
Convolution Mask
Gx=



Gy =





Differences are computed at the
interpolated points [i, j+1/2] and [i+1/2, j]
-1 1
-1 1
] , 1 [ ] , [
] , [ ] 1 , [
j i f j i f Gy
j i f j i f Gx
+ ~
+ ~
1 1
-1 -1
-1 1
1
-1
1/17/2013 Y.EMRE 11
Gradient Methods Roberts
Operator
Provides an approximation to the gradient


Convolution Mask
Gx=


Gy =





Differences are computed at the interpolated points [i+1/2,
j+1/2] and not [i, j]

1 0
0 -1
0 -1
1 0
) 1 , ( ) , 1 ( ) 1 , 1 ( ) , ( )] , ( [ + + + + + = + = j i f j i f j i f j i f Gy Gx j i f G
1/17/2013 Y.EMRE 12
Roberts Operator

1/17/2013 Y.EMRE 13
Gradient Methods Sobel Operator
Convolution Mask


Gx = Gy=






The differences are calculated at the center pixel of the
mask.
-1 0 1
-2 0 2
-1 0 1
1 2 1
0 0 0
-1 -2 -1
1/17/2013 Y.EMRE 14
Sobel Operator
This algorithm is calculated
with maximum and minimum
of the derivative of the signal
Compare the output of
the Sobel Operator with that of
the Roberts Operator:
The spurious edges are
still present but they are
relatively less intense
compared to genuine
lines
Outputs of Sobel (top) and Roberts operator
im=imread('cameraman.tif');
[row col]=size(im);
a=double(im);
subplot(3,2,1);
imshow(im);
title('Original image');
gx=[-1 0 1;-2 0 2;-1 0 1];
gy=[-1 -2 -1;0 0 0;1 2 1];
%X-gradient
for i=2:row-1
for j=2:col-1
fx(i,j)=a(i-1,j-1)*gx(1)+a(i-
1,j)*gx(2)+a(i-1,j+1)*gx(3)+a(i,j-
1)*gx(4)+
a(i,j)*gx(5)+a(i,j+1)*gx(6)+a(i+1,j
-
1)*gx(7)+a(i+1,j)*gx(8)+a(i+1,j+
1)*gx(9);
end
end
subplot(3,2,2);
imshow(uint8(fx));
title('X-Gradient');
%Y-gradient
for i=2:row-1
for j=2:col-1
fy(i,j)=a(i-1,j-1)*gy(1)+a(i-
1,j)*gy(2)+a(i-1,j+1)*gy(3)+a(i,j-
1)*gy(4)+
a(i,j)*gy(5)+a(i,j+1)*gy(6)+a(i+1,j
-
1)*gy(7)+a(i+1,j)*gy(8)+a(i+1,j+
1)*gy(9);
end
end
subplot(3,2,3);
imshow(uint8(fy));
title('Y-Gradient');

F=fx+fy;
subplot(3,2,4);
imshow(uint8(F));
title('Edge detected using sobel
algo')


1/17/2013 Y.EMRE 15


1/17/2013 ECE - Sarbjeet Singh 16
1/17/2013 Y.EMRE 17
Gradient Methods Prewitt
Operator
It is similar to the Sobel operator but uses slightly
different masks.This edge detection computes the
gradient of each point of the input. Magnitudes of
gradients constitute the edge-improved image

Convolution Mask
Px =



Py =
-1 0 1
-1 0 1
-1 0 1
1 1 1
0 0 0
-1 -1 -1


Y.EMRE 18


1/17/2013 19
I = imread('tire.tif');
BW1 = edge(I,'prewitt');
BW2 = edge(I,'canny');
imshow(BW1);
figure, imshow(BW2);
figure,imshow(I)


1/17/2013 Y.EMRE 20


In 1980 Mary and Hildreth
improved and extend the
study of Marry and Poggio
and created a new method
for edge detection.This
method is based on Gauss
filter then Laplacian
principle.This method is
also known as Laplacian of
Gaussian (LoG).Due to its
frequency response , It is
called as "Mexican Hat".


1/17/2013 Y.EMRE 21


1/17/2013 ECE - Sarbjeet Singh 22


1/17/2013 ECE - Sarbjeet Singh 23


1/17/2013 ECE - Sarbjeet Singh 24


1/17/2013 ECE - Sarbjeet Singh 25
1/17/2013 Y.EMRE 26
Second Order Derivative Methods -
Laplacian
Defined as

Mask



Very susceptible to noise, filtering required, use
Laplacian of Gaussian
0 1 0
1 -4 1
0 1 0
1/17/2013 Y.EMRE 27
Second Order Derivative Methods -
Laplacian of Gaussian
Also called Marr-Hildreth.
1/17/2013 Y.EMRE 28
Laplacian of Gaussian contd.
Defined as



Greater the value of o, broader is the
Gaussian filter, more is the smoothing
Too much smoothing may make the
detection of edges difficult

1/17/2013 Y.EMRE 29
Laplacian of Gaussian - contd.
Also called the Mexican Hat operator


1/17/2013 Y.EMRE 30
Laplacian of Gaussian contd.
Mask







Discrete approximation to LoG function with Gaussian = 1.4
Thank You
1/17/2013 ECE - Sarbjeet Singh 31

You might also like