function Pat=dctloop(p1,R)
var=imread(R);
xgray=double(var);
r=xgray(:,:,1);
g=xgray(:,:,2);
b=xgray(:,:,3);
xgray=0.2126*r+0.7152*g+0.0722*b;
variable=xgray-128;
sizeme=size(variable);
bishop=zeros(sizeme(1));

for k=0:(sizeme(1)/8)-1
    for l=0:(sizeme(2)/8)-1
        clutch=variable(8*k+1:8*k+8,8*l+1:8*l+8);
        clutcher=dct(p1,clutch);
        bishop(8*k+1:8*k+8,8*l+1:8*l+8)=clutcher;    
    end
end

Pat=imagesc(uint8(bishop));colormap(gray)
