Chapter 21
Interactive Lab
Images as Matrices

Images as Matrices

Explore pixels, brightness, contrast, thresholding, filters, convolution, edge detection, pooling, and high-dimensional image vectors. Every picture on this page is a numerical array.

1. Pixel Painter

Click cells to turn pixels on and off. A tiny image is just a matrix of brightness values.

Matrix View

The same image as numbers. White pixels are 1; black pixels are 0.


    
A grayscale image is a matrix: A = [aij].

2. Brightness, Contrast, Inversion, Threshold

These are pixelwise operations: every output pixel depends only on one input pixel.

Controls

0.00
1.00
0.50
Try high contrast and then thresholding. You are turning a picture into a decision rule.

3. Convolution Filter Playground

A filter is a small matrix slid across the image. Each output pixel is a local dot product.

Choose a Kernel


    
Filtered pixel = sum of patch entry × kernel entry.

4. Pooling and Downsampling

Pooling reduces resolution. Average pooling keeps coarse brightness; max pooling keeps strong activations.

5. Image as High-Dimensional Vector

A 32 × 32 image is a point in 1024-dimensional space. Distance between images is vector distance.

0
0.00
1024dimension
0.00distance
0.00relative

6. Reflection Prompts

Use the interactive tools above, then write short answers.

Prompt 1. Which operations are pixelwise? Which operations use neighborhoods?

Prompt 2. Why is convolution a linear algebra operation?

Prompt 3. Why might pixel distance disagree with human visual similarity?