Local Binary Patterns
LBP turns every pixel into an 8 bit texture code from its neighbors, so faces and surfaces match by pattern counts rather than raw brightness.
Why Does This Exist?
Texture tells faces, wood, and fabric apart when color and exact brightness do not. Raw pixels shift with every lamp change, but the order of brighter versus darker neighbors stays stable. LBP captures that order cheaply.
It codes each pixel from its ring, then pools codes into histograms over cells. Those histograms feed classical classifiers for faces and materials. For edge direction histograms instead, see HOG.
Think of It Like This
A neighborhood height census
Stand on one paving stone and ask which of the eight around you stands taller. Write yes or no eight times. That 8 bit note describes your spot without naming any height.
Do this for every stone, then count note types per block. Two brick paths give similar counts even when one sits in shade. The analogy stops at scale: fixed rings miss larger weaves unless you grow the radius.
How It Actually Works
For center and neighbors on radius , set bit when :
This gives values to . Uniform patterns with at most two to transitions keep codes plus one bin for the rest, so bins per cell. Histograms over cells form the face or texture vector.
Worked numbers
Center with neighbors gives bits , which sums to . That code has six transitions, so it falls in the non-uniform bin. A flat cheek patch of gives mostly ones, code , a uniform spot. Face grids often use cells times bins for values.
Watch Out For
Noise flips single bit codes
One gray level of noise can flip a neighbor bit and move a pixel to a distant code. Smooth lightly or use ternary variants when sensor noise is high, or histograms jitter frame to frame.
Fixed radius on multiscale texture
Radius sees yarn but not weave. Add radii and or a pyramid when texture spans sizes, or large patterns alias into uniform bins.
The Quick Version
- LBP codes each pixel from 8 neighbor comparisons.
- Uniform codes compress values to bins.
- Cell histograms form a lighting tolerant texture vector.
- Strong for faces and materials, weak across large scale shifts.
- Pair multiscale radii for coarse weaves.