Object Detection Using Local Binary Patterns

LBPs are local patterns that describe the relationship between a pixel and its neighborhood.

Local Binary Patterns (LBPs) have been used for a wide range of applications ranging from face detection [1], [2], face recognition [3], facial expression recognition [4], pedestrian detection [5], to remote sensing and texture classification [6] amongst others in order to build powerful visual object detection systems [7]. Many variants of LBPs have been proposed in literature [8]. The most common approach however, dictates that each 3×3 window in the image is processed to extract an LBP code. The processing involves thresholding the center pixel of that window with its surrounding pixels using the window mean, window median or the actual center pixel, as thresholds. Then the LBP code is given by Equation 1, where I_thresh is the chosen threshold value and I_n are the intensities of the surrounding window pixels with (n=0,1,…,7).

Image for post
Image for post

The overall process consists of the following steps (shown in Figure 1): 1) Threshold the values in a neighborhood (image window) with the chosen threshold placing 1 where the value is greater or equal than the threshold and 0 otherwise. 2) Multiplying the resulting binary map with a predefined mask (usually incremental powers of two). 3)Sum the values to obtain an 8-bit LBP Code.

Fig. 1 LBP Code Generation

The result of LBP processing is an image assembled by LBP features. The next step to creating an LBP-based descriptor requires dividing the LBP-based image in k blocks of W_width × W_height pixels (e.g. 2×4,4×4,8×8). A local histogram is generated for each block in the image in order to build local image descriptors. The local histograms are then concatenated to form a single global histogram, as show in Figure 2. The global histogram approach effectively expresses information in three different levels: the individual LBP code contains information at the pixel-level, the local histograms contain information on a regional level, and the concatenated regional histograms contain a global description. As such, the resulting histogram encodes both local and global characteristics in a compact representation which makes it more robust to object pose and illumination variations.

Fig. 2. LBP Histogram Generation

Each local histogram measures the occurrence of each of the 256 possible LBP codes in the block. The number of bins necessary for the histogram description can be determined by the resulting accuracy after the training and testing phases. When all 256 bins are used this will result in a long histogram descriptor which will have both high computational and storage demands. Alternatively, Ojala et al, propose the concept of uniform and non-uniform patterns to both reduce the number of possible LBP patterns and improve discrimination power. An LBP pattern is called uniform if it has 2 or less transitions e.g. 11110000, and non-uniform if it has have more than 2 transitions e.g. 10100101. It was observed that textured images are consisted mostly by uniform patterns. This also applies for object images since they can be seen as the composition of micro-textures. Hence, the histogram is divided into 59 bins instead of the possible 256, where one bin is devoted for all non-uniform patterns, and the rest are assigned to the remaining 58 uniform patterns. The general histogram descriptor can be used to feed an adequate classifier or discriminative scheme, such as support vector machines, in order to perform object detection.


  1. A. Hadid, M. Pietikainen, and T. Ahonen, “A Discriminative Feature Space for Detecting and Recognizing Faces,” in IEEE Conf. on Computer Vision and Pattern Recognition, 2004, pp. 797–804.
  2. B. Froba and A. Ernst, “Face detection with the modified census transform,” in IEEE Int. Conf. on Automatic Face and Gesture Recognition, 2004, pp. 91–96.
  3. T. Ahonen, A. Hadid, and M. Pietikainen, “Face description with local binary patterns An Application to face recognition,” IEEE Trans. on Pattern Analysis and Machine Intelligence, vol. 28, no. 12, pp. 2037–2041, 2006.
  4. Caifeng Shan, Shaogang Gong, and Peter W. McOwan, “Facial expression recognition based on Local Binary Patterns: A comprehensive study,” Image and Vision Computing, vol. 27, no. 6, pp. 803–816, 2009.
  5. Mu Yadong, Yan Shuicheng, Yi Liu, T. Huang, and Zhou Bingfeng, “Discriminative local binary patterns for human detection in personal album,” in IEEE Conf. onComputer Vision and Pattern Recognition, 2008, pp. 1–8.
  6. Li Liu, Lingjun Zhao, Yunli Long, Gangyao Kuang, and Paul Fieguth, “Extended local binary patterns for texture classification,” Image and Vision Computing, vol. 30, no. 2, pp. 86–99, February 2012.
  7. Jiri Trefny and Jiri Matas, “Extended Set of Local Binary Patterns for Rapid Object Detection,” in Computer Vision Winter Workshop, 2010.
  8. Matti Pietikainen, Hadid Abdenour, Guoying Zhao, and Timo Ahonen, Computer Vision Using Local Binary Patterns.: Springer, 2011.

PhD in Computer Engineering, Self-Driving Car Engineering Nanodegree, Computer Vision, Visual Perception and Computing

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store