About Notch Filtering in the Frequency Domain (2D images)

Started by May 17, 2007
```Dear all:

I was studying the notch filter. As far as I understood, there are 2
possible ways to accomplish this task:
1) Set the DC component of the spectrum to be equal to zero, i.e:
F(0,0) =0. To obtain the filtered image, apply the IDFT.
2) Create a kernel (k) having the same size as the filtered image. Set
all the kernel values equal to 1, except for the pixel in position (M/
2,N/2), which will be equal to 0. Note that M,N represent respectively
the width and height of the filtered image. Compute the DFT of the
kernel (k) obtaining a kernel K in the frequency domain. Convolve the
spectrum with the kernel K in the frequency domain, and apply the IDFT
to the convolved image in order to obtain the filtered image in the
spacial domain.

I would like to know, if those 2 operations are equivalent, because
the obtained filtered images in method 1, and 2 differ from each
other.

Best regards,

Javier

--
=================================================
Javier A. Montoya Zegarra - http://www.lis.ic.unicamp.br/~jmontoya
Institute of Computing, State University of Campinas, SP - Brazil
=================================================

"Set all Afire" - St. Ignatius of Loyola

```
```On 17 May, 17:04, Javier Montoya <jmonto...@gmail.com> wrote:
> Dear all:
>
> I was studying the notch filter. As far as I understood, there are 2
> possible ways to accomplish this task:
> 1) Set the DC component of the spectrum to be equal to zero, i.e:
> F(0,0) =0. To obtain the filtered image, apply the IDFT.
> 2) Create a kernel (k) having the same size as the filtered image. Set
> all the kernel values equal to 1, except for the pixel in position (M/
> 2,N/2), which will be equal to 0. Note that M,N represent respectively
> the width and height of the filtered image. Compute the DFT of the
> kernel (k) obtaining a kernel K in the frequency domain. Convolve the
> spectrum with the kernel K in the frequency domain, and apply the IDFT
> to the convolved image in order to obtain the filtered image in the
> spacial domain.
>
> I would like to know, if those 2 operations are equivalent, because
> the obtained filtered images in method 1, and 2 differ from each
> other.

Formally, they are equivalent, except for wrap-around effects. If,
for
the sake of argument, your image is of size 2N+1 x 2N+1, then
the resulting image after convolition (your approach #2) is of
size 4N+1 x 4N+1.

both the image and the mask, which are of size 2N+1 x 2N+1, are
zero-padded to size 4N+1 x 4N+1 prior to computing the 2D DFTs.
Since you haven't done that, the "overshoot" wraps around the edges
and start messing up your image.

Rune

```
```Please tell me you would not do 1) in this way!

Dirk

On May 17, 11:04 am, Javier Montoya <jmonto...@gmail.com> wrote:
> Dear all:
>
> I was studying the notch filter. As far as I understood, there are 2
> possible ways to accomplish this task:
> 1) Set the DC component of the spectrum to be equal to zero, i.e:
> F(0,0) =0. To obtain the filtered image, apply the IDFT.
<xnipped>

> Javier
>
> --
> =================================================
> Javier A. Montoya Zegarra -http://www.lis.ic.unicamp.br/~jmontoya
> Institute of Computing, State University of Campinas, SP - Brazil
> =================================================
>
> "Set all Afire" - St. Ignatius of Loyola

```