I'm trying to understand how scikit's local binary pattern function works. Let's take the simplest setup: input is a grayscale image, radius = 1, n_points = 4, method = "uniform". How does this output an image? From what I understand, there's a sliding 3x3 window that passes through the whole image. At each location, take the value of the center pixel and compare it to the values of the pixels above, left, below and right of the center pixel. Each may be less than or greater than the value of the center pixel. That's 2^4 = 16 possibilities. Make a histogram of how often each of the 16 possibilities occurs. The problem is that this is a histogram, not an image. So why does local binary pattern return an image? I asked someone about this, and he said maybe they don't make the histogram, and instead record the information about which pixels are greater than or less than the center as a length 4 binary vector. This can then be converted into an integer between 0 and 15 in the obvious way. Do this for all the pixels, and the result can then be interpreted as a greyscale image, with 16 levels. Ok, but this conversion necessarily depends on the order in which the neighboring pixels (above, left, below, right) are taken. So why does the documentation say that the "uniform" setting is rotation invariant? Continue reading...