partioning the image
13 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I want to divide the image into 6 blocks ,i used the code below,now i want to display those divided blocks,can tell how to display it please,I am performing CLD,PLEASE tell hoe to calculate the centroid from "out"
img=imread('dock.jpg')
[img_x,img_y]=size(img);
block_size=8;
slide_len=1;
for ix=block_size/2:slide_len:img_x-block_size/2
for jy=block_size/2:slide_len:img_y-block_size/2
current_block=img((ix-block_size/2+1):(ix+block_size/2),(jy-block_size/2+1):(jy+block_size/2));
dct_coeff=reshape(dct2(current_block),1,block_size^2);
out=zigzag(dct_coeff)
end
end
0 Commenti
Risposte (1)
Walter Roberson
il 19 Gen 2012
Your code is overwriting your "out" matrix in each iteration, so at the end of the loop it does not have the necessary information to display all of the blocks.
You have not told us enough about zigzag() for us to predict what operations could be performed on "out".
12 Commenti
Walter Roberson
il 24 Gen 2012
And if it is not appropriate for your code to think that img_y is 1450 (or, more likely, 768) then you will need to change that line of code.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!