CV Lab 06 · Module 2 — Filtering & Noise

Convolution & Kernels

Almost every image filter — blur, sharpen, edge detect, emboss — is the same operation with a different tiny matrix of numbers. Slide the matrix over the image, multiply, sum, save. This is the one operation to rule them all.

85 92 110 180 195 ? window slides → multiply · sum → one output pixel
The moving window A kernel is a small matrix (usually 3×3). Place it over every pixel in turn, multiply each neighbour by the matching kernel weight, sum them all. That one number becomes the output pixel — and the whole kernel decides what kind of filter you just built.
Ready.

Pick a preset to see its 3×3 kernel and its effect. Same operation, wildly different jobs.

Current kernel
Size 3×3 Sum 1 Divisor 1

Why convolution is the whole game

One operation, many jobs

Blur, sharpen, emboss, edge detect, Sobel gradients, motion blur, unsharp mask — every classical image filter uses the exact same code. What changes is the tiny matrix of weights. Learn the operation, get 20 filters for free.

Positive vs negative weights

Positive weights blend the neighbour into the centre. Negative weights subtract it. That single sign flip is the difference between smoothing (all positive) and detecting change (mixed). Look at the kernel signs and you can predict what a filter will do without running it.

The bridge to deep learning

A convolutional neural network is this same slide-and-sum operation — but with hundreds of kernels stacked in layers, and the numbers learned from data instead of hand-designed. Every "Sharpen" preset here is what an early CNN layer might learn on its own after training.

Predict, then verify

You have a kernel whose weights all sum to zero (e.g. Laplacian: [[0,1,0],[1,-4,1],[0,1,0]]). Applied to a large area of flat, uniform grey, what will the output value be there?