I am trying to implement basic homomorphic filtering but I can't seem to understand what happens in the frequency domain when you take the natural logarithm of the function.
In Matlab I'm getting not a number or infinity everywhere.
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It only takes a minute to sign up.
Sign up to join this communityI am trying to implement basic homomorphic filtering but I can't seem to understand what happens in the frequency domain when you take the natural logarithm of the function.
In Matlab I'm getting not a number or infinity everywhere.
Plus is the simplest operation : $z = x+y$. Fourier is inherently linear, and good at addressing it. However, most processes and data combination are nonlinear, and they should be dealt with. The second simplest operation is multiplication. Homomorphic filtering deals with $z = x\times y$. It is more complicated, especially because of zeroes.
Logarithms were invented to linearize products. Because $\log z = \log x + \log y$, and then we get back to linear. The problem is that logarithms are not defined everywhere in a simple way, especially with negative numbers. So, it is necessary to deal with that, and I do not know of a naturally sound method. But classically, one offsets and scales data, such as with a modified logarithm:
$$ \mathrm{l}_m (x) = \mathrm{sign}(x) \frac{\log(1+a|x|)}{\log(1+a)} $$
related to companding
. When $a$ and $|x|$ are small, this is close to $$\mathrm{sign}(x) \frac{\log(1+a|x|)}{\log(1+a)}\approx \mathrm{sign}(x) \frac{a|x|}{a}\approx x$$ thus back to the linear case.
You can also check: Why do we substract a background image and not divide it?, talking about LIP (Logarithm Image Processing).