SlideShare a Scribd company logo
Exploring Methods to Improve Edge Detection with
Canny Algorithm
A.Mehta, H.Lehri, P.Thakur & S.Tambe
January 2015
1 Introduction
1.1 Image as a Signal
1.2 Theory of Edge Detection
1.3 Edge Detector Types
1.3.1 Gradient Based Edge Detection
1.3.2 Second Ordered Derivative Based Edge Detection
1.3.3 The Canny Edge Detector
1.4 Problems with Standard Edge Detection Method
2 Literature Survey
3 Methods Explored
3.1 Recursive Method for Edge Detection
3.1.1 Basics of Recursion
3.1.2 Using Recursion with Canny Algorithm
3.2 Edge Filtering by determining Conditional Probability of a point being an Edge
3.2.1 Polynomial Regression
3.2.2 Edge Linking
3.2.3 Algorithm for the Edge Filtering Technique
3.3 Results
4 Future Work
5 Conclusion
CONTENT
INTRODUCTION
Edge detection is the process of finding the set of pixels that
represent the boundary of disjoint regions in an image.
Edge detection
INTRODUCTION
Edge detection is important for image segmentation, since many image
processing algorithms are first required to identify the objects and then
process them.
Image Medical Imaging
Finger print detection
Face recognition
Traffic control
processingpre-processing
Edge detection
INTRODUCTION
• Edge detection is not without its challenges
• The image on which the detection is carried out has noise, due to random
variation of brightness, color or electronic noise like
Gaussian noise, Salt pepper noise, Shot noise, Gradient noise etc..
• Noise leads to false edge detection
Gradient noise = False edges
Image as a Signal
• An Image is described as a function of x and y
• A captured image must be treated as a discrete signal rather than a
continuous functions since the image can be recorded on a 2D grid
• The conversion is done by a process called sampling
• Uniform rectangular sampling is the most common
Original Image Spectrum Sampled Image Spectrum
Ld(n, m) = L(n∆x, m∆y)
sinc(x) = sinc(x)/x
introduction
Theory of Edge Detection
• Difficulty: Changes in intensity occur over a wide range of scales in
an image and no single filter can optimally reduce noise at all
scales
• Reason: Physical phenomena that give rise to intensity changes like
illumination and surface reflectance are spatially localized
• Uncertainty Principle: The two requirements lie in different
domains, we cannot achieve both at the same time
Spatial
Domain
Frequency
Domain
Fourier
Transform
Inverse
Fourier
Transform
IlluminationSurface Reflectance
introduction
Theory of Edge Detection
• Possible solution
• Take local averages of the image at various
resolutions and then detect the changes in intensity that occur
at each of the resolutions.
• Determine the optimal smoothing filter to reduce the range of
scales over which the intensity changes take place
• There is only one distribution that optimizes this relationship
• Gaussian distribution:
𝐺(𝑥) =
1
𝜎(2𝜋)
1
2
𝑒
−𝑥2
2𝜎2
introduction
Intensity changes can be detected by either finding the maxima or minima
of the first derivative or finding zero crossings in the second derivative of
the image
Hence we can write it as:
f(x, y) = 𝐷2
( G(x, y) ∗ I(x, y) )
Gaussian
Kernel
Image
Second order directional derivative
Theory of Edge Detection introduction
Edge Detector Types
• Gradient Based
Detects edges by looking for
the maxima or minima of the
first derivate of the image
• Laplacian based
Detect edges by searching for
the zero crossing of the
second derivate of the image
introduction
Edge
Edge
Edge Detector Types
Gradient Based Edge Detection
Roberts Operator
𝐷 𝑥 =
1 0
0 −1
𝐷 𝑦 =
0 1
−1 0
Sobel Operator
𝐷 𝑥 =
−1 0 +1
−2 0 +2
−1 0 +1
𝐷 𝑦 =
−1 −2 +1
0 0 0
−1 +2 +1
Prewitt Operator
𝐷 𝑥 =
−1 0 +1
−1 0 +1
−1 0 +1
𝐷 𝑦 =
+1 +1 +1
0 0 0
−1 −1 −1
Filter out noise
Convolve Image in
horizontal & vertical
Direction using gradient
operators
Gaussian Operators used
For all pixels
If magnitude>threshold then pixel=edge
Else pixel ≠ edge
introduction
Edge Detector Types
Second Order Derivative Based Edge Detection
Filter out noise
Convolve Image in
using Laplacian
Kernel
Laplacian of Gaussian matrix
For all pixels
If 𝐷2
𝑐𝑜𝑛𝑣𝑜𝑙𝑣𝑒𝑑 𝑝𝑖𝑥𝑒𝑙 = 0 then pixel=edge
Else pixel ≠ edge
Marr Hildrith Operator
0 0
0 −1
−1 0 0
−2 −1 0
−1 −2
0
0
−1
0
16 −2 −1
−2
−1
−1 0
0 0
• Isotropic in nature
• Utilizes only one mask
• Cheaper to implement
introduction
Edge Detector Types
The Canny Edge Detector
Remove noise
using Gaussian
filter
first order
derivatives
of the
Image using
operators
like Sobel
operator
For every pixel
calculate
Non Maximal
suppression
For every pixel
Perform
hysteresis
thresholding
The process
Canny is Optimal because:
• Less sensitive to noise
• It removes streaking by using two thresholds 𝑡ℎ𝑖𝑔ℎ 𝑡𝑙𝑜𝑤
• Offers good localization of edges and utilizes gradient of the
edge to generate thin, one-pixel wide edges
introduction
Illumination when the
image is taken
introduction
Problems with Standard Edge Detection Method
(x-1,y+1) (x,y+1) (x+1,y+1)
(x-1,y) (x, y) (x+1,y)
(x-1,y-1) (x,y-1) (x+1,y-1)
Intensity difference
between two
neighboring pixels
Edge Detection Depends on
Smoothing to filter out
noise also spreads the
edges
introduction
Problems with Standard Edge Detection Method
Edge Detection Depends on
Edge linking that may lead to
detection of false edges
Difficult to generalize the
method of thresholding
introduction
Problems with Standard Edge Detection Method
How Canny deals with these problems
Canny Edge
Detection
• Adaptively sensitive to digital noise
• Detects sharper and thinner edges
• Used as a benchmark
LITERATURE SURVEY
Modern Non-Canny Approaches
Wavelet transform
• Similar to Canny’s Kernel
• Selectivity is high
• Difficult to select Wavelet functions
Mathematical Morphology
• Deng Caixia et al[13]. proposed a technique,
wherein they use 2 structural elements, one of
size 3x3 and the other of size 5x5 and orient them
along different directions
• Gives them two edge sets
that fuse into edge image
LITERATURE SURVEY
Research on Canny Edge Detector
T Rupalatha et al[15] & Qian Xu et al
Distributed Canny Edge detector on Field
Programmable Gate Array(FPGA) based architecture.
Ogawa K
Canny Edge Detection algorithm on CUDA(Compute
Unified Device Architecture)
LITERATURE SURVEY
Research on Canny Edge Detector
Philip Worthington
Canny Edge detector using Curvature Consistency
Ping Zhou et al[5]
Canny Edge Detection algorithm on Otsu method for
Adaptive Thresholding
LITERATURE SURVEY
Other Approaches
Aleksandar Jevtic and Bo Li[7
Ant Based Approach for adaptive edge detection
Piotr Dollar and C.Lawrence Zitnick[10]
Edge detection algorithm using Structured Forests
METHODS EXPLORED
Recursive Method for Edge Detection
Original Image Canny output for 300 x 300
Canny output for 400 x 400 Canny output for 600 x 600
Our Observation - Canny
seems to work better with
smaller size images
Our Approach –
• Recursively divide the image
into sub-images
• Apply Canny on sub-images
• Merge sub-outputs to obtain
result
METHODS EXPLORED
Recursive Method for Edge Detection
Our Observation - Canny seems to work better with smaller size images
Mathematical Reasoning
NxN Image
W
Gaussian Filter
Kernel
N −
W
2
N −
W
2
Convolutions required
METHODS EXPLORED
Recursive Method for Edge Detection
Our Observation - Canny seems to work better with smaller size images
Mathematical Reasoning
W
Gaussian Filter
Kernel
S −
W
2
S −
W
2
Convolutions required per block
Block size
S
METHODS EXPLORED
Recursive Method for Edge Detection
Our Observation - Canny seems to work better with smaller size images
Mathematical Reasoning
We have,
N
S
N
S
such blocks
Hence total number of convolutions S −
W
2
2 N
S
2
= N −
WN
2S
2
Since
N
S
> 1 number of operations have decreased
METHODS EXPLORED
Basics of Recursion
f(x)=
g x , if x satisfies the base case
a∗ f(x/b) + c otherwise
Problem can be divided into multiple independent problems(Image) unlike dynamic programming. Recursion is part
of the Divide and Conquer strategy. Recursion is usually of the following format:
T(n) = a ∗ T
𝑛
𝑏
+ O(nk
)
Time complexity of recursive algorithms is give as
The solution to this problem is given by the Master’s Theorem as:
T(n) =
O nlogba , If a > 𝑏 𝑘
O nk
. logn , If a = 𝑏 𝑘
O nk
, If a < 𝑏 𝑘
METHODS EXPLORED
Using Recursion with Canny Algorithm
EDGEDETECTION (Image)
1. Divide the image into four regions into Si, i ∈ {0, 1, 2, 3}
2. For Each Region do:
a) IF sizeof Si is less than Base Case:
i. Filter Si and Perform Canny Edge Detection on it
b) Else Call EDGEDETECTION(𝑺𝒊)
3. Join the results obtained from each region 𝑆𝑖
4. Return the joint Image
METHODS EXPLORED
Edge Filtering by determining Conditional Probability of a point being an Edge
Noise
and
Intensity
changes
Input image
Canny
No
unnecessary
edges
Edge detected image
Edge Filtering
By determining
conditional
probability of
points being on
an edge
Post Processing
Noise
and
Intensity
changes
Input image
Canny
Irrelevant
And
Small
edges
Edge detected image
Our Observation
Our Approach
METHODS EXPLORED
Edge Filtering by determining Conditional Probability of a point being an Edge
noise
and
intensity
changes
Input image
Canny
For every pixel detected by the Canny
algorithm:
1. Analyze Surrounding
2. Measure Order in the neighborhood of the
pixels
• Determine if the pixels can be aligned
along a particular line using regression
fitting
• Get conditional Probability of pixel
falling on the line
3. Probability whether the pixel is part of an
edge or not
4. Filter out pixels based on certain threshold
Post-Processing
No
unnecessary
edges
Edge detected image
METHODS EXPLORED
Edge Linking
In Global Processing the voting is done by points on a curve
y = mx + c or c = -xm+y
c and m are Variables
x and y are Parameters
To find he straight line that best fits given n-points, we can
work in the m-c domain instead of the x-y domain and
apply Hough transform.
The point through which maximum number of lines pass
through gives the m and c of the best fitting line.
METHODS EXPLORED
Edge Linking
In localized algorithm for each edge point, we find the approximate direction of the edge in one of the eight
directions (0o, 45o, 90o, 135o, 180o, 225o, 270o, 315o)
Canny List L = Edges Endpoints While is not empty
• Analyze the 8-neighborhood
of L0 and find the direction
(from the 8 directions) of the
edge
• If reflection(ir,jr) of Lk(i,j) is not
in the list L:
• Add (ir,jr) to List L
• Mark (ir,jr) as white
• Remove Lk from List L
END
METHODS EXPLORED
Edge Linking
Algorithm for Edge Filtering Technique
Canny For each point detected as an edge by Canny algorithm:
1. Analyze the neighborhood around the point.
Using regression, determine a line ax+b which
best fits all the points in the neighborhood which
are white. Once we determine a and b, we find
the number of points (x,y) for which y = ax+b. We
then compute Probability P(i,j).
2. Determine the probability Pr. If Pr > 0.5 the
we retain (i,j) else we set pixel (i,j) as black
Remove small
edges and perform
edge linking
RESULTS
Original
Image
Canny
Recursive
Canny
Edge Filtering
Original
Image
Canny
Recursive
Canny
Edge Filtering
Original
Image
Canny
Recursive
Canny
Edge Filtering
ANALYSIS OF RESULTS
Canny Recursive Canny
Region 1
Region 2
Region 1
Region 2
Good Hysteresis linking preserves edges Reduced scale of Hysteresis linking doesn't preserves
some edges
Recursive Canny helps us analyze Canny without hysteresis linking
ANALYSIS OF RESULTS
Canny Recursive Canny
Region 1
Region 2
Bad Hysteresis linking preserves noise Reduced scale of Hysteresis linking doesn't preserves
noise
Region 1
Region 2
Because linking at lower scales gives fewer false edges than linking on a large scale
Trade off between noise filtering and true edge filtering
ANALYSIS OF RESULTS
Effects of variable kernel size
Kernel size=5 Kernel size=7 Kernel size=9 Kernel size=11
Observations
Outlines (important edges) become more significant as kernel size increases
False Edges decrease with increase in kernel size
Loss of Actual Edges after size = 7
ANALYSIS OF RESULTS
Effects of variable recursion base case (block) size
Block size=8 Block size=16 Block size=32 Block size=64
Jittery and unsmooth output
Approaches to Regular Canny
ANALYSIS OF RESULTS
Optimal Kernel and Block size
block size of 32 and kernel size of
5 improves the quality of output
generated.
• Larger block size the performance suffers
• Smaller block size the recursion leads to a jittery
output with the edges appearing mismatched.
• Larger kernel size smoothen the image, but it
increases the time taken for convolving the image
with the kernel and hence may not b e useful for
practical purposes.
ANALYSIS OF RESULTS
Canny Probabilistic Edge Filtering
Region 1
Region 2
Region 1
Region 2
• No Significant differences since it uses original Canny image used for edge linking
• Marked regions are maintained since they satisfactorily fit on a line unlike in recursive canny
• Noise density is reduced to some extent
ANALYSIS OF RESULTS
Canny Probabilistic Edge Filtering
Noise removal depends on minimum edge length and hence not a fault of refinement process
Region 1
Region 2
Region 1
Region 2
ANALYSIS OF RESULTS
Effects of variable length thresholds
Canny Output Length threshold=1 Length threshold=5 Length threshold=10
Significant-Edge Retention
• However after linking the edges result is similar to Canny
• This is a fault of the linking algorithm as the original Canny is
used for linking broken edges
ANALYSIS OF RESULTS
Effects of variable probability thresholds
Canny Output Probability threshold= 0.5 Probability threshold= 0.6 Probability threshold=0.7
Strong step edges (lines)are retained always, showing the algorithm returns high probability for nearly straight lines
Number of edges decreases
ANALYSIS OF RESULTS
Effects of variable truth values
Canny Output Canny Truth value = 0.4 Canny Truth value = 0.6 Canny Truth value = 0.7
True Edges are lost
False edges increase
• Strong step edges (lines)are not retained
• Because we assume the output of the Canny algorithm itself has very small chance of being true and hence reduces
the overall probability
ANALYSIS OF RESULTS
Effects of variable window size
Canny Output Window Size = 4 Window Size = 14 Window Size = 18
Ineffective neighborhood judgment
Increased processing time & lines
integrate to curves
ANALYSIS OF RESULTS
Optimal probability threshold and truth value and window size
probability threshold = 0.5
truth value = 0.7
window size = 6
• Configuration must be chosen carefully
• Absolute Optimal configuration is not possible
FUTURE SCOPE
• Applying Tsalli’s model
• Color Space Research
• Machine Learning Approach
• Adaptive Thresholding Using
Image Histograms
• 2D Entropy and Probability
application
• Texture Analysis
Thank You

More Related Content

What's hot

ImageProcessing10-Segmentation(Thresholding) (1).ppt
ImageProcessing10-Segmentation(Thresholding) (1).pptImageProcessing10-Segmentation(Thresholding) (1).ppt
ImageProcessing10-Segmentation(Thresholding) (1).ppt
VikramBarapatre2
 
Lect 02 first portion
Lect 02   first portionLect 02   first portion
Lect 02 first portion
Moe Moe Myint
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filters
A B Shinde
 
Active contour segmentation
Active contour segmentationActive contour segmentation
Active contour segmentation
Nishant Jain
 
Object Detection & Tracking
Object Detection & TrackingObject Detection & Tracking
Object Detection & Tracking
Akshay Gujarathi
 
Spatial domain and filtering
Spatial domain and filteringSpatial domain and filtering
Spatial domain and filtering
University of Potsdam
 
Chapter10 image segmentation
Chapter10 image segmentationChapter10 image segmentation
Chapter10 image segmentation
asodariyabhavesh
 
Color Image Processing: Basics
Color Image Processing: BasicsColor Image Processing: Basics
Color Image Processing: Basics
A B Shinde
 
Image noise reduction
Image noise reductionImage noise reduction
Image noise reduction
Jksuryawanshi
 
Edge detection
Edge detectionEdge detection
Edge detection
Jyoti Dhall
 
Object tracking
Object trackingObject tracking
Object tracking
Sri vidhya k
 
Image enhancement in the spatial domain1
Image enhancement in the spatial domain1Image enhancement in the spatial domain1
Image enhancement in the spatial domain1
shabanam tamboli
 
Image segmentation techniques
Image segmentation techniquesImage segmentation techniques
Image segmentation techniques
gmidhubala
 
Image Restoration (Order Statistics Filters)
Image Restoration (Order Statistics Filters)Image Restoration (Order Statistics Filters)
Image Restoration (Order Statistics Filters)
Kalyan Acharjya
 
Image sampling and quantization
Image sampling and quantizationImage sampling and quantization
Image sampling and quantization
BCET, Balasore
 
Digital image processing
Digital image processingDigital image processing
Digital image processing
Avni Bindal
 
Content based image retrieval(cbir)
Content based image retrieval(cbir)Content based image retrieval(cbir)
Content based image retrieval(cbir)paddu123
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
Maneesha Krishnan
 
COM2304: Digital Image Fundamentals - I
COM2304: Digital Image Fundamentals - I COM2304: Digital Image Fundamentals - I
COM2304: Digital Image Fundamentals - I
Hemantha Kulathilake
 

What's hot (20)

ImageProcessing10-Segmentation(Thresholding) (1).ppt
ImageProcessing10-Segmentation(Thresholding) (1).pptImageProcessing10-Segmentation(Thresholding) (1).ppt
ImageProcessing10-Segmentation(Thresholding) (1).ppt
 
Lect 02 first portion
Lect 02   first portionLect 02   first portion
Lect 02 first portion
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filters
 
Active contour segmentation
Active contour segmentationActive contour segmentation
Active contour segmentation
 
Object Detection & Tracking
Object Detection & TrackingObject Detection & Tracking
Object Detection & Tracking
 
Spatial domain and filtering
Spatial domain and filteringSpatial domain and filtering
Spatial domain and filtering
 
Chapter10 image segmentation
Chapter10 image segmentationChapter10 image segmentation
Chapter10 image segmentation
 
Color Image Processing: Basics
Color Image Processing: BasicsColor Image Processing: Basics
Color Image Processing: Basics
 
Image noise reduction
Image noise reductionImage noise reduction
Image noise reduction
 
Edge detection
Edge detectionEdge detection
Edge detection
 
Object tracking
Object trackingObject tracking
Object tracking
 
Image enhancement in the spatial domain1
Image enhancement in the spatial domain1Image enhancement in the spatial domain1
Image enhancement in the spatial domain1
 
Image Segmentation
 Image Segmentation Image Segmentation
Image Segmentation
 
Image segmentation techniques
Image segmentation techniquesImage segmentation techniques
Image segmentation techniques
 
Image Restoration (Order Statistics Filters)
Image Restoration (Order Statistics Filters)Image Restoration (Order Statistics Filters)
Image Restoration (Order Statistics Filters)
 
Image sampling and quantization
Image sampling and quantizationImage sampling and quantization
Image sampling and quantization
 
Digital image processing
Digital image processingDigital image processing
Digital image processing
 
Content based image retrieval(cbir)
Content based image retrieval(cbir)Content based image retrieval(cbir)
Content based image retrieval(cbir)
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
COM2304: Digital Image Fundamentals - I
COM2304: Digital Image Fundamentals - I COM2304: Digital Image Fundamentals - I
COM2304: Digital Image Fundamentals - I
 

Similar to Exploring Methods to Improve Edge Detection with Canny Algorithm

Real time Canny edge detection
Real time Canny edge detectionReal time Canny edge detection
Real time Canny edge detection
Shashank Kapoor
 
denoising.pptx
denoising.pptxdenoising.pptx
denoising.pptx
8885684828
 
PPT s06-machine vision-s2
PPT s06-machine vision-s2PPT s06-machine vision-s2
PPT s06-machine vision-s2
Binus Online Learning
 
Fuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge DetectionFuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge Detection
Dawn Raider Gupta
 
A010110104
A010110104A010110104
A010110104
IOSR Journals
 
Algorithm for the Comparison of Different Types of First Order Edge Detection...
Algorithm for the Comparison of Different Types of First Order Edge Detection...Algorithm for the Comparison of Different Types of First Order Edge Detection...
Algorithm for the Comparison of Different Types of First Order Edge Detection...
IOSR Journals
 
EDGE DETECTION
EDGE DETECTIONEDGE DETECTION
EDGE DETECTION
VIKAS SINGH BHADOURIA
 
Edge Drawing - An Heuristic Approach to Robust Real-Time Edge Detection
Edge Drawing - An Heuristic Approach to Robust Real-Time Edge DetectionEdge Drawing - An Heuristic Approach to Robust Real-Time Edge Detection
Edge Drawing - An Heuristic Approach to Robust Real-Time Edge Detection
cihantopal2
 
International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)
IJERD Editor
 
2-Dimensional Wavelet pre-processing to extract IC-Pin information for disarr...
2-Dimensional Wavelet pre-processing to extract IC-Pin information for disarr...2-Dimensional Wavelet pre-processing to extract IC-Pin information for disarr...
2-Dimensional Wavelet pre-processing to extract IC-Pin information for disarr...
IOSR Journals
 
A NOBEL HYBRID APPROACH FOR EDGE DETECTION
A NOBEL HYBRID APPROACH FOR EDGE  DETECTIONA NOBEL HYBRID APPROACH FOR EDGE  DETECTION
A NOBEL HYBRID APPROACH FOR EDGE DETECTION
ijcses
 
Comparative Analysis of Common Edge Detection Algorithms using Pre-processing...
Comparative Analysis of Common Edge Detection Algorithms using Pre-processing...Comparative Analysis of Common Edge Detection Algorithms using Pre-processing...
Comparative Analysis of Common Edge Detection Algorithms using Pre-processing...
IJECEIAES
 
ADAPTIVE FILTER FOR DENOISING 3D DATA CAPTURED BY DEPTH SENSORS
ADAPTIVE FILTER FOR DENOISING 3D DATA CAPTURED BY DEPTH SENSORSADAPTIVE FILTER FOR DENOISING 3D DATA CAPTURED BY DEPTH SENSORS
ADAPTIVE FILTER FOR DENOISING 3D DATA CAPTURED BY DEPTH SENSORS
Soma Boubou
 
Flash Photography and toonification
Flash Photography and toonificationFlash Photography and toonification
Flash Photography and toonification
Satya Sahoo
 
Denoising and Edge Detection Using Sobelmethod
Denoising and Edge Detection Using SobelmethodDenoising and Edge Detection Using Sobelmethod
Denoising and Edge Detection Using Sobelmethod
IJMER
 
Object detection at night
Object detection at nightObject detection at night
Object detection at night
Sanjay Crúzé
 
Defocus magnification
Defocus magnificationDefocus magnification
Defocus magnification
Debaleena Chattopadhyay
 
AN ENHANCED BLOCK BASED EDGE DETECTION TECHNIQUE USING HYSTERESIS THRESHOLDING
AN ENHANCED BLOCK BASED EDGE DETECTION TECHNIQUE USING HYSTERESIS THRESHOLDING AN ENHANCED BLOCK BASED EDGE DETECTION TECHNIQUE USING HYSTERESIS THRESHOLDING
AN ENHANCED BLOCK BASED EDGE DETECTION TECHNIQUE USING HYSTERESIS THRESHOLDING
sipij
 
ALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEY
ALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEYALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEY
ALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEY
sipij
 

Similar to Exploring Methods to Improve Edge Detection with Canny Algorithm (20)

Real time Canny edge detection
Real time Canny edge detectionReal time Canny edge detection
Real time Canny edge detection
 
Edge Detection
Edge Detection Edge Detection
Edge Detection
 
denoising.pptx
denoising.pptxdenoising.pptx
denoising.pptx
 
PPT s06-machine vision-s2
PPT s06-machine vision-s2PPT s06-machine vision-s2
PPT s06-machine vision-s2
 
Fuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge DetectionFuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge Detection
 
A010110104
A010110104A010110104
A010110104
 
Algorithm for the Comparison of Different Types of First Order Edge Detection...
Algorithm for the Comparison of Different Types of First Order Edge Detection...Algorithm for the Comparison of Different Types of First Order Edge Detection...
Algorithm for the Comparison of Different Types of First Order Edge Detection...
 
EDGE DETECTION
EDGE DETECTIONEDGE DETECTION
EDGE DETECTION
 
Edge Drawing - An Heuristic Approach to Robust Real-Time Edge Detection
Edge Drawing - An Heuristic Approach to Robust Real-Time Edge DetectionEdge Drawing - An Heuristic Approach to Robust Real-Time Edge Detection
Edge Drawing - An Heuristic Approach to Robust Real-Time Edge Detection
 
International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)
 
2-Dimensional Wavelet pre-processing to extract IC-Pin information for disarr...
2-Dimensional Wavelet pre-processing to extract IC-Pin information for disarr...2-Dimensional Wavelet pre-processing to extract IC-Pin information for disarr...
2-Dimensional Wavelet pre-processing to extract IC-Pin information for disarr...
 
A NOBEL HYBRID APPROACH FOR EDGE DETECTION
A NOBEL HYBRID APPROACH FOR EDGE  DETECTIONA NOBEL HYBRID APPROACH FOR EDGE  DETECTION
A NOBEL HYBRID APPROACH FOR EDGE DETECTION
 
Comparative Analysis of Common Edge Detection Algorithms using Pre-processing...
Comparative Analysis of Common Edge Detection Algorithms using Pre-processing...Comparative Analysis of Common Edge Detection Algorithms using Pre-processing...
Comparative Analysis of Common Edge Detection Algorithms using Pre-processing...
 
ADAPTIVE FILTER FOR DENOISING 3D DATA CAPTURED BY DEPTH SENSORS
ADAPTIVE FILTER FOR DENOISING 3D DATA CAPTURED BY DEPTH SENSORSADAPTIVE FILTER FOR DENOISING 3D DATA CAPTURED BY DEPTH SENSORS
ADAPTIVE FILTER FOR DENOISING 3D DATA CAPTURED BY DEPTH SENSORS
 
Flash Photography and toonification
Flash Photography and toonificationFlash Photography and toonification
Flash Photography and toonification
 
Denoising and Edge Detection Using Sobelmethod
Denoising and Edge Detection Using SobelmethodDenoising and Edge Detection Using Sobelmethod
Denoising and Edge Detection Using Sobelmethod
 
Object detection at night
Object detection at nightObject detection at night
Object detection at night
 
Defocus magnification
Defocus magnificationDefocus magnification
Defocus magnification
 
AN ENHANCED BLOCK BASED EDGE DETECTION TECHNIQUE USING HYSTERESIS THRESHOLDING
AN ENHANCED BLOCK BASED EDGE DETECTION TECHNIQUE USING HYSTERESIS THRESHOLDING AN ENHANCED BLOCK BASED EDGE DETECTION TECHNIQUE USING HYSTERESIS THRESHOLDING
AN ENHANCED BLOCK BASED EDGE DETECTION TECHNIQUE USING HYSTERESIS THRESHOLDING
 
ALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEY
ALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEYALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEY
ALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEY
 

Exploring Methods to Improve Edge Detection with Canny Algorithm

  • 1. Exploring Methods to Improve Edge Detection with Canny Algorithm A.Mehta, H.Lehri, P.Thakur & S.Tambe January 2015
  • 2. 1 Introduction 1.1 Image as a Signal 1.2 Theory of Edge Detection 1.3 Edge Detector Types 1.3.1 Gradient Based Edge Detection 1.3.2 Second Ordered Derivative Based Edge Detection 1.3.3 The Canny Edge Detector 1.4 Problems with Standard Edge Detection Method 2 Literature Survey 3 Methods Explored 3.1 Recursive Method for Edge Detection 3.1.1 Basics of Recursion 3.1.2 Using Recursion with Canny Algorithm 3.2 Edge Filtering by determining Conditional Probability of a point being an Edge 3.2.1 Polynomial Regression 3.2.2 Edge Linking 3.2.3 Algorithm for the Edge Filtering Technique 3.3 Results 4 Future Work 5 Conclusion CONTENT
  • 3. INTRODUCTION Edge detection is the process of finding the set of pixels that represent the boundary of disjoint regions in an image. Edge detection
  • 4. INTRODUCTION Edge detection is important for image segmentation, since many image processing algorithms are first required to identify the objects and then process them. Image Medical Imaging Finger print detection Face recognition Traffic control processingpre-processing Edge detection
  • 5. INTRODUCTION • Edge detection is not without its challenges • The image on which the detection is carried out has noise, due to random variation of brightness, color or electronic noise like Gaussian noise, Salt pepper noise, Shot noise, Gradient noise etc.. • Noise leads to false edge detection Gradient noise = False edges
  • 6. Image as a Signal • An Image is described as a function of x and y • A captured image must be treated as a discrete signal rather than a continuous functions since the image can be recorded on a 2D grid • The conversion is done by a process called sampling • Uniform rectangular sampling is the most common Original Image Spectrum Sampled Image Spectrum Ld(n, m) = L(n∆x, m∆y) sinc(x) = sinc(x)/x introduction
  • 7. Theory of Edge Detection • Difficulty: Changes in intensity occur over a wide range of scales in an image and no single filter can optimally reduce noise at all scales • Reason: Physical phenomena that give rise to intensity changes like illumination and surface reflectance are spatially localized • Uncertainty Principle: The two requirements lie in different domains, we cannot achieve both at the same time Spatial Domain Frequency Domain Fourier Transform Inverse Fourier Transform IlluminationSurface Reflectance introduction
  • 8. Theory of Edge Detection • Possible solution • Take local averages of the image at various resolutions and then detect the changes in intensity that occur at each of the resolutions. • Determine the optimal smoothing filter to reduce the range of scales over which the intensity changes take place • There is only one distribution that optimizes this relationship • Gaussian distribution: 𝐺(𝑥) = 1 𝜎(2𝜋) 1 2 𝑒 −𝑥2 2𝜎2 introduction
  • 9. Intensity changes can be detected by either finding the maxima or minima of the first derivative or finding zero crossings in the second derivative of the image Hence we can write it as: f(x, y) = 𝐷2 ( G(x, y) ∗ I(x, y) ) Gaussian Kernel Image Second order directional derivative Theory of Edge Detection introduction
  • 10. Edge Detector Types • Gradient Based Detects edges by looking for the maxima or minima of the first derivate of the image • Laplacian based Detect edges by searching for the zero crossing of the second derivate of the image introduction Edge Edge
  • 11. Edge Detector Types Gradient Based Edge Detection Roberts Operator 𝐷 𝑥 = 1 0 0 −1 𝐷 𝑦 = 0 1 −1 0 Sobel Operator 𝐷 𝑥 = −1 0 +1 −2 0 +2 −1 0 +1 𝐷 𝑦 = −1 −2 +1 0 0 0 −1 +2 +1 Prewitt Operator 𝐷 𝑥 = −1 0 +1 −1 0 +1 −1 0 +1 𝐷 𝑦 = +1 +1 +1 0 0 0 −1 −1 −1 Filter out noise Convolve Image in horizontal & vertical Direction using gradient operators Gaussian Operators used For all pixels If magnitude>threshold then pixel=edge Else pixel ≠ edge introduction
  • 12. Edge Detector Types Second Order Derivative Based Edge Detection Filter out noise Convolve Image in using Laplacian Kernel Laplacian of Gaussian matrix For all pixels If 𝐷2 𝑐𝑜𝑛𝑣𝑜𝑙𝑣𝑒𝑑 𝑝𝑖𝑥𝑒𝑙 = 0 then pixel=edge Else pixel ≠ edge Marr Hildrith Operator 0 0 0 −1 −1 0 0 −2 −1 0 −1 −2 0 0 −1 0 16 −2 −1 −2 −1 −1 0 0 0 • Isotropic in nature • Utilizes only one mask • Cheaper to implement introduction
  • 13. Edge Detector Types The Canny Edge Detector Remove noise using Gaussian filter first order derivatives of the Image using operators like Sobel operator For every pixel calculate Non Maximal suppression For every pixel Perform hysteresis thresholding The process Canny is Optimal because: • Less sensitive to noise • It removes streaking by using two thresholds 𝑡ℎ𝑖𝑔ℎ 𝑡𝑙𝑜𝑤 • Offers good localization of edges and utilizes gradient of the edge to generate thin, one-pixel wide edges introduction
  • 14. Illumination when the image is taken introduction Problems with Standard Edge Detection Method (x-1,y+1) (x,y+1) (x+1,y+1) (x-1,y) (x, y) (x+1,y) (x-1,y-1) (x,y-1) (x+1,y-1) Intensity difference between two neighboring pixels Edge Detection Depends on Smoothing to filter out noise also spreads the edges
  • 15. introduction Problems with Standard Edge Detection Method Edge Detection Depends on Edge linking that may lead to detection of false edges Difficult to generalize the method of thresholding
  • 16. introduction Problems with Standard Edge Detection Method How Canny deals with these problems Canny Edge Detection • Adaptively sensitive to digital noise • Detects sharper and thinner edges • Used as a benchmark
  • 17. LITERATURE SURVEY Modern Non-Canny Approaches Wavelet transform • Similar to Canny’s Kernel • Selectivity is high • Difficult to select Wavelet functions Mathematical Morphology • Deng Caixia et al[13]. proposed a technique, wherein they use 2 structural elements, one of size 3x3 and the other of size 5x5 and orient them along different directions • Gives them two edge sets that fuse into edge image
  • 18. LITERATURE SURVEY Research on Canny Edge Detector T Rupalatha et al[15] & Qian Xu et al Distributed Canny Edge detector on Field Programmable Gate Array(FPGA) based architecture. Ogawa K Canny Edge Detection algorithm on CUDA(Compute Unified Device Architecture)
  • 19. LITERATURE SURVEY Research on Canny Edge Detector Philip Worthington Canny Edge detector using Curvature Consistency Ping Zhou et al[5] Canny Edge Detection algorithm on Otsu method for Adaptive Thresholding
  • 20. LITERATURE SURVEY Other Approaches Aleksandar Jevtic and Bo Li[7 Ant Based Approach for adaptive edge detection Piotr Dollar and C.Lawrence Zitnick[10] Edge detection algorithm using Structured Forests
  • 21. METHODS EXPLORED Recursive Method for Edge Detection Original Image Canny output for 300 x 300 Canny output for 400 x 400 Canny output for 600 x 600 Our Observation - Canny seems to work better with smaller size images Our Approach – • Recursively divide the image into sub-images • Apply Canny on sub-images • Merge sub-outputs to obtain result
  • 22. METHODS EXPLORED Recursive Method for Edge Detection Our Observation - Canny seems to work better with smaller size images Mathematical Reasoning NxN Image W Gaussian Filter Kernel N − W 2 N − W 2 Convolutions required
  • 23. METHODS EXPLORED Recursive Method for Edge Detection Our Observation - Canny seems to work better with smaller size images Mathematical Reasoning W Gaussian Filter Kernel S − W 2 S − W 2 Convolutions required per block Block size S
  • 24. METHODS EXPLORED Recursive Method for Edge Detection Our Observation - Canny seems to work better with smaller size images Mathematical Reasoning We have, N S N S such blocks Hence total number of convolutions S − W 2 2 N S 2 = N − WN 2S 2 Since N S > 1 number of operations have decreased
  • 25. METHODS EXPLORED Basics of Recursion f(x)= g x , if x satisfies the base case a∗ f(x/b) + c otherwise Problem can be divided into multiple independent problems(Image) unlike dynamic programming. Recursion is part of the Divide and Conquer strategy. Recursion is usually of the following format: T(n) = a ∗ T 𝑛 𝑏 + O(nk ) Time complexity of recursive algorithms is give as The solution to this problem is given by the Master’s Theorem as: T(n) = O nlogba , If a > 𝑏 𝑘 O nk . logn , If a = 𝑏 𝑘 O nk , If a < 𝑏 𝑘
  • 26. METHODS EXPLORED Using Recursion with Canny Algorithm EDGEDETECTION (Image) 1. Divide the image into four regions into Si, i ∈ {0, 1, 2, 3} 2. For Each Region do: a) IF sizeof Si is less than Base Case: i. Filter Si and Perform Canny Edge Detection on it b) Else Call EDGEDETECTION(𝑺𝒊) 3. Join the results obtained from each region 𝑆𝑖 4. Return the joint Image
  • 27. METHODS EXPLORED Edge Filtering by determining Conditional Probability of a point being an Edge Noise and Intensity changes Input image Canny No unnecessary edges Edge detected image Edge Filtering By determining conditional probability of points being on an edge Post Processing Noise and Intensity changes Input image Canny Irrelevant And Small edges Edge detected image Our Observation Our Approach
  • 28. METHODS EXPLORED Edge Filtering by determining Conditional Probability of a point being an Edge noise and intensity changes Input image Canny For every pixel detected by the Canny algorithm: 1. Analyze Surrounding 2. Measure Order in the neighborhood of the pixels • Determine if the pixels can be aligned along a particular line using regression fitting • Get conditional Probability of pixel falling on the line 3. Probability whether the pixel is part of an edge or not 4. Filter out pixels based on certain threshold Post-Processing No unnecessary edges Edge detected image
  • 29.
  • 30.
  • 31.
  • 32.
  • 33. METHODS EXPLORED Edge Linking In Global Processing the voting is done by points on a curve y = mx + c or c = -xm+y c and m are Variables x and y are Parameters To find he straight line that best fits given n-points, we can work in the m-c domain instead of the x-y domain and apply Hough transform. The point through which maximum number of lines pass through gives the m and c of the best fitting line.
  • 34. METHODS EXPLORED Edge Linking In localized algorithm for each edge point, we find the approximate direction of the edge in one of the eight directions (0o, 45o, 90o, 135o, 180o, 225o, 270o, 315o) Canny List L = Edges Endpoints While is not empty • Analyze the 8-neighborhood of L0 and find the direction (from the 8 directions) of the edge • If reflection(ir,jr) of Lk(i,j) is not in the list L: • Add (ir,jr) to List L • Mark (ir,jr) as white • Remove Lk from List L END
  • 35. METHODS EXPLORED Edge Linking Algorithm for Edge Filtering Technique Canny For each point detected as an edge by Canny algorithm: 1. Analyze the neighborhood around the point. Using regression, determine a line ax+b which best fits all the points in the neighborhood which are white. Once we determine a and b, we find the number of points (x,y) for which y = ax+b. We then compute Probability P(i,j). 2. Determine the probability Pr. If Pr > 0.5 the we retain (i,j) else we set pixel (i,j) as black Remove small edges and perform edge linking
  • 39. ANALYSIS OF RESULTS Canny Recursive Canny Region 1 Region 2 Region 1 Region 2 Good Hysteresis linking preserves edges Reduced scale of Hysteresis linking doesn't preserves some edges Recursive Canny helps us analyze Canny without hysteresis linking
  • 40. ANALYSIS OF RESULTS Canny Recursive Canny Region 1 Region 2 Bad Hysteresis linking preserves noise Reduced scale of Hysteresis linking doesn't preserves noise Region 1 Region 2 Because linking at lower scales gives fewer false edges than linking on a large scale Trade off between noise filtering and true edge filtering
  • 41. ANALYSIS OF RESULTS Effects of variable kernel size Kernel size=5 Kernel size=7 Kernel size=9 Kernel size=11 Observations Outlines (important edges) become more significant as kernel size increases False Edges decrease with increase in kernel size Loss of Actual Edges after size = 7
  • 42. ANALYSIS OF RESULTS Effects of variable recursion base case (block) size Block size=8 Block size=16 Block size=32 Block size=64 Jittery and unsmooth output Approaches to Regular Canny
  • 43. ANALYSIS OF RESULTS Optimal Kernel and Block size block size of 32 and kernel size of 5 improves the quality of output generated. • Larger block size the performance suffers • Smaller block size the recursion leads to a jittery output with the edges appearing mismatched. • Larger kernel size smoothen the image, but it increases the time taken for convolving the image with the kernel and hence may not b e useful for practical purposes.
  • 44. ANALYSIS OF RESULTS Canny Probabilistic Edge Filtering Region 1 Region 2 Region 1 Region 2 • No Significant differences since it uses original Canny image used for edge linking • Marked regions are maintained since they satisfactorily fit on a line unlike in recursive canny • Noise density is reduced to some extent
  • 45. ANALYSIS OF RESULTS Canny Probabilistic Edge Filtering Noise removal depends on minimum edge length and hence not a fault of refinement process Region 1 Region 2 Region 1 Region 2
  • 46. ANALYSIS OF RESULTS Effects of variable length thresholds Canny Output Length threshold=1 Length threshold=5 Length threshold=10 Significant-Edge Retention • However after linking the edges result is similar to Canny • This is a fault of the linking algorithm as the original Canny is used for linking broken edges
  • 47. ANALYSIS OF RESULTS Effects of variable probability thresholds Canny Output Probability threshold= 0.5 Probability threshold= 0.6 Probability threshold=0.7 Strong step edges (lines)are retained always, showing the algorithm returns high probability for nearly straight lines Number of edges decreases
  • 48. ANALYSIS OF RESULTS Effects of variable truth values Canny Output Canny Truth value = 0.4 Canny Truth value = 0.6 Canny Truth value = 0.7 True Edges are lost False edges increase • Strong step edges (lines)are not retained • Because we assume the output of the Canny algorithm itself has very small chance of being true and hence reduces the overall probability
  • 49. ANALYSIS OF RESULTS Effects of variable window size Canny Output Window Size = 4 Window Size = 14 Window Size = 18 Ineffective neighborhood judgment Increased processing time & lines integrate to curves
  • 50. ANALYSIS OF RESULTS Optimal probability threshold and truth value and window size probability threshold = 0.5 truth value = 0.7 window size = 6 • Configuration must be chosen carefully • Absolute Optimal configuration is not possible
  • 51. FUTURE SCOPE • Applying Tsalli’s model • Color Space Research • Machine Learning Approach • Adaptive Thresholding Using Image Histograms • 2D Entropy and Probability application • Texture Analysis