home *** CD-ROM | disk | FTP | other *** search
-
- Kernel Operations "An Introduction"
-
- Kernel operations are operations on an image which work in the
- following manner. Each output pixel is created by using not only data
- from the corresponding input pixel, but also its neighbouring pixels -
- thus allowing such actions as smoothing, sharpening and noise removal
- (plus many other operations) to be performed.
-
- In Image a kernel size of 9 is used, thus each pixel plus its eight
- nearest neighbours are used. The kernel is specified by giving 11
- values, one for each of the kernel positions (these nine values are
- collectively termed the kernel mask) and also a multiplier and
- a divider. The kernel operation works as follows (per output pixel) :
-
- 1) For each of the 8 neighbours and the pixel in question, the pixel
- values (red, green and blue components) are multiplied by the
- relevant value for the kernel operation, the results of all these
- multiplications are then added together.
-
- 2) The resultant values (red, green and blue) are then further
- multiplied by the 'multiplier' and then divided by the 'divider'
- to produce the result (output) red green and blue values for the
- pixel in question.
-
- This may seem a bit complex, but it is fairly simple, and very
- powerful. As an example let us consider the case where the kernel is
- defined as :
-
-
- 1 1 1 multiplier = 1
- 1 1 1
- 1 1 1 divider = 9
-
- In this case the result is that all nine pixels are added together and
- the total divided by 9 - thus the result is the average of the 9 input
- values. In cases where the result of a kernel operation is an average
- of input values, this tends to make the operation a 'Smoothing'
- operation (it will tend to blur the picture, removing harsh lines).
-
- If you were to replace the central value in the above kernel with,
- say, 4 and make the divider 12 then the result would still be a
- smoothing operation, but this time there would be a bias towards the
- central input pixel - the result of this is that the smoothing will be
- less.
-
- In smoothing operations is is generally best to make the multiplier 1
- and the divider equal the sum of the kernel position values - this
- ensures that the overall brightness of the output image will be
- (approximately) the same as that of the input image. By increasing the
- multiplier, or reducing the divider, the result will be a brighter
- output - whilst increasing the divider will produce a darker output.
-
- In fact, often Image can calculate the multiplier and divider required
- simply by pressing the 'Auto' button. This button takes the values
- currently in the 9 kernel positions and calculates values for the
- multiplier and divider which will maintain overall brightness in the
- image (the multiplier will always be set to 1, in fact in most kernel
- operations the multiplier will be 1).
-
- The opposite of a smoothing operation is a sharpening operation, and
- this too can be performed by the kernel operation. One way to sharpen
- an image is to subtract from it a smoothed version (this may sound
- odd, but it works). The simplest of these can be created thus :
-
- -1 -1 -1 multiplier = 1
- -1 9 -1
- -1 -1 -1 divider = 1
-
- Another standard kernel operation is that of noise removal (removing
- random dots from an image). There are several methods of doing this,
- indeed the smoothing operation will tend to smooth out noise. But to
- remove noise needs a further trick, and Image can perform just such a
- trick.
-
- By placing a '<' or a '>' in front of the central value in the kernel
- mask you alter the way n which the operation will be performed. In
- this case the operation is carried out as before, except that the
- central pixel is not used in the calculation (ie. only the 8
- neighbours are used, the multiplier and divider values need to take
- account of this, the 'Auto' option will take account of this
- situation).
-
- After the result is known, instead of using it as the output directly,
- first this value is subtracted from the input pixel value for the
- central pixel (ie. the one missed out in the calculation). The result
- of this subtraction is then compared with the value in the central
- kernel mask position (the value following the '<' or '>') (this value
- should be a value from 0 to 255). If the results is less than (in the
- case of '<') or greater than (in the case of '>') the value given then
- the result gained from the kernel calculation is used as the output,
- otherwise the pixel being worked on is passed directly to the output,
- unchanged.
-
- What we need here is an example :
-
- 1 1 1 multiplier = 1
- 1 >50 1
- 1 1 1 divider = 8
-
- Now let us assume the the pixel intensities for the pixels being
- investigated are :
-
- 15 12 18
- 7 88 9
- 11 10 12
-
- Now the kernel operation is performed thus, first calculate the kernel
- value using the 8 neighbours, etc.
-
- V = ( 15*1 + 12*1 + 18*1 + 7*1 + 9*1 + 11*1 + 10*1 + 12*1 ) * 1 / 8
-
- = 11.75
-
- Next we subtract that value from the input pixel being considered
- (here 88)
-
- D = 88 - 11.75 (note: absolute value is taken)
-
- = 76.25
-
- Now we compare this value with the value given in the central kernel
- mask position (50) and note that it is greater. Thus (because the
- operation is '>') we use the value 'V' as the output (we output 11.75)
- as being the result for that pixel.
-
- The result of this operation is the removal of the value 88 which is
- uncharacteristic of the surrounding area (ie. likely to be noise). By
- altering the value following the '>' we alter the amount of noise
- removed (the sensitivity), larger values make it less sensitive, small
- values make it more sensitive.
-
- But what of the '<' operation, this is of no use to noise removal.
- Indeed not, but it has a use of its own. With the '<' operation the
- tendency will be to average areas of similar intensity, but preserve
- areas of great fluctuation in intensity - the result being a smoothing
- operation which tends not to blur edges (unlike the standard smoothing
- operations).
-
- Finally kernel operations can produce some very odd results,
- experimentation can lead to some wonderful effects.
-
-