Creates a Gaussian kernel. More...

array gaussiankernel (int rows, int cols, double sigma_r=0, double sigma_c=0)
 Generate kernels. More...

Detailed Description

Creates 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);
// 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.

Function Documentation

array af::gaussiankernel ( int  rows,
int  cols,
double  sigma_r = 0,
double  sigma_c = 0 

Generate kernels.

[in]sigma_r(default 0) (calculated internally as 0.25 * rows + 0.75)
[in]sigma_c(default 0) (calculated internally as 0.25 * cols + 0.75)
gaussian kernel of size rows x cols