Developer Reference

  • 2020
  • 07/15/2020
  • Public Content
Contents

BGRToLab, RGBToLab

Converts a BGR or RGB image to the Lab color model.

Syntax

Case 1: BGR to Lab
IppStatus ippiBGRToLab_8u_C3R(const Ipp8u*
pSrc
, int
srcStep
, Ipp8u*
pDst
, int
dstStep
, IppiSize
roiSize
);
IppStatus ippiBGRToLab_8u16u_C3R(const Ipp8u*
pSrc
, int
srcStep
, Ipp16u*
pDst
, int
dstStep
, IppiSize
roiSize
);
IppStatus ippiBGRToLab_32f_C3R(const Ipp32f*
pSrc
, int
srcStep
, Ipp32f*
pDst
, int
dstStep
, IppiSize
roiSize
);
Case 2: RGB to Lab
IppStatus ippiRGBToLab_8u_C3R(const Ipp8u*
pSrc
, int
srcStep
, Ipp8u*
pDst
, int
dstStep
, IppiSize
roiSize
);
IppStatus ippiRGBToLab_32f_C3R(const Ipp32f*
pSrc
, int
srcStep
, Ipp32f*
pDst
, int
dstStep
, IppiSize
roiSize
);
IppStatus ippiRGBToLab_32f_P3R(const Ipp32f*
pSrc[3]
, int
srcStep[3]
, Ipp32f*
pDst[3]
, int
dstStep[3]
, IppiSize
roiSize
);
IppStatus ippiRGBToLab_64f_P3R(const Ipp64f*
pSrc[3]
, int
srcStep[3]
, Ipp64f*
pDst[3]
, int
dstStep[3]
, IppiSize
roiSize
);
Case 3: RGB to Lab with platform-aware functions
IppStatus ippiRGBToLab_32f_P3R_L(const Ipp32f*
pSrc[3]
, IppSizeL
srcStep[3]
, Ipp32f*
pDst[3]
, IppSizeL
dstStep[3]
, IppiSizeL
roiSize
);
IppStatus ippiRGBToLab_64f_P3R_L(const Ipp64f*
pSrc[3]
, IppSizeL
srcStep[3]
, Ipp64f*
pDst[3]
, IppSizeL
dstStep[3]
, IppiSizeL
roiSize
);
Case 4: RGB to Lab with TL functions based on the Platform Aware API
IppStatus ippiRGBToLab_32f_P3R_LT(const Ipp32f*
pSrc[3]
, IppSizeL
srcStep[3]
, Ipp32f*
pDst[3]
, IppSizeL
dstStep[3]
, IppiSizeL
roiSize
);
IppStatus ippiRGBToLab_64f_P3R_LT(const Ipp64f*
pSrc[3]
, IppSizeL
srcStep[3]
, Ipp64f*
pDst[3]
, IppSizeL
dstStep[3]
, IppiSizeL
roiSize
);
Case 5: RGB to Lab with TL functions based on the Classic API
IppStatus ippiRGBToLab_32f_P3R_T(const Ipp32f*
pSrc[3]
, int
srcStep[3]
, Ipp32f*
pDst[3]
, int
dstStep[3]
, IppiSize
roiSize
);
IppStatus ippiRGBToLab_64f_P3R_T(const Ipp64f*
pSrc[3]
, int
srcStep[3]
, Ipp64f*
pDst[3]
, int
dstStep[3]
, IppiSize
roiSize
);
Include Files
ippcc.h
ippcc_l.h
ippcc_tl.h
Domain Dependencies
Headers:
ippcore.h
,
ippvm.h
,
ipps.h
,
ippi.h
Libraries:
ippcore.lib
,
ippvm.lib
,
ipps.lib
,
ippi.lib
Parameters
pSrc
,
pSrc[3]
Pointer to the source image ROI.
srcStep
,
srcStep[3]
Distance in bytes between starts of consecutive lines in the source image.
pDst
,
pDst[3]
Pointer to the destination image ROI.
dstStep
,
dstStep[3]
Distance in bytes between starts of consecutive lines in the destination image.
roiSize
Size of the source and destination ROI in pixels.
Description
This function operates with ROI (see Regions of Interest in Intel IPP).
This function converts the
BGR
or
RGB
image
pSrc
to the
CIE Lab
image
pDst
, and vice versa. Conversion to
Lab
consists of two steps. First, the conversion is done into
CIE XYZ
format, using equations defined for the function
ippiRGBToXYZ
. After that, conversion to the
Lab
image is performed in accordance with the following equations:
L = 116. * (Y/Y
n
)
1/3.
- 16
for
Y/Y
n
> 0.008856
L = 903.3 * (Y/Y
n
)
1/3.
for
Y/Y
n
0.008856
a = 500. * [f(X/X
n
)-f(Y/Y
n
)]
b = 200. * [f(Y/Y
n
)-f(Z/Z
n
)]
where
Here
Y
n
= 1.0,
X
n
= 0.950455,
Z
n
= 1.088753 for the D65 white point with the CIE chromaticity coordinates
x
n
= 0.312713,
y
n
= 0.329016.
The equations above are given on the assumption that initial B, G, R values are normalized to the range [0..1]. The computed values of the
L
component are in the range [0..100],
a
and
b
component values are in the range [-128..127].
These values are quantized and scaled to the 8-bit range of 0 to 255 for
8u_C3
flavors:
L = L * 255./100.
a = (a + 128.)
b = (a + 128.)
or to the 16-bit range of 0 to 65535 for
ippiBGRToLab_8u16u_C3R
:
L = L * 65535./100.
a = (a + 128.)* 255
b = (a + 128.)* 255
Return Values
ippStsNoErr
Indicates no error. Any other value indicates an error.
ippStsNullPtrErr
Indicates an error condition if
pSrc
,
pSrc[3]
,
pDst
, or
pDst[3]
is
NULL
.
ippStsSizeErr
Indicates an error condition if
roiSize
has a field with a zero or negative value.

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804