Uniform LBP Features and Spatial Histogram Computation
Introduction
In the earlier article we had seen that we had computed a LBP image.Each pixel in this image still can take $2^8$ possible values. The idea of uniform LBP is to perform lossy encoding so that we eliminate some irrelevant data and retain useful information which takes on 58 possible values. In this article we will look at Uniform LBP and computation of Spatial Histogram of LBP which can be used as a feature for image description.- Uniform LBP features are considered as one which have only 2 contigious regions corresponding to 0's and 1's,while non uniform LBP have more than 1 contigious regions corresponding to 0's and 1's.
- This we need a mapping from which assign each on $2^8$ possible codes to one of 58 encoded uniform LBP values.
- All the non uniform codes are assigned to a single values.
- The uniform LBP's can be viewed as corners,line,ramp gradient
- The non uniform LBP's are assumed to be irrelevant and can be ignored.
- A uniform binary pattern can be identified by performing a bit wise traversal and checking if number of bit transitions are atmost 2 .
- This is done by first circular right/left shifting the given code and performing XOR operation with the original code.
- Since we need to only consider 8 bit numbers ,we need perform circular shift and masking MSB for integers.
- Now number of bit operations is simply the number of set bits in the result
- The code for this can be as follows
- the method to count bits is naive way and since we are using 8 bit words,it will take 8 iterations of the for loop.
- Brian Kernighan's method performs this by going through as many iterations as set bits
- The result can be precomputed for possible input code to determine if a LBP is a uniform code or not.
- The next task is to map the LBP codes to one of 58 uniform codes.
- The encoding will be done along the rows as per the below figure
No comments:
Post a Comment