Next: Bibliography Up: Scientific Visualisation 3 1999 Previous: 3.4 Pitfalls

# 4 Question 4 -- Kernels

Kernels are a method of performing a convolution on an image. Kernels work by modifying each pixel's value in some way that depends on its surrounding neighbourhood of pixels. This can be used to increase or decrease the brightness of certain pixels, where these pixels are selected'' based on their local situation in the image, where they are and what their surrounding region is like. This is how kernels smooth images and remove noise -- areas of high contrast have their pixels modified to slightly lower the high intensities and slightly increase the low intensities, and similarly isolated pixels and small regions of abnormally high intensity have their intensities lowered.

Kernels are usually represented as square matrices of odd side length. They may be either square or cross (plus'') shaped, as Equations 1 and 2 show, and are usually either or elements in dimension. The central matrix element is the pixel currently being processed, and the surrounding matrix elements correspond to the surrounding pixels. The numbers indicate the relative weights of the pixels in terms of their contribution to the new value for the current pixel. For example, Equations 1 and 2 show the common Gaussian kernel in both square and cross forms.

 (1)

 (2)

The Gaussian kernel is frequently used as a more sophisticated version of simple neighbourhood averaging, which uses the kernel in Equation 3. This method simply takes the average of the surrounding pixel values as the new value for the pixel, and the Gaussian kernel extends this idea by placing higher weights on closer pixels.

 (3)

Another method, which cannot be expressed as a matrix of pixel weights, is that of neighbourhood ranking. This method selects as its new pixel value the median of the surrounding pixel values.

The smoothing and removal of noise occurs because the kernel causes the pixels to become extended and their values are smeared'' over the area of the kernel. Thus areas of high contrast (such as sharp lines) have their edges blurred and their intensities lowered, causing the effect known as smoothing. Noise in the order of the size of the kernel is lessened or removed for exactly the same reasons -- it becomes smeared over a greater area and so its overall affect on any local area in the image is lessened.

This introduces the first limitation in using kernels for noise removal -- the size of the smallest interesting feature must be substantially larger than a pixel, and for better results should also be larger than the kernel size. The reason is simple -- the kernel alters structures significantly when they are of comparable size and preserves larger structures. Indeed, structures smaller than the kernel, such as a single pixel, may be removed altogether or otherwise damaged by the kernel.

Some kernels, such as the simple and Gaussian neighbourhood averaging, suffer from the problem of edge shift, where edges in the image are shifted by a single pixel, due to the way the kernel gives those pixels an effect in the image at places where they should have none. The neighbourhood ranking method avoids this problem.

Smoothing and noise reduction kernels in general result in a loss of fine detail in the image (which is often desirable, since it may be noise) and more importantly a loss of image contrast. This can make small and low contrast features of the image harder to see. Related is a loss of greyscales and digitisation of the intensities which results from repeated applications of smoothing kernels.

The shape and type of the kernel can also influence the shapes of structures in the resulting images, especially with repeated applications. For example, both neighbourhood ranking and most cross kernels tend to make sharp corners more rounded.

Next: Bibliography Up: Scientific Visualisation 3 1999 Previous: 3.4 Pitfalls
Kevin Pulo
2000-08-22