I have already seen that OpenCV provides a classifier based on LBP histograms:
But I want to have access to the LBP histogram itself. For instance:
histogram = calculate_LBP_Histogram( image )
Is there any function that performs this in OpenCV?
For calculating the LBP, the LBP code for each pixel is calculated and the histogram of LBP codes is constructed as the LBP feature. To calculate the lbp code, for each pixel p, the 8 neighbours of the center pixel are compared with the pixel p and the neighbours x are assigned a value 1 if x ≥ p. Fig.
LBPH (Local Binary Pattern Histogram) is a Face-Recognition algorithm it is used to recognize the face of a person. It is known for its performance and how it is able to recognize the face of a person from both front face and side face.
Local Binary Pattern (LBP) is a simple yet very efficient texture operator which labels the pixels of an image by thresholding the neighborhood of each pixel and considers the result as a binary number.
You can get the C++ code for computing LBP using OpenCV's Mat data structure here:
http://www.bytefish.de/blog/local_binary_patterns
You should be able to find the Python version as well on the same site.
The code is written by Philipp Wagner, who I believe contributed the face recognition code you mentioned to OpenCV, so it should be the same thing.
The LBP code is found in the file: OpenCV-2.4.2/modules/contrib/src/facerec.cpp as a static function. Unfortunately, it does not appear to be exposed for public use (at least for OpenCV 2.4.2).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With