3
$\begingroup$

Let's say that the point spread function, h, is known for a blurred image B.

If we want to apply an inverse filtering method (eg. Direct Inverse Filtering for noiseless images, Wiener Filter, Constrained Least Squares, etc.), can/do we pad the blurred image B in order to divide H (DFT of h)? (The dimensions of H would equal those of the padded B)

I have noticed that using zero-padding does not yield good results, whereas applying the inverse without padding gives much better results

$\endgroup$
7
$\begingroup$

The thing to understand here is exactly what all your transforms and data fiddling do.

We'll consider a 1D discrete-time signal which is rather easier to explain and think about. The arguments extend easily to higher dimensions.

By taking the DFT of that signal, which has been windowed to a finite number of samples, N, to create a frame, one implicitly assumes that the N-length windowed signal is repeated infinitely in the time-domain, such that the zeroth sample is adjacent to the (N-1)th sample.

The effect of this tiling on what happens when you perform any filtering is two-fold:

1) If there is a big step between the 0th (which is also the Nth) sample and the (N-1)th (which is also the -1th) sample, this is going to introduce lots of high frequency components into the signal which probably don't correspond to anything physical.

2) Filtering by windowing in the Fourier domain is equivalent to convolving with the inverse DFT of that window in the time-domain. Since there is an implicit repeating of the signal in the time domain, the lower samples of the frame "leak" energy into the upper samples of the frame, and vice-versa (alternatively: the ends of the frame are wrapped around and smeared together).

You can't escape these effects, it's the nature of doing discrete Fourier domain filtering. The question is, can one do anything sensible to alleviate them?

The answer depends on knowledge about the signal. You mention zero sampling. Simple zero padding (with no edge roll-off) has the effect of artifically introducing a big edge discontinuity. It's equivalent to convolving the Fourier domain signal with a Sinc function, which is likely going to complicate the required inverse filter. On the other hand, it may alleviate the second of the issues above because now there is a gap between the low samples and the wrapped-around high samples.

If your signal naturally decays to zero at the edge of the frame, then zero padding is sensible and generally safe to separate the tiled versions of the frame.

There are various alternative techniques to simply adding zero samples. One might be to time reverse the frame and concatenate it to the original, making a double length frame. This then guarantees that the signal has no big discontinuities. You can chop the frame in half at the end of the processing to get back what you actually need.

Another technique is to roll off the edges of the time domain signal to zero, typically with something like a raised cosine. This is far less harsh than than simply adding zeros to the time domain. Once the signal has reached zero, you can merrily add more zeros to pad it out if you wish. The length of the roll off is a design parameter, but a good starting point is something like the length of the blurring filter.

It's a case of understanding the signal and the effect of a given tweak as to whether it improves the result or not. I would generally expect to have to do something to alleviate the so called edge effects that you're ostensibly trying to do with zero padding, but I'd try to be a bit more sophisticated about it.

One quick point, of which I'm sure you're aware (so for other people reading this). Simply dividing through by H without any form of regularisation is generally a "bad" thing to do. You need to make sure the signal doesn't become dominated by the very small values of H. That's another post though!

$\endgroup$
  • $\begingroup$ Henry, you were absolutely right. Zero-padding the blurred image caused energy to fall into high-frequency areas of the image, which when divided by a very low value in the inverse transform, would accentuate the energy in those areas. Thanks! $\endgroup$ – Sam Apr 20 '12 at 8:12

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.