Class

MPSImageSobel

A filter that convolves an image with the Sobel operator.

Overview

When the color model (e.g. RGB, two-channel, grayscale, etc.) of the source and destination textures match, the filter is applied to each color channel separately. If the destination is single-channel (i.e. monochrome) but the source is multi-channel, the pixel values are converted to grayscale before applying the Sobel operator by using the linear gray color transform vector v shown in Listing 1.

Listing 1

Grayscale conversion function

Luminance = v[0] * pixel.x + v[1] * pixel.y + v[2] * pixel.z

Symbols

Methods

init(device: MTLDevice)

Initializes a Sobel filter on a given device using the default color transform.

init(device: MTLDevice, linearGrayColorTransform: UnsafePointer<Float>)

Initializes a Sobel filter on a given device using a specific color transform.

Properties

var colorTransform: UnsafePointer<Float>

The color transform used to initialize the Sobel filter.

Relationships

Inherits From