Canny Edge Detector
The following are my notes on part of the Edge Detection lecture by Dr. Shah: Lecture 03 – Edge Detection
**Canny Edge Detector **

Critera:

Good detection: Minimize false positives and false negatives

Good localization: Should be close to true edge

Single response constraint: Only one result for each edge point.


Uses gradient of Gaussian.
**Steps: **

Smooth image with Gaussian filter

Compute derivative of smoothed image.

Find gradient magnitudes and orientations.

Apply nonmaximum suppression

Apply hysteresis threshold
**Gaussian Smoothing and Derivative **
 The first two steps are very similar to the Prewitt operator, where we end up with two images, one is the derivative with respect to x, and the other is the derivative with respect to y.
** [28:11 Lecture 3] **
 The difference is simply that with the Prewitt operator we used simple averaging for smoothing, but here we’re using the Gaussian for smoothing.
**Nonmaximum Suppression **

One of the goals is to only have one result point per edge pixel, so in the neighborhood of an edge pixel, we want to find the pixel which is most likely the edge, and suppress the others.

Look along the normal to the edge. There should only be one edge pixel on the line normal to the edge, so take the one with the largest magnitude.
[31:37  Lecture 3]
 If a result point is larger than the edge point to its left and to its right along the normal, then it is a maxima and we keep it. Otherwise, ommitt it.
** [32:43 Lecture 3] **
 The first image shows the gradient magnitude, the second image excludes the edge points which are not local maxima, and the third image applies a threshold to identify the edge pixels.
Hysteresis threshold **

Set a “high” threshold and a “low” thresholds.

Pixels outside of these thresholds are immediately categorized.

For pixels between the threshold:
 Check all of it’s neighbors. If any of it’s neighbors are either certain or possible edge pixels, keep it. If not, ommit it.


The actual algorithm, as its programmed:

Work through the image left to right then top to bottom.

If a pixel is above the high threshold, mark it as an edge.
 Then, check all of its neighbors. If they are above the low threshold, then mark them as an edge (since they are touching a real edge)
