In image processing, what does it mean when a filter is called non-linear?
Does it mean the equation of the filter contains derivatives and if it didn't, it would have been called linear?
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 community
A filter F is called "linear", iff for any scalars $c_1$, $c_2$ and any images $I_1$ and $I_2$:
$F\left(c_1\cdot I_1+c_2\cdot I_2\right)=c_1\cdot F\left(I_1\right)+c_2\cdot F\left(I_2\right)$
and many others.
Examples of non-linear filters are:
Let us say that you have two filters, one linear and one non linear (for filtering out some noise corrupted images). i.e you have some bad pixels with really high or low values that look sort of 'the odd one out' in a small rectangular region on an image.
Now, a linear filter (like 'average') works like this:
You will notice that if you expand the area of the filter window you will stretch it over more elements (i.e more elements make up the average automatically contributing to the filtered pixel value).
On the other hand for a non-linear filter such as the median (which replaces the pixel to be filtered with the median value inside the square window), increasing the window does not necessarily bring a contribution to the median of the window and hence does not result in a direct impact on the filtered pixel.
Here is a numerical example : say you have a i,j (i.e. 3x3 window) with the anchor (center pixel in the middle at position (2,2) and the values are (brightness level) 40, 60, 80, 89, 90, 100, 101, 105, 185. you will notice that the median is 90 so the anchor pixel will become 90. now lets say you increase the window size and you add more values to those nine, namely to have a 5x5 window. There is a chance that even after that the median would still be 90. So a change in input does not necessarily give a proportional change in the output, hence the non-linearity.
This reminds me: many years ago (15?), I read in a non-academic but quite kwnown magazine for developers (cof,cofdr,cof,cofdobbs...) an explanation about LPC=Linear Predictive Coding... It gave as an example the prediction of signal $x[t+1]$ based on the values of $x[t]$ and $x[t-1]$ and explained that for a typical (smooth) signal that could be done by drawing a straight line that passed through those two given values... and because of that the prediction was called 'linear'. I couldn't believe my eyes.
Of course, that 'linearity' has nothing to do with a filter being linear. Suppose that I want to predict the value of a signal using three previous values, and I decide to fit them via a second-degree polynomial, and extrapolate. The extrapolation then would fit a parabola, but my filter would still be a linear filter, because the extrapolated value is a linear combination of the input.