MATLAB: How to Divide an image into 3×3 blocks in MATLAB and compute histogram for each block

3x3dividehistogramimagelbpMATLABsub blocks

Hello everyone,
I am working on "Machine Detection of Hand-over-Face Gestures" using LBP. I just converted an RGB Image to LBP image using this Code. Next Step of my task is to divide LBP image into 3×3 and display histogram for each block to detect the hand gesture position as shown in the following Fig:
Thanks in advance
Regards

Best Answer

Obtaining blocks is a matter of simple indexing
block=yourImage(m1:m2, n1:n2);
where m1,m2,n1,n2 are appropriate indices of the corners of a particular block. Once you have a block, its histogram can be obtained using imhist(block).