img = imread('D43.jpg');
[m,n,k] = size(img);
border = 650;
close all;
imshow(img);

layer1 = img(:,:,1);
layer2 = img(:,:,2);
layer3 = img(:,:,3);
newimg = uint8(zeros(m,n,k));

freq1 = fftshift(fft2(layer1));
freq1([1:border end-border:end], :) = 0;
freq1(:, [1:border end-border:end]) = 0;
figure; spy(freq1);
newimg(:,:,1)=real(ifft2(ifftshift(freq1)));

freq2 = fftshift(fft2(layer2));
freq2([1:border end-border:end], :) = 0;
freq2(:, [1:border end-border:end]) = 0;
newimg(:,:,2)=real(ifft2(ifftshift(freq2)));

freq3 = fftshift(fft2(layer3));
freq3([1:border end-border:end], :) = 0;
freq3(:, [1:border end-border:end]) = 0;
newimg(:,:,3)=real(ifft2(ifftshift(freq3)));

%imshow(newimg, [0, max(max(max(newimg)))])
figure;
imshow(newimg);

diff = uint8(zeros(m,n,k));
diff = abs(img-newimg);

%figure;
%imshow(diff, [0, max(max(max(diff)))])


