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 at0, at integer gridi, 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 considered0, we haveceil(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.