From 0aaf56be64902fb12e53a3e1ee9c4f6855e87eb2 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Fri, 14 Sep 2012 19:55:11 -0400 Subject: 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. --- stripeeraser.m | 4 ++-- 1 file 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)) ); -- cgit v1.2.3