Measuring sharpness and softness

Sharpening and blurring tools both affect the contrast of an image's edges. While a global increase in contrast makes all dark pixels a little darker and all bright pixels a little brighter the increase in contrast that is caused by sharpening is locally restrained to the immediate surroundings of the edges of an image. An image without any edges (like a smooth gradient) generally undergoes no changes at all when sharpened.

The "right" amount of sharpness depends on the image, the output resolution and the output medium - finding the right amounts needs much experience. Also, the computer display can only give so much as hints as to what the printed image will look like. Furthermore, sharpening tools from different programs tend to act very differently, even with similar settings. Besides, the "quality" of a specific program or sharpening tool is hard to figure out using just exemplary images.

The Contrast Curves Test Kit from the SimpelFilter series allows for objective evaluation using so-called contrast curves.

Kontrastkurve1

"Contrast curves" for measuring contrast changes along the edges of an image

To analyze if and how image processing is affecting the edges of an image, a test image is necessary that only consists of edges, namely edges reaching from the smallest possible to the highest possible contrast. Such a contrast gradient consists of gray bars each being 5-pixels-wide those brightnesses alternately increase and decrease. To the left are the mid-gray bars with the lowest contrast, to the right the bars consisting of pure black and white, i.e. with the highest contrast.

kkurve1

Contrast gradient consisting of 256 bars (smaller version)

If you draw the brightnesses into a diagram along the x-axis (resembling a gradation curve) you get two lines. Both begin at the left side of the diagram at mid-height, but separate themselves at once, ending at the right side of the diagram, one in the upper right, the other in the lower right corner. The upper line represents the tonal values of the bars with increasing, the lower one the tonal values with decreasing brightness.

Normalkurve

The contrast curve's "normal form" represents the unchanged contrast test image

Until now this is not much more than a strange-looking gradation curve. But what happens if we try a blur filter on the test image? Blurring does not change contrast globally, but only on the image's edges. That means that the bright pixels along a dark edge get a little darker, and the dark pixels on that edge get a little brighter. The opposite happens during sharpening: Pixels on the bright side of an edge get even brighter, the ones on the dark side even darker. Therefore, edge contrast increases.

kkurve3

A section from the contrast gradient and the changes caused by blurring (left) and sharpening (right).

Now, our curve merely would get some fringes after that - if I was not using a kind of trick: Classifying the pixels in an optically clear way by the three colors red, green and blue. The pixels directly bordering the edges (on the dark or on the bright side) get painted red. Pixels in the second row get green, the ones in the third get blue (in this case, pixels in the third row are exactly in the center of two edges).

Therefore it is plain to see which pixels were influenced to which degree by the blurring. That is to say that the sides of the curve now are divided into three colored sides each. Only if not all rows are affected - or two or all rows are affected in the exact same way - do two sides combine and produce their respective combination color. Blue and green (third and second row) create cyan, red and green (first and second row) produce yellow. The combination of the first and third row (red and blue - magenta) should not happen in the real world. If all three rows of pixels are modified in the same way or are not modified at all, their respective curve sides will stay together and will produce a white curve.

kkurve4

Sharpening increases contrast mainly between pixels directly bordering the edges (first rows of pixels - upper and lower red sides). The third rows of pixels (blue) are not affected here.

The contrast curves allow for evaluation of quite a number of image processing and retouching techniques. Besides sharpening and blurring filters (the so-called focus filters) they also can be used for testing noise filters. In this case a noisy source image is used as a test image. You can find plenty of usage examples in the articles on my home-page www.ralphaltmann.de and in the book Insiderbuch Digitale Fotografie (German).

kkurve5

Blurring reduces contrast

The Contrast Curves Test Kit is only available as a plugin version. Besides the plugin it contains supplementary Photoshop actions for automatizing the workflow and for finishing the calculated curve (the curve points will be thickened and a grid layer will be added to the diagram for better visibility).

The test image is contained in two versions: The version with full resolution consisting of 256 5-pixel-wide bars having a stepping of one tonal value has a width of 1280 pixels (or 1.5 megapixels in total). Thus I included a smaller version of the image that is only a quarter in size. It consists of 128 bars having a stepping of two tonal values and is therefore only 640 pixels wide.

Similar to the Gradation Test Kit I have also included test bands for inclusion in your own images, supplemented by Photoshop actions for fully automatic evaluation. The test bands come in two different versions as well (ca. 1280 and 640 pixels wide).

The test kit can be used in all programs that are compatible with Photoshop plugins. Support of actions and layers are not absolutely necessary, but lacking them you will lose some comfortableness (e.g. finishing the diagrams, if wanted, must be done by hand in this case).

kkurve6

The test band in the top left of the image shows after evaluation the quality of the sharpening process: Small contrasts did not get any sharpening (threshold working), but more intense contrasts were sharpened a lot. Edge contrasts of more than 128 tonal values - if they occurred in the image at all - were over-sharpened.

Contrast Curves Test Kit (Plug-In)


Contains a test image and a test band for analyzing and visualizing local contrast changes along the edges of an image, like those caused by sharpening and blurring. Also included are a plugin for producing the resulting contrast curve and supplementary Photoshop actions.
(Windows and Mac-OS)

sf_analyse_kkurve(mac)
sf_analyse_kkurve(win)

Test Kit for Live Measuring of Edge Contrast


A special layer construction allows the visualization of edge contrast "live". The princip is showing here:

 

Layers of the Test Image

 

The complete layer image is suitable for many programs that support adjustment layers: SF_Contrast_Testkit.zip

A second (but bigger) variant without adjustment layers is suitable i.e. for GIMP and other programs: SF_Contrast_Testkit_uni.zip

Thanks to Rolf Steinort who had adapt the Test Kit for Gimp and replaced the blue color with yellow. This makes the third curve more clearly visible: SF_Contrast_Testkit_RGY.zip

Rolf Steinort published a podcast on his website that explains the use of the Test Curve in Gimp.