f



Dividing an image into 8X8 block and find histogram of each block

Hi,
Can somebody help me with a code snippets to divide an image of size 352*288 to 8x8 blocks and to find histogram of each block? blkproc is not helping me as i need to access each block separately to find the histogram. A working code snippets will really help me. Thnaks in advance.
Regards,
Ayan
0
Ayan
5/28/2010 5:31:20 AM
comp.soft-sys.matlab 211266 articles. 15 followers. lunamoonmoon (258) is leader. Post Follow

5 Replies
3828 Views

Similar Articles

[PageSpeed] 26

"Ayan " <a.chaki@lycos.com> wrote in message <htnkf8$j1j$1@fred.mathworks.com>...
> Hi,
> Can somebody help me with a code snippets to divide an image of size 352*288 to 8x8 blocks and to find histogram of each block? blkproc is not helping me as i need to access each block separately to find the histogram. A working code snippets will really help me. Thnaks in advance.
> Regards,
> Ayan

Here is a snippet:

A=floor(256*rand(352,288));

B=reshape(A,[8 size(A,1)/8 8 size(A,2)/8]);
B=permute(B,[1 3 2 4]);

for k=1:size(B,3)
    for l=1:size(B,4)
        Bkl = B(:,:,k,l);
        count = histc(Bkl(:),0:255);
        % put your code here ...
    end
end

% Bruno
0
Bruno
5/28/2010 6:16:07 AM
Hi Bruna,
Thanks for the reply. I am facing some problem while executing the code. Can you please elaborate it a little bit more with respect to an image? Please note that I need to divide the image into sub-blocks of size 8x8 each and then need to find the histogram of each block to do some further calculations. Also, how to take care of the padding issue? Please help.
Regards,
Ayan
0
Ayan
5/28/2010 9:23:24 AM
"Ayan " <a.chaki@lycos.com> wrote in message <hto22c$iiu$1@fred.mathworks.com>...
> I am facing some problem while executing the code. Can you please elaborate it a little bit more with respect to an image?

I propose you first elaborate the part "I am facing some problem while executing the code".

If you want to "see" on an example the content of B, try with

A = kron(floor(256*rand(2,3)),ones(8))

Bruno (not Bruna)
0
Bruno
5/28/2010 9:34:05 AM
Hi Bruno,

Thanks a lot for your help. And sorry for the unintentional spelling mistake:-(

Thanks and Regards,
Ayan
0
Ayan
5/28/2010 10:17:04 AM
hi can any one help me how to apply histogram to each block of the image, to RGB or gray images, which is divided already. pls help me.
0
2/12/2014 5:34:27 PM
Reply: