Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of 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/Yn)1/3. - 16 for Y/Yn > 0.008856

L = 903.3 * (Y/Yn)1/3. for Y/Yn0.008856

a = 500. * [f(X/Xn)-f(Y/Yn)]

b = 200. * [f(Y/Yn)-f(Z/Zn)]

where


Here Yn = 1.0, Xn = 0.950455, Zn = 1.088753 for the D65 white point with the CIE chromaticity coordinates xn = 0.312713, yn = 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.