6
$\begingroup$

I generate two noise images using MATLAB's function imnoise().
If I average the two noise images, the resultant image looks like the original noise image but only the noise level is different.

If I perform spatial averaging using box filtering, the noise pattern in the resultant image is different from the original noise image. The noise is correlated spatially if spatial averaging is applied.

However I can't figure out the principle behind it. The noise at each location is i.i.d before any operation is performed. So the temporal operation and spatial operation should not produce different results.

The MATLAB is as follow

width = 256;
height = 128;
image = ones(height, width, 'uint8');
image = image.*128;
image_noise0 = imnoise(image, 'gaussian', 0, 0.0005);
image_noise1 = imnoise(image, 'gaussian', 0, 0.0005);
image_noise_tem = uint8((uint16(image_noise0) + uint16(image_noise1))/2);

h = fspecial('average', 3);
image_noise_spa = imfilter(image_noise0, h);
$\endgroup$

2 Answers 2

5
$\begingroup$

Let's model the data as:

$$ {y}_{i} = {x}_{i} + {n}_{i} $$

So the the $ i $ -th pixel in the noisy image $ Y $ is composed by the noiseless image data and additive IID noise.

Now assume we have 2 images: $ {Y}^{1} $ and $ {Y}^{2} $:

$$ {y}^{j}_{i} = {x}_{i} + {n}^{j}_{i}, j = 1, 2 $$

Indeed, noise wise, when we combine data temporarily (Between 2 images) and spatially (Spatial filter) to the noise we do something similar as it is IID. But the difference is image wise.

When we do averaging between two images:

$$ {z}_{i} = \frac{{y}^{1}_{i} + {y}^{2}_{i}}{2} = {x}_{i} + \frac{{n}^{1}_{i} + {n}^{2}_{i}}{2} $$

So the output is the same image with noise with smaller variance.

What happens with spatial averaging? Let's assume something which also just average 2 adjacent pixels:

$$ {w}_{i} = \frac{{y}^{1}_{k} + {y}^{2}_{l}}{2} = \frac{{x}_{k} + {x}_{l}}{2} + \frac{{n}^{1}_{k} + {n}^{2}_{l}}{2} $$

So while the 2 results do have the same noise properties, the data is different.
Classic model for images is the Piece Wise Smooth model. Namely adjacent pixels are correlated, hence the averaging doesn't work on them like if you just blur over edges. This is why denoisers are much more advanced than brute spatial averaging (See for instance the Non Local Means Filter and the Bilateral Filter).

Regarding the noise alone, pay attention that averaging 2 images means we have a filter which combines 2 pixels. Even the smallest box filter (3 x 3) averages 9 pixels. So the output noise will have even smaller variance, yet the content of the image will be distorted. The distortion it something you may model as a spatially correlated noise.

$\endgroup$
4
  • $\begingroup$ I catch what you said fully. However, the image is just a homogeneous region for the example, so the signal at different sptation locations can be considered as same as the temporal average. Does it mean that two kinds of averaging oprations should produce similar results? $\endgroup$ Jan 21 at 2:12
  • 1
    $\begingroup$ If all pixels are the same and you average the exact same number of pixels in both methods then the noise properties per pixel will be the same. Yet the properties spatially (Correlations between 2 pixels) will be different. This happens since adjacent pixels in the spatial case will involve averaging same value of noise. $\endgroup$
    – Royi
    Jan 21 at 6:07
  • $\begingroup$ Thanks. Noise level and noise correlation are two different things. I think I mix them up. Is there any tool to describe the spatial correlation of the noise? $\endgroup$ Jan 21 at 6:56
  • $\begingroup$ The correlation is measured by statistical properties: Joint distribution, Correlation / Covariance. If you have the properties before the linear filtering, with AWGN it is easy to derive the properties after the filtering. $\endgroup$
    – Royi
    Jan 21 at 6:59
2
$\begingroup$

Both averaging operations are low-pass filers: one is low-passing in time the other is low-passing in space.

The cutoff frequencies are determined by the length of the averaging. For your spatial filter this is 7 (I think) and for the temporal one it's 2.

The spatial is easy to easy: just look at a single picture. Too "see" the temporal one you would have to look at a function of time. So you would have to creates a few hundred images and look at the amplitude over time of a single pixel with and without averaging. They will look indeed differently. Alternatively you can just watch it as a video with and without averaging. The averaged one will be less "flickery".

$\endgroup$

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.