Unified LBP with local_binary_pattern scikit-image function

I am using local_binary_pattern from skimage.feature with uniform mode like this:

>>> from skimage.feature import local_binary_pattern >>> lbp_image=local_binary_pattern(some_grayscale_image,8,2,method='uniform') >>> histogram=scipy.stats.itemfreq(lbp_image) >>> print histogram [[ 0.00000000e+00 1.57210000e+04] [ 1.00000000e+00 1.86520000e+04] [ 2.00000000e+00 2.38530000e+04] [ 3.00000000e+00 3.23200000e+04] [ 4.00000000e+00 3.93960000e+04] [ 5.00000000e+00 3.13570000e+04] [ 6.00000000e+00 2.19800000e+04] [ 7.00000000e+00 2.46530000e+04] [ 8.00000000e+00 2.76230000e+04] [ 9.00000000e+00 4.88030000e+04]] 

Since I take 8 pixels in the neighborhood, it is expected that he will get 59 different LBP codes (because it is a single method), but instead he gives me only 9 different LBP codes. In a more general case, always return P + 1 labels (where P is the number of neighbors).

Is this a different kind of unified method, or am I not understanding something?

+5
source share
1 answer
Good question. Take a look at the LBP example in the gallery. In particular, look at the following image:

Lbp patterns

  • Homogeneity:. Since you selected 'uniform' , the result includes only patterns in which all black dots are adjacent and all white dots are adjacent. All other combinations are designated as “uneven”.
  • Rotation invariance: Note that you selected 'uniform' rather than 'nri_uniform' (see the API docs ), where “nri” means the invariant without rotation. This means that 'uniform' is a rotation invariant. As a result, the edge, which is represented as 00001111 (0 and 1 s is black and white dots in the figure above), is going to the same tray as 00111100 (0s are adjacent because we wrap it from front to back).
  • Rotating invariant uniform combinations:. Given the invariance of rotation, there are 9 unique homogeneous combinations:
    • 00000000
    • 00000001
    • 00000011
    • 00000111
    • 00001111
    • 00011111
    • 00111111
    • 01111111
    • 11111111
  • Uneven results: If you look at the result more closely, there are actually 10 bins, not 9. The 10th bunker combines all the uneven results.

Hope this helps! If you have not done so already, the LBP example is worth a look. I heard that someone spent a lot of time on this;)

+8
source

All Articles