简体   繁体   English

颜色转换CMYK-RGB-使用ICC配置文件的WCS实验室

[英]color conversion CMYK - RGB - Lab with WCS by using a ICC Profile

Since last week I try to use the Windows Color System for my color conversion. 从上周开始,我尝试使用Windows颜色系统进行颜色转换。 By the conversion from CMYK to RGB i get the correct values: 通过从CMYK到RGB的转换,我得到了正确的值:

    // Example CMYK - VALUES with 0
    float[] cmykValues = new float[4];
    cmykValues[0] = 0f / 255f;
    cmykValues[1] = 0f / 255f;
    cmykValues[2] = 0f / 255f;
    cmykValues[3] = 0f / 255f;

    System.Windows.Media.Color color = Color.FromValues(cmykValues, new Uri(@"ISOcoated_v2_300_eci.icc"));
    System.Drawing.Color rgbColor = System.Drawing.Color.FromArgb(color.R, color.G, color.B);

When I try to convert the RGB Values to Lab Values, then I get a incorrect Lab - Result: 当我尝试将RGB值转换为Lab值时,我得到了不正确的Lab-结果:

[StructLayout(LayoutKind.Sequential)]
public struct RGBColor
{
    public ushort red;
    public ushort green;
    public ushort blue;
    public ushort pad;
};

[StructLayout(LayoutKind.Sequential)]
public struct LABColor
{
    public ushort L;
    public ushort a;
    public ushort b;
    public ushort pad;
};

 StringBuilder profileName = new StringBuilder(256);
 uint size = (uint)profileName.Capacity * 2;
 success = GetStandardColorSpaceProfile(0, LogicalColorSpace.sRGB, profileName, ref size);

 ProfileFilename sRGBFilename = new ProfileFilename(profileName.ToString());
 IntPtr hSRGBProfile = OpenColorProfile(sRGBFilename, ProfileRead, FileShare.Read, CreateDisposition.OpenExisting);

 ProfileFilename isoCoatedFilename = new ProfileFilename(@"ISOcoated_v2_300_eci.icc");
 IntPtr hIsoCoatedProfile = OpenColorProfile(isoCoatedFilename, ProfileRead, FileShare.Read, CreateDisposition.OpenExisting);

 IntPtr[] profiles = new IntPtr[] { hSRGBProfile, hIsoCoatedProfile };
 uint[] intents = new uint[] { IntentPerceptual };
 IntPtr transform = CreateMultiProfileTransform(profiles, 2, intents, 1, ColorTransformMode.BestMode, IndexDontCare);

 RGBColor[] rgbColors = new RGBColor[1];
 rgbColors[0] = new RGBColor();
 LABColor[] labColors = new LABColor[1];
 labColors[0] = new LABColor();

 rgbColors[0].red    = Convert.ToUInt16(rgbColor.R * 257);
 rgbColors[0].green  = Convert.ToUInt16(rgbColor.G * 257);
 rgbColors[0].blue   = Convert.ToUInt16(rgbColor.B * 257);

 success = TranslateColors(transform, rgbColors, 1, ColorType.RGB, labColors, ColorType.Lab);

 double colorL = Convert.ToDouble(labColors[0].L) / 65535;
 double colorA = Convert.ToDouble(labColors[0].a) / 65535;
 double colorB = Convert.ToDouble(labColors[0].b) / 65535;

When I convert the CMYK Value (0;0;0;0) to RGB (= 254:254;254) and the RGB Value to Lab I get the following values: 当我将CMYK值(0; 0; 0; 0)转换为RGB(= 254:254; 254)并将RGB值转换为Lab时,我得到以下值:

L = 0.0039978637360036373
a = 0.002777141984552145
b = 0.0030670634005218744

But the L-Value should be about 100% 但L值应约为100%

Hm. 嗯。 I think you don't need to use a print profile ( CMYK ) when converting from color monitor's ( RGB ) to a device independent color model ( Lab ). 从彩色显示器( RGB )转换为与设备无关的颜色模型( Lab )时,我认为您不需要使用打印配置文件( CMYK )。

RGB -> XYZ -> Lab or this RGB-> XYZ-> Lab这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM