Instance Method

initWithDevice:kernelWidth:kernelHeight:weights:

Initializes a convolution filter.

Declaration

- (instancetype)initWithDevice:(id<MTLDevice>)device kernelWidth:(NSUInteger)kernelWidth kernelHeight:(NSUInteger)kernelHeight weights:(const float *)kernelWeights;

Parameters

device

The Metal device the filter will run on.

kernelWidth

The width of the kernel. Must be an odd number.

kernelHeight

The height of the kernel. Must be an odd number.

kernelWeights

A pointer to an array of kernelWidth * kernelHeight values to be used as the kernel. These values should be in row-major order.

Return Value

An initialized convolution filter object.