Contents

vImageLookupTable_Planar8toPlanarF(_:_:_:_:)

Uses a lookup table to transform an 8-bit planar image to a 32-bit planar image.

Declaration

func vImageLookupTable_Planar8toPlanarF(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ table: UnsafePointer<Pixel_F>, _ flags: vImage_Flags) -> vImage_Error

Parameters

  • src:

    The source vImage buffer.

  • dest:

    A pointer to the destination vImage buffer 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, deallocate the memory to prevent memory leaks.

  • table:

    A lookup table that contains 256 Pixel_f values.

  • flags:

    The options to use when performing the operation. If your code implements its own tiling or its own multithreading, pass Kvimagedonottile; otherwise, pass Kvimagenoflags.

Return Value

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

Discussion

For each pixel, this function uses the 8-bit value from the source image as an index to the 32-bit value from the table. The per-pixel conversion calculation is equivalent to the following:

float table[256];
float result_pixel = table[ input_8_bit_pixel ];

You can use this function with multichannel data by scaling the width of the image to compensate for the additional channels. In this case, all channels use the same lookup table.

This function doesn’t work in place.

See Also

Transforming planar-to-planar with a lookup table