MathGroup Archive 2009

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

Search the Archive

Re: 2dFFT & image processing

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101597] Re: [mg101500] 2dFFT & image processing
  • From: Alessandro Magni <alexxx.magni at gmail.com>
  • Date: Fri, 10 Jul 2009 23:22:44 -0400 (EDT)
  • References: <200907090553.BAA16870@smc.vnet.net>

thank you everybody,
I corrected my mistake - I didnt realize that the FFT output wasnt
centered, and YES I looked at the FFT image, wandering how beautiful
it was, and not understanding the rings at the 4 corners... how dumb
can I be???

If I may add a further question -
I always knew that as an alternative to this kind of filtering it also
exists the possibility to do a convolution with a high-pass kernel.
Everywhere in literature and on the net you find exemples for this
kind of kernel, say something proportional to
((0,-1,0)(-1,5,-1)(0,-1,0))
but...

1) how can I create a high pass kernel that corresponds to a filter
below a given cutoff frequency fc? Which numbers go into the matrix if
I only know fc?
2) the 3x3 size is related to the cutoff frequency? Under which rules
I can define larger kernels?

I really looked everywhere for a couple of days but couldnt find an
answer to those questions, so if you can spare more time with my
problems, I'll thank you a lot!!!

alessandro



2009/7/10 Patrick Scheibe <pscheibe at trm.uni-leipzig.de>:
> Hi,
>
> the fourier transformed image is *not* centered in the middle.
> So either you cut a way the edges or you center it before cutting the
> central region.
>
> img = ColorConvert[Import["https://ipanema.tictec.de/badische-z\
>    eitung/ipanema_images/21/4/!!PerformanceID_32-InfoTypeID_0-Para\
>    graphID_0!Yvonne%20Catterfeld%20003.clip0.png"], "Grayscale"];
> {nx, ny} = ImageDimensions[img];
> filter = Table[1 - Exp[-(x^2 + y^2)/70.],
>       {y, -ny/2., ny/2. - 1}, {x, -nx/2., nx/2. - 1}];
> fimg = RotateLeft[(RotateLeft[#1, nx/2] & ) /@
>         Fourier[ImageData[img]], ny/2];
> result = InverseFourier[RotateRight[
>         (RotateRight[#1, nx/2] & ) /@ (fimg*filter), ny/2]];
> Column[{img, ArrayPlot[Re[fimg], ColorFunction -> Hue,
>       ColorFunctionScaling -> False], ArrayPlot[filter,
>       ColorFunction -> GrayLevel], Image[Re[result]]}]
>
>
>
> Cheers
> Patrick
>
>
> On Thu, 2009-07-09 at 01:53 -0400, alexxx.magni 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
>>
>>
>>
>>
>
>


  • Prev by Date: Re: 2dFFT & image processing
  • Next by Date: Re: Symbolic summation
  • Previous by thread: Re: 2dFFT & image processing
  • Next by thread: Re: Re: 2dFFT & image processing