# Difference between LBP and LBPH

Is there a difference between Local Binary Patterns (LBP) and Local Binary Patterns Histograms (LBPH) or is it the same thing?

I'm just a little confused because in the documentation it appears sometimes as LBP and other times as LBPH.

Note: this is just a conceptual doubt.

edit retag close merge delete

Sort by » oldest newest most voted

The difference between a LBP and a LBPH is that a LBP refers to the specific binary code that you get from using the LBP operator on a given pixel in a grayscale image, while the LBPH is a histogram representing the number of occurances for each binary code for a given image patch. The basic LBP operator works as follows:

For a given pixel p of a binary image patch check the n pixels in a radius r around p in a clockwise or counter-clockwise manner. If a pixel around p has a higher intensity than p that pixel is denoted as a 1, if not a 0. For a pixel p with n = 8 and r = 1 this results in a 8 bit binary code (LBP), for example 10101011. This code is then translated to a decimal value, 171 in our example, which gets assigned to p. This is then done for the whole image patch and the occurance of each decimal value is counted. The number of occurances result in the LBPH.

Hope this helps to clarify the issue :)

more

1

Thank you so much @ThorbjornSomod. Then, the LBP operation represents the operation that calculates a new decimal value for a specific pixel based on its neighbors (as you described) and the LBPH just measures the occurrence of each decimal value (after applying the LBP operation) creating a histogram. If I understood correctly the histogram is used to decrease the data dimension, is that correct?

For example:

Thinking of a grayscale image after applying the LBP we can get the following pixels:

pixels: 20, 20, 12, 15, 20, 12, 15, 13, 20, 12, ...


Applying the histogram approach we can get:

pixels: 12, 13, 15, 20, ...
occurrence: 3, 1, 2, 4, ...

2

Yes that is correct :) The histograms that you retrieve are commonly used as the feature vectors when doing classification. So, when using the ordinary LBP operator, the histogram of a 8 bit grayscale image describes the occurrence of each of the 256 grayscale values after converting to LBP form. This can then be described as a vector of 256 elements. However, it is not common to use the ordinary LBP operator because of it's large dimension. I would look into uniform local binary patterns for a start (LBP-U2). This operator reduces the dimension from 256 -> 59 without harming the accuracy notably. Good luck!

1

@Kelvin, yes, absolutely correct. the point is, that you can compare the occurrence based histograms with L2 distance (those are real numbers), but not so with the lbp images (the pixels there are "bitstrings", binary.

Official site

GitHub

Wiki

Documentation