MPSImageGaussianBlur(3) MetalPerformanceShaders.framework MPSImageGaussianBlur(3)
NAME
MPSImageGaussianBlur
SYNOPSIS
#import <MPSImageConvolution.h>
Inherits MPSUnaryImageKernel.
Instance Methods
(nonnull instancetype) - initWithDevice:sigma:
(nullable instancetype) - initWithCoder:device:
(nonnull instancetype) - initWithDevice:
Properties
float sigma
Additional Inherited Members
Detailed Description
The MPSImageGaussianBlur convolves an image with gaussian of given sigma in both x and y direction.
The MPSImageGaussianBlur utilizes a very fast algorith that typically runs at approximately
1/2 of copy speeds. Notably, it is faster than either the tent or box blur except perhaps
for very large filter windows. Mathematically, it is an approximate gaussian. Some
non-gaussian behavior may be detectable with advanced analytical methods such as FFT.
If a analytically clean gaussian filter is required, please use the MPSImageConvolution
filter instead with an appropriate set of weights. The MPSImageGaussianBlur is intended
to be suitable for all common image processing needs demanding ~10 bits of precision or
less.
Method Documentation
- (nullable instancetype) initWithCoder: (NSCoder *__nonnull) aDecoder(nonnull id< MTLDevice >) device
NSSecureCoding compatability While the standard NSSecureCoding/NSCoding method -initWithCoder: should work, since the file can't know
which device your data is allocated on, we have to guess and may guess incorrectly. To avoid that problem, use initWithCoder:device
instead.
Parameters:
aDecoder The NSCoder subclass with your serialized MPSKernel
device The MTLDevice on which to make the MPSKernel
Returns:
A new MPSKernel object, or nil if failure.
Reimplemented from MPSUnaryImageKernel.
- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device
Standard init with default properties per filter type
Parameters:
device The device that the filter will be used on. May not be NULL.
Returns:
a pointer to the newly initialized object. This will fail, returning nil if the device is not supported. Devices must be
MTLFeatureSet_iOS_GPUFamily2_v1 or later.
Reimplemented from MPSUnaryImageKernel.
- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device(float) sigma
Initialize a gaussian blur filter for a particular sigma and device
Parameters:
device The device the filter will run on
sigma The standard deviation of gaussian blur filter. Gaussian weight, 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 rough estimate of filter width
Returns:
A valid object or nil, if failure.
Property Documentation
- sigma [read], [nonatomic], [assign]
Read-only sigma value with which filter was created
Author
Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code.
Version MetalPerformanceShaders-100 Thu Feb 8 2018 MPSImageGaussianBlur(3)