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 ?
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.