Download presentation
Presentation is loading. Please wait.
1
3-D Computational Vision CSc 83020 Canny Edge Detection
2
Can we derive an optimal detector? Can we derive an optimal detector? Good Detection: minimize false positives and false negatives. Good Detection: minimize false positives and false negatives. Good Localization: close as possible to the true edges. Good Localization: close as possible to the true edges. Single Response Constraint: one edge should be detected for each true edge Single Response Constraint: one edge should be detected for each true edge
3
Canny Edge Detection 3 STEPS: 3 STEPS: CANNY_ENHANCER CANNY_ENHANCER NONMAX_SUPPRESION NONMAX_SUPPRESION HYSTERESIS_THRESH HYSTERESIS_THRESH
4
Localization-Detection Tradeoff Filter’s spatial scale Filter’s spatial scale Location & Location & Detection criteria. Detection criteria. Optimal 1-D step edge detector! Optimal 1-D step edge detector! Approximated by the 1 st derivative of the Gaussian. Approximated by the 1 st derivative of the Gaussian.
5
Gaussian and its derivative From Jana Kosecka
6
Vertical edges First derivative From Jana Kosecka
7
Horizontal edges Image Gradient Gradient Magnitude From Jana Kosecka
8
Gradient Orientation From Jana Kosecka
9
Optimal 1-D step edge detectors… Pixel (i,j) Keep the one that gives you maximum response. Expensive.
10
Solution… Pixel (i,j) Compute derivatives with respect to x & y directions. Compute edge normal. x y
11
CANNY_ENHANCER Compute I x and I y the gradient of the image using a derivative of Gaussian filter. Compute I x and I y the gradient of the image using a derivative of Gaussian filter. Compute the edge strength from the magnitude of the gradient: Es Compute the edge strength from the magnitude of the gradient: Es Compute the orientation of the edge from arctan(I y / I x ): Eo Compute the orientation of the edge from arctan(I y / I x ): Eo [Canny ’86] n
12
Compute image derivatives if gradient magnitude > and the value is a local max. along gradient direction – pixel is an edge candidate how to detect one pixel thin edges ? gradient magnitude (Es) original image Problem with detector
13
The magnitude image E s has the magnitudes of the smoothed gradient. The magnitude image E s has the magnitudes of the smoothed gradient. Sigma determines the amount of smoothing. Sigma determines the amount of smoothing. E s has large values at edges: E s has large values at edges: Find local maxima Find local maxima Problem with detector Th
14
x x Nonmaximum supression The inputs are E s & E o Magnitude and orientation The inputs are E s & E o Magnitude and orientation Consider 4 directions D={0,45,90,135} wrt x Consider 4 directions D={0,45,90,135} wrt x For each pixel (i,j) do: For each pixel (i,j) do: 1. Find the direction d D s.t. d E o (i,j) (normal to the edge) 2. If {E s (i,j) is smaller than at least one of its neigh. along d } I N (i,j)=0 I N (i,j)=0 Otherwise, I N (i,j)= E s (i,j) Otherwise, I N (i,j)= E s (i,j) The output is the thinned edge image I N The output is the thinned edge image I N
15
Thresholding Edges are found by thresholding the output of NONMAX_SUPRESSION Edges are found by thresholding the output of NONMAX_SUPRESSION If the threshold is too high: If the threshold is too high: Very few (none) edges Very few (none) edges High MISDETECTIONS, many gaps High MISDETECTIONS, many gaps If the threshold is too low: If the threshold is too low: Too many (all pixels) edges Too many (all pixels) edges High FALSE POSITIVES, many extra edges High FALSE POSITIVES, many extra edges
16
Edge Detection With Hysteresis Low thresholdHigh threshold Hysteresis (high and low threshold)
17
Edge Tracking Hysteresis thresholding [Canny ’86] Strong edge Weak edges Strong edges reinforce weak edges. We call a pixel an edge if it is strong. We also call a pixel an edge if it is weak but is connected to an edge. A pixel is connected to an edge if it is in a direction perpendicular to the edge normal Weak edge removed edges
18
Hysteresis Thresholding Es(i,j)> H Es(i,j)<H Es(i,j)>L Es(i,j)<L Es(i,j)>L Strong edges reinforce adjacent weak edges
19
NONMAX_SUPPRESSION 0 45 90 135 Locate local maxima from Es. Find direction d that best approximates Eo(i,j) If Es(i,j) is smaller than at least one neighbor along d In(i,j)=0 else In(i,j)=Es(i,j).
20
HYSTERESIS_THRESH Input: In, Eo, high threshold, low threshold. Input: In, Eo, high threshold, low threshold. Output: Lists of connected edges (contours). Output: Lists of connected edges (contours).
21
Edge Relaxation Parallel – iterative method to adjust edge values on the basis of neighboring edges Crack edges:
22
Edge Relaxation Parallel – iterative method to adjust edge values on the basis of neighboring edges Vertex types: Notation: Edge to be updated Edge No edge Crack edges: (0) (1) (2) (3)
23
Edge Relaxation Parallel – iterative method to adjust edge values on the basis of neighboring edges Vertex types: Notation: Edge to be updated Edge No edge Crack edges: (0) (1) (2) (3) Action table for edge type: Decrease Increase Unchanged 0-01-10-1 0-21-22-2 0-31-32-3 3-3
24
Edge Relaxation Parallel – iterative method to adjust edge values on the basis of neighboring edges Vertex types: Notation: Edge to be updated Edge No edge Crack edges: (0) (1) (2) (3) Action table for edge type: Decrease Increase Unchanged 0-01-10-1 0-21-22-2 0-31-32-3 3-3 Algorithm: 0. Compute initial confidence C 0 (e) of each edge e C 0 (e) = 1.k = 1 2.Compute edge type for all e 3.Modify C k (e) based on C k-1 (e) and edge type. 4.If all C k (e) have converged to 1 or 0 else go to step 1
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.