AI in Motion

Edge Detection with Sobel Filters

Computer VisionBeginner1:185 chapters

Edges are where brightness changes quickly. Compute horizontal and vertical gradients with Sobel filters and combine them into an edge map.

📄 Illustrated notes · every chapter as a picture · printable

Shortcuts: Space play/pause · ←/→ 5 s · N/P chapter · M voice · C subtitles · F fullscreen

Quick quiz

3 questions to check your understanding.

Q1 An edge is where…
Q2 How is edge strength computed from Gx and Gy?
Q3 What do the first layers of trained CNNs often look like?

Go deeper

University-level written lectures in The AI Lecture Hall:

Transcript

Introduction. Edges outline objects. They are where brightness changes suddenly. Finding them is one of the oldest and most useful steps in computer vision.

Sobel in action. Start with this simple image. The Sobel filter for horizontal change highlights vertical edges: pink where it gets brighter, blue where it gets darker. The vertical-change filter highlights horizontal edges. Combining the two, using the square root of the sum of squares, gives edge strength in every direction.

The maths. At every pixel we have two numbers: Gx, the change from left to right, and Gy, the change from top to bottom. The edge strength is the square root of Gx squared plus Gy squared, and the angle tells us the edge’s direction.

Why edges matter. Classic computer vision built features like SIFT and HOG on top of edges and corners. The Canny detector refines edges into thin clean lines. And remarkably, deep networks learn edge-like filters in their very first layer on their own.

Recap. To recap. Edges are rapid changes in brightness. Sobel filters measure them in two directions. Their combined magnitude gives edge strength, and CNNs discover similar filters by themselves.