Test code to generate a circular mask that removes the low frequency components from an image.

Step through radius to get the percentage compression.

IM=imread('images_01.jpg');IM=IM(:,:,2); %Select a channel % cx=size(IM,2)/2; cy=size(IM,1)/2; ix=size(IM,2);iy=size(IM,1);r=833; [x,y]=meshgrid(-(cx-1):(ix-cx),-(cy-1):(iy-cy)); c_mask=((x.^2+y.^2)>r^2); % filtIM = fft2(IM).*c_mask; filtIM = ifft2(filtIM); IM2=abs(double(IM)-abs(filtIM)); % x=size(IM,1)*size(IM,2); y=size(find(c_mask==1)); y=y(1); res=y/x*100; % figure(1); subplot(2,2,1); imshow(c_mask); subplot(2,2,2); imagesc(IM2); axis image; axis off; subplot(2,2,3); imshow(IM); title('Origianl image'); subplot(2,2,4); imagesc(abs(filtIM)); axis image; axis off; title(sprintf('Percent original: %0.2f',res));