Derive parameters from transform matrix

In summary, In this conversation, the user has problems recovering rotation, translation, and scale from a system transformation between two images. Rotation is negligible, so it is easy to find translation and scale, but rotation is not easy to calculate.
  • #1
lock042
4
0
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 ?lock
 
Last edited:
Physics news on Phys.org
  • #2
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.
 
  • #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:
  • #4
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
lock042 said:
I should find
dx = 0.0
dy = 0.0
If the rotation is around the image center, then the translation of the origin in a corner is certainly not zero.
 
  • #7
lock042 said:
I assume that the values are correct. They are given by : http://spiff.rit.edu/match/match-0.16/match.html

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.
 
  • #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.
 

FAQ: Derive parameters from transform matrix

What is a transform matrix?

A transform matrix is a mathematical representation of a geometric transformation, such as translation, rotation, or scaling, in a coordinate system. It is commonly used in computer graphics and image processing to manipulate and transform objects.

How do you derive parameters from a transform matrix?

To derive parameters from a transform matrix, you need to decompose the matrix into its individual transformations, such as translation, rotation, and scaling. This can be done using various methods, such as matrix decomposition or trigonometric calculations.

What are the parameters commonly derived from a transform matrix?

The parameters commonly derived from a transform matrix include translation values (x, y, z), rotation angles (in degrees or radians), and scaling factors (x, y, z). These parameters determine how an object will be transformed in a coordinate system.

Why is it important to derive parameters from a transform matrix?

Deriving parameters from a transform matrix allows us to understand and interpret the transformations applied to an object. These parameters can also be used to recreate the original transformation or apply it to other objects, making it a crucial step in computer graphics and image processing.

What are some applications of deriving parameters from a transform matrix?

Some applications of deriving parameters from a transform matrix include computer graphics, animation, video games, virtual reality, and image processing. It is also used in robotics, motion planning, and computer vision for object recognition and tracking.

Similar threads

Replies
7
Views
949
Replies
1
Views
744
Replies
9
Views
1K
Replies
18
Views
2K
Replies
16
Views
4K
Replies
4
Views
1K
Replies
2
Views
2K
Back
Top