Intel® Integrated Performance Primitives Developer Guide and Reference

ID 790148
Date 11/07/2023
Public

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

Document Table of Contents

RGBToLUV, BGRToLUV

Converts an RGB or BGR image to the LUV color model.

Syntax

Case 1: RGB to LUV

IppStatus ippiRGBToLUV_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize);

Supported values for mod:

8u_C3R 16u_C3R 16s_C3R 32f_C3R
8u_AC4R 16u_AC4R 16s_AC4R 32f_AC4R

Case 2: BGR to LUV

IppStatus ippiBGRToLUV_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize);

Supported values for mod:

8u_C3R 32f_C3R

Include Files

ippcc.h

Domain Dependencies

Headers: ippcore.h, ippvm.h, ipps.h, ippi.h

Libraries: ippcore.lib, ippvm.lib, ipps.lib, ippi.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 and destination ROI in pixels.

Description

This function operates with ROI (see Regions of Interest in Intel IPP).

This function converts the RGB or BGR image pSrc to the CIE LUV CIE LUV image pDstin two steps. First, the conversion is done into CIE XYZ format, using equations defined for the ippiRGBToXYZ function. After that, conversion to LUV image is performed in accordance with the following equations:

L = 116. * (Y/Yn)1/3. - 16.

U = 13. * L * (u - un)

V = 13. * L * (v - vn)

where

u = 4.*X / (X + 15.*Y + 3.*Z)

v = 9.*Y / (X + 15.*Y + 3.*Z)

un = 0.197839

vn = 0.468342

The computed values of the L component are in the range [0..100], U component in the range [-134..220], and V component in the range [-140..122].

The equations above are given on the assumption that R, G, and B values are normalized to the range [0..1]. In case of the floating-point data type, the input RGB values must already be in the range [0..1]. For integer data types, normalization is done by the conversion function internally.

In case of 8u data type, the computed L, U, and V values are quantized and converted to fit in the range [0..IPP_MAX_8U] as follows:

L = L * IPP_MAX_8U / 100.

U = (U + 134.) * IPP_MAX_8U / 354.

V = (V + 140.) * IPP_MAX_8U / 262.

In case of 16u data type, the computed L, U, and V values are quantized and converted to fit in the range [0..IPP_MAX_16U] as follows:

L = L * IPP_MAX_16U / 100.

U = (U + 134.) * IPP_MAX_16U / 354.

V = (V + 140.) * IPP_MAX_16U / 262.

In case of 16s data type, the computed L,U, and V values are quantized and converted to fit in the range [IPP_MIN_16S..IPP_MAX_16S] as follows:

L = L * IPP_MAX_16U / 100. + IPP_MIN_16S

U = (U + 134.) * IPP_MAX_16U / 354. + IPP_MIN_16S

V = (V + 140.) * IPP_MAX_16U / 262. + IPP_MIN_16S

For 32f data type, no further conversion is done and L, U, and V components remain in the ranges [0..100], [-134..220], and [-140..122], respectively.

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.