summaryrefslogtreecommitdiff
path: root/stripeeraser.m
blob: 2ff610781f979b8179cc4c8393656909c751eccf (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 desity 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));