Contents

vImageCreateGammaFunction(_:_:_:)

Returns a gamma function object.

Declaration

func vImageCreateGammaFunction(_ gamma: Float, _ gamma_type: Int32, _ flags: vImage_Flags) -> GammaFunction!

Parameters

Return Value

A gamma function object that encapsulates a gamma value, a gamma function type, and option flags.

Discussion

Use this function to create a gamma function object that you pass to vImageGamma_Planar8toPlanarF(_:_:_:_:), vImageGamma_PlanarFtoPlanar8(_:_:_:_:), or vImageGamma_PlanarF(_:_:_:_:).

The vImage library provides a user-defined half-precision gamma type and constant half-precision gamma types, such as kvImageGamma_sRGB_forward_half_precision. Use a half-precision gamma type when creating a gamma function for image data that’s intended for conversion to 8-bit. The half-precision gamma types work with floating-point values in the range 0...1 and provide a precision of ±1 / 4,096.

The gamma correction functions that use a GammaFunction object are symmetric around zero. That is, they treat negative values as if they’re positive, and restore the sign after applying the exponent.

See Also

Applying a gamma function