MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: 2dFFT & image processing

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101549] Re: 2dFFT & image processing
  • From: "alexxx.magni at gmail.com" <alexxx.magni at gmail.com>
  • Date: Fri, 10 Jul 2009 06:42:21 -0400 (EDT)
  • References: <h340gc$g8m$1@smc.vnet.net>

On 9 Lug, 07:51, "alexxx.ma... at gmail.com" <alexxx.ma... at gmail.com>
wrote:
> hi everybody,
> I need to perform a high-pass filter on some images.
>
> I know I can get a high pass filter doing a convolution of the image
> with a predefined kernel, but for various reasons (and my learning
> too) I wanted to follow the sequence:
> 1) fft
> 2) cut away central region (with a smooth edge)
> 3) fft again
>
> but, due to my ignorance, I'm unable to accomplish the process:
>
> given the image in a, I put:
>
> f = Fourier[a[[1]]];
> af = Abs@f;
> Dimensions[f]
>    {500,500}
>
> and I can check the fft with Graphics[Raster[255*af/Max[af]]]
>
> I then create the "hole" and apply it to the fft and invert again:
>
> k = Table[1 - Exp[-(x^2 + y^2)/s], {x, -249, 250}, {y, -249, 250}] /.
> s -> 1000.;
> holed = af*k;
> fholed = Abs[Fourier[holed]];
>
> since the reconstructed image Graphics[Raster[255*fholed/Max[fholed]]]
> is strongly fuzzed, whichever value I choose for the parameter s
> above, I wanted to ask you if I completely misunderstood the process!
>
> thank you,
>
> alessandro


I beg your pardon, I found my error: I used Abs[] on the FFT's for
display purpose, and I made the mistake of cutting the hole on the Abs
[FFT] instead of the whole FFT:

        k = Table[1 - Exp[-(x^2 + y^2)/s], {x, -249, 250}, {y, -249,
250}] /. s -> 1000.;
        holed = f*k;

and:

Grid[{{
    MatrixPlot[Abs[Fourier[f]], FrameTicks -> None, DataReversed ->
{True, True},
    MatrixPlot[Fourier[holed], FrameTicks -> None,  DataReversed ->
{True, True}}}]


works ok.


What I have yet to find is the corresponding way to do it with
convolution on a kernel: I cannot understand how the cutoff frequency
here (corresponding to the hole size) is related to the kernel of the
convolution...


alessandro




  • Prev by Date: Re: about Implication
  • Next by Date: Re: 2dFFT & image processing
  • Previous by thread: Re: 2dFFT & image processing
  • Next by thread: Re: 2dFFT & image processing