# Laplacian Of Gaussian (Marr-Hildreth) Edge Detector

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

• Noise can really affect edge detection, because noise can cause one pixel to look very different from its neighbors.

• To account for this, we take advantage of the fact that neighboring pixels along an edge tend to look similar.

• Gaussian smoothing helps eliminate noise. The larger the sigma, the greater the smoothing.

• The simplest edge detectors are the Prewit and Sobel edge detectors. These are pretty old.

• Laplacian of Gaussian (Marr-Hildreth) is better.

• Even better: Gradient of Gaussian (Canny)

**Prewitt and Sobel: **

1. Compute derivatives in x and y directions.

3. Threshold the magnitude.

Copmuting derivatives: **First you smooth out the images by averaging with the mask: The below image shows the Prewitt mask in the x-direction. The right hand side represents the operator as two operations. The vertical vector represents a smoothing of the image by averaging. The horizontal vector represents the derivative in the x direction. These two operations can be combined into a single mask as shown on the left hand side. **

**Copmuting the magnitude of the vector incorporates both the the derivative in the x and y direction, and this ensures that we’re able to detect edges at any angle (not just horizontal or vertical edges). ** Marr-Hildreth **The Marr-Hildreth operator is also called the Laplacian of Gaussian, which I saw referenced in SIFT…** **

1. Apply Gaussian smoothing

2. Take the second derivative and look for zero crossings (where 2nd derivative = 0, but is not constant 0)

1. When the first derivative is at a maxima or minima the second derivative is 0.

2. Pixels where a zero crossing occurs are marked as edges (if the slope of the crossing exceeds a threshold).

3. Look for zero crossings along each row (why not by columns, too?)

• According to Wikipedia, this edge detector is more of historical significance because it has a couple serious flaws, and the Canny edge detector is better.

• Marr-Hildreth performs the smoothing using the Gaussian instead of just simple averaging. We already know that the Gaussian does a better job of smoothing, so that’s already one improvement.

• The second order derivative is the Laplacian?

• Rather than convolve the image with the gaussian and take the second order derivative of the result, you can actually take the 2nd derivative of the gaussian itself.

**

• You can precompute the mask values, as shown below. He generally uses a sigma of 1, so I assume that’s the case here:

** **

[8:14 Lecture 3]

• Zero crossings occur in the image wherever a positive value is followed by a negative value, or vice versa. Or there may even be a 0 in between a positive and negative value.

• The absolute difference between the negative and positive values gives you the slope of the crossing, which is a measure of the strength of the edge.
• In the same way that we were able to separate the Gaussian filter to improve performance, we can separate the Laplacian of Gaussian

** [15:40 Lecture 3] - Note: g(x) and g(y) should be switched!

• The Gaussian filter can be applied with 2n multiplications (where n is the mask size), but the LoG requires 4n.

• This requires four passes of the image to apply the 1D vectors (with a final fifth pass to sum the results?)