Color Components

Functional Guide | Reference: Compose, ConvertFromRgb, GetComponent


//////////////////////////////////////////////////////////
// This code snippet shows how to create a color image  //
// from 3 grayscale images and extract the luminance    //
// component from a color image.                        //
//////////////////////////////////////////////////////////

// Images constructor
EImageBW8 red, green, blue;
EImageC24 colorImage;
EImageBW8 luminance;

// ...

// Source and destination images must have the same size
colorImage.SetSize(&red);

// Combine the color planes into a color image
EasyColor::Compose(&red, &green, &blue, &colorImage);

// Prepare a lookup table for
// the RGB to LSH conversion
EColorLookup lookup;
lookup.ConvertFromRgb(EColorSystem_Lsh);

// Source and destination images must have the same size
luminance.SetSize(&colorImage);

// Get the Luminance component
EasyColor::GetComponent(&colorImage, &luminance, 0, &lookup);

//////////////////////////////////////////////////////////
// This code snippet shows how to create a color image  //
// from 3 grayscale images and extract the luminance    //
// component from a color image.                        //
//////////////////////////////////////////////////////////

// Images constructor
EImageBW8 red= new EImageBW8();
EImageBW8 green= new EImageBW8();
EImageBW8 blue= new EImageBW8();
EImageC24 colorImage= new EImageC24();
EImageBW8 luminance= new EImageBW8();

// ...

// Source and destination images must have the same size
colorImage.SetSize(red);

// Combine the color planes into a color image
EasyColor.Compose(red, green, blue, colorImage);

// Prepare a lookup table for
// the RGB to LSH conversion
EColorLookup lookup= new EColorLookup();
lookup.ConvertFromRgb(EColorSystem.Lsh);

// Source and destination images must have the same size
luminance.SetSize(colorImage);

// Get the Luminance component
EasyColor.GetComponent(colorImage, luminance, 0, lookup);