CIFilter.Generator.Checkerboard:
Discussion
You can specify the checkerboard size and colors, and the sharpness of the pattern.
CIFilter.Generator.Code128Barcode:
Discussion
Generates an output image representing the input data according to the ISO/IEC 15417:2007 standard. The width of each module (vertical line) of the barcode in the output image is one pixel. The height of the barcode is 32 pixels. To create a barcode from a string or URL, convert it to an NSData object using the NSASCIIStringEncoding string encoding.
CIFilter.Generator.LenticularHalo:
Discussion
This filter is typically applied to another image to simulate lens flares and similar effects.
CIFilter.Generator.PDF417Barcode:
Discussion
Generates an output image representing the input data according to the ISO 15438 standard. PDF417 codes are commonly used in postage, package tracking, personal identification documents, and coffeeshop membership cards. The width and height of each module (square dot) of the code in the output image is one point. To create a PDF417 code from a string or URL, convert it to an NSData object using the NSISOLatin1StringEncoding string encoding.
CIFilter.Generator.QRCode:
Discussion
Generates an output image representing the input data according to the ISO/IEC 18004:2006 standard. The width and height of each module (square dot) of the code in the output image is one point. To create a QR code from a string or URL, convert it to an NSData object using the NSISOLatin1StringEncoding string encoding.
The inputCorrectionLevel parameter controls the amount of additional data encoded in the output image to provide error correction. Higher levels of error correction result in larger output images but allow larger areas of the code to be damaged or obscured without. There are four possible correction modes (with corresponding error resilience levels):
L: 7%
M: 15%
Q: 25%
H: 30%
CIFilter.Blur.MaskedVariableBlur:
Discussion
Shades of gray in the mask image vary the blur radius from zero (where the mask image is black) to the radius specified in the inputRadius parameter (where the mask image is white).
CIFilter.Blur.NoiseReduction:
Discussion
Small changes in luminance below that value are considered noise and get a noise reduction treatment, which is a local blur. Changes above the threshold value are considered edges, so they are sharpened.
CIFilter.ColorAdjustment.ColorClamp:
Discussion
At each pixel, color component values less than those in inputMinComponents will be increased to match those in inputMinComponents, and color component values greater than those in inputMaxComponents will be decreased to match those in inputMaxComponents.
CIFilter.ColorAdjustment.ColorControls:
Discussion
To calculate saturation, this filter linearly interpolates between a grayscale image (saturation = 0.0) and the original image (saturation = 1.0). The filter supports extrapolation: For values large than 1.0, it increases saturation.
To calculate contrast, this filter uses the following formula:
(color.rgb - vec3(0.5)) * contrast + vec3(0.5)
This filter calculates brightness by adding a bias value:
color.rgb + vec3(brightness)
CIFilter.ColorAdjustment.ColorPolynomial:
Discussion
For each pixel, the value of each color component is treated as the input to a cubic polynomial, whose coefficients are taken from the corresponding input coefficients parameter in ascending order. Equivalent to the following formula:
CIFilter.ColorAdjustment.ExposureAdjust:
Discussion
This filter multiplies the color values, as follows, to simulate exposure change by the specified F-stops:
s.rgb * pow(2.0, ev)
CIFilter.ColorAdjustment.GammaAdjust:
Discussion
This filter is typically used to compensate for nonlinear effects of displays. Adjusting the gamma effectively changes the slope of the transition between black and white. It uses the following formula:
pow(s.rgb, vec3(power))
Note
CIFilter.ColorAdjustment.ToneCurve:
Discussion
The input points are five x,y values that are interpolated using a spline curve. The curve is applied in a perceptual (gamma 2) version of the working space.
CIFilter.ColorEffect.ColorCrossPolynomial:
Discussion
Each component in an output pixel out is determined using the component values in the input pixel in according to a polynomial cross product with the input coefficients. That is, the red component of the output pixel is calculated using the inputRedCoefficients parameter (abbreviated rC below) using the following formula:
CIFilter.ColorEffect.ColorCube:
Discussion
This filter maps color values in the input image to new color values using a three-dimensional color lookup table (also called a CLUT or color cube). For each RGBA pixel in the input image, the filter uses the R, G, and B component values as indices to identify a location in the table; the RGBA value at that location becomes the RGBA value of the output pixel.
Use the inputCubeData parameter to provide data formatted for use as a color lookup table, and the inputCubeDimension parameter to specify the size of the table. This data should be an array of texel values in 32-bit floating-point RGBA linear premultiplied format. The inputCubeDimension parameter identifies the size of the cube by specifying the length of one side, so the size of the array should be inputCubeDimension cubed times the size of a single texel value. In the color table, the R component varies fastest, followed by G, then B. Listing 1 shows a basic pattern for creating color cube data.
Listing 1Creating a Color Table for the CIColorCube Filter
CIFilter.ColorEffect.ColorCubeWithColorSpace:
Discussion
See CIColorCube for more details on the color cube operation. To provide a CGColorSpaceRef object as the input parameter, cast it to type id. With the default color space (null), which is equivalent to kCGColorSpaceGenericRGBLinear, this filter’s effect is identical to that of CIColorCube.
Figure 24 uses the same color cube as Figure 23, but with the sRGB color space.
CIFilter.ColorEffect.FalseColor:
Discussion
False color is often used to process astronomical and other scientific data, such as ultraviolet and x-ray images.
CIFilter.ColorEffect.MaskToAlpha:
Discussion
The white values from the source image produce the inside of the mask; the black values become completely transparent.
CIFilter.CompositeOperation.AdditionCompositing:
Discussion
This filter is typically used to add highlights and lens flare effects. The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital Images. Computer Graphics, 18 (3): 253-259.
CIFilter.CompositeOperation.ColorBlendMode:
Discussion
This mode preserves the gray levels in the image. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.
CIFilter.CompositeOperation.ColorBurnBlendMode:
Discussion
Source image sample values that specify white do not produce a change. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.
CIFilter.CompositeOperation.ColorDodgeBlendMode:
Discussion
Source image sample values that specify black do not produce a change. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.
CIFilter.CompositeOperation.DarkenBlendMode:
Discussion
The result is that the background image samples are replaced by any source image samples that are darker. Otherwise, the background image samples are left unchanged. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.
CIFilter.CompositeOperation.DifferenceBlendMode:
Discussion
Source image sample values that are black produce no change; white inverts the background color values. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.
CIFilter.CompositeOperation.ExclusionBlendMode:
Discussion
Source image sample values that are black do not produce a change; white inverts the background color values. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.
CIFilter.CompositeOperation.HardLightBlendMode:
Discussion
If the source image sample color is lighter than 50% gray, the background is lightened, similar to screening. If the source image sample color is darker than 50% gray, the background is darkened, similar to multiplying. If the source image sample color is equal to 50% gray, the source image is not changed. Image samples that are equal to pure black or pure white result in pure black or white. The overall effect is similar to what you would achieve by shining a harsh spotlight on the source image. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.
CIFilter.CompositeOperation.HueBlendMode:
Discussion
The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.
CIFilter.CompositeOperation.LightenBlendMode:
Discussion
The result is that the background image samples are replaced by any source image samples that are lighter. Otherwise, the background image samples are left unchanged. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.
CIFilter.CompositeOperation.LuminosityBlendMode:
Discussion
This mode creates an effect that is inverse to the effect created by the CIColorBlendMode filter. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.
CIFilter.CompositeOperation.MaximumCompositing:
Discussion
This is similar to dodging. The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital Images. Computer Graphics, 18 (3): 253-259.
CIFilter.CompositeOperation.MinimumCompositing:
Discussion
This is similar to burning. The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital Images. Computer Graphics, 18 (3): 253-259.
CIFilter.CompositeOperation.MultiplyBlendMode:
Discussion
This results in colors that are at least as dark as either of the two contributing sample colors. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.
CIFilter.CompositeOperation.MultiplyCompositing:
Discussion
This filter is typically used to add a spotlight or similar lighting effect to an image. The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital Images. Computer Graphics, 18 (3): 253-259.
CIFilter.CompositeOperation.OverlayBlendMode:
Discussion
The result is to overlay the existing image samples while preserving the highlights and shadows of the background. The background color mixes with the source image to reflect the lightness or darkness of the background. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.
CIFilter.CompositeOperation.SaturationBlendMode:
Discussion
Areas of the background that have no saturation (that is, pure gray areas) do not produce a change. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.
CIFilter.CompositeOperation.ScreenBlendMode:
Discussion
This results in colors that are at least as light as either of the two contributing sample colors. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.
CIFilter.CompositeOperation.SoftLightBlendMode:
Discussion
If the source image sample color is lighter than 50% gray, the background is lightened, similar to dodging. If the source image sample color is darker than 50% gray, the background is darkened, similar to burning. If the source image sample color is equal to 50% gray, the background is not changed. Image samples that are equal to pure black or pure white produce darker or lighter areas, but do not result in pure black or white. The overall effect is similar to what you would achieve by shining a diffuse spotlight on the source image. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.
CIFilter.CompositeOperation.SourceAtopCompositing:
Discussion
The composite shows the background image and only those portions of the source image that are over visible parts of the background. The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital Images. Computer Graphics, 18 (3): 253-259.
CIFilter.CompositeOperation.SourceInCompositing:
Discussion
The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital Images. Computer Graphics, 18 (3): 253-259.
CIFilter.CompositeOperation.SourceOutCompositing:
Discussion
The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital Images. Computer Graphics, 18 (3): 253-259.
CIFilter.CompositeOperation.SourceOverCompositing:
Discussion
The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital Images. Computer Graphics, 18 (3): 253-259.
CIFilter.GeometryAdjustment.PerspectiveCorrection:
Discussion
The extent of the rectangular output image varies based on the size and placement of the specified quadrilateral region in the input image.
CIFilter.GeometryAdjustment.PerspectiveTransformWithExtent:
Discussion
You can use the perspective filter to skew an the portion of the image defined by extent. See CIPerspectiveTransform for an example of the output of this filter when you supply the input image size as the extent.
CIFilter.Gradient.SmoothLinearGradient:
Discussion
Where the CILinearGradient filter blends colors linearly (that is, the color at a point 25% along the line between Point 1 and Point 2 is 25% Color 1 and 75% Color 2), this filter blends colors using an S-curve function: the color blend at points less than 50% along the line between Point 1 and Point 2 is slightly closer to Color 1 than in a linear blend, and the color blend at points further than 50% along that line is slightly closer to Color 2 than in a linear blend.
CIFilter.Reduction.HistogramDisplayFilter:
Discussion
The input image should be a one-dimensional image in which each pixel contains data (per component) for one “bucket” of the histogram; you can produce such an image using the CIAreaHistogram filter. The width of the output image is the same as that of the input image, and its height is the value of the inputHeight parameter.
CIFilter.Reduction.AreaMaximumAlpha:
Discussion
If more than one pixel exists with the maximum alpha value, Core Image returns the vector that has the lowest x and y coordinate. Image component values should range from 0.0 to 1.0, inclusive.
CIFilter.Reduction.AreaMinimumAlpha:
Discussion
If more than one pixel exists with the minimum alpha value, Core Image returns the vector that has the lowest x and y coordinate. Image component values should range from 0.0 to 1.0, inclusive.
CIFilter.Stylize.BlendWithAlphaMask:
Discussion
When a mask alpha value is 0.0, the result is the background. When the mask alpha value is 1.0, the result is the image.
CIFilter.Stylize.BlendWithMask:
Discussion
When a mask value is 0.0, the result is the background. When the mask value is 1.0, the result is the image.
CIFilter.Stylize.Convolution3X3:
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 3x3 weight matrix and the 3x3 neighborhood surrounding an input pixel (that is, the pixel itself and those within a distance of one pixel 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, as shown in the figure below.
CIFilter.Stylize.Convolution5X5:
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 5x5 weight matrix and the 5x5 neighborhood surrounding an input pixel (that is, the pixel itself and those within a distance of two 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.
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.
CIFilter.Stylize.Convolution9Horizontal:
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 9x1 weight matrix and the 9x1 neighborhood surrounding an input pixel (that is, the pixel itself and those within a distance of four pixels horizontally). Unlike convolution filters which use square matrices, this filter can only produce effects along a horizontal axis, but it can be combined with CIConvolution9Vertical to approximate the effect of certain 9x9 weight matrices.
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.
CIFilter.Stylize.Convolution9Vertical:
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 1x9 weight matrix and the 1x9 neighborhood surrounding an input pixel (that is, the pixel itself and those within a distance of four pixels vertically). Unlike convolution filters which use square matrices, this filter can only produce effects along a vertical axis, but it can be combined with CIConvolution9Vertical to approximate the effect of certain 9x9 weight matrices.
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.
CIFilter.Stylize.HeightFieldFromMask:
Discussion
The white values of the mask define those pixels that are inside the height field while the black values define those pixels that are outside. The field varies smoothly and continuously inside the mask, reaching the value 0 at the edge of the mask. You can use this filter with the CIShadedMaterial filter to produce extremely realistic shaded objects.
CIFilter.Stylize.ShadedMaterial:
Discussion
The height field is defined to have greater heights with lighter shades, and lesser heights (lower areas) with darker shades. You can combine this filter with the CIHeightFieldFromMask filter to produce quick shadings of masks, such as text.
This filter sets the input image as a height-field (multiplied by the scale parameter), and computes a normal vector for each pixel. It then uses that normal vector to look up the reflected color for that direction in the input shading image.
The input shading image contains the picture of a hemisphere, which defines the way the surface is shaded. The look-up coordinate for a normal vector is:
(normal.xy + 1.0) * 0.5 * vec2(shadingImageWidth, shadingImageHeight)
CIFilter.TileEffect.AffineClamp:
Discussion
This filter performs similarly to the CIAffineTransform filter except that it produces an image with infinite extent. You can use this filter when you need to blur an image but you want to avoid a soft, black fringe along the edges.
CIFilter.Transition.FlashTransition:
Discussion
The flash originates from a point you specify. Small at first, it rapidly expands until the image frame is completely filled with the flash color. As the color fades, the target image begins to appear.