The convolution tester is an application I built to test different convolution kernels on imagery. The program reads in a bitmap, JPEG, etc. and displays the original image in the left window and the result of the convolution in the right. The image windows are connected so that scrolling in one causes the other to scroll appropriately. Sample screenshots are below:

Image Convolved with 9x9 Linear Falloff Point Spread Kernel


RGB Image Convolved with 9x9 Point Spread Kernel (Displayed in HotCold Colormap)


Image Convolved with 3x3 Horizontal Sobel Edge Detector (Displayed in Rainbow Colormap)


Image Convolved with 1x1 Inversion Kernel


Kernel Input Window

This image shows a color bitmap read in as a grayscale and convolved with a point spread function to blur the image. The inputs and controls for the program are at the top. The top left window is a text parser that converts user text into an array to use for the kernel. The user inputs data delimited by spaces or commas and hits the Update Kernel button and the convolution tester reads the text and converts it into a double precision array. See below:

Kernel Input Window


The Clear Kernel resets the kernel to a 1x1 kernel with a value of 1. This way if the kernel is convolved on an image, the original image is returned. The final button in the Kernel Input window is Unitize Kernel. This is used to convert the existing kernel to a kernel with an overall weighting of 1. The pair of images below shows this. The left image shows the original 3x3 kernel. This kernel has a +2 weight. The right hand image shows the kernel after being unitized. The entire kernel has been divided by it's total weighting to give a total weighting of 1.

Left: Original 3x3 Kernel. Right: Unitized 3x3 Kernel


Kernel Preview Window

The kernel preview window gives the user a graphical representation of the kernel. The 9x9 kernel used in the original screenshot is shown below. The left image shows the 9x9 kernel in a gray colormapping. The lowest values are displayed in black while the highest values in the kernel are shown in white. The right hand image shows the same colormap, but displayed in the HotCold colormap.

Left: 9x9 Kernel in Grayscale Colormap. Right: Same Kernel Displayed in Hot Cold Colormap


Kernel Info and Control Windows

The kernel info window gives the user the basic information about the kernel. The topmost field is the height and width of the kernel. The second field is the overall weighting of the kernel. The final fields on the Kernel Info window are the value ranges of the colormap. This gives the max and minimum values in the kernel.

To preserve data ranges after a convolution this value should be equal to 1. To get gradient data out of the convolution the weighting should be close to or exactly 0. And if the weighting is less than 0 the kernel is going to invert the coloring of the input image.

The controls window allows the user to apply the convolution to the input image or an already convolved image. The Apply Kernel button applies the current kernel to the input image and displays the results in the output window. The Re-Apply Kernel button applies the current kernel to whatever is in the output window already. If the output image is a convolved image, the Re-Apply Kernel button will apply the convolution a second time to the output window. The final button, Reset Image, sets the output image equal to the input.

Left: Kernel Info Window. Right: Controls Window.