<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vImage/PixelBuffer/applyPolynomial(coefficientSegments:boundaries:destination:)-7sy2t",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate6vImageO11PixelBufferVAaC7Planar8VRszrlE15applyPolynomial19coefficientSegments10boundaries11destinationySaySaySfGG_AlEy_AC7PlanarFVGtF"
  },
  "title" : "applyPolynomial(coefficientSegments:boundaries:destination:)"
}
-->

# applyPolynomial(coefficientSegments:boundaries:destination:)

Applies a set of piecewise polynomials to an 8-bit planar buffer and writes the result to a 32-bit planar buffer.

```
func applyPolynomial(coefficientSegments: [[Float]], boundaries: [Float], destination: vImage.PixelBuffer<vImage.PlanarF>)
```

## Parameters

`coefficientSegments`

An array that contains the polynomial coefficient array. Each polynomial must be of the same order.

`boundaries`

An array of boundary values, in increasing order, that separates adjacent ranges of pixel values. `boundaries` must contain `coefficientSegments.count + 1` elements.

`destination`

The destination pixel buffer.

## Discussion

The following code shows an example of applying three polynomials to a [`vImage.Planar8`](/documentation/Accelerate/vImage/Planar8) buffer:

```swift
let src = vImage.PixelBuffer<vImage.Planar8>(
    pixelValues: [32, 64, 128, 192, 255],
    size: vImage.Size(width: 5, height: 1))

let dest = vImage.PixelBuffer<vImage.PlanarF>(
    size: src.size)

src.applyPolynomial(coefficientSegments: [ [1, 1, 0],
                                           [0, 1, 0],
                                           [0, 0, 1] ],
                    boundaries: [0, 1/3, 2/3, 1] as [Float],
                    destination: dest)

// Prints:
//  1.0         ≅ 1 * (32 / 255)⁰
//  1.0         ≅ 1 * (64 / 255)⁰

//  0.5019608   ≅ 1 * (128 / 255)¹

//  0.56692046  ≅ 1 * (192 / 255)²
//  1.0         ≅ 1 * (255 / 255)²
print(dest.array)
```

## See Also

  <doc://com.apple.accelerate/documentation/Accelerate/applying-tone-curve-adjustments-to-images>



---

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)