SPATIAL DOMAIN FILTERING
EDGE DETECTION
CS-467 Digital Image Processing
1
Edges
• Edge pixels are pixels at which the intensity
changes abruptly
• Edges are sets of connected edge pixels
• Often edges are called points of discontinuity
of the intensity function
• To detect edges, differentiation in a local
neighborhood should be used
2
Importance of Edge Detection
• Edge detection is important for localization of
image details, especially the smallest details
• It can be used, for example, in non- destructive
inspection, to localize possible defects; in medical
imaging, to localize important details
• Edge detection is also used in image
segmentation – a process that partitions an
image into disjoint regions corresponding to
different textures
3
High-Pass Filtering
• In terms of filtering, edge detection is a spatial
domain high-pass filtering
• Differentiating an image, high-pass filters
eliminate low and medium frequencies,
passing and possibly enhancing high
frequencies.
4
Three Major Types of Intensity Change
5
Step Ramp Roof
© 1992-2008 R.C. Gonzalez & R.E. Woods
Derivatives of Digital Functions
• The derivatives of a digital image function are
defined in terms of differences. They have to
meet the following requirements:
• A 1st derivative
1) Must be 0 in areas of constant intensity
2) Must be nonzero at the onset of an intensity
step or ramp;
3) Must be nonzero along ramps
6
Derivatives of Digital Functions
• The derivatives of a digital image function are
defined in terms of differences. They have to
meet the following requirements:
• A 2nd derivative
1) Must be 0 in areas of constant intensity
2) Must be nonzero at the onset and end of an
intensity step or ramp;
3) Must be zero along ramps of constant slope
7
Derivatives of 1-D Digital Functions
• A basic definition of the first-order derivative
of the digital function
• A basic definition of the second-order
derivative of the digital function
8
( ) ( )1
f
f x f x
x
∂
= + −
∂
( )f x
( )f x
( ) ( )( ) ( ) ( )( )
( ) ( ) ( )
2
2
1 1
1 1 2
f
f x f x f x f x
x
f x f x f x
∂
= + − − − − =
∂
= + + − −
Derivatives of 1-D Digital Functions
9
© 1992-2008 R.C. Gonzalez & R.E. Woods
Derivatives of 2-D Digital Functions
• A basic definition of the first-order derivatives
of the function
• A basic definition of the second-order
derivatives of the function
10
( ) ( ) ( ) ( )1, , ; , 1 ,
f f
f x y f x y f x y f x y
x y
∂ ∂
= + − = + −
∂ ∂
( ),f x y
( ) ( ) ( )
( ) ( ) ( )
2
2
2
2
1, 1, 2 , ;
, 1 , 1 2 ,
f
f x y f x y f x y
x
f
f x y f x y f x y
y
∂
= + + − −
∂
∂
= + + − −
∂
( ),f x y
The Laplacian and Second Order
Derivative Edge Detection
• The Laplacian (as it is known from calculus
and partial differential equations) is
• Hence, Laplacian of the image intensity
function (“Laplacian 1”)
11
( )
2 2
2
2 2
,
f f
f x y
x y
∂ ∂
∇ = +
∂ ∂
( )f x
( ) ( ) ( ) ( )
( ) ( )
2
, 1, 1, , 1
, 1 4 ,
f x y f x y f x y f x y
f x y f x y
∇ = + + − + + +
+ − −
The Laplacian
• A global edge detector must be spatially
isotropic, it should not depend on any rotation
of an image and particular gradient direction
• To detect diagonal edges, we should involve
the diagonal second-order derivatives
(Laplacian 2)
12
( ) ( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
( )
2
, 1, 1, , 1 , 1
1, 1 1, 1 1, 1 1, 1
8 ,
f x y f x y f x y f x y f x y
f x y f x y f x y f x y
f x y
∇ = + + − + + + − +
+ − − + + − + − + + + + −
−
,
f f
x y y x
∂ ∂
∂ ∂ ∂ ∂
Laplacian Edge Detector
• Laplacian 1 Laplacian 2
13
Downward
Upward
© 1992-2008 R.C. Gonzalez & R.E. Woods
Laplacian Detector of Lines
Oriented in Various Directions
14
© 1992-2008 R.C. Gonzalez & R.E. Woods
First- and Second- Order
Derivatives and Edge Detection
• Laplace edge detectors are based on second-
order derivatives
• There are also edge detectors based on first-
order derivatives
• Second-order derivatives better detect edges
corresponding to the smallest details, they
also detect and enhance isolated pixels
• First-order derivatives detect and possibly
enhance the brightness jumps “as they are”
15
First- and Second- Order
Derivatives and Edge Detection
16
© 1992-2008 R.C. Gonzalez & R.E. Woods
Distinction between First- and Second-
Order Derivatives in Edge Detection
17
© 1992-2008 R.C. Gonzalez & R.E. Woods
First-Order Derivatives in
Edge Detection
• First-order derivatives in image processing are
implemented using the magnitude of the gradient
• The magnitude (length) of vector is
18
( )
x
y
f
g x
f grad f
fg
y
∂ 
   ∂
 ∇= = =  ∂  
 ∂ f∇
( ) ( ) 2 2
, x y x yM x y mag f g g g g= ∇ = + ≈ +
Gradient and Edge
19
© 1992-2008 R.C. Gonzalez & R.E. Woods
First-Order Derivatives by Roberts
(1965)
20
1 2 3
4 5 6
7 8 9
z z z
z z z
z z z
 
 
 
 
 
( ) ( )
( )
9 5 8 6
9 5 8 6
;
,
x yg z z g z z
M x y z z z z
=− =−
≈ − + −
( ) ( )
( )
8 5 6 5
8 5 8 5
;
,
x yg z z g z z
M x y z z z z
=− =−
≈ − + −
Robert’s derivatives and gradients
Disadvantage: no center of symmetry
First-Order Derivatives by Prewitt
(1970)
21
1 2 3
4 5 6
7 8 9
z z z
z z z
z z z
 
 
 
 
 
( ) ( )
( ) ( )
( ) ( ) ( )
( ) ( )
7 8 9 1 2 3
3 6 9 1 4 7
7 8 9 1 2 3
3 6 9 1 4 7
,
x
y
f
g z z z z z z
x
f
g z z z z z z
y
M x y z z z z z z
z z z z z z
∂
= = + + − + +
∂
∂
= = + + − + +
∂
≈ + + − + + +
+ + + − + +
First-Order Derivatives by Sobel (1970)
22
1 2 3
4 5 6
7 8 9
z z z
z z z
z z z
 
 
 
 
 
( ) ( )
( ) ( )
( ) ( ) ( )
( ) ( )
7 8 9 1 2 3
3 6 9 1 4 7
7 8 9 1 2 3
3 6 9 1 4 7
2 2
2 2
2 2
2
,
2
x
y
f
g z z z z z z
x
f
g z z z z z z
y
M x y z z z z z z
z z z z z z
∂
= = + + − + +
∂
∂
= = + + − + +
∂
≈ + + − + + +
+ + + − + +
Roberts, Prewitt, and Sobel masks
23
© 1992-2008 R.C. Gonzalez & R.E. Woods
Some Disadvantages of Classical Edge
Detectors
• They do not differ (except Laplace) between
upward (from “dark” to “bright”) and downward
(from “bright” to “dark”) brightness jumps
• This is resulted in “bold” (“thick”) edges where
the same brightness jump can be detected twice
• All of them (except Prewitt) give a preference to
the pixel of interest (the symmetry center). This
may help to suppress noise, to avoid its
detection, but simultaneously some edges can be
emphasized, while some other can be suppressed
24
Nonlinear Edge Detectors
• In fact, even Sobel and Prewitt edge detectors
are nonlinear, because they operate with
absolute values of gradients. |…| function is
only piecewise-linear; thus, it is nonlinear.
• Nonlinear edge detectors are based either on
nonlinear operation applied to digital
derivatives or nonlinear transformation of an
image followed by some kind of
differentiation
25
Threshold Boolean Filtering
• Let X be (M+1)-valued gray scale image
• Let be a binary
plane
• Then filtering operation is determined by
where F is the processing Boolean function,
is a local window around a pixel of interest
26
( ) 1 , if ( , )
( , ) ; 1,...,
0 , otherwise
k x i j k
x i j k M
≥
= =

( ) ( )( )
1
,
M
k
ij
k
XFy i j
=
= ∑
( )k
ijX
Edge Detecting Boolean Functions
• The Boolean function for detection of upward
brightness jumps
• The Boolean function for detection of
downward brightness jumps
27
( )
1 2 3
4 5 6 5 1 2 3 4 6 7 8 9
7 8 9
&u
x x x
F f x x x x x x x x x x x x
x x x
 
 
= = ∨ ∨ ∨ ∨ ∨ ∨ ∨ 
 
 
( )
1 2 3
4 5 6 5 1 2 3 4 6 7 8 9
7 8 9
&d
x x x
F f x x x x x x x x x x x x
x x x
 
 
= = ∨ ∨ ∨ ∨ ∨ ∨ ∨ 
 
 
Edge Detecting Boolean Functions
28
1 1
1
0
0 1
1 0 1
 
 
 
 
 
0 0
0 0
1
1
1 1 1
 
 
 
 
 
Upward Edge passes through the center of
the window, there is no downward edge
Downward Edge passes through the center
of the window, there is no upward edge
TBF (Stack) Edge Detection Filter
• Detection of upward brightness jumps is
equivalent to
• Detection of downward brightness jumps is
equivalent to
29
( )
( ) ( )( )max , 1, 1 ,if 0
,
0, otherwise
m f x y f x y m
g x y
= − ± ± >
= 

( )
( ) ( )( )max 1, 1 , ,if 0
,
0, otherwise
m f x y f x y m
g x y
= ± ± − >
= 

TBF Edge Detection
30
35 210 100
112 120 80
100 221 220
 
 
 
 
 
35 210 100
112 120 80
100 221 220
 
 
 
 
 
Upward Edge pass through the center of the
window, its intensity is 120-35=85
Downward Edge pass through the center of
the window, its intensity is 221-120=101
Edge Detection using Stack Filter
• Simultaneous detection of downward and
upward brightness jumps
• This is resulted in “bold” (“thick”) edges
31
( ) ( ) ( ), max , 1, 1g x y f x y f x y= − ± ±
Image Break-up Into Binary Planes
• Each intensity value in the range 0…255 is
presented by one byte, which consists of 8 bits
• Breaking up these bytes into bits, we break up
the entire image into 8 binary planes
32
© 1992-2008 R.C. Gonzalez & R.E. Woods
Precise Edge Detection
• Algorithm:
1) Breaking up the image into binary planes;
2) Detection of edges using edge detecting
Boolean function;
3) Assembling the resulting image from the
binary planes
33
Precise Edge Detection
• Upward Edge Detecting Boolean function
• Downward Edge Detecting Boolean function
• “Global” Edge Detecting Boolean function
34
1 2 3
4 5 6
7 8 9
x x x
f x x x
x x x
 
 
= 
 
 
5 1 2 3 4 6 7 8 9( )x x x x x x x x x∧ ∨ ∨ ∨ ∨ ∨ ∨ ∨
5 1 2 3 4 6 7 8 9( )x x x x x x x x x∧ ∨ ∨ ∨ ∨ ∨ ∨ ∨
1 2 3
4 5 6
7 8 9
x x x
f x x x
x x x
 
 
= 
 
 
1 2 3
4 5 6
7 8 9
x x x
f x x x
x x x
 
 
= 
 
 
( )5 1 2 3 4 6 7 8 9& ( )x x x x x x x x x∨ ∨ ∨ ∨ ∨ ∨ ∨ ∨
5 1 2 3 4 6 7 8 9&( )x x x x x x x x x∨ ∨ ∨ ∨ ∨ ∨ ∨ ∨
Edged Segmentation using
Precise Edge Detection
• Edged Segmentation is edge detection with
simultaneous emphasizing of areas with different
textures bounded by edges
• To make segmentation using precise edge
detection, it is necessary to detect edges in some
binary planes preserving some other binary
planes unchanged. For example, a good
segmentational effect can be achieved by
detecting edges in binary planes 0,1,2,3,4,7 and
preserving binary planes 5,6 unchanged
35
Noise and Edge Detection
• Noise prevents detecting clean edges because edge detectors
don’t care of what is behind particular intensity jump – noise
or useful detail
36
© 1992-2008 R.C. Gonzalez & R.E. Woods

More Related Content

PDF
IVR - Chapter 2 - Basics of filtering I: Spatial filters (25Mb)
PDF
Journey to structure from motion
PDF
Image formation
PPTX
Notes on image processing
PDF
Vector Distance Transform Maps for Autonomous Mobile Robot Navigation
PPTX
Computer Graphics Unit 1
PDF
"Fundamentals of Monocular SLAM," a Presentation from Cadence
IVR - Chapter 2 - Basics of filtering I: Spatial filters (25Mb)
Journey to structure from motion
Image formation
Notes on image processing
Vector Distance Transform Maps for Autonomous Mobile Robot Navigation
Computer Graphics Unit 1
"Fundamentals of Monocular SLAM," a Presentation from Cadence

What's hot (20)

KEY
Factorising quads diff 2 squares perfect squares
PPTX
Lec02 03 rasterization
PPTX
Caculus
PDF
Modern features-part-1-detectors
PPT
Anov af03
PPTX
09 cie552 image_featuresi
PDF
CG OpenGL Shadows + Light + Texture -course 10
PDF
[MIRU2018] Global Average Poolingの特性を用いたAttention Branch Network
PPSX
short course on Subsurface stochastic modelling and geostatistics
PDF
(文献紹介)デブラー手法の紹介
PDF
Pc12 sol c03_review
PPTX
Kccsi 2012 a real-time robust object tracking-v2
PPTX
Lesson 8 the definite integrals
PDF
Non-local Neural Network
PPTX
Green Custard Friday Talk 17: Ray Tracing
PDF
TAO Fayan_X-Ray and MIP volume rendering
PPTX
Computer Graphics - Hidden Line Removal Algorithm
PDF
Lecture 1
PPT
PPT
07object3d
Factorising quads diff 2 squares perfect squares
Lec02 03 rasterization
Caculus
Modern features-part-1-detectors
Anov af03
09 cie552 image_featuresi
CG OpenGL Shadows + Light + Texture -course 10
[MIRU2018] Global Average Poolingの特性を用いたAttention Branch Network
short course on Subsurface stochastic modelling and geostatistics
(文献紹介)デブラー手法の紹介
Pc12 sol c03_review
Kccsi 2012 a real-time robust object tracking-v2
Lesson 8 the definite integrals
Non-local Neural Network
Green Custard Friday Talk 17: Ray Tracing
TAO Fayan_X-Ray and MIP volume rendering
Computer Graphics - Hidden Line Removal Algorithm
Lecture 1
07object3d
Ad

Viewers also liked (13)

PPTX
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
PDF
Image Enhancement
PPT
Spatial domain and filtering
PDF
04 image enhancement edge detection
PPTX
PPT
Spatial filtering using image processing
PPTX
Chapter 3 image enhancement (spatial domain)
PPT
06 spatial filtering DIP
PPT
08 frequency domain filtering DIP
PPT
Enhancement in spatial domain
PPTX
Image Enhancement in Spatial Domain
PPT
Frequency Domain Image Enhancement Techniques
PPT
Spatial filtering
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
Image Enhancement
Spatial domain and filtering
04 image enhancement edge detection
Spatial filtering using image processing
Chapter 3 image enhancement (spatial domain)
06 spatial filtering DIP
08 frequency domain filtering DIP
Enhancement in spatial domain
Image Enhancement in Spatial Domain
Frequency Domain Image Enhancement Techniques
Spatial filtering
Ad

Similar to Lecture 8 (20)

PDF
Module-5-1_230523_171754 (1).pdf
PPTX
Lecture 06 - image processingcourse1.pptx
PPTX
Computer vision - edge detection
PPT
IVP_segmentation ppt for image segmentation used in computer graphics
PPTX
Fuzzy Logic Based Edge Detection
PPSX
Edge Detection and Segmentation
PDF
MachineVision_Chapter5_Edge_Detection.pdf
PPT
Edges and lines
PDF
Lec06 edge
PPTX
Image Segmentation by Professor Vipin Tyagi
PPTX
08_Lecture -Chapter 10- Image Segmentation_Part I_Edge Detection.pptx
PDF
Edge Detection 2 digital image processing
PDF
Edge detection
PPTX
image segmentation image segmentation.pptx
PPTX
Edge detection
PPT
Chapter10_Segmentation.ppt
PDF
Biomedical engineering 20231023-segmentation-1.pdf
PPT
image-processing-husseina-ozigi-otaru.ppt
PPT
Chapter10 image segmentation
PPTX
Edge Detection algorithm and code
Module-5-1_230523_171754 (1).pdf
Lecture 06 - image processingcourse1.pptx
Computer vision - edge detection
IVP_segmentation ppt for image segmentation used in computer graphics
Fuzzy Logic Based Edge Detection
Edge Detection and Segmentation
MachineVision_Chapter5_Edge_Detection.pdf
Edges and lines
Lec06 edge
Image Segmentation by Professor Vipin Tyagi
08_Lecture -Chapter 10- Image Segmentation_Part I_Edge Detection.pptx
Edge Detection 2 digital image processing
Edge detection
image segmentation image segmentation.pptx
Edge detection
Chapter10_Segmentation.ppt
Biomedical engineering 20231023-segmentation-1.pdf
image-processing-husseina-ozigi-otaru.ppt
Chapter10 image segmentation
Edge Detection algorithm and code

More from Wael Sharba (20)

PDF
Project 8
PDF
Project 7
PDF
Project 6
PDF
Project 5
PDF
Project 4
PDF
Project 2
PDF
Project 1
PDF
Project 3
PDF
Project 9
PDF
Lecture 14
PDF
Lecture 13
PDF
Lecture 11
PDF
Lecture 12
PDF
Lecture 10
PDF
Lecture 9
PDF
Lecture 7
PDF
Lecture 6
PDF
Lecture 5
PDF
Lecture 4
PDF
Lecture 3
Project 8
Project 7
Project 6
Project 5
Project 4
Project 2
Project 1
Project 3
Project 9
Lecture 14
Lecture 13
Lecture 11
Lecture 12
Lecture 10
Lecture 9
Lecture 7
Lecture 6
Lecture 5
Lecture 4
Lecture 3

Recently uploaded (20)

PPTX
History, Philosophy and sociology of education (1).pptx
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PPTX
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
PPTX
B.Sc. DS Unit 2 Software Engineering.pptx
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PDF
My India Quiz Book_20210205121199924.pdf
PPTX
Unit 4 Computer Architecture Multicore Processor.pptx
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PDF
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
AI-driven educational solutions for real-life interventions in the Philippine...
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
PDF
International_Financial_Reporting_Standa.pdf
History, Philosophy and sociology of education (1).pptx
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
Environmental Education MCQ BD2EE - Share Source.pdf
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
B.Sc. DS Unit 2 Software Engineering.pptx
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
Introduction to pro and eukaryotes and differences.pptx
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
My India Quiz Book_20210205121199924.pdf
Unit 4 Computer Architecture Multicore Processor.pptx
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
AI-driven educational solutions for real-life interventions in the Philippine...
Cambridge-Practice-Tests-for-IELTS-12.docx
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
International_Financial_Reporting_Standa.pdf

Lecture 8

  • 1. SPATIAL DOMAIN FILTERING EDGE DETECTION CS-467 Digital Image Processing 1
  • 2. Edges • Edge pixels are pixels at which the intensity changes abruptly • Edges are sets of connected edge pixels • Often edges are called points of discontinuity of the intensity function • To detect edges, differentiation in a local neighborhood should be used 2
  • 3. Importance of Edge Detection • Edge detection is important for localization of image details, especially the smallest details • It can be used, for example, in non- destructive inspection, to localize possible defects; in medical imaging, to localize important details • Edge detection is also used in image segmentation – a process that partitions an image into disjoint regions corresponding to different textures 3
  • 4. High-Pass Filtering • In terms of filtering, edge detection is a spatial domain high-pass filtering • Differentiating an image, high-pass filters eliminate low and medium frequencies, passing and possibly enhancing high frequencies. 4
  • 5. Three Major Types of Intensity Change 5 Step Ramp Roof © 1992-2008 R.C. Gonzalez & R.E. Woods
  • 6. Derivatives of Digital Functions • The derivatives of a digital image function are defined in terms of differences. They have to meet the following requirements: • A 1st derivative 1) Must be 0 in areas of constant intensity 2) Must be nonzero at the onset of an intensity step or ramp; 3) Must be nonzero along ramps 6
  • 7. Derivatives of Digital Functions • The derivatives of a digital image function are defined in terms of differences. They have to meet the following requirements: • A 2nd derivative 1) Must be 0 in areas of constant intensity 2) Must be nonzero at the onset and end of an intensity step or ramp; 3) Must be zero along ramps of constant slope 7
  • 8. Derivatives of 1-D Digital Functions • A basic definition of the first-order derivative of the digital function • A basic definition of the second-order derivative of the digital function 8 ( ) ( )1 f f x f x x ∂ = + − ∂ ( )f x ( )f x ( ) ( )( ) ( ) ( )( ) ( ) ( ) ( ) 2 2 1 1 1 1 2 f f x f x f x f x x f x f x f x ∂ = + − − − − = ∂ = + + − −
  • 9. Derivatives of 1-D Digital Functions 9 © 1992-2008 R.C. Gonzalez & R.E. Woods
  • 10. Derivatives of 2-D Digital Functions • A basic definition of the first-order derivatives of the function • A basic definition of the second-order derivatives of the function 10 ( ) ( ) ( ) ( )1, , ; , 1 , f f f x y f x y f x y f x y x y ∂ ∂ = + − = + − ∂ ∂ ( ),f x y ( ) ( ) ( ) ( ) ( ) ( ) 2 2 2 2 1, 1, 2 , ; , 1 , 1 2 , f f x y f x y f x y x f f x y f x y f x y y ∂ = + + − − ∂ ∂ = + + − − ∂ ( ),f x y
  • 11. The Laplacian and Second Order Derivative Edge Detection • The Laplacian (as it is known from calculus and partial differential equations) is • Hence, Laplacian of the image intensity function (“Laplacian 1”) 11 ( ) 2 2 2 2 2 , f f f x y x y ∂ ∂ ∇ = + ∂ ∂ ( )f x ( ) ( ) ( ) ( ) ( ) ( ) 2 , 1, 1, , 1 , 1 4 , f x y f x y f x y f x y f x y f x y ∇ = + + − + + + + − −
  • 12. The Laplacian • A global edge detector must be spatially isotropic, it should not depend on any rotation of an image and particular gradient direction • To detect diagonal edges, we should involve the diagonal second-order derivatives (Laplacian 2) 12 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 2 , 1, 1, , 1 , 1 1, 1 1, 1 1, 1 1, 1 8 , f x y f x y f x y f x y f x y f x y f x y f x y f x y f x y ∇ = + + − + + + − + + − − + + − + − + + + + − − , f f x y y x ∂ ∂ ∂ ∂ ∂ ∂
  • 13. Laplacian Edge Detector • Laplacian 1 Laplacian 2 13 Downward Upward © 1992-2008 R.C. Gonzalez & R.E. Woods
  • 14. Laplacian Detector of Lines Oriented in Various Directions 14 © 1992-2008 R.C. Gonzalez & R.E. Woods
  • 15. First- and Second- Order Derivatives and Edge Detection • Laplace edge detectors are based on second- order derivatives • There are also edge detectors based on first- order derivatives • Second-order derivatives better detect edges corresponding to the smallest details, they also detect and enhance isolated pixels • First-order derivatives detect and possibly enhance the brightness jumps “as they are” 15
  • 16. First- and Second- Order Derivatives and Edge Detection 16 © 1992-2008 R.C. Gonzalez & R.E. Woods
  • 17. Distinction between First- and Second- Order Derivatives in Edge Detection 17 © 1992-2008 R.C. Gonzalez & R.E. Woods
  • 18. First-Order Derivatives in Edge Detection • First-order derivatives in image processing are implemented using the magnitude of the gradient • The magnitude (length) of vector is 18 ( ) x y f g x f grad f fg y ∂     ∂  ∇= = =  ∂    ∂ f∇ ( ) ( ) 2 2 , x y x yM x y mag f g g g g= ∇ = + ≈ +
  • 19. Gradient and Edge 19 © 1992-2008 R.C. Gonzalez & R.E. Woods
  • 20. First-Order Derivatives by Roberts (1965) 20 1 2 3 4 5 6 7 8 9 z z z z z z z z z           ( ) ( ) ( ) 9 5 8 6 9 5 8 6 ; , x yg z z g z z M x y z z z z =− =− ≈ − + − ( ) ( ) ( ) 8 5 6 5 8 5 8 5 ; , x yg z z g z z M x y z z z z =− =− ≈ − + − Robert’s derivatives and gradients Disadvantage: no center of symmetry
  • 21. First-Order Derivatives by Prewitt (1970) 21 1 2 3 4 5 6 7 8 9 z z z z z z z z z           ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 7 8 9 1 2 3 3 6 9 1 4 7 7 8 9 1 2 3 3 6 9 1 4 7 , x y f g z z z z z z x f g z z z z z z y M x y z z z z z z z z z z z z ∂ = = + + − + + ∂ ∂ = = + + − + + ∂ ≈ + + − + + + + + + − + +
  • 22. First-Order Derivatives by Sobel (1970) 22 1 2 3 4 5 6 7 8 9 z z z z z z z z z           ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 7 8 9 1 2 3 3 6 9 1 4 7 7 8 9 1 2 3 3 6 9 1 4 7 2 2 2 2 2 2 2 , 2 x y f g z z z z z z x f g z z z z z z y M x y z z z z z z z z z z z z ∂ = = + + − + + ∂ ∂ = = + + − + + ∂ ≈ + + − + + + + + + − + +
  • 23. Roberts, Prewitt, and Sobel masks 23 © 1992-2008 R.C. Gonzalez & R.E. Woods
  • 24. Some Disadvantages of Classical Edge Detectors • They do not differ (except Laplace) between upward (from “dark” to “bright”) and downward (from “bright” to “dark”) brightness jumps • This is resulted in “bold” (“thick”) edges where the same brightness jump can be detected twice • All of them (except Prewitt) give a preference to the pixel of interest (the symmetry center). This may help to suppress noise, to avoid its detection, but simultaneously some edges can be emphasized, while some other can be suppressed 24
  • 25. Nonlinear Edge Detectors • In fact, even Sobel and Prewitt edge detectors are nonlinear, because they operate with absolute values of gradients. |…| function is only piecewise-linear; thus, it is nonlinear. • Nonlinear edge detectors are based either on nonlinear operation applied to digital derivatives or nonlinear transformation of an image followed by some kind of differentiation 25
  • 26. Threshold Boolean Filtering • Let X be (M+1)-valued gray scale image • Let be a binary plane • Then filtering operation is determined by where F is the processing Boolean function, is a local window around a pixel of interest 26 ( ) 1 , if ( , ) ( , ) ; 1,..., 0 , otherwise k x i j k x i j k M ≥ = =  ( ) ( )( ) 1 , M k ij k XFy i j = = ∑ ( )k ijX
  • 27. Edge Detecting Boolean Functions • The Boolean function for detection of upward brightness jumps • The Boolean function for detection of downward brightness jumps 27 ( ) 1 2 3 4 5 6 5 1 2 3 4 6 7 8 9 7 8 9 &u x x x F f x x x x x x x x x x x x x x x     = = ∨ ∨ ∨ ∨ ∨ ∨ ∨      ( ) 1 2 3 4 5 6 5 1 2 3 4 6 7 8 9 7 8 9 &d x x x F f x x x x x x x x x x x x x x x     = = ∨ ∨ ∨ ∨ ∨ ∨ ∨     
  • 28. Edge Detecting Boolean Functions 28 1 1 1 0 0 1 1 0 1           0 0 0 0 1 1 1 1 1           Upward Edge passes through the center of the window, there is no downward edge Downward Edge passes through the center of the window, there is no upward edge
  • 29. TBF (Stack) Edge Detection Filter • Detection of upward brightness jumps is equivalent to • Detection of downward brightness jumps is equivalent to 29 ( ) ( ) ( )( )max , 1, 1 ,if 0 , 0, otherwise m f x y f x y m g x y = − ± ± > =   ( ) ( ) ( )( )max 1, 1 , ,if 0 , 0, otherwise m f x y f x y m g x y = ± ± − > =  
  • 30. TBF Edge Detection 30 35 210 100 112 120 80 100 221 220           35 210 100 112 120 80 100 221 220           Upward Edge pass through the center of the window, its intensity is 120-35=85 Downward Edge pass through the center of the window, its intensity is 221-120=101
  • 31. Edge Detection using Stack Filter • Simultaneous detection of downward and upward brightness jumps • This is resulted in “bold” (“thick”) edges 31 ( ) ( ) ( ), max , 1, 1g x y f x y f x y= − ± ±
  • 32. Image Break-up Into Binary Planes • Each intensity value in the range 0…255 is presented by one byte, which consists of 8 bits • Breaking up these bytes into bits, we break up the entire image into 8 binary planes 32 © 1992-2008 R.C. Gonzalez & R.E. Woods
  • 33. Precise Edge Detection • Algorithm: 1) Breaking up the image into binary planes; 2) Detection of edges using edge detecting Boolean function; 3) Assembling the resulting image from the binary planes 33
  • 34. Precise Edge Detection • Upward Edge Detecting Boolean function • Downward Edge Detecting Boolean function • “Global” Edge Detecting Boolean function 34 1 2 3 4 5 6 7 8 9 x x x f x x x x x x     =      5 1 2 3 4 6 7 8 9( )x x x x x x x x x∧ ∨ ∨ ∨ ∨ ∨ ∨ ∨ 5 1 2 3 4 6 7 8 9( )x x x x x x x x x∧ ∨ ∨ ∨ ∨ ∨ ∨ ∨ 1 2 3 4 5 6 7 8 9 x x x f x x x x x x     =      1 2 3 4 5 6 7 8 9 x x x f x x x x x x     =      ( )5 1 2 3 4 6 7 8 9& ( )x x x x x x x x x∨ ∨ ∨ ∨ ∨ ∨ ∨ ∨ 5 1 2 3 4 6 7 8 9&( )x x x x x x x x x∨ ∨ ∨ ∨ ∨ ∨ ∨ ∨
  • 35. Edged Segmentation using Precise Edge Detection • Edged Segmentation is edge detection with simultaneous emphasizing of areas with different textures bounded by edges • To make segmentation using precise edge detection, it is necessary to detect edges in some binary planes preserving some other binary planes unchanged. For example, a good segmentational effect can be achieved by detecting edges in binary planes 0,1,2,3,4,7 and preserving binary planes 5,6 unchanged 35
  • 36. Noise and Edge Detection • Noise prevents detecting clean edges because edge detectors don’t care of what is behind particular intensity jump – noise or useful detail 36 © 1992-2008 R.C. Gonzalez & R.E. Woods