Image Processing & Correction

Convolution

One operation, infinite uses — change the kernel, change the filter

Definition
Convolution is an operation that produces a new image where each output pixel is a weighted sum of nearby input pixels. The weights live in a small grid called the kernel — typically 3×3, 5×5, or 7×7. To compute one output pixel: place the kernel centered on the corresponding input pixel, multiply each kernel weight by the input pixel underneath it, and sum the products. Slide the kernel one pixel over and repeat. The full output image is what you get when the slide has covered every input pixel. The kernel is the entire identity of the filter — change the weights, change what the filter does.
Supporting
H&EDSPTCH
Video · Supporting
The kernel is the filter
Same operation, different weights
Kernel size is window size
Bigger kernel, broader smoothing
Sum-of-weights = brightness scaling
Don't accidentally darken your image

What's actually happening at the edges

One subtlety: when the kernel slides over a pixel near the image boundary, some of its cells fall off the edge of the input. There's no value there to multiply by, so you have to invent one. The common choices: pad with zeros (which darkens edges), repeat the boundary pixel, or reflect the image. Each produces slightly different results in the first few pixels of the output. Most BOM convolutional filter engines expose this as a border-handling parameter; the default usually works, but it's worth knowing why your output looks slightly off in the corners.

The morphological operationsLoading... face the same boundary handling with their structuring elementLoading... — same underlying action, same edge subtlety, applied to binary masks instead of grayscale intensities.

Share This Term
Term Connections