local binary pattern
The Local Binary Pattern (LBP), developed by Timo Ojala and colleagues in the mid-1990s, is a remarkably simple yet powerful descriptor of local texture, the fine-grained surface pattern of a region such as the weave of fabric, the grain of wood, or the pores of skin. The intuition is that texture is largely defined by the relative arrangement of light and dark micro-patches, not their absolute brightness. So LBP asks, for each pixel, a purely relative question: which of my neighbours are brighter than I am? The answer, encoded as a binary number, is the pixel's local texture code.
The basic operator works on a 3-by-3 neighbourhood. Take the centre pixel as a threshold, and for each of its 8 surrounding pixels write a 1 if that neighbour is greater than or equal to the centre and a 0 otherwise. Reading these 8 bits in a fixed order around the ring produces an 8-bit number between 0 and 255, the LBP code for that pixel. Because the comparison is purely relative to the centre, the code is unchanged by any monotonic brightening or darkening of the whole neighbourhood, which gives LBP strong invariance to illumination, a major practical advantage. A texture is then described by the histogram of these codes over a region: how often each of the 256 patterns occurs.
Two refinements make LBP far more useful. First, the circular generalization samples P neighbours on a circle of radius R (interpolating intensities where the circle does not land on pixel centres), letting the operator capture texture at different scales and neighbourhood sizes. Second, the notion of uniform patterns observes that the vast majority of natural texture codes contain at most two transitions between 0 and 1 around the ring (these correspond to edges, corners, spots, and flat spots); LBP groups all non-uniform patterns into a single bin, shrinking the histogram from 256 to 59 bins while keeping nearly all the discriminative power and adding robustness. Rotation-invariant variants further canonicalize each code by rotating it to its minimum value.
LBP is fast (only comparisons and a histogram), illumination robust, and compact, which made it a long-time favourite for texture classification, facial expression and face recognition (the classic approach divides the face into a grid of cells, computes an LBP histogram per cell, and concatenates them), and medical image analysis. Spatio-temporal extensions such as LBP-TOP handle video, and CLBP and other variants encode magnitude as well as sign. Like the other hand-crafted descriptors, LBP has largely been overtaken by learned CNN features for high-accuracy tasks, but it remains a strong, interpretable, low-compute baseline and is still common in embedded and resource-constrained settings.
A 3×3 patch with centre value 50 and neighbours [60, 40, 55, 30, 70, 45, 80, 20] (clockwise from top-left) becomes bits [1,0,1,0,1,0,1,0]. Read in order this is binary 10101010 = 170, the LBP code recorded in that pixel's histogram bin.