- #1

- 128

- 0

## Main Question or Discussion Point

Hello,

I was looking at the explanation for Gaussian smoothing found here:

http://homepages.inf.ed.ac.uk/rbf/HIPR2/gsmooth.htm" [Broken]

Now, figure 3 shows a discrete Gaussian kernel approximation. I have 2 questions:

1: Why is there a scaling factor (1/273)? Is it so that the sum of the discrete values is 1. I remember reading somewhere that the area under the Guassian curve is supposed to be 1. Is this also true in more than one dimension?

2: This is a more practical question. I am looking at some source code which attempts to smooth a 3D image using the separable technique and smoothes along each axes separately. So, it does it as follows:

float kernelSum = 0.0;

for (int i = 0; i < 3; ++i) {

for (int j = -radius; j < radius; ++j) {// The kernel of a given radius...

// Compute kernel value at the given point

......

kernelSum += computed_kernel_value;

}

for (int j = -radius; j < radius; ++j) {

// Scale all kernel values in current axes by kernelSum

}

}

Now, my question is shouldn't it be scaling the kernel after it has computed the values in all 3 dimensions? Right now, it scales each axes by the sum of the kernel values along that axes. This ensures that the sum of the values along a particular axes is 1. However, shouldn't the sum along all the axes be equal to 1?

To be clear, should the scaling loop in the above pseudish-code be outside the main loop?

I hope the second bit of the code is clear? I think the question reduces to whether the area under the curve along each dimension is 1 or the whole curve (in all dimensions) has an area of 1 under it?

Thanks,

Luca

I was looking at the explanation for Gaussian smoothing found here:

http://homepages.inf.ed.ac.uk/rbf/HIPR2/gsmooth.htm" [Broken]

Now, figure 3 shows a discrete Gaussian kernel approximation. I have 2 questions:

1: Why is there a scaling factor (1/273)? Is it so that the sum of the discrete values is 1. I remember reading somewhere that the area under the Guassian curve is supposed to be 1. Is this also true in more than one dimension?

2: This is a more practical question. I am looking at some source code which attempts to smooth a 3D image using the separable technique and smoothes along each axes separately. So, it does it as follows:

float kernelSum = 0.0;

for (int i = 0; i < 3; ++i) {

for (int j = -radius; j < radius; ++j) {// The kernel of a given radius...

// Compute kernel value at the given point

......

kernelSum += computed_kernel_value;

}

for (int j = -radius; j < radius; ++j) {

// Scale all kernel values in current axes by kernelSum

}

}

Now, my question is shouldn't it be scaling the kernel after it has computed the values in all 3 dimensions? Right now, it scales each axes by the sum of the kernel values along that axes. This ensures that the sum of the values along a particular axes is 1. However, shouldn't the sum along all the axes be equal to 1?

To be clear, should the scaling loop in the above pseudish-code be outside the main loop?

I hope the second bit of the code is clear? I think the question reduces to whether the area under the curve along each dimension is 1 or the whole curve (in all dimensions) has an area of 1 under it?

Thanks,

Luca

Last edited by a moderator: