I have a code where i take every 8*8 block of a 512*512 image and find its average, and subtract it away, storing the result into a new matrix(64*64).
n = 1; for i = 1:bs:row; m = 1; for j = 1:bs:col; ave = mean(mean(I(i:i+bs-1, j:j+bs-1))); A(i:i+bs-1, j:j+bs-1) = I(i:i+bs-1, j:j+bs-1) - ave; DC(n,m) = ave; m = m + 1; end n = n + 1; end
But i would like to apply DCT transform to each of the 8*8 blocks, without applying it to the entire image at once, and then store my results in a new matrix of the same size as the original image matrix. I am not sure how to continue from here. Can someone please guide me through this?
No products are associated with this question.
I'll assume you have a dct function of some kind and also MAT2TILES from the File Exchange
Icell = mat2tiles(I,[8,8]); ave=Icell;