File Exchange

image thumbnail

Local binary patterns

version 1.9 (17.1 KB) by

Calculates image LBP (Local binary patterns).

4.33333
28 Ratings

277 Downloads

Updated

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.

Comments and Ratings (101)

Nikolay S.

Nikolay S. (view profile)

Hello mithlesh arya.
I suggest reading the papepor I have use as guidleine for this implmentation for explantion how number of features is defined and reduced: "Gray Scale and Rotation Invariant Texture Classification with Local Binary Patterns" from http://www.ee.oulu.fi/mvg/files/pdf/pdf_6.pdf
The question of pre-processing is data and application dependent. If your imagea are noisy and pre-processing removes this noise efficiently, the pre-processing is likely to improve your detection performance. On the other hand, if the pre-processing harm the fine texture detail that differentiate the cancel cell from non cancer cell, it is unlikely, So you should thinks, and make up your mind. Of course you can also try trial and error....
best regards,
 Nikolay

mithlesh arya

Hello Nikolay,
In LBP we get 256 features for each image.But by using uniform LBP we can reduce it from 256 to 59..how it works??? And I want to ask that we have to preprocessed image before feature extraction or it will work well on original image???

Nikolay S.

Nikolay S. (view profile)

Hi mithlesh arya.
You can try, and this might result in descent cancerous cell detection. It detected polyps nicely in a project I have implemented.
Best regards,
 Nikolay

mithlesh arya

hai nikolay...can i use LBP for feature extraction of cancerous cell on my database.

azkya novia

Nikolay S.

Nikolay S. (view profile)

Hi azkya novia.
I noticed that you have given my code a grade of 3/5 even before trying it? I can't say I am too happy about this.
Good luck

azkya novia

hai Nikolay. im going to try ur sourcecode ,wish me luck #newbie

Nikolay S.

Nikolay S. (view profile)

Good evening Satish Kumar.
I strongly advise reading at least a single paper on LBP (and better more)- http://www.ee.oulu.fi/mvg/files/pdf/pdf_6.pdf .
In short, 8 neighbors LBP pattern results in 2^8=256 features. Rotation invariant version reduces this number, so you got a 59 elements feature vector.
To increase the feature space you can do following (or combine some of them):
 1) Use differnt LBP filter- see filtR=generateRadialFilterLBP(nFiltSize, nFiltRadius); you can increase radius, and number of neighbors used.
 2) Combine a few LBP filters, and generate a feature vector via their concatenation.
 3) Use the row features rather the Rotation Invariant (RI) features.
 4) Propose various statistical analysis of LBP values, to generate additional features- sub image (in sliding window) STD, Mean, Median etc...

Naturally understanding the problem you are dealing with, and the applied method will results in shorter time spend in try-and-error loop.

Good luck,
 Nikolay
  

SATISH KUMAR

Hi Nikolay, i have applied this LBP on my block image of documents and it is given good results. when i chosen 8 neighbors it gives 59 features. now i wish to know what are those 59 features and can we alter the size of feature vector.

Nikolay S.

Nikolay S. (view profile)

Good evening Satish.
I understand you consider using Local Binary patterns (LBP) for Optical Character Recognition (OCR). I have not personally applied LBP for the task of OCR, but several researches have tried it successfully. I advice seeing relevant papers, and make a decision to adopt this technique, or not:

https://scholar.google.co.il/scholar?hl=en&q=ocr+with+lbp&btnG=&as_sdt=1%2C5&as_sdtp=

Best regards,
 Nikolay

SATISH KUMAR

hi, Nikolay S. i am working on camera based document images to identify the scripts from block wise, line wise and word wise. is this LBP features are helpful for me to identify the scripts. i got the dataset of indian languages like Kannada, english and hindi.

Nikolay S.

Nikolay S. (view profile)

Good evening Waleed Fathy.
You should choose a relevant region (via sliding window) of the image, and generate a feature form it. Histogram is commonly used, and it has a suited option in my code.

Waleed Fathy

I want to use LBP for a classification purpose. The output from your code is an image not a single value. Could you plz tell me how can I obtain this value?

Nikolay S.

Nikolay S. (view profile)

Hi Joydeb Barman.
Sorry for the delayed reply.
LBP can be used for the OCR task you are describing. You should chose the right scheme for you.
I can think of the following option (and I assume there are many others):
When tarining: Rescale the image, so it will fit the LBP filter used. Consider using several filters, having resulting LBP's serving the feature vctors. this is relatively efficient scheme, suitable for OCR.
Train classifier.
When detecting, you should try isolate each character, resclae it (as while training), apply LBP filters, and use classifier to identify the character.

Nikolay S.

Nikolay S. (view profile)

Hi Wan Ain Zubaidah Wan Chek Jafery.
Sorry for the delayed reply.
See the file "demoEfficentLBP.m"- this should help you with the needed parameters (btw, there are more then 2 parameters usually needed) ;).
Also, I sujject reading the function documentation, it was written to assist function users.
Good luck

Nikolay S.

Nikolay S. (view profile)

Hi Ido Ger.
Sorry for the delayed reply.
Yes you seem to be missing a point here. When applying a single LBP filter, you get a single image, of same dimensions as origin. To get reach feature space usually a filter bank is used, and even more commonly, is applying the LBP to image blocks. This also happens in HoG, but I assume you've missed this.
You need to understand better each of the methods, to use them properly. Btw their combination is supposed to be better then each f the two,
Hope this helps,
 Nikolay.

hello. this is my first time knowing LBP. there have 2 input arguments that i need to change in efficientLBP.

function LBP= efficientLBP(inImg, varargin)

what should i put? can you give me some an example?

Ido Ger

Hi Nikolay

I have used your code for extracting LBP from images for classification.
But I get the same dimension as the original image and as a result the classifiaction is hardly as effective as with HOG features, for example. I would have imagined LBP will result in a higher dimensional space. Am I doing something wrong?
Thanks.

Joydeb Barman

Hi Nikolay S

I have three sets of different images of handwritten character (for example, say three types (shapes) of letter a for three sets and each set contain similar types of a's ).I have the testing data with random images of a's and I have to classify them using classifier. In this case can i use LBP for extracting the feature vector and use for train the dataset. Thank you.

rabah pipo

good

Nikolay S.

Nikolay S. (view profile)

Good evening Usman
You should train a classifier, and use it for images classifications. See Matlab Statistical Toolbox Documentation for help. LBP will serve as a feature vector. Some authors propose of combining several images region LBP for the task of face recognition for example.
Best regards,
 Nikolay

Usman

Usman (view profile)

Hello Nikolay S.
I have execute your code in MATLAB, and I came up with subplots of images and respective histogram. Basically i want to use LBP to classify the covered and uncovered mouth images. My question is how can I manipulate your LBP code result for classification.?

Nikolay S.

Nikolay S. (view profile)

Hi Mohamad Faizal Ab Jabal.
Please email me if you wish to reference any of my work.
Best regards,
 Nikolay

Nikolay S.

Nikolay S. (view profile)

Hi Kapil Dev
Thank you for your comment.
An LBP image is generated for each image pixels, so any input image can be used- as long as it is larger then used filter. PC memory constrains images too large.
A feature vector is usually generated from histograms applied to windows on LBP images. Choosing the right window dimensions and overlapping ratio is one of the things to find in each problem. You can see my recent submission for an example where LBP is used for image segmentation: http://www.mathworks.com/matlabcentral/fileexchange/52753-kolian1-texture-segmentation-lbp-vs-glcm.
Best regards,
 Nikolay

Nikolay S.

Nikolay S. (view profile)

Hi Dhananjay Tyagi.
Pleas email me with additional details of the error.
You can find my email in my profile.

Nikolay S.

Nikolay S. (view profile)

Hi ghasem soleimani.
Indeed, you propose a way to generate a feature vector for an image.
However please not thsis is not likely to be sufficient for object classification. One usually needs multiple windows per image to get proper classifications. Please see relevant publications (LBP is used for face detection, human detection and many others).
You can also see an example of mine
Best regards,
 Nikolay

Hi, thanks for your code.
I was calculate histogram with this code, is it true?

filtR=generateRadialFilterLBP(8, 1);
LBP=efficientLBP(grayimage,'filtR', filtR,'isRotInv', true);
% histogram
h=imhist(LBP);
% normal histogram
hn=h/(size(grayimage,1)*size(grayimage,2));

Hello Nikolay, the code doesn't run on my R2013a. It shows an error, that is, "Not enough input arguments."
Please help me to go about it as I am new to matlab

Thanks

Kapil Dev

Hi Nikolay, thank you very much for this excellent piece of code. I'm using it in my research project. I have a question about usage of this code. Do all images should have the same size before we can do can compute features on them? and later perform classification?

can you please email me your gray scale invariance codes mentioned in your paper at http://www.ee.oulu.fi/mvg/files/pdf/pdf_6.pdf
I need it for texture analysis.
my email address is awaisrehman57@hotmail.com

Thanks for putting alot of effort in this work

How I want to cite your works?

Nikolay S.

Nikolay S. (view profile)

Hi M. Janse.
Only radial shaped filters are supported build-in. For the other cases You will have to construct your own filter- in the case of this implementation it will a 3D matrix, where i'th 2D slice of it is the filter for a i'th neighbor.
This is not hard, when you understand how your filter looks like.
Best regards,
 Nikolay

M. Janse

Hi Nikolay,
Your implementation is alligned with the paper by Ojala et. al.
They propose in their paper using the 'U' value to filter out a lot of patterns. How can I easily do this using your implementation as it is not built-in?
Best Regards,
M. Janse

Amruta

Amruta (view profile)

I am referring IEEE transaction paper for project (BRINT: Binary Rotation Invariant and Noise Tolerant Texture Classification JUL 2014)in that on page no.3076 at last paragraph they have given joint histogram of feature vectors. But i didn't get it.
So, please help to get the concept of joint histogram.

Nikolay S.

Nikolay S. (view profile)

Hi Amrutra.
There are several ways to combine feature (in this case histogram) vectors. the easiest one is to concatenate the using Matlab cat command. In your case this will result in a 36+2=38 elements vector. I do not think you need to find a combination to result in 36*2=72 elements feature vector.
Try it out,
Best regards,
 Nikolay

Amruta

Amruta (view profile)

How to calculate joint histogram of two histograms which are feature vectors?

   For example, x is histogram of 36 bins and y is histogram of 2 bins and i have to calculate joint histogram of x and y which will be of 72 bins size.

noo no

noo no (view profile)

Hi Nikolay,
efficent is the same accuracy ??

jayanti

Hi Nikolay, thanx for this code.but i am stuck about how will the feature vector of image look like. can you please load an example of LBP feature vector ?
after taking LBP of image , i have extracted feature vector from an histogram of image. Is this the right way to do? here is what i got.
Bins = 0.0537 0.1612 0.2687 0.3761 0.4836 0.5910 0.6985 0.8060 0.9134 1.0209

Amruta

Amruta (view profile)

Thank you!!!

Nikolay S.

Nikolay S. (view profile)

Good evening Amruta.
1) By using rotation invariant spatial LBP you can identify rotated textures as the same texture.
2) Both spatial and frequency domain can be used for texture classification. In case of LBP I'm not familiar with utilization of frequency domain.
3) Scale invariance can be achieved via pyramid of the image, or using changing neighborhood radius. Both will do the trick.
best regards.

Amruta

Amruta (view profile)

hi Good Afternoon,
Thanks for your valuable comment.
So,1) Can i do rotation invariant texture classification in transform domain?
2)Which domain is more suitable for texture classification ?
3)Can we do feature extraction from dataset(texture images) having different sizes?

Nikolay S.

Nikolay S. (view profile)

Good night Amruta.
As far as I remember- rotation of an image in spatial domain, also rotates the frequency transform image. I assume here that when you say transform domain, you actually mean frequency transom domain.
Texture, in very simplified case, is composed of some repeating pattern, resulting in several spikes in freq. domain. When we perform rotation invariant analysis- we are able to identify textures, even if they are at different directions. You can try visualizing what each texture means in transform domain, by tacking Brodatz or alike images, applying FFT2 with fftshift, spectra=abs(ffthsift(fft2(img))); and presenting imshow( log10(spectra) ,[] ).
You can also try my GUI for Visualization of Gabor filter bank- it is not the same, but related: http://www.mathworks.com/matlabcentral/fileexchange/30107-gabor-filetr-gui

Hope this helps.
Regards, Nikolay

Amruta

Amruta (view profile)

lbp is in spatial domain. Can we implement rotation invariant in transform domain?

please can you help me to understand, what is mean by texture in transform domain?

Nikolay S.

Nikolay S. (view profile)

Hi Olga.
Well I was wrong- the update after Michael bug fix included obsolete file copies, and thus the issue remained. I've resubmitted, hoping it will be fine now.
Thanks for finding the issue.
Best regards,
 Nikolay.

Olga

Olga (view profile)

Hi Nikolay,
I have the same problem as Michael :) Can you help me?
Thanks!
-----
04 Sep 2014 Michael

When I run demoEfficientLBP.m, I receive the following error message:
Error using circshift>ParseInputs (line 71)
Invalid shift type: must be a finite, nonsparse, real integer vector.

Error in circshift (line 34)
[p, sizeA, numDimsA] = ParseInputs(a,p);

Error in pixelwiseLBP>sortNeighbours (line 198)
minLBP=weigthVec*circshift(origBinWord, iCircShift);

Error in pixelwiseLBP (line 147)
[minLBP, ~]=sortNeighbours(binaryWord, weigthVec,...

Error in demoEfficentLBP (line 49)
pwLBP=pixelwiseLBP(imgRGB, 'filtR', filtR, 'isRotInv', true, 'isChanWiseRot',
false);

Any idea what's wrong here?
-----------------

Regards,
Olga

Nikolay S.

Nikolay S. (view profile)

Hi sinanda.
I'll briefly reply here. if you need additional explanations, please email me. I'm not familiar with the concept circular bi-linear interpolation. Regular bi-linear interpolation is basically about calculating value lying between nearest neighbors (interpolation ) values, via weighted average based on their distances to the desired value position (bi-linear). See First Order Hold as well.
In case of LBP, having a central point, and angle, and a radius, usually results in a point "falling" between pixels. This demands calculation of this value via interpolation. bi-linear is the easiest one. Bi-cubic for example is another, more expensive option.
Now again- in LBP image, each pixel value is calculated via sum of neighboring pixels (of when speaking of the whole image via it's shifted versions). As the shift is not always an integer value it demands interpolation. that's about all. See matlab imresize function, or any bi-linear based image zoom method for visualization.
Hope I've made things a bit more clear.

sunanda

Hi Nikolay ..
I am very much new to LBP.
I have successfully calculated LBP.
Can you tell me how to calculate circular bi-linear interpolation. I am confused about radius of circular LBP and how circular neighbourhoods are calculated using bilinear interpolation.

 Pls help me. I read Ojala's paper , but confused about uniform LBP and circular neighbourhood.
sc312009@gmail.com

Never mind. I fixed it. Thanks for the code.

Nikolay S.

Nikolay S. (view profile)

Hi Kathrin.
Using 32 neighbors to an image of [nxmxk] dimensions, results in storing an nxmx(kx32) matrix to the memory. Moreover, usage of 32 elements means storing LBP data in uint32, rather then uint8 (for up to 8 neighbors), which means *4 more memory. Altogether, the usage scenario you propose can indeed cause "out of memory" problem.
Currently I do not have a version with fever memory demands, so the only advice I can give you, it to devide the image to patches/windows, and applying the LBP to each such part in turn. You can then concatenate the sub-windows LBP into a single LBP. You can use my image concatenate function for this.
Regarding your grade (3/5)- I find it a bit insulting. Indeed, my implementation fails to deal with the hush scenario of 32 neighbors, especially if the image investigated is of large dimensions.
But you must understand, that some methods are limited, and you cannot apply them to any kind of data expecting it to work. perhaps there is an optimization, besides what I've proposed beforehand, but I have not figured one out so far. You are welcome to propose a better implementation, so I will be able to use and grade it.
Best regards.

Kathrin

Hi Nikolay,
If I set the number of neighbors to be 32(r=4), the program failed with warning 'out of memory' because of the size of a variable was 2.^nNeigh. I wonder if it can be programmed in another way to avoid the memory problem because the variable is sparse.

Nikolay S.

Nikolay S. (view profile)

Hi Amruta.
Assuming I got your question correctly, I'm using bi-linear interpolation, for neighbor elements falling between pixels.

Amruta

Amruta (view profile)

Hi Nikolay, I am an Mtech student,doing project on LBP metohd.I want your help for interpolation method used in your LBP method.I want formulae of interpolation used in LBP method and therotical information about it.Which interpolation method is used in this given file?

hamad mahmood

Thank you Nikolay.

hamad mahmood

Nikolay S.

Nikolay S. (view profile)

Hi hamad mahmood.
I have not used LBP for face detection, but the topic is highly researched. Here is one of most referenced papers: http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=1717463&url=http%3A%2F%2Fieeexplore.ieee.org%2Fxpls%2Fabs_all.jsp%3Farnumber%3D1717463
I've also participated in a project where Vaioa Jones OpenCV LBP implementtation was used: http://docs.opencv.org/modules/contrib/doc/facerec/facerec_tutorial.html, http://docs.opencv.org/modules/contrib/doc/facerec/facerec_api.html#Ptr<FaceRecognizer> createLBPHFaceRecognizer(int radius, int neighbors, int grid_x, int grid_y, double threshold). You should give it a glance too.
Best regards,
 Nikolay.

hamad mahmood

Hi Nikolay, i'm trying to extract the features from faces using matlab, but could not be able to get good results, kindly help me in this using LBP.

Nikolay S.

Nikolay S. (view profile)

Hi mahdi.
thank for the high grading. I've replied to your email.
Best regards,
 Nikolay.

mahdi

mahdi (view profile)

Hi Nikolay,Thanks a lot. Would you be able to email me your nonparametric classifier codes described in your paper at http://www.ee.oulu.fi/mvg/files/pdf/pdf_6.pdf ? I need it for texture recognition and compare with my results. my email address is mahdi1982ir@yahoo.com Thanks a lot

anin keyen

Kathrin

Thank you! I have got your idea.

Nikolay S.

Nikolay S. (view profile)

Hi Kathrin.
Well, the use of the term bi-linear interpolation was a bit misleading. I'm actually doing a calculation we can refer to as bi-linear decomposition. That is, for a real number, I'm trying to find his nearest integer neighbors and their distances to him.
The bi-linear interpolation of those neighbors should result in the number we had in the first place. From my calculation the above statements is true for my formula.
Would you agree with me?
Best regards.

Kathrin

Hi Nikolay,
I have calculated the bilinear interpolation referring to expressions on the page (http://en.wikipedia.org/wiki/Bilinear_interpolation).
As you can see, the weight is calculated by the multiplication of two differentials. Would you agree with me?
Best regards.

Nikolay S.

Nikolay S. (view profile)

Hi Kathrin.
Thanks for your comment- it seems you've gone intensively through my code.
The filter elements is composed of an average between "ceil" (larger neighbor) and "floor" (smaller neighbor) value of the x and y components, aimed to calculate weight of nearest neighbors from a fractional number. As you have noticed, it is indeed a linear interpolation, implying I could used build in functions, rather than implementing it myself.
Anyhow, I do not see a reason to use multiplication here, and unless I'm being mistaken here the proposed equation seems to be fine.
Best regards, Nikolay.

Kathrin

Hi Nikolay,
Thanks for the code.I'm comfused about an equation in generateRadialFilterLBP.m.That is ' radInterpFilt( rowsFloor(iP), colsFloor(iP), iP )= radInterpFilt( rowsFloor(iP), colsFloor(iP), iP )+rowsDistFloor(iP)+colsDistFloor(iP);'. If it is a bilinear interpolation process. I think it should be a multiplication.That is to say, 'radInterpFilt( rowsFloor(iP), colsFloor(iP), iP )= radInterpFilt( rowsFloor(iP), colsFloor(iP), iP )+rowsDistFloor(iP)*colsDistFloor(iP);'. Would you agree with me?
Best regards!
   

Nikolay S.

Nikolay S. (view profile)

Michael, thank you for:
1) Finding the bug.
2) Helping me finding the root cause.
3) The high rating!
 Best regards!

Michael

Thank you for the great support!

Nikolay S.

Nikolay S. (view profile)

Hi Michael.
It seems the shift value with which the circshift is called is not an integer number. I do not see this happening when I'm running the demo. Let me email you so we can figure out the problem.
Best regards,
 Nikolay.

Michael

When I run demoEfficientLBP.m, I receive the following error message:
Error using circshift>ParseInputs (line 71)
Invalid shift type: must be a finite, nonsparse, real integer vector.

Error in circshift (line 34)
    [p, sizeA, numDimsA] = ParseInputs(a,p);

Error in pixelwiseLBP>sortNeighbours (line 198)
    minLBP=weigthVec*circshift(origBinWord, iCircShift);

Error in pixelwiseLBP (line 147)
                    [minLBP, ~]=sortNeighbours(binaryWord, weigthVec,...

Error in demoEfficentLBP (line 49)
pwLBP=pixelwiseLBP(imgRGB, 'filtR', filtR, 'isRotInv', true, 'isChanWiseRot',
false);

Any idea what's wrong here?

trisha

trisha (view profile)

good

samira

samira (view profile)

I need it

Nikolay S.

Nikolay S. (view profile)

Thanks!

slimane

Hi Mr .Nikolay ,
This is a very good work
thanks

Nikolay S.

Nikolay S. (view profile)

Hi Paresh.
I'd suggest to send your questions to my email, rather then commenting here.
Regarding your question, you should use more then one histogram element. This is called "feature vector". In some cases you can reduce the feature vector length via PCA, and other methods. In case of LBP it was proven that some histogram elements carry more information than others, such as Rotation Invariant and others. I suggest reading relevant publications.
Best regards.

Paresh

Paresh (view profile)

Ok. Thank You.
I have one more question, after we get the histogram feature vector how should I input that into my features matrix? i.e as it is or should I reduce LBP feature vector to a single feature? Please Reply. Thank You

Nikolay S.

Nikolay S. (view profile)

Hi.
Radial filter is uniform to all directions, and in most cases does the trick. Other shape filters can also be handy (especially if the problem in hand has other geometry shape preferences), but radial shape is the one commonly used in published papers.
Hope this will help a bit

Paresh

Paresh (view profile)

Hello,
    Let me rephrase it. Why do we need radial filter at first place? Since in literature we are directly taking difference from the center pixel. Please Explain. Thank You

Nikolay S.

Nikolay S. (view profile)

Hi Paresh.
The multiplication is needed for proper weighting of the radial filter elements. In many cases the filter element is between pixels, and therefore a an averaging ought to be done.
Best regards.

Paresh

Paresh (view profile)

Hello,
    While calculating pixel-wise LBP, what is the need to multiply it with radial filter? Because when I read it they are only taking difference of neighbouring pixels from the center pixel. Please explain. Thank You.
 

Nikolay S.

Nikolay S. (view profile)

Hi KaMu.
Channel wise rotation means that for a given pixel, each color channel rotation is calculated independently- without considering the rotation of other colors.
Regards,
 Nikolay

KaMu

KaMu (view profile)

Hi Nikolay,
Thanks for the code. What do you mean by rotational channel wise. Do you mean that you rotate on one color channel?

Nikolay S.

Nikolay S. (view profile)

Hello naif al harbi.
Well, you can have it, using the "Download submission" button above.
From the relatively low grade I can see you've found the button, but did not like the function... I'd be happy to hear your comments and improvement proposals.
Best regards.

Nikolay S.

Nikolay S. (view profile)

Hello naif al harbi.
Well, you can have it, using the "Download submission" button above.
For the relatively low grade I can see you've found the button, but did not like the function...
Best regards.

naif al harbi

naif al harbi

Hello,mr.Nikolay

i wante code the LBP in matlab

kemi

kemi (view profile)

Nikolay S.

Nikolay S. (view profile)

Good evening Nicola Franzoso.
You'r comment is in place- thank you. I plan to add relevant functionality to the submission. The histogram is easy to achieve using "imhist" or "hist" with bins 1:(2^p-1) where p is the number of filter elements, applied to the LBP matrix converted to "single". What prevents me form posting this, it the Rotation Invariant (RI) case, where the histogram becomes very sparse. I failed to find an analytic way (an equation) to predict the indexes of obsolete bins. I can find the indexes of those bins for each case by applying the LBP minimization procedure, but this is inefficient and nasty. So i'm working on it. If you're not using RI-LBP, or you're fine with sparse histogram, please use my advice above.
Best wishes.

Nikolay, very good, but where i can fing the histogram, that's the template of the image ?

shan

shan (view profile)

Hi Nikolay ,
Very great work thanks..

BIREM Merwan

Nikolay S.

Nikolay S. (view profile)

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...

Charles ding

HI, Nikolay,

Could you please tell me a good literature about efficient LBP realized in the code? I want to understand its principles.

Nikolay S.

Nikolay S. (view profile)

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.

Chris Forne

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;

Rakesh Singh

hi

i wanted to know how to implement the basic concept of LBP operator with uniform patterns
i have implemented the basic concept of LBP operator in matlab
now i am using the concept of uniform pattern
the problem is that i am not able to understand the basic concept of LBP with uniform patterns

How exactly it has to be done

is there any documentation available which can help me

Nikolay S.

Nikolay S. (view profile)

Hello Fa Fa.
As far as I'm concerned, this comments are here for feedback, errors reporting , ratings, thanks, and code related question. Your question (and similar ones) should be be addressed via other media (directly via email, etc..).

Now, to your issue:
I don't quiet understand the question/. As far as I can see you have an interesting project ahead of you. If by "help" you mean "will I do the project for you", the answer is definitely NO.
If you wish to get some assistance with the topics of your project, that's better, but again I'm not the address in this case. I'd help you if were carrying this project under my supervision, but you aren't. I would help you nevertheless, if I was proficient in the above topics, and had some spare time, but unfortunately this is also net the case.
To conclude, it seems I can not assist you.
Best regards.

Fa Fa

Fa Fa (view profile)

Hi Nikolay,
i need to create 511 binary Lookup table, for LBP feature and to work with adaboost with training images.
please can you help me?
Thanks

Iqbal Nouyed

Updates

1.9

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

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

1.7

Resolved the bug reported by Michael.

1.6

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

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

1.4

- 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

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

1.1

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

MATLAB Release
MATLAB 7.10 (R2010a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video