![Page 1: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/1.jpg)
CS-F441: SELECTED TOPICS FROM COMPUTER
SCIENCE (DEEP LEARNING FOR NLP & CV)
Lecture-KT-07: Edge Detection
Dr. Kamlesh Tiwari,Assistant Professor,
Department of Computer Science and Information Systems,BITS Pilani, Rajasthan-333031 INDIA
Oct 25, 2019 (Campus @ BITS-Pilani July-Dec 2019)
![Page 2: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/2.jpg)
ImageGrayscale image can be considered as a function f : R2 → R
Being digital adds quantization and sampling.
We may apply operatorson this function
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 2 / 25
![Page 3: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/3.jpg)
ImageGrayscale image can be considered as a function f : R2 → R
Being digital adds quantization and sampling. We may apply operatorson this function
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 2 / 25
![Page 4: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/4.jpg)
ImageGrayscale image can be considered as a function f : R2 → R
Being digital adds quantization and sampling. We may apply operatorson this function
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 2 / 25
![Page 5: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/5.jpg)
Linear filtering
Use Kernal/Mask/FilterTo replace each pixel by a linear combination of its neighbors
Cross-correlationG[i, j] =
∑ku=−k
∑kv=−k h[u, v ]f [i + u, j + v ]
G = H ⊗ F
ConvolutionG[i, j] =
∑ku=−k
∑kv=−k h[u, v ]f [i − u, j − v ]
G = H × F
Convolution is commutative and associative
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 3 / 25
![Page 6: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/6.jpg)
Linear filtering
Use Kernal/Mask/FilterTo replace each pixel by a linear combination of its neighbors
Cross-correlationG[i, j] =
∑ku=−k
∑kv=−k h[u, v ]f [i + u, j + v ]
G = H ⊗ F
ConvolutionG[i, j] =
∑ku=−k
∑kv=−k h[u, v ]f [i − u, j − v ]
G = H × F
Convolution is commutative and associative
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 3 / 25
![Page 7: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/7.jpg)
Linear filtering
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 4 / 25
![Page 8: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/8.jpg)
Linear filtering
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 4 / 25
![Page 9: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/9.jpg)
Linear filtering
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 4 / 25
![Page 10: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/10.jpg)
Linear filtering
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 4 / 25
![Page 11: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/11.jpg)
Linear filtering
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 4 / 25
![Page 12: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/12.jpg)
Gaussian filter
Gσ =1
2πσ2 e− x2+y2
2σ2
Act as low-pass filter as it removes high-frequency components.Convolution with self is another Gaussian.
Convolving two times with Gaussian kernel of σ width is equivalent toConvoluting once with Gaussian kernel of
√2σ width
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 5 / 25
![Page 13: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/13.jpg)
Gaussian filter
Gσ =1
2πσ2 e− x2+y2
2σ2
Act as low-pass filter as it removes high-frequency components.Convolution with self is another Gaussian.
Convolving two times with Gaussian kernel of σ width is equivalent toConvoluting once with Gaussian kernel of
√2σ width
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 5 / 25
![Page 14: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/14.jpg)
Sharpening
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 6 / 25
![Page 15: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/15.jpg)
Sharpening Filter
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 7 / 25
![Page 16: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/16.jpg)
Edge detection
Image is converted into a set ofcurves.
Gets salient features of thesceneCompact than pixels
Edges are caused by a variety of factors
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 8 / 25
![Page 17: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/17.jpg)
Edge detection
Image is converted into a set ofcurves.
Gets salient features of thesceneCompact than pixels
Edges are caused by a variety of factors
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 8 / 25
![Page 18: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/18.jpg)
Characterizing edges
An edge is a place of rapid change in the image intensity function
How to differentiate a digital image (filter ?)
∂f∂x
[x , y ] = F [x + 1, y ]− F [x , y ]
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 9 / 25
![Page 19: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/19.jpg)
Image gradient
The gradient of an image: Of = [ ∂f∂x ,
∂f∂y ]
Points in the direction of most rapid increase in intensity
where strength is ||Of || =√( ∂f∂x )
2 + ( ∂f∂y )
2
and direction is θ = tan−1( ∂f∂y /
∂f∂x )
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 10 / 25
![Page 20: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/20.jpg)
Image gradient
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 11 / 25
![Page 21: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/21.jpg)
Effects of Noise
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 12 / 25
![Page 22: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/22.jpg)
Solution: smooth first
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 13 / 25
![Page 23: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/23.jpg)
Associative property of convolutionDifferentiation is convolution, and convolution is associative:
ddx
(f ∗ h) = f ∗ ddx
h
This can help us to saves one operation
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 14 / 25
![Page 24: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/24.jpg)
Directional derivative with Gaussian filter
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 15 / 25
![Page 25: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/25.jpg)
Sobel OperatorCommon approximation of derivative of Gaussian
Edge magnitude is√
s2x + s2
y and the direction is tan−1(sy/sx)
Edge is detected by using threshold
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 16 / 25
![Page 26: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/26.jpg)
Sobel OperatorCommon approximation of derivative of Gaussian
Edge magnitude is√
s2x + s2
y and the direction is tan−1(sy/sx)
Edge is detected by using threshold
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 16 / 25
![Page 27: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/27.jpg)
Non-maximum supression
Check if pixel is local maximum along gradient direction
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 17 / 25
![Page 28: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/28.jpg)
Non-maximum supression
Check if pixel is local maximum along gradient direction
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 17 / 25
![Page 29: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/29.jpg)
Non-maximum supression
Check if pixel is local maximum along gradient direction
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 17 / 25
![Page 30: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/30.jpg)
Non-maximum supression
Check if pixel is local maximum along gradient direction
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 17 / 25
![Page 31: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/31.jpg)
Roberts
Roberts operator is a simple approximation to the first derivative.It makes the edge point only, not the information about the edgeorientation.It works well in binary images.The Roberts method finds edges using the Roberts approximationto the derivative.√
(I(i , j)− I(i − 1, j − 1))2 + (I(i , j − 1)− I(i − 1, j))2[0 1−1 0
] [1 00 −1
]
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 18 / 25
![Page 32: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/32.jpg)
Prewit Operator
Performs smoothening (by averaging) and then finds the magnitude ofderivatives and applies threshold on them.
The mask used is as below
hx =
1 0 −11 0 −11 0 −1
hy =
1 1 10 0 0−1 −1 −1
Bigger size mask is
hx =
−3 −1 1 3−3 −1 1 3−3 −1 1 3−3 −1 1 3
hy =
3 3 3 31 1 1 1−1 −1 −1 −1−3 −3 −3 −3
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 19 / 25
![Page 33: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/33.jpg)
Laplacian of Gaussian (Marr-Hildreth)It is high-pass, and non-directional filter. Uses second derivatives 0 −1 0
−1 4 −10 −1 0
−1 −1 −1−1 8 −1−1 −1 −1
Apply LoG to remove noise.
0 0 1 0 00 1 2 1 01 2 −16 2 10 1 2 1 00 0 1 0 0
1 Detect all zero crossings{+,−}, {+,−}, {+,0,−},{+,0,−}
2 Use threshold to keep onlystrong ones
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 20 / 25
![Page 34: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/34.jpg)
Canny Edge Detector [1/3]
Standard edge detector: Probability of detecting real edge points ismaximized while the probability of falsely detecting non-edge points isminimized.
Five separate steps:
1. Smoothing: Blurring of the image to remove noise. (by applying aGaussian filter). The kernel of a Gaussian filter with a standarddeviation of σ = 1.4 is given by
1159
2 4 5 4 24 9 12 9 45 12 15 12 54 9 12 9 42 4 5 4 2
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 21 / 25
![Page 35: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/35.jpg)
Canny Edge Detector [1/3]
Standard edge detector: Probability of detecting real edge points ismaximized while the probability of falsely detecting non-edge points isminimized.Five separate steps:
1. Smoothing: Blurring of the image to remove noise. (by applying aGaussian filter). The kernel of a Gaussian filter with a standarddeviation of σ = 1.4 is given by
1159
2 4 5 4 24 9 12 9 45 12 15 12 54 9 12 9 42 4 5 4 2
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 21 / 25
![Page 36: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/36.jpg)
Canny Edge Detector [2/3]
2. Finding gradients: The edges should be marked where thegradients of the image has large magnitudes (by applyingSobel-operator).
3. Non-maximum suppression: Only local maxima should bemarked as edges.
1 Round the gradient direction to nearest 45◦, corresponding to theuse of an 8-connected neighborhood.
2 Compare the edge strength of the current pixel with the edgestrength of the pixel in the positive and negative gradient direction.i .e. if the gradient direction is north (theta = 90◦), compare with thepixels to the north and south.
3 If the edge strength of the current pixel is largest; preserve thevalue of the edge strength. If not, suppress (i .e. remove) the value.
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 22 / 25
![Page 37: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/37.jpg)
Canny Edge Detector [2/3]
2. Finding gradients: The edges should be marked where thegradients of the image has large magnitudes (by applyingSobel-operator).
3. Non-maximum suppression: Only local maxima should bemarked as edges.
1 Round the gradient direction to nearest 45◦, corresponding to theuse of an 8-connected neighborhood.
2 Compare the edge strength of the current pixel with the edgestrength of the pixel in the positive and negative gradient direction.i .e. if the gradient direction is north (theta = 90◦), compare with thepixels to the north and south.
3 If the edge strength of the current pixel is largest; preserve thevalue of the edge strength. If not, suppress (i .e. remove) the value.
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 22 / 25
![Page 38: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/38.jpg)
Canny Edge Detector [3/3]
4. Double thresholding: Edge pixels stronger than the highthreshold are marked as strong; edge pixels weaker than the lowthreshold are suppressed and edge pixels between the twothresholds are marked as weak. Strong edges are white, whileweak edges are grey. Edges with a strength below boththresholds are suppressed
5. Edge tracking by hysteresis: Final edges are determined bysuppressing all edges that are not connected to a very certain(strong) edge. Strong edges are interpreted as certain edges, andare included in the final edge image. Weak edges are included ifand only if they are connected to strong edges.
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 23 / 25
![Page 39: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/39.jpg)
Canny Edge Detector [3/3]
4. Double thresholding: Edge pixels stronger than the highthreshold are marked as strong; edge pixels weaker than the lowthreshold are suppressed and edge pixels between the twothresholds are marked as weak. Strong edges are white, whileweak edges are grey. Edges with a strength below boththresholds are suppressed
5. Edge tracking by hysteresis: Final edges are determined bysuppressing all edges that are not connected to a very certain(strong) edge. Strong edges are interpreted as certain edges, andare included in the final edge image. Weak edges are included ifand only if they are connected to strong edges.
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 23 / 25
![Page 40: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/40.jpg)
Canny Edge Detector
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 24 / 25
![Page 41: CS-F441: Selected Topics from Computer Science (Deep ...CS-F441: SELECTED TOPICS FROM COMPUTER SCIENCE (DEEP LEARNING FOR NLP & CV) Lecture-KT-07: Edge Detection Dr. Kamlesh Tiwari,](https://reader030.vdocument.in/reader030/viewer/2022040413/5f0d83827e708231d43abbcc/html5/thumbnails/41.jpg)
Thank You!
Thank you very much for your attention1!
Queries ?
1https://www.cs.cornell.edu/courses/cs6670/2011sp/lectures/lec02 filter.pdf
STCS-DL4NLP&CV (CS-F441) Campus @ BITS-Pilani Lecture-KT-07 (Oct 25, 2019) 25 / 25