Prewitt Operator Edge Detection
Prewitt senses brightness change with two plain kernels that weight every row equally. It is Sobel without the double-weighted center.
Why Does This Exist?
Before Sobel became standard, Prewitt offered the simplest gradient estimator that still smooths: differentiate along one axis, average along the other, weight all rows the same. On clean high-contrast images it finds the same boundaries as Sobel with slightly less arithmetic and no special center weight to remember.
It belongs with the first-order detectors under spatial filtering. Prefer Sobel on noisy images, and step up to second-order tools like the Laplacian when you need both sides of an edge.
Think of It Like This
Three judges with equal votes
Three judges score a dive with equal votes and the average stands. Sobel instead lets the middle judge vote twice, trusting experience over rookies. Equal votes are simpler to explain and fair when all judges are sober, which is clean images. When the rookies are drunk on noise, you want Sobel's weighted panel instead.
How It Actually Works
The Prewitt kernels replace Sobel's 1-2-1 profile with a flat 1-1-1 average:
subtracts the left column from the right with every row equal. Magnitude and direction follow exactly as in Sobel. Responses run weaker than Sobel's because no row is doubled.
Worked example
Reuse the dark-to-light step window:
, against Sobel's 400 on identical input. Same edge, same direction, three-quarters the strength, and slightly more noise per unit signal since the center earns no extra trust.
Watch Out For
Noisier than Sobel on grain
Equal row weights smooth less along the averaging axis, so speckle leaks into the response more easily. The symptom is ragged edges where Sobel draws clean lines on the same noisy input. Switch to Sobel, or pre-blur, whenever grain is visible.
The Quick Version
- Prewitt estimates gradients with two 3x3 kernels using flat 1-1-1 weights.
- Magnitude and direction combine exactly as in Sobel.
- Responses run weaker and noisier than Sobel on identical input.
- It suits clean high-contrast images and quick teaching demos.
- Default to Sobel for real noisy images.