lbp is basically this:
you got a pixel , and it's neighbours:
7 0 1
6 P 2
5 4 3
then you walk in a circle around the neighbours, and set a result bit, if the neighbour is larger than the center pixel.
uchar lbp(const Mat_<uchar> & img, int x, int y)
{
uchar v = 0;
uchar c = img(y,x);
v += (img(y-1,x ) > c) << 0;
v += (img(y-1,x+1) > c) << 1;
v += (img(y ,x+1) > c) << 2;
v += (img(y+1,x+1) > c) << 3;
v += (img(y+1,x ) > c) << 4;
v += (img(y+1,x-1) > c) << 5;
v += (img(y ,x-1) > c) << 6;
v += (img(y-1,x-1) > c) << 7;
return v;
}
it does not matter, where you start, or in which direction you walk, as long as you keep consistency there.
but usually, those features are not used 'as is'. i.e if you want to do some kind of 'textron-matching', you'd chop up your image into patches
----------
| | | |
----------
| | | |
----------
| | | |
----------
for each patch (3x3 here), make a histogram of lbp-features(1x256) (that's the H in LBPH), concat those to a flat 1d array(1x2304), and use this as feature vector for further classification (svm knn, or the like)