Local binary patterns

Calculates image LBP (Local binary patterns).
21.5K Downloads
Updated 25 Jul 2017

View License

The LBP tests the relation between pixel and it's neighbors, encoding this relation into a binary word. This allows detection of patterns/features, while being immune to contrast changes.
Current submission presents pixel-wise implementation, and filtering based implementation, achieving much shorter run-times. Both implementations achieve same results, while running at different passes. Do not use ‘pixelwiseLBP’ unless for educational or debugging purposes.
Current implementation is aligned with "Gray Scale and Rotation Invariant Texture Classification with Local Binary Patterns" from http://www.ee.oulu.fi/mvg/files/pdf/pdf_6.pdf.
The differences:
This implementation supports multi-color inputs (RGB).
Rotation invariance can be same for all channels, or channel wise manner.

Cite As

Nikolay S. (2024). Local binary patterns (https://www.mathworks.com/matlabcentral/fileexchange/36484-local-binary-patterns), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.92.0.0

Minor updates added

1.9.0.0

Resolved a few bugs related to circishift (found by Michael and Olga) and sort. Added if changing function behavior based on Matlab version.

1.8.0.0

Removed duplicated outdated files. thanks to Olga for finding this.

1.7.0.0

Resolved the bug reported by Michael.

1.6.0.0

The function “roundnS” was added to the submission aimed to replace the “roundn” function that is apparently part of the Matlab Mapping Toolbox, which may be missing from some of the users trying to run this code.

1.5.0.0

Changed filter direction (to CCW), starting point (3 o'clock instead of 12), support pixels interpolation.

1.4.0.0

- Support Circular filter, as in M. Pietikäinen papers.
- Works on multiple color channels (gray-scale, RGB, La*b and even spectral images).
- Support Rotation Invariant mode.
- Two LBP version- pixels wise, and efficient.
Enjoy

1.2.0.0

A Helix/Snail indexing function was аdded to scan neighborhood pixels as spiral.

1.1.0.0

Many thanks goes to Chris Forne for his sharp eye. Bugs fixed, and some modification introduced.

1.0.0.0