9
$\begingroup$

In image processing books , we are told that Images need to be padded while doing filtering in the frequency domain. Why we need that zero padding ?

$\endgroup$
3
  • 1
    $\begingroup$ you mean this ? dsp.stackexchange.com/questions/741/… $\endgroup$ Sep 25, 2012 at 13:28
  • $\begingroup$ I am interested in padding of images, more about the physical significance. $\endgroup$ Sep 25, 2012 at 13:31
  • 2
    $\begingroup$ @PrashantSingh There is no physical significance. The zero-padding is just a way to make cyclical convolutions (which is what FFT-based convolutions are) act like linear convolutions. $\endgroup$
    – Jim Clay
    Sep 25, 2012 at 14:15

2 Answers 2

15
$\begingroup$

Multiplication in the frequency domain corresponds with circular convolution in the spatial domain. This means that without padding the image properly, results from one side of the image will wrap around to the other side of the image.

You can think of 2D filtering as a sliding window that is centered over each pixel in the image and the center output pixel is a weighted sum of the pixels in the window. With circular convolution, when the window hangs over the right edge of the image, it is actually wrapping back around to the left side of the image. This means that output pixels on the right edge of the image will be affected by pixels on the left edge, which is almost never what is actually desired.

Zero-padding allows space for this wrap-around to occur without contaminating actual output pixels.

$\endgroup$
1
  • 4
    $\begingroup$ Just a note: you are avoiding wrapping from one side of the image to the other; but you are still introducing a transient between the 0-padded area and the actual image. To minimize this transient, instead of zero padding you can use techniques such as mirroring the actual image onto the padding area. $\endgroup$
    – Juancho
    Sep 25, 2012 at 17:19
-1
$\begingroup$

Fourier transform is periodic in nature. Periodic function can cause interference between adjacent periods and this will lead to wraparound error.

wraparound error

To overcome this we go for zero padding

$\endgroup$
1
  • 2
    $\begingroup$ You're not adding very much material to the original answer... $\endgroup$
    – MaximGi
    Feb 22, 2016 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.