- double X_R = temp[0] * Y_R;
- double Z_R = temp[2] * Y_R;
- double X_G = temp[3] * Y_G;
- double Z_G = temp[5] * Y_G;
- double X_B = temp[6] * Y_B;
- double Z_B = temp[8] * Y_B;
-
- m[0] = X_R; m[3] = X_G; m[6] = X_B;
- m[1] = Y_R; m[4] = Y_G; m[7] = Y_B;
- m[2] = Z_R; m[5] = Z_G; m[8] = Z_B;
+ double X_R = temp(0,0) * Y_RGB[0];
+ double Z_R = temp(2,0) * Y_RGB[0];
+
+ double X_G = temp(0,1) * Y_RGB[1];
+ double Z_G = temp(2,1) * Y_RGB[1];
+
+ double X_B = temp(0,2) * Y_RGB[2];
+ double Z_B = temp(2,2) * Y_RGB[2];
+
+ Matrix3d m;
+ m(0,0) = X_R; m(0,1) = X_G; m(0,2) = X_B;
+ m(1,0) = Y_RGB[0]; m(1,1) = Y_RGB[1]; m(1,2) = Y_RGB[2];
+ m(2,0) = Z_R; m(2,1) = Z_G; m(2,2) = Z_B;
+
+ return m;