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, orippAC4.
- 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:- : Every source pixelippNearestpSrc(x,y)from the range[is mapped to the destination pixelpLevels[k],pLevels[k+1])pDst(x,y)which value is equal topValues[k].
- : Every source pixelippLinearpSrc(x, y)from the range[is mapped to the destination pixelpLevels[k],pLevels[k+1])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])
- : Every source pixelippCubicpSrc(x,y)from the range[is mapped to the destination pixelpLevels[k],pLevels[k+1])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)+ DThe 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, coefficientsA,B,C,Dare 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 [
are copied to the pLevels
[0], pLevels
[nLevels
-1])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 isNULL.
- ippStsSizeErr
- Indicates an error whenroiSizehas a field with a value less than 1.
- ippStsChannelErr
- Indicates an error whenchannelhas an illegal value.
- ippStsLUTNofLevelsErr
- Indicates an error whennLevelsis less than 2.
- ippStsInterpolationErr
- Indicates an error wheninterpolationhas an illegal value.