From 80ee320af3b1e6470881f1f7b80eeab43413350c Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Fri, 14 Sep 2012 20:14:17 -0400 Subject: small speed up and improved readability --- stripeeraser.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stripeeraser.m b/stripeeraser.m index cd34d50..3198b1f 100644 --- a/stripeeraser.m +++ b/stripeeraser.m @@ -9,11 +9,12 @@ function [img_cleaned,img_fourier]=stripeeraser(img,radius,threshold_power) img_fourier=fftshift(fft2(img)); % move to Fourier space max1=max(abs(img_fourier(:))); +threshold=max1*(10^(-threshold_power)); [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 && abs(img_fourier(y,x))>max1*(10^(-threshold_power)) + if d>radius && abs(img_fourier(y,x))>threshold % For high enough frequency components % suppress this frequency components which are mostly stripes. % But leave untouched small sharp features of the beam -- cgit v1.2.3