protected void prepareColorTransform(CvMat X2, int pyramidLevel, Parameters p, boolean inverse) {
CvMat A = p.getA(), b = p.getB();
cvSetIdentity(X2);
X2.rows(3); X2.cols(3);
if (p.fakeIdentity && !inverse) {
X2.put(A);
} else if (A != null && X != null) {
cvMatMul(X, A, X2);
} else if (X == null) {
X2.put(A);
} else if (A == null) {
X2.put(X);
}
X2.rows(4); X2.cols(4);
if (b != null) {
X2.put(0, 3, b.get(0));
X2.put(1, 3, b.get(1));
X2.put(2, 3, b.get(2));
}
if (inverse) {
cvInvert(X2, X2, CV_SVD);
}
}