From: Ayan on
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
From: Bruno Luong on
"Ayan " <a.chaki(a)lycos.com> wrote in message <htnkf8$j1j$1(a)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
From: Ayan on
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
From: Bruno Luong on
"Ayan " <a.chaki(a)lycos.com> wrote in message <hto22c$iiu$1(a)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)
From: Ayan on
Hi Bruno,

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

Thanks and Regards,
Ayan