CoreImage.CIConvolution3X3 Class
A filter that performs a custom 3x3 matrix convolution.

See Also: CIConvolution3X3 Members


[ObjCRuntime.iOS(7, 0)]
[ObjCRuntime.Mac(10, 9, false)]
public class CIConvolution3X3 : CIConvolutionCore


The following example shows this filter in use

C# Example

// Create the CIImage from a file
CIImage heron = CIImage.FromCGImage (UIImage.FromFile ("heron.jpg").CGImage);

// Create a CIConvolution3X3 filter with the input image
var convolution_3X3 = new CIConvolution3X3 () {
	Image = heron,
	Weights = new CIVector (new float [] {
		0, -1, 0,
		-1, 5, -1,
		0, -1, 0}),
	Bias = 0,

// Get the altered image from the filter
var output = convolution_3X3.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);

With the following image input:

Produces the following output:

"canon" © 2012 cuatrok77 hernandez, used under a Creative Commons Attribution-ShareAlike license:


Namespace: CoreImage
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: