Skip to main content
BVDART Logo
← All guidesFilters & transforms

Convolution kernels

A kernel combines each pixel with its neighbors. Change the weights to blur, sharpen, or find edges.

Show me the math ↓

The playground

Input image48 × 48 px
Click to inspect a pixelx 24 · y 24
The kernel3 × 3
Find edges

Keep the changes. Let flat areas disappear.

Output imageFind edges
Output image

Every pixel, recalculated.

Slide. Multiply. Add. Repeat.

Pixel 1,177 / 2,304
02 / Under the hood

One pixel. Nine little decisions.

Take a pixel and its eight neighbors. Multiply each value by its kernel weight, then add the results.

The pixel you selected[24, 24]

1. Read the neighborhood

Brightness from 0 to 255

2. Apply the weights

Kernel rotated 180° for convolution

3. Add them up

0
sum -91 ÷ 1 = -91
Black
White

Below 0 → clipped to black.

In a flat region, positive and negative weights cancel. At an edge, they don’t—so positive responses light up. Negative responses are clipped to black.

03 / Build your intuition

Same operation. Different ways of seeing.

This study uses generated grayscale patterns, a stride of one, and replicated border pixels. Results are rounded and clipped to 0–255. Convolution rotates the kernel 180°; these presets are symmetric, so the rotation leaves them unchanged. The Lab applies its matrix directly (correlation): rotate an asymmetric matrix yourself to reproduce this study there.

Scan the same ring through edge, identity and blur kernels. Use any control to take over.

What to try
  1. Switch between Original, Box blur, Sharpen and Find edges. Try the rings, checkerboard and wave patterns.
  2. Click a pixel or move with the arrow keys, edit a weight or the divisor, then follow the neighborhood, rotated weights and output brightness below. Step or animate the scan to move across the image.
Open in the Lab ↗

What to look for: Blur shares brightness with the neighbors. Sharpen strengthens local differences. An edge kernel cancels flat regions; positive responses light up while negative results are clipped to black.

How it works

Multiply each neighborhood value by the corresponding coefficient and sum the products. A normalized all-ones 3 × 3 matrix averages nine samples. Negative weights can subtract neighbors, making edges and directional differences visible. A bias shifts the result before it is clamped to a displayable channel value.

The playground shows the original and filtered images, then breaks down the pixel you select. It rotates the kernel 180° for mathematical convolution and repeats the closest sample at image boundaries. The Lab instead applies the displayed matrix directly (correlation). The symmetric presets behave identically either way; rotate an asymmetric matrix to reproduce this study in the Lab.

Use it in the Lab

Use Custom kernel in the Lab for 3 × 3 through 9 × 9 matrices, channels, bias, boundaries and repeated passes. Save a named kernel once its effect is useful and record it in a chain.

Limits & distinctions

RGB-only kernel processing keeps alpha unchanged. For transparency-aware softening, compare the dedicated blur tools, which handle premultiplied color during filtering.

Further reading

The Sliding Window

A convolution kernel (or filter) is a small matrix — typically 3×3 or 5×5 — that is slid across every pixel of an image. At each position, the kernel values are multiplied element-wise with the underlying pixel values and summed to produce a single output pixel.

convolve.js
// 3×3 Sharpen kernel
const sharpen = [
  [ 0, -1,  0],
  [-1,  5, -1],
  [ 0, -1,  0]
];

// Apply: for each pixel (x, y)
let sum = 0;
for (let ky = -1; ky <= 1; ky++)
  for (let kx = -1; kx <= 1; kx++)
    sum += image[y+ky][x+kx] * sharpen[ky+1][kx+1];
javascript

Common Kernels

Kernel Zoo

Gaussian blur smooths noise. Sobel detects horizontal/vertical edges. Laplacian finds contours. Unsharp mask enhances detail. Emboss creates a 3D relief effect. Each is just a different set of matrix weights.

Different kernels produce dramatically different effects. The Gaussian blur kernel averages nearby pixels weighted by a bell curve. The Sobel operator uses two kernels — one for horizontal edges, one for vertical — and combines them via √(Gx² + Gy²).

Chaining Operations

In BVDART, convolution is the namesake technique. Artworks are built by composing chains of kernel operations — blur, then edge-detect, then sharpen — each one revealing hidden structure in noise fields and procedural textures. The order matters: the same kernels in a different sequence produce entirely different compositions.

Try chaining a Gaussian blur (σ=2) followed by a Laplacian edge detect — this is the Laplacian of Gaussian (LoG) operator, excellent for finding edges at a specific scale.

Articles

Related artworks

Related Lab categories

Sources & references

Guide updated