|
|
@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation |
|
|
/// DISCo, Department of Informatics, Systems and Communication, University of Milan-Bicocca, viale Sarca 336, 20126 Milan, Italy
|
|
|
/// DISCo, Department of Informatics, Systems and Communication, University of Milan-Bicocca, viale Sarca 336, 20126 Milan, Italy
|
|
|
/// https://web.stanford.edu/~sujason/ColorBalancing/Papers/Two%20New%20von%20Kries%20Based%20Chromatic%20Adaptation.pdf
|
|
|
/// https://web.stanford.edu/~sujason/ColorBalancing/Papers/Two%20New%20von%20Kries%20Based%20Chromatic%20Adaptation.pdf
|
|
|
/// </remarks>
|
|
|
/// </remarks>
|
|
|
internal static class LmsAdaptationMatrix |
|
|
public static class LmsAdaptationMatrix |
|
|
{ |
|
|
{ |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Von Kries chromatic adaptation transform matrix (Hunt-Pointer-Estevez adjusted for D65)
|
|
|
/// Von Kries chromatic adaptation transform matrix (Hunt-Pointer-Estevez adjusted for D65)
|
|
|
@ -25,9 +25,15 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation |
|
|
public static readonly Matrix4x4 VonKriesHPEAdjusted |
|
|
public static readonly Matrix4x4 VonKriesHPEAdjusted |
|
|
= Matrix4x4.Transpose(new Matrix4x4 |
|
|
= Matrix4x4.Transpose(new Matrix4x4 |
|
|
{ |
|
|
{ |
|
|
M11 = 0.40024F, M12 = 0.7076F, M13 = -0.08081F, |
|
|
M11 = 0.40024F, |
|
|
M21 = -0.2263F, M22 = 1.16532F, M23 = 0.0457F, |
|
|
M12 = 0.7076F, |
|
|
M31 = 0, M32 = 0, M33 = 0.91822F, |
|
|
M13 = -0.08081F, |
|
|
|
|
|
M21 = -0.2263F, |
|
|
|
|
|
M22 = 1.16532F, |
|
|
|
|
|
M23 = 0.0457F, |
|
|
|
|
|
M31 = 0, |
|
|
|
|
|
M32 = 0, |
|
|
|
|
|
M33 = 0.91822F, |
|
|
M44 = 1F // Important for inverse transforms.
|
|
|
M44 = 1F // Important for inverse transforms.
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@ -37,9 +43,15 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation |
|
|
public static readonly Matrix4x4 VonKriesHPE |
|
|
public static readonly Matrix4x4 VonKriesHPE |
|
|
= Matrix4x4.Transpose(new Matrix4x4 |
|
|
= Matrix4x4.Transpose(new Matrix4x4 |
|
|
{ |
|
|
{ |
|
|
M11 = 0.3897F, M12 = 0.6890F, M13 = -0.0787F, |
|
|
M11 = 0.3897F, |
|
|
M21 = -0.2298F, M22 = 1.1834F, M23 = 0.0464F, |
|
|
M12 = 0.6890F, |
|
|
M31 = 0, M32 = 0, M33 = 1F, |
|
|
M13 = -0.0787F, |
|
|
|
|
|
M21 = -0.2298F, |
|
|
|
|
|
M22 = 1.1834F, |
|
|
|
|
|
M23 = 0.0464F, |
|
|
|
|
|
M31 = 0, |
|
|
|
|
|
M32 = 0, |
|
|
|
|
|
M33 = 1F, |
|
|
M44 = 1F |
|
|
M44 = 1F |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@ -54,9 +66,15 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation |
|
|
public static readonly Matrix4x4 Bradford |
|
|
public static readonly Matrix4x4 Bradford |
|
|
= Matrix4x4.Transpose(new Matrix4x4 |
|
|
= Matrix4x4.Transpose(new Matrix4x4 |
|
|
{ |
|
|
{ |
|
|
M11 = 0.8951F, M12 = 0.2664F, M13 = -0.1614F, |
|
|
M11 = 0.8951F, |
|
|
M21 = -0.7502F, M22 = 1.7135F, M23 = 0.0367F, |
|
|
M12 = 0.2664F, |
|
|
M31 = 0.0389F, M32 = -0.0685F, M33 = 1.0296F, |
|
|
M13 = -0.1614F, |
|
|
|
|
|
M21 = -0.7502F, |
|
|
|
|
|
M22 = 1.7135F, |
|
|
|
|
|
M23 = 0.0367F, |
|
|
|
|
|
M31 = 0.0389F, |
|
|
|
|
|
M32 = -0.0685F, |
|
|
|
|
|
M33 = 1.0296F, |
|
|
M44 = 1F |
|
|
M44 = 1F |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@ -65,35 +83,53 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public static readonly Matrix4x4 BradfordSharp |
|
|
public static readonly Matrix4x4 BradfordSharp |
|
|
= Matrix4x4.Transpose(new Matrix4x4 |
|
|
= Matrix4x4.Transpose(new Matrix4x4 |
|
|
{ |
|
|
{ |
|
|
M11 = 1.2694F, M12 = -0.0988F, M13 = -0.1706F, |
|
|
M11 = 1.2694F, |
|
|
M21 = -0.8364F, M22 = 1.8006F, M23 = 0.0357F, |
|
|
M12 = -0.0988F, |
|
|
M31 = 0.0297F, M32 = -0.0315F, M33 = 1.0018F, |
|
|
M13 = -0.1706F, |
|
|
M44 = 1F |
|
|
M21 = -0.8364F, |
|
|
}); |
|
|
M22 = 1.8006F, |
|
|
|
|
|
M23 = 0.0357F, |
|
|
|
|
|
M31 = 0.0297F, |
|
|
|
|
|
M32 = -0.0315F, |
|
|
|
|
|
M33 = 1.0018F, |
|
|
|
|
|
M44 = 1F |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// CMCCAT2000 (fitted from all available color data sets)
|
|
|
/// CMCCAT2000 (fitted from all available color data sets)
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public static readonly Matrix4x4 CMCCAT2000 |
|
|
public static readonly Matrix4x4 CMCCAT2000 |
|
|
= Matrix4x4.Transpose(new Matrix4x4 |
|
|
= Matrix4x4.Transpose(new Matrix4x4 |
|
|
{ |
|
|
{ |
|
|
M11 = 0.7982F, M12 = 0.3389F, M13 = -0.1371F, |
|
|
M11 = 0.7982F, |
|
|
M21 = -0.5918F, M22 = 1.5512F, M23 = 0.0406F, |
|
|
M12 = 0.3389F, |
|
|
M31 = 0.0008F, M32 = 0.239F, M33 = 0.9753F, |
|
|
M13 = -0.1371F, |
|
|
M44 = 1F |
|
|
M21 = -0.5918F, |
|
|
}); |
|
|
M22 = 1.5512F, |
|
|
|
|
|
M23 = 0.0406F, |
|
|
|
|
|
M31 = 0.0008F, |
|
|
|
|
|
M32 = 0.239F, |
|
|
|
|
|
M33 = 0.9753F, |
|
|
|
|
|
M44 = 1F |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// CAT02 (optimized for minimizing CIELAB differences)
|
|
|
/// CAT02 (optimized for minimizing CIELAB differences)
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public static readonly Matrix4x4 CAT02 |
|
|
public static readonly Matrix4x4 CAT02 |
|
|
= Matrix4x4.Transpose(new Matrix4x4 |
|
|
= Matrix4x4.Transpose(new Matrix4x4 |
|
|
{ |
|
|
{ |
|
|
M11 = 0.7328F, M12 = 0.4296F, M13 = -0.1624F, |
|
|
M11 = 0.7328F, |
|
|
M21 = -0.7036F, M22 = 1.6975F, M23 = 0.0061F, |
|
|
M12 = 0.4296F, |
|
|
M31 = 0.0030F, M32 = 0.0136F, M33 = 0.9834F, |
|
|
M13 = -0.1624F, |
|
|
M44 = 1F |
|
|
M21 = -0.7036F, |
|
|
}); |
|
|
M22 = 1.6975F, |
|
|
|
|
|
M23 = 0.0061F, |
|
|
|
|
|
M31 = 0.0030F, |
|
|
|
|
|
M32 = 0.0136F, |
|
|
|
|
|
M33 = 0.9834F, |
|
|
|
|
|
M44 = 1F |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |