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

# applyPolynomial(coefficientSegments:boundaries:destination:)

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

## Declaration

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

## 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 an vImage.Interleaved8x3 buffer: let src = vImage.PixelBuffer<vImage.Interleaved8x4>(     pixelValues: [64, 128, 192, 255],     size: vImage.Size(width: 1, height: 1))

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

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

// Prints: //  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

### Related Documentation

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

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

- [applyPolynomial(coefficientSegments:boundaries:destination:)](accelerate/vimage/pixelbuffer/applypolynomial(coefficientsegments:boundaries:destination:)-7sy2t.md)
- [applyPolynomial(coefficientSegments:boundaries:destination:)](accelerate/vimage/pixelbuffer/applypolynomial(coefficientsegments:boundaries:destination:)-3sxxv.md)
- [applyPolynomial(coefficientSegments:boundaries:destination:)](accelerate/vimage/pixelbuffer/applypolynomial(coefficientsegments:boundaries:destination:)-4o5ju.md)
