Class

MPSImageConvolution

A filter that convolves an image with a given kernel of odd width and height.

Declaration

@interface MPSImageConvolution : MPSUnaryImageKernel

Overview

Filter width and height can be either 3, 5, 7 or 9. If there are multiple channels in the source image, each channel is processed independently.

A separable convolution filter may perform better when done in two passes. . A convolution filter is separable if the ratio of filter values between all rows is constant over the whole row. For example, this edge detection filter:

Can instead be separated into the product of two vectors, like so:

And consequently can be done as two, one-dimensional convolution passes back to back on the same image. In this way, the number of multiplies (ignoring the fact that we could skip zeros here) is reduced from 3*3=9 to 3+3=6. There are similar savings for addition. For large filters, the savings can be profound.

Topics

Methods

Properties

kernelHeight

The height of the filter window. Must be an odd number.

kernelWidth

The width of the filter window. Must be an odd number.

bias

The value added to a convolved pixel before it is converted back to its intended storage format.

Relationships

Inherits From

See Also

Convolution Image Filters

MPSImageMedian

A filter that applies a median filter in a square region centered around each pixel in the source image.

MPSImageBox

A filter that convolves an image with a given kernel of odd width and height.

MPSImageTent

A filter that convolves an image with a tent filter.

MPSImageGaussianBlur

A filter that convolves an image with a Gaussian blur of a given sigma in both the x and y directions.

MPSImageGaussianPyramid

A filter that convolves an image with a Gaussian pyramid.

MPSImageSobel

A filter that convolves an image with the Sobel operator.

MPSImageLaplacian

An optimized Laplacian filter, provided for ease of use.

MPSImageLaplacianPyramid

A filter that convolves an image with a Laplacian filter.

MPSImageLaplacianPyramidAdd

A filter that convolves an image with an additive Laplacian pyramid.

MPSImageLaplacianPyramidSubtract

A filter that convolves an image with a subtractive Laplacian pyramid.

MPSImagePyramid

A base class for creating different kinds of pyramid images.