Previous | Next --- Slide 75 of 114
Back to Lecture Thumbnails
adigrao2012

I don't quite understand the significance of the -1/9*matrix portion of this filter with respect to detecting the flat area vs intensity peak, could I get an explanation?

mpotoole

@adigrao2012 Because convolution is a linear operation, we can apply the filter in two separate operations (one for the matrix on the left, and the other for the matrix on the right), and then sum the resulting images. The matrix on the left produces the original image, where the pixel values are scaled by 2. The matrix on the right produces a blurry image, using a 3x3 normalized box filter. Subtracting the blurry image from the original image produces a sharper image.

Here's another way to interpret the matrix: the resulting matrix looks a lot like our Laplacian which can be used to extract edges from an image.

I showed some examples of oversharpened results in this lecture. Anyone have ideas on how to change the values of this matrix to control the degree of sharpening?

gmoyer

Would adjusting the size of the kernel help control the degree of sharpening?

mpotoole

Adjusting the size of the kernel might be one way to control the scale at which sharpening is applied. To control the amount of sharpening, one would simply manipulate the values of this matrix.

As mentioned above, this looks a lot like a Laplace operator. We can rewrite the matrix as the sum of two other matrices:

Filter 1:

0 0 0
0 1 0
0 0 0


Filter 2:

-1/9 -1/9 -1/9
-1/9  8/9 -1/9
-1/9 -1/9 -1/9

The first filter produces the original image. The second filter is the Laplacian---used here to extract and amplify edges. The magnitude of the second filter can be chosen to control the sharpening effect (e.g., multiplying the values of the second filter by zero would produce the original image; multiplying this by 100 would significantly amplify the edges captured by the Laplace operator).

gmoyer

Is there a significance between when the values within a kernel add up to 1 vs. 0? It seems like in a lot of our smoothing kernels such as the box filter and the gaussian, we normalize the values to sum up to 1. On the other hand, the Laplacian that you mentioned above (Filter 2) sums to 0.

Not sure if this really matters much or not, just curious!

mpotoole

@gmoyer Good question.

A lot of our blur kernels (e.g. Gaussian, Box filter) should normalize to 1. Normalizing the kernel such that its values add up to 1 ensures that the images doesn't get brighter or dimmer after a convolution operation with the filter. In other words, the average pixel value of your image remains the same in this case.

For the Sobel filter or Laplacian, the goal is to identify edges or large changes in pixel values in an image. These filters are based off of first or second derivative operators. And we know that the derivative of a constant should be zero. So it should be no surprise in this case that a kernel based on derivatives must add up to zero.