}
}
}
// Chromatic adaptation matrix
Matrix B = new Matrix(ColorScience.chromaticAdaptation(daylightTemperature, temperature, caMethod));
Matrix CA = XYZtoRGB.times(B.times(RGBtoZYX));
// Normalize the CA matrix to keep exposure constant
Matrix m = CA.times(new Matrix(new double[][]{{1},{1},{1}}));
double max = m.get(1, 0);
if (max != 1)
CA = CA.times(new Matrix(new double[][]{{1/max, 0, 0},{0, 1/max, 0},{0, 0, 1/max}}));
float actualExposure = exposure;
String thisCamera = metadata.getCameraMake(true);
for (String camera : fakeISO100Cameras)
if (thisCamera.equals(camera)) {
if (metadata.getISO() == 100) {
actualExposure -= 1;
}
break;
}
// The matrix taking into account the camera color space and its basic white balance and exposure
float camMatrix[][] = new Matrix(cameraRGB(temperature)).times(Math.pow(2, actualExposure)).getArrayFloat();
front = new HighlightRecoveryOpImage(front, preMul, camMatrix, CA.getArrayFloat(), null);
if (tint != 0)
front = WhiteBalanceV2.tintCast(front, tint, lightness);