Ask Your Question

Difference between LBP and LBPH

asked 2017-06-18 11:09:39 -0500

Kelvin gravatar image

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 flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-06-18 14:31:54 -0500

ThorbjornSomod gravatar image

updated 2017-06-18 14:35:04 -0500

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 :)

edit flag offensive delete link more



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, ...
Kelvin gravatar imageKelvin ( 2017-06-18 21:01:14 -0500 )edit

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!

ThorbjornSomod gravatar imageThorbjornSomod ( 2017-06-19 03:28:25 -0500 )edit

@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.

berak gravatar imageberak ( 2017-06-19 03:30:58 -0500 )edit

Question Tools

1 follower


Asked: 2017-06-18 11:09:39 -0500

Seen: 1,904 times

Last updated: Jun 18 '17