CONVOLVE

Purpose: Perform a convolution on an image file using an external user defined kernel loaded from a text file

Format:   CONVOLVE   image file     kernel file    <output file>

Notes:     The  CONVOLVE  statement performs matrix multiplication calculations for each pixel in the image specified by the  image file  parameter.  If the optional  <output file>  parameter is set then the results are written to this file instead of over-writing the input file.  The convolution kernel is loaded from an external text file specified by the  kernel file  parameter. The kernel file may be generated using a text editor or a spreadsheet program capable of saving output in  ASCII text format.  The kernel must have an equal number of odd rows and columns.  While the kernel can be any size,  practical limits are 25 rows by 25 columns for convolving larger image files.

Example:

# Create a noisey image file.
window = 1.0
level = .5
image_height = 256
image_width = 256
image_type = 1
outfile noise.img
bmp rough.bmp
process begin
out = random(1)
process end

# Smooth it out using a averaging kernel.
convolve noise.img smooth5.ker

# Create a BMP for viewing the smoothed image.
infile_a noise.img
bmp smooth.bmp
process begin
out = ina
process end

exit