function col8(X, p) 
[m,n,l]=size(X);
imgc = zeros(m,n,l);
for i=2:n
    for j=1:n
        C(i,j)=sqrt(2/n)*cos((i-1)*(j-1/2)*pi/n);
    end
end
C(1,1:n)=ones(1,n)/sqrt(n);
for w = 0:2
Q = (2^w)*8./hilb(8);
Xd = double(X);
for k = 1:l
    Xc = Xd(:,:,k) - 128;
    Y = C*Xc*C';
    Yq = round(Y./Q);
    Ydq = Yq.*Q;
    Xdq = C'*Ydq*C;
    Xe = Xdq+128;
    imgc(:,:,k) = Xe;
end
subplot(2,2,w+2)
imagesc(uint8(imgc));
title(['Compressed p = ' int2str(2^w)])
end
subplot(2,2,1)
imagesc(uint8(X));
title('Original(337:344,801:808)')


  