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 |
Include Files
ippi.h
Domain Dependencies
Headers:
ippcore.h
,
ippvm.h
,
ipps.h
Libraries:
ippcore.lib
,
ippvm.lib
,
ipps.lib
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.
- 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.
- nBitSize
- Number of significant bits in the source image.
Description
This function operates with ROI (see Regions of Interest in Intel IPP).
The function elements that contain intensity values specified by the user. The function uses
ippiLUTPalette
performs intensity transformation of the source image pSrc
using the palette lookup table pTable
. This table is a vector with 2nBitSize
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.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 isNULL.
- ippStsSizeErr
- Indicates an error condition ifroiSizehas a field with a zero or negative value.
- ippStsOutOfRangeErr
- Indicates an error ifnBitSizeis out of the range.
Example
The code example below shows how to use the function
ippiLUTPalette_8u32u_C1R
.#include "ippcore.h" #include "ippi.h" #include <iostream> void func_LUTPalette() { IppStatus status; Ipp8u pSrc[8 * 8]; int srcStep = 8 * sizeof(Ipp8u); IppiSize roiSize = { 8, 8 }; Ipp32u pDst[8 * 8]; int dstStep = 8 * sizeof(Ipp32f); int nBitSize = 3; Ipp32u pTable[8] = { 1, 2, 3, 4, 5, 6, 7, 8 }; status = ippiImageJaehne_8u_C1R(pSrc, srcStep, roiSize); std::cout << "pSrc:\n"; for (int row = 0; row < roiSize.height; row++) { for (int col = 0; col < roiSize.width; col++) { std::cout << (int)pSrc[roiSize.width * row + col] << "\t"; } std::cout << "\n"; } status = ippiLUTPalette_8u32u_C1R(pSrc, srcStep, pDst, dstStep, roiSize, pTable, nBitSize); std::cout << "pDst:\n"; for (int row = 0; row < roiSize.height; row++) { for (int col = 0; col < roiSize.width; col++) { std::cout << pDst[roiSize.width * row + col] << "\t"; } std::cout << "\n"; } }
Result:
pSrc: 1 68 165 209 209 165 68 1 68 209 255 250 250 255 209 68 165 255 227 188 188 227 255 165 209 250 188 141 141 188 250 209 209 250 188 141 141 188 250 209 165 255 227 188 188 227 255 165 68 209 255 250 250 255 209 68 1 68 165 209 209 165 68 1 pDst: 2 5 6 2 2 6 5 2 5 2 8 3 3 8 2 5 6 8 4 5 5 4 8 6 2 3 5 6 6 5 3 2 2 3 5 6 6 5 3 2 6 8 4 5 5 4 8 6 5 2 8 3 3 8 2 5 2 5 6 2 2 6 5 2