Applies a set of piecewise polynomials to transform an image in PlanarF format to an image in Planar8 format.


vImage_Error vImagePiecewisePolynomial_PlanarFtoPlanar8(const vImage_Buffer *src, const vImage_Buffer *dest, const float **coefficients, const float *boundaries, uint32_t order, uint32_t log2segments, vImage_Flags flags);



A pointer to a vImage buffer structure that contains the source image.


A pointer to a vImage buffer data structure. You're responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer this structure points to contains the destination image data. When you no longer need the data buffer, you must deallocate the memory


A pointer to an array of polynomial coefficient arrays. Each polynomial coefficient array contains the coefficients for one polynomial. Note that a polynomial of order R has R+1 coefficients. All the polynomial coefficient arrays must be the same size, R+1, and in each array the coefficients must be ordered from the 0th-order term to the highest-order term.


A pointer to an array of boundary values, in increasing order, for separating adjacent ranges of pixel values. The first boundary value is the lowest in the range; input values lower than this are clipped to this value. The last boundary value is the highest in the range; input values higher than this are clipped to this value. The boundary values between the first and last separate the subranges from each other.


The number of polynomials represented as a base-2 logarithm. If you pass a non-integer power-of-two number of polynomials (for example, 5), you must round up to the next integer power of 2 (for the example of 5, that would be 8), and simply repeat the last polynomial the appropriate number of times.


Reserved for future use; pass 0.

Return Value

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


You can approximate many different correction functions by carefully choosing the polynomials and the ranges of input values they operate on. The number of polynomials must be a non-negative integer power of 2.

Suppose that you want to use N polynomials of order R to process N contiguous ranges of pixel values. For each pixel in the image, the range of usable values is divided into segments by the values passed in the boundaries array. Each segment is processed by the corresponding polynomial. Since there are N polynomials, then there must be N segments, so you must supply N+1 boundaries.

You must order the boundaries by increasing value. The ith segment is the set of pixel values that fall in the range:

    boundary[i] <= value < boundary[i+1]

where i ranges from 0 to N. Values in this segment are processed by the i-th polynomial.

From a performance standpoint, it costs much more to resolve additional polynomials than to work with higher-order polynomials. You typically achieve better performance with one 9th-order polynomial that covers the whole range of values you are interested in than with many lower-order polynomials covering the range piecewise.

This function uses single-precision floating-point arithmetic. As a result, polynomials with large high-order coefficients may cause significant rounding error.

See Also

Applying a Polynomial


Applies a set of piecewise polynomials to an image in PlanarF format.


Applies a set of piecewise polynomials to transform an image in Planar8 format to an image in PlanarF format.


Applies a piecewise rational expression to an image in PlanarF format.


Applies a set of symmetric piecewise polynomials to an image in PlanarF format.