summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2012-09-14 19:55:11 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2012-09-14 19:55:11 -0400
commit0aaf56be64902fb12e53a3e1ee9c4f6855e87eb2 (patch)
tree025d8372d1bb0e0de3a33dad08215f168ff271f0
parent3d610e3342d89ca671ad1b8868900e39b038731d (diff)
downloadbeam_profiler-0aaf56be64902fb12e53a3e1ee9c4f6855e87eb2.tar.gz
beam_profiler-0aaf56be64902fb12e53a3e1ee9c4f6855e87eb2.zip
use abs in comparison and returned image
When we look for maxima in Fourier space we need to use abs, transform might have stron imaginary component and weak real one. Inverse Fourier transform might have imaginary component since our filter somewhat unphysical so we need to take abs of such image, and then return it.
-rw-r--r--stripeeraser.m4
1 files changed, 2 insertions, 2 deletions
diff --git a/stripeeraser.m b/stripeeraser.m
index 5d472fe..c7290ed 100644
--- a/stripeeraser.m
+++ b/stripeeraser.m
@@ -8,7 +8,7 @@ function [img_cleaned,imfourier]=stripeeraser(img,radius,threshold_power)
% from the center i.e. zero spatial frequencies.
immask=fftshift(fft2(img)); % move to Fourier space
-max1=max(immask(:));
+max1=max(abs(immask(:)));
for x=1:640
for y=1:480
d=sqrt((x-320)^2+(y-240)^2);
@@ -25,4 +25,4 @@ for x=1:640
end;
end;
imfourier=immask;
-img_cleaned=ifft2(ifftshift(immask));
+img_cleaned = abs( ifft2(ifftshift(immask)) );