Daniil's blog

Machine Learning and Computer Vision artisan.

Google Summer of Code: Multi-Block Local Binary patterns implementation. Pure Python

A post describing my way of implementing MB-LBP and achieved results.


The selected API

The API of the function was taken from OpenCv. It was done in order to allow users to use OpenCv for training their object detector and connect it later to Scikit-Image. The training part will also be implemented for Scikit-Image. This step will just allow users to be more flexible and also by doing this Scikit-Image Face detection Framework will be tested on much earlier stage.

This is the visual description of MB-LBP that OpenCv uses:

Cascade of classifiers

Implemented functions

For this part two function were implemented:

  1. Function that computes the MB-LBP given the left-top corner coordinates, width and height of one of 9 equal rectangles (See the previous part with OpenCv API).

  2. Function that takes the computed MB-LBP feature and visualizes it on the selected image.

MB-LBP visualization

The hatched regions show the rectangles that has less summed intensity value than the central one.

Cascade of classifiers Cascade of classifiers Cascade of classifiers

Future plans

The next stage will be to implement the same thing using Cython.

Code

The code of functions can be found here. The code that was used for generating images in the post is here.

Test coverage

Implemented functions were covered with tests.