I am using the local_binary_pattern function in the scikit-image package. I would like to calculate the rotation invariant of a uniform LBP of 8 neighbors in radius 1. Here is my Python code:
import numpy as np from skimage.feature import local_binary_pattern image = np.array([[150, 137, 137, 146, 146, 148], [145, 144, 144, 144, 142, 144], [149, 144, 144, 143, 153, 147], [145, 144, 147, 150, 145, 150], [146, 146, 139, 148, 144, 148], [129, 139, 142, 150, 146, 140]]).astype(np.uint8) lbp = local_binary_pattern(image, 8, 1, "uniform") print "image =" print image print "lbp =" print lbp
And here is the conclusion
image = [[150 137 137 146 146 148] [145 144 144 144 142 144] [149 144 144 143 153 147] [145 144 147 150 145 150] [146 146 139 148 144 148] [129 139 142 150 146 140]] lbp = [[ 0. 5. 5. 1. 9. 0.] [ 9. 6. 9. 9. 8. 9.] [ 0. 8. 6. 8. 0. 3.] [ 9. 7. 1. 0. 7. 0.] [ 1. 1. 8. 9. 7. 1.] [ 3. 4. 9. 0. 2. 3.]]
What confuses me is that the same values ββin lbp do not match the same homogeneous pattern. For example, lbp[1,1] and lbp[2,2] are 6. But LBP image[1,1] is
1 0 0 1 x 1 1 1 1
LBP image[2,2] -
1 1 1 1 x 0 1 1 1
where, based on the values ββin lbp , I assume that the local_binary_pattern function uses more than or equal to compare with neighbors.
LBPs image[1,1] and image[2,2] are the same. But how do image[1,1] and image[2,2] have the same LBP value?