Astrofriend's homepage


Ad / Annons:

Ad / Annons:

AstroImageJ Align and Drizzle

AstroImageJ, Align and Drizzle

  1. Introduction matrix*


This is an attempt from me to create a macro to AstroImageJ to align and stack sub images with a Drizzle function.

Expect me to change and correct a lot here in the beginning. But follow it if you find it interesting to see how I develop the function and see if I reach the goal, a working Drizzle function!


Drizzle is a way to increase the resolution of under sampled images, i.e. when you have big size pixels on a high resolution telescope.

More information about Drizzle:

  • Drizzle image, Wiki/
  • Matrix:

    First we, especially me have to dig deeper in the mathematical word about matrices and transformation. Uses of matrices in the calculations can make it a lot easier to do it.

    Here you find deeper information:

  • Transformation matrix, Wiki/
  • Unit matrix
    1 0 0
    0 1 0
    0 0 1

    Unit matrix, does nothing to the image.

    Translation matrix
    1 0 X
    0 1 Y
    0 0 1

    Translation matrix, shifts the image in x and y axis.

    Scale matrix
    W 0 0
    0 H 0
    0 0 1

    Scale the x (W=width) and y (H=height) axis, many times W could set equal to H, symmetry.

    Rotation matrix
    Cos(v) Sin(v) 0
    -Sin(v) Cos(v) 0
    0 0 1

    Rotation matrix, rotate the image by angle v.

    Altogether this matrixes will correspond to: T1 T2 T3 T4 = Ttot

    Overall matrix, Ttot
    W*Cos(v) W*Sin(v) X
    -H*Sin(v) H*Cos(v) Y
    0 0 1

    Translation, Scale and rotation matrices (functions) put together in one matrix.

    How to use T:

    X' = T X, T transform the coordinates of X to X'.

    X consist of one pixel coordinate, xij and yij, i=row and j=column. X' is the new coordinates. First we must find out what T is. To that we use our reference star as we get when we align our sub images. To X we put in our reference stars coordinates from our sub images. X' is the reference stars coordinates reference image (one of the sub images normally). One T matrix for each of your sub images will transform them to the reference image coordinates.

    The Ttot will do a affine transformation, all the three transformations above, to that we need three reference stars. It will not correct optical distortion.

    X coordinates (reference star in sub image)
    x1 x2 x3
    y1 y2 y3
    1 1 1

    X' coordinates (reference star in reference image)
    x'1 x'2 x'3
    y'1 y'2 y'3
    1 1 1

    Each column are the coordinates of the center of a reference star, x1, y1 and x'1, y'1 and so on should align on each other after the transformation (align) process.

    Inverse matrix:

    Now one problem, we need to know how to calculate the matrix T, its internal figures.

    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), se above.

    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.

    Ad / Annons:


    Determinant is another mathematical tool we need to find out the X-1 that we need to calculate T.

    More information about Determinant:

  • Determinant, Wiki/
  • Coming more later.

    AstroImageJ doesn't have any matrix functions so I have to build loops to take care of that. Matlab which I have worked with earlier has most matrix function that is needed and everything get much easier. It will not be an easy task so this is a long time project. But if I succeed in this I can develop my own macros and do it exactly the way I want so it will be worth to spend that time on it, even better if I later can develop the functions in Java, but Java is new for me.