Convolution is a simple mathematical operation which is fundamental to manycommon image processing operators. Convolution provides a way of `multiplyingtogether' two arrays of numbers, generally of diﬀerent sizes, but of the samedimensionality, to produce a third array of numbers of the same dimensionality. Thiscan be used in image processing to implement operators whose output pixel valuesare simple linear combinations of certain input pixel values.
In an image processing context, one of the input arrays is normally just a graylevelimage. The second array is usually much smaller, and is also two-dimensional(although it may be just a single pixel thick), and is known as the kernel. Figure 1shows an example image and kernel that we will use to illustrate convolution.
An example small image (left) and kernel (right) to illustrate
convolution. The labels within each grid square are used to identify each
The convolution is performed by sliding the kernel over the image, generally startingat the top left corner, so as to move the kernel through all the positions where thekernel ﬁts entirely within the boundaries of the image. (Note that implementationsdiﬀer in what they do at the edges of images, as explained below.) Each kernelposition corresponds to a single output pixel, the value of which is calculated bymultiplying together the kernel value and the underlying image pixel value for each of
the cells in the kernel, and then adding all these numbers together.
So, in our example, the value of the bottom right pixel in the output image will begiven by:
If the image has M rows and N columns, and the kernel has m rows and n columns,then the size of the output image will have M - m + 1 rows, and N - n + 1 columns.
Mathematically we can write the convolution as:
where i runs from 1 to M - m + 1 and j runs from 1 to N - n + 1.
Note that many implementations of convolution produce a larger output image thanthis because they relax the constraint that the kernel can only be moved to positionswhere it ﬁts entirely within the image. Instead, these implementations typically slidethe kernel to all positions where just the top left corner of the kernel is within theimage. Therefore the kernel `overlaps' the image on the bottom and right edges. Oneadvantage of this approach is that the output image is the same size as the inputimage. Unfortunately, in order to calculate the output pixel values for the bottom andright edges of the image, it is necessary to invent input pixel values for places wherethe kernel extends oﬀ the end of the image. Typically pixel values of zero are chosenfor regions outside the true image, but this can often distort the output image atthese places. Therefore in general if you are using a convolution implementation thatdoes this, it is better to clip the image to remove these spurious regions. Removing n -1 pixels from the right hand side and m - 1 pixels from the bottom will ﬁx things.
Convolution can be used to implement many diﬀerent operators, particularly spatialﬁlters and feature detectors. Examples include Gaussian smoothing and the Sobeledge detector.
You can interactively experiment with this operator by clicking here.
2003 R. Fisher, S. Perkins, A. Walker and E. Wolfart.
KOBI2013-OA-171 Funding Schemes: Research for the benefit of specific groups (SMEs) PS details PROPOSAL AT A GLANCE Proposal name: MRSA-HUNTER -- Development of a point-of-care diagnostic system with automated sample preparation for the rapid identification of MRSA infections Subject: The project would be based on a combination of a highly sensitive DNA-based sensor integrate
Enliven Festival Saturday 7th July BANDSTAND Somahigh Soma High are a rock band from the South Coast generating a buzz wherever they go performing tracks from their forthcoming debut album ‘Secrets That Didn’t Happen’. Their new music is bursting with fresh energy and ambition and demonstrates the band pushing the boundaries of modern melodic punk rock. Vocalist and song writer Se