Loading
Module 9 of 12

Computer Vision & Image Processing

About 11 minute read

Computer vision is the field of getting computers to interpret images and video. The first thing to internalize is almost anticlimactic: a digital image is just a matrix of numbers (Module 2's matrix, applied directly). A grayscale image is a 2D grid where each cell holds a brightness value, typically 0 (black) to 255 (white). A color image is usually three such grids stacked together — one each for red, green, and blue intensity.

Filters and convolution

A classic image-processing technique is to slide a small grid of numbers, called a kernel (or filter), across the image. At each position, you multiply the kernel's values by the pixels underneath it and sum the results — that sum becomes one pixel of the output image. This sliding, multiply-and-sum operation is called convolution.

Different kernels detect different things: a blur kernel averages neighboring pixels together to smooth the image; an edge-detection kernel produces a large value only where brightness changes sharply (an edge) and near-zero elsewhere. Try switching kernels below and watch how the same 9×9 image responds differently to each one.

Run a filter over an image
An image is just a grid of numbers (brightness values). Pick a filter (kernel) and see how it transforms the pixels.
Original (9×9 pixels)
-1-1-1
-18-1
-1-1-1
Edge detect kernel
After "Edge detect"
Key idea: Notice that a kernel is applied uniformly across the whole image — the same 3×3 numbers, everywhere. That's the "shared weights" trick that makes convolutional neural networks efficient: the network doesn't need to separately learn what an edge looks like in the top-left corner versus the bottom-right.

From hand-picked filters to learned filters

Everything so far used a fixed, hand-designed kernel. A Convolutional Neural Network (CNN) takes the same convolution operation, but instead of a person choosing the kernel's numbers, they become learnable parameters — trained with gradient descent, exactly like Module 8, so the network discovers on its own which filters are useful for the task.

A CNN typically alternates two kinds of layers: convolutional layers (applying many learned filters to detect increasingly complex features) and pooling layers (shrinking the image by keeping only the strongest signal in small regions, which makes the network faster and more tolerant of an object appearing in a slightly different position). After several rounds of this, the shrunken, highly-processed representation is "flattened" into a vector and fed into a regular neural network layer (like Module 7) that makes the final prediction.

Input image32×32×3Convolutionedge / texture mapsPoolingshrink, keep the maxConvolutionshape / part mapsFlatten + Densecombine everythingOutput"cat" 92%
A convolutional neural network passes an image through filters that gradually turn pixels into a decision.

This layered structure mirrors how the network's understanding builds up: early layers tend to learn simple edges and colors, middle layers combine those into textures and shapes, and later layers combine shapes into recognizable parts and objects — the same "increasingly abstract features" idea from Module 7, applied specifically to pixels.

Where this shows up

CNNs (and their more modern successors, like vision transformers) power photo tagging, medical image analysis, self-driving car perception, facial recognition, and quality-control inspection on manufacturing lines — anywhere a computer needs to turn pixels into a decision.

Check your understanding
1. A grayscale digital image is fundamentally represented as:
2. Sliding a small grid of numbers across an image and computing a weighted sum at each position is called:
3. What is different about a CNN's filters compared to the hand-designed edge/blur filters in the demo?
Did you like the lesson? 😆👍
Consider a donation to support our work: