next up previous contents
Next: Separable Filters Up: 12.3.2 The Convolution Operation Previous: 12.3.2 The Convolution Operation

Two-Dimensional Convolutions

Since in image processing we generally operate on two-dimensional images, we extend equation 8 to:
 equation2975

To convolve an image, the filter array is aligned with an equal sized subset of the image. Every element in the convolution kernel array corresponds to a pixel in the subimage. At each convolve step, the color values of each pixel corresponding to a kernel array element are read, then scaled by their corresponding kernel element. The resulting values are all summed together into a single value.

Thus, every element of the kernel, and every pixel under the kernel, contributes values that are combined into a single convolved pixel color. One of the kernel array elements corresponds to the location where this output value is written back to update the output image.

Generally, convolving is done with separate input and output images, so that the input image is read-only, and the outputs of the individual convolution steps don't affect each other.

After each convolution step, the convolution kernel filter position is shifted by one, covering a slightly different set of pixels in the input image, and a new convolution step is performed. The cycle continues, convolving consecutive pixels in a scanning pattern, until the entire image has been convolved.

The convolution filter could have a single element per-pixel, where the RGBA components are scaled by the same value, or have separate red, green, blue, and alpha values for each kernel element.



David Blythe
Thu Jul 17 21:24:28 PDT 1997