Edge Detecting UDFs

(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 the second UDF tutorial, we made some sharpen filters. In this tutorial, we'll make a couple edge detecting filters.

With the blur filters, we added to the UDF matrix positive peripheral cell values around a positive central value. For the sharpening filter, we used a positive central value but surrounded the central cell with negative values. For edge filters, the central value is what's negative, with positive surrounding values.

Here's our rule of thumb for Edge Detecting filters:

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

To create your first edge filter, choose Effects > User Defined Filters, then fill in the matrix like this:

(Note: I've turned off the filter's preview windows here.)

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 -7 and eight surrounding cells filled with 1, for a sum of 1.

Applying this filter gives this result:

Original Edge Detect

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

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 edge filter this way:

We've increased the central value from -7 to -2. The sum of the matrix values now is 6, since we have a central value of -2 and eight surrounding cells filled with 1. To adjust this sum to get 1, press the Compute button to set the Divisor to 6.

Here's the result this time:

Original Subtle Edges

This more-subtle effect (which is approaching a blur effect) might be a good start for a digital painting.

Experiment with your own selected values. Maybe try placing positive values in the corner cells, with or without interior positive cells.

When you're ready for more UDFs, head over to the Embossing UDFs tutorial!

How To