<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.3.0 -",
    "tvOS: 5.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vImageHistogramCalculation_Planar8(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@vImageHistogramCalculation_Planar8"
  },
  "title" : "vImageHistogramCalculation_Planar8(_:_:_:)"
}
-->

# vImageHistogramCalculation_Planar8(_:_:_:)

Calculates the histogram of an 8-bit planar buffer.

```
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 [`kvImageDoNotTile`](/documentation/Accelerate/kvImageDoNotTile); otherwise, pass [`kvImageNoFlags`](/documentation/Accelerate/kvImageNoFlags).

## Return Value

[`kvImageNoError`](/documentation/Accelerate/kvImageNoError); otherwise, one of the error codes in <doc://com.apple.documentation/documentation/Accelerate/data-types-and-constants>.

## Discussion

The following code populates the `histogram` array with the histogram of the specified [`vImage_Buffer`](/documentation/Accelerate/vImage_Buffer) structure.

```swift
var histogram = [vImagePixelCount](repeating: 0, count: 256)

// `buffer` is a `vImage_Buffer` structure.
_ = vImageHistogramCalculation_Planar8(&buffer,
                                       &histogram,
                                       vImage_Flags(kvImageNoFlags))
```

## See Also

  <doc://com.apple.accelerate/documentation/Accelerate/enhancing-image-contrast-with-histogram-manipulation>

  <doc://com.apple.accelerate/documentation/Accelerate/specifying-histograms-with-vimage>



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)