function X=extract(M) % Extraction of non-overlapping 8x8 blocks % % =========================================================== % % function description: % % This function chops up the matrix into subblocks of % size 8x8. Subsequently it converts each block into a column % vector. The output is a 64x1024 matrix consisting of these % column vectors. for rowblock = 1:size(M,1)/8 for colblock =1:size(M,2)/8 for rowOfPxls = 1:8 for colOfPxls = 1:8 % create block of size 8x8 out of the matrix block(rowOfPxls, colOfPxls) = M((rowblock - 1)*8 + ... rowOfPxls, (colblock - 1)*8 + colOfPxls); end end X(:, rowblock + (colblock - 1)*32) = block(:); end end