An edge is a place where brightness changes fast, so the first step drops color and keeps only brightness. Each pixel becomes one number from 0 (black) to 255 (white):
The weights match human vision: we see green as the brightest color and blue as the dimmest.
Camera sensors are noisy, and every speck of noise is a tiny brightness jump that would show up as a fake edge. A Gaussian blur replaces each pixel with a weighted average of its neighbors, with the closest ones counting most. Sigma (σ) sets the blur radius in pixels: more blur means fewer fake edges but softer real ones. Try 0 and watch the later steps fill with speckle.
The Sobel filter slides this 3x3 grid of weights over the image, multiplies the 9 pixels under it by the weights, and adds them up. That gives the left-to-right slope: right column minus left column, with the middle row counted twice. Vertical edges light up.
The same grid turned 90 degrees: bottom row minus top row. Orange means brighter going down, blue means darker going down. Now horizontal edges light up, like a tabletop or a shelf.
Together, (Gx, Gy) is the gradient: a vector pointing the way brightness increases fastest. Its length, √(Gx² + Gy²), is the edge strength, whichever way the edge runs. Show direction colors each pixel by the angle of that vector instead.
Keep pixels stronger than the threshold, drop the rest, and you get edge lines. Too low and noise creeps back, too high and faint edges vanish. Thin lines keeps a pixel only if it beats its neighbors across the edge (non-maximum suppression, one step of the Canny edge detector), so thick bands become crisp 1-pixel lines.
Here the edges are drawn over the live camera. Cartoon filters ink them as outlines (the Cel Shade Camera uses this same Sobel step). Robots use them for line following, lane detection, and finding object outlines before trying to recognize anything.