Histogram of Oriented Gradients (HOG)
Images contain far more raw pixel values than a computer needs to recognize a shape. Histogram of Oriented Gradients (HOG) is a classic way to reduce an image region to a compact description of its visible outlines—especially the edges that form a person, car, letter, or tool.
How HOG captures shape
HOG starts by measuring the image gradient at each pixel: how brightness changes horizontally and vertically. Strong changes indicate edges. Each edge also has an orientation, such as vertical, horizontal, or diagonal. HOG divides the image into small cells, then counts how much edge strength falls into several direction bins within each cell. Rather than recording exact pixels, it records a local “edge-direction signature.”
Making the descriptor reliable
Neighboring cells are grouped into overlapping blocks, and their values are normalized together. This reduces the effect of shadows, contrast changes, and different camera exposure. The final HOG descriptor is a long numeric vector that preserves a rough spatial layout: edges near the top remain distinct from edges near the bottom. A common configuration uses 8×8-pixel cells, 2×2-cell blocks, and 9 orientation bins.
Where it is used and why it matters
HOG became well known for pedestrian detection: a detector slides a fixed-size window across an image at multiple scales, computes HOG features, and uses a classifier such as a linear SVM to decide whether each window contains a person. It is also useful for:
- Recognizing handwritten characters in OCR systems.
- Finding defects with distinctive edges in production-line inspection.
- Describing object shape when training data is limited.
Histogram of Oriented Gradients (HOG) is a hand-engineered image descriptor that represents an object’s shape by counting local edge-gradient directions across small image cells, with contrast normalization over neighboring blocks. It captures silhouette and contour structure while reducing sensitivity to illumination changes. HOG was foundational for classical object detection, especially pedestrian detection, and remains useful as an interpretable feature for lightweight vision systems.
Imagine recognizing a person from their shadow. You may not see colors, faces, or clothing details, but the outline of arms, legs, and posture still tells you a lot. Histogram of Oriented Gradients (HOG) is a way for a computer to describe an image in a similarly simplified form.
It pays attention to where brightness changes sharply—such as along the edge of a person, bicycle, or car—and records the directions those edges point. The result is a compact “shape summary” of the image. HOG became especially useful for finding pedestrians in photos and video because human body outlines remain recognizable even when lighting or clothing changes.