D = imread('peppers.png');
D = double(D)/255;
ycbcrmap = rgb2ycbcr(D);
Y = ycbcrmap(:,:,1);
Cb = ycbcrmap(:,:,2);
Cr = ycbcrmap(:,:,3);
E0 = dct2(Y);
[rows,columns,dim] = size (E0);
sz2 = [rows, columns];
chunk_size2 = [8 8];
sc2 = sz2 ./ chunk_size2;
X2 = mat2cell(E0, chunk_size2(1) * ones(sc2(1),1), chunk_size2(2) *ones(sc2(2),1));
[r, c] = size(X2);
Z = cell(r,c) ;
for row = 1 : r
for col = 1 : c
Z{row,col} = cell2mat(X2(row, col));
end
end
Z = cell2mat(Z) ;
Best Answer