Wednesday, August 18, 2010

Gaussian Image Filter

I wrote a very simple program to generate 3x3 and 5x5 Gaussian filters for images. I sample points from the pixel to find an average value.

Let the Gaussian function be N(mean, sigma).

For N(0,1), I got the following matrix:

          1 3 1
N(0,1) = [3 5 3] / 21
          1 3 1
Machine Vision lists the following matrix:

          1 2 1 
N(0,?) = [2 4 2] / 16
          1 2 1
I suppose that is pretty close to a Gaussian, but I wonder how much it affects the frequency response of the filter.

It is pretty obvious that those values were chosen for performance. Dividing by 16 requires only a bit shift.

No comments:

Post a Comment