Re: FFT of a noisy image with weak periodic information
- To: mathgroup at smc.vnet.net
- Subject: [mg126774] Re: FFT of a noisy image with weak periodic information
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Thu, 7 Jun 2012 05:16:34 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201206060851.EAA17867@smc.vnet.net>
Use Chop or Clip
(a = Table[RandomReal[], {5}, {5}]) // Grid
Chop[a, 0.3] // Grid
Clip[a, {0.3, 1}, {0, 1}] // Grid
Bob Hanlon
On Wed, Jun 6, 2012 at 4:51 AM, Dave Martin <miltydcm at gmail.com> 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 fr=
om
> the RGB image*)
> fx=Fourier[x1]; (*calculate the FFT of x1*)
>
> 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*)
>
- References:
- FFT of a noisy image with weak periodic information
- From: Dave Martin <miltydcm@gmail.com>
- FFT of a noisy image with weak periodic information