Function

vImageHistogramCalculation_ARGBFFFF(_:_:_:_:_:_:)

Calculates histograms for each channel of an ARGBFFFF image.

Declaration

func vImageHistogramCalculation_ARGBFFFF(_ src: UnsafePointer<vImage_Buffer>, _ histogram: UnsafeMutablePointer<UnsafeMutablePointer<vImagePixelCount>?>, _ histogram_entries: UInt32, _ minVal: Pixel_F, _ maxVal: Pixel_F, _ flags: vImage_Flags) -> vImage_Error

Parameters

src

A pointer to a vImage buffer structure that contains the source image.

histogram

A pointer to an array of four histograms, one each for alpha, red, green, and blue (in that order). On return, this array will contain the four histograms for the corresponding channels. Each of the four histograms will be an array with histogram_entries elements.

histogram_entries

The number of histogram entries, or “bins.” Each of the four calculated histograms will be an array with histogram_entries elements.

minVal

A minimum pixel value. Any pixel value less than this will be clipped to this value (for the purposes of histogram calculation), and assigned to the first histogram entry. This minimum value is applied to each of the four channels separately.

maxVal

A maximum pixel value. Any pixel value greater than this will be clipped to this value (for the purposes of histogram calculation), and assigned to the last histogram entry. This maximum value is applied to each of the four channels separately.

flags

The options to use. Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

Return Value

kvImageNoError; otherwise, one of the error codes described in Data Types and Constants.

Discussion

The function calculates the histogram for each channel completely separately from the others. However, size and range values are the same for each of the four histograms.