To extract local binary pattern features without background

Hi all I detect the foreground object and all zeros fro background, the sample image is attached. So how can I only apply the LBP. The original sample and the ROI that is defined with red lines ehich I want to extract features from only this area. HOw can do that. Is there any way and any suggestion and codes. Thanks.

Answers (2)

See attached demo.

7 Comments

I know this but apply to all image I think with background with this demo, How can we d this without background. Your suggestion something like that as attached file. I dont want to take into account background values(ZEROS) when calculating LBP). Background values should removed before calculating texture features.
The LBP is usually done on a binary image. Each of the 8 neighbors is either 1 or 0 and those can be made into a byte which is a number between 0 and 255. If you didn't have a binary image and used the original 8-bit gray levels then you'd have eight 8-bit numbers or a 64 bit pattern. You can't really deal with 64 bit numbers. You'd have to scale it down to 8 bits anyway just to visualize it on your monitor. And if you did that, the only way to do it would be to scale down each pixel value before constructing the LBP for that center pixel. It wouldn't make sense to scale down after making the LBP number. So then you're essentially back to picking a threshold like I did in the demo.
YOur code result like this, so how can I use it this info from only front object(histogram)
That looks right.
To get the histogram of only non-zero pixels, do this:
histObject = histogram(grayImage(grayImage>= 0));
Thanks, I tried this one. This means LBP values or just histogram values? histObject = histogram(grayImage(grayImage>= 0)); but variable say this:
"The variable histObject.Data does not exist".
To see what properties histObject has, set a breakpoint there and type histObject on the command line. You will see Value, BinEdges, etc.
you mean histObject = imhist(grayImage(grayImage>= 0));

Sign in to comment.

Your code works I think 8,1 neighbor so is it possible to find and work 8.2 16.1 16.2 24.1 24.2 24.3 etc.

2 Comments

I don't understand at all what this is trying to say.
Your LBP code works as 8 neighbor. So is it possible to update it for 8,2 16,1 16,2 24,1 etc. and your suggested histogram means only gray values not LBP does it?

Sign in to comment.

Asked:

ali
on 30 Aug 2016

Commented:

on 7 May 2017

Community Treasure Hunt

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

Start Hunting!