BGRToLab

Converts a BGR image to the Lab color model.

Syntax

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);

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 and destination ROI in pixels.

Description

The function ippiBGRToLab is declared in the ippcc.h file. It operates with ROI (see Regions of Interest in Intel IPP).

This function converts the BGR image pSrc to the CIE Lab image pDst in 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

f(t) = t1/3. - 16 for t > 0.008856

f(t) = 7.787*t + 16/116 for t ≤ 0.008856

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 ippiBGRToLab_8u_C3:

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 or pDst is NULL.

ippStsSizeErr

Indicates an error condition if roiSize has a field with a zero or negative value.

Submit feedback on this help topic

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