help-octave
[Top][All Lists]

## RE: bandpass filter for 2D Data

 From: Schirmacher, Rolf Subject: RE: bandpass filter for 2D Data Date: Mon, 7 Sep 2009 21:31:11 +0200

```
> -----Original Message-----
> Sent: Friday, August 28, 2009 5:33 PM
> To: Sergei Steshenko
> Subject: Re: bandpass filter for 2D Data
>
>
>
> On Aug 28, 2009, at 11:30 AM, Sergei Steshenko wrote:
>
> >
> >
> > --- On Thu, 8/27/09, John Swensen <address@hidden> wrote:
> >
> >> From: John Swensen <address@hidden>
> >> Subject: Re: bandpass filter for 2D Data
> >> To: "Dr. Johannes Zellner" <address@hidden>
> >> Date: Thursday, August 27, 2009, 12:58 PM
> >>
> >> On Aug 27, 2009, at 3:15 AM, Dr. Johannes Zellner wrote:
> >>
> >>> Hi
> >>>
> >>> does anyone have an implementation of a 2D bandpass
> >> filter?
> >>>
> >>> Suppose I've 2d data in a matrix of 1000 x 1000 pixels
> >> which
> >>> represents a spatial extension of 1 m (1 mm per
> >> pixel).
> >>> Now I'd like to filter away all frequencies below a
> >> wavelength of 50
> >>> mm and above a wavelength of 150 mm,
> >>> so the resulting data should only have frequencies
> >> corresponding to
> >>> wavelengths between 50 and 150 mm.
> >>>
> >>> Any octave examples for this?
> >>>
> >>> --
> >>> Johannes
> >>> _______________________________________________
> >>> Help-octave mailing list
> >>> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
> >>
> >> I don't know if there is an example of how to do this, but
> >> I think I
> >> remember doing the following pseudocode in my computer
> >> visions class:
> >>
> >> 1) perform the 2D FFT
> >> 2) figure out, based on your spatial sampling frequency,
> >> how much one
> >> "pixel" in the magnitude portion of the 2D FFT is
> >> 3) set everything but an annulus whose larger radius
> >> equates to 150mm
> >> wavelength and inner radius equates to 50mm to zero.
> >> 4) Perform the inverse 2D FFT
> >>
> >> Someone please correct me if this doesn't work, but I think
> >> this ends
> >> up being a fairly quick way to do what you ask and easy to
> >> implement.
> >>
> >> John Swensen
> >> _______________________________________________
> >
> >
> > Your approach is essentially correct, however, with any inverse FFT
> > brickwall filter (the one you propose) causes a lot of
> ringing in the
> > reconstituted signal.
> >
> > Regards,
> >  Sergei.
> >
> >
> >
>
> Yeah, I thought about that afterward, but hadn't got around to
> correcting myself.  To solve that problem you use a difference of 2D
> Guassians to generate the annulus.  I don't quite remember
> now how to
> set the variance of the Gaussians to get the desired cutoff
> frequencies, though.
>
> Thanks for pointing out my error,
> John
>
> _______________________________________________
> Help-octave mailing list
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>

I guess the same way as in 1d filter design... and unfortunately the optimum
solution depends on your performance criterion. So, perhaps do a 1d - design
and "circle" the frequency response (complex!) around zero (probably) in the
complex spectral plane to get the spectral filter matrix. Gaussian might be
preferred due to its optimum time-frequency properties (i.e. equally
distributed time-frequency uncertainty / fourier-transform is gauss again),
but that really depends on the application. Getting a frequency domain brick
of course gives about the worst time/spatial domain behaviour.

Rolf Schirmacher

```