Skip to content

Filtering

Claudiu edited this page Jul 14, 2016 · 4 revisions

Averaging

Assumptions

When does it make sense to average in order to smooth out noise? Assumptions:

  • Images are smooth/continuous in general. That is, true value of a pixel is similar to true value of nearby pixels.
  • The noise is independently distributed. So averaging out will get you the mean, which is assumed to be zero
  • Mean of the noise is zero. See above

Weighted Moving Average

Treat pixels that are further away as less important.

  • Uniform:

    image

  • Non-uniform:

    image

Non-uniform is smoother.

Cross-Correlation

Cross-correlation is literally just a weighted moving average.

Say you are finding the target G[i, j], the target pixel at i, j, and your source is F[i, j].

You have a parameter k which is the amount to go left and right, e.g. a k of 1 means a 3x3 mask. So you sum them together:

G[i, j] = sum of (H[u, v] * F[i + u, j + v]) for u in [-k, k] for v in [-k ,k]

That's it. e.g. H may be:

  |-1  0  1
--+--------
-1| 1  1  1
 0| 1  5  1
 1| 1  1  1

(but you'd divide by 13 to sum them to 1).

G here is known as the cross-correlation of H and F, aka G = H ⨂ F.

H is known as the mask or kernel. It's just the matrix of linear weights that is used.

Gaussian Filter

This is a filter where the mask/kernel is an approximation of a Gaussian function.

In 2 dimensions the circularly symmetric Gaussian function is:

image

Isotropic

This filter is isotropic, which is just a fancy word for "circularly symmetric".

So any isotropic filter, is circularly symmetric.

Clone this wiki locally