LUTPalette, LUTPaletteSwap

Maps an image by applying intensity transformation in accordance with a palette table.

Syntax

Case 1: Operations on one-channel data

IppStatus ippiLUTPalette_<mod>(const Ipp<srcDatatype>* pSrc, int srcStep, Ipp<dstDatatype>* pDst, int dstStep, IppiSize roiSize, const Ipp<dstDatatype>* pTable, int nBitSize);

Supported values for mod:

8u_C1R 16u_C1R
8u32u_C1R 16u8u_C1R
  16u32u_C1R

IppStatus ippiLUTPalette_<mod>(const Ipp<srcDatatype>* pSrc, int srcStep, Ipp8u* pDst, int dstStep, IppiSize roiSize, const Ipp8u* pTable, int nBitSize);

Supported values for mod:

8u24u_C1R 16u24u_C1R

Case 2: Operations on multi-channel data

IppStatus ippiLUTPalette_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize, const Ipp<datatype>* const pTable[3], int nBitSize);

Supported values for mod:

8u_C3R 16u_C3R
8u_AC4R 16u_AC4R

IppStatus ippiLUTPalette_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize, const Ipp<datatype>* const pTable[4], int nBitSize);

Supported values for mod:

8u_C4R 16u_C4R

IppStatus ippiLUTPaletteSwap_<mod>(const Ipp<datatype>* pSrc, int srcStep, int alphaValue, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize, const Ipp<datatype>* const pTable[3], int nBitSize);

Supported values for mod:

8u_C3A0C4R 16u_C3A0C4R

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.

roiSize

Size of the source ROI in pixels.

pTable

Pointer to the palette table, or an array of pointers to the palette tables for each source channel.

alphaValue

Constant value for the alpha channel.

nBitSize

Number of significant bits in the source image.

Description

The functions ippiLUTPalette and ippiLUTPaletteSwap are declared in the ippi.h file. It operates with ROI (see Regions of Interest in Intel IPP).

The function ippiLUTPalette performs intensity transformation of the source image pSrc using the palette lookup table pTable. This table is a vector with 2nBitSize elements that contain intensity values specified by the user. The function uses nBitSize lower bits of intensity value of each source pixel as an index in the pTable and assigns the correspondent intensity value from the table to the respective pixel in the destination image pDst. The number of significant bits nBitSize should be in the range [1, 8] for functions that operate on 8u source images, and [1, 16] for functions that operate on 16u source images.

Some function flavors that operate on the 3-channel source image additionally create a 4-th channel - alpha channel - in the destination image and place it at first position. The channel values of the alpha channel can be set to the arbitrary constant value alhaValue. If this value is less than 0 or greater than the upper boundary of the data range, the channel values are not set.

The function flavor ippiLUTPaletteSwap reverses the order of channels in the destination image.

Example “Using the Function ippiLUTPalette_8u32u_C1R” shows how to use the function ippiLUTPalette_8u32u_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.

ippStsOutOfRangeErr

Indicates an error if nBitSize is out of the range.

Using the Function ippiLUTPalette 

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

    Ipp32f pDst[8*8];
    int dstStep = 8*sizeof(Ipp32f);
    int nBitSize = 3;
    Ipp32u pTable[8] ={1, 2, 3, 4, 5, 6, 7, 8} ;

    ippiImageJaehne_8u_C1R( pSrc, srcStep, roiSize);

    ippiLUTPalette_8u32u_C1R( pSrc, srcStep, pDst, dstStep, roiSize, 
pTable, nBitSize);
}

Result:

              pSrc

  0   67  165  209  209  165   67    0
 67  209  255  250  250  255  209   67
165  255  226  188  188  226  255  165
209  250  188  140  140  188  250  209
209  250  188  140  140  188  250  209
165  255  226  188  188  226  255  165
 67  209  255  250  250  255  209   67
  0   67  165  209  209  165   67    0

               pDst

  1    4    6    2    2    6    4    1
  4    2    8    3    3    8    2    4
  6    8    3    5    5    3    8    6
  2    3    5    5    5    5    3    2
  2    3    5    5    5    5    3    2
  6    8    3    5    5    3    8    6
  4    2    8    3    3    8    2    4
  1    4    6    2    2    6    4    1


Submit feedback on this help topic

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