function [img_cleaned,img_fourier]=stripeeraser(img,radius,threshold_power) % Cleans an image from the stripes produced by interference fringes. % Such parallel fringes appears like a strong peak in the Fourier transformed image. % so it easy to clean them, especially if their spatial frequency is high. % % We will clean strong frequency components higher them max*10^(-threshold_power) % by suppressing them with exponential factor which is increases with distance % from the center i.e. zero spatial frequencies. img_fourier=fftshift(fft2(img)); % move to Fourier space max1=max(abs(img_fourier(:))); [Ny, Nx] = size (img); % image size for x=1:Nx for y=1:Ny d=sqrt((x-Nx/2)^2+(y-Ny/2)^2); if d>radius % for high enough frequency components %The filter works like a neutral density filter. if abs(img_fourier(y,x))>max1*(10^(-threshold_power)); % Suppress this frequency components which are mostly stripes % but leave untouched small sharp features of the beam % since they are spectrally weak img_fourier(y,x)=img_fourier(y,x)*exp(-(d/radius)^2); end; end; end; end; img_cleaned = abs( ifft2(ifftshift(img_fourier)) );