Applies a piecewise gamma function to a Planar8 image.


func vImagePiecewiseGamma_Planar8(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ exponentialCoeffs: UnsafePointer<Float>, _ gamma: Float, _ linearCoeffs: UnsafePointer<Float>, _ boundary: Pixel_8, _ flags: vImage_Flags) -> vImage_Error



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.


An array of three floating-point coefficients for the gamma curve.


The exponent of a power function for calculating gamma correction.


An array of two floating-point coefficients for the linear curve.


The boundary value for switching from linear to gamma curve.


The options to use when performing the operation. If you plan to perform your own tiling or use multithreading, pass kvImageDoNotTile.

Return Value

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


The piecewise gamma calculation combines a linear and an exponential (gamma) curve on two regions of the input interval, separated by a specified boundary value. When the input is greater than or equal to the boundary value, the gamma curve is used to generate the output. Otherwise, the linear curve is used.

For each pixel, given that x is the value of the source pixel, the operation can be described as:

if x < boundary:    
    r = linearCoeffs[0]*x + linearCoeffs[1]
    t = exponentialCoeffs[0]*x + exponentialCoeffs[1]    
    r = pow(t, gamma) + exponentialCoeffs[2]
output pixel value = r

See Also

Correcting Gamma

func vImageDestroyGammaFunction(GammaFunction!)

Destroys a gamma function object created.