Lecture 15
Local Binary Patterns (LBP) & Histogram of Oriented Gradient (HoG)
Local Binary Patterns (LBP)
LBP
• Mainly designed for monochrome still images
– Have been extended for color (multi channel)
– Videos …
• Were introduced by Ojala et al. “A comparative study of texture
measures with classification based on feature distributions”. Pattern
Recognition. 29(1), 51–59 (1996)
LBP
• The local binary pattern operator is an image operator which
transforms an image into an array or image of integer labels
describing small-scale appearance (textures) of the image.
• These labels directly or their statistics are used for further
analysis.
• It is assumed that a texture has locally two complementary
aspects, a pattern and its strength
• local binary pattern operator works in a 3×3 pixel
• The pixels in this block are
– thresholded by its center pixel value,
– multiplied by powers of two (Decimal)
– then summed to obtain a label for the center pixel
– 256 different labels
1. Local Binary Pattern (LBP)
• Description of pixels neighbourhood
• Binary short code to describe neighbourhood
• Operates by taking difference of central pixel with neighbouring pixels
• Mathematically
𝑷−𝟏
𝑳𝑩𝑷𝑹,𝑷 = 𝒔 𝐠 𝒑 − 𝒈𝑪 . 𝟐𝒑
where, 𝒑=𝟎
neighborhood pixels 𝑔𝑝 in each block
is thresholded by its center pixel value 𝑔𝑐 Binary threshold function s 𝒙 is,
p sampling points (e.g., p = 0, 1, …, 7 for a 3x3 cell, where P = 8) 𝟎, &𝒙 < 𝟎
s 𝒙 =
R radius (for 3x3 cell, it is 1). 𝟏, &𝒙 ≥ 𝟎
Coordinates of “𝑔𝑐 ”is (0,0) and of “𝑔𝑝 ” is (x + Rcos(2π p/P), y − Rsin(2π p/P))
Computation of Local Binary Pattern
Binary code for ≥ gc
0 1 0
1 gc 0
3 7 2 0 2 0
0 0 1 LBP
8 4 1
Component-wise
128 ? 0
∑ 146
2 3 5 multiplication Sum
1 2 4
Neighborhood 0 0 16
of a gray-scale
image 128 8
Representation
64 32 16
Example of how the LBP operator works
Computation of LBP
LSB
164 30 99 1 0 0 1 2 4
200 150 177 MSB 1 1 128 8
83 215 20 0 1 0 64 32 16
Example Weights
Binary Thresholds
1 1
Binary Pattern: 0 1 0 1 0 0
(MSB) (LSB)
Code/Weight 2𝑝 : 1 x 27 0x 26 1 x 25 0x 24 1x 23 0x 22 0x 21 1 x 20
= 128 =0 = 32 =0 =8 =0 =0 =1
LBP: 1 + 0 + 0 + 8 + 0+ 32 + 0+ 128 = 169
STANDARD LBP Filter
Advanced LBP (P,R)
P = Pixels
R = Radius
LBP(8,1) LBP(16,2) LBP(20,4)
LBP Advantages and disadvantages
Advantages Disadvantages
• High discriminative power • Not invariant to rotations
• Computational simplicity • The size of the features increases
• Invariance to grayscale exponentially with the number of
neighbours which leads to an increase
changes and of computational complexity in terms of
• Good performance. time and space
• The structural information captured by it
is limited. Only pixel difference is used,
magnitude information ignored.