編輯

共用方式為


CoreImage Namespace

The CoreImage namespace provides hardware-accelerated image processing.

Classes

CIAccordionFoldTransition

Animates a transition by creating an accordion-fold effect on the source image.

CIAdditionCompositing

The CIAdditionCompositing CoreImage filter.

CIAffineClamp

A CIAffineFilter that extends the border pixels to the post-transform boundaries.

CIAffineFilter

An abstract class that defines a CIFilter that performs an affine transform on an image and then performs a filtering operation on the transformed image.

CIAffineTile

A CIAffineFilter that tiles the transformed image.

CIAffineTransform

Performs an affine transform on an image.

CIAreaAverage

Produces a single-pixel image. The pixel is the average color of the input extent.

CIAreaHistogram

Creates histogram data for a given image and rectangle of interest.

CIAreaMaximum

Produces a single-pixel image. The pixel's components are set to the maximum of that component within the input extent.

CIAreaMaximumAlpha

Returns a single-pixel image. The color is that of the pixel in the input extent with the greatest alpha value.

CIAreaMinimum

Returns a single-pixel image. The pixel's components are set to the minimum of that component within the input extent.

CIAreaMinimumAlpha

Returns a single-pixel image. The color is that of the pixel in the input extent with the lowest alpha value.

CIAreaMinMax
CIAreaMinMaxRed
CIAttributedTextImageGenerator

A CIImageGenerator that generates an image from attributed text.

CIAutoAdjustmentFilterOptions

When passed to GetAutoAdjustmentFilters(CIAutoAdjustmentFilterOptions), limits the results.

CIAztecCodeDescriptor

A CIBarcodeDescriptor for the Aztec barcode scheme.

CIAztecCodeGenerator

Generates an Aztec code for the specified P:CoreImage.CIAztecCodeGenerator.Message.

CIBarcodeDescriptor

Base class for barcode descriptions. Subclasses for specific schemes define relevant properties.

CIBarcodeGenerator

A CIFilter that generates barcodes.

CIBarsSwipeTransition

A CITransitionFilter that animates a transition by moving a bar over the source image.

CIBicubicScaleTransform
CIBlendFilter

An abstract CIFilter that combines a background and foreground image.

CIBlendKernel

A CIColorKernel that blends images using the GPU.

CIBlendWithAlphaMask

A CIBlendWithMask that uses a mask image to blend foreground and background images.

CIBlendWithBlueMask
CIBlendWithMask

A CIBlendFilter that uses a grayscale mask to blends its foreground and background images.

CIBlendWithRedMask
CIBloom

A CIFilter that creates an edge-flow effect.

CIBokehBlur

A blur simulating the the unfocused background of a larger-aperture camera with an iris shutter.

CIBoxBlur

Applies a blur created with a box-shaped convolution kernel.

CIBumpDistortion

A CIDistortionFilter that creates a bump at the specified center point.

CIBumpDistortionLinear

A filter that distorts the image around a convex or concave line.

CICameraCalibrationLensCorrection
CICheckerboardGenerator

The CICheckerboardGenerator CoreImage filter

CICircleSplashDistortion

Makes the pixels at the circumference of a circle spread out to the boundaries of the image.

CICircularScreen

A CIScreenFilter that creates a circular bulls-eye-style halftone screen.

CICircularWrap

Distorts the input image so that it appears as if wrapped around a transparent circle.

CIClamp
CICMYKHalftone

Produce a color half-tone image built from cyan, magenta, yellow, and black 'inks'.

CICode128BarcodeGenerator

Generates a Code 128 barcode.

CICodeGenerator

Base class for code generators.

CIColor

A Core Image color, including both color values and a reference to a color space.

CIColorBlendMode

The CIColorBlendMode CoreImage filter

CIColorBurnBlendMode

The CIColorBurnBlendMode CoreImage filter

CIColorClamp

A filter that constrains the color values between the range specified.

CIColorControls

The CIColorControls CoreImage filter

CIColorCrossPolynomial

A filter that modifies the source pixels by applying a set of polynomial cross-products.

CIColorCube

The CIColorCube CoreImage filter

CIColorCubesMixedWithMask
CIColorCubeWithColorSpace

A filter that modifies the source pixels using a 3D color-table and then maps the result to a color space.

CIColorCurves
CIColorDodgeBlendMode

The CIColorDodgeBlendMode CoreImage filter

CIColorInvert

The CIColorInvert CoreImage filter

CIColorKernel

Kernel for a GPU process that only operates on color data.

CIColorMap

Changes colors based on an input gradient image's mapping.

CIColorMatrix

The CIColorMatrix CoreImage filter.

CIColorMonochrome

The CIColorMonochrome CoreImage filter

CIColorPolynomial

A filter that modifies the source pixels by applying a set of cubic polynomials.

CIColorPosterize

Reduces the number of levels for each color component.

CIColumnAverage

Returns a 1-pixel high image with the same width as the input image. Every pixel is the average color of the corresponding column in the input image.

CIComicEffect

Produces an image with outlined edges and a color halftone effect.

CICompositingFilter

An abstract CIFilter that composites two images.

CIConstantColorGenerator

Generates a solid color.

CIContext

Orchestrates the rendering of a CIFilter pipeline.

CIContext_CIDepthBlurEffect
CIContext_CIRenderDestination
CIContext_ImageRepresentation

Extension methods for CIContext that can generate common image formats.

CIContextOptions

Use to configure the CIContext rendering pipeline.

CIConvolution3X3

A filter that performs a custom 3x3 matrix convolution.

CIConvolution5X5

A filter that performs a custom 5x5 matrix convolution.

CIConvolution7X7

A filter that performs a custom 7x7 matrix convolution.

CIConvolution9Horizontal

A filter that performs a horizontal convolution of 9 elements.

CIConvolution9Vertical

A filter that performs a vertical convolution of 9 elements.

CIConvolutionCore

An abstract class that is the base for convolution filters.

CICopyMachineTransition

A CITransitionFilter that mimics the effect of a photocopier.

CICoreMLModelFilter
CICrop

The CICrop CoreImage filter

CICrystallize

Creates irregular blocks of average color from the source image.

CIDarkenBlendMode

The CIDarkenBlendMode CoreImage filter

CIDataMatrixCodeDescriptor

A CIBarcodeDescriptor for the Data Matrix barcode scheme.

CIDepthBlurEffect
CIDepthDisparityConverter
CIDepthOfField

Simulates a blurred depth of field and applies a saturation effect to the 'in-focus' region.

CIDepthToDisparity
CIDetector

Image analysis class for face detection.

CIDetectorOptions

Options for use with face detection. Used with CreateFaceDetector(CIContext, Nullable<FaceDetectorAccuracy>, Nullable<Single>, Nullable<Boolean>).

CIDifferenceBlendMode

The CIDifferenceBlendMode CoreImage filter

CIDiscBlur

Applies a blur created with a disc-shaped convolution kernel.

CIDisintegrateWithMaskTransition

A CITransitionFilter that uses a mask to define the transition.

CIDisparityToDepth
CIDisplacementDistortion

Textures the input image by the grayscale value of the corresponding pixels in the displacement image.

CIDissolveTransition

A CITransitionFilter that performs a cross-dissolve.

CIDistortionFilter

An abstract CIFilter for distortions.

CIDither
CIDivideBlendMode

A CIBlendFilter that divides the color values of its P:CIBlendFilter.Image and BackgroundImage.

CIDotScreen

A CIScreenFilter that screens with a halftone dot pattern.

CIDroste

Creates a series of increasingly smaller boxes repeating a portion of the image.

CIEdgePreserveUpsampleFilter
CIEdges

Creates a colorized edge-detection effect.

CIEdgeWork

Creates a black and white woodblock effect.

CIEightfoldReflectedTile

A CITileFilter that applies 8-way reflected symmetry.

CIExclusionBlendMode

The CIExclusionBlendMode CoreImage filter

CIExposureAdjust

The CIExposureAdjust CoreImage filter

CIFaceBalance

The CIFaceBalance CoreImage filter

CIFaceFeature

Locations of the eyes and mouths in a detected face. In video sequences, attempts to maintain a consistent P:CoreImage.CIFaceFeature.TrackingID.

CIFalseColor

The CIFalseColor CoreImage filter

CIFeature

An area of an image in which a CIDetector has detected a match.

CIFilter

CoreImage image filter.

CIFilterApply
CIFilterAttributes

Constants used for CIFilter's attributes

CIFilterCategory

Constants used for CIFilter filtering facilities to find filters by category.

CIFilterGenerator
CIFilterInputKey

Keys that can be used to configure the CIFilter input values.

CIFilterOutputKey

Keys that can be used to get output results out of a CIFilter.

CIFilterShape

Masks filter operations to areas composed of the intersections, unions, and affine transformations of rectangles and other similarly constructed filter shapes.

CIFlashTransition

A CITransitionFilter that presents a starburst-like flash.

CIFourfoldReflectedTile

A CITileFilter that applies 4-way reflected symmetry.

CIFourfoldRotatedTile

A CITileFilter that rotates the source image in 90-degree increments.

CIFourfoldTranslatedTile

A CITileFilter that applies four translations to the source image.

CIGammaAdjust

The CIGammaAdjust CoreImage filter

CIGaussianBlur

Applies a Gaussian blur.

CIGaussianGradient

Generates a gradient that fades via a 2D Gaussian distribution

CIGlassDistortion

Distorts the input image so that it appears viewed through glass blocks whose geometry corresponds to the Texture image.

CIGlassLozenge

Creates an effect as if a lozenge-shaped lens were placed on the input image.

CIGlideReflectedTile

A CITileFilter that translates and smears the source image.

CIGloom

A CIFilter that dulls the highlights of the source image.

CIGuidedFilter
CIHardLightBlendMode

The CIHardLightBlendMode CoreImage filter

CIHatchedScreen

A CIScreenFilter that filters via a hatched halftone pattern.

CIHeightFieldFromMask

Creates a continuous height field from a grayscale mask. Use with CIShadedMaterial to create realistic dropshadows.

CIHexagonalPixellate

Pixellates the image with hexagonals based on the average color of pixels within the hexagon.

CIHighlightShadowAdjust

The CIHighlightShadowAdjust CoreImage filter

CIHistogramDisplayFilter

Renders a one-dimensional Image histogram as a typical two-dimensional histogram.

CIHoleDistortion

A CIDistortionFilter that distorts pixels around a circular area.

CIHueAdjust

The CIHueAdjust CoreImage filter

CIHueBlendMode

The CIHueBlendMode CoreImage filter

CIHueSaturationValueGradient

Creates a gradient specified using HSV.

CIImage

Represents a set of instructions to create an image for use by CoreImage.

CIImageAccumulator

A feedback image processor.

CIImageGenerator

A CIFilter that generates images.

CIImageInitializationOptions

Options that can be used when initializing a new CIImage.

CIImageInitializationOptionsWithMetadata

A type of CIImageInitializationOptions that has additional metadata properties.

CIImageProcessorInput_Extensions

Contains an extension method for getting the surface from a ICIImageProcessorInput.

CIImageProcessorKernel

Base class for image-processing classes whose processing can be inserted into the CoreImage processing pipeline.

CIImageProcessorOutput_Extensions

Contains an extension method for getting the surface from a ICIImageProcessorOutput.

CIImageProviderOptions

Options used in various calls to CIImage involving ICIImageProvider objects.

CIImageRepresentationOptions
CIKaleidoscope

Produces a kaleidoscopic, 12-way-symmetrical, image.

CIKernel

A kernel for filters that use custom GPU steps.

CILabDeltaE
CILanczosScaleTransform

A scaling transform that uses Lanczos resampling.

CILenticularHaloGenerator

Creates an artificial lens-flare.

CILightenBlendMode

The CILightenBlendMode CoreImage filter

CILightTunnel

A CIFilter that creates a spiraling effect.

CILinearBlur
CILinearBurnBlendMode

Darkens the image based on the colors of the background image.

CILinearDodgeBlendMode

Darkens the image based on the colors of the background image.

CILinearGradient

A gradient that fades one color linearly into another.

CILinearToSRGBToneCurve

A filter that maps color intensity from a linear gamma curve to the sRGB color space.

CILineOverlay

Produces a black-and-white sketch-like image via edge detection.

CILineScreen

A CIScreenFilter that simulates a halftone made of lines.

CILuminosityBlendMode

The CILuminosityBlendMode CoreImage filter

CIMaskedVariableBlur

A CIFilter that blurs based on a black-and-white mask.

CIMaskToAlpha

A CIFilter that converts a grayscale image to an alpha mask.

CIMaximumComponent

A CIFilter that creates a grayscale image from the maximum value of the RGB color values.

CIMaximumCompositing

The CIMaximumCompositing CoreImage filter

CIMedianFilter

Replaces pixel values with the median of neighboring pixel values, thus reducing noise in the input image.

CIMeshGenerator
CIMinimumComponent

A CIFilter that creates a grayscale image from the minimum component of the RGB values.

CIMinimumCompositing

The CIMinimumCompositing CoreImage filter

CIMix
CIModTransition

A CITransitionFilter that reveals the background image via a series of irregularly shaped holes.

CIMorphology
CIMorphologyGradient
CIMorphologyMaximum
CIMorphologyMinimum
CIMotionBlur

Applies a blur that simulates the motion of a camera during capture.

CIMultiplyBlendMode

The CIMultiplyBlendMode CoreImage filter

CIMultiplyCompositing

The CIMultiplyCompositing CoreImage filter

CINinePartStretched
CINinePartTiled
CINoiseReduction

Reduces noise by detecting luminance variations. Small luminance variations are locally blurred, large variations are locally sharpened.

CIOpTile

Creates an 'op art' effect by tiling, scaling, and rotating regions of the image.

CIOverlayBlendMode

The CIOverlayBlendMode CoreImage filter

CIPageCurlTransition

Animates a page curl transition between images.

CIPageCurlWithShadowTransition

Animates a page curl transition, with a shadow, between images.

CIParallelogramTile

Warps an image into a parallelogram and then tiles the result.

CIPdf417BarcodeGenerator

Generator for 2-dimensional PDF417 bar codes.

CIPdf417CodeDescriptor

A CIBarcodeDescriptor for the CIPDF417 barcode scheme.

CIPerspectiveCorrection

A CIPerspectiveTransform that is cropped according to the perspective control points, but whose pixels are not transformed.

CIPerspectiveTile

A CIFilter that applies a perspective transform and then tiles the result.

CIPerspectiveTransform

A CIFilter that applies a transform the simulates perspective.

CIPerspectiveTransformWithExtent

A filter that alters a portion of the total image based on a perspective transform.

CIPhotoEffect

The base class for photo effect filters.

CIPhotoEffectChrome

A filter that exaggerates color of the image producing a vintage look.

CIPhotoEffectFade

A filter that reduces color of the image producing a vintage look.

CIPhotoEffectInstant

A filter that that distorts colors in a style reminiscent of instant film.

CIPhotoEffectMono

A filter that produces a low-contrast black-and-white image.

CIPhotoEffectNoir

A filter that produces a high-contrast black-and-white image.

CIPhotoEffectProcess

A filter that produces a vintage look with exagerrated cool colors.

CIPhotoEffectTonal

A filter that produces a black-and-white image with minimal contrast changes.

CIPhotoEffectTransfer

A filter that produces a vintage look with exagerrated warm colors.

CIPinchDistortion

A CIDistortionFilter that pinches pixels towards a rectangular area.

CIPinLightBlendMode

Replaces image colors with the bright colors from the background image.

CIPixellate

A CIFilter that pixelates the original image.

CIPlugIn
CIPointillize

Creates an effect mimicking artistic pointillization.

CIQRCodeDescriptor

A CIBarcodeDescriptor for QR codes.

CIQRCodeFeature

A detected QR code.

CIQRCodeGenerator

Generates a QR code.

CIRadialGradient

Generates a gradient between two colors as if reflected on a sphere.

CIRandomGenerator

A CIFilter whose pixels are randomly colored.

CIRawFilterOptions

Settings for use with CreateRawFilter(CVPixelBuffer, NSDictionary, NSDictionary).

CIRectangleFeature

A CIFeature an image space rectange that contains a detected physical rectangle.

CIReductionFilter
CIRenderDestination
CIRenderInfo

Holds information about a render pass, including timing information and number of pixels processed.

CIRenderTask
CIRippleTransition

Animates a ripple transition between images.

CIRowAverage

Returns a 1-pixel-high image, the pixels of which are the average color for the corresponding row in the input image.

CISaliencyMapFilter
CISampleNearest
CISampler

Samples images for processing by a CISampler.

CISamplerOptions

Options to conrol sampler operations for CISampler objects.

CISaturationBlendMode

The CISaturationBlendMode CoreImage filter

CIScreenBlendMode

The CIScreenBlendMode CoreImage filter

CIScreenFilter

A CIFilter that mimics halftone screens.

CISepiaTone

The CISepiaTone CoreImage filter

CIShadedMaterial

Produces a shaded image from a height field, such as that produced by CIHeightFieldFromMask.

CISharpenLuminance

A CIFilter that sharpens the image.

CISixfoldReflectedTile

A CITileFilter that applies 6-way reflected symmetry.

CISixfoldRotatedTile

A CITileFilter that rotates the image in 60-degree increments.

CISmoothLinearGradient

A filter that produces a gradient along a linear axis between two endpoints.

CISoftLightBlendMode

The CISoftLightBlendMode CoreImage filter

CISourceAtopCompositing

The CISourceAtopCompositing CoreImage filter

CISourceInCompositing

The CISourceInCompositing CoreImage filter

CISourceOutCompositing

The CISourceOutCompositing CoreImage filter

CISourceOverCompositing

The CISourceOverCompositing CoreImage filter

CISpotColor

Replaces color ranges with specified replacement colors.

CISpotLight

Produces an effect mimicking that of a directional spotlight.

CISRGBToneCurveToLinear

A filter that adjusts tone response in sRGB color space and then maps it to a linear gamma curve.

CIStarShineGenerator

A CIFilter that simulates lens flare.

CIStraightenFilter

The CIStraightenFilter CoreImage filter

CIStretchCrop

Stretches and crops an image.

CIStripesGenerator

Generates hard-edged strips of alternating colors.

CISubtractBlendMode

Subtracts the background image pixels from those in the Image.

CISunbeamsGenerator

Creates an artificial sun and light-ray effect.

CISwipeTransition

A CITransitionFilter that swipes from one image to the other.

CITemperatureAndTint

The CITemperatureAndTint CoreImage filter

CITextFeature

A detected text feature.

CITextImageGenerator

A CIImageGenerator that generates an image from text.

CIThermal
CITileFilter

A CIFilter that applies a filter and then tiles the results.

CIToneCurve

The CIToneCurve CoreImage filter

CITorusLensDistortion

Produces an effect as if a toroidal lens were placed on the input image.

CITransitionFilter

A CITransitionFilter that animates a transition between two images.

CITriangleKaleidoscope

A CIFilter that creates a kaleidoscopic effect.

CITriangleTile

Tiles the image with a triangular region of the input image.

CITwelvefoldReflectedTile

A CITileFilter that applies 12-way reflected symmetry.

CITwirlDistortion

A CIDistortionFilter that rotates pixels around a point.

CIUIParameterSet

Contains options for core image filter user interfaces.

CIUnsharpMask

A CIFilter that increases the contrast of edges in the image.

CIVector

A vector for use with Core Image objects such as CIFilter.

CIVibrance

The CIVibrance CoreImage filter

CIVignette

The CIVignette CoreImage filter

CIVignetteEffect

A filter that modifies the brightness of the outside of an image.

CIVortexDistortion

A CIDistortionFilter that creates a tight spiraling distortion suggestive of a vortex.

CIWarpKernel

A kernel for GPU transforms that operate only on geometry.

CIWhitePointAdjust

The CIWhitePointAdjust CoreImage filter

CIXRay
CIZoomBlur

Applies a blur that simulates a camera zoom during capture.

Interfaces

ICIFilterConstructor

Interface for classes that create named filters.

ICIImageProcessorInput

The input to a CIImageProcessorKernel.

ICIImageProcessorOutput

The output of a CIImageProcessorKernel.

ICIImageProvider

Interface defining an image provider.

Enums

CIDataMatrixCodeEccVersion

Enumerates the ECC versions for the Data Matrix barcode scheme.

CIFilterMode

Enumerates filter modes.

CIFormat

An enumeration whose values specify pixel formats.

CIImageOrientation

An enumeration whose values specify the origin of the CIImage.

CIQRCodeErrorCorrectionLevel

Enumerates the error correction levels for QR codes.

CIRenderDestinationAlphaMode
CIWrapMode

Enumerates values that control how samples from outside the source image are treated.

FaceDetectorAccuracy

An enumeration whose values specify the accuracy of face detection.

Delegates

CIKernelRoiCallback

Completion handler for deterimining a region of interest in the source image.

Remarks

CoreImage provides a framework for processing still images and applying a set of operations on them to either produce new images or perform image analysis (like performing face detection and photography auto-enhance). The operations are hardware accelerated and provide better performance than most hand written implementations.

CoreImage can apply either one filter to an image or you can use the built-in chaining support to apply a series of filters at once to an image. For example, you could apply a Sepia Filter, followed by a Hue adjustment filter, followed by a contrast filter. The idea behind the chaining support is to avoid intermediate copies and intermediate buffers during image processing. Additionally, some of these filtering operations can be performed entirely on the GPU in a single pass, without having to copy data back and forth from the GPU to the main memory.

The CoreImage runtime sits below the N:CoreGraphics, CoreVideo and N:ImageIO stacks and provides services to all of them. Depending on the filter operations and the hardware platform, CoreImage will execute the filters in the CPU or the GPU.

To use CoreImage on iOS, you follow these steps:

  • Create a CIImage object. You can create these from multiple sources: CoreGraphics images, bitmap data, images on disk or CoreVideo image buffers. CIImage objects are immutable and represent recipes, that is, they will be computed on demand.

    :

  • Create and configure a CIFilter object. This object combines image inputs or numeric input parameters to configure the effects of the filter. The configuration is done by setting various properties using the object indexer to any of the values documented in the

    :

  • Create a CIContext object to track the processing pipeline. This is the object trough which CoreImage draws and it can be CPU or GPU bound.

    :

  • Render the filter output into a target image using one of the CIContext methods. :
// This sample turns the image into a sepia image

// Load the image using UIImage, it is convenient
var uiimage = UIImage.FromFile ("sample.jpg");

// Create the CIImage, using the UIImage's CGImage as a reference
var image = new CIImage (uiimage.CGImage);

// Create the filter
var sepia = new CISepiaTone () {
	Image = image,
	Intensity = .8f
};

// Generate the recipe.   It is important to note that at this point
// the resulting CIImage merely contains the recipe on how to create
// the image, this is important, because you can use this result as
// the input to another filter to chain filters together and only 
// at the last minute, when the CIContext rendering APIs are used,
// does the actual pipeline execute.   This allows for a series of
// operations to all be performed in one step without intermediate
// buffer copies.
CIImage output = sepia.OutputImage;

// To render the results, we need to create a context, and then
// use one of the context rendering APIs, in this case, we render the
// result into a CoreGraphics image, which is merely a useful representation
//
var context = CIContext.FromOptions (null);

var cgimage = context.CreateCGImage (output, output.Extent);

// The above cgimage can be added to a screen view, for example, this
// would add it to a UIImageView on the screen:
myImageView.Image = UIImage.FromImage (cgimage);

Face detection is done with the CIDetector class by calling the M:CoreImage.CIDetector.CreateFaceDetector(CoreImage.CIContext,bool) method which returns an array of CIFeature objects with any detected face features found.

Auto-adjustments are implemented by calling the GetAutoAdjustmentFilters() method. This method returns a list of suggested CIFilter which you in turn would apply to your image and render to a context.

To chain filters, all you have to do is connect the OutputImage property from a filter to the Image property of another filter. This is a modified version of the previous example showing how to chain two filters together:

var uiimage = UIImage.FromFile ("sample.jpg");
var image = new CIImage (uiimage.CGImage);

var sepia = new CISepiaTone () {
	Image = image,
	Intensity = .8f
};

// Chain the Sepia filter to a Color inversion filter, this is done
// by assigning the CIColorInvert.Input to the sepia.OutputImage
var invert = new CIColorInvert () {
	Image = sepia.OutputImage;
}

CIImage output = invert.OutputImage;
var context = CIContext.FromOptions (null);
var cgimage = context.CreateCGImage (output, output.Extent);

myImageView.Image = UIImage.FromImage (cgimage);