Function

vImageInterpolatedLookupTable_PlanarF(_:_:_:_:_:_:_:)

Uses a lookup table to transform an image in PlanarF format.

Declaration

func vImageInterpolatedLookupTable_PlanarF(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ table: UnsafePointer<Pixel_F>, _ tableEntries: vImagePixelCount, _ maxFloat: Float, _ minFloat: Float, _ flags: vImage_Flags) -> vImage_Error

Parameters

src

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

dest

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

table

A lookup table of floating-point values.

tableEntries

A value of type vImagePixelCount, giving the number of values in the array.

maxFloat

A value of type float.

minFloat

A value of type float.

flags

The options to use when performing the transformation. Pass kvImageDoNotTile if you plan to perform your own tiling or use multithreading.

Return Value

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

Discussion

It will work in place. The table contains an arbitrary number of values; it is entered with an index interpolated from a value from the source image, to look up a floating-point value for the destination image.

The input pixel is first clipped to the range minFloat ... maxFloat. The result is then calculated as

    float clippedPixel =MAX(MIN(src_pixel, maxFloat), minFloat);
    float fIndex =  (float) (tableEntries - 1) * (clippedPixel -  minFloat)
                    / (maxFloat - minFloat);
    float fract = fIndex - floor(fIndex);
    unsigned long i = fIndex;
    float result = table[i] * (1.0f - fract) + table[i + 1] * fract;

See Also

Transforming with a Lookup Table

func vImageLookupTable_8to64U(UnsafePointer<vImage_Buffer>, UnsafePointer<vImage_Buffer>, UnsafePointer<UInt64>, vImage_Flags) -> vImage_Error

Uses a lookup table to remap 8-bit unsigned integers in a source image to 64-bit unsigned values.