Image texture analysis: extractLBPfeatures MATLAB function

5 views (last 30 days)
Hi,
I implemented the localBinaryPattern code. Thanks to @Image Analyst, I was able to understand how they were derived.
Now, I am trying to understand the extractLBPfeatures function in MATLAB. It is troubling me a lot. This function produces a feature vector of size '1 by 59 single '. I understood, why the size is 59 but I am not able to understand how they were derived and how the LBP values turned into decimal values. Somewhere I read histogram normalized. But how exactly? Can anyone help me please.
The code is attached with a few extra lines to show where I am having trouble.
  1 Comment
Towfeeq Fairooz
Towfeeq Fairooz on 24 Aug 2022
Thank you for the code. It really helped. I would really appreciate if your or anyone else can help me with this please.

Sign in to comment.

Answers (1)

Udit06
Udit06 on 7 Sep 2023
Hi Towfeeq,
I understand that you want to know how the LBP features are extracted and how they are converted to decimal values. Consider the following figure:
A 3*3 matrix for LBP illustration
To find the LBP feature value corresponding to any centre pixel, you compare the centre pixel value with the value of its 8 neighbours. If the intensity of the centre pixel is less than or equal to its neighbour, we set the value to 1, otherwise we set it to 0.
Hence, for the above figure we do the following:
(82>68=1)(57>68=0)(90>68=1)(53>68=0)(92>68=1)(56>68=0)(99>68=1)(78>68=1)
Thus, the LBP code obtained in binary:
Once we obtain the binary code as shown above, we can simple apply binary to decimal conversion to get the decimal value.
(10101011)2=(171)10
The decimal value obtained above work as a feature for the pixels in the patch and the frequencies of these features in a patch forms a histogram.
You can refer to the following research paper to understand more about Local binary pattern.
I hope this helps.

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!