---
title: "applyPolynomial(coefficientSegments:boundaries:destination:)"
framework: accelerate
role: symbol
role_heading: Instance Method
path: "accelerate/vimage/pixelbuffer/applypolynomial(coefficientsegments:boundaries:destination:)-4r6nf"
---

# applyPolynomial(coefficientSegments:boundaries:destination:)

Applies a set of piecewise polynomials to a 3-channel, 32-bit interleaved buffer and writes the result to a 3-channel, 8-bit interleaved buffer.

## Declaration

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

## 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

Discussion The following code shows an example of applying three polynomials to a vImage.InterleavedFx3 buffer: let src = vImage.PixelBuffer<vImage.InterleavedFx3>(     pixelValues: [0.25, 0.5, 0.75],     size: vImage.Size(width: 1, height: 1))

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

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

// Prints: //  255     ≅ factor * 0.25⁰

//  127     ≅ factor * 0.5¹

//  143     ≅ factor * 0.75² print(dest.array)

## See Also

### Related Documentation

- [Applying tone curve adjustments to images](accelerate/applying-tone-curve-adjustments-to-images.md)

### Appying polynomial (32-bit source, 8-bit destination)

- [applyPolynomial(coefficientSegments:boundaries:destination:)](accelerate/vimage/pixelbuffer/applypolynomial(coefficientsegments:boundaries:destination:)-3b0d0.md)
- [applyPolynomial(coefficientSegments:boundaries:destination:)](accelerate/vimage/pixelbuffer/applypolynomial(coefficientsegments:boundaries:destination:)-6uls3.md)
- [applyPolynomial(coefficientSegments:boundaries:destination:)](accelerate/vimage/pixelbuffer/applypolynomial(coefficientsegments:boundaries:destination:)-1b2nu.md)
