Save resource to class

Loading your classrooms…

Sign in to save

Bookmark this page so you can find it later.

LivePhysics staff accounts use their usual sign-in provider below.

Sign in to save

Bookmark this page so you can find it later.

LivePhysics staff accounts use their usual sign-in provider below.

Report an Error

Reported page · Lab

Image Convolution & Filter Lab

/labs/image-convolution-lab/

This helps us reproduce what you saw. Clear the link to leave it out.

or drop them here

Up to 3 images or PDFs, 5 MB per file. 0 of 3 attached.

Image Convolution & Filter Lab

Image filters are built from a tiny grid of numbers called a kernel. Slide that kernel over every pixel, multiply and sum, and you get blur, sharpen, edge detection, and more. Pick a sample image and a kernel, edit its weights, then hover or tap any pixel to watch the convolution happen one neighborhood at a time.

Guided ExperimentWhich kernel finds vertical edges, and what does Sobel Y do instead?

You will filter the vertical-edge sample. Predict which kernel produces a strong response right at the edge column, and predict what happens when you switch from Sobel X to Sobel Y on the same image.

Write your hypothesis in the Lab Report panel, then click Next.

Input48 × 48 pixels
Input, 48 by 48 pixels
KernelGaussian blur
Sum = 16Divisor = 16Bias = 0

A changed weight makes a custom kernel with no bias, divided by its sum, or by 1 when the sum is 0. Choose a kernel under the scene to go back to a named filter.

Filtered outputsame size
Filtered output, 48 by 48 pixels

Hover or tap a pixel in either image to see how its output value is made.

The amber box marks the 3 × 3 neighborhood and the teal box marks the pixel being computed in both images.

Inspected pixel
Sample image
Kernel
Quick experiments

Active kernel Gaussian blur

A weighted blur that favors the center. Smooths noise while keeping a natural look.

Pixel computation (the sliding-window dot product)

Hover or tap a pixel in either image to see its 3 × 3 neighborhood multiplied by the kernel and summed into the output value.

What this filter does

Filtering the Circle sample with the Gaussian blur kernel.

This is a smoothing kernel. It averages each pixel with its neighbors, which softens edges and reduces noise.

Data Table

(0 rows)
#SampleKernelEffect
0 / 500
0 / 500
0 / 500

Reference Guide

What a Convolution Is

A convolution slides a small grid of weights, the kernel, across the image. At each pixel it lines the kernel up with the pixel and its neighbors, multiplies matching cells, and adds the products into a single new value.

  • Kernel. A small matrix of weights, here 3 × 3.
  • Neighborhood. The pixel plus the 8 around it.
  • Output. The weighted sum, written back into a new image.

Repeating this for every pixel produces a filtered image the same size as the original. The weights alone decide what the filter does.

Common Kernels

A handful of classic kernels cover most of image processing. Their weights tell you at a glance whether they smooth, sharpen, or detect change.

  • Box and Gaussian blur. Positive weights that average and smooth.
  • Sharpen. A large positive center against negative neighbors.
  • Laplacian edge detect. A zero-sum kernel that responds to change.
  • Sobel X and Sobel Y. Gradient kernels for vertical and horizontal edges.
  • Emboss. Turns gradients into a lit relief effect.

Normalization, Bias, and Borders

Two small details keep the output looking right. The divisor normalizes the sum so brightness is preserved, and the bias shifts results into a visible range.

  • Divisor. Usually the kernel sum, so a blur of all-equal weights averages.
  • Bias. Added after dividing, often 128 for zero-sum kernels so flat areas read as mid-gray.
  • Borders. Edge pixels lack full neighbors, so this lab clamps to the nearest edge value.

Without a bias, a zero-sum edge kernel would map every flat region to black. The bias lifts it to gray so the edges stand out against it.

From Filters to Neural Networks

These same operations power both classical image editing and modern computer vision. The kernel is the unit that scales up into deep networks.

  • Image processing. Blur, sharpen, denoise, and edge maps in any photo editor.
  • Feature detection. Sobel and Laplacian kernels find edges and corners.
  • Convolutional neural networks. Each layer learns its own kernels from data instead of using fixed ones.

In a convolutional network the weights you edit by hand here are learned during training, so the network discovers the filters that best solve its task.

Related Content