StrataQuest Home › StrataQuest Glossary › Custom filter
BOM Operation

Custom filter

Write the weights yourself

View
Definition
Custom filter performs convolutionLoading... with a kernel of weights you supply. The kernel is the parameter. Fill a 3×3 kernel with 1/9 and you have the Average filterLoading.... Weight it toward the center, summing to 1, and you have Gauss-style smoothing. Enter 3 x 3 | -1 0 1 | -2 0 2 | -1 0 1 and you have the horizontal SobelLoading... gradient. The named filters are its special cases.
Named filters are fixed kernels
Custom exposes what named engines hide
Kernel sum determines brightness behavior
Sum 1 keeps brightness; sum 0 finds edges
Symmetry shapes directional behavior
Asymmetric kernels detect specific orientations
Bigger kernels cost more
5×5 and 7×7 reach farther, at a cost

The math, in two registers

Discrete 2D convolution with a kernel K of size (2k+1)×(2k+1), centered on the origin, is:

O(x, y) = Σᵢ₌₋ₖ^k Σⱼ₌₋ₖ^k I(x+i, y+j) · K(i, j)

The notation hides a subtlety. Mathematicians often define convolution with a flipped kernel: (I * K)(x, y) = Σ I(x−i, y−j) K(i, j). Image-processing engineers usually leave the kernel unflipped, which is technically a correlation, and for symmetric kernels such as Gauss and Laplace the distinction vanishes. Asymmetric kernels such as Sobel are usually written with no flip in mind. The StrataQuest reference does not say whether Custom filter flips the kernel, so for an asymmetric kernel, check the sign of the response on a known edge before relying on it.

Linearity makes convolutional filters composable. (K₁ + K₂) * I = K₁ * I + K₂ * I lets you build a complex filter by adding simpler ones. (K₁ * K₂) * I = K₁ * (K₂ * I) lets you apply one combined kernel instead of two sequential filters, which is useful when the combined kernel is small but the individual ones aren't.

Simplified

At every pixel position, the filter lays the kernel on the image, multiplies each kernel cell by the input pixel beneath it, adds the products, and writes the sum to the matching output position. The kernel stays the same everywhere it goes.

Share This Term
Term Connections