1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Derive parameters from transform matrix

  1. Jun 8, 2015 #1
    Hello everybody,
    Sorry to ask you something that may be easy for you but I'm stuck.
    For example I have 2 images (size 2056x2056). One image of reference and the other is the same rotated from -90degrees.
    Using a program with keypoints, it gives me a transform matrix :
    a=2.056884522e+03 b=1.153333964e-04 c=-9.999797329e-01
    d=1.767228039e-01 e=9.998105577e-01 f=4.144966751e-06.

    Now I try to recover the transform parameters : translation, rotation and scale.
    For rotation I have :
    θ = atan2(c, b) = -89.99
    For scale :
    scale = sqrt(b * b + c * c) = 1.0

    But for translation I'm stuck.
    In a system transformation where rotation is negligeable, it's easy because a and d describe the translation between the two systems with dx = a and dy = -d but here, it is not negligeable and I should find
    dx = 0.0
    dy = 0.0

    Could you help me ?

    Best regards,
    lock
     
    Last edited: Jun 8, 2015
  2. jcsd
  3. Jun 8, 2015 #2

    DEvens

    User Avatar
    Education Advisor
    Gold Member

    Welcome to the forum.

    I am not familiar with the system you are using. Could you explain a bit what the variables a through f are about? Maybe you could give a little context.
     
  4. Jun 8, 2015 #3
    Hello, thanks for trying to help me.
    This is a linear transformation between coordinates (x, y) and (x', y'):

    x' = A + Bx + Cy
    y' = D + Ex + Fy

    a, d: describe the translation between the two systems
    b,c,d,e: describe rotation and magnification

    magnification = sqrt(b*b + c*c);
    rotation angle = atan(c/b);

    The images contains stars and transformation is computed thanks to these stars.

    It is about all I know on the matrix I gave you, this is why it is difficult for me
     
    Last edited: Jun 8, 2015
  5. Jun 8, 2015 #4

    DEvens

    User Avatar
    Education Advisor
    Gold Member

    I think your A and D are wrong by a lot. Your B and F are off a little. Your C and E seem to be pretty close.

    You should be getting something like A, D, B, and F are all zero, C should be -1, E should be 1.

    Maybe your calculation does not deal with 90 degree angles correctly. How did you get these values?
     
  6. Jun 8, 2015 #5
  7. Jun 9, 2015 #6

    A.T.

    User Avatar
    Science Advisor
    Gold Member

    If the rotation is around the image center, then the translation of the origin in a corner is certainly not zero.
     
  8. Jun 9, 2015 #7

    DEvens

    User Avatar
    Education Advisor
    Gold Member

    The page you cite seems to be describing a utility to detect scaling, translation, and rotation of astronomical images. It's an interesting problem because two astronomical images do not necessarily come with the same magnification, orientation, or centre.

    The values you quoted in your first post are not in the link you gave. For example, nowhere on that page will you find 2.05, nor 1.1. So it's unclear where you got these numbers.

    Also, it would seem that by "rotated from -90degrees" you meant scaled, rotated, and translated from the original set of coordinates. I presumed you meant rotated by 90 degrees. I was wrong. You meant transformed by some arbitrary amount in each of these three different fashions.

    It looks like you can just read off the translation. They are the A and D values. If it was pure translation, no rotation and no scale, then B and F would be 1, C and E would be 0. And A and D would be pure translation. With B, C, E, and F values other than that, it is a scale and rotation followed by a translation by the values of A and D.
     
  9. Jun 10, 2015 #8
    Hello.

    Thanks for your answers.
    I've found my mistakes. In fact, I was just forgetting the position of the center of rotation. I was (stupidly) thinking it was in the center of the image in the algorithm I gave you. But it was not the case.
    Taking the center of rotation at the bottom left gave me good results :D.

    Thanks for your answers,
    I appreciate your kindness.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Derive parameters from transform matrix
Loading...