Edge Detection with Sobel Filters — lecture notes
Edges are where brightness changes quickly. Compute horizontal and vertical gradients with Sobel filters and combine them into an edge map.
0:001. Introduction

Edges outline objects. They are where brightness changes suddenly. Finding them is one of the oldest and most useful steps in computer vision.
0:102. 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.
0:313. 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.
0:494. 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.
1:065. 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.
Key takeaways
- Edges are locations where image brightness changes rapidly.
- Sobel filters estimate horizontal (Gx) and vertical (Gy) change.
- Edge strength = √(Gx² + Gy²); direction = atan2(Gy, Gx).
- CNNs learn edge-like filters in their first layers.
Check yourself
- An edge is where…
Show answer
Brightness changes quickly — Edges are strong local changes in intensity.
- How is edge strength computed from Gx and Gy?
Show answer
√(Gx² + Gy²) — It is the length of the gradient vector.
- What do the first layers of trained CNNs often look like?
Show answer
Edge and colour detectors — Early layers learn simple local patterns like edges.
Go deeper
- Image Processing Fundamentals: Filtering, Convolution and Edge Detection · The AI Lecture Hall
- Classical Features: Harris Corners, SIFT, HOG and Bag of Visual Words · The AI Lecture Hall
© 2026 Janin A Apurba, CSE, AUST · Advanced ICT Officer, CNRS-UNHCR. All rights reserved. Notes for the animated lecture at https://ai-in-motion.vercel.app/watch/edge-detection.html