---
title: "vImageHistogramCalculation_Planar8(_:_:_:)"
framework: accelerate
role: symbol
role_heading: Function
path: "accelerate/vimagehistogramcalculation_planar8(_:_:_:)"
---

# vImageHistogramCalculation_Planar8(_:_:_:)

Calculates the histogram of an 8-bit planar buffer.

## Declaration

```swift
func vImageHistogramCalculation_Planar8(_ src: UnsafePointer<vImage_Buffer>, _ histogram: UnsafeMutablePointer<vImagePixelCount>, _ flags: vImage_Flags) -> vImage_Error
```

## Parameters

- `src`: The source vImage buffer.
- `histogram`: The collection that contains 256 elements that receives the histogram data.
- `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.

## Return Value

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

## Discussion

Discussion The following code populates the histogram array with the histogram of the specified vImage_Buffer structure. var histogram = [vImagePixelCount](repeating: 0, count: 256)

// `buffer` is a `vImage_Buffer` structure. _ = vImageHistogramCalculation_Planar8(&buffer,                                        &histogram,                                        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_PlanarF(_:_:_:_:_:_:)](accelerate/vimagehistogramcalculation_planarf(_:_:_:_:_:_:).md)
- [vImageHistogramCalculation_ARGB8888(_:_:_:)](accelerate/vimagehistogramcalculation_argb8888(_:_:_:).md)
- [vImageHistogramCalculation_ARGBFFFF(_:_:_:_:_:_:)](accelerate/vimagehistogramcalculation_argbffff(_:_:_:_:_:_:).md)
