Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4760025

sRGB conversions to and from CIE XYZ incorrect

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 23
    • 1.2.1, 1.4.1
    • client-libs
    • 2d
    • b06
    • x86
    • windows_2000

    Description

      Name: jk109818 Date: 10/08/2002


      FULL PRODUCT VERSION :
      java version "1.4.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
      Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      The methods toCIEXYZ and fromCIEXYZ should when used on the
      sRGB color space should take you from an sRGB color to the
      XYZ equivalent and then back (approximately) to the color
      you started with. Unfortunately the resulting color differs
      substantially from the initial color.
      As sRGB is an invertible color space, one or both of the
      transformations must be erroneous.

      Running the same test with a colour space such as
      AdobeRGB98 works successfully. This color space is
      specified using a gamma instead of lookup tables. This
      suggests that something is wrong with the handling of the
      lookup tables.

      Tests on color spaces derived from the profile for an Epson
      Stylus Photo 2100 (2200 in the US?) printer, produce much
      larger anomalies.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Run the attached code.
      2.
      3.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      The colour on the right of each line should be a close
      match to that at the beginning of the same line.

      Color 0.0 1.0 0.0 ==> XYZ 0.395813 0.71173096 0.08981323
      ==> color 0.10215915 0.9881895 0.02839704
      Color 0.0 0.8 0.0 ==> XYZ 0.23876953 0.42974854 0.05419922
      ==> color 0.059632257 0.7904631 0.022186618
      Color 0.0 0.6 0.0 ==> XYZ 0.1260376 0.22677612 0.028656006
      ==> color 0.041290913 0.5931945 0.013351644

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.color.ColorSpace;

      class TestColorSpace
      {
      public static void main(String[] args)
      {
      ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
      float[] rgb = new float[3];
      float[] g = new float[] {1.0f, 0.8f, 0.6f};
      rgb[0] = 0;
      rgb[2] = 0;
      for (int i=0; i<g.length; i++)
      {
      rgb[1] = g[i];
      float[] xyz = cs.toCIEXYZ(rgb);
      float[] inv = cs.fromCIEXYZ(xyz);
      System.out.println("Color "+toString(rgb)+" ==>
      XYZ "+toString(xyz)+
      " ==>
      color "+toString(inv));
      }
      }

      private static String toString(float[] color)
      {
      StringBuffer buffer = new StringBuffer();
      for (int i=0; i<color.length; i++)
      {
      if (i > 0)
      buffer.append(' ');
      buffer.append(color[i]);
      }
      return buffer.toString();
      }
      }
      ---------- END SOURCE ----------
      (Review ID: 165411)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              serb Sergey Bylokhov
              jkimsunw Jeffrey Kim (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: