summaryrefslogtreecommitdiff
path: root/stripeeraser.m
diff options
context:
space:
mode:
authorMi Zhang <mzhang@email.wm.edu>2012-09-11 16:03:41 -0400
committerMi Zhang <mzhang@email.wm.edu>2012-09-11 16:03:41 -0400
commitd1d7a486cc70665dafe64aaddd44c58e228815b0 (patch)
treeacbf530230d6860c9a85f5f1d67d0e445dde5192 /stripeeraser.m
downloadbeam_profiler-d1d7a486cc70665dafe64aaddd44c58e228815b0.tar.gz
beam_profiler-d1d7a486cc70665dafe64aaddd44c58e228815b0.zip
initial commit
Diffstat (limited to 'stripeeraser.m')
-rw-r--r--stripeeraser.m15
1 files changed, 15 insertions, 0 deletions
diff --git a/stripeeraser.m b/stripeeraser.m
new file mode 100644
index 0000000..2ff6107
--- /dev/null
+++ b/stripeeraser.m
@@ -0,0 +1,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)); \ No newline at end of file