The Color Conversion C++ Class Library provides built-in conversion. To do a built-in conversion, follow the steps below:
1. |
Define the following global variables: |
LColor clr;
CONVERSION_PARAMS params;
WHITEPOINT WPoint;
L_UCHAR *pRGBData;
L_UCHAR *pLABData;
L_INT nWidth;
L_INT nHeight;
L_INT nInAlign;
L_INT nOutAlign;
2. |
Set the conversion options by filling a CONVERSION_PARAMS structure: |
ZeroMemory(¶ms, sizeof(CONVERSION_PARAMS));
params.pWpoint = &WPoint;
params.uStructSize = sizeof(CONVERSION_PARAMS);
params.pWpoint->nWhitePoint = CIELAB_D50;
params.nQuantization = 8;
params.nMethod = USE_BUILTIN;
params.nActiveMethod = USE_BUILTIN;
params.pWpoint->xWhite = 0.0;
params.pWpoint->yWhite = 0.0;
3. |
Initialize the color conversion object with LColor::Initialize (): |
clr.Initialize (CCS_RGB, CCS_LAB, ¶ms);
4. |
Convert from RGB to CIELab: |
clr.Convert (pRGBData, pLABData, nWidth, nHeight, nInAlign, nOutAlign);
5. |
At the end, free the color conversion object: |
clr.Free ();