Convolve Node

The Convolve node is a convolution filter. It can sharpen, soften, or emboss an image, detect its edges, and perform a variety of other functions. It is a very powerful node, but one that may take a little time to learn how to control and apply effectively.

The Convolve node operates on one pixel at a time, beginning with the first pixel in your image and proceeding sequentially through the image until every pixel has been filtered. The filtering process uses a convolution function to apply kernel cell values to each pixel. (The Convolution Kernel is explained in more detail below.)

You can select from a number of predefined convolution kernels (using the Library popup menu on the Convolve tab). You can also create your own filters by entering values into the cells of a kernel. You can modify the values of one of the predefined kernels in the library to suit your needs, or you can select a "generic" kernel (using the Kernel Size parameter) and modify the values in its cells. Another option is to add a control image to define the kernel, as explained in "Using an Input as a Kernel ."

The Convolution Kernel

A kernel is a matrix of cells. Convolve offers three kernel sizes: 3 x 3, 5 x 5, or 7 x 7. In a nine cell (3 x 3) matrix, one central cell is surrounded by eight adjacent cells.

The central cell (E) represents the pixel to which the filtering process will be applied. The eight adjacent cells represent the eight adjacent pixels in the image. The adjacent pixels will not be modified when the filtering process is applied to the central cell; only the central pixel will change during this iteration of the filter. The adjacent cells will be modified when each of them in turn becomes the central pixel and is subjected to the filtering process.

Controlling Changes in Brightness

Unless you wish to modify the brightness of an image, the sum of all cell values must be equal to the number of cells in the matrix. In the following example, which uses integer data, all cells sum to nine (for floating point data, all cells must sum to 1). In this case, the overall brightness of the image being processed will not be affected.

If the sum is less than nine, the image will be darker after processing; if the sum is greater than nine, the image will be brighter after processing.

Blurring

The Convolve node will use the color values of the adjacent pixels to modify the color value of the center pixel. The extent to which each adjacent pixel will contribute information to the processing of the center pixel is represented by the values in the adjacent kernel cells.

The Convolve node will begin by looking at Pixel A and Pixel E. Since the value in each kernel cell is 1, the Convolve node will modify Pixel E so that it becomes 1/9 of its original value, plus 1/9 the value of Cell A, 1/9 the value of Cell B, etc.

In other words, each of the nine cells in the kernel will contribute its color value in equal measure to the resultant pixel; they will be "averaged" together, or in effect "blurred."

If you modified this matrix as follows, the resultant pixel would contain 2/9 of the color values of cells A, D, and G; 1/9 the color values of B, E, and H; and none of the color values of cells C, F, and I.

If you placed a 9 in the center of the matrix, surrounded by a zero in each adjacent cell, the Convolve node would have no effect on the image. It would process each pixel, but leave it unchanged (returning 9/9ths of its original value).

If you placed a 9 in an adjacent cell, as shown below, the Convolve node would effect a one-pixel shift, or offset, of the image to the right.

By creating a kernel with intermediate values that both blur and offset the image, you can effectively create a motion blur.

As mentioned above, blurring an image may be thought of as averaging the values of a pixel with its surrounding pixels. The more adjacent pixels you include in the computation, the blurrier the image will become.

Edge Detection

The inverse of a blurring process would entail detecting the edges of an object in an image and making the edges sharper. The Convolve node is also an effective edge-detection tool.

Three of the predefined matrices, "3x3 Laplacian," the "7x7 Prewitt," and "7x7 Canny," are effective edge detection paradigms. And of course, you may craft your own, depending on your requirements.

Convolve Node Inputs

The Convolve node accepts one, two, or three inputs:

  • Input 1: The top input is the image to be convolved.
  • Input 2: The middle (optional) input is used as a convolution kernel.
  • Input 3: The bottom (optional) input is used as a control image.

Using an Input as a Kernel

The middle, optional, input image is treated as a kernel in the convolution. That is, the value of each pixel represents a cell value in the kernel matrix.

Therefore, the kernel input must be one-channel image that is an odd-size square less than 256 pixels (a 15 x 15 pixel grid, for example, which consists of 225 pixels).

Convolve Parameter Tab

Library

The Library parameter enables you to choose from a menu of predefined cell matrices to perform various types of filtering processes, including several options for blurring and edge detection. The best choice will depend on the nature of the input image. The kernel you select is displayed in the node panel, where you can evaluate and modify cell values.

3 x 3 Average (Mild Blur)

This filter effects a mild blur.

3 x 3 Laplacian (Edges)

This filter is an edge-detection tool. The edges in the resultant image will be emphasized, appearing as bright lines.

3 x 3 High Pass (Sharpen)

This filter is used to sharpen the image.

5 x 5 Low Pass (Stronger Blur)

This filter is stronger than the 3 x 3 blur. It will pass color frequencies in the lower ranges through to the output image; higher frequencies will be filtered out.

5 x 5 Gaussian (Blur)

This filter is an alternative to the low pass blur.

5 x 5 Quadratic (Smooth)

This filter is a subtle blur that removes noise to effectively smooth the image.

7 x 7 Prewitt (Edges)

This filter is an edge-detection tool that operates on a broader range of pixels than the Laplacian filter.

7 x 7 Canny (Edges)

This filter is an alternative edge-detector to the Prewitt filter.

Kernel Size

The Kernel Size enables you to select the size of the input matrix. You can choose from 3 x 3 (9 values), 5 x 5 (25 values), or 7 x 7 (49 values). The input matrix is displayed at the bottom of the Convolve parameter tab.

Kernel Type

The Kernel Type parameter allows you to choose either Integer or Floating Point data values.

Normalize

This option is applicable to floating point operations only. When checked, Normalize ensures that the sum of the kernel is 1 by dividing each cell in the kernel by the sum of all the cells in the kernel.

Border

The Border parameter enables you to specify how the Convolve node will handle the pixels that border the image, since these pixels do not have adjacent pixels on all sides to contribute values to the kernel matrix.

  • Do not convolve leaves the values of the border pixels unchanged.
  • Convolve with black assigns a value of 0 to kernel cells that fall outside the image borders.
  • Convolve with mirror convolves each border pixel as if there were adjacent pixels on all sides by mirroring the values of the inner adjacent pixels, as illustrated below.

The white boxes represent actual pixels in the upper-left border of an image to be convolved; the gray boxes represent the mirror values that would be used in the top and left rows of cells of the kernel matrix.

Channel Mask

The Channel Mask parameter enables you to inhibit the modification of any channel by deselecting the Red, Green, Blue, Alpha, or Other channel icons.

Control Image Parameters

The Control Action and Control Channel menus enable you to specify how an optional control image input will govern the node operation, as explained in "Using Control Images with Filter Nodes ."




Table of Contents | Index



Copyright 1996-1999 by Silicon Grail Corporation