Esempio n. 1
0
 /**
  * Create viewing conditions assuming full adaption. This is primarily useful in color management
  * applications.
  *
  * @param XYZ_w XYZ of adopted whitepoint
  * @param L_A average luminance of visual surround
  * @param Y_b adaptation luminance of color background
  * @param sur the surrounding
  * @return a fully adapted viewing conditions instance
  */
 public static ViewingConditions createFullyAdapted(
     CIEXYZ XYZ_w, float L_A, float Y_b, Surrounding sur) {
   double[] xyz_w = MathTools.floatToDoubleArray(XYZ_w.toCIEXYZ100());
   double[] RGB_w = CS_CIECAM02.XYZtoCAT02(xyz_w);
   double[] RGB_c = calcAdaptedRGBc(XYZ_w, RGB_w, 1.0);
   return new ViewingConditions(xyz_w, L_A, Y_b, sur, RGB_w, RGB_c);
 }
Esempio n. 2
0
 private static double[] calcAdaptedRGBc(CIEXYZ XYZ_w, double[] RGB_w, double D) {
   double[] RGB_c = new double[3];
   double Yw = XYZ_w.get(CIEXYZ.Y) * 100;
   for (int i = 0; i < RGB_c.length; i++) {
     RGB_c[i] = (D * Yw / RGB_w[i]) + (1.0 - D);
   }
   return RGB_c;
 }
Esempio n. 3
0
 /**
  * Construct a new ViewingConditions instance. The degree of adaption (D) is derived from the
  * background and surround. This is the standard case treated in CIE 159:2004.
  *
  * @param XYZ_w XYZ of adopted whitepoint
  * @param L_A average luminance of visual surround
  * @param Y_b adaptation luminance of color background
  * @param sur the surrounding
  * @return a ViewingConditions instance
  */
 public static ViewingConditions createAdapted(
     CIEXYZ XYZ_w, double L_A, double Y_b, Surrounding sur) {
   double[] xyz_w = MathTools.floatToDoubleArray(XYZ_w.toCIEXYZ100());
   // calculate RGB whitepoint
   double[] RGB_w = CS_CIECAM02.XYZtoCAT02(xyz_w);
   double D = calcD(L_A, sur);
   double[] RGB_c = calcAdaptedRGBc(XYZ_w, RGB_w, D);
   return new ViewingConditions(xyz_w, L_A, Y_b, sur, RGB_w, RGB_c);
 }
Esempio n. 4
0
 /**
  * Derive (or better: guess) an (adopted) white point by mixing two white points. Luminance will
  * also be mixed. See CIE:159:2004, section 5.
  *
  * @param background_white the whitepoint of the background
  * @param surround_white the whitepoint of the surround
  * @param bgFactor the background weight
  * @return XYZ mixed from background and surround
  */
 public static CIEXYZ mixedWhitepoint(
     CIEXYZ background_white, CIEXYZ surround_white, float bgFactor) {
   return CIEXYZ.blend(
       new CIEXYZ[] {background_white, surround_white}, new float[] {bgFactor, 1 - bgFactor});
 }