Hi Charles Ding.
Well LBP is pretty simple. As far as I remember I've used Wikipedia, and some Google on top of it to understand it. This should be enough...
Chris Forne, thanks for your comment. Indeed I've overlooked some issues. I hope I've resolved all- both those you've mentioned, and some others I've found myself.
Unfortunately this function does not compute the LBP correctly.
To fix it you need to change 'sign(currNieghDiff)' to 'currNieghDiff > 0'.
You should also change 'if nNeigh<=8' to 'if nNeigh<=9', as nNeigh = number of neighbours + 1.
Finally in the Primitive pixelwise solution you need to change
neighMat( ceil(nNeigh/2))=false;
to
neighMat( ceil(nNeigh/2)+ 1 )=false;
Comment only