# howto divide an image into K*K windows for LBP

3 views (last 30 days)
Newman on 11 Jul 2016
Edited: Newman on 11 Jul 2016
hello I have an image which is 112 x 92. I want to divide the image into 7x7 blocks and apply generate LBP pattern for each block that is for ieach of the 49 blocks.But the issue is 112/7=16 pixels as rows but 92/7=13.14 pixels as columns .SO I want to ask should I round it up to 13 pixels for columns ?Will it cause problems as generating a good feature vector for the face?
another question -I know how to create a global feature vector for the face, i need to concatenate all the blocks LBP patterns .So what should be the direction to do it for eg look at the image below:
Is this the correct direction or there is no direction we can concatenate all the blocks in any way we want ?
P.S- For my code/approach see below
image =112x92 unit8;
extract the size of image
[rows col]=size(image);
a=rows/7;
b=round(col/7);
dfrows=repelem(a,7);%repeating each element 7 times
dfcol=repelem(col,7);
dfcol(numel(dfcol))=dfcol(numel(dfcol))+1; %adding the last element with one as to equal 92 in the columns
ced=mat2cell(image,dfrows,dfcol);
where ced is
[16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x14 uint8]
[16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x14 uint8]
[16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x14 uint8]
[16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x14 uint8]
[16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x14 uint8]
[16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x14 uint8]
[16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x13 uint8] [16x14 uint8]
Kindly help me on how to proceed further.

### Categories

Find more on LBP - Local Binary Patterns in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!