Index


RISC World

Convolve

Martin Carradus

!Convolve

!Convolve processes Acorn Sprite files by performing 'matrix convolution' on them. This produces an altered image which can be saved by the user.

Computer bitmap images are made up by little square areas called 'pixels' that each have an associated single colour or grey level.

A matrix is a square of numbers, in this case three high by three wide. The 'convolution' means looking at each 3 x 3 pixel neighbourhood in the input image, laying the matrix over that area, and mutiplying each pixel value by the corresponding number in the matrix at the same offset from the central pixel. These multiples are then summed together and this gives the output image value at the central point where the matrix was laid down.

Because the numbers in the convolution matrix can be negative, the value coming out of each convolution can sometimes be negative, so the 'absolute' value coming out of each convolution is taken. That is, the value with the sign taken out i.e. if the value becomes negative it is multiplied by -1 to always make the absolute value coming out positive.

Further more, !Convolve uses two matrices, with values chosen by the user, and simultaneously applies both. The two absolute values coming out of the convolutions are summed and the resulting vale halved. This gives the output pixel value. If the user intended only to use one matrix, then both matrices can be given the same values, and this will have the desired effect.

The values in the two matrices are displayed on a 'ToolBar' and are each altered by clicking on one of three vertical or three horizontal buttons for 'High', 'Medium' or 'Low' pass horizontal or vertical 'filters' respectively. The user can also select a 'None' button which suppresses any filtering to the input image for the respective matrix.

The selectable 'Low pass filter' reacts most strongly to those spatial pixel values that are altering the most slowly as the convolution moves over the input image. Hence it 'smooths out' the image.

The selectable 'Medium pass filter' reacts most strongly to spatial pixel values that are altering linearly as the convolution moves over the input image and 'differentiates' them. Hence it reacts to constant spatial pixel values by producing a zero value (or the colour black) and produces a white value when an edge in the image is encountered.

The selectable 'High pass filter' reacts to even more rapid spatial change than the 'Medium pass filter'. It still reduces areas of constant pixel values by producing a zero value (or the colour black).

The Processing can only be performed only after an Analysis of the image has been performed. This measures the degree of relatedness between pixel values both horizontally, vertically and diagonally and produces a 'goodness of fit' value (correlation) that is closer to one, the better the fit happens to be. This is only so noise can be added, if desired, with the same characteristics. If you don't intend to add noise, you needn't be bothered by this part of the program. It has no bearing on the matrix convolution, which is a separate process.

Usage.

After having unzipped the !Convolve application, double click on its icon to load it onto the icon bar, then either drag a Sprite file to the icon, or left click on the icon and drag a Sprite file into the window that appears. Clicking the middle 'Menu' button either over the bar icon or the window gives you a set of options including getting the 'ToolBar' with the matrices to appear. Having Analysed and Processed an image you can 'UnDo' and 'ReDo' the processing to look at the alteration the processing has made.

Menus and Commands

  • Info - Displays program information.
  • Save - Saves the current displayed image.
  • Save Corrupt - Saves the noisy displayed image.
  • Display - Shows the current window.
  • ToolBar - Shows the !Convolve ToolBar. Choose filter characteristics from this.
  • Add Noise - Adds correlated noise to the loaded and analysed image.
  • Analyse - Automatically calculates correlated noise parameters and correlation, by performing a 2D regression on the original image.
  • Process - Processes the image with the current ToolBar parameters.
  • ReDo - Brings back the last processed image.
  • UnDo - Brings back the original image.
  • Help - Shows this info. This may only be done once in a session.
  • Quit - Quits the !Convolve application.

ToolBar Entries

  • Rho X - Horizontal Correlation.
  • Rho Y - Vertical Correlation.
  • Rho XY - Diagonal Correlation.
  • Sigma - The amount of noise present in the regression.
  • Corrn - Overall Goodness of Fit. (The nearer to zero, the poorer the fit, the nearer to + or - 1, the better the fit).

  • Red - Mean of Red Values. (Zero in the case of grey level images).
  • Green - Mean of Green Values. (Zero in the case of grey level images).
  • Blue - Mean of Blue Values. (Zero in the case of grey level images).
  • Tint - Mean of Tint Values.

Matrix Convolution

Applies the First Matrix and Second Matrix spatially at each point in the image, then adds the absolute values coming out and divides by two.

Buttons running horizontally (High, Med or Low) for each matrix, result in Vertical High, Medium and Low Frequency spacial filters.

Buttons running vertically (High, Med or Low) for each matrix, result in Horizontal High, Medium and Low Frequency spacial filters.

'None' stops any filtering at all in the matrix concerned. The appropriate matrices are calculated automatically for the user.

Martin Carradus

 Index