Contents

init(device:sigma:)

Initializes a Gaussian blur filter.

Declaration

init(device: any MTLDevice, sigma: Float)

Parameters

  • device:

    The Metal device the filter will run on.

  • sigma:

    The standard deviation of the gaussian blur filter.

    Gaussian weight w, centered at 0, at integer grid i, is given as:

    w(i) = 1/sqrt(2*pi*sigma) * exp(-i^2/2*sigma^2)

    If we take cut off at 1% of w(0) (max weight) beyond which weights are considered 0, we have ceil(sqrt(-log(0.01)*2)*sigma) ~ ceil(3.7*sigma) as the rough estimate of the filter width.

Return Value

An initialized Gaussian blur filter object.