summaryrefslogtreecommitdiff
path: root/stripeeraser.m
blob: b48a5b4a79000c4f8448f9a4de022034e0b0a1cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function [immask,imfourier]=stripeeraser(img,radius,filter)
immask=fftshift(fft2(img));
max1=max(immask(:));
for x=1:640
    for y=1:480
        d=sqrt((x-320)^2+(y-240)^2);
        if d>radius                                                        %Outside the central frequency.
            if abs(immask(y,x))>max1*(10^(-filter));                       %The filter works like a neutral density filter. 
                immask(y,x)=immask(y,x)*exp(-(d/radius)^2);                %Erase the frequency of the stripes.
            end;
        end;
    end;
end;
imfourier=immask;
immask=ifft2(ifftshift(immask));