Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10369 > unrolled thread
| Started by | W Craig Carter <ccarter@mit.edu> |
|---|---|
| First post | 2012-06-07 09:18 +0000 |
| Last post | 2012-06-08 07:40 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: FFT of a noisy image with weak periodic information W Craig Carter <ccarter@mit.edu> - 2012-06-07 09:18 +0000
Re: FFT of a noisy image with weak periodic information Dave Martin <miltydcm@gmail.com> - 2012-06-08 07:40 +0000
| From | W Craig Carter <ccarter@mit.edu> |
|---|---|
| Date | 2012-06-07 09:18 +0000 |
| Subject | Re: FFT of a noisy image with weak periodic information |
| Message-ID | <jqprli$2ca$1@smc.vnet.net> |
Hello Dave,
This may work for you as long as your data is composed of reals.
threshHold[data_, value_] :=
data /. anumber_?NumericQ /; anumber < value :> 0
threshHold[RandomReal[{0, 1}, {8, 8}], 0.25]
threshHold[RandomReal[{0, 1}, {4, 4, 4}], 0.25] // MatrixForm
W Craig Carter
Professor of Materials Science, MIT
On Jun 6, , at Wed Jun 6, 12 @4: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*)
>
> 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*)
>
>
[toc] | [next] | [standalone]
| From | Dave Martin <miltydcm@gmail.com> |
|---|---|
| Date | 2012-06-08 07:40 +0000 |
| Message-ID | <jqsaa9$dh5$1@smc.vnet.net> |
| In reply to | #10369 |
On Thursday, June 7, 2012 5:18:42 AM UTC-4, W Craig Carter wrote:
> Hello Dave,
> This may work for you as long as your data is composed of reals.
>
> threshHold[data_, value_] :=
> data /. anumber_?NumericQ /; anumber < value :> 0
>
> threshHold[RandomReal[{0, 1}, {8, 8}], 0.25]
> threshHold[RandomReal[{0, 1}, {4, 4, 4}], 0.25] // MatrixForm
>
> W Craig Carter
> Professor of Materials Science, MIT
>
>
>
> On Jun 6, , at Wed Jun 6, 12 @4: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*)
> >
> > 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*)
> >
> >
Thanks Craig, but my data is Complex, so also I need to find the amplitudes first.. regards from UD, DCM
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web