clear;
width = 512;
height = 512;
I = uint8( 128 + randn(height, width, 3) * 128/3 );

R = I(:,:,1);
G = I(:,:,2);
B = I(:,:,3);

DR = dct2(R);
DG = dct2(G);
DB = dct2(B);

mask=zeros(size(R));
mask(1:11, 1:11)=1;

DRf=DR.*mask;
Rf(:,:,1)=mat2gray(idct2(DRf));

DGf=DG.*mask;
Rf(:,:,2)=mat2gray(idct2(DGf));

DBf=DB.*mask;
Rf(:,:,3)=mat2gray(idct2(DBf));

imshow(Rf);
imwrite(Rf,'lowpass.png');