---
title: MPSImageHistogramEqualization
framework: metalperformanceshaders
role: symbol
role_heading: Class
path: metalperformanceshaders/mpsimagehistogramequalization
---

# MPSImageHistogramEqualization

A filter that equalizes the histogram of an image.

## Declaration

```swift
class MPSImageHistogramEqualization
```

## Overview

Overview The process is divided into three steps: Call the init(device:histogramInfo:) method to create a MPSImageHistogramEqualization object. Call the encodeTransform(to:sourceTexture:histogram:histogramOffset:) method. This creates a privately held image transform (i.e. a cumulative distribution function of the histogram) which will be used to equalize the distribution of the histogram of the source image. This process runs on a command buffer when it is committed to a command queue. It must complete before the next step can be run. It may be performed on the same command buffer. The histogram argument specifies the histogram buffer which contains the histogram values for the source texture. The sourceTexture argument is used by the method to determine the number of channels and therefore which histogram data in the histogram buffer to use. The histogram for the source texture must have been computed either on the CPU or using the MPSImageHistogram kernel. Call the encode(commandBuffer:sourceTexture:destinationTexture:) method to read data from the source texture, apply the equalization transform to it, and write to the destination texture. This step is also done on the GPU on a command queue. note: You can reuse the same equalization transform on other images to perform the same transform on those images. (Since their distribution is probably different, they will probably not be equalized by it.) This filter usually will not be able to work in place.

## Topics

### Initializers

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

### Methods

- [init(device:histogramInfo:)](metalperformanceshaders/mpsimagehistogramequalization/init(device:histograminfo:).md)
- [encodeTransform(to:sourceTexture:histogram:histogramOffset:)](metalperformanceshaders/mpsimagehistogramequalization/encodetransform(to:sourcetexture:histogram:histogramoffset:).md)

### Properties

- [histogramInfo](metalperformanceshaders/mpsimagehistogramequalization/histograminfo.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

### Related Documentation

- [Metal Image Filters: Using the image filters provided by the Metal Performance Shaders framework.](apple-archive/samplecode/MetalImageFilters/Introduction/Intro.html.md)

### Histogram Image Filters

- [MPSImageHistogram](metalperformanceshaders/mpsimagehistogram.md)
- [MPSImageHistogramSpecification](metalperformanceshaders/mpsimagehistogramspecification.md)
