Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 3/22/2024
Public
Document Table of Contents

LUT_Init

Initializes the LUT specification structure.

Syntax

IppStatus ippiLUT_Init_8u(IppiInterpolationType interpolation, IppChannels channels, IppiSize roiSize, const Ipp32s* pValues[], const Ipp32s* pLevels[], int nLevels[], IppiLUT_Spec* pSpec);

IppStatus ippiLUT_Init_16u(IppiInterpolationType interpolation, IppChannels channels, IppiSize roiSize, const Ipp32s* pValues[], const Ipp32s* pLevels[], int nLevels[], IppiLUT_Spec* pSpec);

IppStatus ippiLUT_Init_16s(IppiInterpolationType interpolation, IppChannels channels, IppiSize roiSize, const Ipp32s* pValues[], const Ipp32s* pLevels[], int nLevels[], IppiLUT_Spec* pSpec);

IppStatus ippiLUT_Init_32f(IppiInterpolationType interpolation, IppChannels channels, IppiSize roiSize, const Ipp32f* pValues[], const Ipp32f* pLevels[], int nLevels[], IppiLUT_Spec* pSpec);

Include Files

ippi.h

Domain Dependencies

Headers: ippcore.h, ippvm.h, ipps.h

Libraries: ippcore.lib, ippvm.lib, ipps.lib

Parameters

interpolation

Interpolation algorithm, possible values are:

ippNearest

Nearest neighbor interpolation.

ippCubic

Cubic interpolation.

ippLinear

Linear interpolation.

channels

Number of channels in the image. Possible values are: ippC1, ippC3, ippC4, or ippAC4.

roiSize

Size, in pixels, of the destination ROI.

pValues

Pointer to the array with intensity values, separate for each channel.

pLevels

Pointer to the array with level values, separate for each channel.

nLevels

Number of levels, separate for each channel.

pSpec

Pointer to the LUT specification structure.

Description

This function initializes the specification structure for the ippiLUT function. To compute the size of the structure, use the ippiLUT_GetSize function.

Length of the pLevels and pValues arrays is defined by the nLevels parameter. Number of level and intensity values are nLevels-1.

The interpolation parameter defines the mapping algorithm for the LUT function:

  • ippNearest: Every source pixel pSrc(x,y) from the range [pLevels[k], pLevels[k+1]) is mapped to the destination pixel pDst(x,y) which value is equal to pValues[k].

  • ippLinear: Every source pixel pSrc(x, y) from the range [pLevels[k], pLevels[k+1]) is mapped to the destination pixel pDst(x, y) which value is computed according to the following formula:

    pDst(x, y)=pValues[k]+(pSrc(x, y)-pLevels[k])*(pValues[k+1]-pValues[k])/(pLevels[k+1]-Levels[k])

  • ippCubic: Every source pixel pSrc(x,y) from the range [pLevels[k], pLevels[k+1]) is mapped to the destination pixel pDst(x,y) which value is computed as

    pDst(x,y)= A*pSrc(x,y)3 + B*pSrc(x,y)2 + C*pSrc(x,y) + D.

    The function operates on the assumption that the cubic polynomial curve passes through the following four points:

    ([pLevels[k-1], pLevels[k-1])

    ([pLevels[k], pLevels[k])

    ([pLevels[k+1], pLevels[k+1])

    ([pLevels[k+2], pLevels[k+2])

    Based on that, coefficients A, B, C, D are computed by solving the following set of linear equations:

    A*pLevels[k-1]3 + B*pLevels[k-1]2 + C*pLevels[k-1] + D = pValues[k-1]

    A*pLevels[k]3 + B*pLevels[k]2 + C*pLevels[k] + D = pValues[k]

    A*pLevels[k+1]3 + B*pLevels[k+1]2 + C*pLevels[k+1] + D = pValues[k+1]

    A*pLevels[k+2]3 + B*pLevels[k+2]2 + C*pLevels[k+2] + D = pValues[k+2]

Pixels in the pSrc image that are not in the range [pLevels[0], pLevels[nLevels-1]) are copied to the pDst image without any transformation.

For an example on how to use this function, refer to the example provided with the ippiLUT function description.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when any of the specified pointers is NULL.

ippStsSizeErr

Indicates an error when roiSize has a field with a value less than 1.

ippStsChannelErr

Indicates an error when channel has an illegal value.

ippStsLUTNofLevelsErr

Indicates an error when nLevels is less than 2.

ippStsInterpolationErr

Indicates an error when interpolation has an illegal value.

See Also