(Note: If you're unfamiliar with User Defined Filters (UDFs), then please take a look at UDF Basics before working through this tutorial.)

In our first UDF tutorial we looked at the basic rules of thumb for making UDFs, and we made a couple blur filters. In this tutorial, we'll make a couple sharpening filters.

With the blur filters, we added to the UDF matrix positive peripheral cell values around a positive central value. For a sharpening filter, you also use a positive central value, but this time surround the central cell with negative values.

Here's our rule of thumb for Sharpen filters:

For a Sharpen filter, use a positive center value and surround it with a symmetrical pattern of negative values.

To create your first sharpen filter, choose Effects > User Defined. Then fill in the matrix like this:

(Note: I've turned the preview windows off, but when working through your own filters you'll undoubtedly want to keep the preview windows open.)

Remember that in general you maintain the overall brightness of your original image by using values in the matrix that sum to 1. Here we have a central value of 9 and eight surrounding cells filled with -1, for a sum of 1.

Applying this filter gives this result:

Original | Sharpen |

The sharpening effect here is quite extreme, but don't forget another rule of thumb mentioned in UDF Basics:

Lessen the effect of a filter by increasing the value in the center cell; compensate with the appropriate Divisor to maintain the brightness of the original image.

Let's give it a try. We'll modify our original sharpening filter this way:

We've increased the central value from 9 to 16. The sum of the matrix values now is 8, since we have a central value of 16 and eight surrounding cells filled with -1. To adjust this sum to get 1, set the Divisor to 8 by entering it by hand or simply by pressing the Compute button.

Here's the result this time:

Original | Subtle Sharpen |

Now that's a nice effect! Just the amount of sharpening this image needed to eliminate the blurriness of the original.

Experiment with your own selected values. Also try directional sharpening: Arrange your negative peripheral values in a straight vertical, horizontal, or diagonal line passing through the positive center cell. Something else to try is placing negative values in the corner cells, with or without interior negative cells.

That's all for sharpening UDFs. If you'd like to continue learning more about UDFs, head over to the Edge Detecting UDFs tutorial.

Copyright ©2003 Lori J. Davis

All rights reserved