Edge Detection Winter in Krakw photographed by Marcin
Edge Detection Winter in Kraków photographed by Marcin Ryczek CS 194: Image Manipulation, Comp. Vision, and Comp. Photo Alexei Efros, UC Berkeley, Spring 2020
Edge detection • Goal: Identify sudden changes (discontinuities) in an image • Intuitively, most semantic and shape information from the image can be encoded in the edges • More compact than pixels • Ideal: artist’s line drawing (but artist is also using object -level knowledge) Source: D. Lowe
Origin of edges Edges are caused by a variety of factors: surface normal discontinuity depth discontinuity surface color discontinuity illumination discontinuity Source: Steve Seitz
Closeup of edges
Closeup of edges
Closeup of edges
Closeup of edges
Characterizing edges • An edge is a place of rapid change in the image intensity function (along horizontal scanline) first derivative edges correspond to extrema of derivative
There is ALWAYS a tradeoff between smoothing and good edge localization! Image with Edge Image + Noise Edge Location Derivatives detect edge and noise Smoothed derivative removes noise, but blurs edge
The Canny edge detector norm of the gradient
The Canny edge detector thresholding
The Canny edge detector How to turn these thick regions of the gradient into curves? thresholding
Non-maximum suppression Check if pixel is local maximum along gradient direction, select single max across width of the edge
Non-Local Maxima Suppression 1. 0 1. 5 Gradient magnitude at center pixel is lower than the gradient magnitude of a neighbor in the direction of the gradient Discard center pixel (set magnitude to 0) 2 2 4. 1 2. 5 Gradient magnitude at center pixel is greater than gradient magnitude of all the neighbors in the direction of the gradient Keep center pixel unchanged
Non-maximum suppression requires checking interpolated pixels p and r
The Canny edge detector Problem: pixels along this edge didn’t survive thresholding thinning (non-maximum suppression)
Hysteresis thresholding Use a high threshold to start edge curves, and a low threshold to continue them. Source: Steve Seitz
T = 15 T=5 Two thresholds applied to gradient magnitude
Hysteresis Thresholding Weak pixels but connected Very strong edge response. Let’s start here Weak pixels but isolated Weaker response but it is connected to a confirmed edge point. Let’s keep it. Continue…. Note: Darker squares illustrate stronger edge response (larger M)
T=15 T=5 Hysteresis Th=15 Tl = 5 Hysteresis thresholding
Recap: Canny edge detector 1. Filter image with derivative of Gaussian 2. Find magnitude and orientation of gradient 3. Non-maximum suppression: • Thin wide “ridges” down to single pixel width 4. 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 MATLAB: edge(image, ‘canny’); J. Canny, A Computational Approach To Edge Detection, IEEE Trans. Pattern Analysis and Machine Intelligence, 8: 679 -714, 1986.
Edge detection is just the beginning… image human segmentation gradient magnitude Berkeley segmentation database: http: //www. eecs. berkeley. edu/Research/Projects/CS/vision/grouping/segbench/
two-tone images
“attached shadow” contour hair (not shadow!) “cast shadow” contour inferred external contours
29
30
- Slides: 29