A filter that equalizes the histogram of an image.
- iOS 9.0+
- macOS 10.13+
- Mac Catalyst 13.0+
- tvOS 9.0+
- Metal Performance Shaders
The process is divided into three steps:
init(device:method to create a
encodemethod. 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
Transform(to: source Texture: histogram: histogram Offset:)
histogramargument specifies the histogram buffer which contains the histogram values for the source texture. The
sourceargument 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
encode(commandmethod 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.
Buffer: source Texture: destination Texture:)