Contents

vImageHistogramCalculation_PlanarF(_:_:_:_:_:_:)

Calculates the histogram of a 32-bit planar buffer.

Declaration

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

Parameters

  • src:

    The source vImage buffer.

  • histogram:

    The collection that contains histogram_entries elements that receives the histogram data.

  • histogram_entries:

    The number of histogram entries.

  • minVal:

    The minimum pixel value. The operation assigns pixel values less than minVal to the first histogram entry.

  • maxVal:

    The maximum pixel value. The operation assigns pixel values greater than maxVal to the last histogram entry.

  • flags:

    The options to use when performing the operation. If your code implements its own tiling or its own multithreading, pass Kvimagedonottile; otherwise, pass Kvimagenoflags.

Return Value

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

Discussion

The following code populates the histogram array with the histogram of the specified vImage_Buffer structure.

let entryCount = 64
var histogram = [vImagePixelCount](repeating: 0, count: entryCount)

// `buffer` is a `vImage_Buffer` structure.
_ = vImageHistogramCalculation_PlanarF(&buffer,
                                       &histogram,
                                       UInt32(entryCount),
                                       0, 1,
                                       vImage_Flags(kvImageNoFlags))

See Also

Related Documentation

Calculating a histogram