---
title: MPSImageSobel
framework: metalperformanceshaders
role: symbol
role_heading: Class
path: metalperformanceshaders/mpsimagesobel
---

# MPSImageSobel

A filter that convolves an image with the Sobel operator.

## Declaration

```swift
class MPSImageSobel
```

## Overview

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 the code listing below. Luminance = v[0] * pixel.x + v[1] * pixel.y + v[2] * pixel.z

## Topics

### Initializers

- [init(coder:device:)](metalperformanceshaders/mpsimagesobel/init(coder:device:).md)

### Methods

- [init(device:)](metalperformanceshaders/mpsimagesobel/init(device:).md)
- [init(device:linearGrayColorTransform:)](metalperformanceshaders/mpsimagesobel/init(device:lineargraycolortransform:).md)

### Properties

- [colorTransform](metalperformanceshaders/mpsimagesobel/colortransform.md)

## Relationships

### Inherits From

- [MPSUnaryImageKernel](metalperformanceshaders/mpsunaryimagekernel.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Convolution Image Filters

- [MPSImageConvolution](metalperformanceshaders/mpsimageconvolution.md)
- [MPSImageMedian](metalperformanceshaders/mpsimagemedian.md)
- [MPSImageBox](metalperformanceshaders/mpsimagebox.md)
- [MPSImageTent](metalperformanceshaders/mpsimagetent.md)
- [MPSImageGaussianBlur](metalperformanceshaders/mpsimagegaussianblur.md)
- [MPSImageGaussianPyramid](metalperformanceshaders/mpsimagegaussianpyramid.md)
- [MPSImageLaplacian](metalperformanceshaders/mpsimagelaplacian.md)
- [MPSImageLaplacianPyramid](metalperformanceshaders/mpsimagelaplacianpyramid.md)
- [MPSImageLaplacianPyramidAdd](metalperformanceshaders/mpsimagelaplacianpyramidadd.md)
- [MPSImageLaplacianPyramidSubtract](metalperformanceshaders/mpsimagelaplacianpyramidsubtract.md)
- [MPSImagePyramid](metalperformanceshaders/mpsimagepyramid.md)
