OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Wed, 18 Nov 2015 02:48:11 -06002x3 Transformation Matrixhttp://answers.opencv.org/question/19146/2x3-transformation-matrix/Hi,
i would like to know how to read the information of a 2x3 Transformation Matrix.
If i am right, it contains the rotation, the translation x/y and the scale x/y.
But what is the sixth value used for ?
I need to read the rotation from the matrix in RAD or DEG.
I hope someone can explain me the 2x3 Transformation Matrix a little more detailed.
Tue, 20 Aug 2013 03:36:56 -0500http://answers.opencv.org/question/19146/2x3-transformation-matrix/Answer by engine for <p>Hi,</p>
<p>i would like to know how to read the information of a 2x3 Transformation Matrix.
If i am right, it contains the rotation, the translation x/y and the scale x/y.
But what is the sixth value used for ?</p>
<p>I need to read the rotation from the matrix in RAD or DEG.</p>
<p>I hope someone can explain me the 2x3 Transformation Matrix a little more detailed.</p>
http://answers.opencv.org/question/19146/2x3-transformation-matrix/?answer=19147#post-id-19147the transformation matrix contain the relationship between the x' and y' in the image coordinate system and the real world coordinate system which is 3 dimensional ! Tue, 20 Aug 2013 04:33:59 -0500http://answers.opencv.org/question/19146/2x3-transformation-matrix/?answer=19147#post-id-19147Comment by coolece for <p>the transformation matrix contain the relationship between the x' and y' in the image coordinate system and the real world coordinate system which is 3 dimensional ! </p>
http://answers.opencv.org/question/19146/2x3-transformation-matrix/?comment=76595#post-id-76595how to get an affine transform based on 6 co-ordinate points?Wed, 18 Nov 2015 02:48:11 -0600http://answers.opencv.org/question/19146/2x3-transformation-matrix/?comment=76595#post-id-76595Answer by Michael Burdinov for <p>Hi,</p>
<p>i would like to know how to read the information of a 2x3 Transformation Matrix.
If i am right, it contains the rotation, the translation x/y and the scale x/y.
But what is the sixth value used for ?</p>
<p>I need to read the rotation from the matrix in RAD or DEG.</p>
<p>I hope someone can explain me the 2x3 Transformation Matrix a little more detailed.</p>
http://answers.opencv.org/question/19146/2x3-transformation-matrix/?answer=19155#post-id-19155Sixth value is for [shear](http://mathworld.wolfram.com/Shear.html). Affine transformation (the most general transformation that can be expressed by 2x3 matrix) has rotation, shear, scale x/y, and translation x/y. See [this](http://mathworld.wolfram.com/AffineTransformation.html) for more details.
Now about your other question. Your assumption is not entirely correct. Rotation, translation, scale or shear are not stored in Transformation Matrix. Lets assume you have 2x3 transformation matrix A.
A = ( (a(0,0),a(0,1),a(0,2)), (a(1,0),a(1,1),a(1,2)) )
Now you want to apply A on point (x,y). Resulting point is this one:
x_new = a(0,0)*x + a(0,1)*y + a(0,2)
y_new = a(1,0)*x + a(1,1)*y + a(1,2)
As you can see none of values of A is actually rotation or scale.
Also it is important to remember that 2x3 matrix don't have to be affine. It can be some simpler transformation as well (rigid, scale, similarity, and so on). For example if a(0,0) = a(1,1) = 1 and a(0,1) = a(1,0) = 0, than your transformation is just translation.
[Here](http://math.stackexchange.com/questions/13150/extracting-rotation-scale-values-from-2d-transformation-matrix) I saw very good answer about how to calculate rotation, scale, and translation from transformation matrix. I don't remember how to extract shear, but if you don't have it this will be enough.Tue, 20 Aug 2013 07:01:15 -0500http://answers.opencv.org/question/19146/2x3-transformation-matrix/?answer=19155#post-id-19155