boundary based segmentation (edge detection)
TRANSCRIPT
![Page 1: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/1.jpg)
Boundary based segmentation (edge detection)
Changes (or discontinuous) in an image amplitude are important primitive characteristics of an image that carry information about object borders.
Detection methods of image discontinuities are principal approaches to image segmentation and identification of objets in a scene.
Local discontinuities in image intensity fall into three categories: points, lines, and edges.
![Page 2: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/2.jpg)
Segmentation by edge detection
0 10 20 30 40 50 60 70 80 90 10060
80
100
120
140
160
180
200
220
240
Distance along profile
0 10 20 30 40 50 60 70 80 90 10060
80
100
120
140
160
180
200
220
240
Distance along profile
![Page 3: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/3.jpg)
Point and line detection
The most common way to look for an arbitrary image pattern (e.g., point, or edge) is to convolve the image with a mask of size N1ĂN2 (e.g., 3Ă3, 5Ă5).The size of the mask and its content depends on the type of the detected object.
W1
W4
W2
W5 W6
W3
W8 W9 W7
![Page 4: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/4.jpg)
Detection masks
W1
W4
W2
W5 W6
W3
W8 W9 W7
Vector inner product of the mask coefficients with image gray levels covered by the mask :
zwzwzwzwzwD TN
iiiNN ==+++= â
=12211 L
A 3Ă3 detection mask
![Page 5: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/5.jpg)
-1
-1
-1
8 -1
-1
-1 -1-1
Point detection mask:
Point detection mask
The point is rendered if:
where D is a similarity measure between the image and the template, and T is a non-negative threshold.
TD>
![Page 6: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/6.jpg)
Line detection masks
-1
-1
2
2 -1
-1
2 -1-1
-1
-1
-1
2 -1
2
-1 -12
2
-1
-1
2 -1
-1
-1 2-1
Horizontal Vertical
+45° -45°
-1
2
-1
-1 -1
-1 -1
2 2
![Page 7: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/7.jpg)
Line detectors
![Page 8: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/8.jpg)
Edge detection
An edge is the boundary between two regions with distinct gray-level properties.
Edges characterise the physical extent of objects thus their accurate detection plays a key role in image analysis and pattern recognition problems.
The main idea underlying most edge-detection techniques is the computation of a local derivative of an image.
![Page 9: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/9.jpg)
Edge detection
âIdealâ and real edge profiles
0 10 20 30 40 50 60 70 80 90 10060
80
100
120
140
160
180
200
Distance in pixel units
?
![Page 10: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/10.jpg)
How gradient operators work?
![Page 11: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/11.jpg)
v
Image
Firstderivative
Secondderivative
Brightnessprofile
Edgedetection by means ofgradiantoperators
Edgedetection by means ofgradiantoperators
![Page 12: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/12.jpg)
Edge detection
Note the following points about image derivative operators:
⢠the magnitude of the first derivative can be used to detect the presence of an edge in an image,
⢠the sign of the second derivative can be used to determine whether an edge pixel is on the dark or light side of an edge,
the second derivative has z zero crossing at the midpoint of a gray-level transition.
![Page 13: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/13.jpg)
Gradient operators
=
=â
y
fx
f
G
Gf
y
x
ââââ
The gradient of an image f(x,y) at location (x,y) is defined as the vector:
The gradient vector points in the direction of maximum rate of changeof at (x,y). Magnitude of this vector, called simply the gradient, is computedfrom:
( ) [ ] yx/
yx GGGGfmagf +â+=â=â2122
![Page 14: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/14.jpg)
Gradient of an image
5 10 15 20
2
4
6
8
10
12
14
16
18
20
![Page 15: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/15.jpg)
Gradient operators
Z1 Z2
Z3 Z4
X
Y
3121 zzzzf â+âââ
3241 zzzzf â+âââ
Gradient for a discrete image:
or for diagonal directions:
![Page 16: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/16.jpg)
Examples of gradiant masks
Roberts
1 0
-10
h1
0 1
0-1
h2
g(x,y) = |h1**f(x,y)| + |h2**f(x,y)|
![Page 17: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/17.jpg)
Examples of gradiant masks
-1
0
-1
0 0
-1
1 11
-1
-1
0
0 1
1
0 1-1
Prewitt
h1 h2
g(x,y) = |h1**f(x,y)| + |h2**f(x,y)|
g(x,y) = ([h1**f(x,y)]2 + [h2**f(x,y)]2)1/2
%Matlabh=fspecial(âprewittâ)
![Page 18: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/18.jpg)
Examples of gradiant masks
Sobel
1
0
2
0 0
1
-2 -1-1 h1
-1
-2
0
0 2
1
0 1-1h2
g(x,y) = |h1**f(x,y)| + |h2**f(x,y)|
g(x,y) = ([h1**f(x,y)]2 + [h2**f(x,y)]2)1/2
%Matlabh=fspecial(âsobelâ)
![Page 19: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/19.jpg)
Sobel
Prewitt
Roberts
Original
Gradient images
![Page 20: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/20.jpg)
Original
Gradient images
Roberts
CannySobel
%MATLABI = imread(âcameraman.tif');BW1 = edge(I,âroberts');BW2 = edge(I,'sobel');BW3 = edge(I,'canny');figure, imshow(BW1); figure, imshow(BW2);figure, imshow(BW3);
![Page 21: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/21.jpg)
Edge detection procedure
The pixel location is considered as an edge location if âf(x,y) exceeds some threshold T. Typically, T may be selected using the cumulative histogram of the gradient image.
The edge map (a binary image) gives the necessary data for tracing the object boundaries in an image.
Gx
Gy
G=IGxI+IGyI f(x,y) Edge
map T
Thresholding
Gradient image
![Page 22: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/22.jpg)
Edge detection
Horizontal
Vertical
![Page 23: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/23.jpg)
Edge detection
MATLAB
Demo
![Page 24: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/24.jpg)
Laplacian
2
2
2
22
y
f
x
ff
ââ
ââ +=â
( )864252 4 zzzzzf +++âââ
Laplacian of a 2-D function f(x,y) is a second derivative defined as:
The Laplacian of a discrete image can be approximated by a difference equation:
![Page 25: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/25.jpg)
Laplacian
-1
-1
-1
8 -1
-1
-1 -1-1
0
-1
-1
4 -1
0
-1 00
(a) (b)
Two possible versions of the Laplacian masks.
%Matlabh=fspecial(âlaplacianâ)
![Page 26: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/26.jpg)
Gradient operators at work
-1-1-1
-18-1
-1-1-1
%MATLABoutput=filter2(h,input);
help fspecial-1-1-1
-19-1
-1-1-1
![Page 27: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/27.jpg)
Laplacian in frequency domain
Fourier transform of a derivative of a function
( ){ } ( ) ( )ĎĎ Fjxf nn =â
For Laplacian one gets:
higher frequency components are âamplifiedâ.
{ } ( ) ( )yxyx ,Ff ĎĎĎĎ 222 +â=ââ
![Page 28: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/28.jpg)
Laplacian
The Laplacian plays a secondary role in edge
detection due to the following shortcomings:
⢠is unacceptably sensitive to noise (second
derivative),
⢠produces double edges,
⢠unable to detect edge direction.
2
2
2
22
y
f
x
ff
ââ
ââ +=â
![Page 29: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/29.jpg)
Laplacian
A more suitable use of the Laplacian is in finding the location of edges using its zero-crossingproperty. This concept is based on convolving an image with the Laplacian of a 2-D Gaussian function of the form:
+â= 2
22
2Ďyx
exp)y,x(h
where Ď is the standard deviation. Assume r2=x2+y2. Then, the Laplacian of h with respect to r is:
â
â=â 2
2
4
222
2ĎĎĎ r
expr
h
![Page 30: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/30.jpg)
-4-2
02
4
-4-2
02
4
0
0.5
1
XY
Z
Laplacian of a 2-D Gaussian function for Ď =1 (also called the Mexican hat function).
Laplacian
zero crossings
![Page 31: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/31.jpg)
Operator LoG (Laplacian of Gaussian)
%MATLABI = imread('saturn.tif');h = fspecial('log',[5 5], 0.2);I2 = filter2(h,I)/255;imshow(I), figure, imshow(I2)
![Page 32: Boundary based segmentation (edge detection)](https://reader030.vdocument.in/reader030/viewer/2022011915/61d7dcf1bcdcbf28032bd854/html5/thumbnails/32.jpg)
Lapalcian of an image
An image and its zero-crossings.