canny edge detectiondetection/localization trade-off • more smoothing improves detection ... leung...
TRANSCRIPT
![Page 1: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/1.jpg)
Canny Edge Detection
Mohammad Nayeem Teli
![Page 2: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/2.jpg)
Optimal Edge Detection: Canny
Assume: • Linear filtering • Additive iid Gaussian noise
Edge detector should have: • Good Detection. Filter responds to edge, not noise. • Good Localization: detected edge near true edge. • Single Response: one per edge.
![Page 3: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/3.jpg)
Optimal Edge Detection: Canny (continued)Optimal Detector is approximately Derivative of
Gaussian. Detection/Localization trade-off
• More smoothing improves detection • And hurts localization.
This is what you might guess from (detect change) + (remove noise)
![Page 4: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/4.jpg)
Canny edge detector1. Smoothing (noise reduction) 2. Find derivatives (gradients) 3. Find magnitude and orientation of gradient 4. Non-maximum suppression:
• Thin multi-pixel wide “ridges” down to single pixel width
5. Linking and thresholding (hysteresis): • Define two thresholds: low and high • Use the high threshold to start edge curves and the low
threshold to continue them
![Page 5: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/5.jpg)
The Canny edge detector
original image
![Page 6: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/6.jpg)
Canny edge detector1. Smoothing (noise reduction)
5 x 5 Gaussian kernel
12πσ2
e− (x2 + y2)2σ2
x = i − (k + 1); y = j − (k + 1)
Filter : (2k + 1) × (2k + 1) −2 ≤ k ≤ 2
1 ≤ i, j ≤ 2k + 1
![Page 7: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/7.jpg)
The Canny edge detector
smoothed image
![Page 8: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/8.jpg)
Canny edge detector1. Smoothing (noise reduction) 2. Find derivatives (gradients)
hx
hy
Fx
Fy
![Page 9: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/9.jpg)
Canny edge detector1. Smoothing (noise reduction) 2. Find derivatives (gradients) 3. Find magnitude and orientation of gradient
Fx
Fy G = (F2x + F2
y )
![Page 10: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/10.jpg)
Canny edge detector1. Smoothing (noise reduction) 2. Find derivatives (gradients) 3. Find magnitude and orientation of gradient
Fx
Fyθ = tan−1( Fy
Fx )
![Page 11: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/11.jpg)
Non-maximum suppression
Check if pixel is local maximum along gradient direction • requires checking interpolated pixels p and r
![Page 12: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/12.jpg)
Canny edge detector1. Smoothing (noise reduction) 2. Find derivatives (gradients) 3. Find magnitude and orientation of gradient 4. Non-maximum suppression:
• Thin multi-pixel wide “ridges” down to single pixel width
0
π4π
2
3π4
π
![Page 13: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/13.jpg)
Canny edge detector1. Smoothing (noise reduction) 2. Find derivatives (gradients) 3. Find magnitude and orientation of gradient 4. Non-maximum suppression:
• Thin multi-pixel wide “ridges” down to single pixel width
0
π4π
2
3π4
π
![Page 14: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/14.jpg)
Canny edge detector1. Smoothing (noise reduction) 2. Find derivatives (gradients) 3. Find magnitude and orientation of gradient 4. Non-maximum suppression:
• Thin multi-pixel wide “ridges” down to single pixel width
5. Linking and thresholding (hysteresis): • Define two thresholds: low and high
Upper threshold based on the max intensity
lower threshold based on some percentage of the upper threshold
![Page 15: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/15.jpg)
Canny edge detector - double threshold
1. Linking and thresholding (hysteresis): • Define two thresholds: low and high
Upper threshold based on the max intensity
lower threshold based on some percentage of the upper threshold
Example:
Upper threshold - 90% of max lower threshold - 35%
lower threshold < intensity < upper threshold
<= lower threshold >=
upper threshold
irrelevant weak strong
![Page 16: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/16.jpg)
Canny edge detector - double threshold
1. Linking and thresholding (hysteresis): • Define two thresholds: low and high
Upper threshold based on the max intensity
lower threshold based on some percentage of the upper threshold
Example:
Upper threshold - 90% of max lower threshold - 35%
lower threshold < intensity < upper threshold
<= lower threshold >=
upper threshold
irrelevant = 0 weak = low threshold
strong= 255
![Page 17: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/17.jpg)
Canny edge detector - Hysteresis1. Smoothing (noise reduction) 2. Find derivatives (gradients) 3. Find magnitude and orientation of gradient 4. Non-maximum suppression:
• Thin multi-pixel wide “ridges” down to single pixel width
5. Linking and thresholding (hysteresis): • Define two thresholds: low and high • replace with the strong edge if any of the neighboring pixels
is strong, else make it irrelevant.
0
π4π
2
3π4
π
![Page 18: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/18.jpg)
Canny edge detector - Hysteresis1. Smoothing (noise reduction) 2. Find derivatives (gradients) 3. Find magnitude and orientation of gradient 4. Non-maximum suppression:
• Thin multi-pixel wide “ridges” down to single pixel width
5. Linking and thresholding (hysteresis): • Define two thresholds: low and high • replace with the strong edge if any of the neighboring pixels
is strong, else make it irrelevant.
0
π4π
2
3π4
π
![Page 19: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/19.jpg)
Canny Edge Detection (Example)
courtesy of G. Loy
gap is gone
Original image
Strong edges
only
Strong + connected weak edges
Weak edges
![Page 20: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/20.jpg)
Effect of σ (Gaussian kernel size)
Canny with Canny with original
The choice of depends on desired behavior • large detects large scale edges • small detects fine features
![Page 21: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/21.jpg)
(Forsyth & Ponce)
Scale
Smoothing Eliminates noise edges. Makes edges smoother. Removes fine detail.
![Page 22: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/22.jpg)
![Page 23: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/23.jpg)
fine scale high threshold
![Page 24: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/24.jpg)
coarse scale, high threshold
![Page 25: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/25.jpg)
coarse scale low threshold
![Page 26: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/26.jpg)
Computer Vision - A Modern
Approach Set: Linear Filters
Slides by D.A. Forsyth
Filters are templates
■ Applying a filter at some point can be seen as taking a dot-product between the image and some vector
■ Filtering the image is a set of dot products
■ Insight■ filters look like the effects
they are intended to find ■ filters find effects they look
like
![Page 27: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/27.jpg)
Filter Bank
Leung & Malik, Representing and Recognizing the Visual Apperance using 3D Textons, IJCV 2001
![Page 28: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/28.jpg)
Learning to detect boundaries
Berkeley segmentation database:http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/segbench/
image human segmentation gradient magnitude
![Page 29: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/29.jpg)
pB boundary detector
Figure from Fowlkes
Martin, Fowlkes, Malik 2004: Learning to Detection Natural Boundaries… http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/papers/mfm-pami-boundary.pdf
![Page 30: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/30.jpg)
pB Boundary Detector
- Estimate Posterior probability of boundary passing through centre point based on local patch based features - Using a Supervised Learning based framework
![Page 31: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/31.jpg)
Results
Human (0.95)
Pb (0.88)
![Page 32: Canny Edge DetectionDetection/Localization trade-off • More smoothing improves detection ... Leung & Malik, Representing and Recognizing the Visual ... pB Boundary Detector - Estimate](https://reader034.vdocument.in/reader034/viewer/2022042808/5f88018bb06e29220b6d02af/html5/thumbnails/32.jpg)
Results
Human
Pb
Human (0.96)
Global PbPb (0.88)