Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10383

Re: FFT of a noisy image with weak periodic information

From Matthias Odisio <matthias@wolfram.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: FFT of a noisy image with weak periodic information
Date 2012-06-07 09:25 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jqps2t$2he$1@smc.vnet.net> (permalink)
References <201206060851.EAA17867@smc.vnet.net>

Show all headers | View raw


Dave,

On 6/6/12 3:51 AM, Dave Martin wrote:
> I'm trying to accomplish what should be a relatively simple frequency
> domain filtering of a noisy input image with with some weak, periodic
> signals (a low dose transmission electron microscope image of some
> organic crystals).   Using the commands below, I've been able to input
> the image (x), convert it to data (xi), and calculate the FFT (fx).
> Now what I want to do is to set the FFT to zero for all values below
> some threshold, and then inverse transform back to a filtered image.
> My stumbling block is a simple means to set the values of the array fx
> to zero below some threshold, before I perform InverseFourier.
> 
> x=Import["data.tif"]   (*import the file as an image*)
> xi=ImageData[x];   (*convert image to array data*)
> x1=xi[[All,All,1]];    (*extract one of the three color channels from
> the RGB image*)
> fx=Fourier[x1];       (*calculate the FFT of x1*)


This sets to zero the complex numbers for which the magnitude is less
than a threshold:

thr = 2;
m = Threshold[Abs[fx], thr];
z = InverseFourier[m*Exp[I*Arg[fx]]];

To "chop" the tiny values of z, I suggest using again Threshold
instead of Chop. Threshold does not unpack so it is more efficient.

With[{r = Re[z], i = Im[z]},
   newz = Threshold@r + I*Threshold@i]


Matthias Odisio
Wolfram Research

> 
> Some other commands I've found useful...
> 
> pfx=fx*Conjugate[fx];  (*calculate power spectrum = fx^2*)
> n=Length[pfx]             (*determine size of arrays*)
> pxr=RotateRight[pfx, {n/2,n/2}];   (*put origin in center of PS
> image*)
> pi = Image[pxr]           (*convert PS to image for display*)
> 
> Inverse transforming...
> 
> rx=Chop[InverseFourier[fx]];  (*convert fx back to a real space data
> set rx*)
> ri=Image[rx]                         (*convert rx to an image ri for
> display*)
> 
> 

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: FFT of a noisy image with weak periodic information Matthias Odisio <matthias@wolfram.com> - 2012-06-07 09:25 +0000

csiph-web