---
title: "vImageHistogramCalculation_ARGBFFFF(_:_:_:_:_:_:)"
framework: accelerate
role: symbol
role_heading: Function
path: "accelerate/vimagehistogramcalculation_argbffff(_:_:_:_:_:_:)"
---

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

Calculates the histogram of a 32-bit-per-channel, 4-channel interleaved buffer.

## Declaration

```swift
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`: The source vImage buffer.
- `histogram`: An array of four collections that contain histogram_entries elements that receive 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 doc://com.apple.accelerate/documentation/Accelerate/kvImageDoNotTile; otherwise, pass doc://com.apple.accelerate/documentation/Accelerate/kvImageNoFlags. To specify that the function doesn’t calculate the alpha channel histogram, set the doc://com.apple.accelerate/documentation/Accelerate/kvImageLeaveAlphaUnchanged flag.

## Return Value

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

## Discussion

Discussion The following code populates the histogramAlpha , histogramRed, histogramGreen, and histogramBlue arrays with the histograms for each channel of the specified vImage_Buffer structure. let entryCount = 64 var histogramAlpha = [vImagePixelCount](repeating: 0, count: entryCount) var histogramRed = [vImagePixelCount](repeating: 0, count: entryCount) var histogramGreen = [vImagePixelCount](repeating: 0, count: entryCount) var histogramBlue = [vImagePixelCount](repeating: 0, count: entryCount)

histogramAlpha.withUnsafeMutableBufferPointer { zeroPtr in     histogramRed.withUnsafeMutableBufferPointer { onePtr in         histogramGreen.withUnsafeMutableBufferPointer { twoPtr in             histogramBlue.withUnsafeMutableBufferPointer { threePtr in                                  var histogramBins = [zeroPtr.baseAddress, onePtr.baseAddress,                                      twoPtr.baseAddress, threePtr.baseAddress]                                  histogramBins.withUnsafeMutableBufferPointer { histogramBinsPtr in                     // `buffer` is a `vImage_Buffer` structure.                     _ = vImageHistogramCalculation_ARGBFFFF(&buffer,                                                             histogramBinsPtr.baseAddress!,                                                             UInt32(entryCount),                                                             0, 1,                                                             vImage_Flags(kvImageNoFlags))                 }             }         }     } }

## See Also

### Related Documentation

- [Enhancing image contrast with histogram manipulation](accelerate/enhancing-image-contrast-with-histogram-manipulation.md)
- [Specifying histograms with vImage](accelerate/specifying-histograms-with-vimage.md)

### Calculating a histogram

- [vImageHistogramCalculation_Planar8(_:_:_:)](accelerate/vimagehistogramcalculation_planar8(_:_:_:).md)
- [vImageHistogramCalculation_PlanarF(_:_:_:_:_:_:)](accelerate/vimagehistogramcalculation_planarf(_:_:_:_:_:_:).md)
- [vImageHistogramCalculation_ARGB8888(_:_:_:)](accelerate/vimagehistogramcalculation_argb8888(_:_:_:).md)
