LUT_Linear

Maps an image by applying intensity transformation with linear interpolation.

Syntax

Case 1: Not-in-place operation on one-channel integer data

IppStatus ippiLUT_Linear_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize, const Ipp32s* pValues, const Ipp32s* pLevels, int nLevels);

Supported values for mod:

8u_C1R 16u_C1R 16s_C1R

Case 2: Not-in-place operation on multi-channel integer data.

IppStatus ippiLUT_Linear_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize, const Ipp32s* pValues[3], const Ipp32s* pLevels[3], int nLevels[3]);

Supported values for mod:

8u_C3R 16u_C3R 16s_C3R
8u_AC4R 16u_AC4R 16s_AC4R

IppStatus ippiLUT_Linear_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize, const Ipp32s* pValues[4], const Ipp32s* pLevels[4], int nLevels[4]);

Supported values for mod:

8u_C4R 16u_C4R 16s_C4R

Case 3: Not-in-place operation on one-channel floating-point data

IppStatus ippiLUT_Linear_32f_C1R(const Ipp32f* pSrc, int srcStep, Ipp32f* pDst, int dstStep, IppiSize roiSize, const Ipp32f* pValues, const Ipp32f* pLevels, int nLevels);

Case 4: Not-in-place operation on multi-channel floating-point data

IppStatus ippiLUT_Linear_<mod>(const Ipp32f* pSrc, int srcStep, Ipp32f* pDst, int dstStep, IppiSize roiSize, const Ipp32f* pValues[3], const Ipp32f* pLevels[3], int nLevels[3]);

Supported values for mod:

32f_C3R
32f_AC4R

IppStatus ippiLUT_Linear_32f_C4R(const Ipp32f* pSrc, int srcStep, Ipp32f* pDst, int dstStep, IppiSize roiSize, const Ipp32f* pValues[4], const Ipp32f* pLevels[4], int nLevels[4]);

Case 5: In-place operation on one-channel integer data

IppStatus ippiLUT_Linear_<mod>(Ipp<datatype>* pSrcDst, int srcDstStep, IppiSize roiSize, const Ipp32s* pValues, const Ipp32s* pLevels, int nLevels);

Supported values for mod:

8u_C1IR 16u_C1IR 16s_C1IR

Case 6: In-place operation on multi-channel integer data.

IppStatus ippiLUT_Linear_<mod>(Ipp<datatype>* pSrcDst, int srcDstStep, IppiSize roiSize, const Ipp32s* pValues[3], const Ipp32s* pLevels[3], int nLevels[3]);

Supported values for mod:

8u_C3IR 16u_C1IR 16s_C1IR
8u_AC4IR 16u_C1IR 16s_C1IR

IppStatus ippiLUT_Linear_<mod>(Ipp<datatype>* pSrcDst, int srcDstStep, IppiSize roiSize, const Ipp32s* pValues[4], const Ipp32s* pLevels[4], int nLevels[4]);

Supported values for mod:

8u_C4IR 16u_C4IR 16s_C4IR

Case 7: In-place operation on one-channel floating-point data

IppStatus ippiLUT_Linear_32f_C1R(Ipp32f* pSrcDst, int srcDstStep, IppiSize roiSize, const Ipp32f* pValues, const Ipp32f* pLevels, int nLevels);

Case 8: In-place operation on multi-channel floating-point data

IppStatus ippiLUT_Linear_<mod>(Ipp32f* pSrcDst, int srcDstStep, IppiSize roiSize, const Ipp32f* pValues[3], const Ipp32f* pLevels[3], int nLevels[3]);

Supported values for mod:

32f_C3IR
32f_AC4IR

IppStatus ippiLUT_Linear_32f_C4R(Ipp32f* pSrcDst, int srcDstStep, IppiSize roiSize, const Ipp32f* pValues[4], const Ipp32f* pLevels[4], int nLevels[4]);

Parameters

pSrc

Pointer to the source image ROI.

srcStep

Distance in bytes between starts of consecutive lines in the source image.

pDst

Pointer to the destination image ROI.

dstStep

Distance in bytes between starts of consecutive lines in the destination image.

pSrcDst

Pointer to the source and destination mage ROI for the in-place operation.

srcDstStep

Distance in bytes between starts of consecutive lines in the source and destination image for the in-place operation.

roiSize

Size of the source ROI in pixels.

pValues

Pointer to the array of intensity values. In case of multi-channel data, pValues is an array of pointers to the intensity values array for each channel.

pLevels

Pointer to the array of level values. In case of multi-channel data, pLevels is an array of pointers to the level values array for each channel.

nLevels

Number of levels, separate for each channel.

Description

The function ippiLUT_Linear is declared in the ippi.h file. It operates with ROI (see Regions of Interest in Intel IPP).

This function performs intensity transformation of the source image pSrc using the lookup table (LUT) with linear interpolation between two neighbor levels. LUT is specified by the arrays pLevels and pValues. Every source pixel pSrc(x,y) from the range [pLevels[k], pLevels[k+1]) is mapped to the destination pixel pDst(x,y) whose value is computed according to the following relation:



Length of the pLevels and pValues arrays is defined by the nLevels parameter. Pixels in pSrc image that are not in the range [pLevels[0], pLevels[nLevels-1]) are copied to pDst image without any transformation.

Figure Example Mapping Curves Used by the ippiLUT Function Flavors shows particular curves that are used in all ippiLUT function flavors for mapping. The level values are 0, 64, 128, 192, 256; the intensity values are 20, 60, 160, 180, 230.

Example “Using the Function ippiLUT_Linear” shows how to use the function ippiLUT_Linear_32f_C1R.

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error or a warning.

ippStsNullPtrErr

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

ippStsSizeErr

Indicates an error condition if roiSize has a field with a zero or negative value.

ippStsMemAllocErr

Indicates an error when there is not enough memory for inner buffers.

ippStsLUTNofLevelsErr

Indicates an error when the nLevels is less than 2.

Using the Function ippiLUT_Linear 

void func_LUTLinear()
{
    Ipp32f pSrc[8*8];
    int srcStep = 8*sizeof(Ipp32f);
    IppiSize roiSize = {8, 8};

    Ipp32f pDst[8*8];
    int dstStep = 8*sizeof(Ipp32f);
    Ipp32f pLevels[5] = {0.0, 0.128, 0.256, 0.512, 1.0};
    Ipp32f pValues[5] = {0.2, 0.4, 0.6, 0.8, 1.0};
    int nLevels = 5;

    ippiImageJaehne_32f_C1R(pSrc, srcStep, roiSize);

    ippiLUT_Linear_32f_C1R(pSrc, srcStep, pDst, dstStep, roiSize, 
pValues, pLevels, nLevels);
}

Result:

pSrc
0.00  0.26  0.65  0.82  0.82  0.65  0.26  0.00
0.26  0.82  1.00  0.98  0.98  1.00  0.82  0.26
0.65  1.00  0.89  0.74  0.74  0.89  1.00  0.65
0.82  0.98  0.74  0.55  0.55  0.74  0.98  0.82
0.82  0.98  0.74  0.55  0.55  0.74  0.98  0.82
0.65  1.00  0.89  0.74  0.74  0.89  1.00  0.65
0.26  0.82  1.00  0.98  0.98  1.00  0.82  0.26
0.00  0.26  0.65  0.82  0.82  0.65  0.26  0.00


pDst
0.20  0.61  0.85  0.93  0.93  0.85  0.61  0.20
0.61  0.93  1.00  0.99  0.99  1.00  0.93  0.61
0.85  1.00  0.95  0.89  0.89  0.95  1.00  0.85
0.93  0.99  0.89  0.82  0.82  0.89  0.99  0.93
0.93  0.99  0.89  0.82  0.82  0.89  0.99  0.93
0.85  1.00  0.95  0.89  0.89  0.95  1.00  0.85
0.61  0.93  1.00  0.99  0.99  1.00  0.93  0.61
0.20  0.61  0.85  0.93  0.93  0.85  0.61  0.20


Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.