# Why does the local_binary_pattern function in scikit-image provide the same value for different models

I am using the `local_binary_pattern` function in the scikit-image package. I would like to compute the rotation invariant uniform LBP of 8 neighbors within 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 output

``````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 some same values in `lbp` do not correspond to the same uniform pattern. E.g., `lbp[1,1]` and `lbp[2,2]` are both 6. But the LBP of `image[1,1]` is

``````1 0 0
1 x 1
1 1 1
```
```

The LBP of `image[2,2]` is

``````1 1 1
1 x 0
1 1 1
```
```

where based on the values in `lbp`, I assume the `local_binary_pattern` function uses 'greater or equal to' to compare with neighbors.

The LBPs of `image[1,1]` and `image[2,2]` are both uniform. But how could `image[1,1]` and `image[2,2]` have the same LBP value?

The rotation-invariant LBP does not use the pixel values of neighbors directly, but rather values interpolated on a circle (for the rotation invariance). See https://github.com/scikit-image/scikit-image/blob/master/skimage/feature/_texture.pyx#L156

Also see the original LBP paper http://vision.stanford.edu/teaching/cs231b_spring1415/papers/lbp.pdf, which mentions "The gray values of neighbors which do not fall exactly in the center of pixels are estimated by interpolation."