How to change the patch_size in the local_binary_pattern function?

I am implementing a version of a Local Binary Pattern filter code, using skimage’s local_binary_pattern function. However, I have 3 parameters that need to be set, namely numberOfPoints, radius, as well as patchSize, while the function only takes the first 2 parameters.

I need to set it to a value of 32, instead of what the default value is. Can someone help me with this?

@harbarex forgive me, I’m not very familiar with LBP, but why would you want a patch size different from 2x radius? You are only going to grab the points around that radius anyway…? At least, that’s my interpretation of the source code.

Are you perhaps thinking of multiblock_lbp?

I was actually trying to reproduce a paper, and they used a radius of 12, with a patch size of 32. That is why I wanted to change the values.

Could you link the paper?

LBP Fingerprinting.pdf (1.0 MB)

Ah, so it looks like they compute LBP repeatedly on blocks in the image, then append the results to each other. If I understand the paper correctly should use skimage.util.view_as_blocks, then iterate over those blocks, computing LBP on each block, and finally concatenating the results using np.concatenate.

So right now I was just cropping parts of the image, and manually setting the number of blocks to divide the image into. However, that led to some mixed values near the boundaries, and np.concatenate couldn’t join them, even though all the blocks were divided equally. Is there no other way to do this?

I don’t believe so. If you can share code and a sample image, we can maybe help you to get around the error.

LBP.zip (3.2 MB)

I have attached the python script, as well as a sample image. In case you can help me with this, it would be great. The SubHeight & SubWidth are what need to be changed. (I am looking for 97 x 97 to work )