AstroImageJ, Align and Drizzle
4: Inverse matrix
In part one I talked about the matrix T that transform our sub images to fit the reference image. But how to find out what T is?
We need to know how to calculate the matrix T and its internal parameters.
X' = T X.
With help of the invers matrix X-1 we can get T alone on the right side, in matrix manipulation we normally can't change order of the matrices. It looks a bit strange if you are not used with it.
X-1 is of the construction that X-1 X give the unit matrix I (I=1). X must be a square matrix!
X' X-1 = T X X-1 = T I = T
T = X' X-1
Now we get one more problem, to calculate X-1.
Later when we have find T values for each sub image we can put in each sub images coordinates one pixel by one to the transformation T matrix and get the new coordinates in the reference image. In more advanced programs like Matlab we put in the whole image, in more general software like AstroImageJ we have too work with loops.
Inverse matrix, a deeper look inside:
This was the easy case when we have square matrix and an unique solution.
Many times we don't have square matrices, it could be that we have more reference stars than our translation matrix need, they are called to be over-determined. Or the reference points maybe depends on each other, maybe we by mistake have chosen the same star twice.
We can solved that too, but this time it's a mean value more than exact. This is the most common situation, the real life.
Take the example of a warp matrix from the first page:
Z t = X'
Lets say that we have taken 50 reference stars, much more than needed for our translation matrix t, in the example with second degree it's only needs 12 equations, not 50.
You cant just use the inverse of Z like (left side): Z-1 Z t = Z-1 Z t = (Z-1 Z) t = I t = t.
The generalized inverse of Z is the Z-1left matrix or it's components (ZT Z)-1 ZT. ZT is the transpose of the matrix Z. There is an Z-1right too.
Then we have that: Z-1left Z t= Z-1left X' : t = (ZT Z)-1 ZT X'.
In Matlab this is very simple, looks like this: t = X' \ Z.
Transpose of a matrix, in depth:
Generalized inverse, in depth: