CIFilter_Stylize_Convolution7X7 - linhay/Stem GitHub Wiki
CIFilter.Stylize.Convolution7X7
Discussion A convolution filter generates each output pixel by summing all elements in the element-wise product of two matrices—a weight matrix and a matrix containing the neighborhood surrounding the corresponding input pixel—and adding a bias. This operation is performed independently for each color component (including the alpha component), and the resulting value is clamped to the range between 0.0 and 1.0. You can create many types of image processing effects using different weight matrices, such as blurring, sharpening, edge detection, translation, and embossing. This filter uses a 7x7 weight matrix and the 7x7 neighborhood surrounding an input pixel (that is, the pixel itself and those within a distance of three pixels horizontally or vertically). If you want to preserve the overall brightness of the image, ensure that the sum of all values in the weight matrix is 1.0. You may find it convenient to devise a weight matrix without this constraint and then normalize it by dividing each element by the sum of all elements.
public struct Convolution7X7: CIFilterContainerProtocol
and later and in iOS 9 and later.
Inheritance
Initializers
init()
init()
Properties
filter
var filter: CIFilter
image
A CIImage object whose display name is Image.
var image: CIImage?
weights
A CIVector object whose display name is Weights. Default value: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] Identity: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
var weights: CIVector
bias
An NSNumber object whose attribute type is CIAttributeTypeDistance and whose display name is Bias. Default value: 0.00 Identity: 0.00
var bias: NSNumber