Colorimetric Systems Conversion Code Snippet¶
This code snippet shows how to convert a color image from the RGB to the Lab colorimetric system.
C++¶
#include <eVision/EasyColor/EColorLookup.h>
#include <eVision/EasyColor/EasyColor.h>
using namespace eVision;
// Images constructor
EImageC24 srcImage;
EImageC24 dstImage;
// ...
// Prepare a lookup table for
// the RGB to La*b* conversion
EColorLookup lookup;
lookup.ConvertFromRgb(EColorSystem_Lab);
// Source and destination images must have the same size
dstImage.SetSize(&srcImage);
// Perform the color conversion
EasyColor::Transform(&srcImage, &dstImage, &lookup);
C#¶
using eVision;
// Images constructor
EImageC24 srcImage = new EImageC24();
EImageC24 dstImage = new EImageC24();
// ...
// Prepare a lookup table for
// the RGB to La*b* conversion
EColorLookup lookup = new EColorLookup();
lookup.ConvertFromRgb(EColorSystem.Lab);
// Source and destination images must have the same size
dstImage.SetSize(srcImage);
// Perform the color conversion
EasyColor.Transform(srcImage, dstImage, lookup);
Python¶
import eVision
# Images constructor
src_image = eVision.EImageC24()
dst_image = eVision.EImageC24()
# ...
# Prepare a lookup table for
# the RGB to La*b* conversion
lookup = eVision.EColorLookup()
lookup.ConvertFromRgb(eVision.EColorSystem.Lab)
# Source and destination images must have the same size
dst_image.SetSize(src_image)
# Perform the color conversion
eVision.EasyColor.Transform(src_image, dst_image, lookup)
See also
EColorLookup.ConvertFromRgb C++ .NET, EasyColor.Transform C++ .NET