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 ?

  • 1
    $\begingroup$ you mean this ? dsp.stackexchange.com/questions/741/… $\endgroup$ – Sufiyan Ghori Sep 25 '12 at 13:28
  • $\begingroup$ I am interested in padding of images, more about the physical significance. $\endgroup$ – Prashant Singh Sep 25 '12 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 '12 at 14:15

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.

  • 3
    $\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 '12 at 17:19

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

  • $\begingroup$ You're not adding very much material to the original answer... $\endgroup$ – MaximGi Feb 22 '16 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.