gaussiankernel

Create a gaussian kernel. More...

Modules

 gaussiankernel
 Creates a Gaussian kernel.
 

Detailed Description

Create a gaussian kernel.

This function creates a kernel of a specified size that contains a Gaussian distribution. This distribution is normalized to one. This is most commonly used when performing a Gaussian blur on an image. The function takes two sets of arguments, the size of the kernel (width and height in pixels) and the sigma parameters (for row and column) which effect the distribution of the weights in the y and x directions, respectively.

Here is an example of generating a 3x3 kernel with the default sigma parameters of 0 for x and 0 for y:

array a = gaussiankernel(3, 3);
print(a);
// a = 0.0454 0.0566 0.0454
// 0.0566 0.0707 0.0566
// 0.0454 0.0566 0.0454

Changing sigma causes the weights in each direction to vary. Sigma is calculated internally as (0.25 * rows + 0.75) for rows and similarly for columns.